コード例 #1
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);
                }
            }
        }