public class

UniqueValueRenderer

extends BaseRenderer
java.lang.Object
   ↳ com.esri.core.renderer.BaseRenderer
     ↳ com.esri.core.renderer.UniqueValueRenderer

Class Overview

A unique value renderer symbolizes groups of graphics that have matching attributes. This is most common with nominal, or string data. For example, you could use a unique value renderer to symbolize zoning designations: yellow for "Residential", purple for "Industrial", red for "Commercial", and so on. You can also use unique value renderers on numeric fields that are coded values, or on ordinal attributes such as "First", "Second", "Third", and so on.

Typically features are rendered based on the unique values of one attribute field. However, up to three fields can be combined to generate a unique value.

Summary

Constants
String TYPE The Constant TYPE.
[Expand]
Inherited Fields
From class com.esri.core.renderer.BaseRenderer
Public Constructors
UniqueValueRenderer()
Instantiates an empty UniqueValueRenderer object.
UniqueValueRenderer(JsonNode node)
Instantiates UniqueValueRenderer from a Json node object.
Public Methods
boolean addUniqueValue(UniqueValue uniqueValue)
Adds a unique value.
String getDefaultLabel()
Gets the default label.
Symbol getDefaultSymbol()
Gets the default symbol.
String getField1()
Gets the name of the first attribute field used to match values against.
String getField2()
Gets the name of the optional second attribute field used to match values against.
String getField3()
Gets the name of the optional third attribute field used to match values against.
String getFieldDelimiter()
Gets the field delimiter.
Symbol getSymbol(Feature graphic)
Symbol getSymbol(Graphic graphic)
This method is deprecated. please use getSymbol(Feature)
List<UniqueValue> getUniqueValueInfos()
Gets a list of unique values.
boolean removeUniqueValue(UniqueValue uniqueValue)
Removes a unique value.
void setDefaultLabel(String defaultLabel)
Sets the default label.
void setDefaultSymbol(Symbol defaultSymbol)
Sets the default symbol.
void setField1(String field1)
Sets the name of the first attribute field used to match values against.
void setField2(String field2)
Sets the name of the optional second attribute field used to match values against.
void setField3(String field3)
Sets the name of the optional third attribute field used to match values against.
void setFieldDelimiter(String fieldDelimiter)
Sets the field delimiter.
void setUniqueValueInfos(List<UniqueValue> uniqueValueInfos)
Sets unique values.
FeatureType[] toTypes(Field[] fields, Geometry.Type type)
Creates templates out of the renderer.
Protected Methods
String getType()
void toJson(JsonGenerator node)
[Expand]
Inherited Methods
From class com.esri.core.renderer.BaseRenderer
From class java.lang.Object
From interface com.esri.core.renderer.Renderer

Constants

public static final String TYPE

The Constant TYPE.

Constant Value: "uniqueValue"

Public Constructors

public UniqueValueRenderer ()

Instantiates an empty UniqueValueRenderer object.

public UniqueValueRenderer (JsonNode node)

Instantiates UniqueValueRenderer from a Json node object.

Parameters
node JsonNode: the node
Throws
Exception the exception

Public Methods

public boolean addUniqueValue (UniqueValue uniqueValue)

Adds a unique value.

Parameters
uniqueValue UniqueValue: the unique value to add
Returns
boolean true if the unique value was added, or false if uniqueValue is null

public String getDefaultLabel ()

Gets the default label.

Returns
String the default label

public Symbol getDefaultSymbol ()

Gets the default symbol.

Returns
Symbol the default symbol used for unmatched values

public String getField1 ()

Gets the name of the first attribute field used to match values against.

Returns
String the name of the first attribute field

public String getField2 ()

Gets the name of the optional second attribute field used to match values against.

Returns
String the name of the second attribute field, or null if only a single field is used

public String getField3 ()

Gets the name of the optional third attribute field used to match values against.

Returns
String the name of the third attribute field, or null if only one or two fields are used

public String getFieldDelimiter ()

Gets the field delimiter. See setFieldDelimiter(String) for details.

Returns
String string inserted between the values of multiple attribute fields when serializing them to JSON

public Symbol getSymbol (Feature graphic)

Parameters
graphic Feature
Returns
Symbol

public Symbol getSymbol (Graphic graphic)

This method is deprecated.
please use getSymbol(Feature)

Returns the symbol of the unique value the graphic provided corresponds to.

Parameters
graphic Graphic: the graphic to be symbolized
Returns
Symbol the symbol

public List<UniqueValue> getUniqueValueInfos ()

Gets a list of unique values.

Returns
List<UniqueValue> the list of unique values

public boolean removeUniqueValue (UniqueValue uniqueValue)

Removes a unique value.

Parameters
uniqueValue UniqueValue: the unique value to remove
Returns
boolean true if the unique value was removed

public void setDefaultLabel (String defaultLabel)

Sets the default label.

Parameters
defaultLabel String: the default label to set

public void setDefaultSymbol (Symbol defaultSymbol)

Sets the default symbol.

Parameters
defaultSymbol Symbol: the default symbol used for unmatched values

public void setField1 (String field1)

Sets the name of the first attribute field used to match values against.

Parameters
field1 String: the name of the first attribute field

public void setField2 (String field2)

Sets the name of the optional second attribute field used to match values against.

Parameters
field2 String: the name of the second attribute field

public void setField3 (String field3)

Sets the name of the optional third attribute field used to match values against.

Parameters
field3 String: the name of the third attribute field

public void setFieldDelimiter (String fieldDelimiter)

Sets the field delimiter. This is used only when more than one attribute field is specified for matching and can be ignored otherwise. It is used to delimit field values when they are serialized to JSON and needs to be a string that does not occur in any of the UniqueValues that are passed to setUniqueValueInfos(List). It defaults to a comma.

Parameters
fieldDelimiter String: string inserted between the values of multiple attribute fields when serializing them to JSON

public void setUniqueValueInfos (List<UniqueValue> uniqueValueInfos)

Sets unique values.

Parameters
uniqueValueInfos List: the unique value list

public FeatureType[] toTypes (Field[] fields, Geometry.Type type)

Creates templates out of the renderer.

Parameters
fields Field: the field types
type Geometry.Type: the geometry type. The templates are defined on feature layers, the geometry type is defined on feature layers.
Returns
FeatureType[] the feature type[]

Protected Methods

protected String getType ()

Returns
String

protected void toJson (JsonGenerator node)

Parameters
node JsonGenerator
Throws
Exception