my-openlayer 2.4.8 → 2.4.9
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 +207 -151
- package/README.md +156 -156
- package/core/Point.js +21 -3
- 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 +187 -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 +165 -165
- 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 +78 -78
- package/package.json +1 -2
- package/types.d.ts +2 -0
- package/AI_CONTEXT.md +0 -147
package/docs/Point.md
CHANGED
|
@@ -1,165 +1,165 @@
|
|
|
1
|
-
# Point 类
|
|
2
|
-
|
|
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
|
-
|
|
30
|
-
### ClusterOptions
|
|
31
|
-
|
|
32
|
-
继承自 `PointOptions`。
|
|
33
|
-
|
|
34
|
-
| 属性名 | 类型 | 说明 |
|
|
35
|
-
| :--- | :--- | :--- |
|
|
36
|
-
| distance | `number` | 聚合距离(像素),默认为 20 |
|
|
37
|
-
| minDistance | `number` | 最小聚合距离 |
|
|
38
|
-
|
|
39
|
-
### PointData
|
|
40
|
-
|
|
41
|
-
| 属性名 | 类型 | 说明 |
|
|
42
|
-
| :--- | :--- | :--- |
|
|
43
|
-
| lgtd | `number` | 经度 |
|
|
44
|
-
| lttd | `number` | 纬度 |
|
|
45
|
-
| [key: string] | `any` | 其他业务数据字段 |
|
|
46
|
-
|
|
47
|
-
### VueTemplatePointOptions
|
|
48
|
-
|
|
49
|
-
| 属性名 | 类型 | 说明 |
|
|
50
|
-
| :--- | :--- | :--- |
|
|
51
|
-
| Template | `any` | Vue 组件模板 |
|
|
52
|
-
| lgtd | `number` | 经度 |
|
|
53
|
-
| lttd | `number` | 纬度 |
|
|
54
|
-
| props | `any` | 传递给组件的 props |
|
|
55
|
-
| styleType | `'default' \| 'custom'` | 样式类型 |
|
|
56
|
-
| positioning | `string` | 定位方式,如 'bottom-center' |
|
|
57
|
-
| stopEvent | `boolean` | 是否阻止事件冒泡 |
|
|
58
|
-
| visible | `boolean` | 是否可见 |
|
|
59
|
-
| className | `string` | 自定义类名 |
|
|
60
|
-
| zIndex | `number` | 层级 |
|
|
61
|
-
|
|
62
|
-
## 方法
|
|
63
|
-
|
|
64
|
-
### addPoint
|
|
65
|
-
|
|
66
|
-
添加普通点图层。
|
|
67
|
-
|
|
68
|
-
```typescript
|
|
69
|
-
addPoint(pointData: PointData[], options: PointOptions): VectorLayer<VectorSource> | null
|
|
70
|
-
```
|
|
71
|
-
|
|
72
|
-
- **pointData**: 点位数据数组。
|
|
73
|
-
- **options**: 配置选项。
|
|
74
|
-
- **返回值**: 创建的向量图层,如果数据无效返回 `null`。
|
|
75
|
-
|
|
76
|
-
### addClusterPoint
|
|
77
|
-
|
|
78
|
-
添加聚合点图层。
|
|
79
|
-
|
|
80
|
-
```typescript
|
|
81
|
-
addClusterPoint(pointData: PointData[], options: ClusterOptions): VectorLayer<VectorSource> | null
|
|
82
|
-
```
|
|
83
|
-
|
|
84
|
-
- **pointData**: 点位数据数组。
|
|
85
|
-
- **options**: 聚合配置选项。
|
|
86
|
-
- **返回值**: 创建的聚合图层。
|
|
87
|
-
|
|
88
|
-
### addDomPoint
|
|
89
|
-
|
|
90
|
-
添加 DOM 元素点(Overlay)。
|
|
91
|
-
|
|
92
|
-
```typescript
|
|
93
|
-
addDomPoint(twinkleList: TwinkleItem[], callback?: Function): {
|
|
94
|
-
anchors: Overlay[],
|
|
95
|
-
remove: () => void,
|
|
96
|
-
setVisible: (visible: boolean) => void
|
|
97
|
-
}
|
|
98
|
-
```
|
|
99
|
-
|
|
100
|
-
- **twinkleList**: 包含经纬度和类名的数据列表。
|
|
101
|
-
- **callback**: 点击回调函数。
|
|
102
|
-
- **返回值**: 控制对象,包含 `remove` 和 `setVisible` 方法。
|
|
103
|
-
|
|
104
|
-
### addVueTemplatePoint
|
|
105
|
-
|
|
106
|
-
添加 Vue 组件作为点位。
|
|
107
|
-
|
|
108
|
-
```typescript
|
|
109
|
-
addVueTemplatePoint(pointDataList: PointData[], template: any, options?: VueTemplatePointOptions): {
|
|
110
|
-
setVisible: (visible: boolean) => void,
|
|
111
|
-
setOneVisibleByProp: (propName: string, propValue: any, visible: boolean) => void,
|
|
112
|
-
remove: () => void,
|
|
113
|
-
getPoints: () => VueTemplatePointInstance[]
|
|
114
|
-
}
|
|
115
|
-
```
|
|
116
|
-
|
|
117
|
-
- **pointDataList**: 点位数据列表。
|
|
118
|
-
- **template**: Vue 组件。
|
|
119
|
-
- **options**: 配置选项。
|
|
120
|
-
- **返回值**: 控制对象,包含显示/隐藏和移除方法。
|
|
121
|
-
|
|
122
|
-
## 使用示例
|
|
123
|
-
|
|
124
|
-
### 添加普通点
|
|
125
|
-
|
|
126
|
-
```typescript
|
|
127
|
-
import { Point } from 'my-openlayers';
|
|
128
|
-
|
|
129
|
-
const point = new Point(map);
|
|
130
|
-
const data = [
|
|
131
|
-
{ lgtd: 116.40, lttd: 39.90, name: '北京' },
|
|
132
|
-
{ lgtd: 121.47, lttd: 31.23, name: '上海' }
|
|
133
|
-
];
|
|
134
|
-
|
|
135
|
-
point.addPoint(data, {
|
|
136
|
-
layerName: 'cities',
|
|
137
|
-
img: 'path/to/icon.png',
|
|
138
|
-
textKey: 'name',
|
|
139
|
-
scale: 0.8
|
|
140
|
-
});
|
|
141
|
-
```
|
|
142
|
-
|
|
143
|
-
### 添加聚合点
|
|
144
|
-
|
|
145
|
-
```typescript
|
|
146
|
-
point.addClusterPoint(data, {
|
|
147
|
-
layerName: 'clusters',
|
|
148
|
-
distance: 40,
|
|
149
|
-
img: 'path/to/cluster-icon.png'
|
|
150
|
-
});
|
|
151
|
-
```
|
|
152
|
-
|
|
153
|
-
### 添加 Vue 组件点
|
|
154
|
-
|
|
155
|
-
```typescript
|
|
156
|
-
import MyComponent from './MyComponent.vue';
|
|
157
|
-
|
|
158
|
-
const ctrl = point.addVueTemplatePoint(data, MyComponent, {
|
|
159
|
-
positioning: 'bottom-center',
|
|
160
|
-
props: { status: 'active' }
|
|
161
|
-
});
|
|
162
|
-
|
|
163
|
-
// 隐藏所有点
|
|
164
|
-
ctrl.setVisible(false);
|
|
165
|
-
```
|
|
1
|
+
# Point 类
|
|
2
|
+
|
|
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
|
+
|
|
30
|
+
### ClusterOptions
|
|
31
|
+
|
|
32
|
+
继承自 `PointOptions`。
|
|
33
|
+
|
|
34
|
+
| 属性名 | 类型 | 说明 |
|
|
35
|
+
| :--- | :--- | :--- |
|
|
36
|
+
| distance | `number` | 聚合距离(像素),默认为 20 |
|
|
37
|
+
| minDistance | `number` | 最小聚合距离 |
|
|
38
|
+
|
|
39
|
+
### PointData
|
|
40
|
+
|
|
41
|
+
| 属性名 | 类型 | 说明 |
|
|
42
|
+
| :--- | :--- | :--- |
|
|
43
|
+
| lgtd | `number` | 经度 |
|
|
44
|
+
| lttd | `number` | 纬度 |
|
|
45
|
+
| [key: string] | `any` | 其他业务数据字段 |
|
|
46
|
+
|
|
47
|
+
### VueTemplatePointOptions
|
|
48
|
+
|
|
49
|
+
| 属性名 | 类型 | 说明 |
|
|
50
|
+
| :--- | :--- | :--- |
|
|
51
|
+
| Template | `any` | Vue 组件模板 |
|
|
52
|
+
| lgtd | `number` | 经度 |
|
|
53
|
+
| lttd | `number` | 纬度 |
|
|
54
|
+
| props | `any` | 传递给组件的 props |
|
|
55
|
+
| styleType | `'default' \| 'custom'` | 样式类型 |
|
|
56
|
+
| positioning | `string` | 定位方式,如 'bottom-center' |
|
|
57
|
+
| stopEvent | `boolean` | 是否阻止事件冒泡 |
|
|
58
|
+
| visible | `boolean` | 是否可见 |
|
|
59
|
+
| className | `string` | 自定义类名 |
|
|
60
|
+
| zIndex | `number` | 层级 |
|
|
61
|
+
|
|
62
|
+
## 方法
|
|
63
|
+
|
|
64
|
+
### addPoint
|
|
65
|
+
|
|
66
|
+
添加普通点图层。
|
|
67
|
+
|
|
68
|
+
```typescript
|
|
69
|
+
addPoint(pointData: PointData[], options: PointOptions): VectorLayer<VectorSource> | null
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
- **pointData**: 点位数据数组。
|
|
73
|
+
- **options**: 配置选项。
|
|
74
|
+
- **返回值**: 创建的向量图层,如果数据无效返回 `null`。
|
|
75
|
+
|
|
76
|
+
### addClusterPoint
|
|
77
|
+
|
|
78
|
+
添加聚合点图层。
|
|
79
|
+
|
|
80
|
+
```typescript
|
|
81
|
+
addClusterPoint(pointData: PointData[], options: ClusterOptions): VectorLayer<VectorSource> | null
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
- **pointData**: 点位数据数组。
|
|
85
|
+
- **options**: 聚合配置选项。
|
|
86
|
+
- **返回值**: 创建的聚合图层。
|
|
87
|
+
|
|
88
|
+
### addDomPoint
|
|
89
|
+
|
|
90
|
+
添加 DOM 元素点(Overlay)。
|
|
91
|
+
|
|
92
|
+
```typescript
|
|
93
|
+
addDomPoint(twinkleList: TwinkleItem[], callback?: Function): {
|
|
94
|
+
anchors: Overlay[],
|
|
95
|
+
remove: () => void,
|
|
96
|
+
setVisible: (visible: boolean) => void
|
|
97
|
+
}
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
- **twinkleList**: 包含经纬度和类名的数据列表。
|
|
101
|
+
- **callback**: 点击回调函数。
|
|
102
|
+
- **返回值**: 控制对象,包含 `remove` 和 `setVisible` 方法。
|
|
103
|
+
|
|
104
|
+
### addVueTemplatePoint
|
|
105
|
+
|
|
106
|
+
添加 Vue 组件作为点位。
|
|
107
|
+
|
|
108
|
+
```typescript
|
|
109
|
+
addVueTemplatePoint(pointDataList: PointData[], template: any, options?: VueTemplatePointOptions): {
|
|
110
|
+
setVisible: (visible: boolean) => void,
|
|
111
|
+
setOneVisibleByProp: (propName: string, propValue: any, visible: boolean) => void,
|
|
112
|
+
remove: () => void,
|
|
113
|
+
getPoints: () => VueTemplatePointInstance[]
|
|
114
|
+
}
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
- **pointDataList**: 点位数据列表。
|
|
118
|
+
- **template**: Vue 组件。
|
|
119
|
+
- **options**: 配置选项。
|
|
120
|
+
- **返回值**: 控制对象,包含显示/隐藏和移除方法。
|
|
121
|
+
|
|
122
|
+
## 使用示例
|
|
123
|
+
|
|
124
|
+
### 添加普通点
|
|
125
|
+
|
|
126
|
+
```typescript
|
|
127
|
+
import { Point } from 'my-openlayers';
|
|
128
|
+
|
|
129
|
+
const point = new Point(map);
|
|
130
|
+
const data = [
|
|
131
|
+
{ lgtd: 116.40, lttd: 39.90, name: '北京' },
|
|
132
|
+
{ lgtd: 121.47, lttd: 31.23, name: '上海' }
|
|
133
|
+
];
|
|
134
|
+
|
|
135
|
+
point.addPoint(data, {
|
|
136
|
+
layerName: 'cities',
|
|
137
|
+
img: 'path/to/icon.png',
|
|
138
|
+
textKey: 'name',
|
|
139
|
+
scale: 0.8
|
|
140
|
+
});
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
### 添加聚合点
|
|
144
|
+
|
|
145
|
+
```typescript
|
|
146
|
+
point.addClusterPoint(data, {
|
|
147
|
+
layerName: 'clusters',
|
|
148
|
+
distance: 40,
|
|
149
|
+
img: 'path/to/cluster-icon.png'
|
|
150
|
+
});
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
### 添加 Vue 组件点
|
|
154
|
+
|
|
155
|
+
```typescript
|
|
156
|
+
import MyComponent from './MyComponent.vue';
|
|
157
|
+
|
|
158
|
+
const ctrl = point.addVueTemplatePoint(data, MyComponent, {
|
|
159
|
+
positioning: 'bottom-center',
|
|
160
|
+
props: { status: 'active' }
|
|
161
|
+
});
|
|
162
|
+
|
|
163
|
+
// 隐藏所有点
|
|
164
|
+
ctrl.setVisible(false);
|
|
165
|
+
```
|