Exemplo n.º 1
0
        private void DrawCase(JObject json)
        {
            try
            {
                Geometry geoCase = new MapPoint(Convert.ToDouble(json["ZDDWXZB"].ToString()), Convert.ToDouble(json["ZDDWYZB"].ToString()), new SpatialReference(4326));
                Graphic  gCase   = new Graphic()
                {
                    Symbol = PublicParams.symbolCase, Geometry = geoCase
                };
                gCase.Attributes.Add("BJLBMC", json["BJLXMC"].ToString().Trim());
                gCase.Attributes.Add("BJSJ", Convert.ToDateTime(json["BJSJ"].ToString()).ToString("yyyy-MM-dd HH:mm"));
                MapLayers.AddGraphicToGLayerByLayerID(gCase, PublicParams.gLayerCase);

                ////LPY 2016-4-14 添加 新案件点周围视频点自动查找和播放
                //GraphicsLayer glCase = MapLayers.GetGraphicsLayerByID(PublicParams.gLayerCase);
                //if (glCase == null || glCase.Visible == false)
                //    return;
                //MapLayers.ClearGLayerByID(PublicParams.gLayerSearchCamerasNearCrime);//清空图层
                //MapMethods.SendClearGraphicsLayerByID(PublicParams.gLayerSearchCamerasNearCrime);

                //Geometry geoSearch = MapMethods.GetEllipseGeometry(PublicParams.SearchRadius / (106 * 1000), geoCase as MapPoint);

                //GeoServHelper gsh = new GeoServHelper();
                //gsh.ExecuteAsyncQueryForCasePoint(geoSearch, PublicParams.urlCamerasLayer);

                //PublicParams.pubCanvasChild1.BeginStoryboard(App.Current.FindResource("StoryboardForPadCamerasOpen") as System.Windows.Media.Animation.Storyboard);

                //Graphic gSearch = new Graphic() { Symbol = PublicParams.symbolSearchCameras, Geometry = geoSearch };
                //MapLayers.AddGraphicToGLayerByLayerID(gSearch, PublicParams.gLayerSearchCamerasNearCrime);
                //MapMethods.SendGraphicSearchCameras(gSearch);
            }
            catch (Exception)
            {
            }
        }
Exemplo n.º 2
0
        void geometryTask_BufferCompleted(object sender, GraphicsEventArgs e)
        {
            if (e.Results.Count <= 0)
            {
                PublicParams.listCameras.Clear();//清空列表
                return;
            }

            Graphic bufferGraphic = new Graphic();

            bufferGraphic.Geometry = e.Results[0].Geometry;
            ExecuteAsyncQueryForDrawing(e.Results[0].Geometry, PublicParams.urlCamerasLayer);//查找视频点
            bufferGraphic.Symbol = App.Current.Resources["DefaultFillSymbol"] as ESRI.ArcGIS.Client.Symbols.Symbol;
            MapLayers.AddGraphicToGLayerByLayerID(bufferGraphic, PublicParams.gLayerDrawing);
            MapMethods.SendGraphic(bufferGraphic);
        }
Exemplo n.º 3
0
        void consumerCases_Listener(IMessage message)
        {
            ITextMessage msg = (ITextMessage)message;

            PublicParams.pubMainMap.Dispatcher.Invoke(new Action(delegate
            {
                JObject json = JObject.Parse(msg.Text);
                if (json["JJDBH"].ToString() == "00000")//演示用的程序会推送一些编号为00000的数据,清空案件图层
                {
                    MapLayers.ClearGLayerByID(PublicParams.gLayerCase);
                    MapMethods.SendClearGraphicsLayerByID(PublicParams.gLayerCase);
                    return;
                }

                DrawCase(json);
            }));
        }
Exemplo n.º 4
0
        private void ShowTextSymbolByGraphic(Graphic graphic, string result)
        {
            MapLayers.AddGraphicToGLayerByLayerID(graphic, PublicParams.gLayerLengthOrArea);

            double     xCenter   = (graphic.Geometry.Extent.XMax + graphic.Geometry.Extent.XMin) / 2;
            double     yCenter   = (graphic.Geometry.Extent.YMax + graphic.Geometry.Extent.YMin) / 2;
            MapPoint   mpCenter  = new MapPoint(xCenter, yCenter, graphic.Geometry.SpatialReference);
            TextSymbol txtSymbol = PublicParams.textSymbol;

            Graphic gResult = new Graphic()
            {
                Geometry = mpCenter, Symbol = txtSymbol
            };

            gResult.Attributes["Result"] = result;
            gResult.SetZIndex(2);
            MapLayers.AddGraphicToGLayerByLayerID(gResult, PublicParams.gLayerLengthOrArea);

            //发送到大屏
            MapMethods.SendLengthOrAreaResult(graphic, result, graphic.Geometry.GetType().Name);
        }
Exemplo n.º 5
0
        private void DrawPoliceCarByJson(JObject json)
        {
            try
            {
                Graphic gPoliceCar = MapLayers.GetGraphicFromGLayerByID("TITLE", json["TITLE"].ToString(), PublicParams.gLayerPoliceCarGPS);
                if (gPoliceCar != null)
                {
                    gPoliceCar.Geometry        = new MapPoint((double)json["X"], (double)json["Y"], new SpatialReference(4326));
                    gPoliceCar.Attributes["X"] = (double)json["X"];
                    gPoliceCar.Attributes["Y"] = (double)json["Y"];
                    MapLayers.RefreshGLayerByID(PublicParams.gLayerPoliceCarGPS);

                    if (PublicParams.pubInfoWin.IsOpen == true && PublicParams.pubInfoWin.Content == gPoliceCar.Attributes)
                    {
                        PublicParams.pubInfoWin.Anchor = gPoliceCar.Geometry as MapPoint;
                    }
                }
                else//不存在该车辆,先添加该车辆到地图上
                {
                    MapPoint mpGPS   = new MapPoint((double)json["X"], (double)json["Y"], new SpatialReference(4326));
                    Symbol   sGPS    = App.Current.Resources["PoliceCarOnline"] as Symbol;
                    Graphic  gNewCar = new Graphic()
                    {
                        Symbol = sGPS, Geometry = mpGPS
                    };
                    gNewCar.Attributes.Add("TITLE", json["TITLE"].ToString());
                    gNewCar.Attributes.Add("HH", json["HH"].ToString());//呼号
                    gNewCar.Attributes.Add("Class", "PoliceCar");
                    gNewCar.Attributes.Add("X", (double)json["X"]); gNewCar.Attributes.Add("Y", (double)json["Y"]);
                    MapLayers.AddGraphicToGLayerByLayerID(gNewCar, PublicParams.gLayerPoliceCarGPS);
                    MapLayers.RefreshGLayerByID(PublicParams.gLayerPoliceCarGPS);
                }
            }
            catch (Exception)
            {
            }
        }
Exemplo n.º 6
0
        private FeatureLayer flRoad;         //道路
        public Traffic()
        {
            try
            {
                flTrafficLight = MapLayers.GetFeatureLayerByID(PublicParams.fLayerTrafficLight);
                flRoad         = MapLayers.GetFeatureLayerByID(PublicParams.fLayerRoad);
                if (flTrafficLight == null || flRoad == null)
                {
                    return;
                }
            }
            catch (Exception)
            {
                LogHelper.WriteLog("Traffic初始化错误!");
                return;
            }

            flTrafficLight.OutFields = new OutFields {
                "*"
            };
            flRoad.OutFields = new OutFields {
                "*"
            };

            ClassBreaksRenderer cbrTrafficLight = new ClassBreaksRenderer();//红绿灯

            cbrTrafficLight.Field = "DLD_STATUS";
            ClassBreakInfo cbiRed = new ClassBreakInfo()
            {
                MinimumValue = 0, MaximumValue = 0, Symbol = PublicParams.symbolRedLight
            };
            ClassBreakInfo cbiYellow = new ClassBreakInfo()
            {
                MinimumValue = 1, MaximumValue = 1, Symbol = PublicParams.symbolYellowLight
            };
            ClassBreakInfo cbiGreen = new ClassBreakInfo()
            {
                MinimumValue = 2, MaximumValue = 2, Symbol = PublicParams.symbolGreenLight
            };

            cbrTrafficLight.Classes.Add(cbiRed); cbrTrafficLight.Classes.Add(cbiYellow); cbrTrafficLight.Classes.Add(cbiGreen);
            flTrafficLight.Renderer = cbrTrafficLight;

            ClassBreaksRenderer cbrRoad = new ClassBreaksRenderer();//道路

            cbrRoad.Field = "DL_COUNT";
            ClassBreakInfo cbiFree = new ClassBreakInfo()
            {
                MinimumValue = 0, MaximumValue = 100, Symbol = PublicParams.roadFreeSymbol
            };
            ClassBreakInfo cbiNormal = new ClassBreakInfo()
            {
                MinimumValue = 101, MaximumValue = 200, Symbol = PublicParams.roadNormalSymbol
            };
            ClassBreakInfo cbiBusy = new ClassBreakInfo()
            {
                MinimumValue = 201, MaximumValue = 1000, Symbol = PublicParams.roadBusySymbol
            };

            cbrRoad.Classes.Add(cbiFree); cbrRoad.Classes.Add(cbiNormal); cbrRoad.Classes.Add(cbiBusy);
            flRoad.Renderer = cbrRoad;

            Task taskInitTrafficLight = new Task(InitTrafficLight);

            taskInitTrafficLight.Start();

            Task taskInitRoad = new Task(InitRoad);

            taskInitRoad.Start();
        }