ry-vue-map 0.4.7 → 0.4.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/README.MD +1 -1
- package/lib/ryui.common.js +57 -45
- 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 +57 -45
- 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/components/maps/ryLines/src/index.vue +168 -129
- package/src/views/map/index.vue +714 -200
package/lib/ryui.umd.min.js.gz
CHANGED
|
Binary file
|
package/package.json
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
<button class="button-stop" @click.stop="onStopTrajectory()" v-else></button>
|
|
8
8
|
</el-col>
|
|
9
9
|
<el-col style="margin-left: 30px;" :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"
|
|
10
|
+
<el-slider v-model="index" :marks="marks" show-tooltip :step="1" :min="0" :max="cacheArr.length - 1"
|
|
11
11
|
@change="sliderChange" :format-tooltip="formatTooltip"></el-slider>
|
|
12
12
|
</el-col>
|
|
13
13
|
</el-row>
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
<el-col>
|
|
16
16
|
<section class="control-panel">
|
|
17
17
|
<span>播放倍速:</span>
|
|
18
|
-
|
|
18
|
+
<span :class="{ active: selectActive[0] }" @click.stop="onPlaySpeed(0, 200)">0.5x</span>
|
|
19
19
|
<span :class="{ active: selectActive[1] }" @click.stop="onPlaySpeed(1, 100)">正常</span>
|
|
20
20
|
<span :class="{ active: selectActive[2] }" @click.stop="onPlaySpeed(2, 50)">1.5x</span>
|
|
21
21
|
<span :class="{ active: selectActive[3] }" @click.stop="onPlaySpeed(3, 5)">2.0x</span>
|
|
@@ -72,10 +72,10 @@
|
|
|
72
72
|
intervalId: null,
|
|
73
73
|
selectActive: [false, true, false, false],
|
|
74
74
|
marks: {
|
|
75
|
-
|
|
75
|
+
|
|
76
76
|
},
|
|
77
77
|
marks2: {
|
|
78
|
-
|
|
78
|
+
|
|
79
79
|
},
|
|
80
80
|
// 轨迹回放
|
|
81
81
|
isPlayback: false,
|
|
@@ -105,20 +105,21 @@
|
|
|
105
105
|
},
|
|
106
106
|
lineAppend(val) {
|
|
107
107
|
if (val.length > 0 && this.map) {
|
|
108
|
+
console.log('lineAppend==============');
|
|
108
109
|
this.appendCoordinate(val);
|
|
109
110
|
this.setMarkerPoint(this.endMarker, val);
|
|
110
111
|
}
|
|
111
112
|
},
|
|
112
|
-
isShowPlayback(val){
|
|
113
|
-
if(!val){
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
113
|
+
isShowPlayback(val) {
|
|
114
|
+
if (!val) {
|
|
115
|
+
this.endPlaybackLines();
|
|
116
|
+
this.index = 0;
|
|
117
|
+
this.resetPyalPanel();
|
|
118
|
+
return;
|
|
118
119
|
}
|
|
119
120
|
delete this.marks2[this.len];
|
|
120
|
-
this.marks=this.marks2;
|
|
121
|
-
|
|
121
|
+
this.marks = this.marks2;
|
|
122
|
+
|
|
122
123
|
}
|
|
123
124
|
// isPlayback(val){
|
|
124
125
|
// if(val){
|
|
@@ -161,34 +162,37 @@
|
|
|
161
162
|
playbackColor,
|
|
162
163
|
pointArr
|
|
163
164
|
} = model;
|
|
164
|
-
if(!pointArr) return;
|
|
165
|
+
if (!pointArr) return;
|
|
165
166
|
const len = pointArr.length;
|
|
166
167
|
if (!pointArr.length) return;
|
|
167
168
|
this.len += len;
|
|
168
169
|
this.cacheArr.push(...model.pointArr);
|
|
169
|
-
this.cacheColors.set(this.len,playbackColor);
|
|
170
|
+
this.cacheColors.set(this.len, playbackColor);
|
|
170
171
|
this.cacheLenArr.push(len);
|
|
171
|
-
|
|
172
|
+
this.marks2[this.len] = '';
|
|
172
173
|
this.cacheScales.push(this.len);
|
|
173
|
-
|
|
174
|
+
this.cacheModelArr.set(this.len, model);
|
|
174
175
|
}
|
|
175
176
|
},
|
|
176
177
|
_insertLineAndMarker(val) {
|
|
177
178
|
const arr = val.pointArr;
|
|
178
179
|
if (this.isLineFit) {
|
|
179
|
-
|
|
180
|
+
|
|
180
181
|
this.calculateLineBBOX(arr);
|
|
181
182
|
}
|
|
182
183
|
this.initMarker(arr[0]);
|
|
183
184
|
if (!val.isAppend) {
|
|
184
185
|
|
|
185
|
-
this._insertPoint(val,[this.lastLineX,this.lastLineY]);
|
|
186
|
+
this._insertPoint(val, [this.lastLineX, this.lastLineY]);
|
|
186
187
|
const line = this.createPolyline(val);
|
|
187
188
|
const len = arr.length - 1;
|
|
188
189
|
this.setMarkerPoint(this.endMarker, arr[len]);
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
190
|
+
const {
|
|
191
|
+
x,
|
|
192
|
+
y
|
|
193
|
+
} = this.restLastData(arr);
|
|
194
|
+
this.lastLineX = x;
|
|
195
|
+
this.lastLineY = y;
|
|
192
196
|
this.pineArr.push(line);
|
|
193
197
|
return;
|
|
194
198
|
}
|
|
@@ -200,14 +204,17 @@
|
|
|
200
204
|
this.restLastData(arr);
|
|
201
205
|
},
|
|
202
206
|
_insertLineAndMarker2(val) {
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
207
|
+
this._insertPoint(val, [this.lastLineX2, this.lastLineY2]);
|
|
208
|
+
const arr = val.pointArr;
|
|
209
|
+
const line = this.createPolyline(val);
|
|
210
|
+
const {
|
|
211
|
+
x,
|
|
212
|
+
y
|
|
213
|
+
} = this.restLastData(arr);
|
|
214
|
+
this.lastLineX2 = x;
|
|
215
|
+
this.lastLineY2 = y;
|
|
216
|
+
this.cacheLines.push(line);
|
|
217
|
+
return;
|
|
211
218
|
},
|
|
212
219
|
async calculateLineBBOX(arr) {
|
|
213
220
|
return await new Promise(r => {
|
|
@@ -218,13 +225,13 @@
|
|
|
218
225
|
});
|
|
219
226
|
});
|
|
220
227
|
|
|
221
|
-
let amGpsArr =[];
|
|
222
|
-
if(this.gpsType){
|
|
228
|
+
let amGpsArr = [];
|
|
229
|
+
if (this.gpsType) {
|
|
223
230
|
amGpsArr = this.am.getLngLatGCJ02();
|
|
224
|
-
}else{
|
|
225
|
-
amGpsArr =this.am.getLngLats();
|
|
231
|
+
} else {
|
|
232
|
+
amGpsArr = this.am.getLngLats();
|
|
226
233
|
}
|
|
227
|
-
|
|
234
|
+
|
|
228
235
|
fitNew(this.map, [
|
|
229
236
|
[amGpsArr[0], amGpsArr[1]],
|
|
230
237
|
[amGpsArr[2], amGpsArr[3]]
|
|
@@ -247,11 +254,14 @@
|
|
|
247
254
|
restLastData(arr) {
|
|
248
255
|
if (arr.length > 0) {
|
|
249
256
|
const [x, y] = arr[arr.length - 1];
|
|
250
|
-
return {
|
|
257
|
+
return {
|
|
258
|
+
x,
|
|
259
|
+
y
|
|
260
|
+
};
|
|
251
261
|
}
|
|
252
262
|
},
|
|
253
|
-
_insertPoint(val,points) {
|
|
254
|
-
const [x,y]=points;
|
|
263
|
+
_insertPoint(val, points) {
|
|
264
|
+
const [x, y] = points;
|
|
255
265
|
if (x > 0 && y > 0 && val) {
|
|
256
266
|
val.pointArr.unshift(points);
|
|
257
267
|
}
|
|
@@ -327,8 +337,8 @@
|
|
|
327
337
|
this.lastLineY = 0;
|
|
328
338
|
this.am = null;
|
|
329
339
|
this.am = new AM();
|
|
330
|
-
this.marks={};
|
|
331
|
-
this.marks2={};
|
|
340
|
+
this.marks = {};
|
|
341
|
+
this.marks2 = {};
|
|
332
342
|
this._clearInterval();
|
|
333
343
|
this.clearCacheLines();
|
|
334
344
|
},
|
|
@@ -339,14 +349,14 @@
|
|
|
339
349
|
},
|
|
340
350
|
clearCacheLines() {
|
|
341
351
|
this.endPlaybackLines();
|
|
342
|
-
this.cacheLenArr=[];
|
|
352
|
+
this.cacheLenArr = [];
|
|
343
353
|
this.cacheArr = [];
|
|
344
354
|
this.cacheColors.clear();
|
|
345
355
|
this.cacheModelArr.clear();
|
|
346
356
|
this.len = 0;
|
|
347
|
-
this.cacheScales=[];
|
|
348
|
-
this.index=0;
|
|
349
|
-
|
|
357
|
+
this.cacheScales = [];
|
|
358
|
+
this.index = 0;
|
|
359
|
+
|
|
350
360
|
},
|
|
351
361
|
endPlaybackLines() {
|
|
352
362
|
this._clearInterval();
|
|
@@ -363,8 +373,8 @@
|
|
|
363
373
|
this.moveMarker = null;
|
|
364
374
|
// this.index = 0;
|
|
365
375
|
// this.lastColor = null;
|
|
366
|
-
this.lastLineX2=0;
|
|
367
|
-
this.lastLineY2=0;
|
|
376
|
+
this.lastLineX2 = 0;
|
|
377
|
+
this.lastLineY2 = 0;
|
|
368
378
|
},
|
|
369
379
|
stopPlaybackLines(val) {
|
|
370
380
|
this.isPlayback = false;
|
|
@@ -375,7 +385,7 @@
|
|
|
375
385
|
}
|
|
376
386
|
this.trackPlayback();
|
|
377
387
|
},
|
|
378
|
-
createTrackLineAndMarker(index = 0,index2=0) {
|
|
388
|
+
createTrackLineAndMarker(index = 0, index2 = 0) {
|
|
379
389
|
const key = index;
|
|
380
390
|
const {
|
|
381
391
|
playbackColor,
|
|
@@ -384,7 +394,7 @@
|
|
|
384
394
|
} = this.cacheModelArr.get(key);
|
|
385
395
|
|
|
386
396
|
const line = this.createPolyline({
|
|
387
|
-
color:playbackColor,
|
|
397
|
+
color: playbackColor,
|
|
388
398
|
isAppend: false,
|
|
389
399
|
width,
|
|
390
400
|
pointArr: [],
|
|
@@ -398,38 +408,56 @@
|
|
|
398
408
|
},
|
|
399
409
|
trackPlayback() {
|
|
400
410
|
if (!this.cacheLines.length) {
|
|
401
|
-
this.createTrackLineAndMarker(this.cacheScales[0],0);
|
|
411
|
+
this.createTrackLineAndMarker(this.cacheScales[0], 0);
|
|
402
412
|
}
|
|
403
413
|
this.intervalId = setInterval(r => {
|
|
404
|
-
|
|
414
|
+
|
|
405
415
|
if (this.index >= this.len - 1 || !this.isPlayback) {
|
|
416
|
+
|
|
417
|
+
const line = this.cacheLines[this.cacheLines.length - 1];
|
|
418
|
+
const points = this.cacheArr[this.index];
|
|
419
|
+
this.setMarkerPoint(this.moveMarker, points);
|
|
420
|
+
line.appendCoordinate(points, this.gpsType);
|
|
421
|
+
this.$emit('trackPlayEvent', {
|
|
422
|
+
index: this.index,
|
|
423
|
+
points
|
|
424
|
+
});
|
|
425
|
+
|
|
406
426
|
this._clearInterval();
|
|
407
|
-
this.index=0;
|
|
427
|
+
this.index = 0;
|
|
408
428
|
this.isStop = false;
|
|
409
|
-
this.$emit('trackPlayEvent',{
|
|
429
|
+
this.$emit('trackPlayEvent', {
|
|
430
|
+
index: this.index,
|
|
431
|
+
points: this.cacheArr[0]
|
|
432
|
+
});
|
|
410
433
|
return;
|
|
411
|
-
}
|
|
412
|
-
const key=this.getKey(this.index);
|
|
434
|
+
}
|
|
435
|
+
const key = this.getKey(this.index);
|
|
413
436
|
if (this.cacheColors.has(key) && !this.cacheLineMaps.has(key)) {
|
|
414
437
|
if (!this.cacheLineMaps.has(key)) {
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
438
|
+
this.createTrackLineAndMarker(key, this.index);
|
|
439
|
+
const line = this.cacheLines[this.cacheLines.length - 1];
|
|
440
|
+
this.cacheLineMaps.set(key, line);
|
|
441
|
+
const _index = this.index - 1 == -1 ? 0 : this.index - 1;
|
|
442
|
+
line.appendCoordinate(this.cacheArr[_index], this.gpsType);
|
|
443
|
+
// this.$emit('trackPlayEvent',{index:this.index, points:this.cacheArr[_index] });
|
|
421
444
|
}
|
|
422
445
|
}
|
|
423
446
|
const line = this.cacheLines[this.cacheLines.length - 1];
|
|
424
447
|
const points = this.cacheArr[this.index];
|
|
425
448
|
this.setMarkerPoint(this.moveMarker, points);
|
|
426
449
|
line.appendCoordinate(points, this.gpsType);
|
|
427
|
-
this.$emit('trackPlayEvent',{
|
|
450
|
+
this.$emit('trackPlayEvent', {
|
|
451
|
+
index: this.index,
|
|
452
|
+
points
|
|
453
|
+
});
|
|
428
454
|
this.index += 1;
|
|
429
455
|
}, this.playSpeed);
|
|
430
456
|
},
|
|
431
457
|
appendCoordinate(coordinate = []) {
|
|
458
|
+
console.log('appendCoordinat===', coordinate.length, coordinate,'gpstype===',this.gpsType);
|
|
432
459
|
if (!coordinate.length) return;
|
|
460
|
+
|
|
433
461
|
if (!this.pineArr.length) {
|
|
434
462
|
this._insertLineAndMarker({
|
|
435
463
|
...this.lineDto,
|
|
@@ -438,96 +466,107 @@
|
|
|
438
466
|
});
|
|
439
467
|
};
|
|
440
468
|
const line = this.pineArr[this.pineArr.length - 1];
|
|
469
|
+
console.log(line);
|
|
441
470
|
line.appendCoordinate(coordinate, this.gpsType);
|
|
442
471
|
},
|
|
443
472
|
formatTooltip(val) {
|
|
444
473
|
return val / 100;
|
|
445
474
|
},
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
const arr =[];
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
continue;
|
|
475
|
+
getKeys(val) {
|
|
476
|
+
|
|
477
|
+
const arr = [];
|
|
478
|
+
for (let i = 0; i < this.cacheScales.length; i++) {
|
|
479
|
+
if (val >= this.cacheScales[i]) {
|
|
480
|
+
arr.push(this.cacheScales[i]);
|
|
481
|
+
continue;
|
|
454
482
|
}
|
|
455
483
|
arr.push(this.cacheScales[i]);
|
|
456
|
-
break
|
|
484
|
+
break;
|
|
457
485
|
}
|
|
458
486
|
|
|
459
487
|
return arr;
|
|
460
488
|
},
|
|
461
|
-
getKey(val){
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
return key;
|
|
489
|
+
getKey(val) {
|
|
490
|
+
|
|
491
|
+
for (let i = 0; i < this.cacheScales.length; i++) {
|
|
492
|
+
const key = this.cacheScales[i];
|
|
493
|
+
if (val <= key) {
|
|
494
|
+
return key;
|
|
468
495
|
}
|
|
469
496
|
}
|
|
470
497
|
return 0;
|
|
471
498
|
},
|
|
472
|
-
createLineModels(keys,points,step){
|
|
473
|
-
const arr =[];
|
|
474
|
-
const _points=[...points];
|
|
475
|
-
if(keys.length <=1
|
|
476
|
-
|
|
477
|
-
const
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
499
|
+
createLineModels(keys, points, step) {
|
|
500
|
+
const arr = [];
|
|
501
|
+
const _points = [...points];
|
|
502
|
+
if (keys.length <= 1) {
|
|
503
|
+
|
|
504
|
+
const key = keys[0];
|
|
505
|
+
const {
|
|
506
|
+
width,
|
|
507
|
+
zIndex
|
|
508
|
+
} = this.cacheModelArr.get(key);
|
|
509
|
+
arr.push({
|
|
510
|
+
isAppend: false,
|
|
511
|
+
color: this.cacheColors.get(key),
|
|
512
|
+
width,
|
|
513
|
+
zIndex,
|
|
514
|
+
pointArr: _points.splice(0, step + 1)
|
|
515
|
+
});
|
|
485
516
|
return arr;
|
|
486
517
|
}
|
|
487
|
-
|
|
488
|
-
for(let i=0;i< keys.length;i++){
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
const
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
518
|
+
|
|
519
|
+
for (let i = 0; i < keys.length; i++) {
|
|
520
|
+
const key = keys[i];
|
|
521
|
+
const {
|
|
522
|
+
width,
|
|
523
|
+
zIndex
|
|
524
|
+
} = this.cacheModelArr.get(key);
|
|
525
|
+
const pointArr = _points.splice(0, this.cacheLenArr[i]);
|
|
526
|
+
if (pointArr.length) {
|
|
527
|
+
const model = {
|
|
528
|
+
color: this.cacheColors.get(key),
|
|
529
|
+
width,
|
|
530
|
+
zIndex,
|
|
531
|
+
pointArr
|
|
532
|
+
};
|
|
533
|
+
arr.push(model);
|
|
534
|
+
// if( i > 1 &&i <keys.length-1){
|
|
535
|
+
// this._insertPoint(model,points[key-1]);
|
|
536
|
+
// }
|
|
537
|
+
|
|
538
|
+
}
|
|
506
539
|
}
|
|
507
|
-
|
|
540
|
+
return arr;
|
|
508
541
|
},
|
|
509
542
|
sliderChange(val) {
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
this
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
this
|
|
543
|
+
this.endPlaybackLines();
|
|
544
|
+
if (val === 0) {
|
|
545
|
+
this.$emit('trackPlayEvent', {
|
|
546
|
+
index: val,
|
|
547
|
+
points: this.cacheArr[0]
|
|
548
|
+
});
|
|
549
|
+
return;
|
|
550
|
+
}
|
|
551
|
+
const points = this.cacheArr.slice(0, val + 1);
|
|
552
|
+
const arr = this.createLineModels(this.getKeys(val), points, val);
|
|
553
|
+
arr.forEach(r => this._insertLineAndMarker2(r, false));
|
|
554
|
+
if (points.length) {
|
|
555
|
+
this.$emit('trackPlayEvent', {
|
|
556
|
+
index: val,
|
|
557
|
+
points: points[points.length - 1]
|
|
558
|
+
});
|
|
559
|
+
}
|
|
560
|
+
if (this.moveMarkerDto && !this.moveMarker && points.length) {
|
|
561
|
+
this.moveMarker = this.createStartMarker(this.moveMarkerDto, points[points.length - 1]);
|
|
523
562
|
return;
|
|
524
|
-
|
|
525
|
-
|
|
563
|
+
}
|
|
564
|
+
|
|
526
565
|
},
|
|
527
|
-
onPlayTrajectory() {
|
|
528
|
-
|
|
529
|
-
if(this.index==0){
|
|
530
|
-
|
|
566
|
+
onPlayTrajectory() {
|
|
567
|
+
if (!this.isStop) {
|
|
568
|
+
if (this.index == 0) {
|
|
569
|
+
this.endPlaybackLines();
|
|
531
570
|
}
|
|
532
571
|
}
|
|
533
572
|
this.isPlayback = true;
|
|
@@ -556,7 +595,7 @@
|
|
|
556
595
|
r.selectGPS(type);
|
|
557
596
|
});
|
|
558
597
|
this.endPlaybackLines();
|
|
559
|
-
|
|
598
|
+
this.index = 0;
|
|
560
599
|
if (this.startMarker) {
|
|
561
600
|
this.startMarker.selectGPS(type);
|
|
562
601
|
}
|