Skip to content

Documentation / @geoverse/core-ol / DrawTool

Class: DrawTool ​

Defined in: packages/core-ol/src/interactions/drawTool.ts:169

图形绘制工具(旧库 vzDraw 移植):点/线/面/圆/正方形/矩形。

Constructors ​

Constructor ​

ts
new DrawTool(opts?): DrawTool;

Defined in: packages/core-ol/src/interactions/drawTool.ts:180

Parameters ​

opts? ​

DrawToolOptions = {}

Returns ​

DrawTool

Properties ​

callback? ​

ts
protected optional callback?: (result) => void;

Defined in: packages/core-ol/src/interactions/drawTool.ts:173

Parameters ​

result ​

DrawResult

Returns ​

void


defaultStyle ​

ts
protected defaultStyle: Style;

Defined in: packages/core-ol/src/interactions/drawTool.ts:178


drawLayer? ​

ts
protected optional drawLayer?: VectorLayer<VectorSource<Feature<Geometry, {
[x: string]: any;
}>>, Feature<Geometry, {
[x: string]: any;
}>>;

Defined in: packages/core-ol/src/interactions/drawTool.ts:175


drawTool? ​

ts
protected optional drawTool?: Draw;

Defined in: packages/core-ol/src/interactions/drawTool.ts:174


kind ​

ts
protected kind: string;

Defined in: packages/core-ol/src/interactions/drawTool.ts:172


mapObject? ​

ts
protected optional mapObject?: Map;

Defined in: packages/core-ol/src/interactions/drawTool.ts:170


showInfo ​

ts
protected showInfo: boolean;

Defined in: packages/core-ol/src/interactions/drawTool.ts:177


showResult ​

ts
protected showResult: boolean;

Defined in: packages/core-ol/src/interactions/drawTool.ts:176


source ​

ts
protected readonly source: VectorSource;

Defined in: packages/core-ol/src/interactions/drawTool.ts:171

Methods ​

clearResult() ​

ts
clearResult(): void;

Defined in: packages/core-ol/src/interactions/drawTool.ts:330

清空绘制结果

Returns ​

void


destroy() ​

ts
destroy(): void;

Defined in: packages/core-ol/src/interactions/drawTool.ts:345

销毁:清空结果并回收图层与交互

Returns ​

void


init() ​

ts
protected init(): void;

Defined in: packages/core-ol/src/interactions/drawTool.ts:207

Returns ​

void


initInteraction() ​

ts
protected initInteraction(drawType): void;

Defined in: packages/core-ol/src/interactions/drawTool.ts:225

Parameters ​

drawType ​

string

Returns ​

void


resetKind() ​

ts
resetKind(kind): void;

Defined in: packages/core-ol/src/interactions/drawTool.ts:298

切换绘制类型(重建交互)

Parameters ​

kind ​

DrawKind

Returns ​

void


setDrawStyle() ​

ts
setDrawStyle(config): void;

Defined in: packages/core-ol/src/interactions/drawTool.ts:309

自定义绘制样式

Parameters ​

config ​

DrawStyleConfig

Returns ​

void


setMap() ​

ts
setMap(map): void;

Defined in: packages/core-ol/src/interactions/drawTool.ts:291

重新绑定地图(自动销毁旧绑定)

Parameters ​

map ​

Map

Returns ​

void


start() ​

ts
start(): void;

Defined in: packages/core-ol/src/interactions/drawTool.ts:335

启动绘制

Returns ​

void


stop() ​

ts
stop(): void;

Defined in: packages/core-ol/src/interactions/drawTool.ts:340

停止绘制(延迟避免误触发双击)

Returns ​

void