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/Point.md
CHANGED
|
@@ -1,38 +1,38 @@
|
|
|
1
|
-
# Point 类
|
|
2
|
-
|
|
1
|
+
# Point 类
|
|
2
|
+
|
|
3
3
|
`Point` 类用于在地图上添加和管理点要素,支持普通点、聚合点、DOM 点、高性能闪烁点和 Vue 组件点。
|
|
4
|
-
|
|
5
|
-
## 构造函数
|
|
6
|
-
|
|
7
|
-
```typescript
|
|
8
|
-
constructor(map: Map)
|
|
9
|
-
```
|
|
10
|
-
|
|
11
|
-
- **map**: OpenLayers 地图实例。
|
|
12
|
-
|
|
13
|
-
## 接口定义
|
|
14
|
-
|
|
15
|
-
### PointOptions
|
|
16
|
-
|
|
17
|
-
继承自 `BaseOptions`, `StyleOptions`, `TextOptions`。
|
|
18
|
-
|
|
19
|
-
| 属性名 | 类型 | 说明 |
|
|
20
|
-
| :--- | :--- | :--- |
|
|
21
|
-
| textKey | `string` | 数据中用于显示文本的字段键名 |
|
|
22
|
-
| img | `string` | 图标图片的 URL |
|
|
23
|
-
| scale | `number` | 图标缩放比例 |
|
|
24
|
-
| iconColor | `string` | 图标颜色(用于改变图标色调) |
|
|
25
|
-
| layerName | `string` | 图层名称(必填,继承自 BaseOptions) |
|
|
26
|
-
| zIndex | `number` | 图层层级 |
|
|
27
|
-
| visible | `boolean` | 是否可见 |
|
|
28
|
-
| style | `Style \| Style[] \| ((feature: FeatureLike) => Style \| Style[])` | 自定义样式函数 |
|
|
29
|
-
|
|
4
|
+
|
|
5
|
+
## 构造函数
|
|
6
|
+
|
|
7
|
+
```typescript
|
|
8
|
+
constructor(map: Map)
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
- **map**: OpenLayers 地图实例。
|
|
12
|
+
|
|
13
|
+
## 接口定义
|
|
14
|
+
|
|
15
|
+
### PointOptions
|
|
16
|
+
|
|
17
|
+
继承自 `BaseOptions`, `StyleOptions`, `TextOptions`。
|
|
18
|
+
|
|
19
|
+
| 属性名 | 类型 | 说明 |
|
|
20
|
+
| :--- | :--- | :--- |
|
|
21
|
+
| textKey | `string` | 数据中用于显示文本的字段键名 |
|
|
22
|
+
| img | `string` | 图标图片的 URL |
|
|
23
|
+
| scale | `number` | 图标缩放比例 |
|
|
24
|
+
| iconColor | `string` | 图标颜色(用于改变图标色调) |
|
|
25
|
+
| layerName | `string` | 图层名称(必填,继承自 BaseOptions) |
|
|
26
|
+
| zIndex | `number` | 图层层级 |
|
|
27
|
+
| visible | `boolean` | 是否可见 |
|
|
28
|
+
| style | `Style \| Style[] \| ((feature: FeatureLike) => Style \| Style[])` | 自定义样式函数 |
|
|
29
|
+
|
|
30
30
|
### ClusterOptions
|
|
31
31
|
|
|
32
32
|
继承自 `PointOptions`。
|
|
33
|
-
|
|
34
|
-
| 属性名 | 类型 | 说明 |
|
|
35
|
-
| :--- | :--- | :--- |
|
|
33
|
+
|
|
34
|
+
| 属性名 | 类型 | 说明 |
|
|
35
|
+
| :--- | :--- | :--- |
|
|
36
36
|
| distance | `number` | 聚合距离(像素),默认为 20 |
|
|
37
37
|
| minDistance | `number` | 最小聚合距离 |
|
|
38
38
|
|
|
@@ -67,65 +67,65 @@ constructor(map: Map)
|
|
|
67
67
|
### PointData
|
|
68
68
|
|
|
69
69
|
| 属性名 | 类型 | 说明 |
|
|
70
|
-
| :--- | :--- | :--- |
|
|
71
|
-
| lgtd | `number` | 经度 |
|
|
72
|
-
| lttd | `number` | 纬度 |
|
|
73
|
-
| [key: string] | `any` | 其他业务数据字段 |
|
|
74
|
-
|
|
75
|
-
### VueTemplatePointOptions
|
|
76
|
-
|
|
77
|
-
| 属性名 | 类型 | 说明 |
|
|
78
|
-
| :--- | :--- | :--- |
|
|
79
|
-
| Template | `any` | Vue 组件模板 |
|
|
80
|
-
| lgtd | `number` | 经度 |
|
|
81
|
-
| lttd | `number` | 纬度 |
|
|
82
|
-
| props | `any` | 传递给组件的 props |
|
|
83
|
-
| styleType | `'default' \| 'custom'` | 样式类型 |
|
|
84
|
-
| positioning | `string` | 定位方式,如 'bottom-center' |
|
|
85
|
-
| stopEvent | `boolean` | 是否阻止事件冒泡 |
|
|
86
|
-
| visible | `boolean` | 是否可见 |
|
|
87
|
-
| className | `string` | 自定义类名 |
|
|
88
|
-
| zIndex | `number` | 层级 |
|
|
89
|
-
|
|
90
|
-
## 方法
|
|
91
|
-
|
|
92
|
-
### addPoint
|
|
93
|
-
|
|
94
|
-
添加普通点图层。
|
|
95
|
-
|
|
96
|
-
```typescript
|
|
97
|
-
addPoint(pointData: PointData[], options: PointOptions): VectorLayer<VectorSource> | null
|
|
98
|
-
```
|
|
99
|
-
|
|
100
|
-
- **pointData**: 点位数据数组。
|
|
101
|
-
- **options**: 配置选项。
|
|
102
|
-
- **返回值**: 创建的向量图层,如果数据无效返回 `null`。
|
|
103
|
-
|
|
104
|
-
### addClusterPoint
|
|
105
|
-
|
|
106
|
-
添加聚合点图层。
|
|
107
|
-
|
|
108
|
-
```typescript
|
|
109
|
-
addClusterPoint(pointData: PointData[], options: ClusterOptions): VectorLayer<VectorSource> | null
|
|
110
|
-
```
|
|
111
|
-
|
|
112
|
-
- **pointData**: 点位数据数组。
|
|
113
|
-
- **options**: 聚合配置选项。
|
|
114
|
-
- **返回值**: 创建的聚合图层。
|
|
115
|
-
|
|
70
|
+
| :--- | :--- | :--- |
|
|
71
|
+
| lgtd | `number` | 经度 |
|
|
72
|
+
| lttd | `number` | 纬度 |
|
|
73
|
+
| [key: string] | `any` | 其他业务数据字段 |
|
|
74
|
+
|
|
75
|
+
### VueTemplatePointOptions
|
|
76
|
+
|
|
77
|
+
| 属性名 | 类型 | 说明 |
|
|
78
|
+
| :--- | :--- | :--- |
|
|
79
|
+
| Template | `any` | Vue 组件模板 |
|
|
80
|
+
| lgtd | `number` | 经度 |
|
|
81
|
+
| lttd | `number` | 纬度 |
|
|
82
|
+
| props | `any` | 传递给组件的 props |
|
|
83
|
+
| styleType | `'default' \| 'custom'` | 样式类型 |
|
|
84
|
+
| positioning | `string` | 定位方式,如 'bottom-center' |
|
|
85
|
+
| stopEvent | `boolean` | 是否阻止事件冒泡 |
|
|
86
|
+
| visible | `boolean` | 是否可见 |
|
|
87
|
+
| className | `string` | 自定义类名 |
|
|
88
|
+
| zIndex | `number` | 层级 |
|
|
89
|
+
|
|
90
|
+
## 方法
|
|
91
|
+
|
|
92
|
+
### addPoint
|
|
93
|
+
|
|
94
|
+
添加普通点图层。
|
|
95
|
+
|
|
96
|
+
```typescript
|
|
97
|
+
addPoint(pointData: PointData[], options: PointOptions): VectorLayer<VectorSource> | null
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
- **pointData**: 点位数据数组。
|
|
101
|
+
- **options**: 配置选项。
|
|
102
|
+
- **返回值**: 创建的向量图层,如果数据无效返回 `null`。
|
|
103
|
+
|
|
104
|
+
### addClusterPoint
|
|
105
|
+
|
|
106
|
+
添加聚合点图层。
|
|
107
|
+
|
|
108
|
+
```typescript
|
|
109
|
+
addClusterPoint(pointData: PointData[], options: ClusterOptions): VectorLayer<VectorSource> | null
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
- **pointData**: 点位数据数组。
|
|
113
|
+
- **options**: 聚合配置选项。
|
|
114
|
+
- **返回值**: 创建的聚合图层。
|
|
115
|
+
|
|
116
116
|
### addDomPoint
|
|
117
117
|
|
|
118
118
|
添加 DOM 元素点(Overlay)。
|
|
119
|
-
|
|
120
|
-
```typescript
|
|
121
|
-
addDomPoint(twinkleList: TwinkleItem[], callback?: Function): {
|
|
122
|
-
anchors: Overlay[],
|
|
123
|
-
remove: () => void,
|
|
124
|
-
setVisible: (visible: boolean) => void
|
|
125
|
-
}
|
|
126
|
-
```
|
|
127
|
-
|
|
128
|
-
- **twinkleList**: 包含经纬度和类名的数据列表。
|
|
119
|
+
|
|
120
|
+
```typescript
|
|
121
|
+
addDomPoint(twinkleList: TwinkleItem[], callback?: Function): {
|
|
122
|
+
anchors: Overlay[],
|
|
123
|
+
remove: () => void,
|
|
124
|
+
setVisible: (visible: boolean) => void
|
|
125
|
+
}
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
- **twinkleList**: 包含经纬度和类名的数据列表。
|
|
129
129
|
- **callback**: 点击回调函数。
|
|
130
130
|
- **返回值**: 控制对象,包含 `remove` 和 `setVisible` 方法。
|
|
131
131
|
|
|
@@ -144,45 +144,45 @@ addPulsePointLayer(pointData: PointData[], options: PulsePointOptions): PulsePoi
|
|
|
144
144
|
### addVueTemplatePoint
|
|
145
145
|
|
|
146
146
|
添加 Vue 组件作为点位。
|
|
147
|
-
|
|
148
|
-
```typescript
|
|
149
|
-
addVueTemplatePoint(pointDataList: PointData[], template: any, options?: VueTemplatePointOptions): {
|
|
150
|
-
setVisible: (visible: boolean) => void,
|
|
151
|
-
setOneVisibleByProp: (propName: string, propValue: any, visible: boolean) => void,
|
|
152
|
-
remove: () => void,
|
|
153
|
-
getPoints: () => VueTemplatePointInstance[]
|
|
154
|
-
}
|
|
155
|
-
```
|
|
156
|
-
|
|
157
|
-
- **pointDataList**: 点位数据列表。
|
|
158
|
-
- **template**: Vue 组件。
|
|
159
|
-
- **options**: 配置选项。
|
|
160
|
-
- **返回值**: 控制对象,包含显示/隐藏和移除方法。
|
|
161
|
-
|
|
162
|
-
## 使用示例
|
|
163
|
-
|
|
164
|
-
### 添加普通点
|
|
165
|
-
|
|
166
|
-
```typescript
|
|
167
|
-
import { Point } from 'my-openlayers';
|
|
168
|
-
|
|
169
|
-
const point = new Point(map);
|
|
170
|
-
const data = [
|
|
171
|
-
{ lgtd: 116.40, lttd: 39.90, name: '北京' },
|
|
172
|
-
{ lgtd: 121.47, lttd: 31.23, name: '上海' }
|
|
173
|
-
];
|
|
174
|
-
|
|
175
|
-
point.addPoint(data, {
|
|
176
|
-
layerName: 'cities',
|
|
177
|
-
img: 'path/to/icon.png',
|
|
178
|
-
textKey: 'name',
|
|
179
|
-
scale: 0.8
|
|
180
|
-
});
|
|
181
|
-
```
|
|
182
|
-
|
|
183
|
-
### 添加聚合点
|
|
184
|
-
|
|
185
|
-
```typescript
|
|
147
|
+
|
|
148
|
+
```typescript
|
|
149
|
+
addVueTemplatePoint(pointDataList: PointData[], template: any, options?: VueTemplatePointOptions): {
|
|
150
|
+
setVisible: (visible: boolean) => void,
|
|
151
|
+
setOneVisibleByProp: (propName: string, propValue: any, visible: boolean) => void,
|
|
152
|
+
remove: () => void,
|
|
153
|
+
getPoints: () => VueTemplatePointInstance[]
|
|
154
|
+
}
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
- **pointDataList**: 点位数据列表。
|
|
158
|
+
- **template**: Vue 组件。
|
|
159
|
+
- **options**: 配置选项。
|
|
160
|
+
- **返回值**: 控制对象,包含显示/隐藏和移除方法。
|
|
161
|
+
|
|
162
|
+
## 使用示例
|
|
163
|
+
|
|
164
|
+
### 添加普通点
|
|
165
|
+
|
|
166
|
+
```typescript
|
|
167
|
+
import { Point } from 'my-openlayers';
|
|
168
|
+
|
|
169
|
+
const point = new Point(map);
|
|
170
|
+
const data = [
|
|
171
|
+
{ lgtd: 116.40, lttd: 39.90, name: '北京' },
|
|
172
|
+
{ lgtd: 121.47, lttd: 31.23, name: '上海' }
|
|
173
|
+
];
|
|
174
|
+
|
|
175
|
+
point.addPoint(data, {
|
|
176
|
+
layerName: 'cities',
|
|
177
|
+
img: 'path/to/icon.png',
|
|
178
|
+
textKey: 'name',
|
|
179
|
+
scale: 0.8
|
|
180
|
+
});
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
### 添加聚合点
|
|
184
|
+
|
|
185
|
+
```typescript
|
|
186
186
|
point.addClusterPoint(data, {
|
|
187
187
|
layerName: 'clusters',
|
|
188
188
|
distance: 40,
|
|
@@ -221,13 +221,13 @@ pulseCtrl?.remove();
|
|
|
221
221
|
### 添加 Vue 组件点
|
|
222
222
|
|
|
223
223
|
```typescript
|
|
224
|
-
import MyComponent from './MyComponent.vue';
|
|
225
|
-
|
|
226
|
-
const ctrl = point.addVueTemplatePoint(data, MyComponent, {
|
|
227
|
-
positioning: 'bottom-center',
|
|
228
|
-
props: { status: 'active' }
|
|
229
|
-
});
|
|
230
|
-
|
|
231
|
-
// 隐藏所有点
|
|
232
|
-
ctrl.setVisible(false);
|
|
233
|
-
```
|
|
224
|
+
import MyComponent from './MyComponent.vue';
|
|
225
|
+
|
|
226
|
+
const ctrl = point.addVueTemplatePoint(data, MyComponent, {
|
|
227
|
+
positioning: 'bottom-center',
|
|
228
|
+
props: { status: 'active' }
|
|
229
|
+
});
|
|
230
|
+
|
|
231
|
+
// 隐藏所有点
|
|
232
|
+
ctrl.setVisible(false);
|
|
233
|
+
```
|