Class: FMMapEditor

FMMapEditor

FMMapEditor 点线面编辑类。 属于fengmap.plugin.draw.min.js。
在园区一体化地图上绘制的point、line或polygon,对应的buildingID取决于:第一个点位的坐标位置和绘制该点时子地图的显示状态。如果第一个点位坐标在子地图范围内,且子地图为显示状态,则该元素的buildingID为该子地图的buildingID,否则buildingID为null,也就是室外元素。

new fengmap.FMMapEditor(map)

Name Type Description
map Object

FMMap对象

Members

DrawTool

Properties:
Name Type Description
DrawTool String

编辑面的中点图片路径,point:绘制点,line:绘制线,circle:圆,ellipse:椭圆,rect:矩形,polygon:多边形,none:不绘制

LineStyle

Properties:
Name Type Description
LineStyle Object
Properties
Name Type Description
color string

线颜色

width number

线宽,默认6

smooth boolean

是否平滑,默认true

radius number

圆弧半径,默认 1

url string

贴图路径, 优先使用,如果没有给值,则使用lineType的线型

type FMLineType

线型, 默认值 fengmap.FMLineType.ARROW

borderColor string

设置FMARROW线型线边线的颜色,十六进制颜色值。如:'#FF0000'

animate boolean

true 启动动画 false 不启动动画 默认 false

depth boolean

true 开启深度 false 不开启深度 默认 true

PointStyle

Properties:
Name Type Description
PointStyle Object
Properties
Name Type Description
url string

图片地址,必填项

height number

离地高度, 默认 1

size int

图片显示尺寸,默认32

anchor FMMarkerAnchor

锚点位置

depth bool

文本渲染深度,true:开启深度,false:关闭深度,默认为false

collision bool

避让,true:开启避让,false:关闭避让,默认为true

PolygonStyle

Properties:
Name Type Description
PolygonStyle Object
Properties
Name Type Description
height number

离地高度, 默认 1

opacity number

多边形的透明度。0.0 - 1.0 之间取值, 默认为 1.0

color String

多边形的颜色

borderWidth number

多边形边框线宽,默认为2

borderColor string

多边形边框线颜色,默认 #FF0000

centerUrl

Properties:
Name Type Description
centerUrl String

编辑面的中点图片路径

editUrl

Properties:
Name Type Description
editUrl String

编辑线和面的图片路径

Methods

dispose()

废置点线面绘制对象

edit(object)

编辑点线面方法

Name Type Description
object Object

要编辑的点线面对象

on(type, callback)

点线面事件注册

Name Type Description
type string

事件类型

callback function

回调函数

Events

drawend

绘制完成事件

Example
{
 type:'drawend', // 事件类型
 info:{}, // 绘制完成的对象配置信息
 object:{}, // 绘制的对象
}

drawing

绘制中事件

Example
{
 type:'drawing', // 事件类型
 info:{}, // 绘制中的对象配置信息
 object:{}, // 绘制的对象
}

editend

编辑完成事件

Example
{
 type:'editend', // 事件类型
 info:{}, // 编辑完成的对象配置信息
 object:{}, // 编辑完成的对象
}