ArcGIS Pro注记编辑
internal class ChangeSymbol : Button { protected async override void OnClick() { var annoLayer = MapView.Active.Map.GetLayersAsFlattenedList().OfType<AnnotationLayer>().FirstOrDefault(); if (annoLayer == null) return; await QueuedTask.Run(() => { var select = annoLayer.GetSelection(); if (select.GetObjectIDs().Count() > 0) { var oid = select.GetObjectIDs().First(); QueryFilter qf = new QueryFilter() { WhereClause = $"OBJECTID = {oid}" }; var rowCursor = annoLayer.GetTable().Search(qf, false); rowCursor.MoveNext(); var annoFeature = rowCursor.Current as ArcGIS.Core.Data.Mapping.AnnotationFeature; var graphic = annoFeature.GetGraphic(); var textGraphic = graphic as CIMTextGraphic; var op = new EditOperation(); op.Name = "Change Anno"; op.Callback((context) => { //make the callout for the circle var callOut = new CIMPointSymbolCallout(); callOut.PointSymbol = new CIMPointSymbol(); //Circle outline var circle_outline = SymbolFactory.Instance.ConstructMarker(40, "ESRI Default Marker") as CIMCharacterMarker; circle_outline.Size = 30; //eliminate the outline foreach (var layer in circle_outline.Symbol.SymbolLayers) { if (layer is CIMSolidStroke) { ((CIMSolidStroke) layer).Width = 0; } } //Circle fill var circle_fill = SymbolFactory.Instance.ConstructMarker(172, "ESRI Default Marker") as CIMCharacterMarker; circle_fill.Size = 30; //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 = 8;//adjust as needed //now set the text textGraphic.Text = "12 <SUP><UND>00</UND></SUP>"; annoFeature.SetGraphic(textGraphic); annoFeature.Store(); context.Invalidate(annoFeature); }, annoLayer.GetTable()); op.Execute(); } }); } } Related Text Annotation displaying problem Formatting in Add-in Description Dynamic text renderer How to access or set Text Symbol from Table Frame ... Number format in colorizer Related Tags arcgis pro sdkarcgis procarcgisprosdkpro sdkarcgisprosdkarcgis pro sdk for .netarcgisarcgis pro sdk 2.5 View All ≫