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
package/docs/index.md CHANGED
@@ -1,78 +1,79 @@
1
- # My OpenLayers
2
-
3
- My OpenLayers 是一个基于 OpenLayers 的轻量级地图封装库,旨在简化地图开发流程,提供开箱即用的常用功能。它集成了点、线、面绘制,测量工具,选择交互,Vue 组件覆盖物等功能,特别优化了 Vue 项目的集成体验。
4
-
5
- ## 特性
6
-
7
- - **开箱即用**: 封装了常用的地图功能,减少样板代码。
8
- - **Vue 集成**: 支持使用 Vue 组件作为地图覆盖物,轻松创建复杂的交互式标记。
9
- - **TypeScript**: 完全使用 TypeScript 编写,提供完整的类型定义。
10
- - **工具丰富**: 内置测量、选择、裁剪、遮罩等实用工具。
11
- - **扩展性强**: 提供基础类和接口,方便二次封装和扩展。
12
-
13
- ## 安装
14
-
15
- ```bash
16
- npm install my-openlayer
17
- # 或者
18
- yarn add my-openlayer
19
- # 或者
20
- pnpm add my-openlayer
21
- ```
22
-
23
- ## 快速开始
24
-
25
- ```typescript
26
- import { MyOl } from 'my-openlayer';
27
- import 'ol/ol.css'; // 引入 OpenLayers 样式
28
-
29
- // 初始化地图
30
- const map = new MyOl('map-container', {
31
- center: [120.2, 30.3],
32
- zoom: 12,
33
- projection: 'EPSG:4326'
34
- });
35
-
36
- // 获取原生 Map 实例
37
- const olMap = map.map;
38
-
39
- // 添加一个点
40
- const point = map.getPoint();
41
- point.addPoint([{
42
- lgtd: 120.2,
43
- lttd: 30.3,
44
- style: {
45
- icon: 'path/to/icon.png'
46
- }
47
- }]);
48
- ```
49
-
50
- ## 核心模块
51
-
52
- - **[MyOl](./MyOl.md)**: 核心入口类,负责地图初始化和模块管理。
53
- - **[Point](./Point.md)**: 点位管理,支持图标、文本、聚合等。
54
- - **[Line](./Line.md)**: 线条绘制,支持不同样式和动画。
55
- - **[Polygon](./Polygon.md)**: 多边形绘制,支持遮罩、热力图等。
56
- - **[VueTemplatePoint](./VueTemplatePoint.md)**: 使用 Vue 组件作为地图点位覆盖物。
57
-
58
- ## 工具模块
59
-
60
- - **[MapTools](./MapTools.md)**: 通用地图工具,如裁剪、定位、导出图片等。
61
- - **[MeasureHandler](./MeasureHandler.md)**: 距离和面积测量工具。
62
- - **[SelectHandler](./SelectHandler.md)**: 要素选择交互工具。
63
- - **[MapBaseLayers](./MapBaseLayers.md)**: 底图切换和管理。
64
-
65
- ## 基础设施
66
-
67
- - **[ConfigManager](./ConfigManager.md)**: 全局配置管理。
68
- - **[EventManager](./EventManager.md)**: 统一事件管理系统。
69
- - **[ErrorHandler](./ErrorHandler.md)**: 错误处理和日志系统。
70
- - **[ValidationUtils](./ValidationUtils.md)**: 参数验证工具。
71
-
72
- ## 贡献
73
-
74
- 欢迎提交 Issue 和 Pull Request!
75
-
76
- ## 许可证
77
-
78
- MIT License
1
+ # My OpenLayers
2
+
3
+ My OpenLayers 是一个基于 OpenLayers 的轻量级地图封装库,旨在简化地图开发流程,提供开箱即用的常用功能。它集成了点、线、面绘制,测量工具,选择交互,Vue 组件覆盖物等功能,特别优化了 Vue 项目的集成体验。
4
+
5
+ ## 特性
6
+
7
+ - **开箱即用**: 封装了常用的地图功能,减少样板代码。
8
+ - **Vue 集成**: 支持使用 Vue 组件作为地图覆盖物,轻松创建复杂的交互式标记。
9
+ - **TypeScript**: 完全使用 TypeScript 编写,提供完整的类型定义。
10
+ - **工具丰富**: 内置测量、选择、裁剪、遮罩等实用工具。
11
+ - **高性能闪烁点**: 基于 `VectorLayer` 和单个 `requestAnimationFrame` 渲染大量预警点位,避免 DOM 动画卡顿。
12
+ - **扩展性强**: 提供基础类和接口,方便二次封装和扩展。
13
+
14
+ ## 安装
15
+
16
+ ```bash
17
+ npm install my-openlayer
18
+ # 或者
19
+ yarn add my-openlayer
20
+ # 或者
21
+ pnpm add my-openlayer
22
+ ```
23
+
24
+ ## 快速开始
25
+
26
+ ```typescript
27
+ import { MyOl } from 'my-openlayer';
28
+ import 'ol/ol.css'; // 引入 OpenLayers 样式
29
+
30
+ // 初始化地图
31
+ const map = new MyOl('map-container', {
32
+ center: [120.2, 30.3],
33
+ zoom: 12,
34
+ projection: 'EPSG:4326'
35
+ });
36
+
37
+ // 获取原生 Map 实例
38
+ const olMap = map.map;
39
+
40
+ // 添加一个点
41
+ const point = map.getPoint();
42
+ point.addPoint([{
43
+ lgtd: 120.2,
44
+ lttd: 30.3,
45
+ style: {
46
+ icon: 'path/to/icon.png'
47
+ }
48
+ }]);
49
+ ```
50
+
51
+ ## 核心模块
52
+
53
+ - **[MyOl](./MyOl.md)**: 核心入口类,负责地图初始化和模块管理。
54
+ - **[Point](./Point.md)**: 点位管理,支持图标、文本、聚合、高性能闪烁点等。
55
+ - **[Line](./Line.md)**: 线条绘制,支持不同样式和动画。
56
+ - **[Polygon](./Polygon.md)**: 多边形绘制,支持遮罩、热力图等。
57
+ - **[VueTemplatePoint](./VueTemplatePoint.md)**: 使用 Vue 组件作为地图点位覆盖物。
58
+
59
+ ## 工具模块
60
+
61
+ - **[MapTools](./MapTools.md)**: 通用地图工具,如裁剪、定位、导出图片等。
62
+ - **[MeasureHandler](./MeasureHandler.md)**: 距离和面积测量工具。
63
+ - **[SelectHandler](./SelectHandler.md)**: 要素选择交互工具。
64
+ - **[MapBaseLayers](./MapBaseLayers.md)**: 底图切换和管理。
65
+
66
+ ## 基础设施
67
+
68
+ - **[ConfigManager](./ConfigManager.md)**: 全局配置管理。
69
+ - **[EventManager](./EventManager.md)**: 统一事件管理系统。
70
+ - **[ErrorHandler](./ErrorHandler.md)**: 错误处理和日志系统。
71
+ - **[ValidationUtils](./ValidationUtils.md)**: 参数验证工具。
72
+
73
+ ## 贡献
74
+
75
+ 欢迎提交 Issue 和 Pull Request!
76
+
77
+ ## 许可证
78
+
79
+ MIT License
package/index.d.ts CHANGED
@@ -1,21 +1,16 @@
1
1
  export { default } from './MyOl';
2
2
  export { default as MyOl } from './MyOl';
3
- export { default as Point } from './core/Point';
4
- export { default as Line } from './core/Line';
5
- export { default as Polygon } from './core/Polygon';
6
- export { default as MapBaseLayers } from './core/MapBaseLayers';
7
- export { default as MapTools } from './core/MapTools';
8
- export { default as MeasureHandler } from './core/MeasureHandler';
9
- export { default as VueTemplatePoint } from './core/VueTemplatePoint';
10
- export { default as SelectHandler } from './core/SelectHandler';
11
- export { default as RiverLayerManager } from './core/RiverLayerManager';
12
- export type { RiverLayerOptions, RiverLevelWidthMap } from './core/RiverLayerManager';
13
- export { ConfigManager } from './core/ConfigManager';
14
- export { EventManager } from './core/EventManager';
15
- export type { MapEventType, EventCallback, MapEventData } from './core/EventManager';
3
+ export { Point } from './core/point';
4
+ export { Line, RiverLayerManager } from './core/line';
5
+ export type { RiverLayerOptions, RiverLevelWidthMap } from './core/line';
6
+ export { Polygon } from './core/polygon';
7
+ export { MapBaseLayers, MapTools, MeasureHandler, ConfigManager, EventManager } from './core/map';
8
+ export { VueTemplatePoint } from './core/vue-template-point';
9
+ export { SelectHandler } from './core/select';
10
+ export type { MapEventType, EventCallback, MapEventData } from './core/map/EventManager';
16
11
  export { ErrorHandler, MyOpenLayersError, ErrorType } from './utils/ErrorHandler';
17
- export { ValidationUtils } from './utils/ValidationUtils';
12
+ export { default as ValidationUtils } from './utils/ValidationUtils';
18
13
  export type { BaseOptions, StyleOptions, TextOptions } from './types';
19
- export type { PointOptions, LineOptions, PolygonOptions } from './types';
14
+ export type { PointOptions, LineOptions, FlowLineOptions, FlowLineLayerHandle, PolygonOptions, PulsePointOptions, PulsePointLayerHandle } from './types';
20
15
  export type { OptionsType } from './types';
21
- export type { MapInitType, MapLayersOptions, HeatMapOptions, ImageLayerData, MaskLayerOptions, FeatureColorUpdateOptions, PointData, LineData, ClusterOptions, MeasureHandlerType, VueTemplatePointOptions, MapJSONData, FeatureData, AnnotationType, TiandituType, MapLayers, AnnotationLayerOptions, SelectOptions, SelectMode, SelectCallbackEvent, ProgrammaticSelectOptions } from './types';
16
+ export type { MapInitType, MapLayersOptions, HeatMapOptions, ImageLayerData, MaskLayerOptions, FeatureColorUpdateOptions, PointData, PulsePointIconOptions, LineData, ClusterOptions, MeasureHandlerType, VueTemplatePointOptions, MapJSONData, FeatureData, AnnotationType, TiandituType, MapLayers, AnnotationLayerOptions, SelectOptions, SelectMode, SelectCallbackEvent, ProgrammaticSelectOptions } from './types';
package/index.js CHANGED
@@ -1,19 +1,13 @@
1
1
  // 导出核心类 - 默认导出
2
2
  export { default } from './MyOl';
3
3
  export { default as MyOl } from './MyOl';
4
- export { default as Point } from './core/Point';
5
- export { default as Line } from './core/Line';
6
- export { default as Polygon } from './core/Polygon';
7
- export { default as MapBaseLayers } from './core/MapBaseLayers';
8
- export { default as MapTools } from './core/MapTools';
9
- export { default as MeasureHandler } from './core/MeasureHandler';
10
- export { default as VueTemplatePoint } from './core/VueTemplatePoint';
11
- export { default as SelectHandler } from './core/SelectHandler';
12
- export { default as RiverLayerManager } from './core/RiverLayerManager';
13
- // 新增工具类
14
- export { ConfigManager } from './core/ConfigManager';
15
- export { EventManager } from './core/EventManager';
4
+ export { Point } from './core/point';
5
+ export { Line, RiverLayerManager } from './core/line';
6
+ export { Polygon } from './core/polygon';
7
+ export { MapBaseLayers, MapTools, MeasureHandler, ConfigManager, EventManager } from './core/map';
8
+ export { VueTemplatePoint } from './core/vue-template-point';
9
+ export { SelectHandler } from './core/select';
16
10
  // 错误处理
17
11
  export { ErrorHandler, MyOpenLayersError, ErrorType } from './utils/ErrorHandler';
18
12
  // 验证工具
19
- export { ValidationUtils } from './utils/ValidationUtils';
13
+ export { default as ValidationUtils } from './utils/ValidationUtils';
package/package.json CHANGED
@@ -1,11 +1,17 @@
1
1
  {
2
2
  "name": "my-openlayer",
3
3
  "private": false,
4
- "version": "2.4.10",
4
+ "version": "2.5.1",
5
5
  "type": "module",
6
6
  "license": "MIT",
7
7
  "main": "index.js",
8
8
  "types": "index.d.ts",
9
+ "exports": {
10
+ ".": {
11
+ "types": "./index.d.ts",
12
+ "import": "./index.js"
13
+ }
14
+ },
9
15
  "keywords": [
10
16
  "openlayers",
11
17
  "ol",
@@ -32,6 +38,9 @@
32
38
  "scripts": {
33
39
  "dev": "vite",
34
40
  "build": "tsc",
41
+ "typecheck": "vue-tsc --noEmit",
42
+ "test": "vitest",
43
+ "test:run": "vitest run",
35
44
  "preview": "vite preview",
36
45
  "prepare-publish": "node scripts/prepare-publish.cjs",
37
46
  "publish-flat": "npm run build && npm run prepare-publish && cd temp-publish && npm publish",
@@ -50,6 +59,7 @@
50
59
  "@vitejs/plugin-vue": "^5.0.4",
51
60
  "typescript": "~5.6.2",
52
61
  "vite": "^5.4.10",
62
+ "vitest": "^2.1.9",
53
63
  "vite-plugin-css-modules": "^0.0.1",
54
64
  "vite-plugin-libcss": "^1.1.1",
55
65
  "vitepress": "^1.6.4",
@@ -0,0 +1,47 @@
1
+ import Feature, { FeatureLike } from "ol/Feature";
2
+ import { Style } from "ol/style";
3
+ import type { MapJSONData } from "./common";
4
+ /**
5
+ * 基础选项接口 - 所有图层的公共配置。
6
+ */
7
+ export interface BaseOptions {
8
+ layerName?: string;
9
+ zIndex?: number;
10
+ visible?: boolean;
11
+ opacity?: number;
12
+ fitView?: boolean;
13
+ mapClip?: boolean;
14
+ mapClipData?: MapJSONData;
15
+ dataProjection?: string;
16
+ featureProjection?: string;
17
+ /**
18
+ * @deprecated 新项目请使用 dataProjection / featureProjection。
19
+ */
20
+ projectionOptOptions?: any;
21
+ style?: Style | Style[] | ((feature: FeatureLike) => Style | Style[]);
22
+ }
23
+ /**
24
+ * 图形样式相关配置。
25
+ */
26
+ export interface StyleOptions {
27
+ strokeColor?: string | number[];
28
+ strokeWidth?: number;
29
+ lineDash?: number[];
30
+ lineDashOffset?: number;
31
+ fillColor?: string;
32
+ fillColorCallBack?: (feature: Feature) => string;
33
+ withDefaultStroke?: boolean;
34
+ withDefaultFill?: boolean;
35
+ }
36
+ /**
37
+ * 文本标注相关配置。
38
+ */
39
+ export interface TextOptions {
40
+ textVisible?: boolean;
41
+ textCallBack?: (feature: Feature) => string;
42
+ textFont?: string;
43
+ textFillColor?: string;
44
+ textStrokeColor?: string;
45
+ textStrokeWidth?: number;
46
+ textOffsetY?: number;
47
+ }
package/types/base.js ADDED
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,59 @@
1
+ /**
2
+ * 通用 GeoJSON 数据结构定义。
3
+ */
4
+ export interface FeatureData {
5
+ type: string;
6
+ properties: any;
7
+ geometry: {
8
+ type: "Polygon" | "MultiPolygon" | "Point" | "LineString" | "MultiLineString" | "MultiPoint" | "GeometryCollection";
9
+ coordinates: any[];
10
+ };
11
+ }
12
+ /**
13
+ * 通用 GeoJSON 集合结构。
14
+ */
15
+ export interface MapJSONData {
16
+ type: string;
17
+ name?: string;
18
+ features: FeatureData[];
19
+ }
20
+ export type MeasureHandlerType = 'LineString' | 'Polygon';
21
+ export type EventType = 'click' | 'hover' | 'moveend';
22
+ /**
23
+ * 兼容性类型别名 - 保持向后兼容。
24
+ * @deprecated 请使用具体的选项接口:PointOptions, LineOptions, PolygonOptions
25
+ */
26
+ export type OptionsType = {
27
+ layerName?: string;
28
+ zIndex?: number;
29
+ visible?: boolean;
30
+ opacity?: number;
31
+ fitView?: boolean;
32
+ mapClip?: boolean;
33
+ mapClipData?: MapJSONData;
34
+ dataProjection?: string;
35
+ featureProjection?: string;
36
+ projectionOptOptions?: any;
37
+ style?: any;
38
+ strokeColor?: string | number[];
39
+ strokeWidth?: number;
40
+ lineDash?: number[];
41
+ lineDashOffset?: number;
42
+ fillColor?: string;
43
+ fillColorCallBack?: (feature: any) => string;
44
+ withDefaultStroke?: boolean;
45
+ withDefaultFill?: boolean;
46
+ textVisible?: boolean;
47
+ textCallBack?: (feature: any) => string;
48
+ textFont?: string;
49
+ textFillColor?: string;
50
+ textStrokeColor?: string;
51
+ textStrokeWidth?: number;
52
+ textOffsetY?: number;
53
+ textKey?: string;
54
+ img?: string;
55
+ scale?: number;
56
+ iconColor?: string;
57
+ type?: string;
58
+ mask?: boolean;
59
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,9 @@
1
+ export type { BaseOptions, StyleOptions, TextOptions } from './base';
2
+ export type { FeatureData, MapJSONData, OptionsType, MeasureHandlerType, EventType } from './common';
3
+ export type { MapInitType, MapLayersOptions, MapLayers, AnnotationType, TiandituType, AnnotationLayerOptions, HeatMapOptions, ImageLayerData, MaskLayerOptions } from './map';
4
+ export type { PointOptions, PointData, ClusterOptions, PulsePointIconOptions, PulsePointOptions, PulsePointLayerHandle, TwinkleItem } from './point';
5
+ export type { LineOptions, LineData, FlowLineOptions, FlowLineLayerHandle } from './line';
6
+ export type { PolygonOptions, FeatureColorUpdateOptions } from './polygon';
7
+ export type { SelectOptions, SelectMode, SelectCallbackEvent, ProgrammaticSelectOptions } from './select';
8
+ export type { VueInstance, VueApp, VueLegacyInstance, VueTemplatePointOptions, VueTemplatePointInstance } from './vue-template-point';
9
+ export { VueTemplatePointState } from './vue-template-point';
package/types/index.js ADDED
@@ -0,0 +1 @@
1
+ export { VueTemplatePointState } from './vue-template-point';
@@ -0,0 +1,41 @@
1
+ import VectorLayer from "ol/layer/Vector";
2
+ import VectorSource from "ol/source/Vector";
3
+ import type { BaseOptions, StyleOptions, TextOptions } from "./base";
4
+ import type { MapJSONData } from "./common";
5
+ export interface LineOptions extends BaseOptions, StyleOptions, TextOptions {
6
+ type?: string;
7
+ }
8
+ export interface LineData {
9
+ type: string;
10
+ coordinates: number[][];
11
+ [key: string]: any;
12
+ }
13
+ export interface FlowLineOptions extends LineOptions {
14
+ loop?: boolean;
15
+ autoStart?: boolean;
16
+ duration?: number;
17
+ speed?: number;
18
+ showBaseLine?: boolean;
19
+ animationMode?: 'icon' | 'dash' | 'icon+dash';
20
+ flowSymbol?: {
21
+ src?: string;
22
+ scale?: number;
23
+ color?: string;
24
+ rotateWithView?: boolean;
25
+ count?: number;
26
+ spacing?: number;
27
+ };
28
+ trailEnabled?: boolean;
29
+ trailLength?: number;
30
+ }
31
+ export interface FlowLineLayerHandle {
32
+ layer: VectorLayer<VectorSource>;
33
+ animationLayer: VectorLayer<VectorSource>;
34
+ start: () => void;
35
+ pause: () => void;
36
+ resume: () => void;
37
+ stop: () => void;
38
+ setVisible: (visible: boolean) => void;
39
+ updateData: (data: MapJSONData) => void;
40
+ remove: () => void;
41
+ }
package/types/line.js ADDED
@@ -0,0 +1 @@
1
+ export {};
package/types/map.d.ts ADDED
@@ -0,0 +1,77 @@
1
+ import BaseLayer from "ol/layer/Base";
2
+ import TileLayer from "ol/layer/Tile";
3
+ import { WMTS } from "ol/source";
4
+ import View from "ol/View";
5
+ import { Units } from "ol/proj/Units";
6
+ import type { MapJSONData } from "./common";
7
+ type LayerItem = BaseLayer | TileLayer<WMTS>;
8
+ export interface MapInitType {
9
+ layers?: LayerItem[] | {
10
+ [key: string]: LayerItem[];
11
+ };
12
+ zoom?: number;
13
+ center?: number[];
14
+ view?: View;
15
+ minZoom?: number;
16
+ maxZoom?: number;
17
+ extent?: number[];
18
+ mapClipData?: MapJSONData;
19
+ token?: string;
20
+ annotation?: boolean;
21
+ enableLog?: boolean;
22
+ logLevel?: 'debug' | 'info' | 'warn' | 'error';
23
+ projection?: {
24
+ code: string;
25
+ def?: string;
26
+ extent?: number[];
27
+ worldExtent?: number[];
28
+ units?: Units;
29
+ };
30
+ }
31
+ export type AnnotationType = 'cva_c' | 'cia_c' | 'cta_c';
32
+ export type TiandituType = 'vec_c' | 'img_c' | 'ter_c';
33
+ export interface MapLayers {
34
+ vec_c?: BaseLayer[];
35
+ img_c?: BaseLayer[];
36
+ ter_c?: BaseLayer[];
37
+ [key: string]: BaseLayer[] | undefined;
38
+ }
39
+ export interface MapLayersOptions {
40
+ layers?: BaseLayer[] | MapLayers;
41
+ zIndex?: number;
42
+ mapClip?: boolean;
43
+ mapClipData?: MapJSONData;
44
+ token?: string;
45
+ annotation?: boolean;
46
+ }
47
+ export interface AnnotationLayerOptions {
48
+ type: AnnotationType;
49
+ token: string;
50
+ zIndex?: number;
51
+ visible?: boolean;
52
+ }
53
+ export interface HeatMapOptions {
54
+ layerName?: string;
55
+ radius?: number;
56
+ blur?: number;
57
+ gradient?: string[];
58
+ opacity?: number;
59
+ visible?: boolean;
60
+ zIndex?: number;
61
+ valueKey?: string;
62
+ }
63
+ export interface ImageLayerData {
64
+ img?: string;
65
+ extent?: number[];
66
+ }
67
+ export interface MaskLayerOptions {
68
+ extent?: any;
69
+ fillColor?: string;
70
+ strokeWidth?: number;
71
+ strokeColor?: string;
72
+ zIndex?: number;
73
+ opacity?: number;
74
+ visible?: boolean;
75
+ layerName?: string;
76
+ }
77
+ export {};
package/types/map.js ADDED
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,54 @@
1
+ import VectorLayer from "ol/layer/Vector";
2
+ import VectorSource from "ol/source/Vector";
3
+ import type { BaseOptions, StyleOptions, TextOptions } from "./base";
4
+ export interface PointOptions extends BaseOptions, StyleOptions, TextOptions {
5
+ textKey?: string;
6
+ img?: string;
7
+ scale?: number;
8
+ iconColor?: string;
9
+ }
10
+ export interface PointData {
11
+ lgtd: number;
12
+ lttd: number;
13
+ [key: string]: any;
14
+ }
15
+ export interface ClusterOptions extends PointOptions {
16
+ distance?: number;
17
+ minDistance?: number;
18
+ }
19
+ export interface PulsePointIconOptions {
20
+ src?: string;
21
+ scale?: number;
22
+ color?: string;
23
+ radius?: number;
24
+ fillColor?: string;
25
+ strokeColor?: string;
26
+ strokeWidth?: number;
27
+ }
28
+ export interface PulsePointOptions extends PointOptions {
29
+ levelKey?: string;
30
+ icon?: PulsePointIconOptions;
31
+ pulse?: {
32
+ enabled?: boolean;
33
+ duration?: number;
34
+ radius?: [number, number];
35
+ colorMap?: Record<string | number, string>;
36
+ strokeColorMap?: Record<string | number, string>;
37
+ strokeWidth?: number;
38
+ frameCount?: number;
39
+ };
40
+ }
41
+ export interface PulsePointLayerHandle {
42
+ layer: VectorLayer<VectorSource>;
43
+ source: VectorSource;
44
+ start: () => void;
45
+ stop: () => void;
46
+ setVisible: (visible: boolean) => void;
47
+ updateData: (data: PointData[]) => void;
48
+ remove: () => void;
49
+ }
50
+ export interface TwinkleItem extends PointData {
51
+ className?: string;
52
+ element?: HTMLElement | ((item: TwinkleItem) => HTMLElement);
53
+ [key: string]: any;
54
+ }
package/types/point.js ADDED
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,8 @@
1
+ import type { BaseOptions, StyleOptions, TextOptions } from "./base";
2
+ export interface PolygonOptions extends BaseOptions, StyleOptions, TextOptions {
3
+ textKey?: string;
4
+ mask?: boolean;
5
+ }
6
+ export interface FeatureColorUpdateOptions extends BaseOptions, StyleOptions, TextOptions {
7
+ textKey?: string;
8
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,25 @@
1
+ import type { FeatureLike } from "ol/Feature";
2
+ import MapBrowserEvent from "ol/MapBrowserEvent";
3
+ import { Style } from "ol/style";
4
+ export type SelectMode = 'click' | 'hover' | 'ctrl';
5
+ export interface SelectCallbackEvent {
6
+ selected: FeatureLike[];
7
+ deselected: FeatureLike[];
8
+ mapBrowserEvent: MapBrowserEvent<any>;
9
+ }
10
+ export interface SelectOptions {
11
+ multi?: boolean;
12
+ layerFilter?: string[];
13
+ featureFilter?: (feature: FeatureLike) => boolean;
14
+ hitTolerance?: number;
15
+ selectStyle?: Style | Style[] | ((feature: FeatureLike) => Style | Style[]);
16
+ onSelect?: (event: SelectCallbackEvent) => void;
17
+ onDeselect?: (event: SelectCallbackEvent) => void;
18
+ }
19
+ export interface ProgrammaticSelectOptions {
20
+ layerName?: string;
21
+ selectStyle?: Style | Style[] | ((feature: FeatureLike) => Style | Style[]);
22
+ fitView?: boolean;
23
+ fitDuration?: number;
24
+ fitPadding?: number;
25
+ }
@@ -0,0 +1 @@
1
+ export {};