my-openlayer 2.4.12 → 2.5.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.
- package/CHANGELOG.md +251 -251
- package/LICENSE +21 -21
- package/MyOl.d.ts +9 -9
- package/MyOl.js +17 -14
- package/README.md +174 -148
- package/core/line/Line.d.ts +40 -0
- package/core/line/Line.js +144 -0
- package/core/line/LineFeatureFactory.d.ts +17 -0
- package/core/line/LineFeatureFactory.js +75 -0
- package/core/line/LineFlowAnimator.d.ts +53 -0
- package/core/line/LineFlowAnimator.js +297 -0
- package/core/line/LineStyleFactory.d.ts +43 -0
- package/core/line/LineStyleFactory.js +135 -0
- package/core/{RiverLayerManager.d.ts → line/RiverLayerManager.d.ts} +2 -2
- package/core/{RiverLayerManager.js → line/RiverLayerManager.js} +3 -5
- package/core/line/index.d.ts +6 -0
- package/core/line/index.js +5 -0
- package/core/{ConfigManager.d.ts → map/ConfigManager.d.ts} +25 -1
- package/core/{ConfigManager.js → map/ConfigManager.js} +22 -1
- package/core/{EventManager.d.ts → map/EventManager.d.ts} +1 -1
- package/core/{EventManager.js → map/EventManager.js} +2 -2
- package/core/{MapBaseLayers.d.ts → map/MapBaseLayers.d.ts} +1 -1
- package/core/{MapBaseLayers.js → map/MapBaseLayers.js} +3 -3
- package/core/{MapTools.d.ts → map/MapTools.d.ts} +5 -2
- package/core/{MapTools.js → map/MapTools.js} +11 -5
- package/core/{MeasureHandler.d.ts → map/MeasureHandler.d.ts} +1 -1
- package/core/{MeasureHandler.js → map/MeasureHandler.js} +41 -41
- package/core/map/index.d.ts +5 -0
- package/core/map/index.js +5 -0
- package/core/{Point.d.ts → point/Point.d.ts} +6 -14
- package/core/point/Point.js +272 -0
- package/core/point/PointClusterLayer.d.ts +10 -0
- package/core/point/PointClusterLayer.js +52 -0
- package/core/point/PointOverlay.d.ts +13 -0
- package/core/point/PointOverlay.js +57 -0
- package/core/point/PointPulseLayer.d.ts +13 -0
- package/core/point/PointPulseLayer.js +207 -0
- package/core/point/index.d.ts +4 -0
- package/core/point/index.js +4 -0
- package/core/{Polygon.d.ts → polygon/Polygon.d.ts} +4 -50
- package/core/polygon/Polygon.js +248 -0
- package/core/polygon/PolygonHeatmapLayer.d.ts +11 -0
- package/core/polygon/PolygonHeatmapLayer.js +40 -0
- package/core/polygon/PolygonImageLayer.d.ts +9 -0
- package/core/polygon/PolygonImageLayer.js +61 -0
- package/core/polygon/PolygonMaskLayer.d.ts +20 -0
- package/core/polygon/PolygonMaskLayer.js +107 -0
- package/core/polygon/PolygonStyleFactory.d.ts +12 -0
- package/core/polygon/PolygonStyleFactory.js +100 -0
- package/core/polygon/index.d.ts +5 -0
- package/core/polygon/index.js +5 -0
- package/core/{SelectHandler.d.ts → select/SelectHandler.d.ts} +2 -3
- package/core/{SelectHandler.js → select/SelectHandler.js} +4 -4
- package/core/select/index.d.ts +1 -0
- package/core/select/index.js +1 -0
- package/core/{VueTemplatePoint.d.ts → vue-template-point/VueTemplatePoint.d.ts} +1 -1
- package/core/{VueTemplatePoint.js → vue-template-point/VueTemplatePoint.js} +4 -4
- package/core/vue-template-point/index.d.ts +1 -0
- package/core/vue-template-point/index.js +1 -0
- package/docs/.vitepress/config.mts +57 -57
- package/docs/ConfigManager.md +71 -71
- package/docs/ErrorHandler.md +106 -106
- package/docs/EventManager.md +142 -142
- package/docs/Line.md +215 -187
- package/docs/MapBaseLayers.md +198 -198
- package/docs/MapTools.md +172 -172
- package/docs/MeasureHandler.md +87 -87
- package/docs/MyOl.md +247 -247
- package/docs/Point.md +136 -136
- package/docs/Polygon.md +241 -241
- package/docs/RiverLayerManager.md +187 -187
- package/docs/SelectHandler.md +147 -147
- package/docs/ValidationUtils.md +83 -83
- package/docs/VueTemplatePoint.md +214 -214
- package/docs/index.md +73 -73
- package/index.d.ts +10 -15
- package/index.js +7 -13
- package/package.json +11 -1
- package/types/base.d.ts +47 -0
- package/types/base.js +1 -0
- package/types/common.d.ts +59 -0
- package/types/common.js +1 -0
- package/types/index.d.ts +9 -0
- package/types/index.js +1 -0
- package/types/line.d.ts +41 -0
- package/types/line.js +1 -0
- package/types/map.d.ts +77 -0
- package/types/map.js +1 -0
- package/types/point.d.ts +54 -0
- package/types/point.js +1 -0
- package/types/polygon.d.ts +8 -0
- package/types/polygon.js +1 -0
- package/types/select.d.ts +25 -0
- package/types/select.js +1 -0
- package/types/vue-template-point.d.ts +54 -0
- package/{types.js → types/vue-template-point.js} +0 -3
- package/utils/ProjectionUtils.d.ts +28 -0
- package/utils/ProjectionUtils.js +34 -0
- package/utils/ValidationUtils.d.ts +33 -86
- package/utils/ValidationUtils.js +60 -165
- package/core/Line.d.ts +0 -49
- package/core/Line.js +0 -114
- package/core/Point.js +0 -560
- package/core/Polygon.js +0 -646
- package/docs/.vitepress/dist/404.html +0 -22
- package/docs/.vitepress/dist/ConfigManager.html +0 -46
- package/docs/.vitepress/dist/ErrorHandler.html +0 -52
- package/docs/.vitepress/dist/EventManager.html +0 -58
- package/docs/.vitepress/dist/Line.html +0 -92
- package/docs/.vitepress/dist/MapBaseLayers.html +0 -52
- package/docs/.vitepress/dist/MapTools.html +0 -81
- package/docs/.vitepress/dist/MeasureHandler.html +0 -32
- package/docs/.vitepress/dist/MyOl.html +0 -62
- package/docs/.vitepress/dist/Point.html +0 -81
- package/docs/.vitepress/dist/Polygon.html +0 -102
- package/docs/.vitepress/dist/RiverLayerManager.html +0 -66
- package/docs/.vitepress/dist/SelectHandler.html +0 -46
- package/docs/.vitepress/dist/ValidationUtils.html +0 -47
- package/docs/.vitepress/dist/VueTemplatePoint.html +0 -112
- package/docs/.vitepress/dist/assets/ConfigManager.md.BOMdGTaa.js +0 -22
- package/docs/.vitepress/dist/assets/ConfigManager.md.BOMdGTaa.lean.js +0 -1
- package/docs/.vitepress/dist/assets/ErrorHandler.md.yUiuJ9w9.js +0 -28
- package/docs/.vitepress/dist/assets/ErrorHandler.md.yUiuJ9w9.lean.js +0 -1
- package/docs/.vitepress/dist/assets/EventManager.md.BhCUVy1f.js +0 -34
- package/docs/.vitepress/dist/assets/EventManager.md.BhCUVy1f.lean.js +0 -1
- package/docs/.vitepress/dist/assets/Line.md.BAQOzmSt.js +0 -68
- package/docs/.vitepress/dist/assets/Line.md.BAQOzmSt.lean.js +0 -1
- package/docs/.vitepress/dist/assets/MapBaseLayers.md.Bw0L_m0b.js +0 -28
- package/docs/.vitepress/dist/assets/MapBaseLayers.md.Bw0L_m0b.lean.js +0 -1
- package/docs/.vitepress/dist/assets/MapTools.md.DaYgiDPe.js +0 -57
- package/docs/.vitepress/dist/assets/MapTools.md.DaYgiDPe.lean.js +0 -1
- package/docs/.vitepress/dist/assets/MeasureHandler.md.7Sf4ymRv.js +0 -8
- package/docs/.vitepress/dist/assets/MeasureHandler.md.7Sf4ymRv.lean.js +0 -1
- package/docs/.vitepress/dist/assets/MyOl.md.D-14Gzjy.js +0 -38
- package/docs/.vitepress/dist/assets/MyOl.md.D-14Gzjy.lean.js +0 -1
- package/docs/.vitepress/dist/assets/Point.md.Bi9juuuv.js +0 -57
- package/docs/.vitepress/dist/assets/Point.md.Bi9juuuv.lean.js +0 -1
- package/docs/.vitepress/dist/assets/Polygon.md.-JIqEvzD.js +0 -78
- package/docs/.vitepress/dist/assets/Polygon.md.-JIqEvzD.lean.js +0 -1
- package/docs/.vitepress/dist/assets/RiverLayerManager.md.CfUu2RxH.js +0 -42
- package/docs/.vitepress/dist/assets/RiverLayerManager.md.CfUu2RxH.lean.js +0 -1
- package/docs/.vitepress/dist/assets/SelectHandler.md.COR4ez_p.js +0 -22
- package/docs/.vitepress/dist/assets/SelectHandler.md.COR4ez_p.lean.js +0 -1
- package/docs/.vitepress/dist/assets/ValidationUtils.md.ReTVWa73.js +0 -23
- package/docs/.vitepress/dist/assets/ValidationUtils.md.ReTVWa73.lean.js +0 -1
- package/docs/.vitepress/dist/assets/VueTemplatePoint.md.CtxSb5Pm.js +0 -88
- package/docs/.vitepress/dist/assets/VueTemplatePoint.md.CtxSb5Pm.lean.js +0 -1
- package/docs/.vitepress/dist/assets/app.YvjVuxaB.js +0 -1
- package/docs/.vitepress/dist/assets/chunks/framework.C_W0ODpn.js +0 -18
- package/docs/.vitepress/dist/assets/chunks/theme.Bf87fILP.js +0 -1
- package/docs/.vitepress/dist/assets/index.md.BJz6tHSr.js +0 -26
- package/docs/.vitepress/dist/assets/index.md.BJz6tHSr.lean.js +0 -1
- package/docs/.vitepress/dist/assets/inter-italic-cyrillic-ext.r48I6akx.woff2 +0 -0
- package/docs/.vitepress/dist/assets/inter-italic-cyrillic.By2_1cv3.woff2 +0 -0
- package/docs/.vitepress/dist/assets/inter-italic-greek-ext.1u6EdAuj.woff2 +0 -0
- package/docs/.vitepress/dist/assets/inter-italic-greek.DJ8dCoTZ.woff2 +0 -0
- package/docs/.vitepress/dist/assets/inter-italic-latin-ext.CN1xVJS-.woff2 +0 -0
- package/docs/.vitepress/dist/assets/inter-italic-latin.C2AdPX0b.woff2 +0 -0
- package/docs/.vitepress/dist/assets/inter-italic-vietnamese.BSbpV94h.woff2 +0 -0
- package/docs/.vitepress/dist/assets/inter-roman-cyrillic-ext.BBPuwvHQ.woff2 +0 -0
- package/docs/.vitepress/dist/assets/inter-roman-cyrillic.C5lxZ8CY.woff2 +0 -0
- package/docs/.vitepress/dist/assets/inter-roman-greek-ext.CqjqNYQ-.woff2 +0 -0
- package/docs/.vitepress/dist/assets/inter-roman-greek.BBVDIX6e.woff2 +0 -0
- package/docs/.vitepress/dist/assets/inter-roman-latin-ext.4ZJIpNVo.woff2 +0 -0
- package/docs/.vitepress/dist/assets/inter-roman-latin.Di8DUHzh.woff2 +0 -0
- package/docs/.vitepress/dist/assets/inter-roman-vietnamese.BjW4sHH5.woff2 +0 -0
- package/docs/.vitepress/dist/assets/style.C2pAQzDq.css +0 -1
- package/docs/.vitepress/dist/hashmap.json +0 -1
- package/docs/.vitepress/dist/index.html +0 -50
- package/docs/.vitepress/dist/vp-icons.css +0 -1
- package/types.d.ts +0 -431
package/docs/Line.md
CHANGED
|
@@ -1,187 +1,215 @@
|
|
|
1
|
-
# Line 线要素类
|
|
2
|
-
|
|
3
|
-
`Line`
|
|
4
|
-
|
|
5
|
-
## 构造函数
|
|
6
|
-
|
|
7
|
-
```typescript
|
|
8
|
-
const line = new Line(map: Map);
|
|
9
|
-
```
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
|
20
|
-
|
|
|
21
|
-
|
|
|
22
|
-
| `
|
|
23
|
-
| `
|
|
24
|
-
| `
|
|
25
|
-
| `
|
|
26
|
-
| `
|
|
27
|
-
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
|
34
|
-
|
|
|
35
|
-
| `
|
|
36
|
-
| `
|
|
37
|
-
| `
|
|
38
|
-
| `
|
|
39
|
-
| `
|
|
40
|
-
| `
|
|
41
|
-
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
```
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
1
|
+
# Line 线要素类
|
|
2
|
+
|
|
3
|
+
`Line` 类用于在地图上管理静态线和流动线,支持 GeoJSON 数据加载、自定义样式、图层管理以及沿线运动符号 / 流光动画。
|
|
4
|
+
|
|
5
|
+
## 构造函数
|
|
6
|
+
|
|
7
|
+
```typescript
|
|
8
|
+
const line = new Line(map: Map);
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## 核心类型
|
|
12
|
+
|
|
13
|
+
### LineOptions
|
|
14
|
+
|
|
15
|
+
静态线配置,继承自 `BaseOptions`、`StyleOptions`、`TextOptions`。
|
|
16
|
+
|
|
17
|
+
| 属性 | 类型 | 说明 |
|
|
18
|
+
| :--- | :--- | :--- |
|
|
19
|
+
| `layerName` | `string` | 图层名称 |
|
|
20
|
+
| `strokeColor` | `string \| number[]` | 线颜色 |
|
|
21
|
+
| `strokeWidth` | `number` | 线宽 |
|
|
22
|
+
| `lineDash` | `number[]` | 虚线样式 |
|
|
23
|
+
| `lineDashOffset` | `number` | 虚线偏移 |
|
|
24
|
+
| `style` | `Style \| Style[] \| (feature) => Style \| Style[]` | 自定义静态线样式 |
|
|
25
|
+
| `dataProjection` | `string` | 输入数据投影 |
|
|
26
|
+
| `featureProjection` | `string` | 要素投影 |
|
|
27
|
+
| `projectionOptOptions` | `any` | 旧版投影参数,兼容保留 |
|
|
28
|
+
|
|
29
|
+
### FlowLineOptions
|
|
30
|
+
|
|
31
|
+
流动线配置,继承 `LineOptions`。
|
|
32
|
+
|
|
33
|
+
| 属性 | 类型 | 说明 |
|
|
34
|
+
| :--- | :--- | :--- |
|
|
35
|
+
| `loop` | `boolean` | 是否循环播放,默认 `true` |
|
|
36
|
+
| `autoStart` | `boolean` | 创建后是否自动开始,默认 `true` |
|
|
37
|
+
| `duration` | `number` | 单轮动画时长,默认 `4000` |
|
|
38
|
+
| `speed` | `number` | 动画速度倍率,小于等于 `0` 时回退为 `1` |
|
|
39
|
+
| `showBaseLine` | `boolean` | 是否显示基础静态线,默认 `true` |
|
|
40
|
+
| `animationMode` | `'icon' \| 'dash' \| 'icon+dash'` | 动画模式 |
|
|
41
|
+
| `flowSymbol` | `{ src?: string; scale?: number; color?: string; rotateWithView?: boolean; count?: number; spacing?: number }` | 沿线运动符号配置 |
|
|
42
|
+
|
|
43
|
+
### FlowLineLayerHandle
|
|
44
|
+
|
|
45
|
+
```typescript
|
|
46
|
+
interface FlowLineLayerHandle {
|
|
47
|
+
layer: VectorLayer<VectorSource>
|
|
48
|
+
animationLayer: VectorLayer<VectorSource>
|
|
49
|
+
start: () => void
|
|
50
|
+
pause: () => void
|
|
51
|
+
resume: () => void
|
|
52
|
+
stop: () => void
|
|
53
|
+
setVisible: (visible: boolean) => void
|
|
54
|
+
updateData: (data: MapJSONData) => void
|
|
55
|
+
remove: () => void
|
|
56
|
+
}
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
- `layer` 始终是基础线图层。
|
|
60
|
+
- `animationLayer` 始终是动画图层。
|
|
61
|
+
- 即使 `showBaseLine: false`,handle 结构也保持完整。
|
|
62
|
+
|
|
63
|
+
## 公开方法
|
|
64
|
+
|
|
65
|
+
### addLine
|
|
66
|
+
|
|
67
|
+
```typescript
|
|
68
|
+
addLine(data: MapJSONData, options?: LineOptions): VectorLayer<VectorSource>
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
添加静态线图层。
|
|
72
|
+
|
|
73
|
+
### addLineByUrl
|
|
74
|
+
|
|
75
|
+
```typescript
|
|
76
|
+
addLineByUrl(url: string, options?: LineOptions): VectorLayer<VectorSource>
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
从 URL 加载并添加静态线图层。
|
|
80
|
+
|
|
81
|
+
### removeLineLayer
|
|
82
|
+
|
|
83
|
+
```typescript
|
|
84
|
+
removeLineLayer(layerName: string): void
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
移除静态线图层。
|
|
88
|
+
|
|
89
|
+
## 流动线 / 动态图标线
|
|
90
|
+
|
|
91
|
+
### addFlowLine
|
|
92
|
+
|
|
93
|
+
```typescript
|
|
94
|
+
addFlowLine(data: MapJSONData, options?: FlowLineOptions): FlowLineLayerHandle | null
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
支持 `LineString` 和 `MultiLineString`。`MultiLineString` 会在内部拆解后参与动画。
|
|
98
|
+
`flowSymbol.src` 不限于箭头,可以是船、车、粒子、标记等任意沿线运动符号;未传时内部会使用默认矢量 moving symbol。
|
|
99
|
+
|
|
100
|
+
### addFlowLineByUrl
|
|
101
|
+
|
|
102
|
+
```typescript
|
|
103
|
+
addFlowLineByUrl(url: string, options?: FlowLineOptions): Promise<FlowLineLayerHandle | null>
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
从 URL 加载 GeoJSON 后创建流动线。网络失败、JSON 解析失败、数据结构非法时返回 `null`。
|
|
107
|
+
|
|
108
|
+
### removeFlowLineLayer
|
|
109
|
+
|
|
110
|
+
```typescript
|
|
111
|
+
removeFlowLineLayer(layerName: string): void
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
按图层名移除流动线的基础图层与动画图层。
|
|
115
|
+
|
|
116
|
+
## 使用示例
|
|
117
|
+
|
|
118
|
+
### 基础静态线
|
|
119
|
+
|
|
120
|
+
```typescript
|
|
121
|
+
const lineModule = map.getLine();
|
|
122
|
+
|
|
123
|
+
lineModule.addLine(lineData, {
|
|
124
|
+
layerName: 'base-line',
|
|
125
|
+
strokeColor: '#ff0000',
|
|
126
|
+
strokeWidth: 3
|
|
127
|
+
});
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
### 流动线基础用法
|
|
131
|
+
|
|
132
|
+
```typescript
|
|
133
|
+
const lineModule = map.getLine();
|
|
134
|
+
const flow = lineModule.addFlowLine(lineData, {
|
|
135
|
+
layerName: 'river-flow',
|
|
136
|
+
animationMode: 'icon+dash',
|
|
137
|
+
strokeColor: '#19b1ff',
|
|
138
|
+
strokeWidth: 3,
|
|
139
|
+
lineDash: [18, 12],
|
|
140
|
+
flowSymbol: {
|
|
141
|
+
src: '/symbols/boat.svg',
|
|
142
|
+
scale: 0.9,
|
|
143
|
+
color: '#19b1ff',
|
|
144
|
+
rotateWithView: true,
|
|
145
|
+
count: 2,
|
|
146
|
+
spacing: 0.2
|
|
147
|
+
},
|
|
148
|
+
duration: 3600
|
|
149
|
+
});
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
### pause / resume / remove
|
|
153
|
+
|
|
154
|
+
```typescript
|
|
155
|
+
flow?.pause();
|
|
156
|
+
flow?.resume();
|
|
157
|
+
flow?.stop();
|
|
158
|
+
flow?.remove();
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
### updateData
|
|
162
|
+
|
|
163
|
+
```typescript
|
|
164
|
+
flow?.updateData({
|
|
165
|
+
type: 'FeatureCollection',
|
|
166
|
+
features: [
|
|
167
|
+
{
|
|
168
|
+
type: 'Feature',
|
|
169
|
+
properties: { name: '支流' },
|
|
170
|
+
geometry: {
|
|
171
|
+
type: 'MultiLineString',
|
|
172
|
+
coordinates: [
|
|
173
|
+
[[119.8, 29.9], [119.9, 30.0]],
|
|
174
|
+
[[119.82, 30.02], [119.95, 30.06]]
|
|
175
|
+
]
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
]
|
|
179
|
+
});
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
### 显式投影字段示例
|
|
183
|
+
|
|
184
|
+
```typescript
|
|
185
|
+
lineModule.addFlowLine(projectedLineData, {
|
|
186
|
+
layerName: 'projected-flow',
|
|
187
|
+
animationMode: 'icon+dash',
|
|
188
|
+
dataProjection: 'EPSG:4490',
|
|
189
|
+
featureProjection: 'EPSG:3857',
|
|
190
|
+
flowSymbol: {
|
|
191
|
+
src: '/symbols/ship.svg',
|
|
192
|
+
scale: 1,
|
|
193
|
+
count: 1,
|
|
194
|
+
spacing: 0.15
|
|
195
|
+
}
|
|
196
|
+
});
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
默认输入按经纬度 GeoJSON 处理;如果地图使用其他投影,建议显式传入 `dataProjection` / `featureProjection`。
|
|
200
|
+
|
|
201
|
+
## 样式兼容说明
|
|
202
|
+
|
|
203
|
+
- `strokeColor`、`strokeWidth`、`lineDash`、`lineDashOffset`、`style` 继续兼容。
|
|
204
|
+
- 当传入 `style` 时,它只控制基础线图层,不直接控制 moving symbol。
|
|
205
|
+
- `animationMode: 'dash'` 未传虚线参数时,内部会补默认虚线样式,确保流光可见。
|
|
206
|
+
- `animationMode: 'icon+dash'` 会同时渲染:
|
|
207
|
+
- 基础线图层
|
|
208
|
+
- 动画虚线图层
|
|
209
|
+
- `postrender` moving symbol 动画
|
|
210
|
+
|
|
211
|
+
## 与旧版 projectionOptOptions 的关系
|
|
212
|
+
|
|
213
|
+
- 新项目推荐使用 `dataProjection` / `featureProjection`。
|
|
214
|
+
- `projectionOptOptions` 仅用于兼容旧代码,不再作为主入口。
|
|
215
|
+
- 当两者同时存在时,显式字段 `dataProjection` / `featureProjection` 优先级更高。
|