com.supermap.web.actions
public class DrawAction
继承 DrawAction Inheritance MapAction Inheritance flash.events.EventDispatcher
子类 DrawCircle, DrawFreeLine, DrawFreePolygon, DrawLine, DrawPolygon, DrawRectangle, DrawText, Edit

绘图操作的的父类.

该类是 DrawLine、DrawPolygon 等与绘图操作相关的基类。用户可以继承该类自定义子类,实现特定的绘图功能。
绘制操作原理:系统内部定义了临时的要素图层 tempLayer 用于加载用户绘制的要素 tempFeature,当要素绘制完成时系统内部会自动清空此图层,并根据用户绘制的要素 tempFeature 使用 new 方法重新克隆一个新的要素对象 drawFeature(与 tempFeature 的属性完全相同),最终通过派发 DrawEvent.DrawEnd 事件将 drawFeature 存储于 DrawEvent 中。因此用户若想在客户端显示绘制的矢量要素,需通过绘制操作监听 DrawEvent.DrawEnd 事件,从而获取要素并将其添加至客户端要素图层中。



公共属性
  属性 定义方
  Inherited map : Map
获取或设置与交互操作绑定的地图控件。
MapAction
    snap : Snap
获取或设置捕捉参数类。(SuperMap iServer 7.0及以上版本支持)
DrawAction
    style : Style
获取或设置绘制的要素样式。
DrawAction
受保护的属性
  属性 定义方
    actionStarted : Boolean = false
标识绘图操作是否已开始。
DrawAction
  Inherited _cursorClass : Class
MapAction
  Inherited _cursorID : int
MapAction
  Inherited _cursorXOffset : Number = 0
MapAction
  Inherited _cursorYOffset : Number = 0
MapAction
    drawFeature : Feature = null
最终用于显示的要素。与 tempFeature 相同,通过监听 DrawEvent.DrawEnd 事件获取。
DrawAction
  Inherited _isMouseOut : Boolean
MapAction
    tempFeature : Feature = null
用户绘制的要素。
DrawAction
    tempLayer : FeaturesLayer
临时图层,用于存储用户绘制过的要素 tempFeature。.
DrawAction
公共方法
  方法 定义方
   
初始化 DrawAction 类的新实例。
DrawAction
  Inherited
MapAction
  Inherited
setCursor(value:Class, xOffset:Number = 0, yOffset:Number = 0):void
定义鼠标样式的类对象。
MapAction
受保护的方法
  方法 定义方
   
endDraw(endPoint:Point2D = null):void
矢量要素绘制完成时调用该函数。在此函数中系统会派发 DrawEvent.DRAW_END 事件,用户若要获取绘制的要素 Feature 对象,通过 DrawAction 对象监听 DrawEvent.DRAW_END 事件即可。
DrawAction
  Inherited
onMouseClick(event:MouseEvent):void
MouseEvent.CLICK 事件的侦听函数。
MapAction
  Inherited
onMouseDoubleClick(event:MouseEvent):void
MouseEvent.DOUBLE_CLICK 事件的侦听函数。
MapAction
  Inherited
onMouseDown(event:MouseEvent):void
MouseEvent.MOUSE_DOWN 事件的侦听函数。
MapAction
  Inherited
onMouseMove(event:MouseEvent):void
MouseEvent.MOUSE_MOVE 事件的侦听函数。
MapAction
  Inherited
onMouseOut(event:MouseEvent):void
MouseEvent.MOUSE_OUT 事件的侦听函数。
MapAction
  Inherited
onMouseOver(event:MouseEvent):void
MouseEvent.MOUSE_OVER 事件的侦听函数。
MapAction
  Inherited
onMouseUp(event:MouseEvent):void
MouseEvent.MOUSE_UP 事件的侦听函数。
MapAction
   
startDraw(startPoint:Point2D = null):void
矢量要素绘制开始时调用该函数。在此函数中会派发 DrawEvent.DRAW_START 事件。
DrawAction
   
转变矢量要素绘制类型时调用该函数。
DrawAction
属性详细信息
actionStarted 属性
protected var actionStarted:Boolean = false

标识绘图操作是否已开始。

drawFeature 属性  
protected var drawFeature:Feature = null

最终用于显示的要素。与 tempFeature 相同,通过监听 DrawEvent.DrawEnd 事件获取。

snap 属性  
snap:Snap

获取或设置捕捉参数类。(SuperMap iServer 7.0及以上版本支持)


Implementation
    public function get snap():Snap
    public function set snap(value:Snap):void
style 属性  
style:Style

获取或设置绘制的要素样式。


Implementation
    public function get style():Style
    public function set style(value:Style):void
tempFeature 属性  
protected var tempFeature:Feature = null

用户绘制的要素。

tempLayer 属性  
protected var tempLayer:FeaturesLayer

临时图层,用于存储用户绘制过的要素 tempFeature。.

当完成绘制操作时系统内部会自动清除此图层,并将绘制的要素传递至 DrawEvent.DRAW_END 事件中。

构造函数详细信息
DrawAction () 构造函数
public function DrawAction(map:Map)

初始化 DrawAction 类的新实例。

参数
map:Map — 与平移操作绑定的地图控件。
方法详细描述
endDraw () 方法
protected function endDraw(endPoint:Point2D = null):void

矢量要素绘制完成时调用该函数。在此函数中系统会派发 DrawEvent.DRAW_END 事件,用户若要获取绘制的要素 Feature 对象,通过 DrawAction 对象监听 DrawEvent.DRAW_END 事件即可。

参数

endPoint:Point2D (default = null)

startDraw () 方法  
protected function startDraw(startPoint:Point2D = null):void

矢量要素绘制开始时调用该函数。在此函数中会派发 DrawEvent.DRAW_START 事件。

参数

startPoint:Point2D (default = null)

switchActionHandle () 方法  
protected function switchActionHandle():void

转变矢量要素绘制类型时调用该函数。