/// <summary> /// Upon activating the custom tool, the segment symbology is modified in this method and the regular unselected vertices symbology is also modified. /// </summary> /// <param name="active"></param> /// <returns></returns> protected override Task OnToolActivateAsync(bool active) { return(QueuedTask.Run(() => { //Getting the current symbology options of the segment var segmentOptions = GetSketchSegmentSymbolOptions(); //Modifying the primary color and the width of the segment symbology options var orange = new CIMRGBColor(); orange.R = 255; orange.G = 165; orange.B = 0; segmentOptions.PrimaryColor = orange; segmentOptions.Width = 4; //Creating a new vertex symbol options instance with the values you want var vertexOptions = new VertexSymbolOptions(VertexSymbolType.RegularUnselected); var yellow = new CIMRGBColor(); yellow.R = 255; yellow.G = 215; yellow.B = 0; var purple = new CIMRGBColor(); purple.R = 148; purple.G = 0; purple.B = 211; vertexOptions.AngleRotation = 45; vertexOptions.Color = yellow; vertexOptions.MarkerType = VertexMarkerType.Star; vertexOptions.OutlineColor = purple; vertexOptions.OutlineWidth = 3; vertexOptions.Size = 5; try { //Setting the value of the segment symbol options SetSketchSegmentSymbolOptions(segmentOptions); //Setting the value of the vertex symbol options of the regular unselected vertices using the vertexOptions instance created above. SetSketchVertexSymbolOptions(VertexSymbolType.RegularUnselected, vertexOptions); } catch (Exception ex) { System.Diagnostics.Debug.WriteLine($@"Unexpected Exception: {ex}"); } })); }
/// <summary> /// On activating this MapTool, the sketch segment symbology is modified along with the symbologies of the /// unselected current and unselected regular vertices of the sketch. /// The SketchSymbol property of the MapTool is also modified, which is different from the sketch segment and vertices. /// This property is used to customize the fixed part of the sketch, i.e. the part of the sketch that shows you what the /// output will look like if you finish the sketch right then without doing any more edits. /// </summary> /// <param name="active"></param> /// <returns></returns> protected override Task OnToolActivateAsync(bool active) { var darkBlue = new CIMRGBColor() { R = 0, G = 76, B = 153 }; var lightBlue = new CIMRGBColor() { R = 102, G = 178, B = 255 }; var darkGreen = new CIMRGBColor() { R = 0, G = 153, B = 0 }; var lightGreen = new CIMRGBColor() { R = 102, G = 255, B = 102 }; var red = new CIMRGBColor() { R = 153, G = 0, B = 0 }; var white = new CIMRGBColor() { R = 255, G = 255, B = 255 }; //return base.OnToolActivateAsync(active); return(QueuedTask.Run(() => { //Getting the current symbology options of the segment var segmentOptions = GetSketchSegmentSymbolOptions(); //Modifying the primary color, secondary color, and the width of the segment symbology options segmentOptions.PrimaryColor = darkBlue; segmentOptions.Width = 1.5; segmentOptions.SecondaryColor = lightBlue; //Creating a new vertex symbol options instances with the values you want //Vertex symbol options instance 1 var vertexOptions = new VertexSymbolOptions(VertexSymbolType.RegularUnselected); vertexOptions.Color = darkGreen; vertexOptions.MarkerType = VertexMarkerType.Circle; vertexOptions.OutlineColor = lightGreen; vertexOptions.OutlineWidth = 4; vertexOptions.Size = 8; //Vertex symbol options instance 2 var vertexOptions2 = new VertexSymbolOptions(VertexSymbolType.CurrentUnselected); vertexOptions2.Color = white; vertexOptions2.OutlineColor = red; vertexOptions2.MarkerType = VertexMarkerType.PushPin; vertexOptions2.OutlineWidth = 5; vertexOptions2.Size = 10; try { //Setting the value of the segment symbol options SetSketchSegmentSymbolOptions(segmentOptions); //Setting the value of the vertex symbol options of the regular unselected vertices using the vertexOptions instance 1 created above. SetSketchVertexSymbolOptions(VertexSymbolType.RegularUnselected, vertexOptions); //Setting symbol options of current unselected vertex SetSketchVertexSymbolOptions(VertexSymbolType.CurrentUnselected, vertexOptions2); //Similarly you can set symbol options for current selected vertex and regular selected vertex //SetSketchVertexSymbolOptions(VertexSymbolType.CurrentSelected, vertexOptions3); //SetSketchVertexSymbolOptions(VertexSymbolType.RegularSelected, vertexOptions4); //Modifying the SketchSymbol property of the MapTool var yellow = CIMColor.CreateRGBColor(255, 215, 0); var cimLineSymbol = SymbolFactory.Instance.ConstructLineSymbol(yellow, 4, SimpleLineStyle.DashDotDot); base.SketchSymbol = cimLineSymbol.MakeSymbolReference(); } catch (Exception ex) { System.Diagnostics.Debug.WriteLine($@"Unexpected Exception: {ex}"); } })); }