com.esri.core.map
Class Graphic

java.lang.Object
  extended by com.esri.core.map.Graphic
All Implemented Interfaces:
Serializable

public class Graphic
extends Object
implements Serializable

The Graphic class is used to represent a feature that can have geometry, a symbol, and attributes.

Graphic objects can be displayed using rendered using a GraphicsLayer (see the GraphicsLayer class for more details).

See Also:
Serialized Form

Field Summary
protected  Map<String,Object> attributes
          Name-value pairs of fields and their connected field values that are associated with the graphic.
 
Constructor Summary
Graphic()
          Instantiates an empty Graphic object.
Graphic(Geometry geometry)
          Instantiates a new Graphic object.
Graphic(Geometry geometry, Symbol symbol)
          Instantiates a new Graphic object.
 
Method Summary
 void addAttribute(String key, Object value)
          Sets the field name and the field value associated with the graphic.
 String[] getAttributeNames()
          Gets the name of all the attributes.
 Map<String,Object> getAttributes()
          Returns all attributes of the graphic as a read-only collection.
 Object getAttributeValue(String key)
          Gets the attribute value by the given name.
 Geometry getGeometry()
          Gets the geometry that defines the graphic.
 InfoTemplate getInfoTemplate()
          Returns the template.
 Symbol getSymbol()
          Gets the symbol for the graphic.
 void removeAllAttribute()
          Removes all the attributes associated with the graphic.
 void removeAttribute(String key)
          Removes a field from the graphic.
 void setAttributes(Map<String,Object> attrs)
          Sets the name-value pairs of fields and their connected field values that are associated with the graphic.
 Object setAttributeValue(String key, Object value)
          Sets the attribute value by the given name.
 void setGeometry(Geometry geometry)
          Sets the geometry that defines the graphic.
 void setInfoTemplate(InfoTemplate infoTemplate)
          Gets the template.
 void setSymbol(Symbol symbol)
          Sets the symbol for the graphic.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

attributes

protected final Map<String,Object> attributes
Name-value pairs of fields and their connected field values that are associated with the graphic.

Constructor Detail

Graphic

public Graphic(Geometry geometry,
               Symbol symbol)
Instantiates a new Graphic object.

Parameters:
geometry - the geometry to draw;
symbol - the symbol to draw the geometry with.

Graphic

public Graphic(Geometry geometry)
Instantiates a new Graphic object.

Parameters:
geometry - the geometry to draw;

Graphic

public Graphic()
Instantiates an empty Graphic object.

Method Detail

getSymbol

public Symbol getSymbol()
Gets the symbol for the graphic.


setSymbol

public void setSymbol(Symbol symbol)
Sets the symbol for the graphic.

Parameters:
symbol -

getGeometry

public Geometry getGeometry()
Gets the geometry that defines the graphic.


setGeometry

public void setGeometry(Geometry geometry)
Sets the geometry that defines the graphic.


setAttributes

public void setAttributes(Map<String,Object> attrs)
Sets the name-value pairs of fields and their connected field values that are associated with the graphic.


addAttribute

public void addAttribute(String key,
                         Object value)
Sets the field name and the field value associated with the graphic.

Parameters:
key - the field name;
value - the field value;

removeAttribute

public void removeAttribute(String key)
Removes a field from the graphic.


getAttributeNames

public String[] getAttributeNames()
Gets the name of all the attributes. Attributes are name-value pairs of fields and field values associated with the graphic.


getAttributeValue

public Object getAttributeValue(String key)
Gets the attribute value by the given name.


setAttributeValue

public Object setAttributeValue(String key,
                                Object value)
Sets the attribute value by the given name.


removeAllAttribute

public void removeAllAttribute()
Removes all the attributes associated with the graphic.


getInfoTemplate

public InfoTemplate getInfoTemplate()
Returns the template.


setInfoTemplate

public void setInfoTemplate(InfoTemplate infoTemplate)
Gets the template.


getAttributes

public Map<String,Object> getAttributes()
Returns all attributes of the graphic as a read-only collection.



Copyright © 2010. All Rights Reserved.