VJMAP logoVJMAP
CAD · WebGIS
中

Class: DrawTool

Updated 2026-09-14~ 12 min read
.md

Implements

Table of contents

Constructors

Properties

Constructors

constructor

+ new DrawTool(options?: IDrawOptions): DrawTool

构造函数

Parameters
Name Type
options? IDrawOptions

Returns: DrawTool

Properties

add

• add: (geojson: any) => string[]

此方法采用 GeoJSON Feature、FeatureCollection 或 Geometry 并将其添加到 Draw。它返回一个 id 数组,用于与添加的功能进行交互。如果某个功能没有自己的 id,则会自动生成一个

Type declaration

▸ (geojson: any): string[]

Parameters
Name Type
geojson any

Returns: string[]

Implementation of: IDrawTool.add


changeMode

• changeMode: (mode: string, modeOptions?: any) => IDrawTool

将绘图更改为另一种模式。返回用于链接的绘制实例

Type declaration

▸ (mode: string, modeOptions?: any): IDrawTool

Parameters
Name Type
mode string
modeOptions? any

Returns: IDrawTool

Implementation of: IDrawTool.changeMode


combineFeatures

• combineFeatures: () => IDrawTool

调用当前模式的combineFeatures操作。返回用于链接的绘制实例

Type declaration

▸ (): IDrawTool

Returns: IDrawTool

Implementation of: IDrawTool.combineFeatures


delete

• delete: (featureIds: string | string[]) => IDrawTool

删除具有指定 ID 的功能。返回用于链接的绘制实例

Type declaration

▸ (featureIds: string | string[]): IDrawTool

Parameters
Name Type
featureIds string | string[]

Returns: IDrawTool

Implementation of: IDrawTool.delete


deleteAll

• deleteAll: () => IDrawTool

删除所有功能。返回用于链接的绘制实例

Type declaration

▸ (): IDrawTool

Returns: IDrawTool

Implementation of: IDrawTool.deleteAll


doAction

• doAction: (actionName: string) => any

在当前模式下执行动作

Type declaration

▸ (actionName: string): any

Parameters
Name Type
actionName string

Returns: any

Implementation of: IDrawTool.doAction


forceRefresh

• forceRefresh: () => any

强制刷新

Type declaration

▸ (): any

Returns: any

Implementation of: IDrawTool.forceRefresh


get

• get: (id: string) => any

返回 Draw 中具有指定 id 的 GeoJSON 功能,或者undefined如果 id 不匹配任何功能

Type declaration

▸ (id: string): any

Parameters
Name Type
id string

Returns: any

Implementation of: IDrawTool.get


getAll

• getAll: () => FeatureCollection<Geometry | GeometryCollection, Properties>

返回所有功能的 FeatureCollection

Type declaration

▸ (): FeatureCollection<Geometry | GeometryCollection, Properties>

Returns: FeatureCollection<Geometry | GeometryCollection, Properties>

Implementation of: IDrawTool.getAll


getFeatureIdsAt

• getFeatureIdsAt: (point: { x: number ; y: number }) => string[]

返回当前在指定点呈现的功能的功能 ID 数组。

Type declaration

▸ (point: { x: number ; y: number }): string[]

Parameters
Name Type
point object
point.x number
point.y number

Returns: string[]

Implementation of: IDrawTool.getFeatureIdsAt


getMode

• getMode: () => string

返回 Draw 的当前模式

Type declaration

▸ (): string

Returns: string

Implementation of: IDrawTool.getMode


getSelected

• getSelected: () => FeatureCollection<Geometry | GeometryCollection, Properties>

返回当前选择的所有功能的 FeatureCollection

Type declaration

▸ (): FeatureCollection<Geometry | GeometryCollection, Properties>

Returns: FeatureCollection<Geometry | GeometryCollection, Properties>

Implementation of: IDrawTool.getSelected


getSelectedIds

• getSelectedIds: () => string[]

返回当前所选功能的功能 ID 数组

Type declaration

▸ (): string[]

Returns: string[]

Implementation of: IDrawTool.getSelectedIds


getSelectedPoints

• getSelectedPoints: () => FeatureCollection<Geometry | GeometryCollection, Properties>

返回代表当前选择的所有顶点的 FeatureCollection 点

Type declaration

▸ (): FeatureCollection<Geometry | GeometryCollection, Properties>

Returns: FeatureCollection<Geometry | GeometryCollection, Properties>

Implementation of: IDrawTool.getSelectedPoints


modes

• modes: Record<string, any>

内部变量模式值

Implementation of: IDrawTool.modes


onAdd

• onAdd: (map: any) => any

增加时回调接口

Type declaration

▸ (map: any): any

Parameters
Name Type
map any

Returns: any

Implementation of: IDrawTool.onAdd


onRemove

• onRemove: () => any

移除时回调接口

Type declaration

▸ (): any

Returns: any

Implementation of: IDrawTool.onRemove


options

• options: Record<string, any>

内部变量选项值

Implementation of: IDrawTool.options


redo

• redo: () => any

Type declaration

▸ (): any

Returns: any

Implementation of: IDrawTool.redo


set

• set: (featureCollection: FeatureCollection<Geometry | GeometryCollection, Properties>) => string[]

将 Draw 的功能设置为指定的 FeatureCollection

Type declaration

▸ (featureCollection: FeatureCollection<Geometry | GeometryCollection, Properties>): string[]

Parameters
Name Type
featureCollection FeatureCollection<Geometry | GeometryCollection, Properties>

Returns: string[]

Implementation of: IDrawTool.set


setFeatureProperty

• setFeatureProperty: (featureId: string, property: string, value: any) => IDrawTool

设置具有指定 id 的要素的属性值。返回用于链接的绘制实例

Type declaration

▸ (featureId: string, property: string, value: any): IDrawTool

Parameters
Name Type
featureId string
property string
value any

Returns: IDrawTool

Implementation of: IDrawTool.setFeatureProperty


trash

• trash: () => IDrawTool

调用当前模式的删除trash操作。返回用于链接的绘制实例

Type declaration

▸ (): IDrawTool

Returns: IDrawTool

Implementation of: IDrawTool.trash


uncombineFeatures

• uncombineFeatures: () => IDrawTool

Type declaration

▸ (): IDrawTool

Returns: IDrawTool

Implementation of: IDrawTool.uncombineFeatures


undo

• undo: () => any

Type declaration

▸ (): any

Returns: any

Implementation of: IDrawTool.undo

vjmap / Exports / EllipseEdge

Was this page helpful?