my-openlayer 2.4.7 → 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 +208 -101
- package/MyOl.js +1 -1
- package/README.md +156 -156
- package/core/Point.js +21 -3
- package/docs/.vitepress/cache/deps/@theme_index.js +275 -0
- package/docs/.vitepress/cache/deps/@theme_index.js.map +7 -0
- package/docs/.vitepress/cache/deps/_metadata.json +40 -0
- package/docs/.vitepress/cache/deps/chunk-LW4I4DCF.js +12542 -0
- package/docs/.vitepress/cache/deps/chunk-LW4I4DCF.js.map +7 -0
- package/docs/.vitepress/cache/deps/chunk-Z5QSWKN2.js +9719 -0
- package/docs/.vitepress/cache/deps/chunk-Z5QSWKN2.js.map +7 -0
- package/docs/.vitepress/cache/deps/package.json +3 -0
- package/docs/.vitepress/cache/deps/vitepress___@vue_devtools-api.js +4505 -0
- package/docs/.vitepress/cache/deps/vitepress___@vue_devtools-api.js.map +7 -0
- package/docs/.vitepress/cache/deps/vitepress___@vueuse_core.js +583 -0
- package/docs/.vitepress/cache/deps/vitepress___@vueuse_core.js.map +7 -0
- package/docs/.vitepress/cache/deps/vue.js +343 -0
- package/docs/.vitepress/cache/deps/vue.js.map +7 -0
- package/docs/.vitepress/config.mts +57 -0
- package/docs/ConfigManager.md +71 -40
- package/docs/ErrorHandler.md +106 -45
- package/docs/EventManager.md +142 -52
- package/docs/Line.md +187 -52
- package/docs/MapBaseLayers.md +198 -48
- package/docs/MapTools.md +172 -48
- package/docs/MeasureHandler.md +87 -47
- package/docs/MyOl.md +247 -62
- package/docs/Point.md +165 -58
- package/docs/Polygon.md +241 -65
- package/docs/RiverLayerManager.md +187 -59
- package/docs/SelectHandler.md +147 -126
- package/docs/ValidationUtils.md +83 -38
- package/docs/VueTemplatePoint.md +214 -85
- package/docs/index.md +78 -0
- package/package.json +7 -4
- package/types.d.ts +2 -0
- package/AI_CONTEXT.md +0 -147
package/docs/Point.md
CHANGED
|
@@ -1,58 +1,165 @@
|
|
|
1
|
-
# Point
|
|
2
|
-
|
|
3
|
-
`Point`
|
|
4
|
-
|
|
5
|
-
##
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
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
|
+
```
|
package/docs/Polygon.md
CHANGED
|
@@ -1,65 +1,241 @@
|
|
|
1
|
-
# Polygon 面要素类
|
|
2
|
-
|
|
3
|
-
`Polygon`
|
|
4
|
-
|
|
5
|
-
##
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
- **
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
1
|
+
# Polygon 面要素类
|
|
2
|
+
|
|
3
|
+
`Polygon` 类用于在地图上绘制面要素、热力图、图片图层和遮罩层,支持丰富的数据可视化功能。
|
|
4
|
+
|
|
5
|
+
## 构造函数
|
|
6
|
+
|
|
7
|
+
```typescript
|
|
8
|
+
const polygon = new Polygon(map: Map);
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
- **map**: OpenLayers 地图实例。
|
|
12
|
+
|
|
13
|
+
## 接口定义
|
|
14
|
+
|
|
15
|
+
### PolygonOptions
|
|
16
|
+
|
|
17
|
+
面图层配置项,继承自 `BaseOptions`, `StyleOptions`, `TextOptions`。
|
|
18
|
+
|
|
19
|
+
| 属性 | 类型 | 说明 |
|
|
20
|
+
| :--- | :--- | :--- |
|
|
21
|
+
| **基础配置** | | |
|
|
22
|
+
| `layerName` | `string` | 图层名称 |
|
|
23
|
+
| `zIndex` | `number` | 图层层级 |
|
|
24
|
+
| `visible` | `boolean` | 是否可见 |
|
|
25
|
+
| `opacity` | `number` | 透明度 (0-1) |
|
|
26
|
+
| `fitView` | `boolean` | 是否自动缩放视图 |
|
|
27
|
+
| **样式配置** | | |
|
|
28
|
+
| `fillColor` | `string` | 填充颜色 |
|
|
29
|
+
| `fillColorCallBack` | `(feature) => string` | 动态填充颜色回调 |
|
|
30
|
+
| `strokeColor` | `string` | 边框颜色 |
|
|
31
|
+
| `strokeWidth` | `number` | 边框宽度 |
|
|
32
|
+
| `lineDash` | `number[]` | 边框虚线样式 |
|
|
33
|
+
| **文本标注** | | |
|
|
34
|
+
| `textVisible` | `boolean` | 是否显示文本 |
|
|
35
|
+
| `textKey` | `string` | 文本对应的属性字段名 |
|
|
36
|
+
| `textCallBack` | `(feature) => string` | 文本回调函数(优先级高于 textKey) |
|
|
37
|
+
| `textFont` | `string` | 字体样式 |
|
|
38
|
+
| `textFillColor` | `string` | 文本颜色 |
|
|
39
|
+
| `textStrokeColor` | `string` | 文本描边颜色 |
|
|
40
|
+
| **其他** | | |
|
|
41
|
+
| `mask` | `boolean` | 是否作为蒙版(配合 `setOutLayer` 使用) |
|
|
42
|
+
|
|
43
|
+
### HeatMapOptions
|
|
44
|
+
|
|
45
|
+
热力图配置项。
|
|
46
|
+
|
|
47
|
+
| 属性 | 类型 | 说明 |
|
|
48
|
+
| :--- | :--- | :--- |
|
|
49
|
+
| `layerName` | `string` | 图层名称 |
|
|
50
|
+
| `radius` | `number` | 热点半径,默认 8 |
|
|
51
|
+
| `blur` | `number` | 模糊度,默认 15 |
|
|
52
|
+
| `gradient` | `string[]` | 颜色渐变数组 |
|
|
53
|
+
| `opacity` | `number` | 透明度 |
|
|
54
|
+
| `valueKey` | `string` | 权重字段名,默认 'value' |
|
|
55
|
+
|
|
56
|
+
### ImageLayerData
|
|
57
|
+
|
|
58
|
+
图片图层数据。
|
|
59
|
+
|
|
60
|
+
| 属性 | 类型 | 说明 |
|
|
61
|
+
| :--- | :--- | :--- |
|
|
62
|
+
| `img` | `string` | 图片 URL |
|
|
63
|
+
| `extent` | `number[]` | 图片覆盖范围 `[minX, minY, maxX, maxY]` |
|
|
64
|
+
|
|
65
|
+
## 方法
|
|
66
|
+
|
|
67
|
+
### addPolygon
|
|
68
|
+
|
|
69
|
+
添加多边形图层。
|
|
70
|
+
|
|
71
|
+
```typescript
|
|
72
|
+
addPolygon(data: MapJSONData, options?: PolygonOptions): VectorLayer<VectorSource>
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
| 参数 | 类型 | 说明 |
|
|
76
|
+
| :--- | :--- | :--- |
|
|
77
|
+
| `data` | `MapJSONData` | GeoJSON 数据 |
|
|
78
|
+
| `options` | `PolygonOptions` | 配置项 |
|
|
79
|
+
|
|
80
|
+
### addPolygonByUrl
|
|
81
|
+
|
|
82
|
+
从 URL 加载多边形图层。
|
|
83
|
+
|
|
84
|
+
```typescript
|
|
85
|
+
addPolygonByUrl(url: string, options?: PolygonOptions): VectorLayer<VectorSource>
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
### addBorderPolygon
|
|
89
|
+
|
|
90
|
+
添加边界图层(通常用于行政区划边界,支持镂空效果)。
|
|
91
|
+
|
|
92
|
+
```typescript
|
|
93
|
+
addBorderPolygon(data: MapJSONData, options?: PolygonOptions): VectorLayer<VectorSource>
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
### updateFeatureColor
|
|
97
|
+
|
|
98
|
+
动态更新面要素颜色,常用于数据可视化展示。
|
|
99
|
+
|
|
100
|
+
```typescript
|
|
101
|
+
updateFeatureColor(
|
|
102
|
+
layerName: string,
|
|
103
|
+
colorObj?: { [propName: string]: string },
|
|
104
|
+
options?: FeatureColorUpdateOptions
|
|
105
|
+
): void
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
| 参数 | 类型 | 说明 |
|
|
109
|
+
| :--- | :--- | :--- |
|
|
110
|
+
| `layerName` | `string` | 目标图层名称 |
|
|
111
|
+
| `colorObj` | `Object` | 颜色映射对象 `{ '区域名': '颜色值' }` |
|
|
112
|
+
| `options` | `FeatureColorUpdateOptions` | 包含 textKey 等配置以匹配要素 |
|
|
113
|
+
|
|
114
|
+
### addImageLayer
|
|
115
|
+
|
|
116
|
+
添加静态图片图层(如叠加平面图、卫星图)。
|
|
117
|
+
|
|
118
|
+
```typescript
|
|
119
|
+
addImageLayer(imageData: ImageLayerData, options?: PolygonOptions): ImageLayer<any>
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
### addHeatmap
|
|
123
|
+
|
|
124
|
+
添加热力图。
|
|
125
|
+
|
|
126
|
+
```typescript
|
|
127
|
+
addHeatmap(pointData: PointData[], options?: HeatMapOptions): Heatmap
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
### setOutLayer
|
|
131
|
+
|
|
132
|
+
添加遮罩图层(反向裁剪,只高亮指定区域,遮挡外部)。
|
|
133
|
+
|
|
134
|
+
```typescript
|
|
135
|
+
setOutLayer(data: MapJSONData, options?: {
|
|
136
|
+
layerName?: string,
|
|
137
|
+
extent?: any,
|
|
138
|
+
fillColor?: string,
|
|
139
|
+
strokeWidth?: number,
|
|
140
|
+
strokeColor?: string,
|
|
141
|
+
zIndex?: number
|
|
142
|
+
}): VectorLayer<VectorSource>
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
## 使用示例
|
|
146
|
+
|
|
147
|
+
### 基础多边形
|
|
148
|
+
|
|
149
|
+
```typescript
|
|
150
|
+
const polygonModule = map.getPolygon();
|
|
151
|
+
|
|
152
|
+
// GeoJSON 数据
|
|
153
|
+
const polygonData = {
|
|
154
|
+
type: 'FeatureCollection',
|
|
155
|
+
features: [
|
|
156
|
+
{
|
|
157
|
+
type: 'Feature',
|
|
158
|
+
geometry: {
|
|
159
|
+
type: 'Polygon',
|
|
160
|
+
coordinates: [[[120, 30], [121, 30], [121, 31], [120, 31], [120, 30]]]
|
|
161
|
+
},
|
|
162
|
+
properties: { name: '区域A', value: 100 }
|
|
163
|
+
}
|
|
164
|
+
]
|
|
165
|
+
};
|
|
166
|
+
|
|
167
|
+
// 添加半透明蓝色填充、蓝色边框的多边形
|
|
168
|
+
polygonModule.addPolygon(polygonData, {
|
|
169
|
+
layerName: 'area-layer',
|
|
170
|
+
fillColor: 'rgba(0, 0, 255, 0.1)',
|
|
171
|
+
strokeColor: 'blue',
|
|
172
|
+
strokeWidth: 2,
|
|
173
|
+
textKey: 'name', // 显示名称
|
|
174
|
+
textFillColor: '#fff',
|
|
175
|
+
textStrokeColor: 'blue',
|
|
176
|
+
textStrokeWidth: 2,
|
|
177
|
+
fitView: true
|
|
178
|
+
});
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
### 数据可视化(动态填色)
|
|
182
|
+
|
|
183
|
+
```typescript
|
|
184
|
+
// 假设 'area-layer' 中的要素有 'name' 属性
|
|
185
|
+
// 我们将 '区域A' 设为红色,其他区域保持默认或设为其他颜色
|
|
186
|
+
polygonModule.updateFeatureColor(
|
|
187
|
+
'area-layer',
|
|
188
|
+
{
|
|
189
|
+
'区域A': 'rgba(255, 0, 0, 0.5)',
|
|
190
|
+
'区域B': 'rgba(0, 255, 0, 0.5)'
|
|
191
|
+
},
|
|
192
|
+
{
|
|
193
|
+
textKey: 'name', // 匹配 colorObj 的键
|
|
194
|
+
strokeColor: '#666', // 统一更新边框颜色
|
|
195
|
+
strokeWidth: 1
|
|
196
|
+
}
|
|
197
|
+
);
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
### 热力图
|
|
201
|
+
|
|
202
|
+
```typescript
|
|
203
|
+
const heatPoints = [
|
|
204
|
+
{ lgtd: 119.8, lttd: 29.9, value: 100 },
|
|
205
|
+
{ lgtd: 119.9, lttd: 30.0, value: 50 },
|
|
206
|
+
// ... 更多点
|
|
207
|
+
];
|
|
208
|
+
|
|
209
|
+
polygonModule.addHeatmap(heatPoints, {
|
|
210
|
+
layerName: 'heatmap-layer',
|
|
211
|
+
radius: 20, // 热点半径
|
|
212
|
+
blur: 15, // 边缘模糊
|
|
213
|
+
valueKey: 'value', // 权重字段
|
|
214
|
+
gradient: ['#00f', '#0ff', '#0f0', '#ff0', '#f00'] // 自定义渐变色
|
|
215
|
+
});
|
|
216
|
+
```
|
|
217
|
+
|
|
218
|
+
### 图片图层
|
|
219
|
+
|
|
220
|
+
```typescript
|
|
221
|
+
// 将图片叠加到指定经纬度范围
|
|
222
|
+
polygonModule.addImageLayer({
|
|
223
|
+
img: 'https://example.com/plan.png',
|
|
224
|
+
extent: [120.0, 30.0, 120.1, 30.1] // [minX, minY, maxX, maxY]
|
|
225
|
+
}, {
|
|
226
|
+
layerName: 'image-overlay',
|
|
227
|
+
opacity: 0.8
|
|
228
|
+
});
|
|
229
|
+
```
|
|
230
|
+
|
|
231
|
+
### 遮罩层(反向裁剪)
|
|
232
|
+
|
|
233
|
+
```typescript
|
|
234
|
+
// 添加遮罩,除了 polygonData 覆盖的区域外,其他区域都会被遮挡
|
|
235
|
+
polygonModule.setOutLayer(polygonData, {
|
|
236
|
+
layerName: 'mask-layer',
|
|
237
|
+
fillColor: 'rgba(0, 0, 0, 0.5)', // 黑色半透明遮罩
|
|
238
|
+
strokeColor: '#fff',
|
|
239
|
+
strokeWidth: 2
|
|
240
|
+
});
|
|
241
|
+
```
|