I want to create a CIMSymbol that will be used in a unique value class renderer. The symbol should be a circle with red fill and the letter R in it.
This is what I have but the symbol comes out as empty and the Symbology tab shows "symbol has inconsistent geometry logic"
var textSymbol = SymbolFactory.Instance.ConstructTextSymbol(ColorFactory.Instance.BlackRGB, 8);
var fill = SymbolFactory.Instance.ConstructSolidFill(ColorFactory.Instance.RedRGB);
List<CIMSymbolLayer> symbolLayers = new List<CIMSymbolLayer>
{
new CIMVectorMarker()
{
MarkerGraphics = new CIMMarkerGraphic[]
{
new CIMMarkerGraphic()
{
Symbol = textSymbol,
TextString = "R"
}
}
},
fill
};
_symbolRightLimit = new CIMPointSymbol() { SymbolLayers = symbolLayers.ToArray() };
_symbolRightLimit.SetSize(10);
I have tried to use the Symbology tab to see what I can fix to make it work but it appears that the only way to make that error go away is to add a global effect to the symbol? And while the error went away, the symbol still did not render.
I have also tried to play with the CIM Viewer to see what I can do but have not managed to find anything.
Solved! Go to Solution.
I have actually figured it out by using the Symbology pane and the CIM Viewer and lots of back and forth
double size = 10;
CIMColor fillColor = ColorFactory.Instance.RedRGB;
var textSymbol = SymbolFactory.Instance.ConstructTextSymbol(ColorFactory.Instance.BlackRGB, size);
textSymbol.VerticalAlignment = VerticalAlignment.Center;
textSymbol.HorizontalAlignment = HorizontalAlignment.Center;
var fill = SymbolFactory.Instance.ConstructSolidFill(fillColor);
var marker = SymbolFactory.Instance.ConstructMarker() as CIMVectorMarker;
marker.MarkerPlacement = new CIMMarkerPlacementPolygonCenter();
marker.MarkerGraphics[0].Geometry = new PointN().ToCoreGeometry<MapPoint>();
marker.MarkerGraphics[0].Symbol = textSymbol;
marker.MarkerGraphics[0].TextString = "R";
List<CIMSymbolLayer> symbolLayers = new List<CIMSymbolLayer>
{
marker,
fill
};
var symbol = new CIMPointSymbol()
{
Effects = new List<CIMGeometricEffect> { new CIMGeometricEffectRegularPolygon() { Radius = size } }.ToArray(),
SymbolLayers = symbolLayers.ToArray()
};
symbol.SetSize(size);
return symbol;
Are you potentially replying on the wrong thread?
I have actually figured it out by using the Symbology pane and the CIM Viewer and lots of back and forth
double size = 10;
CIMColor fillColor = ColorFactory.Instance.RedRGB;
var textSymbol = SymbolFactory.Instance.ConstructTextSymbol(ColorFactory.Instance.BlackRGB, size);
textSymbol.VerticalAlignment = VerticalAlignment.Center;
textSymbol.HorizontalAlignment = HorizontalAlignment.Center;
var fill = SymbolFactory.Instance.ConstructSolidFill(fillColor);
var marker = SymbolFactory.Instance.ConstructMarker() as CIMVectorMarker;
marker.MarkerPlacement = new CIMMarkerPlacementPolygonCenter();
marker.MarkerGraphics[0].Geometry = new PointN().ToCoreGeometry<MapPoint>();
marker.MarkerGraphics[0].Symbol = textSymbol;
marker.MarkerGraphics[0].TextString = "R";
List<CIMSymbolLayer> symbolLayers = new List<CIMSymbolLayer>
{
marker,
fill
};
var symbol = new CIMPointSymbol()
{
Effects = new List<CIMGeometricEffect> { new CIMGeometricEffectRegularPolygon() { Radius = size } }.ToArray(),
SymbolLayers = symbolLayers.ToArray()
};
symbol.SetSize(size);
return symbol;