0.3.7 • Published 11 months ago
@dijiang/front_mapbox_custom_draw v0.3.7
基于 mapbox-gl-draw 完善绘制功能
install
npm install @dijiang/front_mapbox_custom_draw
use
import MapboxDrawer from '@dijiang/front_mapbox_custom_draw'
const drawer = new MapboxDrawer(map)
switch tool
drawer.switchDrawTool(drawType, styleTemplate, option)
返回一个promise,值为绘制的图形,测量工具为null
参数如下:
drawType 绘制类型
name | drawType |
---|---|
标点 | draw_point |
直线 | draw_line_string |
自由绘线 | freeline |
细箭头 | straightarrow |
多边形 | draw_polygon |
测距 | measure_line |
测面 | measure_polygon |
曲线 | curve |
正圆 | circle |
椭圆 | ellipse |
矩形 | rectangle |
扇形 | sector |
曲线面 | closecurve |
钳击箭头 | doublearrow |
燕尾箭头 | tailsquadarrow |
文字标注 | text |
styleTemplate 样式模板
获取默认样式,根据用户界面进行修改:
const styleTemplate = drawer.getStyleTemplate(drawType)
/* styleTemplate:{_color: '#f00',_size: 10 ...} */
当UI触发修改后:
drawer.changeStyle(key, value);
地图交互选中已经绘制的图形抛出其样式:
drawer.select(currentSelectStyle => toSetUi(currentSelectStyle));
option
测量工具信息,{unit: 'm' | 'km'}
methods
// 如上:
switchDrawTool()
select()
changeStyle()
getStyleTemplate()
// 返回上一步操作
trash():void
// 获取所有
getAll(): features
// 删除所有
deleteAll():void
0.3.7
11 months ago
0.2.10
2 years ago
0.3.0
2 years ago
0.3.6
2 years ago
0.3.5
2 years ago
0.2.9
2 years ago
0.3.2
2 years ago
0.3.1
2 years ago
0.3.4
2 years ago
0.3.3
2 years ago
0.2.1
3 years ago
0.2.0
3 years ago
0.2.7
3 years ago
0.2.6
3 years ago
0.2.8
3 years ago
0.2.3
3 years ago
0.1.4
3 years ago
0.2.2
3 years ago
0.2.5
3 years ago
0.2.4
3 years ago
0.1.5
3 years ago
0.1.2
3 years ago
0.1.3
3 years ago
0.1.0
3 years ago
0.1.1
3 years ago
0.0.3
3 years ago
0.0.2
3 years ago
0.0.1
3 years ago