0.3.7 • Published 11 months ago

@dijiang/front_mapbox_custom_draw v0.3.7

Weekly downloads
-
License
mit
Repository
-
Last release
11 months ago

基于 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 绘制类型

namedrawType
标点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