gdmap-utils 1.2.3 → 1.2.5
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/.husky/pre-commit +1 -1
- package/.prettierrc.json +17 -17
- package/README.md +467 -2
- package/dist/index.js +127 -7
- package/dist/index.js.map +1 -1
- package/docs/classes/MapUtils.md +153 -0
- package/docs/functions/createMapUtils.md +18 -0
- package/docs/functions/initMapSource.md +14 -0
- package/docs/globals.md +11 -0
- package/examples/1_init.html +23 -23
- package/examples/2_mapInit.html +48 -48
- package/examples/3_MarkerLayer.html +565 -565
- package/examples/4_LabelMarkerLayer.html +574 -574
- package/examples/5_markerCluster.html +528 -0
- package/index.html +134 -134
- package/package.json +54 -51
- package/scripts/cleanDocs.js +220 -0
- package/scripts/mergeDocs.js +129 -0
- package/src/LayerManager.ts +17 -1
- package/src/MapSourceImport.ts +23 -23
- package/src/MapUtils.ts +198 -22
- package/src/gdMap/gdHelper.ts +113 -85
- package/src/index.ts +3 -1
- package/src/layers/baseMarkerLayer/LabelMarkerLayer.ts +240 -240
- package/src/layers/baseMarkerLayer/MarkerLayer.ts +208 -208
- package/src/layers/baseMarkerLayer/index.ts +369 -354
- package/src/layers/clusterMarkerLayer/MarkerClusterLayer.ts +53 -53
- package/src/layers/clusterMarkerLayer/index.ts +204 -177
- package/src/layers/index.ts +9 -9
- package/src/types/MapUtils.d.ts +53 -53
- package/src/types/amap.d.ts +11 -11
- package/src/types/{BaseMarkerLayer.d.ts → baseMarkerLayer.d.ts} +86 -87
- package/src/types/clusterMarkerLayer.d.ts +89 -88
- package/src/types/index.d.ts +14 -14
- package/tsconfig.json +26 -26
- package/typedoc.json +22 -0
- package/webpack.config.js +125 -126
- package/src/gdMap/gdHelper.js +0 -194
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
[**GdMapUtils**](../README.md)
|
|
2
|
+
***
|
|
3
|
+
|
|
4
|
+
[GdMapUtils](../globals.md) / MapUtils
|
|
5
|
+
|
|
6
|
+
## Constructors
|
|
7
|
+
|
|
8
|
+
### Constructor
|
|
9
|
+
|
|
10
|
+
> **new MapUtils**(`opts`, `AMap`): `MapUtils`
|
|
11
|
+
***
|
|
12
|
+
|
|
13
|
+
### options
|
|
14
|
+
|
|
15
|
+
> **options**: `object`
|
|
16
|
+
***
|
|
17
|
+
|
|
18
|
+
### LayerManager
|
|
19
|
+
|
|
20
|
+
> **LayerManager**: `LayerManager`
|
|
21
|
+
***
|
|
22
|
+
|
|
23
|
+
### createAMapMarker()
|
|
24
|
+
|
|
25
|
+
> `static` **createAMapMarker**: (`options`) => `Marker` = `MapMixin.createAMapMarker`
|
|
26
|
+
|
|
27
|
+
创建高德地图标注
|
|
28
|
+
***
|
|
29
|
+
|
|
30
|
+
### createIcon()
|
|
31
|
+
|
|
32
|
+
> `static` **createIcon**: (`opts`) => `Icon` = `MapMixin.createIcon`
|
|
33
|
+
|
|
34
|
+
创建一个图标
|
|
35
|
+
***
|
|
36
|
+
|
|
37
|
+
### Size()
|
|
38
|
+
|
|
39
|
+
> `static` **Size**: (`width`, `height`) => `Size` = `MapMixin.Size`
|
|
40
|
+
|
|
41
|
+
地物对象的像素尺寸
|
|
42
|
+
***
|
|
43
|
+
|
|
44
|
+
### Pixel()
|
|
45
|
+
|
|
46
|
+
> `static` **Pixel**: (...`rest`) => `Pixel` = `MapMixin.Pixel`
|
|
47
|
+
|
|
48
|
+
像素坐标,确定地图上的一个像素点
|
|
49
|
+
***
|
|
50
|
+
|
|
51
|
+
### LngLat()
|
|
52
|
+
|
|
53
|
+
> `static` **LngLat**: (`lng`, `lat`, `noWrap?`) => `LngLat` = `MapMixin.LngLat`
|
|
54
|
+
|
|
55
|
+
经纬度坐标,用来描述地图上的一个点位置
|
|
56
|
+
***
|
|
57
|
+
|
|
58
|
+
### createAMapInfoWindow()
|
|
59
|
+
|
|
60
|
+
> `static` **createAMapInfoWindow**: (`opts`) => `InfoWindow` = `MapMixin.createAMapInfoWindow`
|
|
61
|
+
***
|
|
62
|
+
|
|
63
|
+
### createAMapPolyline()
|
|
64
|
+
|
|
65
|
+
> `static` **createAMapPolyline**: (`options`) => `Polyline` = `MapMixin.createAMapPolyline`
|
|
66
|
+
|
|
67
|
+
创建高德地图折线
|
|
68
|
+
***
|
|
69
|
+
|
|
70
|
+
### loadPlugins()
|
|
71
|
+
|
|
72
|
+
> `static` **loadPlugins**: (`plugins`) => `Promise`\<`unknown`\> = `MapMixin.loadPlugins`
|
|
73
|
+
***
|
|
74
|
+
|
|
75
|
+
### initMap()
|
|
76
|
+
|
|
77
|
+
> **initMap**(`id`, `opts`): `Map_2`
|
|
78
|
+
***
|
|
79
|
+
|
|
80
|
+
### createBaseMarkerLayer()
|
|
81
|
+
|
|
82
|
+
> **createBaseMarkerLayer**\<`U`, `T`\>(`opts`): `BaseMarkerLayer`\<`U`, `T`, `BaseMarkerLayerInfo`\[`T`\]\>
|
|
83
|
+
***
|
|
84
|
+
|
|
85
|
+
### createClusterMarkerLayer()
|
|
86
|
+
|
|
87
|
+
> **createClusterMarkerLayer**\<`U`, `T`\>(`opts`): `ClusterMarkerLayer`\<`U`, `T`, `ClusterMarkerLayerInfo`\[`T`\]\>
|
|
88
|
+
|
|
89
|
+
创建聚合标记图层
|
|
90
|
+
***
|
|
91
|
+
|
|
92
|
+
### removeLayer()
|
|
93
|
+
|
|
94
|
+
> **removeLayer**(`layer`): `void`
|
|
95
|
+
|
|
96
|
+
`removeLayer`接收图层实例将其从mapUtils的关联中移除
|
|
97
|
+
***
|
|
98
|
+
|
|
99
|
+
### setFitView()
|
|
100
|
+
|
|
101
|
+
> **setFitView**(opts: Parameters<mapIns['setFitView']>): `void`
|
|
102
|
+
|
|
103
|
+
根据地图上添加的覆盖物分布情况,自动缩放地图到合适的视野级别
|
|
104
|
+
***
|
|
105
|
+
|
|
106
|
+
### clearInfoWindow()
|
|
107
|
+
|
|
108
|
+
> **clearInfoWindow**(): `void`
|
|
109
|
+
|
|
110
|
+
地图弹窗关闭
|
|
111
|
+
***
|
|
112
|
+
|
|
113
|
+
### seZoomAndCenter()
|
|
114
|
+
|
|
115
|
+
> **seZoomAndCenter**(opts: { zoom: number; center: AMap.LngLat | [number, number]; immediately?: boolean; duration?: number }): `void`
|
|
116
|
+
|
|
117
|
+
将地图视图切换到指定状态
|
|
118
|
+
***
|
|
119
|
+
|
|
120
|
+
### showLayer()
|
|
121
|
+
|
|
122
|
+
> **showLayer**(opts: Parameters<mapIns['setFitView']>): `void`
|
|
123
|
+
|
|
124
|
+
地图指定图层显示, `layerName`为创建图层所传递的参数,用于标识图层名称。
|
|
125
|
+
***
|
|
126
|
+
|
|
127
|
+
### hideLayer()
|
|
128
|
+
|
|
129
|
+
> **hideLayer**(`layerName`): `void`
|
|
130
|
+
|
|
131
|
+
地图指定图层隐藏, `layerName`为创建图层所传递的参数,用于标识图层名称。
|
|
132
|
+
***
|
|
133
|
+
|
|
134
|
+
### showAllLayers()
|
|
135
|
+
|
|
136
|
+
> **showAllLayers**(): `void`
|
|
137
|
+
|
|
138
|
+
地图显示所有图层
|
|
139
|
+
***
|
|
140
|
+
|
|
141
|
+
### hideAllLayers()
|
|
142
|
+
|
|
143
|
+
> **hideAllLayers**(): `void`
|
|
144
|
+
|
|
145
|
+
地图隐藏所有图层
|
|
146
|
+
***
|
|
147
|
+
|
|
148
|
+
### reloadLayers()
|
|
149
|
+
|
|
150
|
+
> **reloadLayers**(): `void`
|
|
151
|
+
|
|
152
|
+
地图重新渲染所有图层
|
|
153
|
+
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
[**GdMapUtils**](../README.md)
|
|
2
|
+
***
|
|
3
|
+
|
|
4
|
+
[GdMapUtils](../globals.md) / createMapUtils
|
|
5
|
+
|
|
6
|
+
> **createMapUtils**(`opts`, `loaderOPts?`): `Promise`\<[`MapUtils`](../classes/MapUtils.md)\>
|
|
7
|
+
|
|
8
|
+
## Parameters
|
|
9
|
+
|
|
10
|
+
### opts
|
|
11
|
+
|
|
12
|
+
`MapUtilsUseExistingOpts` | `MapUtilsCreateOpts`
|
|
13
|
+
|
|
14
|
+
### loaderOPts?
|
|
15
|
+
|
|
16
|
+
## Returns
|
|
17
|
+
|
|
18
|
+
`Promise`\<[`MapUtils`](../classes/MapUtils.md)\>
|
package/docs/globals.md
ADDED
package/examples/1_init.html
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
<!doctype html>
|
|
2
|
-
<html lang="en">
|
|
3
|
-
<head>
|
|
4
|
-
<meta charset="UTF-8" />
|
|
5
|
-
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
6
|
-
<title>Document</title>
|
|
7
|
-
</head>
|
|
8
|
-
<body>
|
|
9
|
-
<script src="../dist/index.js"></script>
|
|
10
|
-
<script>
|
|
11
|
-
const { initMapSource } =
|
|
12
|
-
|
|
13
|
-
const loaderOpts = {
|
|
14
|
-
version: '2.0', // 指定要加载的 JSAPI 的版本,缺省时默认为 1.4.15
|
|
15
|
-
plugins: ['AMap.MapType', 'AMap.MoveAnimation'], // 需要使用的的插件列表,如比例尺'AMap.Scale'等
|
|
16
|
-
key: '9506c73ed67acb0a09f1aabf88df4819',
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
initMapSource(loaderOpts)
|
|
20
|
-
|
|
21
|
-
</script>
|
|
22
|
-
</body>
|
|
23
|
-
</html>
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8" />
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
6
|
+
<title>Document</title>
|
|
7
|
+
</head>
|
|
8
|
+
<body>
|
|
9
|
+
<script src="../dist/index.js"></script>
|
|
10
|
+
<script>
|
|
11
|
+
const { initMapSource } = GdMapUtils;
|
|
12
|
+
|
|
13
|
+
const loaderOpts = {
|
|
14
|
+
version: '2.0', // 指定要加载的 JSAPI 的版本,缺省时默认为 1.4.15
|
|
15
|
+
plugins: ['AMap.MapType', 'AMap.MoveAnimation'], // 需要使用的的插件列表,如比例尺'AMap.Scale'等
|
|
16
|
+
key: '9506c73ed67acb0a09f1aabf88df4819',
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
initMapSource(loaderOpts)
|
|
20
|
+
|
|
21
|
+
</script>
|
|
22
|
+
</body>
|
|
23
|
+
</html>
|
package/examples/2_mapInit.html
CHANGED
|
@@ -1,48 +1,48 @@
|
|
|
1
|
-
<!doctype html>
|
|
2
|
-
<html>
|
|
3
|
-
<head>
|
|
4
|
-
<meta charset="utf-8" />
|
|
5
|
-
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
|
6
|
-
<meta
|
|
7
|
-
name="viewport"
|
|
8
|
-
content="initial-scale=1.0, user-scalable=no, width=device-width"
|
|
9
|
-
/>
|
|
10
|
-
<link
|
|
11
|
-
rel="stylesheet"
|
|
12
|
-
href="https://a.amap.com/jsapi_demos/static/demo-center/css/demo-center.css"
|
|
13
|
-
/>
|
|
14
|
-
<title>地图显示</title>
|
|
15
|
-
<style>
|
|
16
|
-
html,
|
|
17
|
-
body,
|
|
18
|
-
#container {
|
|
19
|
-
width: 100%;
|
|
20
|
-
height: 100%;
|
|
21
|
-
}
|
|
22
|
-
</style>
|
|
23
|
-
</head>
|
|
24
|
-
<body>
|
|
25
|
-
<div id="container"></div>
|
|
26
|
-
<!-- 加载地图JSAPI脚本 -->
|
|
27
|
-
<script src="../dist/index.js"></script>
|
|
28
|
-
<script>
|
|
29
|
-
const { createMapUtils } =
|
|
30
|
-
|
|
31
|
-
const loaderOpts = {
|
|
32
|
-
version: '2.0', // 指定要加载的 JSAPI 的版本,缺省时默认为 1.4.15
|
|
33
|
-
plugins: ['AMap.MapType', 'AMap.MoveAnimation'], // 需要使用的的插件列表,如比例尺'AMap.Scale'等
|
|
34
|
-
key: '9506c73ed67acb0a09f1aabf88df4819',
|
|
35
|
-
};
|
|
36
|
-
|
|
37
|
-
createMapUtils(
|
|
38
|
-
{
|
|
39
|
-
viewMode: '2D', // 默认使用 2D 模式,如果希望使用带有俯仰角的 3D 模式,请设置 viewMode: '3D'
|
|
40
|
-
zoom: 11, // 初始化地图层级
|
|
41
|
-
center: [116.397428, 39.90923], // 初始化地图中心点
|
|
42
|
-
mountSelector: 'container',
|
|
43
|
-
},
|
|
44
|
-
loaderOpts
|
|
45
|
-
);
|
|
46
|
-
</script>
|
|
47
|
-
</body>
|
|
48
|
-
</html>
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html>
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8" />
|
|
5
|
+
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
|
6
|
+
<meta
|
|
7
|
+
name="viewport"
|
|
8
|
+
content="initial-scale=1.0, user-scalable=no, width=device-width"
|
|
9
|
+
/>
|
|
10
|
+
<link
|
|
11
|
+
rel="stylesheet"
|
|
12
|
+
href="https://a.amap.com/jsapi_demos/static/demo-center/css/demo-center.css"
|
|
13
|
+
/>
|
|
14
|
+
<title>地图显示</title>
|
|
15
|
+
<style>
|
|
16
|
+
html,
|
|
17
|
+
body,
|
|
18
|
+
#container {
|
|
19
|
+
width: 100%;
|
|
20
|
+
height: 100%;
|
|
21
|
+
}
|
|
22
|
+
</style>
|
|
23
|
+
</head>
|
|
24
|
+
<body>
|
|
25
|
+
<div id="container"></div>
|
|
26
|
+
<!-- 加载地图JSAPI脚本 -->
|
|
27
|
+
<script src="../dist/index.js"></script>
|
|
28
|
+
<script>
|
|
29
|
+
const { createMapUtils } = GdMapUtils;
|
|
30
|
+
|
|
31
|
+
const loaderOpts = {
|
|
32
|
+
version: '2.0', // 指定要加载的 JSAPI 的版本,缺省时默认为 1.4.15
|
|
33
|
+
plugins: ['AMap.MapType', 'AMap.MoveAnimation'], // 需要使用的的插件列表,如比例尺'AMap.Scale'等
|
|
34
|
+
key: '9506c73ed67acb0a09f1aabf88df4819',
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
createMapUtils(
|
|
38
|
+
{
|
|
39
|
+
viewMode: '2D', // 默认使用 2D 模式,如果希望使用带有俯仰角的 3D 模式,请设置 viewMode: '3D'
|
|
40
|
+
zoom: 11, // 初始化地图层级
|
|
41
|
+
center: [116.397428, 39.90923], // 初始化地图中心点
|
|
42
|
+
mountSelector: 'container',
|
|
43
|
+
},
|
|
44
|
+
loaderOpts
|
|
45
|
+
);
|
|
46
|
+
</script>
|
|
47
|
+
</body>
|
|
48
|
+
</html>
|