Example #1
0
        public AdvancedReshapeFeedback()
        {
            _openJawReplaceEndSymbol = CreateHollowCircle(0, 0, 200);

            _addAreaSymbol    = SymbolUtils.CreateHatchFillSymbol(0, 255, 0, 90);
            _removeAreaSymbol = SymbolUtils.CreateHatchFillSymbol(255, 0, 0);
        }
Example #2
0
        private Task <CIMSymbolReference> OverlaySymbolX(GeometryType gt)
        {
            return(QueuedTask.Run(() =>
            {
                CIMSymbolReference retval = null;

                switch (gt)
                {
                case GeometryType.Polygon:
                case GeometryType.Envelope:
                    CIMStroke outline = SymbolFactory.Instance.ConstructStroke(ColorFactory.Instance.RedRGB, 2.0, SimpleLineStyle.Solid);
                    CIMPolygonSymbol fillWithOutline =
                        SymbolFactory.Instance.ConstructPolygonSymbol(ColorFactory.Instance.RedRGB, SimpleFillStyle.Null, outline);
                    retval = fillWithOutline.MakeSymbolReference();
                    break;

                case GeometryType.Point:
                case GeometryType.Multipoint:
                    CIMPointSymbol ps = SymbolFactory.Instance.ConstructPointSymbol(ColorFactory.Instance.RedRGB, 5.0, SimpleMarkerStyle.Circle);
                    retval = ps.MakeSymbolReference();
                    break;

                case GeometryType.Polyline:
                    CIMLineSymbol ls = SymbolFactory.Instance.ConstructLineSymbol(ColorFactory.Instance.RedRGB, 2.0, SimpleLineStyle.Solid);
                    retval = ls.MakeSymbolReference();
                    break;

                default:
                    break;
                }

                return retval;
            }));
        }
Example #3
0
        protected override Task HandleMouseDownAsync(MapViewMouseButtonEventArgs e)
        {
            return(QueuedTask.Run(() =>
            {
                // Get the mouse click point
                MapPoint location = MapView.Active.ClientToMap(e.ClientPoint);

                // Create a symbol based on the mouse button.
                CIMPointSymbol pointSymbol = null;
                if (e.ChangedButton == MouseButton.Left)
                {
                    // Specify a symbol
                    pointSymbol = SymbolFactory.Instance.ConstructPointSymbol(ColorFactory.Instance.CreateRGBColor(150, 0, 0, 60), 80, SimpleMarkerStyle.Circle);
                }
                else if (e.ChangedButton == MouseButton.Right)
                {
                    // Specify a symbol
                    pointSymbol = SymbolFactory.Instance.ConstructPointSymbol(ColorFactory.Instance.CreateRGBColor(0, 0, 150, 60), 80, SimpleMarkerStyle.Cross);
                }

                // Create a CIMGraphic to show the symbol on the map in the grapicslayer.
                var graphic = new CIMPointGraphic()
                {
                    Symbol = pointSymbol?.MakeSymbolReference(),
                    Location = location
                };

                // Add the graphic to the grapicslayer.
                FieldOfJoy.AddElement(graphic);

                // By default all items are selected, deselect all items
                FieldOfJoy.UnSelectElements();
            }));
        }
Example #4
0
        public ChangeAlongFeedback()
        {
            var red = ColorFactory.Instance.CreateRGBColor(248, 0, 0);

            _noReshapeLineSymbol = SymbolFactory.Instance.ConstructLineSymbol(red, _lineWidth);

            var green = ColorFactory.Instance.CreateRGBColor(0, 248, 0);

            _reshapeLineSymbol = SymbolFactory.Instance.ConstructLineSymbol(green, _lineWidth);

            var yellow = ColorFactory.Instance.CreateRGBColor(255, 255, 0);

            _candidateReshapeLineSymbol =
                SymbolFactory.Instance.ConstructLineSymbol(yellow, _lineWidth);

            var grey = ColorFactory.Instance.CreateRGBColor(100, 100, 100);

            _filteredReshapeLineSymbol =
                SymbolFactory.Instance.ConstructLineSymbol(grey, _lineWidth);

            _noReshapeLineEnd = CreateMarkerSymbol(red);
            _reshapeLineEnd   = CreateMarkerSymbol(green);
            _candidateLineEnd = CreateMarkerSymbol(yellow);
            _filteredLineEnd  = CreateMarkerSymbol(grey);
        }
Example #5
0
        /// <summary>
        /// Create a CIMPointGaphic which can be added to the MapView overlay.
        /// </summary>
        /// <param name="point">The location for the point (as a CIM point)</param>
        /// <returns></returns>
        public CIMPointGraphic MakeCIMPointGraphic(PointN point)
        {
            ////CIMMarker marker = SymbolHelper.ConstructMarker(Red, 10, SimpleMarkerStyle.Circle);

            CIMMarker marker = SymbolHelper.ConstructMarker(Red, 10, SimpleMarkerStyle.Star);

            CIMSymbolLayer[] layers = new CIMSymbolLayer[1];
            layers[0] = marker;

            CIMPointSymbol pointSymbol = new CIMPointSymbol();

            pointSymbol.SymbolLayers = layers;
            pointSymbol.ScaleX       = 1;

            CIMSymbolReference symbolRef = new CIMSymbolReference();

            symbolRef.Symbol = pointSymbol;

            CIMPointGraphic pointGraphic = new CIMPointGraphic();

            pointGraphic.Location = point;
            pointGraphic.Symbol   = symbolRef;

            return(pointGraphic);
        }
        protected async override Task OnToolActivateAsync(bool active)
        {
            _trackingMouseMove = TrackingState.NotTracking;
            if (_pointSymbol == null)
            {
                _pointSymbol = await Module1.CreatePointSymbolAsync();
            }
            //_lastLocations.Clear();
            _lastLocation    = null;
            _workingLocation = null;

            if (!Module1.MessageShown)
            {
                if (!Module1.AreThereAnyLineLayers())
                {
                    MessageBox.Show("You need to add at least one line featurelayer to the map.",
                                    this.Caption);
                }
                else
                {
                    MessageBox.Show("Click on any line feature and hold the mouse down to move the graphic. " +
                                    "The graphic will track the mouse along the selected line feature.",
                                    this.Caption);
                    Module1.MessageShown = true;
                }
            }
        }
Example #7
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));
 }
Example #8
0
        /// <summary>
        /// Create a CIMPointGaphic which can be added to the MapView overlay.
        /// </summary>
        /// <param name="point">The location for the point (as a CIM point)</param>
        /// <returns></returns>
        public CIMPointGraphic MakeCIMPointGraphic(PointN point)
        {
            CIMMarker marker = SymbolFactory.Instance.ConstructMarker(Red, 10, SimpleMarkerStyle.Star);

            CIMSymbolLayer[] layers = new CIMSymbolLayer[1];
            layers[0] = marker;

            CIMPointSymbol pointSymbol = new CIMPointSymbol()
            {
                SymbolLayers = layers,
                ScaleX       = 1
            };
            CIMSymbolReference symbolRef = new CIMSymbolReference()
            {
                Symbol = pointSymbol
            };
            CIMPointGraphic pointGraphic = new CIMPointGraphic();

            ArcGIS.Core.Geometry.SpatialReference spatialRef = SpatialReferenceBuilder.CreateSpatialReference(point.SpatialReference.WKID);
            MapPoint mapPoint = MapPointBuilder.CreateMapPoint(point.X, point.Y, spatialRef);

            pointGraphic.Location = mapPoint;
            pointGraphic.Symbol   = symbolRef;

            return(pointGraphic);
        }
Example #9
0
        public PickerViewModel(List <IPickableItem> pickingCandidates,
                               bool isSingleMode)
        {
            FlashItemCmd = new RelayCommand(FlashItem, () => true, false);

            CloseCommand = new RelayCommand(Close, () => true, false);

            PickableItems =
                new ObservableCollection <IPickableItem>(pickingCandidates);

            _isSingleMode = isSingleMode;

            CIMColor magenta = ColorFactory.Instance.CreateRGBColor(255, 0, 255);

            CIMStroke outline =
                SymbolFactory.Instance.ConstructStroke(
                    magenta, 4, SimpleLineStyle.Solid);

            _highlightLineSymbol =
                SymbolFactory.Instance.ConstructLineSymbol(magenta, 4);

            _highlightPolygonSymbol =
                SymbolFactory.Instance.ConstructPolygonSymbol(
                    magenta, SimpleFillStyle.Null, outline);

            _highlightPointSymbol =
                SymbolFactory.Instance.ConstructPointSymbol(magenta, 6);
        }
 protected async override Task OnToolActivateAsync(bool active)
 {
     if (_pointSymbol == null)
     {
         _pointSymbol = await CreatePointSymbolAsync();
     }
 }
 protected override Task OnToolActivateAsync(bool active)
 {
     QueuedTask.Run(() =>
     {
         _pointSymbol = SymbolFactory.Instance.ConstructPointSymbol(CIMColor.CreateRGBColor(100, 255, 40), 10, SimpleMarkerStyle.Circle);
     });
     return(base.OnToolActivateAsync(active));
 }
Example #12
0
        public static CIMPointSymbol CreatePointSymbol(CIMMarker marker)
        {
            var symbol = new CIMPointSymbol();

            symbol.ScaleX       = 1.0;
            symbol.HaloSize     = 1.0;
            symbol.SymbolLayers = new CIMSymbolLayer[] { marker };
            return(symbol);
        }
 private static void SetupOverlaySymbols()
 {
     QueuedTask.Run(() =>
     {
         var markerCoordPoint = SymbolFactory.Instance.ConstructMarker(ColorFactory.Instance.GreenRGB, 12,
                                                                       SimpleMarkerStyle.Circle);
         _pointCoordSymbol = SymbolFactory.Instance.ConstructPointSymbol(markerCoordPoint);
     });
 }
Example #14
0
        public static void MakeManholesLayer(Map mapView)
        {
            try
            {
                // Create the "Manholes"  layer object.
                var mh = mapView.GetLayersAsFlattenedList().OfType <FeatureLayer>().FirstOrDefault(s => s.Name == "Manholes");

                //Get the selected features from the map.
                var mhOIDList = mh.GetSelection().GetObjectIDs();                 // Gets a list of Object IDs
                var mhOID     = mh.GetTable().GetDefinition().GetObjectIDField(); // Gets the OBJECTID field name for the def query

                // Check to see if there are manhole features selected in the map.
                if (mhOIDList.Count() == 0)
                {
                    MessageBox.Show("There are no manholes selected.");
                }

                else
                {
                    // Create the defenition query
                    string defQuery = $"{mhOID} in ({string.Join(",", mhOIDList)})";
                    string url      = @"O:\SHARE\405 - INFORMATION SERVICES\GIS_Layers\[email protected]\SDE.SEWERMAN.MANHOLES_VIEW";

                    // Create the Uri object create the feature layer.
                    Uri uri            = new Uri(url);
                    var selectionLayer = LayerFactory.Instance.CreateFeatureLayer(uri, mapView, 0, "Manholes SELECTION");

                    // Apply the definition query
                    selectionLayer.SetDefinitionQuery(defQuery);

                    // Create the point symbol renderer.
                    CIMPointSymbol pointSymbol = SymbolFactory.Instance.ConstructPointSymbol(
                        ColorFactory.Instance.GreenRGB,
                        8.0,
                        SimpleMarkerStyle.Circle
                        );
                    CIMSimpleRenderer renderer = selectionLayer.GetRenderer() as CIMSimpleRenderer;
                    // Reference the existing renderer
                    renderer.Symbol = pointSymbol.MakeSymbolReference();
                    // Apply new renderer
                    selectionLayer.SetRenderer(renderer);
                }
            }

            catch (Exception ex)
            {
                SysModule.LogError(ex.Message, ex.StackTrace);

                string caption = "Error Occurred";
                string message = "Process failed. \nSave and restart ArcGIS Pro and try process again.\n" +
                                 "If problem persist, contact your GIS Admin.";

                //Using the ArcGIS Pro SDK MessageBox class
                MessageBox.Show(message, caption);
            }
        }
Example #15
0
        protected override Task OnToolActivateAsync(bool active)
        {
            QueuedTask.Run(() =>
            {
                _pointSymbol = SymbolFactory.Instance.ConstructPointSymbol(CIMColor.CreateRGBColor(255, 255, 0, 40), 10, SimpleMarkerStyle.Circle);
                _textSymbol  = SymbolFactory.Instance.ConstructTextSymbol(ColorFactory.Instance.BlackRGB, 9.5, "Corbel", "Bold");
            });

            return(base.OnToolActivateAsync(active));
        }
        //construct point symbol
        #region ProSnippet Group: Symbols
        #endregion
        public async Task ConstructPointSymbol_1()
        {
            #region How to construct a point symbol of a specific color and size

            await QueuedTask.Run(() =>
            {
                CIMPointSymbol pointSymbol = SymbolFactory.Instance.ConstructPointSymbol(ColorFactory.Instance.RedRGB, 10.0);
            });

            #endregion
        }
        public async Task ConstructPointSymbol_4()
        {
            #region How to construct a point symbol from a file on disk

            //The following file formats can be used to create the marker: DAE, 3DS, FLT, EMF, JPG, PNG, BMP, GIF
            CIMMarker markerFromFile = await QueuedTask.Run(() => SymbolFactory.Instance.ConstructMarkerFromFile(@"C:\Temp\fileName.dae"));

            CIMPointSymbol pointSymbolFromFile = SymbolFactory.Instance.ConstructPointSymbol(markerFromFile);

            #endregion
        }
        public async Task ConstructPointSymbol_2()
        {
            #region How to construct a point symbol of a specific color, size and shape

            await QueuedTask.Run(() =>
            {
                CIMPointSymbol starPointSymbol = SymbolFactory.Instance.ConstructPointSymbol(ColorFactory.Instance.RedRGB, 10.0, SimpleMarkerStyle.Star);
            });

            #endregion
        }
Example #19
0
        internal static CIMSymbol GetPointSymbol()
        {
            if (_point2DSymbol != null)
            {
                return(_point2DSymbol);
            }
            //must be on the QueuedTask
            _point2DSymbol = SymbolFactory.Instance.ConstructPointSymbol(
                ColorFactory.Instance.RedRGB, 11, SimpleMarkerStyle.Circle);

            return(_point2DSymbol);
        }
        public async Task ConstructPointSymbol_3()
        {
            #region How to construct a point symbol from a marker

            await QueuedTask.Run(() =>
            {
                CIMMarker marker = SymbolFactory.Instance.ConstructMarker(ColorFactory.Instance.GreenRGB, 8.0, SimpleMarkerStyle.Pushpin);
                CIMPointSymbol pointSymbolFromMarker = SymbolFactory.Instance.ConstructPointSymbol(marker);
            });

            #endregion
        }
Example #21
0
 private void AddReshapeLineEndpoints(IEnumerable <CutSubcurve> subcurves,
                                      Predicate <CutSubcurve> predicate,
                                      CIMPointSymbol symbol)
 {
     foreach (var cutSubcurve in subcurves)
     {
         if (predicate == null || predicate(cutSubcurve))
         {
             AddOverlay(cutSubcurve.FromPoint, symbol);
             AddOverlay(cutSubcurve.ToPoint, symbol);
         }
     }
 }
 public void ConstructPointSymbolFromMarkerStream()
 {
     #region How to construct a point symbol from a in memory graphic
     //Create a stream for the image
     Image newImage = Image.FromFile(@"C:\PathToImage\Image.png");
     var   stream   = new System.IO.MemoryStream();
     newImage.Save(stream, ImageFormat.Png);
     stream.Position = 0;
     //Create marker using the stream
     CIMMarker markerFromStream = SymbolFactory.Instance.ConstructMarkerFromStream(stream);
     //Create the point symbol from the marker
     CIMPointSymbol pointSymbolFromStream = SymbolFactory.Instance.ConstructPointSymbol(markerFromStream);
     #endregion
 }
Example #23
0
        private void InitSymbology(IPointSymbology symbology)
        {
            _pointSize = symbology.Size;

            var pointColor = ColorFactory.Instance.CreateRGBColor(symbology.Color.R, symbology.Color.G, symbology.Color.B, symbology.Opacity);

            _pointSymbol = SymbolFactory.Instance.ConstructPointSymbol(pointColor, symbology.Size, symbology.Shape);
            (((_pointSymbol.SymbolLayers[0] as CIMVectorMarker).MarkerGraphics[0].Symbol as CIMPolygonSymbol).SymbolLayers[0] as CIMSolidStroke).Width = 0;

            var textSymbol = SymbolFactory.Instance.ConstructTextSymbol(ColorFactory.Instance.WhiteRGB, symbology.Size * 1.5, "Arial", "Bold");

            textSymbol.HorizontalAlignment = HorizontalAlignment.Center;
            textSymbol.VerticalAlignment   = VerticalAlignment.Center;
            _textSymbolRef = textSymbol.MakeSymbolReference();
        }
        protected override async void OnClick()
        {
            if (_pointSymbol == null)
            {
                _pointSymbol = await Module1.CreatePointSymbolAsync();
            }
            GeoCoordinateWatcher watcher = new GeoCoordinateWatcher();

            watcher.PositionChanged += Watcher_PositionChanged;
            // Do not suppress prompt, and wait 1000 milliseconds to start.
            bool bStarted = watcher.TryStart(false, TimeSpan.FromMilliseconds(2000));

            if (!bStarted)
            {
                MessageBox.Show("GeoCoordinateWatcher timed out on start.");
            }
        }
        private void SetIconPrimitiveNames(CIMPointSymbol symbol, bool useWhite)
        {
            List <CIMColor> colors = new List <CIMColor>();

            ColorUtil.CollectColors(symbol, colors);

            if (colors.Count == 1)
            {
                var  color   = colors[0];
                bool colorIt = !useWhite || ColorUtil.IsBlackColor(color);
                if (colorIt)
                {
                    UnlockAndSetPrimitiveName(symbol, (layer) => !useWhite || ColorUtil.IsBlackLayer(layer), "icon_element");
                }
                else
                {
                    SymbolUtil.LockAllLayers(symbol); // all locked - no color primitive name
                }
            }
            else if (colors.Count == 2)
            {
                var  color1  = colors[0];
                var  color2  = colors[1];
                bool colorIt = useWhite ?
                               ((ColorUtil.IsBlackColor(color1) && ColorUtil.IsWhiteColor(color2)) || (ColorUtil.IsBlackColor(color2) && ColorUtil.IsWhiteColor(color1))) :
                               ((ColorUtil.IsBlackColor(color1) && !ColorUtil.IsBlackColor(color2)) || (ColorUtil.IsBlackColor(color2) && !ColorUtil.IsBlackColor(color1)));
                if (colorIt)
                {
                    UnlockAndSetPrimitiveName(symbol, (layer) => !ColorUtil.IsBlackLayer(layer), "icon_element");
                }
                else
                {
                    SymbolUtil.LockAllLayers(symbol);
                }
            }
            else
            {
                // all locked
                SymbolUtil.LockAllLayers(symbol);
            }

            ++_updatedSymbols;
        }
Example #26
0
        private Task AddStyleItemToStyle(StyleProjectItem styleProjectItem, CIMPointSymbol cimPointSymbol)
        {
            return(QueuedTask.Run(() =>
            {
                if (styleProjectItem == null || cimPointSymbol == null)
                {
                    throw new System.ArgumentNullException();
                }
                SymbolStyleItem symbolStyleItem = new SymbolStyleItem() //define the symbol
                {
                    Symbol = cimPointSymbol,
                    ItemType = StyleItemType.PointSymbol,
                    Category = $"{SelectedFontFamily}",
                    Name = $"{SelectedCharacter.Character.ToString()}",
                    Key = $"{SelectedCharacter.Character.ToString()}_{SelectedFontFamily}_3",
                    Tags = $"{SelectedFontFamily};{SelectedCharacter.Character.ToString()};point"
                };

                styleProjectItem.AddItem(symbolStyleItem);
            }));
        }
Example #27
0
        private static CIMPointSymbol CreateHollowCircle(int red, int green, int blue)
        {
            CIMColor transparent = ColorFactory.Instance.CreateRGBColor(0d, 0d, 0d, 0d);
            CIMColor color       = ColorFactory.Instance.CreateRGBColor(red, green, blue);

            CIMPointSymbol hollowCircle =
                SymbolFactory.Instance.ConstructPointSymbol(transparent, 19,
                                                            SimpleMarkerStyle.Circle);

            var marker     = hollowCircle.SymbolLayers[0] as CIMVectorMarker;
            var polySymbol = Assert.NotNull(marker).MarkerGraphics[0].Symbol as CIMPolygonSymbol;

            //Outline:
            Assert.NotNull(polySymbol).SymbolLayers[0] =
                SymbolFactory.Instance.ConstructStroke(color, 2, SimpleLineStyle.Solid);

            // Fill:
            polySymbol.SymbolLayers[1] = SymbolFactory.Instance.ConstructSolidFill(transparent);

            return(hollowCircle);
        }
        protected async override Task OnToolActivateAsync(bool active) {
            _trackingMouseMove = TrackingState.NotTracking;
            if (_pointSymbol == null)
                _pointSymbol = await Module1.CreatePointSymbolAsync();
            //_lastLocations.Clear();
            _lastLocation = null;
            _workingLocation = null;

            if (!Module1.MessageShown) {
                if (!Module1.AreThereAnyLineLayers()) {
                    MessageBox.Show("You need to add at least one line featurelayer to the map.",
                        this.Caption);
                }
                else {
                    MessageBox.Show("Click on any line feature and hold the mouse down to move the graphic. " +
                                "The graphic will track the mouse along the selected line feature.",
                    this.Caption);
                    Module1.MessageShown = true;
                }
            }
        }
Example #29
0
        /// <summary>
        /// This function builds the map topology graph of the current map view extent.
        /// </summary>
        /// <returns></returns>
        private async Task BuildGraphWithActiveView()
        {
            await QueuedTask.Run(() =>
            {
                ClearOverlay();

                //Build the map topology graph
                MapView.Active.BuildMapTopologyGraph <TopologyDefinition>(topologyGraph =>
                {
                    //Getting the nodes and edges present in the graph
                    topologyGraphNodes = topologyGraph.GetNodes();
                    topologyGraphEdges = topologyGraph.GetEdges();

                    if (_symbol == null)
                    {
                        //Construct point and line symbols
                        _symbol     = SymbolFactory.Instance.ConstructPointSymbol(ColorFactory.Instance.BlueRGB, 6.0, SimpleMarkerStyle.Circle);
                        _symbolLine = SymbolFactory.Instance.ConstructLineSymbol(ColorFactory.Instance.BlueRGB, 3.0);
                        //Get symbol references from the symbols
                        _symbolReference     = _symbol.MakeSymbolReference();
                        _symbolReferenceLine = _symbolLine.MakeSymbolReference();
                    }

                    //Draw the nodes and edges on the overlay to highlight them
                    foreach (var node in topologyGraphNodes)
                    {
                        _overlayObject = MapView.Active.AddOverlay(node.GetShape() as MapPoint, _symbolReference);
                        snapshot.Add(_overlayObject);
                    }
                    foreach (var edge in topologyGraphEdges)
                    {
                        _overlayObject = MapView.Active.AddOverlay(edge.GetShape() as Polyline, _symbolReferenceLine);
                        snapshot.Add(_overlayObject);
                    }

                    MessageBox.Show($"Number of topo graph nodes are:  {topologyGraphNodes.Count}.\n Number of topo graph edges are {topologyGraphEdges.Count}.", "Map Topology Info");
                });
            });
        }
Example #30
0
        public async Task UpdateAsync(double x, double y, double size)
        {
            Settings           settings = Settings.Instance;
            MySpatialReference spatRel  = settings.CycloramaViewerCoordinateSystem;

            await QueuedTask.Run(() =>
            {
                MapView thisView = MapView.Active;
                Map map          = thisView?.Map;
                SpatialReference mapSpatialReference = map?.SpatialReference;
                SpatialReference spatialReference    = spatRel?.ArcGisSpatialReference ?? mapSpatialReference;
                MapPoint point = MapPointBuilder.CreateMapPoint(x, y, spatialReference);
                MapPoint mapPoint;

                if (mapSpatialReference != null && spatialReference.Wkid != mapSpatialReference.Wkid)
                {
                    ProjectionTransformation projection = ProjectionTransformation.Create(spatialReference, mapSpatialReference);
                    mapPoint = GeometryEngine.Instance.ProjectEx(point, projection) as MapPoint;
                }
                else
                {
                    mapPoint = (MapPoint)point.Clone();
                }

                if (mapPoint != null && !mapPoint.IsEmpty)
                {
                    CIMColor cimColor          = ColorFactory.Instance.CreateColor(Color.Black);
                    CIMMarker cimMarker        = SymbolFactory.Instance.ConstructMarker(cimColor, size, SimpleMarkerStyle.Cross);
                    CIMPointSymbol pointSymbol = SymbolFactory.Instance.ConstructPointSymbol(cimMarker);
                    CIMSymbolReference pointSymbolReference = pointSymbol.MakeSymbolReference();
                    IDisposable disposeCross = thisView.AddOverlay(mapPoint, pointSymbolReference);

                    _disposeCross?.Dispose();
                    _disposeCross = disposeCross;
                }
            });
        }
        protected override Task <bool> OnSketchCompleteAsync(Geometry geometry)
        {
            if (Module1.Current.SelectedGraphicsLayerTOC == null)
            {
                MessageBox.Show("Select a graphics layer in the TOC", "No graphics layer selected",
                                System.Windows.MessageBoxButton.OK, System.Windows.MessageBoxImage.Exclamation);
                return(Task.FromResult(true));
            }

            if (_pointSymbol == null)
            {
                return(Task.FromResult(true));
            }
            return(QueuedTask.Run(() =>
            {
                var selectedElements = Module1.Current.SelectedGraphicsLayerTOC.GetSelectedElements().
                                       OfType <GraphicElement>();

                //If only one element is selected, is it of type Point?
                if (selectedElements.Count() == 1)
                {
                    if (selectedElements.FirstOrDefault().GetGraphic() is CIMPointGraphic) //It is a Point
                    {
                        //So we use it
                        var polySymbol = selectedElements.FirstOrDefault().GetGraphic() as CIMPointGraphic;
                        _pointSymbol = polySymbol.Symbol.Symbol as CIMPointSymbol;
                    }
                }
                var cimGraphicElement = new CIMPointGraphic
                {
                    Location = geometry as MapPoint,
                    Symbol = _pointSymbol.MakeSymbolReference()
                };
                Module1.Current.SelectedGraphicsLayerTOC.AddElement(cimGraphicElement);
                return true;
            }));
        }
 private static void SetupOverlaySymbols()
 {
     QueuedTask.Run(() =>
     {
         var markerCoordPoint = SymbolFactory.ConstructMarker(ColorFactory.GreenRGB, 12,
             SimpleMarkerStyle.Circle);
         _pointCoordSymbol = SymbolFactory.ConstructPointSymbol(markerCoordPoint);
     });
 }
        /// <summary>
        /// Create a CIMPointGaphic which can be added to the MapView overlay.
        /// </summary>
        /// <param name="point">The location for the point (as a CIM point)</param>
        /// <returns></returns>
        public CIMPointGraphic MakeCIMPointGraphic(PointN point)
        {
            CIMMarker marker = SymbolFactory.ConstructMarker(Red, 10, SimpleMarkerStyle.Star);

            CIMSymbolLayer[] layers = new CIMSymbolLayer[1];
            layers[0] = marker;

            CIMPointSymbol pointSymbol = new CIMPointSymbol();
            pointSymbol.SymbolLayers = layers;
            pointSymbol.ScaleX = 1;

            CIMSymbolReference symbolRef = new CIMSymbolReference();
            symbolRef.Symbol = pointSymbol;

            CIMPointGraphic pointGraphic = new CIMPointGraphic();
            ArcGIS.Core.Geometry.SpatialReference spatialRef = SpatialReferenceBuilder.CreateSpatialReference(point.SpatialReference.WKID);
            MapPoint mapPoint = MapPointBuilder.CreateMapPoint(point.X, point.Y, spatialRef);
            pointGraphic.Location = mapPoint;
            pointGraphic.Symbol = symbolRef;

            return pointGraphic;
        }
        /// <summary>
        /// Create a CIMPointGaphic which can be added to the MapView overlay.
        /// </summary>
        /// <param name="point">The location for the point (as a CIM point)</param>
        /// <returns></returns>
        public  CIMPointGraphic MakeCIMPointGraphic(PointN point)
        {

            ////CIMMarker marker = SymbolHelper.ConstructMarker(Red, 10, SimpleMarkerStyle.Circle);
            
            CIMMarker marker = SymbolHelper.ConstructMarker(Red, 10, SimpleMarkerStyle.Star);

            CIMSymbolLayer[] layers = new CIMSymbolLayer[1];
            layers[0] = marker;

            CIMPointSymbol pointSymbol = new CIMPointSymbol();
            pointSymbol.SymbolLayers = layers;
            pointSymbol.ScaleX = 1;

            CIMSymbolReference symbolRef = new CIMSymbolReference();
            symbolRef.Symbol = pointSymbol;

            CIMPointGraphic pointGraphic = new CIMPointGraphic();
            pointGraphic.Location = point;
            pointGraphic.Symbol = symbolRef;

            return pointGraphic;
        }