/// <summary>
        /// Method for applying the selected character to the point feature layer
        /// </summary>
        /// <returns></returns>
        private async Task ApplyFontAsMarker()
        {
            var charIndex = 0;

            charIndex = SelectedCharacter.Character;
            var fontName  = SelectedFontFamily.ToString();
            var styleName = SelectedTypeFace.ToString();

            if (MapView.Active != null)
            {
                GetSelectedPointFeatureLayer(); //the selected point feature layer in the TOC
            }
            var cimMarker = SymbolFactory.ConstructMarker(charIndex, fontName,
                                                          styleName, Size); //creating the marker from the Font selected

            var pointSymbolFromMarker = SymbolFactory.ConstructPointSymbol(cimMarker);

            //create a symbol from the marker

            await SetFeatureLayerSymbolAsync(PointFeatureLayer, pointSymbolFromMarker);

            if (IsFavorites)
            {
                await CreateStyleItem();

                if (FontMarkerStyleProjectItem != null && pointSymbolFromMarker != null && !FontMarkerStyleProjectItem.IsReadOnly())
                {
                    await AddStyleItemToStyle(FontMarkerStyleProjectItem, pointSymbolFromMarker); //selected marker is added to the FontMarker style
                }
            }
        }
コード例 #2
0
 protected override Task OnToolActivateAsync(bool active)
 {
     if (_vm == null)
     {
         _vm = this.OverlayEmbeddableControl as OverlayControlViewModel;
     }
     if (_overlaySymbol == null)
     {
         QueuedTask.Run(() => {
             _overlaySymbol = SymbolFactory.ConstructPointSymbol(ColorFactory.Red, 12.0, SimpleMarkerStyle.Circle);
         });
     }
     if (_trees == null)
     {
         _trees = ActiveMapView.Map.GetLayersAsFlattenedList().FirstOrDefault((lyr) => lyr.Name == "Tree") as BasicFeatureLayer;
     }
     if (_theInspector == null)
     {
         _theInspector = new Inspector();
         var tuple = _theInspector.CreateEmbeddableControl();
         _vm.InspectorView      = tuple.Item2;
         _vm.InspectorViewModel = tuple.Item1;
     }
     return(base.OnToolActivateAsync(active));
 }
コード例 #3
0
        internal async Task AddGraphicToMap(Geometry geom, CIMColor color, bool IsTempGraphic = false, double size = 1.0, string text = "")
        {
            if (geom == null || MapView.Active == null)
            {
                return;
            }

            CIMSymbolReference symbol = null;

            if (!string.IsNullOrWhiteSpace(text) && geom.GeometryType == GeometryType.Point)
            {
                await QueuedTask.Run(() =>
                {
                    //var tg = new CIMTextGraphic() { Placement = Anchor.CenterPoint, Text = text};
                });
            }
            else if (geom.GeometryType == GeometryType.Point)
            {
                await QueuedTask.Run(() =>
                {
                    var s  = SymbolFactory.ConstructPointSymbol(color, size, SimpleMarkerStyle.Circle);
                    symbol = new CIMSymbolReference()
                    {
                        Symbol = s
                    };
                });
            }
            else if (geom.GeometryType == GeometryType.Polyline)
            {
                await QueuedTask.Run(() =>
                {
                    var s  = SymbolFactory.ConstructLineSymbol(color, size);
                    symbol = new CIMSymbolReference()
                    {
                        Symbol = s
                    };
                });
            }
            else if (geom.GeometryType == GeometryType.Polygon)
            {
                await QueuedTask.Run(() =>
                {
                    var outline = SymbolFactory.ConstructStroke(ColorFactory.Black, 1.0, SimpleLineStyle.Solid);
                    var s       = SymbolFactory.ConstructPolygonSymbol(color, SimpleFillStyle.Solid, outline);
                    symbol      = new CIMSymbolReference()
                    {
                        Symbol = s
                    };
                });
            }

            await QueuedTask.Run(() =>
            {
                var disposable = MapView.Active.AddOverlay(geom, symbol);
                overlayObjects.Add(disposable);

                GraphicsList.Add(new ProGraphic(disposable, geom, IsTempGraphic));
            });
        }
コード例 #4
0
        private static async Task CreateFeatures(List <MapPoint> mapPointList)
        {
            RowBuffer rowBuffer = null;

            try
            {
                await QueuedTask.Run(() =>
                {
                    var layer = MapView.Active.GetSelectedLayers()[0];
                    if (layer is FeatureLayer)
                    {
                        var featureLayer = layer as FeatureLayer;

                        using (var table = featureLayer.GetTable())
                        {
                            TableDefinition definition = table.GetDefinition();
                            int shapeIndex             = definition.FindField("Shape");

                            foreach (var point in mapPointList)
                            {
                                rowBuffer = table.CreateRowBuffer();

                                rowBuffer[shapeIndex] = new MapPointBuilder(point).ToGeometry();

                                Row row = table.CreateRow(rowBuffer);
                            }
                        }

                        //Get simple renderer from feature layer
                        CIMSimpleRenderer currentRenderer = featureLayer.GetRenderer() as CIMSimpleRenderer;
                        CIMSymbolReference sybmol         = currentRenderer.Symbol;

                        //var outline = SymbolFactory.ConstructStroke(ColorFactory.RedRGB, 1.0, SimpleLineStyle.Solid);
                        //var s = SymbolFactory.ConstructPolygonSymbol(ColorFactory.RedRGB, SimpleFillStyle.Null, outline);
                        var s = SymbolFactory.ConstructPointSymbol(ColorFactory.RedRGB, 3.0);
                        CIMSymbolReference symbolRef = new CIMSymbolReference()
                        {
                            Symbol = s
                        };
                        currentRenderer.Symbol = symbolRef;

                        featureLayer.SetRenderer(currentRenderer);
                    }
                });
            }
            catch (GeodatabaseException exObj)
            {
                Console.WriteLine(exObj);
                throw;
            }
            finally
            {
                if (rowBuffer != null)
                {
                    rowBuffer.Dispose();
                }
            }
        }
 private static void SetupOverlaySymbols()
 {
     QueuedTask.Run(() =>
     {
         var markerCoordPoint = SymbolFactory.ConstructMarker(ColorFactory.GreenRGB, 12,
                                                              SimpleMarkerStyle.Circle);
         _pointCoordSymbol = SymbolFactory.ConstructPointSymbol(markerCoordPoint);
     });
 }
コード例 #6
0
        internal async Task AddGraphicToMap(Geometry geom, CIMColor color, bool IsTempGraphic = false, double size = 1.0)
        {
            if (geom == null || MapView.Active == null)
            {
                return;
            }

            CIMSymbolReference symbol = null;

            if (geom.GeometryType == GeometryType.Point)
            {
                await QueuedTask.Run(() =>
                {
                    var s  = SymbolFactory.ConstructPointSymbol(color, size, SimpleMarkerStyle.Circle);
                    symbol = new CIMSymbolReference()
                    {
                        Symbol = s
                    };
                });
            }
            else if (geom.GeometryType == GeometryType.Polyline)
            {
                await QueuedTask.Run(() =>
                {
                    var s  = SymbolFactory.ConstructLineSymbol(color, size);
                    symbol = new CIMSymbolReference()
                    {
                        Symbol = s
                    };
                });
            }
            else if (geom.GeometryType == GeometryType.Polygon)
            {
                await QueuedTask.Run(() =>
                {
                    var outline = SymbolFactory.ConstructStroke(ColorFactory.RedRGB, 1.0, SimpleLineStyle.Solid);
                    var s       = SymbolFactory.ConstructPolygonSymbol(color, SimpleFillStyle.Null, outline);
                    symbol      = new CIMSymbolReference()
                    {
                        Symbol = s
                    };
                });
            }

            await QueuedTask.Run(() =>
            {
                var disposable = MapView.Active.AddOverlay(geom, symbol);
                overlayObjects.Add(disposable);

                var gt = GetGraphicType();

                GraphicsList.Add(new Graphic(gt, disposable, geom, this, IsTempGraphic));

                RaisePropertyChanged(() => HasMapGraphics);
            });
        }
コード例 #7
0
        /// <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);
            });
        }
コード例 #8
0
        /// <summary>
        /// Method for applying the selected character to the point feature layer
        /// </summary>
        /// <returns></returns>
        private async Task ApplyFontAsMarker()
        {
            var charIndex = 0;

            charIndex = SelectedCharacter.Character;
            var fontName  = SelectedFontFamily.ToString();
            var styleName = SelectedTypeFace.ToString();

            if (MapView.Active != null)
            {
                GetSelectedPointFeatureLayer(); //the selected point feature layer in the TOC
            }
            var cimMarker = SymbolFactory.ConstructMarker(charIndex, fontName,
                                                          styleName, Size); //creating the marker from the Font selected

            var pointSymbolFromMarker = SymbolFactory.ConstructPointSymbol(cimMarker);

            //create a symbol from the marker

            await SetFeatureLayerSymbolAsync(PointFeatureLayer, pointSymbolFromMarker);
        }
コード例 #9
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);
            });
        }
コード例 #10
0
        internal async Task <string> AddGraphicToMap(Geometry geom, CIMColor color, bool IsTempGraphic = false, double size = 1.0, string text = "", SimpleMarkerStyle markerStyle = SimpleMarkerStyle.Circle, string tag = "")
        {
            if (geom == null || MapView.Active == null)
            {
                return(string.Empty);
            }

            CIMSymbolReference symbol = null;

            if (!string.IsNullOrWhiteSpace(text) && geom.GeometryType == GeometryType.Point)
            {
                await QueuedTask.Run(() =>
                {
                    // TODO add text graphic
                    //var tg = new CIMTextGraphic() { Placement = Anchor.CenterPoint, Text = text};
                });
            }
            else if (geom.GeometryType == GeometryType.Point)
            {
                await QueuedTask.Run(() =>
                {
                    var s  = SymbolFactory.ConstructPointSymbol(color, size, markerStyle);
                    symbol = new CIMSymbolReference()
                    {
                        Symbol = s
                    };
                });
            }
            else if (geom.GeometryType == GeometryType.Polyline)
            {
                await QueuedTask.Run(() =>
                {
                    var s  = SymbolFactory.ConstructLineSymbol(color, size);
                    symbol = new CIMSymbolReference()
                    {
                        Symbol = s
                    };
                });
            }
            else if (geom.GeometryType == GeometryType.Polygon)
            {
                await QueuedTask.Run(() =>
                {
                    var outline = SymbolFactory.ConstructStroke(ColorFactory.Black, 1.0, SimpleLineStyle.Solid);
                    var s       = SymbolFactory.ConstructPolygonSymbol(color, SimpleFillStyle.Solid, outline);
                    symbol      = new CIMSymbolReference()
                    {
                        Symbol = s
                    };
                });
            }

            var result = await QueuedTask.Run(() =>
            {
                var disposable = MapView.Active.AddOverlay(geom, symbol);
                var guid       = Guid.NewGuid().ToString();
                ProGraphicsList.Add(new ProGraphic(disposable, guid, geom, IsTempGraphic, tag));
                return(guid);
            });

            return(result);
        }
コード例 #11
0
 /// <summary>
 /// Create a point symbol
 /// </summary>
 /// <returns></returns>
 internal static Task <CIMPointSymbol> CreatePointSymbolAsync()
 {
     return(QueuedTask.Run(() => {
         return SymbolFactory.ConstructPointSymbol(ColorFactory.RedRGB, 14, SimpleMarkerStyle.Circle);
     }));
 }