ESRI.ArcGIS.ADF.IMS
UniqueValue Constructor
See Also  Example
ESRI.ArcGIS.ADF.IMS.Display.Renderer Namespace > UniqueValue Class : UniqueValue Constructor




Constructs a UniqueValue object.

Syntax

Visual Basic (Declaration) 
Public Function New()
Visual Basic (Usage)Copy Code
Dim instance As UniqueValue()
C# 
public UniqueValue()

Example

The following example displays capital and non-capital cities with different symbols: larger star and smaller circle. A ValueMapRenderer is created, and two UniqueValue objects are created, one for capitals and one for non-capitals. These are added to the renderer, and the renderer is assigned to the existing cities layer.
Visual BasicCopy Code
' Create a new ValueMapRenderer and set value field

Dim valueMapRend As New ValueMapRenderer()

valueMapRend.ValueField = "CAPITAL"



' Ranges below should cover all population sizes, but just in case we miss any...

valueMapRend.DefaultLabel = "Other"

valueMapRend.DefaultSymbol = New SimpleMarkerSymbol(Drawing.Color.Gray, 5)



Dim uniqueValue As UniqueValue



' Create unique values for capitals and non-capitals

uniqueValue = New UniqueValue()

uniqueValue.Value = "Y"

uniquevalue.ComparisonMethod = ComparisonMethod.IsExact

uniqueValue.SymbolLabel = "Capital"

uniqueValue.Symbol = New SimpleMarkerSymbol(Drawing.Color.OrangeRed, 20, MarkerSymbolType.Star)

valueMapRend.Values.Add(uniqueValue)



uniqueValue = New UniqueValue()

uniqueValue.Value = "N"

uniqueValue.SymbolLabel = "Non-capital"

uniqueValue.Symbol = New SimpleMarkerSymbol(Drawing.Color.Gray, 10)

valueMapRend.Values.Add(uniqueValue)



' Assign the ValueMapRenderer to an existing point layer

Dim layer As FeatureLayer = mapView.Layers.FindByName("Cities")

layer.Renderer = valueMapRend

C#Copy Code
// Create a new ValueMapRenderer and set value field 

ValueMapRenderer valueMapRend = new ValueMapRenderer(); 

valueMapRend.ValueField = "CAPITAL"; 

  

// Ranges below should cover all population sizes, but just in case we miss any... 

valueMapRend.DefaultLabel = "Other"; 

valueMapRend.DefaultSymbol = new SimpleMarkerSymbol(Drawing.Color.Gray, 5); 

  

UniqueValue uniqueValue; 

  

// Create unique values for capitals and non-capitals 

uniqueValue = new UniqueValue(); 

uniqueValue.Value = "Y"; 

uniquevalue.ComparisonMethod = ComparisonMethod.IsExact; 

uniqueValue.SymbolLabel = "Capital"; 

uniqueValue.Symbol = new SimpleMarkerSymbol(Drawing.Color.OrangeRed, 20, MarkerSymbolType.Star); 

valueMapRend.Values.Add(uniqueValue); 

  

uniqueValue = new UniqueValue(); 

uniqueValue.Value = "N"; 

uniqueValue.SymbolLabel = "Non-capital"; 

uniqueValue.Symbol = new SimpleMarkerSymbol(Drawing.Color.Gray, 10); 

valueMapRend.Values.Add(uniqueValue); 

  

// Assign the ValueMapRenderer to an existing point layer 

FeatureLayer layer = mapView.Layers.FindByName("Cities"); 

layer.Renderer = valueMapRend; 

    

See Also

© 2010 All Rights Reserved.