Select to view content in your preferred language

How to set Point Symbol outline colour in UniqueValueRenderer

1598
3
04-05-2017 01:01 AM
jackpearson
Emerging Contributor

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 ]

0 Kudos
3 Replies
UmaHarano
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

0 Kudos
jackpearson
Emerging Contributor

Perfect / Brilliant - thanks for your help !

0 Kudos
afishdev
New Contributor

Is this the only way to create a point symbol and change the outline? Is there any way to actually adjust a CIMPointSymbol outline (not halo)?

For instance, I have:

var symbol = SymbolFactory.Instance.ConstructPointSymbol(ColorFactory.Instance.CreateRGBColor(0,0,0,0), 15);

 

Basically I want a Point Symbol with a Cyan outline and transparent fill. I can't find how to adjust the outline.

0 Kudos