@metagl/sdk-plotting 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +86 -0
  2. package/package.json +53 -0
package/README.md ADDED
@@ -0,0 +1,86 @@
1
+ # geovisearthsdk_web - plotting 模块 README
2
+
3
+ ## 简介
4
+ plotting 模块为 GeovisEarth Web SDK 提供矢量绘制、标注与图形交互的封装组件,便于在地图上创建、编辑与管理点、线、面、标注等图形要素。
5
+
6
+ ## 主要功能
7
+ - 创建点、线、面、文本标注、图标等要素
8
+ - 支持要素样式配置(颜色、宽度、图标、透明度等)
9
+ - 要素编辑(拖拽、顶点编辑、删除)
10
+ - 支持要素分组与图层管理
11
+ - 事件绑定(点击、悬停、编辑开始/结束等)
12
+ - 批量导入/导出 GeoJSON
13
+
14
+ ## 快速开始
15
+
16
+ 安装(npm)
17
+ ```bash
18
+ npm install @metagl/sdk-plotting
19
+ ```
20
+
21
+ 浏览器引入(UMD)
22
+ ```html
23
+ <script src="path/to/sdk-plotting.js"></script>
24
+ ```
25
+
26
+ 初始化并创建一个点
27
+ ```js
28
+ import { Plotting } from '@metagl/sdk-plotting';
29
+
30
+ const map = new GeoMap({ container: 'map' });
31
+ const plotting = new Plotting({ map });
32
+
33
+ const marker = plotting.createPoint({
34
+ position: [116.397389, 39.908860],
35
+ style: { color: '#ff0000', size: 12 }
36
+ });
37
+ plotting.add(marker);
38
+ ```
39
+
40
+ ## 基本 API(概览)
41
+ - Plotting(options)
42
+ - map: 地图实例
43
+ - zIndex, defaultStyle 等
44
+ - createPoint({ position, style })
45
+ - createLine({ positions, style })
46
+ - createPolygon({ positions, style })
47
+ - createLabel({ position, text, style })
48
+ - add(feature) / remove(feature) / clear()
49
+ - edit(feature) / stopEdit()
50
+ - toGeoJSON() / fromGeoJSON(geojson)
51
+ - on(event, handler) / off(event, handler)
52
+
53
+ 常见事件:'click'、'dblclick'、'pointermove'、'editstart'、'editend'、'create'
54
+
55
+ ## 配置示例
56
+ ```js
57
+ const plotting = new Plotting({
58
+ map,
59
+ defaultStyle: {
60
+ point: { color: '#3388ff', size: 8 },
61
+ line: { color: '#33aa33', width: 3 },
62
+ polygon: { fillColor: 'rgba(51,136,255,0.2)', strokeColor: '#3388ff' }
63
+ }
64
+ });
65
+ ```
66
+
67
+ ## 编辑与交互
68
+ - 通过 plotting.edit(feature) 启动编辑模式
69
+ - 支持拖动顶点、添加/删除顶点
70
+ - 编辑完成触发 'editend' 事件,可获取最新 GeoJSON
71
+
72
+ ## 导入/导出
73
+ ```js
74
+ const geojson = plotting.toGeoJSON();
75
+ plotting.fromGeoJSON(geojson);
76
+ ```
77
+
78
+ ## 常见问题
79
+ - 要素不可见:检查图层可见性及样式透明度、地图投影设置
80
+ - 编辑失败:确保 feature 已添加到 plotting 管理器并传入正确坐标格式
81
+
82
+ ## 贡献
83
+ 欢迎提交 issue 与 PR。请遵守项目代码风格并补充单元测试。
84
+
85
+ ## 许可证
86
+ ISC
package/package.json ADDED
@@ -0,0 +1,53 @@
1
+ {
2
+ "name": "@metagl/sdk-plotting",
3
+ "version": "0.0.1",
4
+ "description": "Geovis Earth SDK Plotting Module",
5
+ "main": "./lib/lacdt.plotting.js",
6
+ "module": "./lib/lacdt.plotting.js",
7
+ "types": "./lib/lacdt.plotting.d.ts",
8
+ "scripts": {
9
+ "test": "cd publish && node server.cjs"
10
+ },
11
+ "keywords": [
12
+ "cesium",
13
+ "sdk",
14
+ "plotting"
15
+ ],
16
+ "author": "asun01",
17
+ "license": "ISC",
18
+ "publishConfig": {"access":"public","registry":"https://registry.npmjs.org/"},
19
+ "dependencies": {
20
+ "@tsgl/webgl-consts": "0.0.2",
21
+ "@turf/turf": "^6.5.0",
22
+ "@types/geojson": "^7946.0.16",
23
+ "axios": "^1.11.0",
24
+ "bezier-js": "^5.1.0",
25
+ "class-transformer": "^0.5.1",
26
+ "crypto-js": "^4.1.1",
27
+ "d3-timer": "^3.0.1",
28
+ "dom7": "^4.0.4",
29
+ "fast-xml-parser": "^4.0.1",
30
+ "geobuf": "^3.0.2",
31
+ "geojson": "^0.5.0",
32
+ "jquery": "^3.6.0",
33
+ "keyboardjs": "^2.6.4",
34
+ "keycode": "^2.2.1",
35
+ "linq": "^3.2.4",
36
+ "mobx": "^5.9.4",
37
+ "moment": "^2.29.1",
38
+ "ng-zorro-antd": "^13.0.1",
39
+ "piexifjs": "^1.0.6",
40
+ "primeng": "~13.1.0",
41
+ "rgb2hex": "^0.2.5",
42
+ "rxjs": "^7.5.4",
43
+ "satellite.js": "^5.0.0",
44
+ "serializer.ts": "0.0.12",
45
+ "undo-manager": "^1.0.5",
46
+ "x2js": "^3.3.1"
47
+ },
48
+ "files": [
49
+ "lib/**/*",
50
+ "LICENSE",
51
+ "README.md"
52
+ ]
53
+ }