Exemple #1
0
        private void ShowStatisticsCommandBinding_Executed(object sender, ExecutedRoutedEventArgs e)
        {
            ViewSpot       param          = e.Parameter as ViewSpot;
            SpotStatistics spotStatistics = new SpotStatistics(param.id);

            spotStatistics.Show();
            ViewMaster.DataItemListView.SelectedIndex = -1;
        }
Exemple #2
0
        /// <summary>
        /// 构造一个回调框
        /// </summary>
        /// <param name="viewSpotInfo"></param>
        public ViewSpotCallout(ViewSpot viewSpotInfo)
        {
            InitializeComponent();

            ViewInfo         = viewSpotInfo;
            LocationDescribe = ViewInfo.pname + " " + ViewInfo.cityname + " " + ViewInfo.adminname + " " + ViewInfo.address;
            ImageUrls[0]     = ViewInfo.photourl1 ?? string.Empty;
            ImageUrls[1]     = ViewInfo.photourl2 ?? string.Empty;
            ImageUrls[2]     = ViewInfo.photourl3 ?? string.Empty;
            CurrentImageUrl  = ImageUrls[CurrentImageIndex];
        }
        /// <summary>
        /// 命令转发到覆盖面板命令
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void CommandsFreightStationToOverlayerCommandBinding_Executed(object sender, ExecutedRoutedEventArgs e)
        {
            Tuple <object, int> param    = e.Parameter as Tuple <object, int>;
            ViewSpot            viewspot = param.Item1 as ViewSpot;
            int overlayIndex             = param.Item2;

            if (viewspot != null && overlayIndex >= 0 && overlayIndex < 4)
            {
                ViewSpotViewerCommands.ShowViewSpotDetail.Execute(viewspot, Overlayers[overlayIndex].Content as UserControl);
            }
        }
Exemple #4
0
        private void ShowViewSpotDetailCommandBinding_Executed(object sender, ExecutedRoutedEventArgs e)
        {
            ViewSpot param = e.Parameter as ViewSpot;

            ViewDetail.DetailShowItem  = param;
            ViewDetail.ImageUrls[0]    = ViewDetail.DetailShowItem.photourl1 ?? string.Empty;
            ViewDetail.ImageUrls[1]    = ViewDetail.DetailShowItem.photourl2 ?? string.Empty;
            ViewDetail.ImageUrls[2]    = ViewDetail.DetailShowItem.photourl3 ?? string.Empty;
            ViewDetail.CurrentImageUrl = ViewDetail.ImageUrls[ViewDetail.CurrentImageIndex];
            CurrentGrid = CurrentPanel.Detail;
        }
        /// <summary>
        /// 在地图上添加要素命令执行函数
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void ShowFeatureOnMapCommandBinding_Executed(object sender, ExecutedRoutedEventArgs e)
        {
            Dictionary <string, object> param           = e.Parameter as Dictionary <string, object>;
            GraphicsOverlay             graphicsOverlay = ArcGISMapView.PointOverlay;
            MapPoint location = new MapPoint((double)param["Lng"], (double)param["Lat"], SpatialReferences.Wgs84);
            Uri      iconUri  = param["IconUri"] as Uri;
            double   width    = (double)param["Width"];
            double   height   = (double)param["Height"];
            double   offsetX  = (double)param["OffsetX"];
            double   offsetY  = (double)param["OffsetY"];
            ViewSpot data     = param["Data"] as ViewSpot;

            ArcGISMapView.AddIconToGraphicsOverlay(graphicsOverlay, location, iconUri, width, height, offsetX, offsetY, data);
        }
Exemple #6
0
        private async void ShowDiscussCommandBinding_Executed(object sender, ExecutedRoutedEventArgs e)
        {
            ViewSpot param = e.Parameter as ViewSpot;

            ViewComment.DetailShowItem = param;
            CurrentGrid = CurrentPanel.Comment;
            ViewMaster.DataItemListView.SelectedIndex = -1;

            if (ViewComment.DetailShowItem == null)
            {
                return;
            }

            string requestString = AppSettings["WEB_API_GET_COMMENT_INFO_BY_VIEW"] + "?viewid=" + ViewComment.DetailShowItem.id;

            //API返回内容
            string jsonString = string.Empty;

            try
            {
                jsonString = (await WebServiceHelper.GetHttpResponseAsync(requestString, string.Empty, RestSharp.Method.GET)).Content;
                if (jsonString == "")
                {
                    throw new Exception("");
                }

                JObject jobject = (JObject)JsonConvert.DeserializeObject(jsonString);

                string content_string = jobject["CommentInfo"].ToString();

                using (var ms = new MemoryStream(Encoding.Unicode.GetBytes(content_string)))
                {
                    DataContractJsonSerializer deseralizer = new DataContractJsonSerializer(typeof(ObservableCollection <CommentInfo>));
                    ViewComment.CommentList = (ObservableCollection <CommentInfo>)deseralizer.ReadObject(ms);
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
                MessageboxMaster.Show(LanguageDictionaryHelper.GetString("Server_Connect_Error"), LanguageDictionaryHelper.GetString("MessageBox_Error_Title"));
                return;
            }

            //检查数据
            for (int i = 0; i < ViewComment.CommentList.Count; i++)
            {
                ViewComment.CommentList[i].Spot = ViewComment.DetailShowItem;
                ViewComment.CommentList[i].CheckData();
            }
        }
        /// <summary>
        /// 设置地图显示,并显示地图中心要素
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void SetScaleAndLocationCommandBinding_Executed(object sender, ExecutedRoutedEventArgs e)
        {
            ViewSpot data = e.Parameter as ViewSpot;

            foreach (Graphic g in ArcGISMapView.PointOverlay.Graphics)
            {
                MapPoint point = g.Geometry as MapPoint;
                //如果经纬度匹配
                if (point.X == data.GetLng() && point.Y == data.GetLat())
                {
                    //更改图标
                    PictureMarkerSymbol pictureMarkerSymbol = new PictureMarkerSymbol(IconDictionaryHelper.IconDictionary[IconDictionaryHelper.Icons.pin])
                    {
                        Width   = 16,
                        Height  = 24,
                        OffsetX = 0,
                        OffsetY = 9.5
                    };
                    g.Symbol = pictureMarkerSymbol;
                }
                else
                {
                    //恢复其他已被改变的图标
                    if ((g.Symbol as PictureMarkerSymbol).Uri != IconDictionaryHelper.IconDictionary[IconDictionaryHelper.Icons.pin_blue])
                    {
                        PictureMarkerSymbol pictureMarkerSymbol = new PictureMarkerSymbol(IconDictionaryHelper.IconDictionary[IconDictionaryHelper.Icons.pin_blue])
                        {
                            Width   = 16,
                            Height  = 24,
                            OffsetX = 0,
                            OffsetY = 9.5
                        };
                        g.Symbol = pictureMarkerSymbol;
                    }
                }
            }
            //改变地图视角
            ArcGISMapView.SetScaleAndLoction(new MapPoint(data.GetLng(), data.GetLat(), SpatialReferences.Wgs84), 10000);
        }
Exemple #8
0
        /// <summary>
        /// 地图点击事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private async void mapView_GeoViewTappedAsync(object sender, Esri.ArcGISRuntime.UI.Controls.GeoViewInputEventArgs e)
        {
            MapPoint mapLocation = e.Location;

            Esri.ArcGISRuntime.Geometry.Geometry myGeometry = GeometryEngine.Project(mapLocation, SpatialReferences.Wgs84);
            MapPoint projectedLocation = myGeometry as MapPoint;

            routeStops.Add(projectedLocation);

            double tolerance        = 0;
            int    maximumResults   = 1;
            bool   onlyReturnPopups = false;

            IdentifyGraphicsOverlayResult identifyResults = await mapView.IdentifyGraphicsOverlayAsync(
                PointOverlay,
                e.Position,
                tolerance,
                onlyReturnPopups,
                maximumResults);

            foreach (Graphic g in PointOverlay.Graphics)
            {
                PictureMarkerSymbol symbol = g.Symbol as PictureMarkerSymbol;
                if (symbol.Uri != IconDictionaryHelper.IconDictionary[IconDictionaryHelper.Icons.pin_blue])
                {
                    //恢复所有图标
                    PictureMarkerSymbol pictureMarkerSymbol = new PictureMarkerSymbol(IconDictionaryHelper.IconDictionary[IconDictionaryHelper.Icons.pin_blue])
                    {
                        Width   = symbol.Width,
                        Height  = symbol.Height,
                        OffsetX = symbol.OffsetX,
                        OffsetY = symbol.OffsetY
                    };
                    g.Symbol = pictureMarkerSymbol;
                }
            }

            if (identifyResults.Graphics.Count > 0)
            {
                Graphic             graphic    = identifyResults.Graphics[0];
                MapPoint            mapPoint   = graphic.Geometry as MapPoint;
                PictureMarkerSymbol iconSymbol = graphic.Symbol as PictureMarkerSymbol;
                double iconHeight = iconSymbol.Height;
                //改变选中图标
                PictureMarkerSymbol pictureMarkerSymbol = new PictureMarkerSymbol(IconDictionaryHelper.IconDictionary[IconDictionaryHelper.Icons.pin])
                {
                    Width   = iconSymbol.Width,
                    Height  = iconSymbol.Height,
                    OffsetX = iconSymbol.OffsetX,
                    OffsetY = iconSymbol.OffsetY
                };
                graphic.Symbol = pictureMarkerSymbol;
                ViewSpot viewInfo = GraphicsAttributes.ContainsKey(graphic) ? (GraphicsAttributes[graphic] as ViewSpot) : null;
                if (viewInfo != null)
                {
                    mapView.ShowCalloutAt(mapPoint, new ViewSpotCallout(viewInfo), new Point(0, iconHeight));
                    Tuple <object, int> param = new Tuple <object, int>(viewInfo, 1);
                    CommandForMainWindow.CommandsFreightStationToOverlayerCommand.Execute(param, Application.Current.MainWindow);
                }
            }
            else
            {
                mapView.DismissCallout();
            }
        }