|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.esri.map.Layer com.esri.map.GraphicsLayer
public class GraphicsLayer
The GraphicsLayer class represents a layer that contains one or more Graphic features. The map can contain one or more graphics layers.
The following are examples of how you might work with the GraphicsLayer class. You can initialize a GraphicsLayer through Java source code.
Java usage:
JMap map;
.
.
.
GraphicsLayer graphicsLayer = new GraphicsLayer();
map.getLayers().add(graphicsLayer);
Nested Class Summary |
---|
Nested classes/interfaces inherited from class com.esri.map.Layer |
---|
Layer.LayerStatus |
Field Summary |
---|
Fields inherited from class com.esri.map.Layer |
---|
_credentials, _progress, _resolutionList, serviceInfo |
Constructor Summary | |
---|---|
|
GraphicsLayer()
This constructs an empty GraphicsLayer (see the class description for an example of this usage). |
protected |
GraphicsLayer(boolean init)
The constructor is used internally to allow more control over the layer initialization process. |
Method Summary | |
---|---|
int |
addGraphic(Graphic graphic)
Adds a graphic to the layer. |
int[] |
addGraphics(Graphic[] graphics)
Adds graphics to the layer. |
protected String |
attributesToJson(Map<String,Object> attributes)
|
void |
bringToFront(int id)
Brings the graphic to front. |
void |
clearSelection()
Deselects all selected graphics. |
void |
createNativeLayer()
|
BufferedImage |
createSymbolImage(Symbol symbol,
Geometry geometry,
int width,
int height,
Color color)
Returns a swatch image of the given geometry rendered with the specified symbol. |
BufferedImage[] |
createSymbolImages(Symbol[] symbols,
Geometry[] geometries,
int width,
int height,
Color color)
Returns a swatch image array of for the given geometries rendered with the symbols. |
LayerLegendInfoCollection |
generateLegendInfo(ArrayList<com.esri.map.GraphicsLayer.LegendData> legendData)
|
Graphic |
getGraphic(int id)
Gets the graphic with the supplied id. |
int[] |
getGraphicIDs()
Gets all graphic ids from the layer. |
int[] |
getGraphicIDs(float x,
float y,
int tolerance)
Finds the graphics near the supplied x,y in pixels. |
int[] |
getGraphicIDs(float x,
float y,
int tolerance,
int numberOfResults)
|
protected String |
getLayerType()
|
LayerLegendInfoCollection |
getLegend()
|
protected Geometry |
getLegendImageGeometry()
|
protected Geometry |
getLegendImageGeometryByType(Geometry.Type type)
|
MapTip |
getMapTip()
Returns the maptip. |
int |
getMaxDrawOrder()
Returns the current maximum draw order of the graphics. |
double |
getMaxScale()
Gets the maximum scale at which this layer will be displayed. |
int |
getMinDrawOrder()
Returns the current minimum draw order of the graphics. |
double |
getMinScale()
Gets the minimum scale at which this layer will be displayed. |
int |
getNumberOfGraphics()
Gets the number of graphics in the layer. |
Renderer<Graphic> |
getRenderer()
Gets the renderer of the GraphicsLayer. |
Color |
getSelectionColor()
Returns the color applied to a selected graphic. |
int[] |
getSelectionIDs()
Gets the ids of the selected graphics. |
Symbol |
getSelectionSymbol()
Gets the selection symbol. |
protected void |
init(boolean isVisible,
int[] visibleLayers,
String title,
float opacity)
This method is called only when composing a Map from a Web Map. |
protected void |
initializeNativeLayer()
|
protected void |
initLayer()
|
protected void |
internalInit()
|
boolean |
isGraphicSelected(int id)
Returns true if the graphic with the supplied id is selected. |
void |
movePointGraphic(int id,
Point to)
Moves the Point graphic to the supplied Point location. |
void |
recycle()
Releases resources referenced by the Layer so that they can be recycled. |
void |
removeAll()
Removes all graphics from the layer. |
void |
removeGraphic(int id)
Removes the graphic with the specified id. |
void |
select(int id)
Selects the graphic with the supplied id. |
void |
sendToBack(int id)
Sends the graphic to back. |
void |
setGraphicVisible(int id,
boolean visible)
Sets the graphic visible or invisible. |
void |
setMapTip(MapTip mapTip)
Sets the maptip to be used with this layer. |
void |
setMaxScale(double maxScale)
|
void |
setMinScale(double minScale)
|
void |
setRenderer(Renderer<Graphic> renderer)
Sets the renderer of the GraphicsLayer. |
void |
setSelectionColor(Color selectionColor)
Sets the color that is applied to a selected graphic. |
void |
setSelectionIDs(int[] ids,
boolean inclusive)
Selects the graphics with the supplied ids. |
void |
setSelectionSymbol(Symbol selectionSymbol)
Sets the symbol to use for selected graphics. |
void |
unselect(int id)
Deselects the graphic with the supplied id. |
void |
updateGraphic(int[] ids,
int drawOrder)
Updates the draw order of graphics. |
void |
updateGraphic(int[] ids,
int[] drawOrder)
Updates the draw order of the graphic. |
void |
updateGraphic(int id,
Geometry geometry)
Replaces the geometry of the identified graphic with the supplied geometry. |
void |
updateGraphic(int id,
Graphic graphic)
Replaces the identified graphic with the supplied graphic. |
void |
updateGraphic(int id,
InfoTemplate infoTemplate)
Replaces the infoTemplate of the identified graphic with the supplied infoTemplate. |
void |
updateGraphic(int id,
int drawOrder)
Updates the draw order of the graphic. |
void |
updateGraphic(int id,
Map<String,Object> attributes)
Replaces the set of attributes of the identified graphic with the supplied attributes. |
void |
updateGraphic(int id,
Symbol symbol)
Replaces the symbol of the identified graphic with the supplied symbol. |
protected void |
validateMapTip(MapTip mapTip)
Validates maptip. |
Methods inherited from class java.lang.Object |
---|
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public GraphicsLayer()
This constructor assumes you have another layer as the bottom most layer defined for the Map, the GraphicsLayer cannot be the bottom most layer.
protected GraphicsLayer(boolean init)
Method Detail |
---|
public void recycle()
Layer
recycle
in class Layer
public BufferedImage createSymbolImage(Symbol symbol, Geometry geometry, int width, int height, Color color)
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.
public BufferedImage[] createSymbolImages(Symbol[] symbols, Geometry[] geometries, int width, int height, Color color)
symbols
- a symbol arraygeometries
- a geometry arraywidth
- the width of the swatch in pixels.height
- the height of the swatch in pixels.color
- the background color in ARGB format.
public void createNativeLayer()
createNativeLayer
in class Layer
protected void initLayer()
public void movePointGraphic(int id, Point to)
id
- of the Point graphic to be moved. If the id is not of a Point graphic,
then there will be no change.to
- destination of the move operation.public void removeAll()
public int addGraphic(Graphic graphic)
graphic
- the graphic to add
public int[] addGraphics(Graphic[] graphics)
graphics
- the graphics to add
public Graphic getGraphic(int id)
id
- the id
public int[] getGraphicIDs()
public double getMaxScale()
Layer
getMaxScale
in class Layer
public double getMinScale()
Layer
getMinScale
in class Layer
public void setMaxScale(double maxScale)
public void setMinScale(double minScale)
public int getNumberOfGraphics()
public void removeGraphic(int id)
id
- the id of the graphic to removepublic void updateGraphic(int id, Graphic graphic)
id
- the id of the graphic to changegraphic
- the new graphicpublic void updateGraphic(int id, Geometry geometry)
id
- the id of the graphic to changegeometry
- the new geometrypublic void updateGraphic(int id, Symbol symbol)
id
- the id of the graphic to changesymbol
- the new symbolpublic void updateGraphic(int id, InfoTemplate infoTemplate) throws Exception
id
- the id of the graphic to changeinfoTemplate
- the new infoTemplate
Exception
public void updateGraphic(int id, Map<String,Object> attributes)
id
- the id of the graphic to changeattributes
- the new attributespublic void updateGraphic(int id, int drawOrder)
id
- graphic id.drawOrder
- draw order.updateGraphic(int[], int)
,
updateGraphic(int[], int[])
public void updateGraphic(int[] ids, int drawOrder)
ids
- graphic ids.drawOrder
- draw order.updateGraphic(int, int)
,
updateGraphic(int[], int[])
public void updateGraphic(int[] ids, int[] drawOrder)
ids
- graphic ids.drawOrder
- draw order corresponding to corresponding graphic id.public int getMinDrawOrder()
public int getMaxDrawOrder()
public void bringToFront(int id)
id
- graphic id.public void sendToBack(int id)
id
- graphic id.public void setGraphicVisible(int id, boolean visible)
id
- the id of the graphic to changevisible
- true if the graphic is to be visible, false otherwise.public MapTip getMapTip()
public void setMapTip(MapTip mapTip)
mapTip
- maptip to be used.protected void validateMapTip(MapTip mapTip)
mapTip
- maptip to be validated.protected String attributesToJson(Map<String,Object> attributes)
public Renderer<Graphic> getRenderer()
public void setRenderer(Renderer<Graphic> renderer)
renderer
- The renderer to set.public int[] getGraphicIDs(float x, float y, int tolerance)
x
- the x coordinates of the point for searching.y
- the y coordinates of the point for searching.tolerance
- the search tolerance in pixels
public int[] getGraphicIDs(float x, float y, int tolerance, int numberOfResults)
protected void internalInit()
internalInit
in class Layer
protected void init(boolean isVisible, int[] visibleLayers, String title, float opacity)
Layer
init
in class Layer
protected void initializeNativeLayer()
initializeNativeLayer
in class Layer
public void setSelectionSymbol(Symbol selectionSymbol)
selectionSymbol
- getSelectionSymbol()
,
setSelectionColor(Color)
public Symbol getSelectionSymbol()
setSelectionSymbol(Symbol)
,
getSelectionColor()
public Color getSelectionColor()
setSelectionColor(Color)
,
getSelectionSymbol()
public void setSelectionColor(Color selectionColor)
selectionColor
- color that is applied to a selected graphic.getSelectionColor()
,
setSelectionSymbol(Symbol)
public void setSelectionIDs(int[] ids, boolean inclusive)
ids
- inclusive
- true if the supplied graphics will be added to the selection;
false if the supplied graphics are the only selected graphics.public void select(int id)
id
- public void unselect(int id)
id
- public int[] getSelectionIDs()
public boolean isGraphicSelected(int id)
id
-
public void clearSelection()
public LayerLegendInfoCollection getLegend()
getLegend
in class Layer
protected Geometry getLegendImageGeometry()
protected Geometry getLegendImageGeometryByType(Geometry.Type type)
public LayerLegendInfoCollection generateLegendInfo(ArrayList<com.esri.map.GraphicsLayer.LegendData> legendData) throws Exception, IOException
legendData
-
Exception
IOException
protected String getLayerType()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |