/// <summary>
        /// Add a point to the specified mapview
        /// </summary>
        /// <param name="point">The location of the graphic</param>
        /// <param name="mapView">The mapview to whose overlay the graphic will be added</param>
        /// <returns></returns>
        public static async void AddToMapOverlay(ArcGIS.Core.Geometry.MapPoint point, MapView mapView)
        {
            ArcGIS.Core.CIM.CIMPointSymbol symbol = null;

            await QueuedTask.Run(() =>
            {
                // Construct point symbol
                symbol = SymbolFactory.ConstructPointSymbol(ColorFactory.Red, 10.0, SimpleMarkerStyle.Star);
            });

            //Get symbol reference from the symbol
            CIMSymbolReference symbolReference = symbol.MakeSymbolReference();

            await QueuedTask.Run(() =>
            {
                _overlayObject = mapView.AddOverlay(point, symbolReference);
            });
        }
Exemple #2
0
        private async void OnFlashPointCommand(object obj)
        {
            CoordinateDD dd;
            var          ctvm = CTView.Resources["CTViewModel"] as CoordinateToolViewModel;

            if (ctvm != null)
            {
                if (!CoordinateDD.TryParse(ctvm.InputCoordinate, out dd))
                {
                    return;
                }
            }
            else
            {
                return;
            }

            ArcGIS.Core.CIM.CIMPointSymbol symbol = null;
            var point = await QueuedTask.Run(() =>
            {
                ArcGIS.Core.Geometry.SpatialReference sptlRef = SpatialReferenceBuilder.CreateSpatialReference(4326);
                return(MapPointBuilder.CreateMapPoint(dd.Lon, dd.Lat, sptlRef));
            });

            await QueuedTask.Run(() =>
            {
                // Construct point symbol
                symbol = SymbolFactory.ConstructPointSymbol(ColorFactory.Red, 10.0, SimpleMarkerStyle.Star);
            });

            //Get symbol reference from the symbol
            CIMSymbolReference symbolReference = symbol.MakeSymbolReference();

            await QueuedTask.Run(() =>
            {
                ClearOverlay();
                _overlayObject = MapView.Active.AddOverlay(point, symbolReference);
                MapView.Active.ZoomToAsync(point, new TimeSpan(2500000), true);
            });
        }
        private async void OnFlashPointCommand(object obj)
        {
            var previous = IsToolActive;

            if (!IsToolActive)
            {
                IsToolActive = true;
            }

            CoordinateDD dd;
            var          ctvm = CTView.Resources["CTViewModel"] as CoordinateConversionViewModel;

            if (ctvm != null)
            {
                if (!CoordinateDD.TryParse(ctvm.InputCoordinate, out dd))
                {
                    return;
                }
            }
            else
            {
                return;
            }

            ArcGIS.Core.CIM.CIMPointSymbol symbol = null;
            var point = await QueuedTask.Run(() =>
            {
                ArcGIS.Core.Geometry.SpatialReference sptlRef = SpatialReferenceBuilder.CreateSpatialReference(4326);
                return(MapPointBuilder.CreateMapPoint(dd.Lon, dd.Lat, sptlRef));
            });

            //await QueuedTask.Run(() =>
            //{
            //    // Construct point symbol
            //    symbol = SymbolFactory.ConstructPointSymbol(ColorFactory.Red, 10.0, SimpleMarkerStyle.Star);
            //});

            ////Get symbol reference from the symbol
            //CIMSymbolReference symbolReference = symbol.MakeSymbolReference();

            //QueuedTask.Run(() =>
            //{
            //    ClearOverlay();
            //    _overlayObject = MapView.Active.AddOverlay(point, symbolReference);
            //    //MapView.Active.ZoomToAsync(point, new TimeSpan(2500000), true);
            //});


            QueuedTask.Run(() =>
            {
                Mediator.NotifyColleagues("UPDATE_FLASH", point);
            });

            //await QueuedTask.Run(() =>
            //{
            //    Task.Delay(500);
            //    ClearOverlay();
            //    //_overlayObject = MapView.Active.AddOverlay(point, symbolReference);
            //    //MapView.Active.ZoomToAsync(point, new TimeSpan(2500000), true);
            //});
            //if (previous != IsToolActive)
            //    IsToolActive = previous;
            //await QueuedTask.Run(() =>
            //{
            //    Task.Delay(500);
            //    ClearOverlay();
            //    MapView.Active.LookAt(MapView.Active.Extent.Center);
            //});
        }