• 电子沙盘数字沙盘大数据人工智能开发教程第16课


    电子沙盘数字沙盘大数据可视化GIS系统开发教程第16课:新增加属性在MTGIS3d控件

      public bool ShowFLGrid;//是否显 示方里网格

            public bool Atmosphere;//是否显示大气圈。(因为WPF不支持shader功能,所以效果嘛。。。)

    在SDK中为了方便三方数据的接入,引入了一个用户层接口。主要是完成三方数据的接入,含动态数据(如GPS),用户可自行控制UI及UI的交互,可实现如滴滴打车的车辆控制,公安应用中的UI按属性控制显示,并且该用户层的显示是由核心部分直接调用,在需要显示数据的调用下面的接口,这样可防止因为用户是从外部接入。而卡顿,影响用户使用体验。而UI的回收是由核心负责,不需要用户干预,二次开发时用户只用关心自己要承现的UI,及UI的交互:

         public interface UserGisData : INotifyPropertyChanged
        {
     
     
            NewGisBiao.Base.JunBiao.CenteType BiaoCenterType
            {
                get;  //这个UI对象的中心点类型
            }
     
            string LayName {
                get; //用户层名称
             
            }
     
         
     
     
            ///


            /// 标签整体缩放
            ///

            double  MScal
            {
                get; //UI整体缩放参数
            }
     
     
            Dictionary DrawObject
           {
               get;  //访问当前已经存在UI对象
               set;
           }
     
            ///
            /// 是否显示
            ///

           bool ISShow
           {
               get;  //隐藏和显示该用户层
               set;
           }
     
            ///
            /// 最小显示层
            ///

           int MinZoom
           {
               get;  //该用户层的最小显示层
               set;
           }
     
            ///
            /// 最大显示层
            ///

           int MaxZoom
           {
               get; //该用户层的最大显示层
               set;
           }
     
     
     
     
            ///
            /// 返回一个图标表示这个层的图标
            ///

            System.Windows.Media.Imaging.BitmapImage MICon
            {
                get;
            }
            ///
            /// 
            ///

            /// 查询中心点经度(如果没有会传入null)
            /// 查询中心点纬度(如果没有会传入null)
            /// 查询的信息(如果是全部会传入*)
            /// 范围(如果没有会传入null)
            ///
            Dictionary SechPro(double centerx, double centery, string info, double length);
     
            Dictionary SechForLine(List Line, string info, double length);
            Dictionary SechForRect(List Line, string info, double length);
     
            ///
            /// 画用户物体
            ///

            ///
            ///
            ///
            List DrawData(double centerx, double centery);
     
     
            void OnUserBiaoClick(DrawPointData va); //UI点击的事件,现已作废,UI可自行响应所有交互事件
     
     
     
        }

    List DrawData(double centerx, double centery); 为该接口的核心部分,传入参数为当前地图的中心 点经纬度,根据这个经纬度,二次开发用户需要从 数据(如mysql或者其它三方数据中)查询当前需要显示范围的 数据,并连通UI一起返回:例子如下:

     List UserGisData.DrawData(double centerx, double centery)
            {
     
                if (Con == null)
                {
                    Con = new MySql.Data.MySqlClient.MySqlConnection(IniRead.IniReadWrite.GetMySqlDataConnstring());
                    Con.Open();
                }
     
                int mmzoom = IniRead.IniReadWrite.MPareant.Zoom;
                int drawfanwei = 5;
                double bx, by, ex, ey;
                Int64 cx, cy;
                NewGisBiao.Help.MathHelp.MyConver(centerx, centery, out cx, out cy, (int)mmzoom - 1);
                NewGisBiao.Help.MathHelp.MyConver2(cx - drawfanwei, cy - drawfanwei, (int)mmzoom - 1, out bx, out by);
                NewGisBiao.Help.MathHelp.MyConver2(cx + drawfanwei, cy + drawfanwei, (int)mmzoom - 1, out ex, out ey);
                string t6 = " where (jingdu > " + bx.ToString() + " and jingdu<"
                                   + ex.ToString() + " and weidu > "
                                   + ey.ToString() + " and weidu < "
                                   + by + ")";
                MySqlCommand cmd = Con.CreateCommand();
                cmd.CommandText = "select * from gw_shigu" + t6;
                MySqlDataReader read = cmd.ExecuteReader();
     
                try
                {
     
     
                    if (read.HasRows)
                    {
                        List y1 = new List();
                        while (read.Read())
                        {
                            if (MData.ContainsKey(read["number"].ToString() + "A") == false)
                            {
     
                                DrawPointData u1 = new DrawPointData();
     
                                u1.ISAutoAngle = true;
                                u1.ISAutoScal = true;
                                u1.MaxZoomScal = 15;
     
     
                                u1.ID = read["number"].ToString() + "A";
                                u1.MPoint = new Point(Convert.ToDouble(read["jingdu"].ToString()), Convert.ToDouble(read["weidu"].ToString()));
                                Image h1 = new Image();
                                u1.Hi = 0.05;
                                h1.Width = 45;
                                h1.Height = 70;
                                if (read["sgtype"].ToString().Trim() == "重伤")
                                    h1.Source = new BitmapImage(new Uri(AppDomain.CurrentDomain.BaseDirectory + "\\res\\重伤.png"));
                                if (read["sgtype"].ToString().Trim() == "轻伤")
                                    h1.Source = new BitmapImage(new Uri(AppDomain.CurrentDomain.BaseDirectory + "\\res\\轻伤.png"));
                                if (read["sgtype"].ToString().Trim() == "无伤")
                                {
                                    BitmapImage u11 = new BitmapImage(new Uri(AppDomain.CurrentDomain.BaseDirectory + "\\res\\无伤.png"));
                                    h1.Source = u11;
                                    h1.Width = u11.Width;
                                    h1.Height = u11.Height;
                                }
                                h1.Stretch = Stretch.Fill;
     
     
                                h1.Tag = read["number"].ToString() + ";" + u1.MPoint.X.ToString() + ";" + u1.MPoint.Y.ToString();
                                u1.UIObject = h1;
                                y1.Add(u1);
                            }
                        }
                        read.Close();
                      
                        return y1;
                    }
                    read.Close();
                    return null;
                }
                catch
                {
                    read.Close();
                    return null;
                }
     
     
     
     
            }
    上面的方法主要是从接口返回的中心点得到一 个范围内的用户数据,并根据用户的属性创建不同的UI,
    ————————————————

  • 相关阅读:
    学生HTML网页作业作品:HTML+CSS网站设计与实现【红色喜庆邀请函 3页】
    C 语言与 C++ 语言中全局变量重新声明的行为差异
    【Unity】Unity3D 车位售卖系统制作实例(一)系统介绍及相机控制器
    2022杭电多校七 1007-Weighted Beautiful Tree(树形DP)
    你的工具包已到货「GitHub 热点速览 v.22.31」
    从零开始构建一个电影知识图谱,实现KBQA智能问答[上篇]:本体建模、RDF、D2RQ、SPARQL endpoint与两种交互方式详细教学
    第22章 软件安装 RPM/ YUM
    计算机毕业设计Python+djang的疫情防控下医院人员调动系统(源码+系统+mysql数据库+Lw文档)
    PyQt(学习笔记)
    十分钟学习 TypeScript
  • 原文地址:https://blog.csdn.net/qq_37897462/article/details/133754671