包 | com.supermap.web.actions |
类 | public class DrawPoint |
继承 | DrawPoint ![]() ![]() ![]() |
该类用于实现通过鼠标在地图中绘制点要素的操作。用户若想设置所绘制的点要素样式,既可以使用系统提供的预定义风格 PredefinedMarkerStyle 来设置 markerStyle 属性;也可以继承 MarkerStyle 类自定义点要素风格进行设置。
绘制操作原理:系统内部定义了临时的要素图层 tempLayer 用于加载用户绘制的要素 tempFeature,当要素绘制完成时系统内部会自动清空此图层,并根据用户绘制的要素 tempFeature 使用 new 方法重新克隆一个新的要素对象 drawFeature(与 tempFeature 的属性完全相同),最终通过派发 DrawEvent.DrawEnd 事件将 drawFeature 存储于 DrawEvent 中。因此用户若想在客户端显示绘制的矢量要素,需通过绘制操作监听 DrawEvent.DrawEnd 事件,从而获取要素并将其添加至客户端要素图层中。
属性 | 定义方 | ||
---|---|---|---|
actionStarted : Boolean = false
标识绘图操作是否已开始。
|
DrawPoint | ||
![]() |
_cursorClass : Class | MapAction | |
![]() |
_cursorID : int | MapAction | |
![]() |
_cursorXOffset : Number = 0 | MapAction | |
![]() |
_cursorYOffset : Number = 0 | MapAction | |
![]() |
_isMouseOut : Boolean | MapAction |
方法 | 定义方 | ||
---|---|---|---|
初始化 DrawPoint 类的新实例。
|
DrawPoint | ||
![]() |
removeCursor():void
|
MapAction | |
![]() |
setCursor(value:Class, xOffset:Number = 0, yOffset:Number = 0):void
定义鼠标样式的类对象。
|
MapAction |
方法 | 定义方 | ||
---|---|---|---|
endDraw(endPoint:Point = null):void
矢量要素绘制完成时调用该函数。在此函数中系统会派发 DrawEvent.DRAW_END 事件,用户若要获取绘制的要素 Feature 对象,通过 DrawAction 对象监听 DrawEvent.DRAW_END 事件即可。
|
DrawPoint | ||
![]() |
onMouseClick(event:MouseEvent):void
MouseEvent.CLICK 事件的侦听函数。
|
MapAction | |
![]() |
onMouseDoubleClick(event:MouseEvent):void
MouseEvent.DOUBLE_CLICK 事件的侦听函数。
|
MapAction | |
onMouseDown(event:MouseEvent):void
[Override] MouseEvent.MOUSE_DOWN 事件的侦听函数。
|
DrawPoint | ||
![]() |
onMouseMove(event:MouseEvent):void
MouseEvent.MOUSE_MOVE 事件的侦听函数。
|
MapAction | |
onMouseOut(event:MouseEvent):void
[Override] MouseEvent.MOUSE_OUT 事件的侦听函数。
|
DrawPoint | ||
onMouseOver(event:MouseEvent):void
[Override] MouseEvent.MOUSE_OVER 事件的侦听函数。
|
DrawPoint | ||
onMouseUp(event:MouseEvent):void
[Override] MouseEvent.MOUSE_UP 事件的侦听函数。
|
DrawPoint | ||
矢量要素绘制开始时调用该函数。在此函数中会派发 DrawEvent.DRAW_START 事件。
|
DrawPoint | ||
switchActionHandle():void
转变矢量要素绘制类型时调用该函数。
|
DrawPoint |
actionStarted | 属性 |
protected var actionStarted:Boolean = false
标识绘图操作是否已开始。
style | 属性 |
style:Style
获取或设置绘制的要素样式。
public function get style():Style
public function set style(value:Style):void
DrawPoint | () | 构造函数 |
endDraw | () | 方法 |
protected function endDraw(endPoint:Point = null):void
矢量要素绘制完成时调用该函数。在此函数中系统会派发 DrawEvent.DRAW_END 事件,用户若要获取绘制的要素 Feature 对象,通过 DrawAction 对象监听 DrawEvent.DRAW_END 事件即可。
参数
endPoint:Point (default = null ) |
onMouseDown | () | 方法 |
override protected function onMouseDown(event:MouseEvent):void
MouseEvent.MOUSE_DOWN 事件的侦听函数。
参数
event:MouseEvent |
onMouseOut | () | 方法 |
override protected function onMouseOut(event:MouseEvent):void
MouseEvent.MOUSE_OUT 事件的侦听函数。
参数
event:MouseEvent |
onMouseOver | () | 方法 |
override protected function onMouseOver(event:MouseEvent):void
MouseEvent.MOUSE_OVER 事件的侦听函数。
参数
event:MouseEvent |
onMouseUp | () | 方法 |
override protected function onMouseUp(event:MouseEvent):void
MouseEvent.MOUSE_UP 事件的侦听函数。
参数
event:MouseEvent |
startDraw | () | 方法 |
protected function startDraw(startPoint:Point2D = null):void
矢量要素绘制开始时调用该函数。在此函数中会派发 DrawEvent.DRAW_START 事件。
参数
startPoint:Point2D (default = null ) |
switchActionHandle | () | 方法 |
protected function switchActionHandle():void
转变矢量要素绘制类型时调用该函数。