@caoguo/maplibre-pipeline 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 (77) hide show
  1. package/dist/burst/index.cjs +708 -0
  2. package/dist/burst/index.cjs.map +1 -0
  3. package/dist/burst/index.d.cts +74 -0
  4. package/dist/burst/index.d.ts +74 -0
  5. package/dist/burst/index.js +4 -0
  6. package/dist/burst/index.js.map +1 -0
  7. package/dist/burstClass-CGMjcAYy.d.cts +161 -0
  8. package/dist/burstClass-Cf2p71LE.d.ts +161 -0
  9. package/dist/chunk-CDEYJ67B.js +80 -0
  10. package/dist/chunk-CDEYJ67B.js.map +1 -0
  11. package/dist/chunk-GCDA7KJM.js +289 -0
  12. package/dist/chunk-GCDA7KJM.js.map +1 -0
  13. package/dist/chunk-GEJRE2OR.js +351 -0
  14. package/dist/chunk-GEJRE2OR.js.map +1 -0
  15. package/dist/chunk-HCT6NSNS.js +532 -0
  16. package/dist/chunk-HCT6NSNS.js.map +1 -0
  17. package/dist/chunk-HIRNJVCV.js +13 -0
  18. package/dist/chunk-HIRNJVCV.js.map +1 -0
  19. package/dist/chunk-J3AEVXT4.js +164 -0
  20. package/dist/chunk-J3AEVXT4.js.map +1 -0
  21. package/dist/chunk-QVY4WJLM.js +256 -0
  22. package/dist/chunk-QVY4WJLM.js.map +1 -0
  23. package/dist/chunk-VA2TQWL3.js +340 -0
  24. package/dist/chunk-VA2TQWL3.js.map +1 -0
  25. package/dist/chunk-YBLESEN4.js +133 -0
  26. package/dist/chunk-YBLESEN4.js.map +1 -0
  27. package/dist/chunk-YS2ICFVK.js +101 -0
  28. package/dist/chunk-YS2ICFVK.js.map +1 -0
  29. package/dist/graph/index.cjs +382 -0
  30. package/dist/graph/index.cjs.map +1 -0
  31. package/dist/graph/index.d.cts +211 -0
  32. package/dist/graph/index.d.ts +211 -0
  33. package/dist/graph/index.js +4 -0
  34. package/dist/graph/index.js.map +1 -0
  35. package/dist/health/index.cjs +348 -0
  36. package/dist/health/index.cjs.map +1 -0
  37. package/dist/health/index.d.cts +210 -0
  38. package/dist/health/index.d.ts +210 -0
  39. package/dist/health/index.js +3 -0
  40. package/dist/health/index.js.map +1 -0
  41. package/dist/index.cjs +2295 -0
  42. package/dist/index.cjs.map +1 -0
  43. package/dist/index.d.cts +10 -0
  44. package/dist/index.d.ts +10 -0
  45. package/dist/index.js +12 -0
  46. package/dist/index.js.map +1 -0
  47. package/dist/leakage/index.cjs +358 -0
  48. package/dist/leakage/index.cjs.map +1 -0
  49. package/dist/leakage/index.d.cts +212 -0
  50. package/dist/leakage/index.d.ts +212 -0
  51. package/dist/leakage/index.js +3 -0
  52. package/dist/leakage/index.js.map +1 -0
  53. package/dist/nlpg/index.cjs +136 -0
  54. package/dist/nlpg/index.cjs.map +1 -0
  55. package/dist/nlpg/index.d.cts +51 -0
  56. package/dist/nlpg/index.d.ts +51 -0
  57. package/dist/nlpg/index.js +3 -0
  58. package/dist/nlpg/index.js.map +1 -0
  59. package/dist/style/index.cjs +379 -0
  60. package/dist/style/index.cjs.map +1 -0
  61. package/dist/style/index.d.cts +119 -0
  62. package/dist/style/index.d.ts +119 -0
  63. package/dist/style/index.js +4 -0
  64. package/dist/style/index.js.map +1 -0
  65. package/dist/topology/index.cjs +317 -0
  66. package/dist/topology/index.cjs.map +1 -0
  67. package/dist/topology/index.d.cts +69 -0
  68. package/dist/topology/index.d.ts +69 -0
  69. package/dist/topology/index.js +4 -0
  70. package/dist/topology/index.js.map +1 -0
  71. package/dist/types/index.cjs +15 -0
  72. package/dist/types/index.cjs.map +1 -0
  73. package/dist/types/index.d.cts +214 -0
  74. package/dist/types/index.d.ts +214 -0
  75. package/dist/types/index.js +3 -0
  76. package/dist/types/index.js.map +1 -0
  77. package/package.json +81 -0
@@ -0,0 +1,210 @@
1
+ import { PipeMaterial, PipeStatus, PipelineTopologyDataset } from '../types/index.js';
2
+ import { Map } from '@caoguo/maplibre';
3
+
4
+ /**
5
+ * 管线健康度评分(healthScorer)
6
+ *
7
+ * 6 维加权评分(PRD §4.4.2):
8
+ * health_score = age (0.25) + material (0.20) + soil (0.15) +
9
+ * history (0.20) + pressure (0.10) + protection (0.10)
10
+ *
11
+ * 每维 0-100,最终加权求和。
12
+ * 评分模型可解释:每个维度的评分依据清晰可见。
13
+ */
14
+
15
+ interface PipeHealthInput {
16
+ /** 安装日期 ISO */
17
+ installDate?: string;
18
+ /** 材质 */
19
+ material?: PipeMaterial;
20
+ /** 当前故障次数 */
21
+ failureCount?: number;
22
+ /** 当前压力(MPa) */
23
+ pressure?: number;
24
+ /** 最高允许压力(MPa) */
25
+ ratedPressure?: number;
26
+ /** 是否阴极保护 */
27
+ hasCathodicProtection?: boolean;
28
+ /** 土壤腐蚀指数 0-1(无数据时 0.5) */
29
+ soilCorrosion?: number;
30
+ /** 状态(damaged / under_repair 直接影响评分) */
31
+ status?: PipeStatus;
32
+ }
33
+ interface PipeHealthScore {
34
+ /** 总分 0-100 */
35
+ score: number;
36
+ /** 等级 */
37
+ level: 'excellent' | 'good' | 'fair' | 'poor' | 'critical';
38
+ /** 6 维细分 */
39
+ dimensions: {
40
+ age: {
41
+ score: number;
42
+ weight: number;
43
+ reason: string;
44
+ };
45
+ material: {
46
+ score: number;
47
+ weight: number;
48
+ reason: string;
49
+ };
50
+ soil: {
51
+ score: number;
52
+ weight: number;
53
+ reason: string;
54
+ };
55
+ history: {
56
+ score: number;
57
+ weight: number;
58
+ reason: string;
59
+ };
60
+ pressure: {
61
+ score: number;
62
+ weight: number;
63
+ reason: string;
64
+ };
65
+ protection: {
66
+ score: number;
67
+ weight: number;
68
+ reason: string;
69
+ };
70
+ };
71
+ }
72
+ /** 默认权重 */
73
+ declare const DEFAULT_WEIGHTS: {
74
+ age: number;
75
+ material: number;
76
+ soil: number;
77
+ history: number;
78
+ pressure: number;
79
+ protection: number;
80
+ };
81
+ /**
82
+ * 计算单根管线的健康度
83
+ */
84
+ declare function scorePipeHealth(input: PipeHealthInput, weights?: {
85
+ age: number;
86
+ material: number;
87
+ soil: number;
88
+ history: number;
89
+ pressure: number;
90
+ protection: number;
91
+ }): PipeHealthScore;
92
+ /**
93
+ * 批量评分(按需遍历)
94
+ */
95
+ declare function scorePipes(inputs: PipeHealthInput[], weights?: {
96
+ age: number;
97
+ material: number;
98
+ soil: number;
99
+ history: number;
100
+ pressure: number;
101
+ protection: number;
102
+ }): PipeHealthScore[];
103
+
104
+ /**
105
+ * 风险热力图(riskHeatmap)
106
+ *
107
+ * 把 scorePipeHealth 输出按地理网格聚合,输出每个网格的平均分/最高风险,
108
+ * 用于地图热力图(heat-map layer)。
109
+ *
110
+ * 输入:管线数组 [{ lng, lat, healthScore }]
111
+ * 输出:GeoJSON FeatureCollection<Point>(含 healthScore 属性)
112
+ */
113
+ interface HeatmapCell {
114
+ lng: number;
115
+ lat: number;
116
+ healthScore: number;
117
+ /** 网格内管段数 */
118
+ pipeCount: number;
119
+ }
120
+ interface PipeHealthPoint {
121
+ lng: number;
122
+ lat: number;
123
+ healthScore: number;
124
+ }
125
+ interface RiskHeatmapOptions {
126
+ /** 网格尺寸(m),默认 500 */
127
+ cellSize?: number;
128
+ /** 聚合方式 */
129
+ aggregation?: 'average' | 'min' | 'max';
130
+ }
131
+ declare function aggregateHeatmap(points: PipeHealthPoint[], options?: RiskHeatmapOptions): HeatmapCell[];
132
+ declare function heatmapToGeoJSON(cells: HeatmapCell[]): GeoJSON.FeatureCollection<GeoJSON.Point>;
133
+ /** 优先维护建议列表(风险最高的 Top N 管线) */
134
+ declare function prioritizeMaintenance(pipes: Array<{
135
+ id: string;
136
+ healthScore: number;
137
+ lng: number;
138
+ lat: number;
139
+ label?: string;
140
+ }>, topN?: number): {
141
+ id: string;
142
+ healthScore: number;
143
+ lng: number;
144
+ lat: number;
145
+ label?: string;
146
+ }[];
147
+
148
+ /**
149
+ * PipelineHealth 组件类(地图集成层)
150
+ */
151
+
152
+ interface PipelineHealthOptions {
153
+ map: Map;
154
+ dataset: PipelineTopologyDataset;
155
+ cellSize?: number;
156
+ layerPrefix?: string;
157
+ }
158
+ interface HealthResult {
159
+ /** 全部管段评分 */
160
+ scores: Array<{
161
+ pipeId: string;
162
+ score: PipeHealthScore;
163
+ }>;
164
+ /** 热力图聚合格 */
165
+ heatmap: HeatmapCell[];
166
+ /** 优先维护建议 */
167
+ maintenance: Array<{
168
+ id: string;
169
+ healthScore: number;
170
+ lng: number;
171
+ lat: number;
172
+ label?: string;
173
+ }>;
174
+ /** 计算耗时 */
175
+ durationMs: number;
176
+ }
177
+ type Listener = (r: HealthResult) => void;
178
+ /**
179
+ * 管线健康评估组件
180
+ */
181
+ declare class PipelineHealth {
182
+ private map;
183
+ private dataset;
184
+ private cellSize;
185
+ private layerPrefix;
186
+ private listeners;
187
+ private lastResult;
188
+ private layerIds;
189
+ constructor(options: PipelineHealthOptions);
190
+ /** 评估全网管线健康度 */
191
+ evaluate(weights?: {
192
+ age: number;
193
+ material: number;
194
+ soil: number;
195
+ history: number;
196
+ pressure: number;
197
+ protection: number;
198
+ }): HealthResult;
199
+ /** 清空图层 */
200
+ clear(): void;
201
+ /** 销毁 */
202
+ destroy(): void;
203
+ /** 订阅结果 */
204
+ onResult(fn: Listener): () => void;
205
+ /** 取最后一次结果 */
206
+ getLastResult(): HealthResult | null;
207
+ private renderHeatmap;
208
+ }
209
+
210
+ export { DEFAULT_WEIGHTS, type HealthResult, type HeatmapCell, type PipeHealthInput, type PipeHealthPoint, type PipeHealthScore, PipelineHealth, type PipelineHealthOptions, type RiskHeatmapOptions, aggregateHeatmap, heatmapToGeoJSON, prioritizeMaintenance, scorePipeHealth, scorePipes };
@@ -0,0 +1,3 @@
1
+ export { DEFAULT_WEIGHTS, PipelineHealth, aggregateHeatmap, heatmapToGeoJSON, prioritizeMaintenance, scorePipeHealth, scorePipes } from '../chunk-VA2TQWL3.js';
2
+ //# sourceMappingURL=index.js.map
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"index.js"}