com.esri.core.renderer
Class UniqueValueRenderer

java.lang.Object
  extended by com.esri.core.renderer.UniqueValueRenderer
All Implemented Interfaces:
Renderer<Graphic>, Serializable

public class UniqueValueRenderer
extends Object
implements Renderer<Graphic>

A unique value renderer. The renderer provides a symbol based on the value of up to three attributes of a graphic.

See Also:
Serialized Form

Field Summary
static String TYPE
           
 
Constructor Summary
UniqueValueRenderer()
          Default constructor.
UniqueValueRenderer(org.codehaus.jackson.JsonNode node)
          Creates a renderer from a JSON node.
UniqueValueRenderer(Symbol symbol, String attribute)
          Creates a renderer with a default symbol and using a single attribute.
UniqueValueRenderer(Symbol symbol, String attribute1, String attribute2)
          Creates a renderer with a default symbol and using two attributes.
UniqueValueRenderer(Symbol symbol, String attribute1, String attribute2, String attribute3)
          Creates a renderer with a default symbol and using three attributes.
 
Method Summary
 void addValue(UniqueValueInfo info)
          Add a unique value to the renderer.
 String getAttributeName1()
          Get the name of the first attribute being used.
 String getAttributeName2()
          Get the name of the second attribute being used.
 String getAttributeName3()
          Get the name of the third attribute being used.
 String getDefaultLabel()
          Gets the default label.
 Symbol getDefaultSymbol()
          Gets the current default symbol used when a graphic does not match any of the unique values.
 Symbol getSymbol(Graphic graphic)
          Subclasses must override this method.
 ArrayList<UniqueValueInfo> getUniqueValues()
          Gets a list of all the unique values.
 void removeAll()
          Removes all the unique values.
 void removeValue(UniqueValueInfo info)
          Remove a unique value from the renderer.
 void setAttributeName1(String attribute)
          Set the first attribute name.
 void setAttributeName2(String attribute)
          Set the second attribute name.
 void setAttributeName3(String attribute)
          Set the third attribute name.
 void setDefaultLabel(String label)
          Sets the default label.
 void setDefaultSymbol(Symbol symbol)
          Set the default symbol used when a graphic does not match any of the unique values.
 String toJson()
          Converts into a JSON string.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TYPE

public static final String TYPE
See Also:
Constant Field Values
Constructor Detail

UniqueValueRenderer

public UniqueValueRenderer(org.codehaus.jackson.JsonNode node)
                    throws Exception
Creates a renderer from a JSON node.

Parameters:
node - The JSON node.
Throws:
Exception

UniqueValueRenderer

public UniqueValueRenderer()
Default constructor.


UniqueValueRenderer

public UniqueValueRenderer(Symbol symbol,
                           String attribute)
Creates a renderer with a default symbol and using a single attribute.

Parameters:
symbol - The symbol.
attribute - The attribute name.

UniqueValueRenderer

public UniqueValueRenderer(Symbol symbol,
                           String attribute1,
                           String attribute2)
Creates a renderer with a default symbol and using two attributes.

Parameters:
symbol - The symbol.
attribute1 - An attribute name.
attribute2 - An attribute name.

UniqueValueRenderer

public UniqueValueRenderer(Symbol symbol,
                           String attribute1,
                           String attribute2,
                           String attribute3)
Creates a renderer with a default symbol and using three attributes.

Parameters:
symbol - The symbol.
attribute1 - An attribute name.
attribute2 - An attribute name.
attribute3 - An attribute name.
Method Detail

getSymbol

public Symbol getSymbol(Graphic graphic)
Description copied from interface: Renderer
Subclasses must override this method. You wouldn't typically work with this method unless you need to create your own renderer.

Specified by:
getSymbol in interface Renderer<Graphic>
Parameters:
graphic - The Graphic to symbolize.
Returns:
the symbol based on the properties of the graphic.

addValue

public void addValue(UniqueValueInfo info)
Add a unique value to the renderer.

Parameters:
info - The unique value.

removeValue

public void removeValue(UniqueValueInfo info)
Remove a unique value from the renderer.

Parameters:
info - The unique value to remove.

getAttributeName1

public String getAttributeName1()
Get the name of the first attribute being used.

Returns:
The attribute name.

setAttributeName1

public void setAttributeName1(String attribute)
Set the first attribute name.

Parameters:
attribute - The name of an attribute.

getAttributeName2

public String getAttributeName2()
Get the name of the second attribute being used.

Returns:
The attribute name.

setAttributeName2

public void setAttributeName2(String attribute)
Set the second attribute name.

Parameters:
attribute - The name of an attribute.

getAttributeName3

public String getAttributeName3()
Get the name of the third attribute being used.

Returns:
The attribute name.

setAttributeName3

public void setAttributeName3(String attribute)
Set the third attribute name.

Parameters:
attribute - The name of an attribute.

setDefaultLabel

public void setDefaultLabel(String label)
Sets the default label.

Parameters:
label - the new default label

getDefaultLabel

public String getDefaultLabel()
Gets the default label.

Returns:
the default label

setDefaultSymbol

public void setDefaultSymbol(Symbol symbol)
Set the default symbol used when a graphic does not match any of the unique values.

Parameters:
symbol - The symbol to use.

getDefaultSymbol

public Symbol getDefaultSymbol()
Gets the current default symbol used when a graphic does not match any of the unique values.

Returns:
The symbol.

getUniqueValues

public ArrayList<UniqueValueInfo> getUniqueValues()
Gets a list of all the unique values.

Returns:
The unique values.

removeAll

public void removeAll()
Removes all the unique values. Does not remove the default symbol or attibute settings.


toJson

public String toJson()
              throws Exception
Converts into a JSON string.

Specified by:
toJson in interface Renderer<Graphic>
Returns:
a JSON string.
Throws:
Exception


Copyright © 2012. All Rights Reserved.