SuperMap.Control.PlottingEdit

鼠标编辑动态标绘标号类。该控件激活时,单击即可选中标号,被选中的标号将显示其控制点及比例点,拖拽这些点以编辑标号,拖拽符号本身平移标号。

通过 active 和 deactive 两个方法,实现动态的激活和注销。

  • 激活控件,方法如下:
plottingEdit.activate();

注销控件,方法如下:

plottingEdit.deactivate();

Inherits From

Summary
SuperMap.Control.PlottingEdit 鼠标编辑动态标绘标号类。该控件激活时,单击即可选中标号,被选中的标号将显示其控制点及比例点,拖拽这些点以编辑标号,拖拽符号本身平移标号。
Properties
avoidEditPointStyle {Object} 避让编辑模式下节点 style。
controlPointsStyle {Object} 控制点风格。
editMode {SuperMap.Plot.EditMode} 当前的编辑模式。
highlightFlag {Boolean} 选择航线后是否高亮
highlightStyle {Object} 航线高亮的样式
hoverMilliSec {Integer} 悬停的毫秒数。
lockedControlPointsStyle {Object} 标号锁定的控制点风格。
mouseTolerance {Integer} 鼠标模式容限。
onComplete {Function} 拖拽完成时都会调用该方法。该方法传递两个参数:拖拽的矢量要素。
onDrag {Function} 矢量要素的每一次移动都会调用该方法。该方法传递两个参数:拖拽的矢量要素、鼠标当前位置。
onHover {Function} 鼠标悬停在矢量要素上会调用该方法。该方法传递两个参数:鼠标悬停的矢量要素、鼠标事件。
onMove {Function} 平移时可以调用该方法,完成用户指定的任务。
onOut {Function} 鼠标离开矢量要素会调用该方法。该方法传递一个参数:鼠标离开的矢量要素。
onOver {Function} 鼠标进入矢量要素会调用该方法。该方法传递两个参数:鼠标进入的矢量要素、鼠标事件。
onStart {Function} 拖拽开始时执行的方法。该方法传递两个参数:拖拽的矢量要素、鼠标当前位置。
rotatePointStyle {Object} 旋转点 style。
scalePointsStyle {Object} 比例点 style。
touchTolerance {Number} 触摸屏模式容限。
unEditBoxStyle {Object} 不可编辑时包围盒 style。
Constructor
SuperMap.Control.PlottingEdit 创建该控件的新实例。
Functions
activate 激活该控件。
align 设置标号对齐。
avoidEdit 设置进入或者退出避让编辑
deactivate 取消激活控件,使其不可用。
deleteSelectFeature 删除标绘扩展符号 (选中)
destroy 销毁该类,释放空间。
multiSelect 多选与点选的切换接口。
removeAllAvoidRegion 移除当前选中对象所有的避让区域
removeAvoidRegion 移除当前选中对象指定的避让区域
setEditMode 设置当前的编辑模式

Properties

editMode

{SuperMap.Plot.EditMode} 当前的编辑模式。

hoverMilliSec

{Integer} 悬停的毫秒数。

mouseTolerance

{Integer} 鼠标模式容限。

touchTolerance

{Number} 触摸屏模式容限。

lockedControlPointsStyle

{Object} 标号锁定的控制点风格。

lockedControlPointsStyle的可设属性如下:

Symbolizer properties

fillColor {String} 十六进制填充颜色,默认为”#00ff00”。
fillOpacity {Number} 填充不透明度。默认为1。
strokeColor {String} 十六进制描边颜色,默认为”#000000”。
strokeOpacity {Number} 描边的不透明度(0-1),默认为1.0。
strokeWidth {Number} 像素描边宽度,默认为1。

controlPointsStyle

{Object} 控制点风格。

controlPointsStyle的可设属性如下:

Symbolizer properties

fillColor {String} 十六进制填充颜色,默认为”#00ff00”。
fillOpacity {Number} 填充不透明度,默认为1。
strokeColor {String} 十六进制描边颜色,默认为”#000000”。
strokeOpacity {Number} 描边的不透明度(0-1),默认为1.0。
strokeWidth {Number} 像素描边宽度,默认为1。

scalePointsStyle

{Object} 比例点 style。

scalePointsStyle的可设属性如下:

Symbolizer properties

fillColor {String} 十六进制填充颜色,默认为”#ffff00”。
fillOpacity {Number} 填充不透明度。默认为1.0。
strokeColor {String} 十六进制描边颜色,默认为”#000000”。
strokeOpacity {Number} 描边的不透明度(0-1),默认为1.0。
strokeWidth {Number} 像素描边宽度,默认为1。

rotatePointStyle

{Object} 旋转点 style。

rotatePointStyle的可设属性如下:

Symbolizer properties

fillColor {String} 十六进制填充颜色,默认为”#ff0000”。
fillOpacity {Number} 填充不透明度。默认为1.0。
strokeColor {String} 十六进制描边颜色,默认为”#ff0000”。
strokeOpacity {Number} 描边的不透明度(0-1),默认为1.0。
strokeWidth {Number} 像素描边宽度,默认为1。

unEditBoxStyle

{Object} 不可编辑时包围盒 style。

unEditBoxStyle的可设属性如下:

Symbolizer properties

fillColor {String} 十六进制填充颜色,默认为”#0000ff”。
fillOpacity {Number} 填充不透明度。默认为0.3。
strokeColor {String} 十六进制描边颜色,默认为”#0000ff”。
strokeOpacity {Number} 描边的不透明度(0-1),默认为0.5。
strokeWidth {Number} 像素描边宽度,默认为1。

avoidEditPointStyle

{Object} 避让编辑模式下节点 style。

avoidEditPointStyle的可设属性如下:

Symbolizer properties

fillColor {String} 十六进制填充颜色,默认为”#5f9ea0”。
fillOpacity {Number} 填充不透明度。默认为1.0。
strokeColor {String} 十六进制描边颜色,默认为”#000000”。
strokeOpacity {Number} 描边的不透明度(0-1),默认为1.0。
strokeWidth {Number} 像素描边宽度,默认为1。

highlightStyle

{Object} 航线高亮的样式

highlightStyle的可设属性如下:

Symbolizer properties

strokeColor {String} 十六进制描边颜色,默认为”#ffffff”。
strokeOpacity {Number} 描边的不透明度(0-1),默认为1.0。
strokeWidth {Number} 像素描边宽度,默认为1。

highlightFlag

{Boolean} 选择航线后是否高亮

onStart

{Function} 拖拽开始时执行的方法。该方法传递两个参数:拖拽的矢量要素、鼠标当前位置。

var plottingEdit = new SuperMap.Control.PlottingEdit();
plottingEdit.onStart=test;
function test(feature,pixel){
    var fea= feature;
    var position = pixel;
    console.log( fea);
}

Parameters

feature {SuperMap.Feature.Vector} 拖拽的要素。
pixel {SuperMap.Pixel} 鼠标当前的位置。

onDrag

{Function} 矢量要素的每一次移动都会调用该方法。该方法传递两个参数:拖拽的矢量要素、鼠标当前位置。

var plottingEdit = new SuperMap.Control.PlottingEdit();
plottingEdit.onDrag=onDrag;
function onDrag(feature,pixel){
    var fea= feature;
    var position = pixel;
    console.log( fea);
}

Parameters

feature {SuperMap.Feature.Vector} 拖拽的要素。
pixel {SuperMap.Pixel} 鼠标当前的位置。

onComplete

{Function} 拖拽完成时都会调用该方法。该方法传递两个参数:拖拽的矢量要素。

var plottingEdit = new SuperMap.Control.PlottingEdit();
plottingEdit.onComplete=onComplete;
function onComplete(feature){
    var feas = features;
    console.log( feas );
}

Parameters

feature {Array(SuperMap.Feature.Vector)} 拖拽的要素。

onMove

{Function} 平移时可以调用该方法,完成用户指定的任务。

Parameters

feature {SuperMap.Feature.Vector} 平移的要素。
x {Float} x轴正方向上移动的距离。
y {Float} y轴正方向上移动的距离。

onOver

{Function} 鼠标进入矢量要素会调用该方法。该方法传递两个参数:鼠标进入的矢量要素、鼠标事件。

var plottingEdit = new SuperMap.Control.PlottingEdit();
plottingEdit.onOver=onOver;
function onOver(feature,pixel){
    var fea= feature;
    var position = pixel;
    console.log( fea);
}

Parameters

feature {SuperMap.Feature.Vector} 矢量要素。
evt {MouseEvent} 鼠标事件。

onOut

{Function} 鼠标离开矢量要素会调用该方法。该方法传递一个参数:鼠标离开的矢量要素。

var plottingEdit = new SuperMap.Control.PlottingEdit();
plottingEdit.onOut=onOut;
function onOut(feature){
    var fea= feature;
    console.log( fea);
}

Parameters

feature {SuperMap.Feature.Vector} 矢量要素。

onHover

{Function} 鼠标悬停在矢量要素上会调用该方法。该方法传递两个参数:鼠标悬停的矢量要素、鼠标事件。

var plottingEdit = new SuperMap.Control.PlottingEdit();
plottingEdit.onHover=onHover;
function onHover(feature,evt){
    var fea= feature;
    console.log( fea);
}

Parameters

feature {SuperMap.Feature.Vector} 悬停的要素。
evt {MouseEvent} 鼠标事件。

Constructor

SuperMap.Control.PlottingEdit

创建该控件的新实例。

Parameters

layer {SuperMap.Layer.PlottingLayer} 执行编辑的图层。
options {Object} 设置该类开放的属性值。

创建 PlottingEdit 控件新实例的方法如下所示:

//定义一个矢量图层 vectorLayer 进行符号的编辑
var plottingLayer = new SuperMap.Layer.PlottingLayer("plottingLayer");
//实例化一个 plottingEdit 控件
var plottingEdit = new SuperMap.Control.PlottingEdit();
//地图上添加控件
map.addControl(plottingEdit);
//激活 plottingEdit 控件
plottingEdit.activate();

Functions

destroy

destroy: function ()

销毁该类,释放空间。

activate

activate: function ()

激活该控件。

Returns

{Boolean} 激活控件是否成功。

deactivate

deactivate: function ()

取消激活控件,使其不可用。

Returns

{Boolean} 返回操作是否成功。

align

align: function ( alignType )

设置标号对齐。

Parameters

alignType {SuperMap.Plot.AlignType} 对齐类型。

multiSelect

multiSelect: function ( multiple )

多选与点选的切换接口。

Parameters

multiple {Boolean} 指定是否要切换到多选状态。默认是切换到与当前相反的状态

Returns

{Boolean} 多选返回true,否则返回false。

setEditMode

setEditMode: function( editMode )

设置当前的编辑模式

Parameters

editMode {SuperMap.Plot.EditMode} 编辑模式。

avoidEdit

avoidEdit: function( avoidEditting )

设置进入或者退出避让编辑

Parameters

avoidEditting {Boolean} 进入或者退出避让编辑。

removeAllAvoidRegion

removeAllAvoidRegion: function()

移除当前选中对象所有的避让区域

removeAvoidRegion

removeAvoidRegion: function( region )

移除当前选中对象指定的避让区域

Parameters

region {SuperMap.Geometry.AvoidRegion} 要删除的避让区域。

deleteSelectFeature

deleteSelectFeature: function ()

删除标绘扩展符号 (选中)

Returns

{Boolean} 返回操作是否成功。

动态标绘中用到的枚举类型。
destroy: function ()
销毁该类,释放空间。
activate: function ()
激活该控件。
deactivate: function ()
取消激活控件,使其不可用。
align: function ( alignType )
设置标号对齐。
multiSelect: function ( multiple )
多选与点选的切换接口。
setEditMode: function( editMode )
设置当前的编辑模式
avoidEdit: function( avoidEditting )
设置进入或者退出避让编辑
removeAllAvoidRegion: function()
移除当前选中对象所有的避让区域
removeAvoidRegion: function( region )
移除当前选中对象指定的避让区域
deleteSelectFeature: function ()
删除标绘扩展符号 (选中)
控件类,提供了多种控件,比如比例尺控件,鹰眼控件,缩放条控件等等。 用于处理 Control 事件的事件处理器 Handler,内部封装了一系列的浏览器事件, 在控件(control)实现过程中可调用Handler,通过 active和 deactive两个方法,实现动态的激活和注销。
矢量要素类。该类具有 Geometry 属性存放几何信息, attributes 属性存放非几何信息,另外还包含了 style 属性,用来定义矢量要素的样式, 其中,默认的样式在 SuperMap.Feature.Vector.style 类中定义,如果没有特别的指定将使用默认的样式,
此类用x,y坐标描绘屏幕坐标(像素点)。
该图层用于渲染标号。
避让区对象。
Close