my-openlayer 2.4.10 → 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.
Files changed (119) hide show
  1. package/CHANGELOG.md +167 -265
  2. package/MyOl.d.ts +9 -9
  3. package/MyOl.js +17 -16
  4. package/README.md +217 -156
  5. package/core/line/Line.d.ts +40 -0
  6. package/core/line/Line.js +144 -0
  7. package/core/line/LineFeatureFactory.d.ts +17 -0
  8. package/core/line/LineFeatureFactory.js +75 -0
  9. package/core/line/LineFlowAnimator.d.ts +53 -0
  10. package/core/line/LineFlowAnimator.js +297 -0
  11. package/core/line/LineStyleFactory.d.ts +43 -0
  12. package/core/line/LineStyleFactory.js +135 -0
  13. package/core/{RiverLayerManager.d.ts → line/RiverLayerManager.d.ts} +2 -2
  14. package/core/{RiverLayerManager.js → line/RiverLayerManager.js} +3 -5
  15. package/core/line/index.d.ts +6 -0
  16. package/core/line/index.js +5 -0
  17. package/core/{ConfigManager.d.ts → map/ConfigManager.d.ts} +25 -1
  18. package/core/{ConfigManager.js → map/ConfigManager.js} +22 -1
  19. package/core/{EventManager.d.ts → map/EventManager.d.ts} +1 -1
  20. package/core/{EventManager.js → map/EventManager.js} +2 -2
  21. package/core/{MapBaseLayers.d.ts → map/MapBaseLayers.d.ts} +1 -1
  22. package/core/{MapBaseLayers.js → map/MapBaseLayers.js} +10 -12
  23. package/core/{MapTools.d.ts → map/MapTools.d.ts} +5 -2
  24. package/core/{MapTools.js → map/MapTools.js} +11 -5
  25. package/core/{MeasureHandler.d.ts → map/MeasureHandler.d.ts} +1 -1
  26. package/core/{MeasureHandler.js → map/MeasureHandler.js} +41 -41
  27. package/core/map/index.d.ts +5 -0
  28. package/core/map/index.js +5 -0
  29. package/core/{Point.d.ts → point/Point.d.ts} +13 -4
  30. package/core/{Point.js → point/Point.js} +24 -112
  31. package/core/point/PointClusterLayer.d.ts +10 -0
  32. package/core/point/PointClusterLayer.js +52 -0
  33. package/core/point/PointOverlay.d.ts +13 -0
  34. package/core/point/PointOverlay.js +57 -0
  35. package/core/point/PointPulseLayer.d.ts +13 -0
  36. package/core/point/PointPulseLayer.js +207 -0
  37. package/core/point/index.d.ts +4 -0
  38. package/core/point/index.js +4 -0
  39. package/core/{Polygon.d.ts → polygon/Polygon.d.ts} +4 -50
  40. package/core/polygon/Polygon.js +248 -0
  41. package/core/polygon/PolygonHeatmapLayer.d.ts +11 -0
  42. package/core/polygon/PolygonHeatmapLayer.js +40 -0
  43. package/core/polygon/PolygonImageLayer.d.ts +9 -0
  44. package/core/polygon/PolygonImageLayer.js +61 -0
  45. package/core/polygon/PolygonMaskLayer.d.ts +20 -0
  46. package/core/polygon/PolygonMaskLayer.js +107 -0
  47. package/core/polygon/PolygonStyleFactory.d.ts +12 -0
  48. package/core/polygon/PolygonStyleFactory.js +100 -0
  49. package/core/polygon/index.d.ts +5 -0
  50. package/core/polygon/index.js +5 -0
  51. package/core/{SelectHandler.d.ts → select/SelectHandler.d.ts} +2 -3
  52. package/core/{SelectHandler.js → select/SelectHandler.js} +4 -4
  53. package/core/select/index.d.ts +1 -0
  54. package/core/select/index.js +1 -0
  55. package/core/{VueTemplatePoint.d.ts → vue-template-point/VueTemplatePoint.d.ts} +1 -1
  56. package/core/{VueTemplatePoint.js → vue-template-point/VueTemplatePoint.js} +4 -4
  57. package/core/vue-template-point/index.d.ts +1 -0
  58. package/core/vue-template-point/index.js +1 -0
  59. package/docs/.vitepress/config.mts +57 -57
  60. package/docs/ConfigManager.md +71 -71
  61. package/docs/ErrorHandler.md +106 -106
  62. package/docs/EventManager.md +142 -142
  63. package/docs/Line.md +215 -187
  64. package/docs/MapBaseLayers.md +198 -198
  65. package/docs/MapTools.md +172 -172
  66. package/docs/MeasureHandler.md +87 -87
  67. package/docs/MyOl.md +247 -247
  68. package/docs/Point.md +233 -165
  69. package/docs/Polygon.md +241 -241
  70. package/docs/RiverLayerManager.md +187 -187
  71. package/docs/SelectHandler.md +147 -147
  72. package/docs/ValidationUtils.md +83 -83
  73. package/docs/VueTemplatePoint.md +214 -214
  74. package/docs/index.md +79 -78
  75. package/index.d.ts +11 -16
  76. package/index.js +7 -13
  77. package/package.json +11 -1
  78. package/types/base.d.ts +47 -0
  79. package/types/base.js +1 -0
  80. package/types/common.d.ts +59 -0
  81. package/types/common.js +1 -0
  82. package/types/index.d.ts +9 -0
  83. package/types/index.js +1 -0
  84. package/types/line.d.ts +41 -0
  85. package/types/line.js +1 -0
  86. package/types/map.d.ts +77 -0
  87. package/types/map.js +1 -0
  88. package/types/point.d.ts +54 -0
  89. package/types/point.js +1 -0
  90. package/types/polygon.d.ts +8 -0
  91. package/types/polygon.js +1 -0
  92. package/types/select.d.ts +25 -0
  93. package/types/select.js +1 -0
  94. package/types/vue-template-point.d.ts +54 -0
  95. package/{types.js → types/vue-template-point.js} +0 -3
  96. package/utils/ProjectionUtils.d.ts +28 -0
  97. package/utils/ProjectionUtils.js +34 -0
  98. package/utils/ValidationUtils.d.ts +33 -86
  99. package/utils/ValidationUtils.js +60 -165
  100. package/core/DomPoint.d.ts +0 -21
  101. package/core/DomPoint.js +0 -36
  102. package/core/Line.d.ts +0 -49
  103. package/core/Line.js +0 -114
  104. package/core/Polygon.js +0 -646
  105. package/docs/.vitepress/cache/deps/@theme_index.js +0 -275
  106. package/docs/.vitepress/cache/deps/@theme_index.js.map +0 -7
  107. package/docs/.vitepress/cache/deps/_metadata.json +0 -40
  108. package/docs/.vitepress/cache/deps/chunk-LW4I4DCF.js +0 -12542
  109. package/docs/.vitepress/cache/deps/chunk-LW4I4DCF.js.map +0 -7
  110. package/docs/.vitepress/cache/deps/chunk-Z5QSWKN2.js +0 -9719
  111. package/docs/.vitepress/cache/deps/chunk-Z5QSWKN2.js.map +0 -7
  112. package/docs/.vitepress/cache/deps/package.json +0 -3
  113. package/docs/.vitepress/cache/deps/vitepress___@vue_devtools-api.js +0 -4505
  114. package/docs/.vitepress/cache/deps/vitepress___@vue_devtools-api.js.map +0 -7
  115. package/docs/.vitepress/cache/deps/vitepress___@vueuse_core.js +0 -583
  116. package/docs/.vitepress/cache/deps/vitepress___@vueuse_core.js.map +0 -7
  117. package/docs/.vitepress/cache/deps/vue.js +0 -343
  118. package/docs/.vitepress/cache/deps/vue.js.map +0 -7
  119. package/types.d.ts +0 -372
@@ -0,0 +1,54 @@
1
+ export interface VueInstance {
2
+ mount(element: Element | string): VueInstance;
3
+ unmount?(): void;
4
+ $destroy?(): void;
5
+ [key: string]: any;
6
+ }
7
+ export interface VueApp {
8
+ mount(element: Element | string): VueInstance;
9
+ unmount(): void;
10
+ [key: string]: any;
11
+ }
12
+ export interface VueLegacyInstance {
13
+ $mount(element?: Element | string): VueLegacyInstance;
14
+ $destroy(): void;
15
+ [key: string]: any;
16
+ }
17
+ export declare enum VueTemplatePointState {
18
+ CREATED = "created",
19
+ MOUNTED = "mounted",
20
+ VISIBLE = "visible",
21
+ HIDDEN = "hidden",
22
+ DESTROYED = "destroyed"
23
+ }
24
+ export interface VueTemplatePointOptions {
25
+ Template: any;
26
+ lgtd: number;
27
+ lttd: number;
28
+ props?: any;
29
+ styleType?: 'default' | 'custom';
30
+ positioning?: 'bottom-left' | 'bottom-center' | 'bottom-right' | 'center-left' | 'center-center' | 'center-right' | 'top-left' | 'top-center' | 'top-right';
31
+ stopEvent?: boolean;
32
+ visible?: boolean;
33
+ className?: string;
34
+ zIndex?: number;
35
+ }
36
+ export interface VueTemplatePointInstance {
37
+ id: string;
38
+ dom: HTMLElement;
39
+ anchor: any;
40
+ app: VueApp | VueLegacyInstance | null;
41
+ state: VueTemplatePointState;
42
+ position: number[];
43
+ options: VueTemplatePointOptions;
44
+ setVisible(visible: boolean): void;
45
+ updatePosition(lgtd: number, lttd: number): void;
46
+ updateProps(newProps: Record<string, any>): void;
47
+ setStyle(styles: Partial<CSSStyleDeclaration>): void;
48
+ addClass(className: string): void;
49
+ removeClass(className: string): void;
50
+ remove(): void;
51
+ getState(): VueTemplatePointState;
52
+ getOptions(): Readonly<VueTemplatePointOptions>;
53
+ isDestroyed(): boolean;
54
+ }
@@ -1,6 +1,3 @@
1
- /**
2
- * DOM点位状态枚举
3
- */
4
1
  export var VueTemplatePointState;
5
2
  (function (VueTemplatePointState) {
6
3
  VueTemplatePointState["CREATED"] = "created";
@@ -0,0 +1,28 @@
1
+ /**
2
+ * 可携带投影参数的配置对象。
3
+ */
4
+ export interface ProjectionOptionLike {
5
+ dataProjection?: string;
6
+ featureProjection?: string;
7
+ /**
8
+ * @deprecated 新项目请使用 dataProjection / featureProjection。
9
+ */
10
+ projectionOptOptions?: {
11
+ dataProjection?: string;
12
+ featureProjection?: string;
13
+ [key: string]: unknown;
14
+ };
15
+ }
16
+ /**
17
+ * 投影处理工具,统一显式字段与旧 projectionOptOptions 的兼容逻辑。
18
+ */
19
+ export default class ProjectionUtils {
20
+ /**
21
+ * 生成 GeoJSON 读取投影参数。显式字段优先于旧 projectionOptOptions。
22
+ */
23
+ static getGeoJSONReadOptions(options?: ProjectionOptionLike): Record<string, unknown>;
24
+ /**
25
+ * 将输入坐标转换到目标要素投影。未传目标投影时保持原坐标。
26
+ */
27
+ static transformCoordinate(coordinate: number[], options?: ProjectionOptionLike): number[];
28
+ }
@@ -0,0 +1,34 @@
1
+ import { transform } from 'ol/proj';
2
+ /**
3
+ * 投影处理工具,统一显式字段与旧 projectionOptOptions 的兼容逻辑。
4
+ */
5
+ export default class ProjectionUtils {
6
+ /**
7
+ * 生成 GeoJSON 读取投影参数。显式字段优先于旧 projectionOptOptions。
8
+ */
9
+ static getGeoJSONReadOptions(options) {
10
+ const legacyOptions = options?.projectionOptOptions ?? {};
11
+ const readOptions = { ...legacyOptions };
12
+ if (options?.dataProjection) {
13
+ readOptions.dataProjection = options.dataProjection;
14
+ }
15
+ if (options?.featureProjection) {
16
+ readOptions.featureProjection = options.featureProjection;
17
+ }
18
+ return readOptions;
19
+ }
20
+ /**
21
+ * 将输入坐标转换到目标要素投影。未传目标投影时保持原坐标。
22
+ */
23
+ static transformCoordinate(coordinate, options) {
24
+ const featureProjection = options?.featureProjection ?? options?.projectionOptOptions?.featureProjection;
25
+ if (!featureProjection) {
26
+ return coordinate;
27
+ }
28
+ const dataProjection = options?.dataProjection ?? options?.projectionOptOptions?.dataProjection ?? 'EPSG:4326';
29
+ if (dataProjection === featureProjection) {
30
+ return coordinate;
31
+ }
32
+ return transform(coordinate, dataProjection, featureProjection);
33
+ }
34
+ }
@@ -1,159 +1,106 @@
1
- export declare class ValidationUtils {
1
+ /**
2
+ * 验证工具类
3
+ * 统一管理参数校验逻辑,错误记录由调用方或 ErrorHandler 负责。
4
+ */
5
+ export default class ValidationUtils {
2
6
  /**
3
- * 验证坐标是否有效
4
- * @param longitude 经度
5
- * @param latitude 纬度
6
- * @returns 是否有效
7
+ * 判断值是否为有效数字。
8
+ */
9
+ private static isFiniteNumber;
10
+ /**
11
+ * 验证坐标是否有效。
7
12
  */
8
13
  static isValidCoordinate(longitude: number, latitude: number): boolean;
9
14
  /**
10
- * 验证经纬度坐标(简化版本)
11
- * @param lgtd 经度
12
- * @param lttd 纬度
13
- * @returns 是否有效
15
+ * 验证经纬度坐标,保留布尔返回以兼容旧调用。
14
16
  */
15
17
  static validateLngLat(lgtd: number, lttd: number): boolean;
16
18
  /**
17
- * 验证点数据数组
18
- * @param pointData 点数据数组
19
- * @returns 是否有效
19
+ * 验证点数据数组,保留布尔返回以兼容旧调用。
20
20
  */
21
21
  static validatePointData(pointData: any[]): boolean;
22
22
  /**
23
- * 验证单个点的坐标
24
- * @param item 包含坐标的数据项
25
- * @returns 是否有效
23
+ * 验证单个点的坐标,保留布尔返回以兼容旧调用。
26
24
  */
27
25
  static validateCoordinates(item: any): boolean;
28
26
  /**
29
- * 验证颜色字符串是否有效
30
- * @param color 颜色字符串
31
- * @returns 是否有效
27
+ * 验证颜色字符串是否有效。
32
28
  */
33
29
  static isValidColor(color: string): boolean;
34
30
  /**
35
- * 验证图层名称是否有效
36
- * @param layerName 图层名称
37
- * @returns 是否有效
31
+ * 验证图层名称是否有效。
38
32
  */
39
33
  static isValidLayerName(layerName: string): boolean;
40
34
  /**
41
- * 验证范围是否有效
42
- * @param extent 范围数组 [minX, minY, maxX, maxY]
43
- * @returns 是否有效
35
+ * 验证范围是否有效。
44
36
  */
45
37
  static isValidExtent(extent: number[]): boolean;
46
38
  /**
47
- * 验证GeoJSON数据
48
- * @param data GeoJSON数据
49
- * @returns 是否有效
39
+ * 验证 GeoJSON 数据,保留布尔返回以兼容旧调用。
50
40
  */
51
41
  static validateGeoJSONData(data: any): boolean;
52
42
  /**
53
- * 验证配置选项
54
- * @param options 配置选项
55
- * @returns 是否有效
43
+ * 验证配置选项,保留布尔返回以兼容旧调用。
56
44
  */
57
45
  static validateOptions(options: any): boolean;
58
46
  /**
59
- * 验证数值范围
60
- * @param value 数值
61
- * @param min 最小值
62
- * @param max 最大值
63
- * @returns 是否有效
47
+ * 验证数值范围。
64
48
  */
65
49
  static validateNumberRange(value: number, min: number, max: number): boolean;
66
50
  /**
67
- * 验证DOM元素ID
68
- * @param id 元素ID
69
- * @returns 是否有效
51
+ * 验证 DOM 元素 ID,保留布尔返回以兼容旧调用。
70
52
  */
71
53
  static validateElementId(id: string): boolean;
72
54
  /**
73
- * 验证Vue相关参数
74
- * @param pointInfoList 点位信息列表
75
- * @param template Vue组件模板
76
- * @param Vue Vue实例
77
- * @returns 是否有效
55
+ * 验证 Vue 相关参数,保留布尔返回以兼容旧调用。
78
56
  */
79
57
  static validateVueParams(pointInfoList: any[], template: any, Vue: any): boolean;
80
58
  /**
81
- * 验证图层名称(抛出异常版本)
82
- * @param layerName 图层名称
83
- * @throws 如果图层名称无效则抛出异常
59
+ * 验证图层名称(抛出异常版本)。
84
60
  */
85
61
  static validateLayerName(layerName: string): void;
86
62
  /**
87
- * 验证图像数据
88
- * @param imageData 图像数据
89
- * @param allowEmptyImg 是否允许img为空
90
- * @throws 如果图像数据无效则抛出异常
63
+ * 验证图像数据。
91
64
  */
92
65
  static validateImageData(imageData: any, allowEmptyImg?: boolean): void;
93
66
  /**
94
- * 验证遮罩数据
95
- * @param data 遮罩数据
96
- * @throws 如果遮罩数据无效则抛出异常
67
+ * 验证遮罩数据。
97
68
  */
98
69
  static validateMaskData(data: any): void;
99
70
  /**
100
- * 验证地图实例
101
- * @param map 地图实例
102
- * @throws 如果地图实例无效则抛出异常
71
+ * 验证地图实例。
103
72
  */
104
73
  static validateMapInstance(map: any): void;
105
74
  /**
106
- * 验证必需参数
107
- * @param value 要验证的值
108
- * @param message 错误消息
109
- * @throws 如果值为空则抛出异常
75
+ * 验证必需参数。
110
76
  */
111
77
  static validateRequired(value: any, message: string): void;
112
78
  /**
113
- * 验证坐标(抛出异常版本)
114
- * @param longitude 经度
115
- * @param latitude 纬度
116
- * @throws 如果坐标无效则抛出异常
79
+ * 验证坐标(抛出异常版本)。
117
80
  */
118
81
  static validateCoordinate(longitude: number, latitude: number): void;
119
82
  /**
120
- * 验证类型
121
- * @param value 要验证的值
122
- * @param expectedType 期望的类型
123
- * @param message 错误消息
124
- * @throws 如果类型不匹配则抛出异常
83
+ * 验证类型。
125
84
  */
126
85
  static validateType(value: any, expectedType: string, message: string): void;
127
86
  /**
128
- * 验证非空字符串(抛出异常版本)
129
- * @param str 字符串
130
- * @param message 错误消息
131
- * @throws 如果字符串为空则抛出异常
87
+ * 验证非空字符串。
132
88
  */
133
89
  static validateNonEmptyString(str: string, message: string): void;
134
90
  /**
135
- * 验证地图实例(通用版本)
136
- * @param map 地图实例
137
- * @throws 如果地图实例无效则抛出异常
91
+ * 验证地图实例(通用版本)。
138
92
  */
139
93
  static validateMap(map: any): void;
140
94
  /**
141
- * 验证测量类型
142
- * @param type 测量类型
143
- * @throws 如果测量类型无效则抛出异常
95
+ * 验证测量类型。
144
96
  */
145
97
  static validateMeasureType(type: string): void;
146
98
  /**
147
- * 验证正数
148
- * @param value 数值
149
- * @param message 错误消息
150
- * @throws 如果数值不是正数则抛出异常
99
+ * 验证正数。
151
100
  */
152
101
  static validatePositiveNumber(value: number, message: string): void;
153
102
  /**
154
- * 验证图层名称参数
155
- * @param layerName 图层名称(字符串或字符串数组)
156
- * @throws 如果图层名称参数无效则抛出异常
103
+ * 验证图层名称参数。
157
104
  */
158
105
  static validateLayerNameParam(layerName: string | string[]): void;
159
106
  }