calcGeolocation.js
829 Bytes
1
2
3
4
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
import calcDistanceFromCoord from '@/utils/CommonFunction/calcDistanceFromCoord';
import calcAngleFromCoord from '@/utils/CommonFunction/calcAngleFromCoord';
export default {
data() {
return {
};
},
computed: {
calcAngle() {
return (oldVal, newVal) => calcAngleFromCoord(oldVal, newVal);
},
calcVelocity() {
return (oldVal, newVal) => `${calcDistanceFromCoord(oldVal, newVal)}m/s`;
},
calcDistance() {
return (logs) => {
let sum = 0;
for (let i = 1; i < logs.length; i += 1) {
const oldVal = logs[i - 1];
const newVal = logs[i];
sum += calcDistanceFromCoord(oldVal, newVal);
}
return sum;
};
},
},
watch: {
},
created() {
},
mounted() {
},
beforeDestroy() {
},
methods: {
},
};