In This Topic
Represents a symbol layer. Symbol layers are the components that make up a symbol. A symbol layer is represented by a stroke, fill, marker, or procedural symbol layer.
Syntax
Example
How to construct a multilayer line symbol with circle markers on the line ends
//These methods must be called within the lambda passed to QueuedTask.Run
var lineStrokeRed = SymbolFactory.Instance.ConstructStroke(ColorFactory.Instance.RedRGB, 4.0);
var markerCircle = SymbolFactory.Instance.ConstructMarker(ColorFactory.Instance.RedRGB, 12, SimpleMarkerStyle.Circle);
markerCircle.MarkerPlacement = new CIMMarkerPlacementOnVertices()
{
AngleToLine = true,
PlaceOnEndPoints = true,
Offset = 0
};
var lineSymbolWithCircles = new CIMLineSymbol()
{
SymbolLayers = new CIMSymbolLayer[2] { markerCircle, lineStrokeRed }
};
How to construct a multilayer line symbol with an arrow head on the end
//These methods must be called within the lambda passed to QueuedTask.Run
var markerTriangle = SymbolFactory.Instance.ConstructMarker(ColorFactory.Instance.RedRGB, 12, SimpleMarkerStyle.Triangle);
markerTriangle.Rotation = -90; // or -90
markerTriangle.MarkerPlacement = new CIMMarkerPlacementOnLine() { AngleToLine = true, RelativeTo = PlacementOnLineRelativeTo.LineEnd };
var lineSymbolWithArrow = new CIMLineSymbol()
{
SymbolLayers = new CIMSymbolLayer[2] { markerTriangle,
SymbolFactory.Instance.ConstructStroke(ColorFactory.Instance.RedRGB, 2)
}
};
Snippet Mesh procedural texture symbol
/// <summary>
/// Creates Mesh procedural symbol with various textures.
/// ![MeshProceduralTexture](http://Esri.github.io/arcgis-pro-sdk/images/Symbology/mesh-procedural-texture.png)
/// </summary>
/// <remarks>Note: The rule package used in this method can be obtained from the Sample Data included in the arcgis-pro-sdk-community-samples repository.</remarks>
/// <returns></returns>
private static readonly string _rulePkgPath = @"C:\Data\RulePackages\MultipatchTextures.rpk";
public static Task<CIMMeshSymbol> CreateProceduralMeshSymbolAsync()
{
return QueuedTask.Run<CIMMeshSymbol>(() =>
{
CIMSymbolLayer[] proceduralSymbolLyr =
{
new CIMProceduralSymbolLayer()
{
PrimitiveName = "Textures",
RulePackage = _rulePkgPath,
RulePackageName = "Textures",
}
};
var myMeshSymbol = new CIMMeshSymbol()
{
SymbolLayers = proceduralSymbolLyr
};
return myMeshSymbol;
});
}
Snippet Cross hatch
/// <summary>
/// Create a polygon symbol using the ConstructHatchFill method . <br/>
/// ![PolygonSymbolDiagonalCrossHatch](http://Esri.github.io/arcgis-pro-sdk/images/Symbology/ConstructHatchFill.png)
/// </summary>
/// <returns></returns>
private static Task<CIMPolygonSymbol> CreateHatchFillPolygonAsync()
{
return QueuedTask.Run<CIMPolygonSymbol>(() =>
{
CIMStroke lineStroke = SymbolFactory.Instance.ConstructStroke(CIMColor.CreateRGBColor(51, 51, 51, 60), 4, SimpleLineStyle.Solid);
//gradient
var hatchFill = SymbolFactory.Instance.ConstructHatchFill(lineStroke, 45, 6, 0);
List<CIMSymbolLayer> symbolLayers = new List<CIMSymbolLayer>
{
hatchFill
};
return new CIMPolygonSymbol() { SymbolLayers = symbolLayers.ToArray() };
});
}
Snippet Gradient color fill using CIMGradientFill
/// <summary>
/// Create a polygon symbol with a gradient color fill. <br/>
/// ![PolygonSymbolGradientColor](http://Esri.github.io/arcgis-pro-sdk/images/Symbology/polygon-gradient-color.png)
/// </summary>
/// <remarks>
/// 1. Create a solid colored stroke with 50% transparency
/// 1. Create a fill using gradient colors red through green
/// 1. Apply both the stroke and fill as a symbol layer array to the new PolygonSymbol
/// </remarks>
/// <returns></returns>
public static Task<CIMPolygonSymbol> CreateGradientFillAsync()
{
return QueuedTask.Run<CIMPolygonSymbol>(() =>
{
var trans = 50.0;//semi transparent
CIMStroke outline = SymbolFactory.Instance.ConstructStroke(CIMColor.CreateRGBColor(0, 0, 0, trans), 2.0, SimpleLineStyle.Solid);
//Mimic cross hatch
CIMFill solidColorHatch =
new CIMGradientFill()
{
ColorRamp = ColorFactory.Instance.ConstructColorRamp(ColorRampAlgorithm.LinearContinuous,
ColorFactory.Instance.RedRGB, ColorFactory.Instance.GreenRGB)
};
List<CIMSymbolLayer> symbolLayers = new List<CIMSymbolLayer>
{
outline,
solidColorHatch
};
return new CIMPolygonSymbol() { SymbolLayers = symbolLayers.ToArray() };
});
}
Snippet Gradient color fill using CIMGradientFill
/// <summary>
/// Create a polygon symbol with a gradient color fill. <br/>
/// ![PolygonSymbolGradientColor](http://Esri.github.io/arcgis-pro-sdk/images/Symbology/polygon-gradient-color.png)
/// </summary>
/// <remarks>
/// 1. Create a solid colored stroke with 50% transparency
/// 1. Create a fill using gradient colors red through green
/// 1. Apply both the stroke and fill as a symbol layer array to the new PolygonSymbol
/// </remarks>
/// <returns></returns>
public static Task<CIMPolygonSymbol> CreateGradientFillAsync()
{
return QueuedTask.Run<CIMPolygonSymbol>(() =>
{
var trans = 50.0;//semi transparent
CIMStroke outline = SymbolFactory.Instance.ConstructStroke(CIMColor.CreateRGBColor(0, 0, 0, trans), 2.0, SimpleLineStyle.Solid);
//Mimic cross hatch
CIMFill solidColorHatch =
new CIMGradientFill()
{
ColorRamp = ColorFactory.Instance.ConstructColorRamp(ColorRampAlgorithm.LinearContinuous,
ColorFactory.Instance.RedRGB, ColorFactory.Instance.GreenRGB)
};
List<CIMSymbolLayer> symbolLayers = new List<CIMSymbolLayer>
{
outline,
solidColorHatch
};
return new CIMPolygonSymbol() { SymbolLayers = symbolLayers.ToArray() };
});
}
Inheritance Hierarchy
Requirements
Target Platforms: Windows 11, Windows 10
ArcGIS Pro version: 3 or higher.
See Also