ArcGIS pro=callout
Creates a simple line callout text symbol
Creates a simple line callout text symbol. The CIMSimpleLineCallout created is a dash-dot-dash line symbol with an offset of 10 from the geometry being labeled.
private static Task<CIMTextSymbol> CreateSimpleLineCalloutAsync()
{
return QueuedTask.Run<CIMTextSymbol>(() => {
//create a text symbol
var textSymbol = SymbolFactory.Instance.ConstructTextSymbol(ColorFactory.Instance.BlackRGB, 10, "Verdana", "Regular");
//Create a line call out
var lineCalloutSymbol = new CIMSimpleLineCallout();
//Get a line symbol
var lineSymbol = SymbolFactory.Instance.ConstructLineSymbol(ColorFactory.Instance.BlackRGB, 1, SimpleLineStyle.DashDotDot);
//assign the line symbol to the callout
lineCalloutSymbol.LineSymbol = lineSymbol;
//Offset for the text
textSymbol.OffsetX = 10;
textSymbol.OffsetY = 10;
//Assign the callout to the text symbol
textSymbol.Callout = lineCalloutSymbol;
return textSymbol;
});
}
Creates a balloon callout text symbol
Creates a black banner balloon callout text symbol. The CIMBalloonCallout created is a rectangular polygon with rounded corners.
private static Task<CIMTextSymbol> CreateBalloonCalloutAsync()
{
return QueuedTask.Run<CIMTextSymbol>(() =>
{
//create a text symbol
var textSymbol = SymbolFactory.Instance.ConstructTextSymbol(ColorFactory.Instance.WhiteRGB, 11, "Corbel", "Regular");
//A balloon callout
var balloonCallout = new CIMBalloonCallout();
//set the callout's style
balloonCallout.BalloonStyle = BalloonCalloutStyle.RoundedRectangle;
//Create a solid fill polygon symbol for the callout.
var polySymbol = SymbolFactory.Instance.ConstructPolygonSymbol(ColorFactory.Instance.BlackRGB, SimpleFillStyle.Solid);
//Set the callout's background to be the black polygon symbol
balloonCallout.BackgroundSymbol = polySymbol;
//margin inside the callout to place the text
balloonCallout.Margin = new CIMTextMargin
{
Left = 5,
Right = 5,
Bottom = 5,
Top = 5
};
//assign the callout to the text symbol's callout property
textSymbol.Callout = balloonCallout;
return textSymbol;
});
}
Creates a point callout text symbol
Creates a highway shield callout text symbol. The CIMPointSymbolCallout created is a highway shield point symbol from the ArcGIS 2D style.
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;
});
}
Creates a background callout text symbol
Creates a solid fill background text symbol with an Accent bar and leader line. The CIMBackgroundCallout created has a solid fill aqua polygon, with a black dash-dot-dash leader line and a solid accent bar.
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;
});
}