/// <summary> /// Creates a highway shield callout text symbol. The [CIMPointSymbolCallout](http://pro.arcgis.com/en/pro-app/sdk/api-reference/#topic4116.html) created is a highway shield point symbol from the ArcGIS 2D style. /// ![lineCallOut](http://Esri.github.io/arcgis-pro-sdk/images/Labeling/highway-callout.png "Highway shield text symbol") /// </summary> /// <returns></returns> private static Task <CIMTextSymbol> CreatePointCallOutAsync() { return(QueuedTask.Run <CIMTextSymbol>(() => { //create a text symbol var textSymbol = SymbolFactory.Instance.ConstructTextSymbol(ColorFactory.Instance.WhiteRGB, 6, "Tahoma", "Bold"); //Create a call out var shieldCalloutSymbol = new CIMPointSymbolCallout(); //Get a Shield symbolStyleItem from ArcGIS 2D StyleProjectitem var symbolStyleItem = GetPointSymbol("ArcGIS 2D", "Shield 1"); //assign the point symbol (Highway shield) to the callout shieldCalloutSymbol.PointSymbol = symbolStyleItem.Symbol as CIMPointSymbol; shieldCalloutSymbol.PointSymbol.SetSize(18.0); //set symbol size //Assign the callout to the text symbol textSymbol.Callout = shieldCalloutSymbol; return textSymbol; })); }
public static void ShowPatchLabels(Patch patch) { foreach (var cg in CimGraphics) { cg.Dispose(); } CimGraphics.Clear(); int nodeNumber = 0; int maxCoordCount = patch.Coords.Count; int coordCount = 0; foreach (var coord in patch.Coords) { //MapView.Active.AddOverlay() var textGraphic = new CIMTextGraphic { Symbol = SymbolFactory.Instance.ConstructTextSymbol( ColorFactory.Instance.BlackRGB, 12, "Times New Roman", "Regular").MakeSymbolReference() }; //make the callout for the circle var callOut = new CIMPointSymbolCallout { PointSymbol = new CIMPointSymbol() }; //Circle outline - 40 var circle_outline = SymbolFactory.Instance.ConstructMarker(40, "ESRI Default Marker") as CIMCharacterMarker; //Square - 41 //Triangle - 42 //Pentagon - 43 //Hexagon - 44 //Octagon - 45 circle_outline.Size = 40; //eliminate the outline foreach (var layer in circle_outline.Symbol.SymbolLayers) { if (layer is CIMSolidStroke) { ((CIMSolidStroke)layer).Width = 0; } } //Circle fill - 33 var circle_fill = SymbolFactory.Instance.ConstructMarker(33, "ESRI Default Marker") as CIMCharacterMarker; //Square - 34 //Triangle - 35 //Pentagon - 36 //Hexagon - 37 //Octagon - 38 circle_fill.Size = 40; //eliminate the outline, make sure the fill is white foreach (var layer in circle_fill.Symbol.SymbolLayers) { if (layer is CIMSolidFill) { ((CIMSolidFill)layer).Color = ColorFactory.Instance.WhiteRGB; } else if (layer is CIMSolidStroke) { ((CIMSolidStroke)layer).Width = 0; } } var calloutLayers = new List <CIMSymbolLayer> { circle_outline, circle_fill }; //set the layers on the callout callOut.PointSymbol.SymbolLayers = calloutLayers.ToArray(); //set the callout on the text symbol var textSym = textGraphic.Symbol.Symbol as CIMTextSymbol; textSym.Callout = callOut; textSym.Height = 12;//adjust as needed //now set the text textGraphic.Text = $@"{nodeNumber++}"; // reposition the last two labels // 2 meters up System.Diagnostics.Debug.WriteLine($@"Pnt: {coordCount} {coord.X} {coord.Y} {coord.Z} "); var labelPnt = MapPointBuilder.CreateMapPoint(new Coordinate3D(coord.X, coord.Y, coord.Z + 4 * coordCount++)); textGraphic.Shape = labelPnt; CimGraphics.Add(MapView.Active.AddOverlay(textGraphic)); } }
protected override Task <bool> OnSketchCompleteAsync(Geometry geometry) { return(QueuedTask.Run(() => { //MapView.Active.AddOverlay() var textGraphic = new CIMTextGraphic(); textGraphic.Symbol = SymbolFactory.Instance.ConstructTextSymbol( ColorFactory.Instance.BlackRGB, 12, "Times New Roman", "Regular").MakeSymbolReference(); //make the callout for the circle var callOut = new CIMPointSymbolCallout(); callOut.PointSymbol = new CIMPointSymbol(); //Circle outline - 40 var circle_outline = SymbolFactory.Instance.ConstructMarker(40, "ESRI Default Marker") as CIMCharacterMarker; //Square - 41 //Triangle - 42 //Pentagon - 43 //Hexagon - 44 //Octagon - 45 circle_outline.Size = 40; //eliminate the outline foreach (var layer in circle_outline.Symbol.SymbolLayers) { if (layer is CIMSolidStroke) { ((CIMSolidStroke)layer).Width = 0; } } //Circle fill - 33 var circle_fill = SymbolFactory.Instance.ConstructMarker(33, "ESRI Default Marker") as CIMCharacterMarker; //Square - 34 //Triangle - 35 //Pentagon - 36 //Hexagon - 37 //Octagon - 38 circle_fill.Size = 40; //eliminate the outline, make sure the fill is white foreach (var layer in circle_fill.Symbol.SymbolLayers) { if (layer is CIMSolidFill) { ((CIMSolidFill)layer).Color = ColorFactory.Instance.WhiteRGB; } else if (layer is CIMSolidStroke) { ((CIMSolidStroke)layer).Width = 0; } } var calloutLayers = new List <CIMSymbolLayer>(); calloutLayers.Add(circle_outline); calloutLayers.Add(circle_fill); //set the layers on the callout callOut.PointSymbol.SymbolLayers = calloutLayers.ToArray(); //set the callout on the text symbol var textSym = textGraphic.Symbol.Symbol as CIMTextSymbol; textSym.Callout = callOut; textSym.Height = 12;//adjust as needed //now set the text textGraphic.Text = "12 <SUP><UND>00</UND></SUP>"; textGraphic.Shape = geometry; var graphic = MapView.Active.AddOverlay(textGraphic); Module1.Current.Graphics.Add(graphic); return true; })); }