Пример #1
0
        void drawBuffer_DrawComplete(object sender, DrawEventArgs e)
        {
            if (e.Geometry == null)
            {
                return;
            }

            Graphic graphic = new Graphic()
            {
                Geometry = e.Geometry, Symbol = activeSymbolBuffer
            };

            switch (e.Geometry.GetType().Name)
            {
            case "Polyline":    //根据画线类型,如果为line类型,则对line添加buffer
                BufferParameters bufferParams = new BufferParameters()
                {
                    BufferSpatialReference = new SpatialReference(102113), OutSpatialReference = new SpatialReference(4326), Unit = LinearUnit.Meter
                };
                bufferParams.Distances.Add(PublicParams.BufferRadius);
                bufferParams.Features.Add(graphic);
                GeoServHelper gshPolyline = new GeoServHelper();
                gshPolyline.geometryTask.BufferAsync(bufferParams);
                break;

            case "Polygon":
                this.Dispatcher.BeginInvoke(new Action(() => {
                    GeoServHelper gshPolygon = new GeoServHelper();
                    gshPolygon.ExecuteAsyncQueryForDrawing(e.Geometry, PublicParams.urlCamerasLayer);
                }));
                break;

            default:
                break;
            }
            MapLayers.AddGraphicToGLayerByLayerID(graphic, PublicParams.gLayerDrawing);

            MapMethods.SendGraphic(graphic);//同步画线到大屏
            drawBuffer.DrawMode = DrawMode.None;
            PublicParams.pubCanvasChild1.BeginStoryboard(App.Current.FindResource("StoryboardForPadCamerasOpen") as Storyboard);
            MapMethods.SendOpenPadVideos();//大屏同步弹出视频背景板
        }
Пример #2
0
        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)
            {
            }
        }
Пример #3
0
        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);
                }
            }
        }