my-openlayer 2.4.8 → 2.4.10
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 +212 -102
- package/MyOl.js +2 -0
- 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/CHANGELOG.md
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
-
## [2.4.
|
|
3
|
+
## [2.4.10] - 2026-03-31
|
|
4
4
|
|
|
5
5
|
### ✨ Features
|
|
6
6
|
|
|
7
|
+
- **TwinkleItem:** 支持自定义闪烁点DOM元素
|
|
7
8
|
- **SelectHandler:** 重构选择交互以支持独立样式渲染和多选隔离
|
|
8
9
|
- 重构Polygon样式处理并添加示例组件
|
|
9
10
|
- **core:** 添加基于GeoJSON数据的地图定位功能
|
|
@@ -47,114 +48,17 @@
|
|
|
47
48
|
|
|
48
49
|
### 📝 Documentation
|
|
49
50
|
|
|
51
|
+
- 更新技能文档的名称与描述
|
|
52
|
+
- 添加技能文档系统并更新项目文档结构
|
|
50
53
|
- add vitepress documentation and github actions workflow
|
|
51
54
|
- 添加详细模块文档并更新发布配置
|
|
52
55
|
- update README with branch strategy and add migration guide
|
|
53
56
|
|
|
54
|
-
## [2.4.
|
|
55
|
-
|
|
56
|
-
### ✨ Features
|
|
57
|
-
|
|
58
|
-
- **SelectHandler:** 重构选择交互以支持独立样式渲染和多选隔离
|
|
59
|
-
- 重构Polygon样式处理并添加示例组件
|
|
60
|
-
- **core:** 添加基于GeoJSON数据的地图定位功能
|
|
61
|
-
- **core:** 添加地图定位功能并重构点位相关方法
|
|
62
|
-
- **Point:** 添加闪烁点功能及示例
|
|
63
|
-
- **core:** 为Polygon添加layerName选项并调整图层添加逻辑
|
|
64
|
-
- **Point:** 添加setOneVisibleByProp方法控制点显示
|
|
65
|
-
- **Polygon:** 优化遮罩功能支持多几何图形处理
|
|
66
|
-
- **测量工具:** 添加测量距离和面积功能及工具栏样式
|
|
67
|
-
- **地图:** 添加自定义投影配置支持
|
|
68
|
-
- **日志管理:** 实现统一日志开关与级别控制
|
|
69
|
-
- **SelectHandler:** 新增要素选择处理器模块
|
|
70
|
-
- upgrade OpenLayers to v10.6.1 and update project to v2.0.0
|
|
71
|
-
- update MapBaseLayers to handle optional token and improve annotation layer management
|
|
72
|
-
- 重新添加已清理的App.vue文件,移除了所有敏感token信息
|
|
73
|
-
- 重构Vue模板点位功能并优化事件管理
|
|
74
|
-
- **Polygon:** 改进图像图层处理逻辑并添加更新功能
|
|
75
|
-
- 添加验证工具类并重构现有验证逻辑
|
|
76
|
-
- **地图工具:** 重构地图工具类并增强错误处理
|
|
77
|
-
- 重构类型系统并增强核心功能
|
|
78
|
-
|
|
79
|
-
### 🐛 Bug Fixes
|
|
80
|
-
|
|
81
|
-
- **core:** 改进Vue依赖检测逻辑并更新版本号
|
|
82
|
-
- **VueTemplatePoint:** 修复Vue3环境下pointData的类型定义
|
|
83
|
-
- **core:** 修正Line类中layerName属性设置错误
|
|
84
|
-
- resolve TypeScript build error in MapBaseLayers.ts
|
|
85
|
-
|
|
86
|
-
### ⚡ Performance
|
|
87
|
-
|
|
88
|
-
- **Polygon:** 优化GeoJSON解析性能,直接注入layerName
|
|
89
|
-
|
|
90
|
-
### ♻️ Refactor
|
|
91
|
-
|
|
92
|
-
- **MapBaseLayers:** 重构图层管理逻辑,优化代码结构和可维护性
|
|
93
|
-
- **ConfigManager:** 集中管理默认配置并移除无用接口
|
|
94
|
-
- **样式处理:** 统一处理自定义样式逻辑并修复代码格式
|
|
95
|
-
- 将nameKey重命名为textKey以提高语义清晰度
|
|
96
|
-
- 更新依赖项并优化类型导出结构
|
|
97
|
-
- **core:** 重构DomPoint和MapBaseLayers类,优化代码结构和功能
|
|
98
|
-
|
|
99
|
-
### 📝 Documentation
|
|
100
|
-
|
|
101
|
-
- 添加详细模块文档并更新发布配置
|
|
102
|
-
- update README with branch strategy and add migration guide
|
|
103
|
-
|
|
104
|
-
## [2.4.6] - 2026-01-30
|
|
105
|
-
|
|
106
|
-
### ✨ Features
|
|
107
|
-
|
|
108
|
-
- **SelectHandler:** 重构选择交互以支持独立样式渲染和多选隔离
|
|
109
|
-
- 重构Polygon样式处理并添加示例组件
|
|
110
|
-
- **core:** 添加基于GeoJSON数据的地图定位功能
|
|
111
|
-
- **core:** 添加地图定位功能并重构点位相关方法
|
|
112
|
-
- **Point:** 添加闪烁点功能及示例
|
|
113
|
-
- **core:** 为Polygon添加layerName选项并调整图层添加逻辑
|
|
114
|
-
- **Point:** 添加setOneVisibleByProp方法控制点显示
|
|
115
|
-
- **Polygon:** 优化遮罩功能支持多几何图形处理
|
|
116
|
-
- **测量工具:** 添加测量距离和面积功能及工具栏样式
|
|
117
|
-
- **地图:** 添加自定义投影配置支持
|
|
118
|
-
- **日志管理:** 实现统一日志开关与级别控制
|
|
119
|
-
- **SelectHandler:** 新增要素选择处理器模块
|
|
120
|
-
- upgrade OpenLayers to v10.6.1 and update project to v2.0.0
|
|
121
|
-
- update MapBaseLayers to handle optional token and improve annotation layer management
|
|
122
|
-
- 重新添加已清理的App.vue文件,移除了所有敏感token信息
|
|
123
|
-
- 重构Vue模板点位功能并优化事件管理
|
|
124
|
-
- **Polygon:** 改进图像图层处理逻辑并添加更新功能
|
|
125
|
-
- 添加验证工具类并重构现有验证逻辑
|
|
126
|
-
- **地图工具:** 重构地图工具类并增强错误处理
|
|
127
|
-
- 重构类型系统并增强核心功能
|
|
128
|
-
|
|
129
|
-
### 🐛 Bug Fixes
|
|
130
|
-
|
|
131
|
-
- **core:** 改进Vue依赖检测逻辑并更新版本号
|
|
132
|
-
- **VueTemplatePoint:** 修复Vue3环境下pointData的类型定义
|
|
133
|
-
- **core:** 修正Line类中layerName属性设置错误
|
|
134
|
-
- resolve TypeScript build error in MapBaseLayers.ts
|
|
135
|
-
|
|
136
|
-
### ⚡ Performance
|
|
137
|
-
|
|
138
|
-
- **Polygon:** 优化GeoJSON解析性能,直接注入layerName
|
|
139
|
-
|
|
140
|
-
### ♻️ Refactor
|
|
141
|
-
|
|
142
|
-
- **MapBaseLayers:** 重构图层管理逻辑,优化代码结构和可维护性
|
|
143
|
-
- **ConfigManager:** 集中管理默认配置并移除无用接口
|
|
144
|
-
- **样式处理:** 统一处理自定义样式逻辑并修复代码格式
|
|
145
|
-
- 将nameKey重命名为textKey以提高语义清晰度
|
|
146
|
-
- 更新依赖项并优化类型导出结构
|
|
147
|
-
- **core:** 重构DomPoint和MapBaseLayers类,优化代码结构和功能
|
|
148
|
-
|
|
149
|
-
### 📝 Documentation
|
|
150
|
-
|
|
151
|
-
- 添加详细模块文档并更新发布配置
|
|
152
|
-
- update README with branch strategy and add migration guide
|
|
153
|
-
|
|
154
|
-
## [2.4.5] - 2026-01-30
|
|
57
|
+
## [2.4.9] - 2026-03-05
|
|
155
58
|
|
|
156
59
|
### ✨ Features
|
|
157
60
|
|
|
61
|
+
- **TwinkleItem:** 支持自定义闪烁点DOM元素
|
|
158
62
|
- **SelectHandler:** 重构选择交互以支持独立样式渲染和多选隔离
|
|
159
63
|
- 重构Polygon样式处理并添加示例组件
|
|
160
64
|
- **core:** 添加基于GeoJSON数据的地图定位功能
|
|
@@ -198,11 +102,217 @@
|
|
|
198
102
|
|
|
199
103
|
### 📝 Documentation
|
|
200
104
|
|
|
105
|
+
- 更新技能文档的名称与描述
|
|
106
|
+
- 添加技能文档系统并更新项目文档结构
|
|
107
|
+
- add vitepress documentation and github actions workflow
|
|
201
108
|
- 添加详细模块文档并更新发布配置
|
|
202
109
|
- update README with branch strategy and add migration guide
|
|
203
110
|
|
|
204
111
|
# Changelog
|
|
205
112
|
|
|
113
|
+
## [2.4.8] - 2026-01-30
|
|
114
|
+
|
|
115
|
+
### ✨ Features
|
|
116
|
+
|
|
117
|
+
- **SelectHandler:** 重构选择交互以支持独立样式渲染和多选隔离
|
|
118
|
+
- 重构Polygon样式处理并添加示例组件
|
|
119
|
+
- **core:** 添加基于GeoJSON数据的地图定位功能
|
|
120
|
+
- **core:** 添加地图定位功能并重构点位相关方法
|
|
121
|
+
- **Point:** 添加闪烁点功能及示例
|
|
122
|
+
- **core:** 为Polygon添加layerName选项并调整图层添加逻辑
|
|
123
|
+
- **Point:** 添加setOneVisibleByProp方法控制点显示
|
|
124
|
+
- **Polygon:** 优化遮罩功能支持多几何图形处理
|
|
125
|
+
- **测量工具:** 添加测量距离和面积功能及工具栏样式
|
|
126
|
+
- **地图:** 添加自定义投影配置支持
|
|
127
|
+
- **日志管理:** 实现统一日志开关与级别控制
|
|
128
|
+
- **SelectHandler:** 新增要素选择处理器模块
|
|
129
|
+
- upgrade OpenLayers to v10.6.1 and update project to v2.0.0
|
|
130
|
+
- update MapBaseLayers to handle optional token and improve annotation layer management
|
|
131
|
+
- 重新添加已清理的App.vue文件,移除了所有敏感token信息
|
|
132
|
+
- 重构Vue模板点位功能并优化事件管理
|
|
133
|
+
- **Polygon:** 改进图像图层处理逻辑并添加更新功能
|
|
134
|
+
- 添加验证工具类并重构现有验证逻辑
|
|
135
|
+
- **地图工具:** 重构地图工具类并增强错误处理
|
|
136
|
+
- 重构类型系统并增强核心功能
|
|
137
|
+
|
|
138
|
+
### 🐛 Bug Fixes
|
|
139
|
+
|
|
140
|
+
- **core:** 改进Vue依赖检测逻辑并更新版本号
|
|
141
|
+
- **VueTemplatePoint:** 修复Vue3环境下pointData的类型定义
|
|
142
|
+
- **core:** 修正Line类中layerName属性设置错误
|
|
143
|
+
- resolve TypeScript build error in MapBaseLayers.ts
|
|
144
|
+
|
|
145
|
+
### ⚡ Performance
|
|
146
|
+
|
|
147
|
+
- **Polygon:** 优化GeoJSON解析性能,直接注入layerName
|
|
148
|
+
|
|
149
|
+
### ♻️ Refactor
|
|
150
|
+
|
|
151
|
+
- **MapBaseLayers:** 重构图层管理逻辑,优化代码结构和可维护性
|
|
152
|
+
- **ConfigManager:** 集中管理默认配置并移除无用接口
|
|
153
|
+
- **样式处理:** 统一处理自定义样式逻辑并修复代码格式
|
|
154
|
+
- 将nameKey重命名为textKey以提高语义清晰度
|
|
155
|
+
- 更新依赖项并优化类型导出结构
|
|
156
|
+
- **core:** 重构DomPoint和MapBaseLayers类,优化代码结构和功能
|
|
157
|
+
|
|
158
|
+
### 📝 Documentation
|
|
159
|
+
|
|
160
|
+
- add vitepress documentation and github actions workflow
|
|
161
|
+
- 添加详细模块文档并更新发布配置
|
|
162
|
+
- update README with branch strategy and add migration guide
|
|
163
|
+
|
|
164
|
+
## [2.4.7] - 2026-01-30
|
|
165
|
+
|
|
166
|
+
### ✨ Features
|
|
167
|
+
|
|
168
|
+
- **SelectHandler:** 重构选择交互以支持独立样式渲染和多选隔离
|
|
169
|
+
- 重构Polygon样式处理并添加示例组件
|
|
170
|
+
- **core:** 添加基于GeoJSON数据的地图定位功能
|
|
171
|
+
- **core:** 添加地图定位功能并重构点位相关方法
|
|
172
|
+
- **Point:** 添加闪烁点功能及示例
|
|
173
|
+
- **core:** 为Polygon添加layerName选项并调整图层添加逻辑
|
|
174
|
+
- **Point:** 添加setOneVisibleByProp方法控制点显示
|
|
175
|
+
- **Polygon:** 优化遮罩功能支持多几何图形处理
|
|
176
|
+
- **测量工具:** 添加测量距离和面积功能及工具栏样式
|
|
177
|
+
- **地图:** 添加自定义投影配置支持
|
|
178
|
+
- **日志管理:** 实现统一日志开关与级别控制
|
|
179
|
+
- **SelectHandler:** 新增要素选择处理器模块
|
|
180
|
+
- upgrade OpenLayers to v10.6.1 and update project to v2.0.0
|
|
181
|
+
- update MapBaseLayers to handle optional token and improve annotation layer management
|
|
182
|
+
- 重新添加已清理的App.vue文件,移除了所有敏感token信息
|
|
183
|
+
- 重构Vue模板点位功能并优化事件管理
|
|
184
|
+
- **Polygon:** 改进图像图层处理逻辑并添加更新功能
|
|
185
|
+
- 添加验证工具类并重构现有验证逻辑
|
|
186
|
+
- **地图工具:** 重构地图工具类并增强错误处理
|
|
187
|
+
- 重构类型系统并增强核心功能
|
|
188
|
+
|
|
189
|
+
### 🐛 Bug Fixes
|
|
190
|
+
|
|
191
|
+
- **core:** 改进Vue依赖检测逻辑并更新版本号
|
|
192
|
+
- **VueTemplatePoint:** 修复Vue3环境下pointData的类型定义
|
|
193
|
+
- **core:** 修正Line类中layerName属性设置错误
|
|
194
|
+
- resolve TypeScript build error in MapBaseLayers.ts
|
|
195
|
+
|
|
196
|
+
### ⚡ Performance
|
|
197
|
+
|
|
198
|
+
- **Polygon:** 优化GeoJSON解析性能,直接注入layerName
|
|
199
|
+
|
|
200
|
+
### ♻️ Refactor
|
|
201
|
+
|
|
202
|
+
- **MapBaseLayers:** 重构图层管理逻辑,优化代码结构和可维护性
|
|
203
|
+
- **ConfigManager:** 集中管理默认配置并移除无用接口
|
|
204
|
+
- **样式处理:** 统一处理自定义样式逻辑并修复代码格式
|
|
205
|
+
- 将nameKey重命名为textKey以提高语义清晰度
|
|
206
|
+
- 更新依赖项并优化类型导出结构
|
|
207
|
+
- **core:** 重构DomPoint和MapBaseLayers类,优化代码结构和功能
|
|
208
|
+
|
|
209
|
+
### 📝 Documentation
|
|
210
|
+
|
|
211
|
+
- 添加详细模块文档并更新发布配置
|
|
212
|
+
- update README with branch strategy and add migration guide
|
|
213
|
+
|
|
214
|
+
## [2.4.6] - 2026-01-30
|
|
215
|
+
|
|
216
|
+
### ✨ Features
|
|
217
|
+
|
|
218
|
+
- **SelectHandler:** 重构选择交互以支持独立样式渲染和多选隔离
|
|
219
|
+
- 重构Polygon样式处理并添加示例组件
|
|
220
|
+
- **core:** 添加基于GeoJSON数据的地图定位功能
|
|
221
|
+
- **core:** 添加地图定位功能并重构点位相关方法
|
|
222
|
+
- **Point:** 添加闪烁点功能及示例
|
|
223
|
+
- **core:** 为Polygon添加layerName选项并调整图层添加逻辑
|
|
224
|
+
- **Point:** 添加setOneVisibleByProp方法控制点显示
|
|
225
|
+
- **Polygon:** 优化遮罩功能支持多几何图形处理
|
|
226
|
+
- **测量工具:** 添加测量距离和面积功能及工具栏样式
|
|
227
|
+
- **地图:** 添加自定义投影配置支持
|
|
228
|
+
- **日志管理:** 实现统一日志开关与级别控制
|
|
229
|
+
- **SelectHandler:** 新增要素选择处理器模块
|
|
230
|
+
- upgrade OpenLayers to v10.6.1 and update project to v2.0.0
|
|
231
|
+
- update MapBaseLayers to handle optional token and improve annotation layer management
|
|
232
|
+
- 重新添加已清理的App.vue文件,移除了所有敏感token信息
|
|
233
|
+
- 重构Vue模板点位功能并优化事件管理
|
|
234
|
+
- **Polygon:** 改进图像图层处理逻辑并添加更新功能
|
|
235
|
+
- 添加验证工具类并重构现有验证逻辑
|
|
236
|
+
- **地图工具:** 重构地图工具类并增强错误处理
|
|
237
|
+
- 重构类型系统并增强核心功能
|
|
238
|
+
|
|
239
|
+
### 🐛 Bug Fixes
|
|
240
|
+
|
|
241
|
+
- **core:** 改进Vue依赖检测逻辑并更新版本号
|
|
242
|
+
- **VueTemplatePoint:** 修复Vue3环境下pointData的类型定义
|
|
243
|
+
- **core:** 修正Line类中layerName属性设置错误
|
|
244
|
+
- resolve TypeScript build error in MapBaseLayers.ts
|
|
245
|
+
|
|
246
|
+
### ⚡ Performance
|
|
247
|
+
|
|
248
|
+
- **Polygon:** 优化GeoJSON解析性能,直接注入layerName
|
|
249
|
+
|
|
250
|
+
### ♻️ Refactor
|
|
251
|
+
|
|
252
|
+
- **MapBaseLayers:** 重构图层管理逻辑,优化代码结构和可维护性
|
|
253
|
+
- **ConfigManager:** 集中管理默认配置并移除无用接口
|
|
254
|
+
- **样式处理:** 统一处理自定义样式逻辑并修复代码格式
|
|
255
|
+
- 将nameKey重命名为textKey以提高语义清晰度
|
|
256
|
+
- 更新依赖项并优化类型导出结构
|
|
257
|
+
- **core:** 重构DomPoint和MapBaseLayers类,优化代码结构和功能
|
|
258
|
+
|
|
259
|
+
### 📝 Documentation
|
|
260
|
+
|
|
261
|
+
- 添加详细模块文档并更新发布配置
|
|
262
|
+
- update README with branch strategy and add migration guide
|
|
263
|
+
|
|
264
|
+
## [2.4.5] - 2026-01-30
|
|
265
|
+
|
|
266
|
+
### ✨ Features
|
|
267
|
+
|
|
268
|
+
- **SelectHandler:** 重构选择交互以支持独立样式渲染和多选隔离
|
|
269
|
+
- 重构Polygon样式处理并添加示例组件
|
|
270
|
+
- **core:** 添加基于GeoJSON数据的地图定位功能
|
|
271
|
+
- **core:** 添加地图定位功能并重构点位相关方法
|
|
272
|
+
- **Point:** 添加闪烁点功能及示例
|
|
273
|
+
- **core:** 为Polygon添加layerName选项并调整图层添加逻辑
|
|
274
|
+
- **Point:** 添加setOneVisibleByProp方法控制点显示
|
|
275
|
+
- **Polygon:** 优化遮罩功能支持多几何图形处理
|
|
276
|
+
- **测量工具:** 添加测量距离和面积功能及工具栏样式
|
|
277
|
+
- **地图:** 添加自定义投影配置支持
|
|
278
|
+
- **日志管理:** 实现统一日志开关与级别控制
|
|
279
|
+
- **SelectHandler:** 新增要素选择处理器模块
|
|
280
|
+
- upgrade OpenLayers to v10.6.1 and update project to v2.0.0
|
|
281
|
+
- update MapBaseLayers to handle optional token and improve annotation layer management
|
|
282
|
+
- 重新添加已清理的App.vue文件,移除了所有敏感token信息
|
|
283
|
+
- 重构Vue模板点位功能并优化事件管理
|
|
284
|
+
- **Polygon:** 改进图像图层处理逻辑并添加更新功能
|
|
285
|
+
- 添加验证工具类并重构现有验证逻辑
|
|
286
|
+
- **地图工具:** 重构地图工具类并增强错误处理
|
|
287
|
+
- 重构类型系统并增强核心功能
|
|
288
|
+
|
|
289
|
+
### 🐛 Bug Fixes
|
|
290
|
+
|
|
291
|
+
- **core:** 改进Vue依赖检测逻辑并更新版本号
|
|
292
|
+
- **VueTemplatePoint:** 修复Vue3环境下pointData的类型定义
|
|
293
|
+
- **core:** 修正Line类中layerName属性设置错误
|
|
294
|
+
- resolve TypeScript build error in MapBaseLayers.ts
|
|
295
|
+
|
|
296
|
+
### ⚡ Performance
|
|
297
|
+
|
|
298
|
+
- **Polygon:** 优化GeoJSON解析性能,直接注入layerName
|
|
299
|
+
|
|
300
|
+
### ♻️ Refactor
|
|
301
|
+
|
|
302
|
+
- **MapBaseLayers:** 重构图层管理逻辑,优化代码结构和可维护性
|
|
303
|
+
- **ConfigManager:** 集中管理默认配置并移除无用接口
|
|
304
|
+
- **样式处理:** 统一处理自定义样式逻辑并修复代码格式
|
|
305
|
+
- 将nameKey重命名为textKey以提高语义清晰度
|
|
306
|
+
- 更新依赖项并优化类型导出结构
|
|
307
|
+
- **core:** 重构DomPoint和MapBaseLayers类,优化代码结构和功能
|
|
308
|
+
|
|
309
|
+
### 📝 Documentation
|
|
310
|
+
|
|
311
|
+
- 添加详细模块文档并更新发布配置
|
|
312
|
+
- update README with branch strategy and add migration guide
|
|
313
|
+
|
|
314
|
+
# Changelog
|
|
315
|
+
|
|
206
316
|
## [2.4.3] - 2026-01-27
|
|
207
317
|
|
|
208
318
|
### ✨ Features
|
package/MyOl.js
CHANGED
|
@@ -149,6 +149,8 @@ class MyOl {
|
|
|
149
149
|
*/
|
|
150
150
|
static createView(options = MyOl.DefaultOptions) {
|
|
151
151
|
try {
|
|
152
|
+
// 确保坐标系已注册(支持独立调用 createView 而不先实例化 MyOl)
|
|
153
|
+
MyOl.initializeProjections(options);
|
|
152
154
|
const code = options.projection?.code ?? MyOl.PROJECTIONS.CGCS2000;
|
|
153
155
|
const projection = new olProjProjection({
|
|
154
156
|
code,
|
package/README.md
CHANGED
|
@@ -1,156 +1,156 @@
|
|
|
1
|
-
# my-openlayer
|
|
2
|
-
|
|
3
|
-
my-openlayer 是一个基于 [OpenLayers](https://openlayers.org/) 的现代地图组件库,专为 Web GIS 应用开发者设计。提供完整的 TypeScript 支持、模块化的类型定义、强大的错误处理和事件管理系统,支持天地图底图加载、要素绘制、图层管理、事件监听等丰富功能,极大提升地图开发效率。
|
|
4
|
-
|
|
5
|
-
[](https://www.npmjs.com/package/my-openlayer)
|
|
6
|
-
[](https://www.typescriptlang.org/)
|
|
7
|
-
[](https://opensource.org/licenses/MIT)
|
|
8
|
-
|
|
9
|
-
---
|
|
10
|
-
|
|
11
|
-
## 项目概述
|
|
12
|
-
|
|
13
|
-
- **项目名称**:`my-openlayer`
|
|
14
|
-
- **用途**:基于 OpenLayers 的 TypeScript 地图组件库,提供点/线/面要素、底图切换、热力图、事件与配置管理等能力。
|
|
15
|
-
- **目标用户**:Web GIS 开发者、可视化工程师、前端开发者
|
|
16
|
-
|
|
17
|
-
## 功能亮点
|
|
18
|
-
|
|
19
|
-
- **🗺️ 底图管理 (MapBaseLayers)**
|
|
20
|
-
- 支持天地图矢量、影像、地形底图切换
|
|
21
|
-
- 动态切换底图与注记图层管理
|
|
22
|
-
- 地图裁剪与自定义范围显示
|
|
23
|
-
- 支持 GeoServer WMS 图层
|
|
24
|
-
|
|
25
|
-
- **📍 要素操作**
|
|
26
|
-
- **点位管理 (Point)**:点位标注(自定义图标、聚合、闪烁)
|
|
27
|
-
- **线要素绘制 (Line)**:线要素绘制(虚线、样式自定义)
|
|
28
|
-
- **面要素 (Polygon)**:面要素绘制、分区高亮、遮罩层
|
|
29
|
-
- **Vue组件支持 (VueTemplatePoint)**:支持将 Vue 组件作为地图点位渲染
|
|
30
|
-
- **河流图层 (RiverLayerManager)**:支持分级显示的河流图层管理
|
|
31
|
-
|
|
32
|
-
- **🛠️ 地图工具**
|
|
33
|
-
- **测量工具 (MeasureHandler)**:距离和面积测量
|
|
34
|
-
- **要素选择 (SelectHandler)**:支持点击、悬停、多选等交互选择
|
|
35
|
-
- **地图工具 (MapTools)**:图层管理、定位、视图自适应
|
|
36
|
-
- **事件管理 (EventManager)**:统一的地图事件监听与管理
|
|
37
|
-
|
|
38
|
-
- **⚡ 高级特性**
|
|
39
|
-
- **TypeScript 完全支持**:提供完整的类型定义
|
|
40
|
-
- **错误处理 (ErrorHandler)**:统一的错误捕获与日志
|
|
41
|
-
- **配置管理 (ConfigManager)**:集中管理默认配置
|
|
42
|
-
- **坐标系支持**:内置 CGCS2000 坐标系支持
|
|
43
|
-
|
|
44
|
-
## 安装
|
|
45
|
-
|
|
46
|
-
```bash
|
|
47
|
-
npm install my-openlayer
|
|
48
|
-
# 或
|
|
49
|
-
yarn add my-openlayer
|
|
50
|
-
# 或
|
|
51
|
-
pnpm add my-openlayer
|
|
52
|
-
```
|
|
53
|
-
|
|
54
|
-
### 依赖要求
|
|
55
|
-
|
|
56
|
-
- **Node.js**: >= 18
|
|
57
|
-
- **OpenLayers**: ^10.6.1
|
|
58
|
-
- **proj4**: ^2.7.5
|
|
59
|
-
- **@turf/turf**: ^7.2.0
|
|
60
|
-
|
|
61
|
-
## 快速上手
|
|
62
|
-
|
|
63
|
-
### 1. 初始化地图
|
|
64
|
-
|
|
65
|
-
```typescript
|
|
66
|
-
import MyOl, { MapInitType } from 'my-openlayer';
|
|
67
|
-
|
|
68
|
-
const mapConfig: MapInitType = {
|
|
69
|
-
center: [119.81, 29.969],
|
|
70
|
-
zoom: 10,
|
|
71
|
-
token: import.meta.env.VITE_TIANDITU_TOKEN, // 天地图 Token
|
|
72
|
-
annotation: true
|
|
73
|
-
};
|
|
74
|
-
|
|
75
|
-
const map = new MyOl('map-container', mapConfig);
|
|
76
|
-
```
|
|
77
|
-
|
|
78
|
-
### 2. 使用功能模块
|
|
79
|
-
|
|
80
|
-
```typescript
|
|
81
|
-
// 获取模块实例
|
|
82
|
-
const point = map.getPoint();
|
|
83
|
-
const line = map.getLine();
|
|
84
|
-
const polygon = map.getPolygon();
|
|
85
|
-
|
|
86
|
-
// 添加点位
|
|
87
|
-
point.addPoint([{ lgtd: 119.81, lttd: 29.969, name: '示例点' }], {
|
|
88
|
-
layerName: 'example-point',
|
|
89
|
-
img: 'marker.png'
|
|
90
|
-
});
|
|
91
|
-
```
|
|
92
|
-
|
|
93
|
-
## 文档索引
|
|
94
|
-
|
|
95
|
-
为了提供更详细的说明,我们将文档拆分为独立的模块文件:
|
|
96
|
-
|
|
97
|
-
### 核心类库
|
|
98
|
-
- **[MyOl](docs/MyOl.md)**: 地图入口类,负责初始化和模块访问。
|
|
99
|
-
- **[MapBaseLayers](docs/MapBaseLayers.md)**: 底图与注记管理。
|
|
100
|
-
- **[ConfigManager](docs/ConfigManager.md)**: 配置管理。
|
|
101
|
-
- **[EventManager](docs/EventManager.md)**: 事件管理。
|
|
102
|
-
- **[ErrorHandler](docs/ErrorHandler.md)**: 错误处理。
|
|
103
|
-
|
|
104
|
-
### 要素操作
|
|
105
|
-
- **[Point](docs/Point.md)**: 点要素(含聚合、DOM点位)。
|
|
106
|
-
- **[Line](docs/Line.md)**: 线要素。
|
|
107
|
-
- **[Polygon](docs/Polygon.md)**: 面要素(含热力图、图片层)。
|
|
108
|
-
- **[VueTemplatePoint](docs/VueTemplatePoint.md)**: Vue 组件点位。
|
|
109
|
-
- **[RiverLayerManager](docs/RiverLayerManager.md)**: 河流图层管理。
|
|
110
|
-
|
|
111
|
-
### 交互与工具
|
|
112
|
-
- **[SelectHandler](docs/SelectHandler.md)**: 要素选择交互(支持独立样式渲染、多选隔离)。
|
|
113
|
-
- **[MeasureHandler](docs/MeasureHandler.md)**: 测量工具。
|
|
114
|
-
- **[MapTools](docs/MapTools.md)**: 通用地图工具。
|
|
115
|
-
- **[ValidationUtils](docs/ValidationUtils.md)**: 验证工具。
|
|
116
|
-
|
|
117
|
-
## 详细用法示例
|
|
118
|
-
|
|
119
|
-
### 底图切换
|
|
120
|
-
|
|
121
|
-
```typescript
|
|
122
|
-
const baseLayers = map.getMapBaseLayers();
|
|
123
|
-
baseLayers.switchBaseLayer('img_c'); // 切换到影像底图
|
|
124
|
-
```
|
|
125
|
-
|
|
126
|
-
### 测量工具
|
|
127
|
-
|
|
128
|
-
```typescript
|
|
129
|
-
import { MeasureHandler } from 'my-openlayer';
|
|
130
|
-
|
|
131
|
-
// 需要传入原生的 OpenLayers map 实例
|
|
132
|
-
const measure = new MeasureHandler(map.map);
|
|
133
|
-
|
|
134
|
-
measure.start('LineString'); // 开始测距
|
|
135
|
-
measure.end(); // 结束测量
|
|
136
|
-
```
|
|
137
|
-
|
|
138
|
-
> 注意:部分高级功能(如 SelectHandler)可以通过 `map.getSelectHandler()` 访问。
|
|
139
|
-
|
|
140
|
-
## 贡献指南
|
|
141
|
-
|
|
142
|
-
欢迎提交 Issue 或 Pull Request!
|
|
143
|
-
|
|
144
|
-
1. Fork 本仓库
|
|
145
|
-
2. 新建分支:`git checkout -b feature/your-feature`
|
|
146
|
-
3. 提交更改:`git commit -m 'feat: 新功能描述'`
|
|
147
|
-
4. 推送分支:`git push origin feature/your-feature`
|
|
148
|
-
5. 提交 Pull Request
|
|
149
|
-
|
|
150
|
-
## 许可证
|
|
151
|
-
|
|
152
|
-
[MIT](LICENSE)
|
|
153
|
-
|
|
154
|
-
---
|
|
155
|
-
|
|
156
|
-
**联系方式**: 2364184627@qq.com | [GitHub Issues](https://github.com/cuteyuchen/my-openlayer/issues)
|
|
1
|
+
# my-openlayer
|
|
2
|
+
|
|
3
|
+
my-openlayer 是一个基于 [OpenLayers](https://openlayers.org/) 的现代地图组件库,专为 Web GIS 应用开发者设计。提供完整的 TypeScript 支持、模块化的类型定义、强大的错误处理和事件管理系统,支持天地图底图加载、要素绘制、图层管理、事件监听等丰富功能,极大提升地图开发效率。
|
|
4
|
+
|
|
5
|
+
[](https://www.npmjs.com/package/my-openlayer)
|
|
6
|
+
[](https://www.typescriptlang.org/)
|
|
7
|
+
[](https://opensource.org/licenses/MIT)
|
|
8
|
+
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
## 项目概述
|
|
12
|
+
|
|
13
|
+
- **项目名称**:`my-openlayer`
|
|
14
|
+
- **用途**:基于 OpenLayers 的 TypeScript 地图组件库,提供点/线/面要素、底图切换、热力图、事件与配置管理等能力。
|
|
15
|
+
- **目标用户**:Web GIS 开发者、可视化工程师、前端开发者
|
|
16
|
+
|
|
17
|
+
## 功能亮点
|
|
18
|
+
|
|
19
|
+
- **🗺️ 底图管理 (MapBaseLayers)**
|
|
20
|
+
- 支持天地图矢量、影像、地形底图切换
|
|
21
|
+
- 动态切换底图与注记图层管理
|
|
22
|
+
- 地图裁剪与自定义范围显示
|
|
23
|
+
- 支持 GeoServer WMS 图层
|
|
24
|
+
|
|
25
|
+
- **📍 要素操作**
|
|
26
|
+
- **点位管理 (Point)**:点位标注(自定义图标、聚合、闪烁)
|
|
27
|
+
- **线要素绘制 (Line)**:线要素绘制(虚线、样式自定义)
|
|
28
|
+
- **面要素 (Polygon)**:面要素绘制、分区高亮、遮罩层
|
|
29
|
+
- **Vue组件支持 (VueTemplatePoint)**:支持将 Vue 组件作为地图点位渲染
|
|
30
|
+
- **河流图层 (RiverLayerManager)**:支持分级显示的河流图层管理
|
|
31
|
+
|
|
32
|
+
- **🛠️ 地图工具**
|
|
33
|
+
- **测量工具 (MeasureHandler)**:距离和面积测量
|
|
34
|
+
- **要素选择 (SelectHandler)**:支持点击、悬停、多选等交互选择
|
|
35
|
+
- **地图工具 (MapTools)**:图层管理、定位、视图自适应
|
|
36
|
+
- **事件管理 (EventManager)**:统一的地图事件监听与管理
|
|
37
|
+
|
|
38
|
+
- **⚡ 高级特性**
|
|
39
|
+
- **TypeScript 完全支持**:提供完整的类型定义
|
|
40
|
+
- **错误处理 (ErrorHandler)**:统一的错误捕获与日志
|
|
41
|
+
- **配置管理 (ConfigManager)**:集中管理默认配置
|
|
42
|
+
- **坐标系支持**:内置 CGCS2000 坐标系支持
|
|
43
|
+
|
|
44
|
+
## 安装
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
npm install my-openlayer
|
|
48
|
+
# 或
|
|
49
|
+
yarn add my-openlayer
|
|
50
|
+
# 或
|
|
51
|
+
pnpm add my-openlayer
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
### 依赖要求
|
|
55
|
+
|
|
56
|
+
- **Node.js**: >= 18
|
|
57
|
+
- **OpenLayers**: ^10.6.1
|
|
58
|
+
- **proj4**: ^2.7.5
|
|
59
|
+
- **@turf/turf**: ^7.2.0
|
|
60
|
+
|
|
61
|
+
## 快速上手
|
|
62
|
+
|
|
63
|
+
### 1. 初始化地图
|
|
64
|
+
|
|
65
|
+
```typescript
|
|
66
|
+
import MyOl, { MapInitType } from 'my-openlayer';
|
|
67
|
+
|
|
68
|
+
const mapConfig: MapInitType = {
|
|
69
|
+
center: [119.81, 29.969],
|
|
70
|
+
zoom: 10,
|
|
71
|
+
token: import.meta.env.VITE_TIANDITU_TOKEN, // 天地图 Token
|
|
72
|
+
annotation: true
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
const map = new MyOl('map-container', mapConfig);
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
### 2. 使用功能模块
|
|
79
|
+
|
|
80
|
+
```typescript
|
|
81
|
+
// 获取模块实例
|
|
82
|
+
const point = map.getPoint();
|
|
83
|
+
const line = map.getLine();
|
|
84
|
+
const polygon = map.getPolygon();
|
|
85
|
+
|
|
86
|
+
// 添加点位
|
|
87
|
+
point.addPoint([{ lgtd: 119.81, lttd: 29.969, name: '示例点' }], {
|
|
88
|
+
layerName: 'example-point',
|
|
89
|
+
img: 'marker.png'
|
|
90
|
+
});
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
## 文档索引
|
|
94
|
+
|
|
95
|
+
为了提供更详细的说明,我们将文档拆分为独立的模块文件:
|
|
96
|
+
|
|
97
|
+
### 核心类库
|
|
98
|
+
- **[MyOl](docs/MyOl.md)**: 地图入口类,负责初始化和模块访问。
|
|
99
|
+
- **[MapBaseLayers](docs/MapBaseLayers.md)**: 底图与注记管理。
|
|
100
|
+
- **[ConfigManager](docs/ConfigManager.md)**: 配置管理。
|
|
101
|
+
- **[EventManager](docs/EventManager.md)**: 事件管理。
|
|
102
|
+
- **[ErrorHandler](docs/ErrorHandler.md)**: 错误处理。
|
|
103
|
+
|
|
104
|
+
### 要素操作
|
|
105
|
+
- **[Point](docs/Point.md)**: 点要素(含聚合、DOM点位)。
|
|
106
|
+
- **[Line](docs/Line.md)**: 线要素。
|
|
107
|
+
- **[Polygon](docs/Polygon.md)**: 面要素(含热力图、图片层)。
|
|
108
|
+
- **[VueTemplatePoint](docs/VueTemplatePoint.md)**: Vue 组件点位。
|
|
109
|
+
- **[RiverLayerManager](docs/RiverLayerManager.md)**: 河流图层管理。
|
|
110
|
+
|
|
111
|
+
### 交互与工具
|
|
112
|
+
- **[SelectHandler](docs/SelectHandler.md)**: 要素选择交互(支持独立样式渲染、多选隔离)。
|
|
113
|
+
- **[MeasureHandler](docs/MeasureHandler.md)**: 测量工具。
|
|
114
|
+
- **[MapTools](docs/MapTools.md)**: 通用地图工具。
|
|
115
|
+
- **[ValidationUtils](docs/ValidationUtils.md)**: 验证工具。
|
|
116
|
+
|
|
117
|
+
## 详细用法示例
|
|
118
|
+
|
|
119
|
+
### 底图切换
|
|
120
|
+
|
|
121
|
+
```typescript
|
|
122
|
+
const baseLayers = map.getMapBaseLayers();
|
|
123
|
+
baseLayers.switchBaseLayer('img_c'); // 切换到影像底图
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
### 测量工具
|
|
127
|
+
|
|
128
|
+
```typescript
|
|
129
|
+
import { MeasureHandler } from 'my-openlayer';
|
|
130
|
+
|
|
131
|
+
// 需要传入原生的 OpenLayers map 实例
|
|
132
|
+
const measure = new MeasureHandler(map.map);
|
|
133
|
+
|
|
134
|
+
measure.start('LineString'); // 开始测距
|
|
135
|
+
measure.end(); // 结束测量
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
> 注意:部分高级功能(如 SelectHandler)可以通过 `map.getSelectHandler()` 访问。
|
|
139
|
+
|
|
140
|
+
## 贡献指南
|
|
141
|
+
|
|
142
|
+
欢迎提交 Issue 或 Pull Request!
|
|
143
|
+
|
|
144
|
+
1. Fork 本仓库
|
|
145
|
+
2. 新建分支:`git checkout -b feature/your-feature`
|
|
146
|
+
3. 提交更改:`git commit -m 'feat: 新功能描述'`
|
|
147
|
+
4. 推送分支:`git push origin feature/your-feature`
|
|
148
|
+
5. 提交 Pull Request
|
|
149
|
+
|
|
150
|
+
## 许可证
|
|
151
|
+
|
|
152
|
+
[MIT](LICENSE)
|
|
153
|
+
|
|
154
|
+
---
|
|
155
|
+
|
|
156
|
+
**联系方式**: 2364184627@qq.com | [GitHub Issues](https://github.com/cuteyuchen/my-openlayer/issues)
|