ry-vue-map 0.2.2 → 0.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/README.MD +1 -1
- package/lib/ryui.common.js +81115 -75690
- package/lib/ryui.common.js.gz +0 -0
- package/lib/ryui.css +1 -1
- package/lib/ryui.umd.js +81115 -75690
- package/lib/ryui.umd.js.gz +0 -0
- package/lib/ryui.umd.min.js +5 -5
- package/lib/ryui.umd.min.js.gz +0 -0
- package/package.json +7 -3
- package/src/assets/map.png +0 -0
- package/src/components/index.js +5 -1
- package/src/components/maps/models/ryKML/index.js +29 -0
- package/src/components/maps/models/ryKMLs/index.js +41 -0
- package/src/components/maps/models/ryMapTool/mapTool.js +7 -0
- package/src/components/maps/models/ryOfflineMap/map.js +140 -0
- package/src/components/maps/models/ryOfflineMap/view.js +62 -0
- package/src/components/maps/models/ryStaticMap/map.js +36 -0
- package/src/components/maps/models/ryStaticMap/view.js +66 -0
- package/src/components/maps/ryClusters/src/index.vue +4 -2
- package/src/components/maps/ryKML/index.js +7 -0
- package/src/components/maps/ryKML/src/index.vue +174 -0
- package/src/components/maps/ryKMLs/index.js +7 -0
- package/src/components/maps/ryKMLs/src/index.vue +217 -0
- package/src/components/maps/ryMap/src/index.vue +4 -2
- package/src/components/maps/ryMapTool/src/index.vue +6 -6
- package/src/components/maps/ryOfflineMap/index.js +6 -0
- package/src/components/maps/ryOfflineMap/src/index.vue +329 -0
- package/src/components/maps/ryPolygons/src/index.vue +0 -1
- package/src/components/maps/ryStaticMap/index.js +7 -0
- package/src/components/maps/ryStaticMap/src/index.vue +233 -0
- package/src/components/maps/ryVectorMap/src/index.vue +1 -3
- package/src/components/maps/switchMap/src/newIndex.vue +39 -19
- package/src/main.js +10 -8
- package/src/router/index.js +28 -3
- package/src/utils/lMapServices.js +50 -5
- package/src/views/docx/index.vue +36 -0
- package/src/views/excel/index.vue +26 -0
- package/src/views/map/330112.js +220 -0
- package/src/views/map/dksj.js +1103 -0
- package/src/views/map/index.vue +69 -429
- package/src/views/map/index3.vue +207 -0
- package/src/views/map/index4.vue +207 -0
- package/src/views/map/indexNew.vue +625 -0
- package/src/views/map/indexStatic.vue +205 -0
- package/src/views/pdf/index.vue +24 -0
- package/src/views/staticMap/index.vue +90 -0
- package/src/views/tree/index.vue +193 -0
- package/src/views/vectorMap/index.vue +26 -5
package/lib/ryui.umd.min.js.gz
CHANGED
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ry-vue-map",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.5",
|
|
4
4
|
"private": false,
|
|
5
5
|
"main": "lib/ryui.umd.min.js",
|
|
6
6
|
"description": "ry公共组件库",
|
|
@@ -32,6 +32,10 @@
|
|
|
32
32
|
"@form-create/element-ui": "^2.5.20",
|
|
33
33
|
"@turf/helpers": "^6.5.0",
|
|
34
34
|
"@turf/line-intersect": "^6.5.0",
|
|
35
|
+
"@vue-office/docx": "^0.2.4",
|
|
36
|
+
"@vue-office/excel": "^0.2.4",
|
|
37
|
+
"@vue-office/pdf": "^0.2.4",
|
|
38
|
+
"@vue/composition-api": "^1.7.1",
|
|
35
39
|
"axios": "~0.21.1",
|
|
36
40
|
"core-js": "~3.15.2",
|
|
37
41
|
"countup.js": "~2.0.7",
|
|
@@ -39,8 +43,9 @@
|
|
|
39
43
|
"element-ui": "~2.15.6",
|
|
40
44
|
"nprogress": "~0.2.0",
|
|
41
45
|
"ol": "^6.14.1",
|
|
42
|
-
"ry-map": "^0.
|
|
46
|
+
"ry-map": "^0.4.1",
|
|
43
47
|
"vue": "~2.6.14",
|
|
48
|
+
"vue-demi": "^0.13.11",
|
|
44
49
|
"vue-router": "~3.5.2",
|
|
45
50
|
"vue-server-renderer": "^2.6.14",
|
|
46
51
|
"vuedraggable": "~2.24.3",
|
|
@@ -53,7 +58,6 @@
|
|
|
53
58
|
"@vue/cli-plugin-router": "~4.4.6",
|
|
54
59
|
"@vue/cli-plugin-vuex": "~4.4.6",
|
|
55
60
|
"@vue/cli-service": "~4.4.6",
|
|
56
|
-
"@vue/composition-api": "~1.2.2",
|
|
57
61
|
"babel-eslint": "~10.1.0",
|
|
58
62
|
"compression-webpack-plugin": "~6.1.1",
|
|
59
63
|
"eslint": "~6.8.0",
|
|
Binary file
|
package/src/components/index.js
CHANGED
|
@@ -9,10 +9,14 @@ import RyClustersMarker from './maps/ryClustersMarker';
|
|
|
9
9
|
import RyPolygonGeo from './maps/ryPolygonGeo';
|
|
10
10
|
import RyVectorMap from './maps/ryVectorMap';
|
|
11
11
|
import RyLines from './maps/ryLines';
|
|
12
|
+
import RyStaticMap from './maps/ryStaticMap/index';
|
|
13
|
+
import RyOfflineMap from './maps/ryOfflineMap/index';
|
|
14
|
+
import RyKMLs from './maps/ryKMLs/index';
|
|
15
|
+
import RyKML from './maps/ryKML/index';
|
|
12
16
|
// import "./fonts/iconfont.css";
|
|
13
17
|
|
|
14
18
|
// 组件列表
|
|
15
|
-
const components = [
|
|
19
|
+
const components = [RyMap,RyCrossHair,RyMapTool, RyPolygon,RyPolygons,RyClusters, RyPolygonGeo, RyClustersMarker,RyVectorMap,RyLines,RyStaticMap,RyOfflineMap,RyKMLs,RyKML];
|
|
16
20
|
|
|
17
21
|
// 定义install
|
|
18
22
|
const install = (Vue, options) => {
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
|
|
2
|
+
import Base from '../base/base';
|
|
3
|
+
|
|
4
|
+
export default class RyKMLDto extends Base {
|
|
5
|
+
// 多边形
|
|
6
|
+
model = {
|
|
7
|
+
type: Object,
|
|
8
|
+
default: () => null,
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
// 显示或隐藏
|
|
12
|
+
isShow = {
|
|
13
|
+
type: Boolean,
|
|
14
|
+
default: true,
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
// 清除多边形以及标记
|
|
18
|
+
clear = {
|
|
19
|
+
type: Boolean,
|
|
20
|
+
default: false,
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
// 是否根据bbox 设为中心点
|
|
24
|
+
isFit = {
|
|
25
|
+
type: Boolean,
|
|
26
|
+
default: true,
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
|
|
2
|
+
import Base from '../base/base';
|
|
3
|
+
|
|
4
|
+
export default class RyKMLDto extends Base {
|
|
5
|
+
// 多边形
|
|
6
|
+
modelArr = {
|
|
7
|
+
type: Array,
|
|
8
|
+
default: () => [],
|
|
9
|
+
};
|
|
10
|
+
// 插入
|
|
11
|
+
insert = {
|
|
12
|
+
type: Object,
|
|
13
|
+
default: () => null,
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
// 批量插入
|
|
17
|
+
inserts = {
|
|
18
|
+
type: Array,
|
|
19
|
+
default: () => [],
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
// 显示或隐藏所有所有
|
|
23
|
+
isShowAll = {
|
|
24
|
+
type: Boolean,
|
|
25
|
+
default: true,
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
// 清除多边形以及标记
|
|
30
|
+
clear = {
|
|
31
|
+
type: Boolean,
|
|
32
|
+
default: false,
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
// 是否根据bbox 设为中心点
|
|
36
|
+
isFit = {
|
|
37
|
+
type: Boolean,
|
|
38
|
+
default: true,
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
}
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
export default class MapDto {
|
|
2
|
+
constructor() {
|
|
3
|
+
this.mapType = {
|
|
4
|
+
type: Number,
|
|
5
|
+
default: 0,
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
this.layerType = {
|
|
9
|
+
type: Number,
|
|
10
|
+
default:2 ,
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
this.isSwitchMapTool = {
|
|
15
|
+
type: Boolean,
|
|
16
|
+
default: true,
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
this.isRyMapTool = {
|
|
20
|
+
type: Boolean,
|
|
21
|
+
default: false,
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
this.isRight = {
|
|
25
|
+
type: Boolean,
|
|
26
|
+
default: false,
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
this.bindMapClick = {
|
|
30
|
+
type: Boolean,
|
|
31
|
+
default: false,
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
this.bindMapMoveend = {
|
|
35
|
+
type: Boolean,
|
|
36
|
+
default: false,
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
this.isDisabledSwitchMapTabEvent={
|
|
40
|
+
type: Boolean,
|
|
41
|
+
default: false,
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
// 初始化编辑多边形
|
|
45
|
+
this.initModifyPolygon = {
|
|
46
|
+
type: [String, Object],
|
|
47
|
+
default: () => null,
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
// 地图中心点计算中心点距离 默认 单位m
|
|
51
|
+
this.m = {
|
|
52
|
+
type: Number,
|
|
53
|
+
default: () => 3000,
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
//切换地图的默认瓦片和类型
|
|
57
|
+
this.switchMapDefaultTypeOrLayer = {
|
|
58
|
+
type: Array,
|
|
59
|
+
default: ()=> null
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
//地图类型以及瓦片的数据结构
|
|
63
|
+
this.mapTypeAndLayer = {
|
|
64
|
+
type: Array,
|
|
65
|
+
default: () => [
|
|
66
|
+
{
|
|
67
|
+
id:0,
|
|
68
|
+
icon: 'el-icon--tianditu',
|
|
69
|
+
activeIcon: 'el-icon--tianditu-copy',
|
|
70
|
+
name: '天地图',
|
|
71
|
+
layer: [
|
|
72
|
+
{
|
|
73
|
+
id:0,
|
|
74
|
+
name:'地图'
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
id:1,
|
|
78
|
+
name:'卫星'
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
id:2,
|
|
82
|
+
name:'卫星组合'
|
|
83
|
+
}
|
|
84
|
+
]
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
id:1,
|
|
88
|
+
icon: 'el-icon--gaode',
|
|
89
|
+
activeIcon: 'el-icon--gaode-copy',
|
|
90
|
+
name: '高德地图',
|
|
91
|
+
layer: [
|
|
92
|
+
{
|
|
93
|
+
id:0,
|
|
94
|
+
name:'地图'
|
|
95
|
+
},
|
|
96
|
+
{
|
|
97
|
+
id:1,
|
|
98
|
+
name:'卫星'
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
id:2,
|
|
102
|
+
name:'卫星组合'
|
|
103
|
+
}
|
|
104
|
+
]
|
|
105
|
+
},
|
|
106
|
+
{
|
|
107
|
+
id:2,
|
|
108
|
+
icon: 'el-icon--Bing',
|
|
109
|
+
activeIcon: 'el-icon--Bing-copy',
|
|
110
|
+
name: 'Bing地图',
|
|
111
|
+
layer: [
|
|
112
|
+
{
|
|
113
|
+
id:1,
|
|
114
|
+
name:'卫星'
|
|
115
|
+
},
|
|
116
|
+
{
|
|
117
|
+
id:2,
|
|
118
|
+
name:'卫星组合'
|
|
119
|
+
}
|
|
120
|
+
]
|
|
121
|
+
}
|
|
122
|
+
]
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
isShowSwitchMap={
|
|
126
|
+
type: Boolean,
|
|
127
|
+
default: true,
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
urls={
|
|
131
|
+
type: Array,
|
|
132
|
+
default: ()=> [],
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
boundaryModel={
|
|
136
|
+
type: Object,
|
|
137
|
+
default: ()=> null,
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
const viewOptions = {
|
|
2
|
+
projection: 'EPSG:4326',
|
|
3
|
+
center: [116.40769, 39.89945],
|
|
4
|
+
zoom: 18
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
export default class MapDto {
|
|
8
|
+
constructor(opt) {
|
|
9
|
+
|
|
10
|
+
// 默认缩放率
|
|
11
|
+
this.zoom = {
|
|
12
|
+
type: Number,
|
|
13
|
+
default: 10,
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
// 最大缩放率
|
|
17
|
+
this.maxZoom = {
|
|
18
|
+
type: Number,
|
|
19
|
+
default: 18,
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
// 最小缩放率
|
|
23
|
+
this.minZoom = {
|
|
24
|
+
type: Number,
|
|
25
|
+
default: 1,
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
// 默认中心点数组
|
|
29
|
+
this.center = {
|
|
30
|
+
type: Array,
|
|
31
|
+
default: () => [116.40769, 39.89945],
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
// 投影方式
|
|
35
|
+
|
|
36
|
+
this.projection = {
|
|
37
|
+
type: String,
|
|
38
|
+
default: 'EPSG:4326',
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
// 二维数组 [[],[]] 根据多个中心点数组进行定位 fit 适合用于 多边形 marker 折线等
|
|
42
|
+
this.bbox = {
|
|
43
|
+
type: Array,
|
|
44
|
+
default: () => [],
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
// this.viewOptions = {
|
|
50
|
+
// type: Object,
|
|
51
|
+
// default: () => {
|
|
52
|
+
// return {
|
|
53
|
+
// projection: 'EPSG:4326',
|
|
54
|
+
// center: [116.40769, 39.89945],
|
|
55
|
+
// zoom: 18,
|
|
56
|
+
// minZoom:1,
|
|
57
|
+
// maxZoom:18
|
|
58
|
+
// };
|
|
59
|
+
// }
|
|
60
|
+
// }
|
|
61
|
+
}
|
|
62
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
export default class MapDto {
|
|
2
|
+
constructor() {
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
this.isSwitchMapTool = {
|
|
6
|
+
type: Boolean,
|
|
7
|
+
default: true,
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
this.isRyMapTool = {
|
|
11
|
+
type: Boolean,
|
|
12
|
+
default: false,
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
this.isRight = {
|
|
16
|
+
type: Boolean,
|
|
17
|
+
default: false,
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
this.bindMapClick = {
|
|
21
|
+
type: Boolean,
|
|
22
|
+
default: false,
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
// 初始化编辑多边形
|
|
27
|
+
this.initModifyPolygon = {
|
|
28
|
+
type: [String, Object],
|
|
29
|
+
default: () => null,
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
const viewOptions = {
|
|
2
|
+
projection: 'EPSG:4326',
|
|
3
|
+
center: [116.40769, 39.89945],
|
|
4
|
+
zoom: 18
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
export default class MapDto {
|
|
8
|
+
constructor(opt) {
|
|
9
|
+
|
|
10
|
+
// 默认缩放率
|
|
11
|
+
this.zoom = {
|
|
12
|
+
type: Number,
|
|
13
|
+
default: 10,
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
// 最大缩放率
|
|
17
|
+
this.maxZoom = {
|
|
18
|
+
type: Number,
|
|
19
|
+
default: 28,
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
// 最小缩放率
|
|
23
|
+
this.minZoom = {
|
|
24
|
+
type: Number,
|
|
25
|
+
default: 1,
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
// 默认中心点数组
|
|
29
|
+
this.center = {
|
|
30
|
+
type: Array,
|
|
31
|
+
default: () => [2575, 1450],
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
// 二维数组 [[],[]] 根据多个中心点数组进行定位 fit 适合用于 多边形 marker 折线等
|
|
35
|
+
this.bbox = {
|
|
36
|
+
type: Array,
|
|
37
|
+
default: () => [],
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
this.url = {
|
|
41
|
+
type: String,
|
|
42
|
+
default: () => null,
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
this.imageSize={
|
|
46
|
+
type: Array,
|
|
47
|
+
default: () => [0, 0, 7247, 3562],
|
|
48
|
+
}
|
|
49
|
+
this.imageExtent={
|
|
50
|
+
type: Array,
|
|
51
|
+
default: () =>[500, 400, 5000, 2700],
|
|
52
|
+
}
|
|
53
|
+
// this.viewOptions = {
|
|
54
|
+
// type: Object,
|
|
55
|
+
// default: () => {
|
|
56
|
+
// return {
|
|
57
|
+
// projection: 'EPSG:4326',
|
|
58
|
+
// center: [116.40769, 39.89945],
|
|
59
|
+
// zoom: 18,
|
|
60
|
+
// minZoom:1,
|
|
61
|
+
// maxZoom:18
|
|
62
|
+
// };
|
|
63
|
+
// }
|
|
64
|
+
// }
|
|
65
|
+
}
|
|
66
|
+
}
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
stroke: 'rgba(23, 168, 162, 0.56)',
|
|
12
12
|
width: 3,
|
|
13
13
|
// id:'ceshi',
|
|
14
|
-
text:'
|
|
14
|
+
text:'块'
|
|
15
15
|
};
|
|
16
16
|
import {
|
|
17
17
|
CheckPoint,
|
|
@@ -70,7 +70,7 @@
|
|
|
70
70
|
checkPointArr: new Map(),
|
|
71
71
|
currentArr: Array(),
|
|
72
72
|
fpModelArr: [],
|
|
73
|
-
featurePolygon:
|
|
73
|
+
featurePolygon:null,
|
|
74
74
|
multiPolygonMap: new Map(),
|
|
75
75
|
// model: new multiPolygonGeoJsonModel(),
|
|
76
76
|
scan: new GrahamScan(),
|
|
@@ -80,6 +80,7 @@
|
|
|
80
80
|
beforeDestroy() {
|
|
81
81
|
this.clear();
|
|
82
82
|
},
|
|
83
|
+
|
|
83
84
|
watch: {
|
|
84
85
|
modelArr(data) {
|
|
85
86
|
if (this.map) {
|
|
@@ -93,6 +94,7 @@
|
|
|
93
94
|
}
|
|
94
95
|
},
|
|
95
96
|
created(){
|
|
97
|
+
this.featurePolygon = new FeaturePolygon(this.gpsType);
|
|
96
98
|
this.clear();
|
|
97
99
|
this.init();
|
|
98
100
|
},
|
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
</template>
|
|
3
|
+
|
|
4
|
+
<script>
|
|
5
|
+
import {
|
|
6
|
+
fitNew,
|
|
7
|
+
GPS,
|
|
8
|
+
LKML,
|
|
9
|
+
} from 'ry-map';
|
|
10
|
+
import Dto from './../../models/ryKML/index.js';
|
|
11
|
+
export default {
|
|
12
|
+
name: 'RyKMLs',
|
|
13
|
+
props: {
|
|
14
|
+
...new Dto(),
|
|
15
|
+
},
|
|
16
|
+
data() {
|
|
17
|
+
return {
|
|
18
|
+
bbox: [],
|
|
19
|
+
bboxGCJ02: [],
|
|
20
|
+
kml: null,
|
|
21
|
+
lastType: -1,
|
|
22
|
+
url:null,
|
|
23
|
+
gcj02Url:null,
|
|
24
|
+
};
|
|
25
|
+
},
|
|
26
|
+
watch: {
|
|
27
|
+
model(val) {
|
|
28
|
+
this._remove();
|
|
29
|
+
if (!val.length) return;
|
|
30
|
+
this.model = val;
|
|
31
|
+
this.init(val);
|
|
32
|
+
},
|
|
33
|
+
clear(val) {
|
|
34
|
+
if (val) {
|
|
35
|
+
this._remove();
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
isShow(val) {
|
|
39
|
+
if (val) {
|
|
40
|
+
this.showAll();
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
this.hideAll();
|
|
44
|
+
},
|
|
45
|
+
gpsType(val) {
|
|
46
|
+
if (this.lastType == val) return;
|
|
47
|
+
this.gpsType = val;
|
|
48
|
+
this.lastType = val;
|
|
49
|
+
this.selectGPSAll(this.gpsType);
|
|
50
|
+
},
|
|
51
|
+
|
|
52
|
+
},
|
|
53
|
+
|
|
54
|
+
created() {
|
|
55
|
+
this.lastType = this.gpsType;
|
|
56
|
+
if(!this.model) return;
|
|
57
|
+
this.init(this.model);
|
|
58
|
+
},
|
|
59
|
+
|
|
60
|
+
methods: {
|
|
61
|
+
init(model) {
|
|
62
|
+
this._insert(model);
|
|
63
|
+
if(this.isFit){
|
|
64
|
+
setTimeout(() => {
|
|
65
|
+
this.setFit();
|
|
66
|
+
}, 50);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
},
|
|
70
|
+
_insert(dto) {
|
|
71
|
+
const {
|
|
72
|
+
id,
|
|
73
|
+
url,
|
|
74
|
+
bbox,
|
|
75
|
+
is,
|
|
76
|
+
stroke,
|
|
77
|
+
fillColor,
|
|
78
|
+
zIndex,
|
|
79
|
+
width,
|
|
80
|
+
extractStyles,
|
|
81
|
+
gcj02Url
|
|
82
|
+
} = dto;
|
|
83
|
+
const lkml = new LKML({
|
|
84
|
+
id,
|
|
85
|
+
url: this.gpsType == 1 ? gcj02Url : url,
|
|
86
|
+
bbox,
|
|
87
|
+
is,
|
|
88
|
+
stroke,
|
|
89
|
+
fillColor,
|
|
90
|
+
zIndex,
|
|
91
|
+
width,
|
|
92
|
+
},
|
|
93
|
+
this.map,
|
|
94
|
+
extractStyles);
|
|
95
|
+
this.kml=lkml;
|
|
96
|
+
this.url=url;
|
|
97
|
+
this.gcj02Url=gcj02Url;
|
|
98
|
+
this.setBBOXArr(bbox);
|
|
99
|
+
},
|
|
100
|
+
setBBOXArr(bbox) {
|
|
101
|
+
this.bbox=bbox;
|
|
102
|
+
const _bboxGCJ02 = this.convertBBoxGCJ02(bbox);
|
|
103
|
+
this.bboxGCJ02=_bboxGCJ02;
|
|
104
|
+
},
|
|
105
|
+
setUrl(url) {
|
|
106
|
+
|
|
107
|
+
if (this.kml) {
|
|
108
|
+
|
|
109
|
+
this.kml.setUrl(url);
|
|
110
|
+
}
|
|
111
|
+
},
|
|
112
|
+
setFit() {
|
|
113
|
+
|
|
114
|
+
if (!this.bbox.length || !this.map) return;
|
|
115
|
+
this.setFitFist(this.gpsType == 1 ? this.bboxGCJ02 : this.bbox);
|
|
116
|
+
},
|
|
117
|
+
// bbox.length =1 执行此处
|
|
118
|
+
setFitFist(bbox) {
|
|
119
|
+
const bbox2 = [bbox[0], bbox[3], bbox[2], bbox[1]];
|
|
120
|
+
const bbox3 = [bbox[2], bbox[1], bbox[0], bbox[3]];
|
|
121
|
+
fitNew(this.map, [bbox2, bbox3]);
|
|
122
|
+
},
|
|
123
|
+
convertBBoxGCJ02(bbox) {
|
|
124
|
+
const pointArr = [];
|
|
125
|
+
const {
|
|
126
|
+
lat,
|
|
127
|
+
lon
|
|
128
|
+
} = GPS.gcj_encrypt(bbox[0], bbox[1]);
|
|
129
|
+
const {
|
|
130
|
+
lon: lon2,
|
|
131
|
+
lat: lat2
|
|
132
|
+
} = GPS.gcj_encrypt(bbox[2], bbox[3]);
|
|
133
|
+
pointArr.push(lon);
|
|
134
|
+
pointArr.push(lat);
|
|
135
|
+
pointArr.push(lon2);
|
|
136
|
+
pointArr.push(lat2);
|
|
137
|
+
return pointArr;
|
|
138
|
+
},
|
|
139
|
+
|
|
140
|
+
_remove() {
|
|
141
|
+
if(!this.kml) return;
|
|
142
|
+
this.kml.removeKML();
|
|
143
|
+
this.bbox = [];
|
|
144
|
+
this.bboxGCJ02 = [];
|
|
145
|
+
this.url=null;
|
|
146
|
+
this.gcj02Url=null;
|
|
147
|
+
},
|
|
148
|
+
|
|
149
|
+
selectGPSAll(type) {
|
|
150
|
+
const url = type == 1 ? this.gcj02Url : this.url;
|
|
151
|
+
this.setUrl(url);
|
|
152
|
+
},
|
|
153
|
+
|
|
154
|
+
show() {
|
|
155
|
+
if(!this.kml) return;
|
|
156
|
+
this.kml.show();
|
|
157
|
+
if(this.isFit){
|
|
158
|
+
setTimeout(() => {
|
|
159
|
+
this.setFit();
|
|
160
|
+
}, 50);
|
|
161
|
+
}
|
|
162
|
+
},
|
|
163
|
+
|
|
164
|
+
hide() {
|
|
165
|
+
if(!this.kml) return;
|
|
166
|
+
this.kml.hide();
|
|
167
|
+
},
|
|
168
|
+
|
|
169
|
+
},
|
|
170
|
+
}
|
|
171
|
+
</script>
|
|
172
|
+
|
|
173
|
+
<style>
|
|
174
|
+
</style>
|