Ejemplo n.º 1
0
        void _geometryTask_DensifyCompleted(object sender, GraphicsEventArgs e)
        {
            GraphicsLayer graphicsLayerLine = GlobalLayers._MainMap.Layers["graphicsLayerLine"] as GraphicsLayer;

            foreach (Graphic g in e.Results)
            {
                Polyline p = g.Geometry as Polyline;
                foreach (PointCollection pc in p.Paths)
                {
                    foreach (MapPoint point in pc)
                    {
                        Graphic newPoint = new Graphic()
                        {
                            Symbol   = App.Current.Resources["NewMarkerSymbol"] as Symbol,
                            Geometry = point
                        };
                        graphicsLayerLine.Graphics.Add(newPoint);

                        Graphic biggerNewPoint = new Graphic()
                        {
                            Symbol   = App.Current.Resources["BiggerNewMarkerSymbol"] as Symbol,
                            Geometry = GeometryFunc.GetEllipseGraphic(searchRadius / (106 * 1000), point)//这里是米换算为经度,使用已存在的方法Mark
                        };
                        alPoints.Add(biggerNewPoint);
                    }
                }
            }
            threadPointsRun = new Thread(new ThreadStart(PointsRun));
            threadPointsRun.Start();
        }
Ejemplo n.º 2
0
        // 车辆动态跟踪查询
        // 车辆的位置点由接收GPS位置线程更新到GLOBALLAYERS.MAINX,MAINY
        // 每次循环查询车辆位置周边的视频,并发送打开指令到GQY的视频端口
        // 打开的视频如果不在车辆覆盖范围,到定时时间自动关闭

        public void AsyncLoop()
        {
            Graphic Effect = null;

            //   GlobalLayers.DynamicGraphicLayer.ClearGraphics();      // 动态特效的位置点
            while (true)
            {
                if (PublicVARS.MainGPS != null && PublicVARS.MainX != 0.0) // 有跟踪点
                {
                    double Radius = PublicVARS.Distance / (106 * 1000);    // 米换算为经纬度

                    if (PublicVARS.TESTMODE)                               // 测试模式时,X 自动加
                    {
                        PublicVARS.MainX += 0.00005;
                    }

                    Geometry SearchG = GeometryFunc.GetEllipseGraphic(Radius, new MapPoint(PublicVARS.MainX, PublicVARS.MainY));

                    GlobalLayers._MainMap.Dispatcher.Invoke(              // 此结构是WIN GUI 处理多线程修改界面元素的保护
                        new Action(
                            delegate
                    {
                        Graphic TrackPoint  = new Graphic();                                        // 轨迹点
                        TrackPoint.Geometry = new MapPoint(PublicVARS.MainX, PublicVARS.MainY);
                        TrackPoint.Symbol   = App.Current.Resources["CarPositionSymbol"] as Symbol; // 红点轨迹点
                        GlobalLayers.DynamicResultGraphicLayer.Graphics.Add(TrackPoint);


                        if (Effect == null)
                        {
                            Effect                  = new Graphic();                             // 特效位置点
                            Effect.Symbol           = App.Current.Resources["NEWGPS"] as Symbol; // 设定特效点符号
                            Effect.Attributes["ID"] = "EFFECT";
                        }
                        Effect.Geometry = new MapPoint(PublicVARS.MainX, PublicVARS.MainY); // 更新特效点位置
                        if (mapcontrol.getMapG("EFFECT", GlobalLayers.DynamicGraphicLayer) == null)
                        {
                            GlobalLayers.DynamicGraphicLayer.Graphics.Add(Effect);
                        }


                        // 显示查询覆盖区域

                        Graphic finder = null;
                        foreach (Graphic CB in GlobalLayers.DynamicGraphicLayer)    // 查找有没上一次显示的区域,没有做插入,没有做更新
                        {
                            if (CB.Attributes.ContainsKey("ID"))
                            {
                                if (CB.Attributes["ID"].ToString() == "AREA")
                                {
                                    finder = CB;
                                    break;
                                }
                            }
                        }
                        if (finder != null)
                        {
                            finder.Geometry = SearchG;
                        }
                        else
                        {
                            Graphic SearchArea          = new Graphic();
                            SearchArea.Geometry         = SearchG;
                            SearchArea.Attributes["ID"] = "AREA";

                            SearchArea.Symbol = App.Current.Resources["CarBufferSymbol"] as ESRI.ArcGIS.Client.Symbols.Symbol;
                            GlobalLayers.DynamicGraphicLayer.Graphics.Add(SearchArea);
                        }
                    }
                            ));
                    // 做周边查询

                    GlobalLayers._MainMap.Dispatcher.Invoke(              // 此结构是WIN GUI 处理多线程修改界面元素的保护
                        new Action(
                            delegate
                    {
                        //QueryLayer QL = new QueryLayer(SearchG, "CJ_SP_PT", "DynamicResultGraphicLayer");
                        //QL.Do();
                        //        QWB.SetBuffGeom(new MapPoint(GlobalLayers.MainX, GlobalLayers.MainY));  // 设定新的查询点
                        //        QWB.ProcessBuffer();

                        if (PublicVARS.MainVID != null && PublicVARS.MainVID != "")    // 车载视频
                        {
                            GlobalLayers._gqyvideocontrol.OpenVID(PublicVARS.MainVID, new MapPoint(PublicVARS.MainX, PublicVARS.MainY));
                        }


                        GlobalLayers._gqyvideocontrol.FlushEnd();   // 检查是否有到设定时间的视频,并关闭之
                    }
                            ));
                }
                Thread.Sleep(3000);
            }
        }