@caoguo/maplibre-pipeline 0.0.1 → 0.0.2

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 (42) hide show
  1. package/README.md +107 -0
  2. package/package.json +33 -4
  3. package/dist/burst/index.cjs +0 -708
  4. package/dist/burst/index.cjs.map +0 -1
  5. package/dist/burst/index.js +0 -4
  6. package/dist/burst/index.js.map +0 -1
  7. package/dist/burstClass-CGMjcAYy.d.cts +0 -161
  8. package/dist/burstClass-Cf2p71LE.d.ts +0 -161
  9. package/dist/chunk-CDEYJ67B.js +0 -80
  10. package/dist/chunk-CDEYJ67B.js.map +0 -1
  11. package/dist/chunk-GCDA7KJM.js +0 -289
  12. package/dist/chunk-GCDA7KJM.js.map +0 -1
  13. package/dist/chunk-GEJRE2OR.js +0 -351
  14. package/dist/chunk-GEJRE2OR.js.map +0 -1
  15. package/dist/chunk-HCT6NSNS.js +0 -532
  16. package/dist/chunk-HCT6NSNS.js.map +0 -1
  17. package/dist/chunk-HIRNJVCV.js +0 -13
  18. package/dist/chunk-HIRNJVCV.js.map +0 -1
  19. package/dist/chunk-J3AEVXT4.js +0 -164
  20. package/dist/chunk-J3AEVXT4.js.map +0 -1
  21. package/dist/chunk-QVY4WJLM.js +0 -256
  22. package/dist/chunk-QVY4WJLM.js.map +0 -1
  23. package/dist/chunk-VA2TQWL3.js +0 -340
  24. package/dist/chunk-VA2TQWL3.js.map +0 -1
  25. package/dist/chunk-YBLESEN4.js +0 -133
  26. package/dist/chunk-YBLESEN4.js.map +0 -1
  27. package/dist/chunk-YS2ICFVK.js +0 -101
  28. package/dist/chunk-YS2ICFVK.js.map +0 -1
  29. package/dist/graph/index.cjs +0 -382
  30. package/dist/graph/index.cjs.map +0 -1
  31. package/dist/graph/index.js +0 -4
  32. package/dist/graph/index.js.map +0 -1
  33. package/dist/health/index.cjs +0 -348
  34. package/dist/health/index.cjs.map +0 -1
  35. package/dist/health/index.js +0 -3
  36. package/dist/health/index.js.map +0 -1
  37. package/dist/index.cjs +0 -2295
  38. package/dist/index.cjs.map +0 -1
  39. package/dist/index.d.cts +0 -10
  40. package/dist/index.d.ts +0 -10
  41. package/dist/index.js +0 -12
  42. package/dist/index.js.map +0 -1
package/README.md ADDED
@@ -0,0 +1,107 @@
1
+ # @caoguo/maplibre-pipeline
2
+
3
+ > 草果地图管网组件包 — 爆管推演 / 泄漏扩散 / 健康评估 / 拓扑编辑器
4
+
5
+ [![npm version](https://img.shields.io/npm/v/@caoguo/maplibre-pipeline.svg)](https://www.npmjs.com/package/@caoguo/maplibre-pipeline)
6
+ [![license](https://img.shields.io/npm/l/@caoguo/maplibre-pipeline.svg)](LICENSE)
7
+
8
+ ## 安装
9
+
10
+ ```bash
11
+ npm install @caoguo/maplibre-pipeline
12
+ ```
13
+
14
+ Peer:`maplibre-gl@^4.7.1`。
15
+ 依赖:`@caoguo/maplibre`、`@caoguo/theme`。
16
+
17
+ ## 功能模块
18
+
19
+ | 模块 | 导出名 | 说明 |
20
+ |------|--------|------|
21
+ | 图算法 | `bfs` / `dfs` / `shortestPath` / `adjacency` / `connectivity` | 邻接表、BFS/DFS、最短路径、连通性、上游阀门查找 |
22
+ | 拓扑 | `PipelineTopology` | 管网拓扑编辑器(5 级钻取 + 上下游追踪) |
23
+ | 爆管 | `BurstSimulator` | 爆管推演(影响范围 + 隔离阀定位) |
24
+ | 泄漏 | `LeakagePlume` | 高斯烟羽 + Pasquill-Gifford 扩散 + 洪水淹没 |
25
+ | 健康 | `PipelineHealth` | 多维加权评分(管龄/材质/压力/历史)+ 热力图 |
26
+ | NLPG | `pipelineNlp` / `pipelineNlpClass` | 管网查询意图识别 |
27
+ | 样式 | `PIPELINE_TYPE_COLORS` / `healthLevel` / `pipelineLegend` | 管网专用配色 |
28
+ | 数据 | `Node` / `Pipe` / `User` / `TopologyDataset` | 数据模型 |
29
+
30
+ ## 快速开始
31
+
32
+ ### 爆管推演
33
+
34
+ ```ts
35
+ import { BurstSimulator, burstClass } from '@caoguo/maplibre-pipeline/burst';
36
+
37
+ const sim = new BurstSimulator({
38
+ dataset, // TopologyDataset
39
+ burstNodeId: 'N123',
40
+ maxAffectedRadius: 500, // 米
41
+ });
42
+ const result = sim.simulate();
43
+ console.log('影响节点数', result.affectedNodes.length);
44
+ console.log('应关阀门', result.valvesToClose);
45
+ ```
46
+
47
+ ### 泄漏扩散
48
+
49
+ ```ts
50
+ import { LeakagePlume, gaussianPlume } from '@caoguo/maplibre-pipeline/leakage';
51
+
52
+ const plume = new LeakagePlume({
53
+ source: { lng: 114.3, lat: 30.6, heightMeters: 2 },
54
+ wind: { speedMps: 3, directionDeg: 45 },
55
+ stabilityClass: 'D', // Pasquill-Gifford
56
+ });
57
+ const contour = plume.simulate(3600); // 1 小时后的等浓度线
58
+ ```
59
+
60
+ ### 管线健康评分
61
+
62
+ ```ts
63
+ import { PipelineHealth } from '@caoguo/maplibre-pipeline/health';
64
+
65
+ const health = new PipelineHealth({ dataset });
66
+ const score = health.evaluate('P-001'); // 单管
67
+ console.log(score.total, score.explain());
68
+ ```
69
+
70
+ ### 拓扑编辑器(与 @caoguo/maplibre 配合)
71
+
72
+ ```ts
73
+ import { Map } from '@caoguo/maplibre';
74
+ import { PipelineTopology } from '@caoguo/maplibre-pipeline/topology';
75
+
76
+ const map = new Map({ container: 'map' });
77
+ const topo = new PipelineTopology(map.instance, { dataset });
78
+ topo.mount();
79
+ ```
80
+
81
+ ## 子入口
82
+
83
+ 包内提供 ESM 子路径入口,按需引入更轻:
84
+
85
+ ```ts
86
+ import { bfs } from '@caoguo/maplibre-pipeline/graph';
87
+ import { healthLevel } from '@caoguo/maplibre-pipeline/style';
88
+ import { pipelineNlp } from '@caoguo/maplibre-pipeline/nlpg';
89
+ ```
90
+
91
+ 可用子路径:`./graph`、`./topology`、`./burst`、`./leakage`、`./health`、`./nlpg`、`./style`、`./types`。
92
+
93
+ ## 设计原则
94
+
95
+ 1. **算法纯函数 + 渲染薄壳**:所有算法可在 Node 环境单测。
96
+ 2. **可插拔**:每个组件独立可用,也可组合。
97
+ 3. **离线友好**:所有计算在前端完成。
98
+ 4. **可解释**:所有评分/推演结果附 `explain()`。
99
+
100
+ ## 浏览器 / 环境要求
101
+
102
+ - 现代浏览器(Chrome 90+)
103
+ - 核心算法模块可在 Node.js 测试(已含 54 个 vitest 用例)
104
+
105
+ ## 许可
106
+
107
+ Apache-2.0
package/package.json CHANGED
@@ -1,7 +1,36 @@
1
1
  {
2
2
  "name": "@caoguo/maplibre-pipeline",
3
- "version": "0.0.1",
4
- "description": "草果地图管网组件包 - Pipeline topology / Burst simulation / Leakage plume / Health assessment",
3
+ "version": "0.0.2",
4
+ "description": "草果地图管网组件包 - 爆管推演 / 泄漏扩散 / 健康评估 / 拓扑编辑器",
5
+ "license": "Apache-2.0",
6
+ "author": "caoguo <caoguo@hb.cn>",
7
+ "homepage": "https://github.com/caoguo/map/blob/main/packages/pipeline/README.md",
8
+ "repository": {
9
+ "type": "git",
10
+ "url": "git+https://github.com/caoguo/map.git",
11
+ "directory": "packages/pipeline"
12
+ },
13
+ "bugs": {
14
+ "url": "https://github.com/caoguo/map/issues"
15
+ },
16
+ "keywords": [
17
+ "maplibre",
18
+ "caoguo",
19
+ "gis",
20
+ "pipeline",
21
+ "underground-pipeline",
22
+ "burst-simulation",
23
+ "leakage-plume",
24
+ "gaussian-plume",
25
+ "pasquill-gifford",
26
+ "health-assessment",
27
+ "risk-heatmap",
28
+ "graph-algorithm",
29
+ "topology",
30
+ "valve-planner",
31
+ "nlpg",
32
+ "china"
33
+ ],
5
34
  "type": "module",
6
35
  "main": "./dist/index.cjs",
7
36
  "module": "./dist/index.js",
@@ -57,8 +86,8 @@
57
86
  "dist"
58
87
  ],
59
88
  "dependencies": {
60
- "@caoguo/maplibre": "0.0.2",
61
- "@caoguo/theme": "0.0.1"
89
+ "@caoguo/maplibre": "0.0.3",
90
+ "@caoguo/theme": "0.0.2"
62
91
  },
63
92
  "publishConfig": {
64
93
  "access": "public",