AnsweredAssumed Answered

add callout text symbols to selected features in layout

Question asked by helenchu on May 29, 2020
Latest reply on Jun 18, 2020 by helenchu


I found a snippet for creating callout text symbol below.  What I need is to add callout text symbols to all selected features in layout.  How do I use my selected feature centroid x, y with the codes below ?  Thank you for your help.

private static Task<CIMTextSymbol> CreateBackgroundCalloutAsync() {     return QueuedTask.Run<CIMTextSymbol>(() =>    {         var textSymbol = SymbolFactory.Instance.ConstructTextSymbol(ColorFactory.Instance.BlackRGB, 8, "Tahoma", "Bold");         //Create a call out        var backgroundCalloutSymbol = new CIMBackgroundCallout();         //Leader line        //Get a line symbol        var lineSymbol = SymbolFactory.Instance.ConstructLineSymbol(ColorFactory.Instance.BlackRGB, 1, SimpleLineStyle.DashDotDot);         //Create a solid fill polygon symbol for the callout.        var aquaBackground = ColorFactory.Instance.CreateRGBColor(190, 255, 232, 100);         var polySymbol = SymbolFactory.Instance.ConstructPolygonSymbol(aquaBackground, SimpleFillStyle.Solid);         //assign the line to the callout        backgroundCalloutSymbol.LeaderLineSymbol = lineSymbol;         //Offset for the text        textSymbol.OffsetX = 10;         textSymbol.OffsetY = 10;         //Assign the polygon to the background callout        backgroundCalloutSymbol.BackgroundSymbol = polySymbol;         //Accent bar        var accentSymbol = SymbolFactory.Instance.ConstructLineSymbol(ColorFactory.Instance.BlackRGB, 2, SimpleLineStyle.Solid);         backgroundCalloutSymbol.AccentBarSymbol = accentSymbol;         //Set margins for the callout        backgroundCalloutSymbol.Margin = new CIMTextMargin        {             Left = 5,             Right = 5,             Top = 5,             Bottom = 5        };                  //assign the callout to the textSymbol        textSymbol.Callout = backgroundCalloutSymbol;         return textSymbol;     }); }