void consumer_Listener(IMessage message) { ITextMessage msg = (ITextMessage)message; PublicParams.pubMainMap.Dispatcher.Invoke(new Action(delegate{ //tbTest.Text = msg.Text; JObject json = JObject.Parse(msg.Text); if (json["JJDBH"].ToString() == "00000")//演示用的程序会推送一些编号为00000的数据 { MapLayers.ClearGLayerByID(PublicParams.gLayerCrimePoint); return; } Case newcase = new Case(json); DrawCase(json); LoopQueue(newcase); UpdateNewest(newcase); })); }
private void Tools_Click(object sender, RoutedEventArgs e) { //Button btnMain = sender as Button; switch ((sender as Button).Tag.ToString()) { case "DrawCircle": drawBuffer.DrawMode = DrawMode.Circle; activeSymbolBuffer = PublicParams.fillSymbol; break; case "DrawEllipse": drawBuffer.DrawMode = DrawMode.Ellipse; activeSymbolBuffer = PublicParams.fillSymbol; break; case "DrawFreehandLine": drawBuffer.DrawMode = DrawMode.Freehand; activeSymbolBuffer = PublicParams.lineSymbol; break; case "DrawPolyline": drawBuffer.DrawMode = DrawMode.Polyline; activeSymbolBuffer = PublicParams.lineSymbol; break; case "DrawPolygon": drawBuffer.DrawMode = DrawMode.Polygon; activeSymbolBuffer = PublicParams.fillSymbol; break; case "DrawRectangle": drawBuffer.DrawMode = DrawMode.Rectangle; activeSymbolBuffer = PublicParams.fillSymbol; break; default: drawBuffer.DrawMode = DrawMode.None; MapLayers.ClearGLayerByID(PublicParams.gLayerDrawing); MapMethods.SendClearBufferLayer(); //清除大屏BufferLayer上的Buffers break; } drawBuffer.IsEnabled = (drawBuffer.DrawMode != DrawMode.None); }
private void DrawCase(JObject json) { try { Symbol sCase = App.Current.Resources["pmsForCase"] as Symbol; Geometry geoCase = new MapPoint(Convert.ToDouble(json["ZDDWXZB"].ToString()), Convert.ToDouble(json["ZDDWYZB"].ToString()), new SpatialReference(4326)); Graphic gCase = new Graphic() {Symbol=sCase,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); Symbol sCrimePoint = App.Current.Resources["CrimePointSymbol"] as Symbol; Geometry geoCrimePoint = new MapPoint(Convert.ToDouble(json["ZDDWXZB"].ToString()), Convert.ToDouble(json["ZDDWYZB"].ToString()), new SpatialReference(4326)); Graphic gCrimePoint = new Graphic() { Symbol = sCrimePoint, Geometry = geoCrimePoint }; MapLayers.ClearGLayerByID(PublicParams.gLayerCrimePoint); MapLayers.AddGraphicToGLayerByLayerID(gCrimePoint, PublicParams.gLayerCrimePoint); } catch (Exception) { } }
private void UserTools_Click(object sender, RoutedEventArgs e) { Button btnMain = sender as Button; switch (btnMain.Tag.ToString()) { case "OpenTools": borMapTools.BeginStoryboard(App.Current.FindResource("StoryboardForToolsOpen") as Storyboard); btnMain.Style = this.FindResource("btnRight") as Style; btnMain.Tag = "CloseTools"; break; case "CloseTools": borMapTools.BeginStoryboard(App.Current.FindResource("StoryboardForToolsClose") as Storyboard); btnMain.Style = this.FindResource("btnLeft") as Style; btnMain.Tag = "OpenTools"; break; case "OpenUserTools": borMapUserTools.BeginStoryboard(App.Current.FindResource("StoryboardForUserToolsOpen") as Storyboard); btnMain.Style = this.FindResource("btnRight") as Style; btnMain.Tag = "CloseUserTools"; break; case "CloseUserTools": borMapUserTools.BeginStoryboard(App.Current.FindResource("StoryboardForUserToolsClose") as Storyboard); btnMain.Style = this.FindResource("btnLeft") as Style; btnMain.Tag = "OpenUserTools"; break; default: drawLenOrArea.DrawMode = DrawMode.None; MapLayers.ClearGLayerByID(PublicParams.gLayerLengthOrArea); MapMethods.SendClearLengthOrAreaLayer(); break; } }
private void ShowInfoWinByClickOrTouch(Point screenPnt) { GeneralTransform generalTransform = mainMap.TransformToVisual(Application.Current.MainWindow); Point transformScreenPnt = generalTransform.Transform(screenPnt); foreach (FeatureLayer featureLayer in PublicParams.listFLayer) { if (featureLayer != null && featureLayer.Visible == true) { IEnumerable <Graphic> selectedFLayer = featureLayer.FindGraphicsInHostCoordinates(transformScreenPnt); foreach (Graphic graphic in selectedFLayer) { //mainInfoWindow.Anchor = e.MapPoint; mainInfoWindow.Anchor = graphic.Geometry as MapPoint; mainInfoWindow.IsOpen = true; mainInfoWindow.ContentTemplate = this.FindResource("DT" + graphic.Attributes["Class"].ToString()) as DataTemplate; mainInfoWindow.Content = graphic.Attributes; MapMethods.SendOpenInfoWindow(graphic); return; } } } GraphicsLayer graphicsLayerPoliceCar = MapLayers.GetGraphicsLayerByID(PublicParams.gLayerPoliceCarGPS); if (graphicsLayerPoliceCar != null && graphicsLayerPoliceCar.Visible != false) { IEnumerable <Graphic> selectedGraphics = graphicsLayerPoliceCar.FindGraphicsInHostCoordinates(transformScreenPnt); foreach (Graphic graphic in selectedGraphics) { mainInfoWindow.Anchor = graphic.Geometry as MapPoint; mainInfoWindow.IsOpen = true; mainInfoWindow.ContentTemplate = this.FindResource("DTPoliceCar") as DataTemplate; mainInfoWindow.Content = graphic.Attributes; MapMethods.SendOpenInfoWindow(graphic); return; } } GraphicsLayer graphicsLayerCase = MapLayers.GetGraphicsLayerByID(PublicParams.gLayerCase); if (graphicsLayerCase != null && graphicsLayerCase.Visible == true) { IEnumerable <Graphic> selectedGraphics = graphicsLayerCase.FindGraphicsInHostCoordinates(transformScreenPnt); foreach (Graphic graphic in selectedGraphics) { //LPY 2016-4-14 添加 新案件点周围视频点自动查找和播放 MapLayers.ClearGLayerByID(PublicParams.gLayerSearchCamerasNearCrime);//清空图层 MapMethods.SendClearGraphicsLayerByID(PublicParams.gLayerSearchCamerasNearCrime); ESRI.ArcGIS.Client.Geometry.Geometry geoSearch = MapMethods.GetEllipseGeometry(PublicParams.SearchRadius / (106 * 1000), graphic.Geometry as MapPoint); GeoServHelper gsh = new GeoServHelper(); gsh.ExecuteAsyncQueryForCasePoint(geoSearch, PublicParams.urlCamerasLayer); PublicParams.pubCanvasChild1.BeginStoryboard(App.Current.FindResource("StoryboardForPadCamerasOpen") as System.Windows.Media.Animation.Storyboard); MapMethods.SendOpenPadVideos();//打开视频背景板 Graphic gSearch = new Graphic() { Symbol = PublicParams.symbolSearchCameras, Geometry = geoSearch }; MapLayers.AddGraphicToGLayerByLayerID(gSearch, PublicParams.gLayerSearchCamerasNearCrime); MapMethods.SendGraphicSearchCameras(gSearch); } } }
private void Button_Click(object sender, RoutedEventArgs e) { Button btn = sender as Button; switch (btn.Tag.ToString()) { case "CasePointsOff": //MapMethods.SendSwitchGraphicsLayerByID(PublicParams.gLayerCase, "1"); MapLayers.ShowHideFeatureLayerByID(PublicParams.fLayerCase, true); MapMethods.SendSwitchFeatureLayerByID(PublicParams.fLayerCase, "1"); btn.Style = App.Current.Resources["btnOn"] as Style; btn.Tag = "CasePointsOn"; break; case "CasePointsOn": //MapMethods.SendSwitchGraphicsLayerByID(PublicParams.gLayerCase, "0"); MapLayers.ShowHideFeatureLayerByID(PublicParams.fLayerCase, false); MapMethods.SendSwitchFeatureLayerByID(PublicParams.fLayerCase, "0"); btn.Style = App.Current.Resources["btnOff"] as Style; btn.Tag = "CasePointsOff"; break; case "CaseHeatMapOff": //热力图 MapLayers.ShowHideHeatMapLayerByID(PublicParams.hLayerCase, true); MapMethods.SendSwitchHeatMapLayerByID(PublicParams.hLayerCase, "1"); btn.Style = App.Current.Resources["btnOn"] as Style; btn.Tag = "CaseHeatMapOn"; break; case "CaseHeatMapOn": MapLayers.ShowHideHeatMapLayerByID(PublicParams.hLayerCase, false); MapMethods.SendSwitchHeatMapLayerByID(PublicParams.hLayerCase, "0"); btn.Style = App.Current.Resources["btnOff"] as Style; btn.Tag = "CaseHeatMapOff"; break; case "CaseTodayOff": //当日案件 MapMethods.SendSwitchWin("警情监控", "1"); MapLayers.ShowHideGraphicsLayerByID(PublicParams.gLayerCase, true); MapLayers.ShowHideGraphicsLayerByID(PublicParams.gLayerSearchCamerasNearCrime, true); btn.Style = App.Current.Resources["btnOn"] as Style; btn.Tag = "CaseTodayOn"; break; case "CaseTodayOn": MapMethods.SendSwitchWin("警情监控", "0"); MapLayers.ShowHideGraphicsLayerByID(PublicParams.gLayerCase, false); MapLayers.ShowHideGraphicsLayerByID(PublicParams.gLayerSearchCamerasNearCrime, false); MapLayers.ClearGLayerByID(PublicParams.gLayerSearchCamerasNearCrime); MapMethods.SendClearGraphicsLayerByID(PublicParams.gLayerSearchCamerasNearCrime); btn.Style = App.Current.Resources["btnOff"] as Style; btn.Tag = "CaseTodayOff"; break; case "CaseClusterOff": //聚合图 MapLayers.ShowHideClusterLayerByID(PublicParams.cLayerCase, true); MapMethods.SendSwitchClusterLayerByID(PublicParams.cLayerCase, "1"); btn.Style = App.Current.Resources["btnOn"] as Style; btn.Tag = "CaseClusterOn"; break; case "CaseClusterOn": MapLayers.ShowHideClusterLayerByID(PublicParams.cLayerCase, false); MapMethods.SendSwitchClusterLayerByID(PublicParams.cLayerCase, "0"); btn.Style = App.Current.Resources["btnOff"] as Style; btn.Tag = "CaseClusterOff"; break; default: break; } }