map_view_vue2 0.0.2 → 0.0.3
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/README.md +24 -34
- package/index.d.ts +2 -2
- package/map_view_vue2.common.js +370 -300
- package/map_view_vue2.common.js.map +1 -1
- package/map_view_vue2.css +1 -1
- package/map_view_vue2.umd.js +370 -300
- package/map_view_vue2.umd.js.map +1 -1
- package/map_view_vue2.umd.min.js +1 -1
- package/map_view_vue2.umd.min.js.map +1 -1
- package/package.json +5 -13
package/README.md
CHANGED
|
@@ -12,6 +12,14 @@ npm install map_view_vue2 --save
|
|
|
12
12
|
yarn add map_view_vue2
|
|
13
13
|
```
|
|
14
14
|
|
|
15
|
+
```bash
|
|
16
|
+
// main.js
|
|
17
|
+
import MapView from 'map_view_vue2'
|
|
18
|
+
import 'map_view_vue2/map_view_vue2.css'
|
|
19
|
+
Vue.use(MapView)
|
|
20
|
+
|
|
21
|
+
```
|
|
22
|
+
|
|
15
23
|
## 快速上手
|
|
16
24
|
|
|
17
25
|
完整绑定示例(全部 props 与全部事件):
|
|
@@ -30,9 +38,6 @@ yarn add map_view_vue2
|
|
|
30
38
|
:height="viewerHeight"
|
|
31
39
|
:map-background="mapBackground"
|
|
32
40
|
:auto-load="autoLoad"
|
|
33
|
-
@map-added="onMapAdded"
|
|
34
|
-
@active-map-changed="onActiveMapChanged"
|
|
35
|
-
@map-removed="onMapRemoved"
|
|
36
41
|
@layer-removed="onLayerRemoved"
|
|
37
42
|
@view-changed="onViewChanged"
|
|
38
43
|
@theme-changed="onThemeChanged" />
|
|
@@ -40,37 +45,27 @@ yarn add map_view_vue2
|
|
|
40
45
|
</template>
|
|
41
46
|
|
|
42
47
|
<script>
|
|
43
|
-
import mapView from 'map_view_vue2'
|
|
44
|
-
import 'map_view_vue2/map_view_vue2.css'
|
|
45
|
-
|
|
46
48
|
export default {
|
|
47
|
-
components: { mapView },
|
|
48
49
|
data () {
|
|
49
50
|
return {
|
|
50
|
-
theme: 'light',
|
|
51
|
-
dataCrs: 'EPSG:3857',
|
|
52
|
-
zoom: 4.2,
|
|
53
|
-
hidePanels: false,
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
mapBackground: '#ffffff', // 地图画布背景色;null 跟随明暗主题默认背景
|
|
51
|
+
theme: 'light', // light | dark
|
|
52
|
+
dataCrs: 'EPSG:3857', // 初始数据坐标系
|
|
53
|
+
zoom: 4.2, // 初始缩放级别
|
|
54
|
+
hidePanels: false, // 嵌入模式隐藏两侧面板
|
|
55
|
+
viewerWidth: '1000px', // 查看器宽度:数字按 px,字符串原样使用;null 铺满父容器
|
|
56
|
+
viewerHeight: '800px', // 查看器高度:数字按 px,字符串原样使用;null 铺满父容器
|
|
57
|
+
mapBackground: '#ffffff', // 地图画布背景色;null 跟随明暗主题默认背景
|
|
58
58
|
autoLoad: {
|
|
59
|
-
type: 'manifest',
|
|
59
|
+
type: 'manifest', // manifest=矢量清单 / image=PNG 栅格地图
|
|
60
60
|
url: 'http://your-server.com/geojson/metadata.json',
|
|
61
61
|
baseUrl: 'http://your-server.com/geojson'
|
|
62
62
|
}
|
|
63
63
|
};
|
|
64
64
|
},
|
|
65
65
|
methods: {
|
|
66
|
-
// 地图新增:info = { id, name, kind, extent, projection }
|
|
67
|
-
onMapAdded (info) {},
|
|
68
|
-
// 活动地图切换:info = { id, name, kind }
|
|
69
|
-
onActiveMapChanged (info) {},
|
|
70
|
-
// 地图删除:info = { id, name, kind }
|
|
71
|
-
onMapRemoved (info) {},
|
|
72
66
|
// 图层删除:info = { isGroup, name, layerCount, group }
|
|
73
67
|
onLayerRemoved ({ isGroup, name, layerCount, group }) {
|
|
68
|
+
// isGroup :true --- 点击的是图层组的删除, false----点击的是图层组下面的删除
|
|
74
69
|
if (isGroup) {
|
|
75
70
|
console.log('删除了图层组:' + name + ',包含 ' + layerCount + ' 个图层');
|
|
76
71
|
} else {
|
|
@@ -85,9 +80,6 @@ export default {
|
|
|
85
80
|
};
|
|
86
81
|
</script>
|
|
87
82
|
```
|
|
88
|
-
|
|
89
|
-
也可以通过 `$refs.viewer` 调用组件方法,例如 `this.$refs.viewer.addXyzLayer({...})`、`this.$refs.viewer.loadImageFromUrl({...})`、`this.$refs.viewer.loadGeoJsonFromFiles(files)`。
|
|
90
|
-
|
|
91
83
|
## Props
|
|
92
84
|
|
|
93
85
|
| Prop | 类型 | 默认值 | 说明 |
|
|
@@ -96,7 +88,6 @@ export default {
|
|
|
96
88
|
| dataCrs | String | 'EPSG:3857' | 初始数据坐标系(EPSG 代码)。 |
|
|
97
89
|
| zoom | Number | 4.2 | 初始缩放级别。 |
|
|
98
90
|
| hidePanels | Boolean | false | 隐藏两侧面板(嵌入模式)。 |
|
|
99
|
-
| showLoader | Boolean | true | 是否显示「加载地图」按钮与加载对话框。 |
|
|
100
91
|
| width | String / Number | null | 固定查看器宽度:数字按 px,字符串原样使用(如 600 → 600px、100% → 100%)。不传则铺满父容器。 |
|
|
101
92
|
| height | String / Number | null | 固定查看器高度:同上(如 800 → 800px、100vh)。不传则铺满父容器。 |
|
|
102
93
|
| mapBackground | String | null | 地图画布背景色(任意 CSS 颜色值)。不传则跟随明暗主题默认背景。 |
|
|
@@ -111,8 +102,8 @@ export default {
|
|
|
111
102
|
```js
|
|
112
103
|
autoLoad: {
|
|
113
104
|
type: 'manifest',
|
|
114
|
-
url: 'http://
|
|
115
|
-
baseUrl: 'http://
|
|
105
|
+
url: 'http://xxx.xxx.xxx.xx:xx/geojson/metadata.json', // 清单接口地址
|
|
106
|
+
baseUrl: 'http://xxx.xxx.xxx.xx:xx/geojson' // 清单内相对文件名的前缀
|
|
116
107
|
}
|
|
117
108
|
```
|
|
118
109
|
|
|
@@ -125,10 +116,9 @@ autoLoad: {
|
|
|
125
116
|
```js
|
|
126
117
|
autoLoad: {
|
|
127
118
|
type: 'image',
|
|
128
|
-
url: 'http://
|
|
129
|
-
worldFile: 'http://
|
|
130
|
-
|
|
131
|
-
name: '矿区底图' // 可选:地图条目显示名称
|
|
119
|
+
url: 'http://xxx.xxx.xxx.xx:xx/333.png', // PNG 图片地址
|
|
120
|
+
worldFile: 'http://xxx.xxx.xxx.xx:xx/333.pgw', // 世界文件地址
|
|
121
|
+
name: '矿区底图' // 可选:地图条目显示名称
|
|
132
122
|
}
|
|
133
123
|
```
|
|
134
124
|
|
|
@@ -156,8 +146,8 @@ import mapView from 'map_view_vue2'
|
|
|
156
146
|
// autoLoad / 事件载荷等均有完整类型提示
|
|
157
147
|
const autoLoad: import('map_view_vue2').AutoLoadSource = {
|
|
158
148
|
type: 'manifest',
|
|
159
|
-
url: 'http://
|
|
160
|
-
baseUrl: 'http://
|
|
149
|
+
url: 'http://xxx.xxx.xxx.xx:xx/geojson/metadata.json',
|
|
150
|
+
baseUrl: 'http://xxx.xxx.xxx.xx:xx/geojson'
|
|
161
151
|
};
|
|
162
152
|
```
|
|
163
153
|
|
package/index.d.ts
CHANGED
|
@@ -27,7 +27,7 @@ export interface AutoLoadImage {
|
|
|
27
27
|
worldFile?: string;
|
|
28
28
|
/** 世界文件文本内容(传入时优先于 worldFile) */
|
|
29
29
|
worldText?: string;
|
|
30
|
-
/**
|
|
30
|
+
/** 数据坐标系:世界文件不含坐标系信息;不传时自动按范围猜测中国高斯投影带号,未命中默认按 EPSG:3857 解析 */
|
|
31
31
|
crs?: string;
|
|
32
32
|
/** 地图条目显示名称 */
|
|
33
33
|
name?: string;
|
|
@@ -135,4 +135,4 @@ export interface MapViewProps {
|
|
|
135
135
|
*/
|
|
136
136
|
declare const MapView: Vue.ComponentOptions<Vue> & MapViewProps;
|
|
137
137
|
|
|
138
|
-
export default MapView;
|
|
138
|
+
export default MapView;
|