| Package | com.esri.ags.layers |
| Class | public class GraphicsLayer |
| Inheritance | GraphicsLayer Layer mx.core.UIComponent |
Note that GraphicsLayer, like all layers, extend UIComponent and thus include basic mouse events, for example: click, mouseOut, mouseOver, and mouseDown, as well as other events like show and hide, and general properties, such as alpha, mouseChildren, toolTip and visible.
Default MXML PropertygraphicProvider
<esri:Map>
<esri:ArcGISTiledMapServiceLayer
url="http://server.arcgisonline.com/ArcGIS/rest/services/NPS_Physical_World_2D/MapServer" />
<esri:GraphicsLayer>
<esri:Graphic>
<esri:geometry>
<esri:MapPoint x="13" y="55.59" spatialReference="{new SpatialReference(4326)}"/>
</esri:geometry>
</esri:Graphic>
</esri:Map>See also
| Property | Defined by | ||
|---|---|---|---|
| graphicProvider : Object
Set of graphics to be viewed.
| GraphicsLayer | ||
| initialExtent : Extent
The initial extent of the map layer.
| GraphicsLayer | ||
![]() | isInScaleRange : Boolean
Returns true if the current scale of the map is between the maximum and minimum scale of the layer [added in version 1.3].
| Layer | |
![]() | loaded : Boolean
When the layer is loaded, the value becomes "true" and layer properties can be accessed.
| Layer | |
![]() | map : Map
A reference to the Map this layer is in.
| Layer | |
![]() | maxScale : Number = 0
The maximum scale of the layer [added in version 1.3].
| Layer | |
![]() | minScale : Number = 0
The minimum scale of the layer [added in version 1.3].
| Layer | |
| numGraphics : int [read-only]
Get the number of graphics in that layer.
| GraphicsLayer | ||
| renderer : Renderer
The renderer allows for the symbol of the graphic to be dynamically picked - for example
based on attributes or position of the graphic, or based on the scale of the map, or anything else.
| GraphicsLayer | ||
| spatialReference : SpatialReference
The spatial reference of the map layer.
| GraphicsLayer | ||
| symbol : Symbol
The default symbol for the layer.
| GraphicsLayer | ||
| symbolFunction : Function
[Deprecated - please use Renderers]
The symbol function allows for the symbol of the graphic to be dynamically picked - for example
based on attributes or position of the graphic, or based on the scale of the map, or anything else.
| GraphicsLayer | ||
| units : String
The units of the layer.
| GraphicsLayer | ||
| Method | Defined by | ||
|---|---|---|---|
|
Creates a new GraphicsLayer.
| GraphicsLayer | ||
|
Adds a graphic.
| GraphicsLayer | ||
|
clear():void
Clears all graphics.
| GraphicsLayer | ||
|
Moves a specific graphic to the top of the stack.
| GraphicsLayer | ||
![]() |
refresh():void
Causes the layer to redraw or reload its content.
| Layer | |
|
Removes the specific graphic.
| GraphicsLayer | ||
| Event | Summary | Defined by | ||
|---|---|---|---|---|
| Fires when a graphic is added to the GraphicsLayer. | GraphicsLayer | |||
| Fires when all graphics in the GraphicsLayer are cleared. | GraphicsLayer | |||
| Fires when a graphic is removed from the GraphicsLayer. | GraphicsLayer | |||
![]() | Fires after layer properties for the layer are successfully populated. | Layer | ||
![]() | Fires if the layer is unable to load. | Layer | ||
| graphicProvider | property |
graphicProvider:Object [read-write]
Set of graphics to be viewed.
This property lets you use either an Array, an ArrayCollection, or a single Graphic as graphic providers.
If you set the graphicProvider property to an Array,
it will be converted to an ArrayCollection.
If you set the property to an ArrayCollection, it will be used directly.
If you set the property to a single Graphic, it will be wrapped in a new ArrayCollection.
As a consequence of the conversions, when you get the
graphicProvider property, it will always be
an ArrayCollection.
The default value is an empty ArrayCollection.
This property can be used as the source for data binding.
Implementation public function get graphicProvider():Object
public function set graphicProvider(value:Object):void
See also
| initialExtent | property |
initialExtent:Extent [read-write]The initial extent of the map layer. Used for the map if it's the first layer in the map and map doesn't have an extent specified.
The default value is new Extent(-180, -90, 180, 90, new SpatialReference(4326)).
public function get initialExtent():Extent
public function set initialExtent(value:Extent):void
| numGraphics | property |
numGraphics:int [read-only]Get the number of graphics in that layer.
This property can be used as the source for data binding.
Implementation public function get numGraphics():int
| renderer | property |
renderer:Renderer [read-write]The renderer allows for the symbol of the graphic to be dynamically picked - for example based on attributes or position of the graphic, or based on the scale of the map, or anything else. This will be used when graphic does not have its own symbol.
This property can be used as the source for data binding.
Implementation public function get renderer():Renderer
public function set renderer(value:Renderer):void
See also
| spatialReference | property |
spatialReference:SpatialReference [read-write]The spatial reference of the map layer.
Implementation public function get spatialReference():SpatialReference
public function set spatialReference(value:SpatialReference):void
| symbol | property |
symbol:Symbol [read-write]The default symbol for the layer. This symbol will be used when graphic does not define one and a symbolFunction is not defined. Any individual graphic with a symbol assigned, will use that symbol instead of anything specified on its layer.
This property can be used as the source for data binding.
Implementation public function get symbol():Symbol
public function set symbol(value:Symbol):void
| symbolFunction | property |
symbolFunction:Function [read-write]
[Deprecated - please use Renderers]
The symbol function allows for the symbol of the graphic to be dynamically picked - for example
based on attributes or position of the graphic, or based on the scale of the map, or anything else.
This will be used when graphic does not have its own symbol.
Note: the renderers introduced in version 1.2 replaces the functionality of the symbolFunction.
The function should have the following signature:
public function mySymbolFunction(graphic:Graphic):Symbol
This property can be used as the source for data binding.
Implementation public function get symbolFunction():Function
public function set symbolFunction(value:Function):void
See also
| units | property |
units:String [read-write]The units of the layer.
The default value is DECIMAL_DEGRESS.
public function get units():String
public function set units(value:String):void
| GraphicsLayer | () | constructor |
public function GraphicsLayer()Creates a new GraphicsLayer.
| add | () | method |
public function add(graphic:Graphic):StringAdds a graphic. If an ID was not defined, a unique name will be created and assigned to the graphic. The unique name is created using NameUtil.createUniqueName, which will combine the unqualified class name with an incrementing counter to create something like "Graphic67".
Parametersgraphic:Graphic — The graphic to add.
|
String — The graphic id.
|
See also
| clear | () | method |
public function clear():voidClears all graphics.
See also
| moveToTop | () | method |
public function moveToTop(graphic:Graphic):voidMoves a specific graphic to the top of the stack.
Parametersgraphic:Graphic — The graphic to move.
|
| remove | () | method |
public function remove(graphic:Graphic):voidRemoves the specific graphic.
Parametersgraphic:Graphic — The graphic to remove.
|
See also
| graphicAdd | event |
com.esri.ags.events.GraphicEvent
com.esri.ags.events.GraphicEvent.GRAPHIC_ADD
Fires when a graphic is added to the GraphicsLayer.
Defines the value of the type property of a graphicAdd event object.
| graphicClear | event |
com.esri.ags.events.GraphicEvent
com.esri.ags.events.GraphicEvent.GRAPHIC_CLEAR
Fires when all graphics in the GraphicsLayer are cleared.
Defines the value of the type property of a graphicClear event object.
| graphicRemove | event |
com.esri.ags.events.GraphicEvent
com.esri.ags.events.GraphicEvent.GRAPHIC_REMOVE
Fires when a graphic is removed from the GraphicsLayer.
Defines the value of the type property of a graphicRemove event object.