new Plot(map, options)
构造一个Plot对象
Name | Type | Description | |||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
map |
Map |
使用标绘的地图对象 |
|||||||||||||||
options |
Object |
标绘对象的一些参数,可以不设置
|
Classes
Methods
-
addEventListener(evtType, callBack){Object}
app/plot/index.js, line 297 -
给标绘对象绑定事件,一般给标绘对象进行全局绑定
Name Type Description evtType
String 地图事件类型,暂时支持:"drawEnd"--标绘结束时触发、 "click"/"pointermove"/"pointerdrag"/"dblclick"/"singleclick"
callBack
function 回调函数
Returns:
Type Description Object 当前要素的信息对象, { map // 标绘的地图对象 featrue // 标绘的要素对象 drawLayer // 标绘图层对象 } -
addFeatures(feaArr)
app/plot/index.js, line 134 -
给标绘图层上添加多个要素
Name Type Description feaArr
Array 标绘要素数组
-
draw(type)
app/plot/index.js, line 69 -
在地图上开始绘制图形
Name Type Description type
String 图形类型。"TextArea"--文本标绘、"Arc"--弧线、"Curve"--曲线、 "GatheringPlace"--集结地、Polyline"--折线、"FreeHandLine"--自由线、"Point"--点、 "RectAngle"--矩形、"Circle"--圆形、"Ellipse"--椭圆、"Lune"--弓形、"Sector"--扇形、 "ClosedCurve"--闭合曲面、"Polygon"--面(多边形)、"FreePolygon"--自由面、"AttackArrow"-- 进攻方向、"DoubleArrow"--双箭头、"StraightArrow"--细直箭头、"FineArrow"--粗单尖头箭头、 "AssaultDirection"--攻击方向、"TailedAttackArrow"--进攻方向(尾)、"SquadCombat"-- 战斗行动、"TailedSquadCombat"--分队战斗行动(尾)、"RectFlag"--矩形旗帜、"TriangleFlag"-- 三角旗帜、"CurveFlag"--弓形旗帜。
-
get(feature, key)
app/plot/index.js, line 186 -
返回要素设置的键值对数据
Name Type Description feature
Feature 指定要素
key
String 键值,如果指定键值则返回键值对应的值,如果不指定则返回所有键值对数据
-
getExtData(feature){Any}
app/plot/index.js, line 204 -
获取标绘要素绑定数据,一般和要素的事件监听联用
Name Type Description feature
Feature 指定要素
Returns:
Type Description Any extData 用户自定义属性,支持JavaScript API任意数据类型, 如feature的id等 地图容器DIV的ID值或者DIV对象 -
getFeatureInfo(feature){Object}
app/plot/index.js, line 106 -
获取标绘要素的信息,一般和标绘的事件监听联用
Name Type Description feature
Feature 标绘要素
Returns:
Type Description Object 标绘要素的信息 -
getFeaturesInfo(是否原始样式类型){Object}
app/plot/index.js, line 125 -
获取当前地图上标绘的所有要素信息
Name Type Description 是否原始样式类型
Boolean Returns:
Type Description Object 标绘要素的信息 -
getPlotType(feature){String}
app/plot/index.js, line 214 -
获取标绘类型
Name Type Description feature
Feature 指定要素
Returns:
Type Description String 标绘类型 -
isDrawing(){Boolean}
app/plot/index.js, line 83 -
标绘状态,判断是否正在标绘
Returns:
Type Description Boolean 标绘状态 -
removeAllFeatures()
app/plot/index.js, line 143 -
清除标绘图层上的所有要素
-
removeEventListener()
app/plot/index.js, line 327 -
移出标绘对象绑定的事件
-
removeFeature(feature)
app/plot/index.js, line 153 -
从标绘图层上移出指定要素
Name Type Description feature
Feature 指定要素
-
set(feature, key, val)
app/plot/index.js, line 176 -
给标绘要素绑定数据,可以自定义绑定数据的键值对
Name Type Description feature
Feature 指定要素
key
String 键值
val
Any 键值对应的值
-
setBackgroundColor(feature, color)
app/plot/index.js, line 280 -
设置标绘要素的背景颜色
Name Type Description feature
Feature 指定要素
color
String 背景颜色
- Deprecated
- Yes
-
setBorderColor(feature, color)
app/plot/index.js, line 269 -
设置标绘要素的边界颜色
Name Type Description feature
Feature 指定要素
color
String 边界颜色
- Deprecated
- 逐渐取消
-
setBorderWidth(feature, width)
app/plot/index.js, line 258 -
设置标绘要素的边界宽度
Name Type Description feature
Feature 指定要素
width
Number 边界宽度
- Deprecated
- Yes
-
setExtData(feature, info)
app/plot/index.js, line 165 -
给标绘要素绑定数据,一般和要素的事件监听联用
Name Type Description feature
Feature 指定要素
info
Any 用户自定义属性,支持JavaScript API任意数据类型, 如feature的id等 地图容器DIV的ID值或者DIV对象
-
setIconOpacity(feature, opacity)
app/plot/index.js, line 236 -
设置标绘图标的透明度
Name Type Description feature
Feature 指定要素
opacity
Number 图标的透明度
- Deprecated
- Yes
-
setIconScale(feature, scale)
app/plot/index.js, line 225 -
设置标绘图标的大小
Name Type Description feature
Feature 指定要素
scale
Number 大小比例,值域 [0,1]
- Deprecated
- Yes
-
setOpacity(feature, opacity)
app/plot/index.js, line 247 -
设置标绘要素的透明度
Name Type Description feature
Feature 指定要素
opacity
Number 透明度
- Deprecated
- Yes