java.lang.Object | ||
↳ | com.esri.android.map.Layer | |
↳ | com.esri.android.map.GraphicsLayer |
Known Direct Subclasses |
The GraphicsLayer class represents a layer that contains one or more Graphic
features. The MapView
can contain one or more graphic layers.
The following is an example of how you can work with the GraphicsLayer class in Java.
Java usage:
//GraphicsLayer class is used to define the Layer that is added to the
//MapView object.
MapView mv = new MapView(this);
mv.addLayer(new GraphicsLayer());
setContentView(mv);
[Expand]
Inherited Fields | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
com.esri.android.map.Layer
|
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
GraphicsLayer()
The constructor is used if your are instantiating an empty GraphicsLayer (see the class description for an example
of this usage).
| |||||||||||
GraphicsLayer(SpatialReference sr, Envelope fullextent)
The constructor with spatial reference and full extent.
|
Protected Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
GraphicsLayer(boolean initLayer)
The constructor is used internally to allow more controls over the layer initialization process.
| |||||||||||
GraphicsLayer(long handle)
The constructor is used internally to allow more controls over the layer initialization process.
|
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
int |
addGraphic(Graphic graphic)
Adds a graphic into GraphicsLayer.
| ||||||||||
int[] |
addGraphics(Graphic[] graphics)
Adds an array of Graphic.
| ||||||||||
void |
bringToFront(int id)
Brings the graphic to front.
| ||||||||||
void |
clearSelection()
Clears the current selection.
| ||||||||||
PopupInfo | createPopupInfo(Graphic graphic) | ||||||||||
Bitmap |
createSymbolImage(Symbol symbol, Geometry geometry, int width, int height, int color)
Returns a swatch image of the given geometry rendered with the specified symbol.
| ||||||||||
Bitmap[] |
createSymbolImages(Symbol[] symbol, Geometry[] geometry, int width, int height, int color)
Returns a swatch image array of for the given geometries rendered with the symbols.
| ||||||||||
int |
getDrawOrder(int uid)
Returns current draw order for the given graphic.
| ||||||||||
Graphic |
getGraphic(int uid)
Retrives a graphic instance using a unique ID.
| ||||||||||
int[] |
getGraphicIDs(float x, float y, int tolerance)
Returns the graphics near the Point.
| ||||||||||
int[] |
getGraphicIDs()
Retrieves an array of unique IDs representing all graphics in this layer.
| ||||||||||
int[] |
getGraphicIDs(float x, float y, int tolerance, int numberOfResults)
Returns the graphics near the Point.
| ||||||||||
int |
getMaxDrawOrder()
Returns the current maximum draw order of the graphics.
| ||||||||||
int |
getMinDrawOrder()
Returns the current minimum draw order of the graphics.
| ||||||||||
int |
getNumberOfGraphics()
Returns number of graphics.
| ||||||||||
Renderer<Graphic> |
getRenderer()
Gets the renderer of the GraphicsLayer.
| ||||||||||
int |
getSelectionColor()
Returns the color applied to a selected feature.
| ||||||||||
int[] |
getSelectionIDs()
Returns an array of selected graphic ids.
| ||||||||||
boolean |
isGraphicSelected(int id)
Returns true if the graphic with the supplied id is selected.
| ||||||||||
void |
removeAll()
Removes all graphics.
| ||||||||||
void |
removeGraphic(int id)
Removes graphic using a unique ID.
| ||||||||||
void |
sendToBack(int id)
Sends the graphic to back.
| ||||||||||
void |
setGraphicVisible(int uid, boolean visible)
Sets visibility of a graphic with a unique id.
| ||||||||||
void |
setRenderer(Renderer<Graphic> renderer)
Sets the renderer of the GraphicsLayer.
| ||||||||||
void |
setSelectedGraphics(int[] ids, boolean selected)
Selects the graphics with the supplied ids.
| ||||||||||
void |
setSelectionColor(int selectionColor)
Sets the color that is applied to a selected feature.
| ||||||||||
void |
updateGraphic(int id, Map<String, Object> attributes)
Updates the attributes of a graphic specified by id with an attribute map.
| ||||||||||
void |
updateGraphic(int id, InfoTemplate infoTemplate)
Updates the infotemplate of a graphic specified by id with an infotemplate.
| ||||||||||
void |
updateGraphic(int id, int drawOrder)
Updates the draw order of the graphic.
| ||||||||||
void |
updateGraphic(int id, Geometry geometry)
Updates the geometry of a graphic specified by id with a geometry.
| ||||||||||
void |
updateGraphic(int id, Symbol symbol)
Updates the symbol attribute of a graphic specified by id with a symbol.
| ||||||||||
void |
updateGraphic(int id, Graphic graphic)
Updates a graphic specified by an id with attributes of another graphic instance.
| ||||||||||
void |
updateGraphics(int[] ids, int[] drawOrder)
Updates an array of graphics with the corresponding draw order.
| ||||||||||
void |
updateGraphics(int[] ids, int drawOrder)
Updates the draw order of for a group graphics.
|
Protected Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
long | create() | ||||||||||
void |
initLayer()
Initializes the layer.
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
com.esri.android.map.Layer
| |||||||||||
From class
java.lang.Object
|
The constructor is used if your are instantiating an empty GraphicsLayer (see the class description for an example of this usage).
This constructor assumes you have another layer as the bottom most layer defined for the MapView. In this instance the GraphicsLayer cannot be the bottom most layer.
The constructor with spatial reference and full extent.
sr | The default spatial reference GraphicsLayer uses |
---|---|
fullextent | The full extent of GraphicsLayer |
The constructor is used internally to allow more controls over the layer initialization process.
The constructor is used internally to allow more controls over the layer initialization process.
Adds a graphic into GraphicsLayer.
graphic | Graphic object |
---|
Adds an array of Graphic.
graphics | An array of Graphic. |
---|
Brings the graphic to front.
id | graphic id. |
---|
Clears the current selection.
Returns a swatch image of the given geometry rendered with the specified symbol.
symbol | to render the geometry with. |
---|---|
geometry | the geometry to render in the swatch. |
width | the width of the swatch in pixels. |
height | the height of the swatch in pixels. |
color | the background color in ARGB format. |
Returns a swatch image array of for the given geometries rendered with the symbols.
symbol | a symbol array |
---|---|
geometry | a geometry array |
width | the width of the swatch in pixels. |
height | the height of the swatch in pixels. |
color | the background color in ARGB format. |
Returns current draw order for the given graphic.
uid | graphic id. |
---|
Retrives a graphic instance using a unique ID.
uid | Unique ID representing a graphic |
---|
Returns the graphics near the Point. The point is specified by the x,y in pixels.
The returned results are sorted:
x | the x screen coordinates of the point for searching. |
---|---|
y | the y screen coordinates of the point for searching. |
tolerance | the search tolerance in pixels |
Retrieves an array of unique IDs representing all graphics in this layer.
Returns the graphics near the Point. The point is specified by the x,y in pixels.
The returned results are sorted:
x | the x screen coordinates of the point for searching. |
---|---|
y | the y screen coordinates of the point for searching. |
tolerance | the search tolerance in pixels |
numberOfResults | the maximum number of result can be returned. |
Returns the current maximum draw order of the graphics.
Returns the current minimum draw order of the graphics.
Returns number of graphics.
Gets the renderer of the GraphicsLayer.
Returns the color applied to a selected feature.
Returns an array of selected graphic ids.
Returns true if the graphic with the supplied id is selected.
id | the id |
---|
Removes all graphics.
Removes graphic using a unique ID.
id | Unique ID representing a Graphic. |
---|
Sends the graphic to back.
id | graphic id. |
---|
Sets visibility of a graphic with a unique id.
uid | Unique ID representing an existing graphic. |
---|---|
visible | False if graphic is invisible. |
Sets the renderer of the GraphicsLayer.
renderer | The renderer to set. |
---|
Selects the graphics with the supplied ids.
ids | the ids |
---|---|
selected | if true the graphic will be added to current selections, otherwise it will be unselected from current selection. |
Sets the color that is applied to a selected feature.
selectionColor | color that is applied to a selected feature. |
---|
getSelectionColor()
Updates the attributes of a graphic specified by id with an attribute map.
id | Unique ID representing an existing graphic. |
---|---|
attributes | Attribute map used for update. |
Updates the infotemplate of a graphic specified by id with an infotemplate.
id | Unique ID representing an existing graphic. |
---|---|
infoTemplate | InfoTemplate instance used for update. |
Exception | the exception |
---|
Updates the draw order of the graphic. Higher valued graphics are drawn on top of those with lower value.
id | id Unique ID representing an existing graphic. |
---|---|
drawOrder | an integer for drawing order |
Updates the geometry of a graphic specified by id with a geometry.
id | Unique ID representing an existing graphic. |
---|---|
geometry | Geometry instance used for update. |
Updates the symbol attribute of a graphic specified by id with a symbol.
id | Unique ID representing an existing graphic. |
---|---|
symbol | Symbol instance used for update. |
Updates a graphic specified by an id with attributes of another graphic instance. Its graphic order is updated also.
id | Unique ID representing an existing graphic. |
---|---|
graphic | Graphic instance whose attributes is used in update. |
Updates an array of graphics with the corresponding draw order. Higher valued graphics are drawn on top of those with lower value.
ids | graphic ids. |
---|---|
drawOrder | draw order corresponding to corresponding graphic id. |
Updates the draw order of for a group graphics. Higher valued graphics are drawn on top of those with lower value.
ids | array of graphic IDs. |
---|---|
drawOrder | draw order. |
Initializes the layer. The implementation should submit the OnStatusChangedListener.STATUS
event accordingly.