How to set Point Symbol outline colour in UniqueValueRenderer

854
2
04-05-2017 01:01 AM
Highlighted
New Contributor II

For a UniqueValueRendererfor point feature layer, I am creating classes using the following :

var uniqueValueClass = new CIMUniqueValueClass
{
  Values = uniqueValues.ToArray(),
  Label = compValue,
  Visible = true,
  Editable = true,
  Symbol = new CIMSymbolReference { Symbol = GetPointSymbol(symbolIndex, sizeVal,GetColor(colorIndex)) }
};

and creating the symbols :

private CIMPointSymbol GetPointSymbol(int symbolIndex, int sizeVal,CIMColor colour)
{
  var shapeDef = GetEsriSymbolTable[symbolIndex];

  var cimMarker = SymbolFactory.ConstructMarker(shapeDef.index, shapeDef.font, "Regular", sizeVal, colour); //create   marker from the Font, char index,size,colour
  cimMarker.Rotation = shapeDef.rotation;

  var pointSymbol = SymbolFactory.ConstructPointSymbol(cimMarker); //create a symbol from the marker

  return pointSymbol;
}

The colour is being applied to the fill, but not to the shape outline. How can i set the colour for the outline ?

GetEsriSymbolTable(symbolIndex) returns a tuple with font, character index and rotation ]

Reply
0 Kudos
2 Replies
Highlighted
Esri Regular Contributor

Hi Jack,

When you create your CIMMarker, create it as a CIMCharacterMarker. You can then access the "polygon symbol" used to render the marker and then access the SymbolLayers (components that make up the symbol) to change the fill and outline.  Here is a code snippet:

var cimMarker = SymbolFactory.ConstructMarker(symbolIndex, "Wingdings 3", "Regular", sizeVal, colour) as CIMCharacterMarker; //create   marker from the Font, char index,size,colour
var polygonMarker = cimMarker.Symbol;
//modifying the polygon's outline and fill
polygonMarker.SymbolLayers[0] = SymbolFactory.ConstructStroke(ColorFactory.GreenRGB, 2, SimpleLineStyle.Solid); //This is the outline
polygonMarker.SymbolLayers[1] = SymbolFactory.ConstructSolidFill(colour); //This is the fill
var pointSymbol = SymbolFactory.ConstructPointSymbol(cimMarker); //create a symbol from the marker ‍‍‍‍‍‍‍‍‍‍‍‍

Thanks

Uma Harano

Reply
0 Kudos
Highlighted
New Contributor II

Perfect / Brilliant - thanks for your help !

Reply
0 Kudos