ry-vue-map 0.6.2 → 0.6.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 +1 -1
- package/package.json +2 -2
- package/src/components/maps/models/ryKML/index.js +8 -1
- package/src/components/maps/models/ryKMLs/index.js +7 -2
- package/src/components/maps/ryKML/src/index.vue +161 -159
- package/src/components/maps/ryKMLs/src/index.vue +23 -22
- package/src/views/map/index.vue +3 -1053
- package/src/views/map/3301.js +0 -96828
- package/src/views/map/330112.js +0 -5106
- package/src/views/map/330681.js +0 -3454
- package/src/views/map/331123.js +0 -4736
- package/src/views/map/ceshijson.js +0 -323
- package/src/views/map/ceshisuhusss.js +0 -7587
- package/src/views/map/dksj.js +0 -482171
- package/src/views/map/imgUrl.js +0 -1517
- package/src/views/map/index3.vue +0 -207
- package/src/views/map/index4.vue +0 -207
- package/src/views/map/indexNew.vue +0 -625
- package/src/views/map/indexStatic.vue +0 -1
- package/src/views/map/indexsssss.vue +0 -762
- package/src/views/map/line.vue +0 -1045
- package/src/views/map/lineData.js +0 -19592
- package/src/views/map/lineData2.js +0 -3449
- package/src/views/map/new_file.vue +0 -280
- package/src/views/map/obj.js +0 -10014
package/README.MD
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ry-vue-map",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.3",
|
|
4
4
|
"private": false,
|
|
5
5
|
"main": "lib/ryui.umd.min.js",
|
|
6
6
|
"description": "ry公共组件库",
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
"kml-to-geojson": "^1.0.13",
|
|
46
46
|
"nprogress": "~0.2.0",
|
|
47
47
|
"ol": "^6.14.1",
|
|
48
|
-
"ry-map": "^0.5.
|
|
48
|
+
"ry-map": "^0.5.3",
|
|
49
49
|
"vue": "~2.6.14",
|
|
50
50
|
"vue-demi": "^0.13.11",
|
|
51
51
|
"vue-router": "~3.5.2",
|
|
@@ -13,7 +13,7 @@ export default class RyKMLDto extends Base {
|
|
|
13
13
|
type: Boolean,
|
|
14
14
|
default: true,
|
|
15
15
|
};
|
|
16
|
-
|
|
16
|
+
|
|
17
17
|
// 清除多边形以及标记
|
|
18
18
|
clear = {
|
|
19
19
|
type: Boolean,
|
|
@@ -24,6 +24,13 @@ export default class RyKMLDto extends Base {
|
|
|
24
24
|
isFit = {
|
|
25
25
|
type: Boolean,
|
|
26
26
|
default: true,
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
// 异步加载KML时间默认100毫秒
|
|
31
|
+
time = {
|
|
32
|
+
type: Number,
|
|
33
|
+
default: 100,
|
|
27
34
|
};
|
|
28
35
|
|
|
29
36
|
}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
|
|
2
1
|
import Base from '../base/base';
|
|
3
2
|
|
|
4
3
|
export default class RyKMLDto extends Base {
|
|
@@ -43,4 +42,10 @@ export default class RyKMLDto extends Base {
|
|
|
43
42
|
type: Object,
|
|
44
43
|
default: () => null,
|
|
45
44
|
};
|
|
46
|
-
|
|
45
|
+
|
|
46
|
+
// 异步加载KML时间默认100毫秒
|
|
47
|
+
time = {
|
|
48
|
+
type: Number,
|
|
49
|
+
default: 100,
|
|
50
|
+
};
|
|
51
|
+
}
|
|
@@ -2,173 +2,175 @@
|
|
|
2
2
|
</template>
|
|
3
3
|
|
|
4
4
|
<script>
|
|
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
|
-
|
|
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: 'RyKML',
|
|
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) 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
51
|
|
|
52
|
-
|
|
52
|
+
},
|
|
53
53
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
54
|
+
created() {
|
|
55
|
+
this.lastType = this.gpsType;
|
|
56
|
+
if (!this.model) return;
|
|
57
|
+
this.init(this.model);
|
|
58
|
+
},
|
|
59
59
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
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
|
-
},
|
|
60
|
+
methods: {
|
|
61
|
+
async init(model) {
|
|
62
|
+
await this._insert(model);
|
|
63
|
+
if (this.isFit) {
|
|
64
|
+
setTimeout(() => {
|
|
65
|
+
this.setFit();
|
|
66
|
+
}, 50);
|
|
67
|
+
}
|
|
139
68
|
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
69
|
+
},
|
|
70
|
+
async _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
|
+
await lkml.init(this.time);
|
|
99
|
+
if (id) {
|
|
100
|
+
lkml.setId(id);
|
|
101
|
+
}
|
|
102
|
+
this.setBBOXArr(lkml.getExtent());
|
|
103
|
+
},
|
|
104
|
+
setBBOXArr(bbox) {
|
|
105
|
+
this.bbox = bbox;
|
|
106
|
+
const _bboxGCJ02 = this.convertBBoxGCJ02(bbox);
|
|
107
|
+
this.bboxGCJ02 = _bboxGCJ02;
|
|
108
|
+
},
|
|
109
|
+
setUrl(url) {
|
|
148
110
|
|
|
149
|
-
|
|
150
|
-
const url = type == 1 ? this.gcj02Url : this.url;
|
|
151
|
-
this.setUrl(url);
|
|
152
|
-
},
|
|
111
|
+
if (this.kml) {
|
|
153
112
|
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
113
|
+
this.kml.setUrl(url);
|
|
114
|
+
}
|
|
115
|
+
},
|
|
116
|
+
setFit() {
|
|
117
|
+
if (!this.bbox.length || !this.map) return;
|
|
118
|
+
this.setFitFist(this.gpsType == 1 ? this.bboxGCJ02 : this.bbox);
|
|
119
|
+
},
|
|
120
|
+
// bbox.length =1 执行此处
|
|
121
|
+
setFitFist(bbox) {
|
|
122
|
+
const bbox2 = [bbox[0], bbox[3], bbox[2], bbox[1]];
|
|
123
|
+
const bbox3 = [bbox[2], bbox[1], bbox[0], bbox[3]];
|
|
124
|
+
fitNew(this.map, [bbox2, bbox3]);
|
|
125
|
+
},
|
|
126
|
+
convertBBoxGCJ02(bbox) {
|
|
127
|
+
const pointArr = [];
|
|
128
|
+
const {
|
|
129
|
+
lat,
|
|
130
|
+
lon
|
|
131
|
+
} = GPS.gcj_encrypt(bbox[0], bbox[1]);
|
|
132
|
+
const {
|
|
133
|
+
lon: lon2,
|
|
134
|
+
lat: lat2
|
|
135
|
+
} = GPS.gcj_encrypt(bbox[2], bbox[3]);
|
|
136
|
+
pointArr.push(lon);
|
|
137
|
+
pointArr.push(lat);
|
|
138
|
+
pointArr.push(lon2);
|
|
139
|
+
pointArr.push(lat2);
|
|
140
|
+
return pointArr;
|
|
141
|
+
},
|
|
163
142
|
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
143
|
+
_remove() {
|
|
144
|
+
if (!this.kml) return;
|
|
145
|
+
this.kml.removeKML();
|
|
146
|
+
this.bbox = [];
|
|
147
|
+
this.bboxGCJ02 = [];
|
|
148
|
+
this.url = null;
|
|
149
|
+
this.gcj02Url = null;
|
|
150
|
+
},
|
|
168
151
|
|
|
169
|
-
|
|
170
|
-
|
|
152
|
+
selectGPSAll(type) {
|
|
153
|
+
const url = type == 1 ? this.gcj02Url : this.url;
|
|
154
|
+
this.setUrl(url);
|
|
155
|
+
},
|
|
156
|
+
|
|
157
|
+
show() {
|
|
158
|
+
if (!this.kml) return;
|
|
159
|
+
this.kml.show();
|
|
160
|
+
if (this.isFit) {
|
|
161
|
+
setTimeout(() => {
|
|
162
|
+
this.setFit();
|
|
163
|
+
}, 50);
|
|
164
|
+
}
|
|
165
|
+
},
|
|
166
|
+
|
|
167
|
+
hide() {
|
|
168
|
+
if (!this.kml) return;
|
|
169
|
+
this.kml.hide();
|
|
170
|
+
},
|
|
171
|
+
},
|
|
172
|
+
}
|
|
171
173
|
</script>
|
|
172
174
|
|
|
173
175
|
<style>
|
|
174
|
-
</style>
|
|
176
|
+
</style>
|
|
@@ -72,29 +72,24 @@
|
|
|
72
72
|
|
|
73
73
|
},
|
|
74
74
|
|
|
75
|
-
created() {
|
|
76
|
-
this.lastType = this.gpsType;
|
|
77
|
-
if(this.modelArr.length){
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
}
|
|
81
|
-
if(this.inserts.length){
|
|
82
|
-
|
|
75
|
+
async created() {
|
|
76
|
+
this.lastType = this.gpsType;
|
|
77
|
+
if (this.modelArr.length) {
|
|
78
|
+
await this.init(this.modelArr);
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
81
|
+
if (this.inserts.length) {
|
|
82
|
+
await this.init(this.inserts);
|
|
83
83
|
}
|
|
84
84
|
},
|
|
85
85
|
|
|
86
86
|
methods: {
|
|
87
|
-
init(arr) {
|
|
88
|
-
// this._insert();
|
|
87
|
+
async init(arr) {
|
|
89
88
|
if (!arr || !arr.length) return;
|
|
90
|
-
arr.
|
|
91
|
-
this._insert(
|
|
92
|
-
});
|
|
93
|
-
if (this.isFit) {
|
|
94
|
-
setTimeout(() => {
|
|
95
|
-
this.setFit();
|
|
96
|
-
}, 50);
|
|
89
|
+
for (let i = 0; i < arr.length; i++) {
|
|
90
|
+
await this._insert(arr[i]);
|
|
97
91
|
}
|
|
92
|
+
this.setFit();
|
|
98
93
|
},
|
|
99
94
|
_inserts(arr) {
|
|
100
95
|
this.lastType = this.gpsType;
|
|
@@ -107,7 +102,7 @@
|
|
|
107
102
|
}, 50);
|
|
108
103
|
}
|
|
109
104
|
},
|
|
110
|
-
_insert(dto) {
|
|
105
|
+
async _insert(dto) {
|
|
111
106
|
const {
|
|
112
107
|
id,
|
|
113
108
|
url,
|
|
@@ -133,13 +128,19 @@
|
|
|
133
128
|
},
|
|
134
129
|
this.map,
|
|
135
130
|
extractStyles);
|
|
131
|
+
await lkml.init(this.time);
|
|
132
|
+
if (id) {
|
|
133
|
+
lkml.setId(id);
|
|
134
|
+
}
|
|
136
135
|
this.kmlMap.set(id, lkml);
|
|
137
136
|
this.urls.set(id, url);
|
|
137
|
+
|
|
138
138
|
if (gcj02Url) {
|
|
139
139
|
this.gcj02Urls.set(id, gcj02Url);
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
|
|
140
|
+
}
|
|
141
|
+
this.setBBOXArr(dto.id, lkml.getExtent());
|
|
142
|
+
}
|
|
143
|
+
|
|
143
144
|
},
|
|
144
145
|
// 刷新
|
|
145
146
|
_setZoom() {
|
|
@@ -171,7 +172,7 @@
|
|
|
171
172
|
}
|
|
172
173
|
this.setFitFist(this.gpsType == 1 ? this.bboxGCJ02[0] : this.bbox[0]);
|
|
173
174
|
},
|
|
174
|
-
|
|
175
|
+
|
|
175
176
|
setFitFist(bbox) {
|
|
176
177
|
const bbox2 = [bbox[0], bbox[3], bbox[2], bbox[1]];
|
|
177
178
|
const bbox3 = [bbox[2], bbox[1], bbox[0], bbox[3]];
|