Licence
MIT
Version
0.1.1
Deps
7
Size
105 kB
Vulns
0
Weekly
73
@geoverse/editor-core
GeoVerse 的框架无关要素编辑引擎:撤销/重做、打断、合并、变换、节点编辑、类型校验、拓扑校验、吸附与后端同步。纯 TypeScript,不依赖任何地图库,由 @geoverse/editor-ol 与 @geoverse/editor-libre 分别接入 OpenLayers 与 MapLibre。
状态:
0.1.0,实验性,公共 API 可能在正式发布前微调。
安装
pnpm add @geoverse/editor-core运行时依赖:@turf/*、jsts、rbush、nanoid(随包安装)。本包不含地图库依赖。
最小用法
import { EditEngine, SplitLineCommand } from '@geoverse/editor-core';
const engine = new EditEngine({
crs: 'EPSG:3857',
features: [
{
id: 'l1',
geometry: {
type: 'LineString',
coordinates: [
[0, 0],
[10, 0],
],
},
properties: {},
},
],
});
const res = engine.dispatch(new SplitLineCommand('l1', [5, 0])); // 打断 1→2
if (res.ok) engine.undo(); // 撤销接地图请用适配器;引擎与命令的完整说明见文档。
文档
- 指南:编辑器概览 · 核心概念
- API:editor-core API
License
MIT
