Packagecom.esri.ags.tools
Classpublic class EditTool
InheritanceEditTool Inheritance com.esri.ags.tools.BaseTool

Functionality to move graphics or modify individual vertices, i.e., edit the geometry of existing graphics. To add new graphics, use the Draw tool.

The property map has to be set for the activate method to complete.

Mouse behavior when editing features

Snapping (as of version 2.3)

See also

DrawTool
Live sample - using EditTool to move or modify vertices of a graphic.


Public Properties
 PropertyDefined By
  allowAddVertices : Boolean
Specifies whether users can add new vertices (polyline/polygon).
EditTool
  allowDeleteVertices : Boolean
Specifies whether users can delete vertices (polyline/polygon/multipoint).
EditTool
  ghostVertexSymbol : Symbol
Symbol for "ghost" vertices (polyline/polygon).
EditTool
  map : Map
[override] The Map that the EditTool is associated with.
EditTool
  snapDistance : Number
The distance in pixels for snapping.
EditTool
  snapMode : String
Specifies whether snapping is off, always on or enabled by pressing the Ctrl key.
EditTool
  vertexSymbol : Symbol
Symbol for vertices (polyline/polygon).
EditTool
Public Methods
 MethodDefined By
  
EditTool(map:Map = null)
Creates a new EditTool object.
EditTool
  
activate(editType:Number, graphics:Array):void
Activates the tool for editing features.
EditTool
  
deactivate():void
Deactivates the tool and reactivates map navigation.
EditTool
Events
 Event Summary Defined By
  The contextMenuSelect event is dispatched when a context menu is generated but before the contents of the context menu are displayed.EditTool
  The geometry update event.EditTool
  The ghost vertex mouse down event.EditTool
  The graphic rotate event.EditTool
  The graphic rotate first event.EditTool
  The graphic rotate start event.EditTool
  The graphic rotate stop event.EditTool
  The graphic scale event.EditTool
  The graphic scale first event.EditTool
  The graphic scale start event.EditTool
  The graphic scale stop event.EditTool
  The graphics move event.EditTool
  The graphics move first event.EditTool
  The graphics move start event.EditTool
  The graphics move stop event.EditTool
  The vertex add event.EditTool
  The vertex delete event.EditTool
  The vertex mouse out event.EditTool
  The vertex mouse over event.EditTool
  The vertex move event.EditTool
  The vertex move first event.EditTool
  The vertex move start event.EditTool
  The vertex move stop event.EditTool
Public Constants
 ConstantDefined By
  EDIT_VERTICES : Number = 2
[static] Edit the vertices of the selected graphic (multipoint, polyline and polygon).
EditTool
  MOVE : Number = 1
[static] Move the array of graphic.
EditTool
  ROTATE : Number = 8
[static] Rotate the selected graphic (polyline,polygon and extent).
EditTool
  SCALE : Number = 4
[static] Scale the selected graphic (polyline,polygon and extent).
EditTool
  SNAP_MODE_ALWAYS_ON : String = alwaysOn
[static] Snapping is always on.
EditTool
  SNAP_MODE_OFF : String = off
[static] Snapping is off.
EditTool
  SNAP_MODE_ON_DEMAND : String = onDemand
[static] Enable snapping by pressing the Ctrl key.
EditTool
Property Detail
allowAddVerticesproperty
allowAddVertices:Boolean

Specifies whether users can add new vertices (polyline/polygon). If true, ghost vertices will display for polylines and polygons. If false, no ghost vertices will display.

The default value is true.

This property can be used as the source for data binding.


Implementation
    public function get allowAddVertices():Boolean
    public function set allowAddVertices(value:Boolean):void
allowDeleteVerticesproperty 
allowDeleteVertices:Boolean

Specifies whether users can delete vertices (polyline/polygon/multipoint). If true, users can right-click on the vertex to delete a vertex. Only available if the polyline has more than two, or the polygon more than four, vertices.

The default value is true.

This property can be used as the source for data binding.


Implementation
    public function get allowDeleteVertices():Boolean
    public function set allowDeleteVertices(value:Boolean):void
ghostVertexSymbolproperty 
ghostVertexSymbol:Symbol

Symbol for "ghost" vertices (polyline/polygon).

This property can be used as the source for data binding.


Implementation
    public function get ghostVertexSymbol():Symbol
    public function set ghostVertexSymbol(value:Symbol):void
mapproperty 
map:Map[override]

The Map that the EditTool is associated with.


Implementation
    public function get map():Map
    public function set map(value:Map):void
snapDistanceproperty 
snapDistance:Number

Since : ArcGIS API for Flex 2.3

The distance in pixels for snapping. To disable snapping, set this value to 0.

The default value is 15.

This property can be used as the source for data binding.


Implementation
    public function get snapDistance():Number
    public function set snapDistance(value:Number):void
snapModeproperty 
snapMode:String

Since : ArcGIS API for Flex 2.5

Specifies whether snapping is off, always on or enabled by pressing the Ctrl key.

The default value is SNAP_MODE_ON_DEMAND.

This property can be used as the source for data binding.


Implementation
    public function get snapMode():String
    public function set snapMode(value:String):void
vertexSymbolproperty 
vertexSymbol:Symbol

Symbol for vertices (polyline/polygon).

This property can be used as the source for data binding.


Implementation
    public function get vertexSymbol():Symbol
    public function set vertexSymbol(value:Symbol):void
Constructor Detail
EditTool()Constructor
public function EditTool(map:Map = null)

Creates a new EditTool object.

Parameters
map:Map (default = null) — The Map that the tool should be associated with.
Method Detail
activate()method
public function activate(editType:Number, graphics:Array):void

Activates the tool for editing features. Once called the tool is ready to respond to user interaction based on specified edit type.

Parameters

editType:Number — The edit type.

It can have one of the following values:

  • EditTool.MOVE : Move the array of graphics.
  • EditTool.EDIT_VERTICES : Edit vertices of the first graphic in the array.
  • EditTool.MOVE|EditTool.EDIT_VERTICES : Only supports one graphic. Allows the graphic to be moved in addition to editing individual vertices.

 
graphics:Array — The array of graphic(feature) to be edited.

deactivate()method 
public function deactivate():void

Deactivates the tool and reactivates map navigation.

Event Detail
contextMenuSelect Event
Event Object Type: com.esri.ags.events.EditEvent
EditEvent.type property = com.esri.ags.events.EditEvent.CONTEXT_MENU_SELECT

The contextMenuSelect event is dispatched when a context menu is generated but before the contents of the context menu are displayed.

Defines the value of the type property of a contextMenuSelect event object.
geometryUpdate Event  
Event Object Type: com.esri.ags.events.EditEvent
EditEvent.type property = com.esri.ags.events.EditEvent.GEOMETRY_UPDATE

The geometry update event.

Defines the value of the type property of a geometryUpdate event object.
ghostVertexMouseDown Event  
Event Object Type: com.esri.ags.events.EditEvent
EditEvent.type property = com.esri.ags.events.EditEvent.GHOST_VERTEX_MOUSE_DOWN

The ghost vertex mouse down event.

Defines the value of the type property of a ghostVertexMouseDown event object.
graphicRotate Event  
Event Object Type: com.esri.ags.events.EditEvent
EditEvent.type property = com.esri.ags.events.EditEvent.GRAPHIC_ROTATE

The graphic rotate event.

Defines the value of the type property of a graphicRotate event object.
graphicRotateFirst Event  
Event Object Type: com.esri.ags.events.EditEvent
EditEvent.type property = com.esri.ags.events.EditEvent.GRAPHIC_ROTATE_FIRST

The graphic rotate first event.

Defines the value of the type property of a graphicRotateFirst event object.
graphicRotateStart Event  
Event Object Type: com.esri.ags.events.EditEvent
EditEvent.type property = com.esri.ags.events.EditEvent.GRAPHIC_ROTATE_START

The graphic rotate start event.

Defines the value of the type property of a graphicRotateStart event object.
graphicRotateStop Event  
Event Object Type: com.esri.ags.events.EditEvent
EditEvent.type property = com.esri.ags.events.EditEvent.GRAPHIC_ROTATE_STOP

The graphic rotate stop event.

Defines the value of the type property of a graphicRotateStop event object.
graphicScale Event  
Event Object Type: com.esri.ags.events.EditEvent
EditEvent.type property = com.esri.ags.events.EditEvent.GRAPHIC_SCALE

The graphic scale event.

Defines the value of the type property of a graphicScale event object.
graphicScaleFirst Event  
Event Object Type: com.esri.ags.events.EditEvent
EditEvent.type property = com.esri.ags.events.EditEvent.GRAPHIC_SCALE_FIRST

The graphic scale first event.

Defines the value of the type property of a graphicScaleFirst event object.
graphicScaleStart Event  
Event Object Type: com.esri.ags.events.EditEvent
EditEvent.type property = com.esri.ags.events.EditEvent.GRAPHIC_SCALE_START

The graphic scale start event.

Defines the value of the type property of a graphicScaleStart event object.
graphicScaleStop Event  
Event Object Type: com.esri.ags.events.EditEvent
EditEvent.type property = com.esri.ags.events.EditEvent.GRAPHIC_SCALE_STOP

The graphic scale stop event.

Defines the value of the type property of a graphicScaleStop event object.
graphicsMove Event  
Event Object Type: com.esri.ags.events.EditEvent
EditEvent.type property = com.esri.ags.events.EditEvent.GRAPHICS_MOVE

The graphics move event.

Defines the value of the type property of a graphicsMove event object.
graphicsMoveFirst Event  
Event Object Type: com.esri.ags.events.EditEvent
EditEvent.type property = com.esri.ags.events.EditEvent.GRAPHICS_MOVE_FIRST

The graphics move first event.

Defines the value of the type property of a graphicsMoveFirst event object.
graphicsMoveStart Event  
Event Object Type: com.esri.ags.events.EditEvent
EditEvent.type property = com.esri.ags.events.EditEvent.GRAPHICS_MOVE_START

The graphics move start event.

Defines the value of the type property of a graphicsMoveStart event object.
graphicsMoveStop Event  
Event Object Type: com.esri.ags.events.EditEvent
EditEvent.type property = com.esri.ags.events.EditEvent.GRAPHICS_MOVE_STOP

The graphics move stop event.

Defines the value of the type property of a graphicsMoveStop event object.
vertexAdd Event  
Event Object Type: com.esri.ags.events.EditEvent
EditEvent.type property = com.esri.ags.events.EditEvent.VERTEX_ADD

The vertex add event.

Defines the value of the type property of a vertexAdd event object.
vertexDelete Event  
Event Object Type: com.esri.ags.events.EditEvent
EditEvent.type property = com.esri.ags.events.EditEvent.VERTEX_DELETE

The vertex delete event.

Defines the value of the type property of a vertexDelete event object.
vertexMouseOut Event  
Event Object Type: com.esri.ags.events.EditEvent
EditEvent.type property = com.esri.ags.events.EditEvent.VERTEX_MOUSE_OUT

The vertex mouse out event.

Defines the value of the type property of a vertexMouseOut event object.
vertexMouseOver Event  
Event Object Type: com.esri.ags.events.EditEvent
EditEvent.type property = com.esri.ags.events.EditEvent.VERTEX_MOUSE_OVER

The vertex mouse over event.

Defines the value of the type property of a vertexMouseOver event object.
vertexMove Event  
Event Object Type: com.esri.ags.events.EditEvent
EditEvent.type property = com.esri.ags.events.EditEvent.VERTEX_MOVE

The vertex move event.

Defines the value of the type property of a vertexMove event object.
vertexMoveFirst Event  
Event Object Type: com.esri.ags.events.EditEvent
EditEvent.type property = com.esri.ags.events.EditEvent.VERTEX_NOVE_FIRST

The vertex move first event.

vertexMoveStart Event  
Event Object Type: com.esri.ags.events.EditEvent
EditEvent.type property = com.esri.ags.events.EditEvent.VERTEX_MOVE_START

The vertex move start event.

Defines the value of the type property of a vertexMoveStart event object.
vertexMoveStop Event  
Event Object Type: com.esri.ags.events.EditEvent
EditEvent.type property = com.esri.ags.events.EditEvent.VERTEX_MOVE_STOP

The vertex move stop event.

Defines the value of the type property of a vertexMoveStop event object.
Constant Detail
EDIT_VERTICESConstant
public static const EDIT_VERTICES:Number = 2

Edit the vertices of the selected graphic (multipoint, polyline and polygon).

MOVEConstant 
public static const MOVE:Number = 1

Move the array of graphic.

ROTATEConstant 
public static const ROTATE:Number = 8

Rotate the selected graphic (polyline,polygon and extent).

SCALEConstant 
public static const SCALE:Number = 4

Scale the selected graphic (polyline,polygon and extent).

SNAP_MODE_ALWAYS_ONConstant 
public static const SNAP_MODE_ALWAYS_ON:String = alwaysOn

Snapping is always on.

SNAP_MODE_OFFConstant 
public static const SNAP_MODE_OFF:String = off

Snapping is off.

SNAP_MODE_ON_DEMANDConstant 
public static const SNAP_MODE_ON_DEMAND:String = onDemand

Enable snapping by pressing the Ctrl key.