ry-vue-map 0.2.8 → 0.2.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/lib/ryui.common.js +1060 -149
- package/lib/ryui.common.js.gz +0 -0
- package/lib/ryui.css +1 -1
- package/lib/ryui.css.gz +0 -0
- package/lib/ryui.umd.js +1060 -149
- package/lib/ryui.umd.js.gz +0 -0
- package/lib/ryui.umd.min.js +3 -3
- package/lib/ryui.umd.min.js.gz +0 -0
- package/package.json +1 -1
- package/src/assets/mask.png +0 -0
- package/src/assets/play.png +0 -0
- package/src/assets/stop.png +0 -0
- package/src/components/index.js +20 -1
- package/src/components/maps/models/ryLines/ryLines.js +17 -1
- package/src/components/maps/models/ryPolygons/ryPolygons.js +8 -101
- package/src/components/maps/models/ryStaticLayer/index.js +29 -0
- package/src/components/maps/models/ryStaticLayers/index.js +45 -0
- package/src/components/maps/ryLines/src/index.scss +115 -0
- package/src/components/maps/ryLines/src/index.vue +378 -26
- package/src/components/maps/ryStaticLayer/index.js +7 -0
- package/src/components/maps/ryStaticLayer/src/index.vue +154 -0
- package/src/components/maps/ryStaticLayers/index.js +7 -0
- package/src/components/maps/ryStaticLayers/src/index.vue +213 -0
- package/src/components/maps/switchMap/src/newIndex.vue +0 -1
- package/src/views/map/index.vue +405 -125
|
@@ -1,13 +1,37 @@
|
|
|
1
1
|
<template>
|
|
2
|
+
<div>
|
|
3
|
+
<div v-if="isShowPlayback" class="el-slider-box">
|
|
4
|
+
<el-row type="flex" justify="center">
|
|
5
|
+
<el-col :span="1">
|
|
6
|
+
<button class="button-paly" @click.stop="onPlayTrajectory()" v-if="!index || !isStop"></button>
|
|
7
|
+
<button class="button-stop" @click.stop="onStopTrajectory()" v-else></button>
|
|
8
|
+
</el-col>
|
|
9
|
+
<el-col :xs="13" :sm="19" :md="19" :lg="19" :xl="23">
|
|
10
|
+
<el-slider v-model="index" :marks="marks" show-tooltip :step="1" :min="0" :max="cacheArr.length"
|
|
11
|
+
@change="sliderChange" :format-tooltip="formatTooltip"></el-slider>
|
|
12
|
+
</el-col>
|
|
13
|
+
</el-row>
|
|
14
|
+
<el-row type="flex" justify="end">
|
|
15
|
+
<el-col>
|
|
16
|
+
<section class="control-panel">
|
|
17
|
+
<span>播放倍速:</span>
|
|
18
|
+
<span :class="{ active: selectActive[0] }" @click.stop="onPlaySpeed(0, 200)">0.5x</span>
|
|
19
|
+
<span :class="{ active: selectActive[1] }" @click.stop="onPlaySpeed(1, 100)">正常</span>
|
|
20
|
+
<span :class="{ active: selectActive[2] }" @click.stop="onPlaySpeed(2, 50)">1.5x</span>
|
|
21
|
+
<span :class="{ active: selectActive[3] }" @click.stop="onPlaySpeed(3, 5)">2.0x</span>
|
|
22
|
+
</section>
|
|
23
|
+
</el-col>
|
|
24
|
+
</el-row>
|
|
25
|
+
</div>
|
|
26
|
+
</div>
|
|
27
|
+
|
|
2
28
|
</template>
|
|
3
29
|
|
|
4
30
|
<script>
|
|
5
31
|
import {
|
|
6
32
|
Polyline,
|
|
7
33
|
LMarker,
|
|
8
|
-
getCenterPoint,
|
|
9
34
|
fitNew,
|
|
10
|
-
getLngAndLatMaxMin,
|
|
11
35
|
GPS,
|
|
12
36
|
AM,
|
|
13
37
|
} from 'ry-map';
|
|
@@ -31,23 +55,48 @@
|
|
|
31
55
|
pineArr: [],
|
|
32
56
|
lastLineX: 0,
|
|
33
57
|
lastLineY: 0,
|
|
34
|
-
|
|
35
|
-
|
|
58
|
+
lastLineX2: 0,
|
|
59
|
+
lastLineY2: 0,
|
|
60
|
+
cacheArr: new Array(),
|
|
61
|
+
cacheModelArr: new Map(),
|
|
62
|
+
cacheColors: new Map(),
|
|
63
|
+
cacheLenArr: new Array(),
|
|
64
|
+
cacheLines: new Array(),
|
|
65
|
+
cacheLineMaps: new Map(),
|
|
66
|
+
cacheScales: new Array(),
|
|
36
67
|
isFist: true,
|
|
37
68
|
lastColor: null,
|
|
38
|
-
|
|
69
|
+
len: 0,
|
|
70
|
+
am: new AM(),
|
|
71
|
+
index: 0,
|
|
72
|
+
intervalId: null,
|
|
73
|
+
selectActive: [false, true, false, false],
|
|
74
|
+
marks: {
|
|
75
|
+
|
|
76
|
+
},
|
|
77
|
+
marks2: {
|
|
78
|
+
|
|
79
|
+
},
|
|
80
|
+
// 轨迹回放
|
|
81
|
+
isPlayback: false,
|
|
82
|
+
// 暂停轨迹回放
|
|
83
|
+
isStop: false,
|
|
84
|
+
playSpeed: 100,
|
|
39
85
|
};
|
|
40
86
|
},
|
|
41
87
|
watch: {
|
|
42
88
|
model(val) {
|
|
43
89
|
this.init();
|
|
90
|
+
if (!val) return;
|
|
91
|
+
this.insertCache(val.pointArr);
|
|
44
92
|
},
|
|
45
93
|
linenIsert(val) {
|
|
46
94
|
if (!this.map || !val) return;
|
|
95
|
+
this.insertCache(val);
|
|
47
96
|
this._insertLineAndMarker(val);
|
|
48
97
|
},
|
|
49
98
|
gpsType(val) {
|
|
50
|
-
|
|
99
|
+
this.selectGPSAll(val);
|
|
51
100
|
},
|
|
52
101
|
clearLiens(val) {
|
|
53
102
|
if (val) {
|
|
@@ -59,7 +108,33 @@
|
|
|
59
108
|
this.appendCoordinate(val);
|
|
60
109
|
this.setMarkerPoint(this.endMarker, val);
|
|
61
110
|
}
|
|
111
|
+
},
|
|
112
|
+
isShowPlayback(val){
|
|
113
|
+
if(!val){
|
|
114
|
+
this.endPlaybackLines();
|
|
115
|
+
this.index=0;
|
|
116
|
+
this.resetPyalPanel();
|
|
117
|
+
return;
|
|
118
|
+
}
|
|
119
|
+
delete this.marks2[this.len];
|
|
120
|
+
this.marks=this.marks2;
|
|
121
|
+
|
|
62
122
|
}
|
|
123
|
+
// isPlayback(val){
|
|
124
|
+
// if(val){
|
|
125
|
+
// this.trackPlayback();
|
|
126
|
+
// return;
|
|
127
|
+
// }
|
|
128
|
+
// this.endPlaybackLines();
|
|
129
|
+
// },
|
|
130
|
+
// isStop(val){
|
|
131
|
+
// if(val){
|
|
132
|
+
// this._clearInterval();
|
|
133
|
+
// return;
|
|
134
|
+
// }
|
|
135
|
+
// this.trackPlayback();
|
|
136
|
+
// },
|
|
137
|
+
|
|
63
138
|
},
|
|
64
139
|
created() {
|
|
65
140
|
this.init();
|
|
@@ -68,25 +143,53 @@
|
|
|
68
143
|
init() {
|
|
69
144
|
if (!this.map) return;
|
|
70
145
|
this.clearLine();
|
|
71
|
-
|
|
146
|
+
|
|
147
|
+
if (!this.model && !this.linenIsert) return;
|
|
72
148
|
this.lastType = this.gpsType;
|
|
73
|
-
|
|
149
|
+
if (this.model) {
|
|
150
|
+
this.insertCache(this.model);
|
|
151
|
+
this._insertLineAndMarker(this.model);
|
|
152
|
+
}
|
|
153
|
+
if (this.linenIsert) {
|
|
154
|
+
this.insertCache(this.linenIsert);
|
|
155
|
+
this._insertLineAndMarker(this.linenIsert);
|
|
156
|
+
}
|
|
157
|
+
},
|
|
158
|
+
insertCache(model) {
|
|
159
|
+
if (model) {
|
|
160
|
+
const {
|
|
161
|
+
playbackColor,
|
|
162
|
+
pointArr
|
|
163
|
+
} = model;
|
|
164
|
+
const len = pointArr.length;
|
|
165
|
+
if (!pointArr.length) return;
|
|
166
|
+
this.len += len;
|
|
167
|
+
this.cacheArr.push(...model.pointArr);
|
|
168
|
+
this.cacheColors.set(this.len,playbackColor);
|
|
169
|
+
this.cacheLenArr.push(len);
|
|
170
|
+
this.marks2[this.len]='';
|
|
171
|
+
this.cacheScales.push(this.len);
|
|
172
|
+
this.cacheModelArr.set(this.len,model);
|
|
173
|
+
}
|
|
74
174
|
},
|
|
75
175
|
_insertLineAndMarker(val) {
|
|
76
|
-
const color = val.color;
|
|
77
176
|
const arr = val.pointArr;
|
|
78
177
|
if (this.isLineFit) {
|
|
178
|
+
|
|
79
179
|
this.calculateLineBBOX(arr);
|
|
80
180
|
}
|
|
81
181
|
this.initMarker(arr[0]);
|
|
82
|
-
if (!val.isAppend
|
|
83
|
-
|
|
182
|
+
if (!val.isAppend) {
|
|
183
|
+
|
|
184
|
+
this._insertPoint(val,[this.lastLineX,this.lastLineY]);
|
|
84
185
|
const line = this.createPolyline(val);
|
|
85
186
|
const len = arr.length - 1;
|
|
86
187
|
this.setMarkerPoint(this.endMarker, arr[len]);
|
|
87
|
-
|
|
188
|
+
const {x,y} = this.restLastData(arr);
|
|
189
|
+
this.lastLineX=x;
|
|
190
|
+
this.lastLineY=y;
|
|
88
191
|
this.pineArr.push(line);
|
|
89
|
-
|
|
192
|
+
return;
|
|
90
193
|
}
|
|
91
194
|
arr.forEach(r => {
|
|
92
195
|
this.appendCoordinate(r);
|
|
@@ -95,6 +198,16 @@
|
|
|
95
198
|
this.setMarkerPoint(this.endMarker, arr[len]);
|
|
96
199
|
this.restLastData(arr);
|
|
97
200
|
},
|
|
201
|
+
_insertLineAndMarker2(val) {
|
|
202
|
+
this._insertPoint(val,[this.lastLineX2,this.lastLineY2]);
|
|
203
|
+
const arr = val.pointArr;
|
|
204
|
+
const line = this.createPolyline(val);
|
|
205
|
+
const {x,y} = this.restLastData(arr);
|
|
206
|
+
this.lastLineX2=x;
|
|
207
|
+
this.lastLineY2=y;
|
|
208
|
+
this.cacheLines.push(line);
|
|
209
|
+
return;
|
|
210
|
+
},
|
|
98
211
|
async calculateLineBBOX(arr) {
|
|
99
212
|
return await new Promise(r => {
|
|
100
213
|
arr.forEach(r => {
|
|
@@ -103,7 +216,14 @@
|
|
|
103
216
|
Y: r[1]
|
|
104
217
|
});
|
|
105
218
|
});
|
|
106
|
-
|
|
219
|
+
|
|
220
|
+
let amGpsArr =[];
|
|
221
|
+
if(this.gpsType){
|
|
222
|
+
amGpsArr = this.am.getLngLatGCJ02();
|
|
223
|
+
}else{
|
|
224
|
+
amGpsArr =this.am.getLngLats();
|
|
225
|
+
}
|
|
226
|
+
|
|
107
227
|
fitNew(this.map, [
|
|
108
228
|
[amGpsArr[0], amGpsArr[1]],
|
|
109
229
|
[amGpsArr[2], amGpsArr[3]]
|
|
@@ -112,7 +232,6 @@
|
|
|
112
232
|
});
|
|
113
233
|
},
|
|
114
234
|
initMarker(arr) {
|
|
115
|
-
|
|
116
235
|
if (!this.startMarkerDto && !this.endMarkerDto) return;
|
|
117
236
|
if (!this.startMarker && !this.endMarker) {
|
|
118
237
|
this.startMarker = this.createStartMarker(this.startMarkerDto, arr);
|
|
@@ -127,20 +246,20 @@
|
|
|
127
246
|
restLastData(arr) {
|
|
128
247
|
if (arr.length > 0) {
|
|
129
248
|
const [x, y] = arr[arr.length - 1];
|
|
130
|
-
|
|
131
|
-
this.lastLineY = y;
|
|
249
|
+
return {x,y};
|
|
132
250
|
}
|
|
133
251
|
},
|
|
134
|
-
_insertPoint(val) {
|
|
135
|
-
|
|
136
|
-
|
|
252
|
+
_insertPoint(val,points) {
|
|
253
|
+
const [x,y]=points;
|
|
254
|
+
if (x > 0 && y > 0 && val) {
|
|
255
|
+
val.pointArr.unshift(points);
|
|
137
256
|
}
|
|
138
257
|
},
|
|
139
258
|
createPolyline(polylineModel = {
|
|
140
259
|
color: 'rgb(0,0,255)',
|
|
141
260
|
width: 2,
|
|
142
261
|
pointArr: [],
|
|
143
|
-
zIndex:
|
|
262
|
+
zIndex: 1,
|
|
144
263
|
}) {
|
|
145
264
|
return new Polyline({
|
|
146
265
|
...polylineModel,
|
|
@@ -198,29 +317,262 @@
|
|
|
198
317
|
this.startMarker = null;
|
|
199
318
|
},
|
|
200
319
|
clearLine() {
|
|
320
|
+
this.resetPyalPanel();
|
|
201
321
|
this.removeLines();
|
|
202
322
|
this.removeLineMarker();
|
|
203
|
-
this.
|
|
323
|
+
this.cacheArr = [];
|
|
204
324
|
this.lastColor = null;
|
|
205
325
|
this.lastLineX = 0;
|
|
206
326
|
this.lastLineY = 0;
|
|
207
327
|
this.am = null;
|
|
208
328
|
this.am = new AM();
|
|
329
|
+
this.marks={};
|
|
330
|
+
this.marks2={};
|
|
331
|
+
this._clearInterval();
|
|
332
|
+
this.clearCacheLines();
|
|
333
|
+
},
|
|
334
|
+
_clearInterval() {
|
|
335
|
+
if (this.intervalId) {
|
|
336
|
+
clearInterval(this.intervalId);
|
|
337
|
+
}
|
|
338
|
+
},
|
|
339
|
+
clearCacheLines() {
|
|
340
|
+
this.endPlaybackLines();
|
|
341
|
+
this.cacheLenArr=[];
|
|
342
|
+
this.cacheArr = [];
|
|
343
|
+
this.cacheColors.clear();
|
|
344
|
+
this.cacheModelArr.clear();
|
|
345
|
+
this.len = 0;
|
|
346
|
+
this.cacheScales=[];
|
|
347
|
+
this.index=0;
|
|
348
|
+
|
|
349
|
+
},
|
|
350
|
+
endPlaybackLines() {
|
|
351
|
+
this._clearInterval();
|
|
352
|
+
this.cacheLines.forEach(r => {
|
|
353
|
+
r.removePolyline();
|
|
354
|
+
});
|
|
355
|
+
if (this.moveMarker) {
|
|
356
|
+
this.map.removeOverlay(this.moveMarker.getMarker());
|
|
357
|
+
}
|
|
358
|
+
this.isPlayback = false;
|
|
359
|
+
this.isStop = false;
|
|
360
|
+
this.cacheLines = [];
|
|
361
|
+
this.cacheLineMaps.clear();
|
|
362
|
+
this.moveMarker = null;
|
|
363
|
+
// this.index = 0;
|
|
364
|
+
// this.lastColor = null;
|
|
365
|
+
this.lastLineX2=0;
|
|
366
|
+
this.lastLineY2=0;
|
|
367
|
+
},
|
|
368
|
+
stopPlaybackLines(val) {
|
|
369
|
+
this.isPlayback = false;
|
|
370
|
+
this.isStop = false;
|
|
371
|
+
if (val) {
|
|
372
|
+
this._clearInterval();
|
|
373
|
+
return;
|
|
374
|
+
}
|
|
375
|
+
this.trackPlayback();
|
|
376
|
+
},
|
|
377
|
+
createTrackLineAndMarker(index = 0,index2=0) {
|
|
378
|
+
const key = index;
|
|
379
|
+
const {
|
|
380
|
+
playbackColor,
|
|
381
|
+
width,
|
|
382
|
+
zIndex
|
|
383
|
+
} = this.cacheModelArr.get(key);
|
|
384
|
+
|
|
385
|
+
const line = this.createPolyline({
|
|
386
|
+
color:playbackColor,
|
|
387
|
+
isAppend: false,
|
|
388
|
+
width,
|
|
389
|
+
pointArr: [],
|
|
390
|
+
zIndex,
|
|
391
|
+
}, this.gpsType);
|
|
392
|
+
this.lastColor = playbackColor;
|
|
393
|
+
this.cacheLines.push(line);
|
|
394
|
+
if (this.moveMarkerDto && !this.moveMarker) {
|
|
395
|
+
this.moveMarker = this.createStartMarker(this.moveMarkerDto, this.cacheArr[index2]);
|
|
396
|
+
}
|
|
397
|
+
},
|
|
398
|
+
trackPlayback() {
|
|
399
|
+
if (!this.cacheLines.length) {
|
|
400
|
+
|
|
401
|
+
this.createTrackLineAndMarker(this.cacheScales[0],0);
|
|
402
|
+
}
|
|
403
|
+
this.intervalId = setInterval(r => {
|
|
404
|
+
if (this.index >= this.len || !this.isPlayback) {
|
|
405
|
+
this._clearInterval();
|
|
406
|
+
this.index=0;
|
|
407
|
+
this.isStop = false;
|
|
408
|
+
this.$emit('trackPlayEvent',{index:this.index,points:[] });
|
|
409
|
+
return;
|
|
410
|
+
}
|
|
411
|
+
const key=this.getKey(this.index);
|
|
412
|
+
if (this.cacheColors.has(key) && !this.cacheLineMaps.has(key)) {
|
|
413
|
+
if (!this.cacheLineMaps.has(key)) {
|
|
414
|
+
this.createTrackLineAndMarker(key,this.index);
|
|
415
|
+
const line = this.cacheLines[this.cacheLines.length - 1];
|
|
416
|
+
this.cacheLineMaps.set(key,line);
|
|
417
|
+
const _index=this.index - 1 == -1 ? 0 : this.index-1;
|
|
418
|
+
line.appendCoordinate(this.cacheArr[_index], this.gpsType);
|
|
419
|
+
this.$emit('trackPlayEvent',{index:this.index, points:this.cacheArr[_index] });
|
|
420
|
+
}
|
|
421
|
+
}
|
|
422
|
+
const line = this.cacheLines[this.cacheLines.length - 1];
|
|
423
|
+
const points = this.cacheArr[this.index];
|
|
424
|
+
this.setMarkerPoint(this.moveMarker, points);
|
|
425
|
+
line.appendCoordinate(points, this.gpsType);
|
|
426
|
+
this.$emit('trackPlayEvent',{index:this.index,points});
|
|
427
|
+
this.index += 1;
|
|
428
|
+
}, this.playSpeed);
|
|
209
429
|
},
|
|
210
430
|
appendCoordinate(coordinate = []) {
|
|
211
431
|
if (!coordinate.length) return;
|
|
212
432
|
if (!this.pineArr.length) {
|
|
213
|
-
|
|
433
|
+
this._insertLineAndMarker({
|
|
434
|
+
...this.lineDto,
|
|
435
|
+
pointArr: [coordinate],
|
|
436
|
+
isAppend: false
|
|
437
|
+
});
|
|
214
438
|
};
|
|
215
439
|
const line = this.pineArr[this.pineArr.length - 1];
|
|
216
|
-
line.appendCoordinate(coordinate);
|
|
440
|
+
line.appendCoordinate(coordinate, this.gpsType);
|
|
441
|
+
},
|
|
442
|
+
formatTooltip(val) {
|
|
443
|
+
return val / 100;
|
|
444
|
+
},
|
|
445
|
+
getKeys(val){
|
|
446
|
+
|
|
447
|
+
const arr =[];
|
|
448
|
+
for(let i=0;i< this.cacheScales.length;i++)
|
|
449
|
+
{
|
|
450
|
+
if(val >= this.cacheScales[i]){
|
|
451
|
+
arr.push(this.cacheScales[i]);
|
|
452
|
+
continue;
|
|
453
|
+
}
|
|
454
|
+
arr.push(this.cacheScales[i]);
|
|
455
|
+
break ;
|
|
456
|
+
}
|
|
457
|
+
|
|
458
|
+
return arr;
|
|
459
|
+
},
|
|
460
|
+
getKey(val){
|
|
461
|
+
|
|
462
|
+
for(let i=0;i< this.cacheScales.length;i++)
|
|
463
|
+
{
|
|
464
|
+
const key=this.cacheScales[i];
|
|
465
|
+
if(val <= key){
|
|
466
|
+
return key;
|
|
467
|
+
}
|
|
468
|
+
}
|
|
469
|
+
return 0;
|
|
470
|
+
},
|
|
471
|
+
createLineModels(keys,points,step){
|
|
472
|
+
const arr =[];
|
|
473
|
+
const _points=[...points];
|
|
474
|
+
if(keys.length <=1 ){
|
|
475
|
+
const key=keys[0];
|
|
476
|
+
const {width,zIndex}=this.cacheModelArr.get(key);
|
|
477
|
+
arr.push({
|
|
478
|
+
isAppend:false,
|
|
479
|
+
color:this.cacheColors.get(key),
|
|
480
|
+
width,
|
|
481
|
+
zIndex,
|
|
482
|
+
pointArr:_points.splice(0,step)
|
|
483
|
+
});
|
|
484
|
+
return arr;
|
|
485
|
+
}
|
|
486
|
+
|
|
487
|
+
for(let i=0;i< keys.length;i++){
|
|
488
|
+
|
|
489
|
+
const key=keys[i];
|
|
490
|
+
const {width,zIndex}=this.cacheModelArr.get(key);
|
|
491
|
+
const pointArr=_points.splice(0,this.cacheLenArr[i]);
|
|
492
|
+
if(pointArr.length){
|
|
493
|
+
const model ={
|
|
494
|
+
color:this.cacheColors.get(key),
|
|
495
|
+
width,
|
|
496
|
+
zIndex,
|
|
497
|
+
pointArr
|
|
498
|
+
};
|
|
499
|
+
arr.push(model);
|
|
500
|
+
// if( i > 1 &&i <keys.length-1){
|
|
501
|
+
// // console.log(points[key-1]);
|
|
502
|
+
// this._insertPoint(model,points[key-1]);
|
|
503
|
+
// }
|
|
504
|
+
|
|
505
|
+
}
|
|
506
|
+
}
|
|
507
|
+
return arr;
|
|
508
|
+
},
|
|
509
|
+
sliderChange(val) {
|
|
510
|
+
this.endPlaybackLines();
|
|
511
|
+
if (val === 0) {
|
|
512
|
+
this.$emit('trackPlayEvent',{index:val,points:[] });
|
|
513
|
+
return;
|
|
514
|
+
}
|
|
515
|
+
const points= this.cacheArr.slice(0,val);
|
|
516
|
+
const arr = this.createLineModels(this.getKeys(val),points,val);
|
|
517
|
+
arr.forEach(r=> this._insertLineAndMarker2(r,false));
|
|
518
|
+
if(points.length){
|
|
519
|
+
this.$emit('trackPlayEvent',{index:val,points:points[points.length-1] });
|
|
520
|
+
}
|
|
521
|
+
if (this.moveMarkerDto && !this.moveMarker && points.length) {
|
|
522
|
+
this.moveMarker = this.createStartMarker(this.moveMarkerDto, points[points.length-1]);
|
|
523
|
+
return;
|
|
524
|
+
}
|
|
525
|
+
|
|
526
|
+
},
|
|
527
|
+
onPlayTrajectory() {
|
|
528
|
+
if (!this.isStop) {
|
|
529
|
+
if(this.index==0){
|
|
530
|
+
this.endPlaybackLines();
|
|
531
|
+
}
|
|
532
|
+
}
|
|
533
|
+
this.isPlayback = true;
|
|
534
|
+
this.isStop = true;
|
|
535
|
+
this.trackPlayback();
|
|
536
|
+
},
|
|
537
|
+
onStopTrajectory() {
|
|
538
|
+
this.isStop = false;
|
|
539
|
+
this._clearInterval();
|
|
540
|
+
},
|
|
541
|
+
|
|
542
|
+
onPlaySpeed(key, val) {
|
|
543
|
+
this.selectActive = this.selectActive.map(v => (v = false));
|
|
544
|
+
this.selectActive[key] = true;
|
|
545
|
+
this.playSpeed = val;
|
|
546
|
+
this.isStop = false;
|
|
547
|
+
this._clearInterval();
|
|
548
|
+
|
|
549
|
+
},
|
|
550
|
+
resetPyalPanel() {
|
|
551
|
+
this.selectActive = [false, true, false, false, false];
|
|
552
|
+
this.playSpeed = 100;
|
|
217
553
|
},
|
|
218
554
|
selectGPSAll(type) {
|
|
555
|
+
this.pineArr.forEach(r => {
|
|
556
|
+
r.selectGPS(type);
|
|
557
|
+
});
|
|
558
|
+
this.endPlaybackLines();
|
|
559
|
+
this.index=0;
|
|
560
|
+
if (this.startMarker) {
|
|
561
|
+
this.startMarker.selectGPS(type);
|
|
562
|
+
}
|
|
219
563
|
|
|
564
|
+
if (this.endMarker) {
|
|
565
|
+
this.endMarker.selectGPS(type);
|
|
566
|
+
}
|
|
567
|
+
|
|
568
|
+
if (this.moveMarker) {
|
|
569
|
+
this.moveMarker.selectGPS(type);
|
|
570
|
+
}
|
|
220
571
|
},
|
|
221
572
|
}
|
|
222
573
|
}
|
|
223
574
|
</script>
|
|
224
575
|
|
|
225
|
-
<style>
|
|
226
|
-
|
|
576
|
+
<style lang="scss" scoped>
|
|
577
|
+
@import "./index.scss";
|
|
578
|
+
</style>
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
</template>
|
|
3
|
+
|
|
4
|
+
<script>
|
|
5
|
+
import {
|
|
6
|
+
fitNew,
|
|
7
|
+
GPS,
|
|
8
|
+
staticImage as StaticImage
|
|
9
|
+
} from 'ry-map';
|
|
10
|
+
import Dto from './../../models/ryStaticLayer/index.js';
|
|
11
|
+
export default {
|
|
12
|
+
name: 'RyStaticLayers',
|
|
13
|
+
props: {
|
|
14
|
+
...new Dto(),
|
|
15
|
+
},
|
|
16
|
+
data() {
|
|
17
|
+
return {
|
|
18
|
+
bbox: [],
|
|
19
|
+
bboxGCJ02: [],
|
|
20
|
+
staticImg:null,
|
|
21
|
+
lastType: -1,
|
|
22
|
+
};
|
|
23
|
+
},
|
|
24
|
+
watch: {
|
|
25
|
+
model(val) {
|
|
26
|
+
this._remove();
|
|
27
|
+
if (!val.length) return;
|
|
28
|
+
this.init(val);
|
|
29
|
+
},
|
|
30
|
+
gpsType(val) {
|
|
31
|
+
if (this.lastType == val) return;
|
|
32
|
+
this.gpsType = val;
|
|
33
|
+
this.lastType = val;
|
|
34
|
+
this.selectGPSAll(this.gpsType);
|
|
35
|
+
},
|
|
36
|
+
clear(val) {
|
|
37
|
+
if (val) {
|
|
38
|
+
this._remove();
|
|
39
|
+
}
|
|
40
|
+
},
|
|
41
|
+
isShow(val) {
|
|
42
|
+
this._isShow(val);
|
|
43
|
+
},
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
},
|
|
47
|
+
|
|
48
|
+
created() {
|
|
49
|
+
this.lastType = this.gpsType;
|
|
50
|
+
this.init(this.model);
|
|
51
|
+
},
|
|
52
|
+
|
|
53
|
+
methods: {
|
|
54
|
+
init(model) {
|
|
55
|
+
// this._insert();
|
|
56
|
+
if (!model) return;
|
|
57
|
+
|
|
58
|
+
this._insert(model);
|
|
59
|
+
if(this.isFit){
|
|
60
|
+
setTimeout(() => {
|
|
61
|
+
this.setFit();
|
|
62
|
+
}, 50);
|
|
63
|
+
};
|
|
64
|
+
},
|
|
65
|
+
_insert(dto) {
|
|
66
|
+
const {
|
|
67
|
+
id,
|
|
68
|
+
url,
|
|
69
|
+
bbox,
|
|
70
|
+
zIndex,
|
|
71
|
+
} = dto;
|
|
72
|
+
const img = new StaticImage({
|
|
73
|
+
id,
|
|
74
|
+
url,
|
|
75
|
+
imageExtent:bbox,
|
|
76
|
+
zIndex,
|
|
77
|
+
type:this.gpsType
|
|
78
|
+
},
|
|
79
|
+
this.map);
|
|
80
|
+
this.staticImg=img;
|
|
81
|
+
|
|
82
|
+
this.setBBOXArr(bbox);
|
|
83
|
+
},
|
|
84
|
+
setBBOXArr(bbox) {
|
|
85
|
+
this.bbox.push(bbox);
|
|
86
|
+
const _bboxGCJ02 = this.convertBBoxGCJ02(bbox);
|
|
87
|
+
this.bboxGCJ02.push(_bboxGCJ02);
|
|
88
|
+
},
|
|
89
|
+
|
|
90
|
+
setFit() {
|
|
91
|
+
if (!this.bbox.length || !this.map) return;
|
|
92
|
+
if (this.bbox.length > 1) {
|
|
93
|
+
fitNew(this.map, this.gpsType == 1 ? this.bboxGCJ02 : this.bbox);
|
|
94
|
+
|
|
95
|
+
return;
|
|
96
|
+
}
|
|
97
|
+
this.setFitFist(this.gpsType == 1 ? this.bboxGCJ02[0] : this.bbox[0]);
|
|
98
|
+
},
|
|
99
|
+
// bbox.length =1 执行此处
|
|
100
|
+
setFitFist(bbox) {
|
|
101
|
+
const bbox2 = [bbox[0], bbox[3], bbox[2], bbox[1]];
|
|
102
|
+
const bbox3 = [bbox[2], bbox[1], bbox[0], bbox[3]];
|
|
103
|
+
fitNew(this.map, [bbox2, bbox3]);
|
|
104
|
+
},
|
|
105
|
+
convertBBoxGCJ02(bbox) {
|
|
106
|
+
const pointArr = [];
|
|
107
|
+
const {
|
|
108
|
+
lat,
|
|
109
|
+
lon
|
|
110
|
+
} = GPS.gcj_encrypt(bbox[0], bbox[1]);
|
|
111
|
+
const {
|
|
112
|
+
lon: lon2,
|
|
113
|
+
lat: lat2
|
|
114
|
+
} = GPS.gcj_encrypt(bbox[2], bbox[3]);
|
|
115
|
+
pointArr.push(lon);
|
|
116
|
+
pointArr.push(lat);
|
|
117
|
+
pointArr.push(lon2);
|
|
118
|
+
pointArr.push(lat2);
|
|
119
|
+
return pointArr;
|
|
120
|
+
},
|
|
121
|
+
|
|
122
|
+
_remove() {
|
|
123
|
+
if(this.staticImg){
|
|
124
|
+
this.staticImg.removeImageLayer();
|
|
125
|
+
}
|
|
126
|
+
this.staticImg=null;
|
|
127
|
+
this.bbox = [];
|
|
128
|
+
this.bboxGCJ02=[];
|
|
129
|
+
|
|
130
|
+
},
|
|
131
|
+
|
|
132
|
+
selectGPSAll(type) {
|
|
133
|
+
if(this.staticImg){
|
|
134
|
+
this.staticImg.selectGPS(type);
|
|
135
|
+
}
|
|
136
|
+
},
|
|
137
|
+
|
|
138
|
+
_isShow(val) {
|
|
139
|
+
if (this.staticImg) {
|
|
140
|
+
const img = this.staticImg;
|
|
141
|
+
if (val) {
|
|
142
|
+
img.show();
|
|
143
|
+
return;
|
|
144
|
+
}
|
|
145
|
+
img.hide();
|
|
146
|
+
}
|
|
147
|
+
},
|
|
148
|
+
|
|
149
|
+
},
|
|
150
|
+
}
|
|
151
|
+
</script>
|
|
152
|
+
|
|
153
|
+
<style>
|
|
154
|
+
</style>
|