control~MeshPlot(options)

模型标绘,支持立方体、立体面、圆柱体、圆锥体、球体、圆环、墙体、闭合墙等三维模型的绘制,当前模型标绘控件暂不支持吸附、撤销等功能。

Summary

Methods:
activate

激活标绘控件,只有将控件添加到地图上时才起作用。

deactivate

禁用标绘控件。如果标绘尚未结束,则取消当前正在进行的绘制行为,然后禁用控件。

destroy

销毁接口:销毁控件,释放占用的内存

disableEdit

禁用标绘控件的编辑功能

enableEdit

启用标绘控件的编辑功能

getControlType

返回控件的类型

getLayer

获取承载模型标绘内容的图层

getPlotLayer

获取承载模型标绘内容的图层

getPlotType

获取标绘控件的绘制类型

isEditing

标绘控件是否处于编辑状态

isPlotting

标绘控件是否处于绘制状态

on

绑定事件,同一个绘制对象的同种类型事件,多次绑定前面的将被覆盖。

setFeatureEdit

设置指定要素为编辑状态

setPlotLayer

设置承载模型标绘内容的模型图层

setPlotMaterial

设置模型标绘的材质,已经绘制的要素样式不作更改

setPlotType

设置标绘类型。如果当前有正在进行的标绘行为,将被取消。

un

取消事件绑定

Constructor

new MeshPlot(options)

Parameters:
Name Type Description
options Object

可选项

Name Type Description
layer module:layer~MeshLayer

保存标绘要素的图层,建议单独为标绘创建一个图层,该图层单独使用一个画板。

material module:material~Material

绘制模型的材质

editPointStyle module:style~Style

标绘控件修改要素时时节点的样式,有默认样式

midPointStyle module:style~Style

标绘控件修改线、多边形要素时,节点之间有虚拟点位,表示中间可以新增点,虚拟点位的样式,有默认样式

enable3dPlot Boolean

是否开启三维标绘,默认为false,如果开启,标绘控件会和地图中enableHashCode为true的图层做相交判断,并以相交的三维坐标作为标绘点(注意有些几何比如矩形,对构造坐标的z值有要求,不支持三维标绘)。

Example
let plotControl = new hmap.control.MeshPlot();
map.addControl(plotControl)

Methods

activate()

激活标绘控件,只有将控件添加到地图上时才起作用。

Example
plotControl.activate();

deactivate()

禁用标绘控件。如果标绘尚未结束,则取消当前正在进行的绘制行为,然后禁用控件。

Example
plotControl.deactivate();

destroy()

销毁接口:销毁控件,释放占用的内存

Example
plotControl.destroy();

disableEdit()

禁用标绘控件的编辑功能

enableEdit()

启用标绘控件的编辑功能

Example
plotControl.enableEdit()

getControlType() → {String}

返回控件的类型

Returns:
String -

标绘控件类型的名称。

getLayer() → {module:layer~MeshLayer}

获取承载模型标绘内容的图层

Returns:
module:layer~MeshLayer -

模型图层

getPlotLayer() → {module:layer~MeshLayer}

获取承载模型标绘内容的图层

Returns:
module:layer~MeshLayer -

模型图层

getPlotType() → {String}

获取标绘控件的绘制类型

Returns:
String -

绘制类型,参见PlotTypes枚举module:control~PlotTypes

isEditing() → {Boolean}

标绘控件是否处于编辑状态

Returns:
Boolean -

返回标绘控件的编辑状态,如果正在编辑则返回true,否则返回false

isPlotting() → {Boolean}

标绘控件是否处于绘制状态

Returns:
Boolean -

返回标绘控件的绘制状态,如果正在绘制则返回true,否则返回false

on(type, callback)

绑定事件,同一个绘制对象的同种类型事件,多次绑定前面的将被覆盖。

Parameters:
Name Type Description
type String

触发类型 plotEventType的项

callback function

回调函数

Example
//事件回调枚举:
//plotEventType.NEWPOINT     绘制图形时,新增一个节点时触发
//plotEventType.CHANGEPOINT  绘制图形时,控制点随鼠标变化时触发
//plotEventType.PLOTFINISHED 单个图形绘制完成时触发
//plotEventType.EDITSTART    编辑图形时,编辑单个节点前触发
//plotEventType.EDITPOINT    编辑图形时,编辑单个节点时触发
//plotEventType.EDITMOVEEND  编辑图形时,移动一个要素或节点结束时触发
//plotEventType.EDITFINISHED 编辑图形时,完成单个编辑时触发
plotControl.on(plotControl.plotEventType.NEWPOINT,function(data){
     console.log(data);
})

setFeatureEdit(feature)

设置指定要素为编辑状态

Parameters:
Name Type Description
feature module:feature~Vector

矢量要素,确保该矢量要素已经添加到正在标绘的图层中

Example
plotControl.setFeatureEdit(feature);

setPlotLayer(layer)

设置承载模型标绘内容的模型图层

Parameters:
Name Type Description
layer module:layer~MeshLayer

模型图层

setPlotMaterial(material)

设置模型标绘的材质,已经绘制的要素样式不作更改

Parameters:
Name Type Description
material module:material~Material

模型材质

setPlotType(plotType)

设置标绘类型。如果当前有正在进行的标绘行为,将被取消。

Parameters:
Name Type Description
plotType String

设置绘制类型,参见PlotTypes枚举module:control~PlotTypes,如果设置undefined则停止绘制

un(type)

取消事件绑定

Parameters:
Name Type Description
type String

触发类型 plotEventType的项