incyclist-services 1.3.20 → 1.3.21
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/activities/ride/service.js +6 -1
- package/lib/maps/ways/MapArea.d.ts +110 -0
- package/lib/maps/ways/MapArea.js +1194 -0
- package/lib/maps/ways/consts.d.ts +6 -0
- package/lib/maps/ways/consts.js +9 -0
- package/lib/maps/ways/service.d.ts +51 -0
- package/lib/maps/ways/service.js +561 -0
- package/lib/maps/ways/types.d.ts +81 -0
- package/lib/maps/ways/types.js +2 -0
- package/lib/maps/ways/utils.d.ts +60 -0
- package/lib/maps/ways/utils.js +619 -0
- package/lib/routes/base/parsers/incyclist.d.ts +3 -0
- package/lib/routes/base/parsers/incyclist.js +50 -1
- package/lib/routes/base/parsers/types.d.ts +5 -0
- package/lib/routes/base/types/index.d.ts +4 -4
- package/lib/routes/base/types/index.js +1 -0
- package/lib/routes/download/service.js +5 -1
- package/lib/settings/user/service.js +1 -1
- package/lib/utils/geo.d.ts +1 -0
- package/lib/utils/geo.js +57 -1
- package/lib/utils/index.d.ts +2 -0
- package/lib/utils/index.js +2 -0
- package/lib/utils/merge.js +3 -0
- package/lib/utils/time.d.ts +1 -0
- package/lib/utils/time.js +9 -0
- package/lib/utils/vector.d.ts +23 -0
- package/lib/utils/vector.js +201 -0
- package/lib/utils/xml.d.ts +1 -0
- package/lib/utils/xml.js +9 -2
- package/package.json +2 -2
|
@@ -430,7 +430,7 @@ let ActivityRideService = (() => {
|
|
|
430
430
|
}
|
|
431
431
|
const logs = ai.details.logs;
|
|
432
432
|
const totalDistance = ai.summary.distance;
|
|
433
|
-
if (current.distance > totalDistance)
|
|
433
|
+
if (!(current === null || current === void 0 ? void 0 : current.distance) || current.distance > totalDistance)
|
|
434
434
|
return null;
|
|
435
435
|
let prev = undefined;
|
|
436
436
|
let res = (0, clone_1.default)(logs.find((log, idx) => {
|
|
@@ -443,6 +443,9 @@ let ActivityRideService = (() => {
|
|
|
443
443
|
}));
|
|
444
444
|
if (!res) {
|
|
445
445
|
res = (0, clone_1.default)(logs[logs.length - 1]);
|
|
446
|
+
if (!res) {
|
|
447
|
+
return null;
|
|
448
|
+
}
|
|
446
449
|
}
|
|
447
450
|
else {
|
|
448
451
|
if (Math.abs(res.time - current.time) > 0.1) {
|
|
@@ -471,6 +474,8 @@ let ActivityRideService = (() => {
|
|
|
471
474
|
}
|
|
472
475
|
return false;
|
|
473
476
|
}));
|
|
477
|
+
if (!res)
|
|
478
|
+
return null;
|
|
474
479
|
const s = res.distance - current.distance;
|
|
475
480
|
const v = res.speed / 3.6;
|
|
476
481
|
const t = v === 0 ? Infinity : s / v;
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
export default class MapAreaService {
|
|
2
|
+
static consts: {
|
|
3
|
+
DEFAULT_RADIUS: number;
|
|
4
|
+
DEFAULT_MIN_WAYS: number;
|
|
5
|
+
DEFAULT_MAX_WAYS: number;
|
|
6
|
+
MAX_DISTANCE_FROM_PATH: number;
|
|
7
|
+
GET_WAYS_IN_AREA: string;
|
|
8
|
+
};
|
|
9
|
+
static _instances: {};
|
|
10
|
+
static getInstance(id?: string): any;
|
|
11
|
+
constructor(props?: any);
|
|
12
|
+
init(props: any): void;
|
|
13
|
+
isInitialized(): boolean;
|
|
14
|
+
load(callback: any): Promise<void>;
|
|
15
|
+
setData(openmapData: any, callback: any): void;
|
|
16
|
+
_collectRoundabout(way: any): any[];
|
|
17
|
+
static _generateID(ways: any): any;
|
|
18
|
+
_replaceWayID(way: any, newId: any, replaceLookup?: boolean): any;
|
|
19
|
+
_checkRoundabouts(): void;
|
|
20
|
+
setLocation(location: any, reload: any, onLoaded: any): void;
|
|
21
|
+
_buildQuery(template: any): any;
|
|
22
|
+
getNearestPath(point: any): {
|
|
23
|
+
path: any;
|
|
24
|
+
distance: any;
|
|
25
|
+
way: any;
|
|
26
|
+
};
|
|
27
|
+
static _getNearestPath(point: any, ways: any): {
|
|
28
|
+
path: any;
|
|
29
|
+
distance: any;
|
|
30
|
+
way: any;
|
|
31
|
+
};
|
|
32
|
+
static _isWithinRange(distance: any): boolean;
|
|
33
|
+
static _isOnPath(point: any, way: any): boolean;
|
|
34
|
+
static _isBetween(point: any, p1: any, p2: any): {
|
|
35
|
+
between: boolean;
|
|
36
|
+
offset: any;
|
|
37
|
+
};
|
|
38
|
+
static _distanceToPath(point: any, way: any): any;
|
|
39
|
+
static addNode(node: any, nodesLookup: any, id: any, path: any): void;
|
|
40
|
+
static addWay(w: any, ways: any, waysLookup: any): void;
|
|
41
|
+
static updateTypeStats(types: any, type: any): void;
|
|
42
|
+
static _parse(str: any, filter: any): {
|
|
43
|
+
ways: any[];
|
|
44
|
+
nodesLookup: any[];
|
|
45
|
+
waysLookup: any[];
|
|
46
|
+
typeStats: any[];
|
|
47
|
+
};
|
|
48
|
+
splitAtFirstBranch(way: any): {
|
|
49
|
+
way: {
|
|
50
|
+
id: any;
|
|
51
|
+
path: any[];
|
|
52
|
+
};
|
|
53
|
+
branches: any[];
|
|
54
|
+
};
|
|
55
|
+
getWay(props: any): any;
|
|
56
|
+
getNode(props: any): any;
|
|
57
|
+
copyWay(wayFrom: any, id: any): {
|
|
58
|
+
w: any;
|
|
59
|
+
roundabout: boolean;
|
|
60
|
+
};
|
|
61
|
+
checkOptionsOnCurrentWay(location: any, way: any, options: any): void;
|
|
62
|
+
splitWayAtPoint(w: any, location: any): {
|
|
63
|
+
id: any;
|
|
64
|
+
path: any[];
|
|
65
|
+
}[];
|
|
66
|
+
checkOptionsOnDifferentWay(location: any, w: any, options: any): any;
|
|
67
|
+
removeDuplicates(options: any): any;
|
|
68
|
+
_getNextOptions(loc: any, way: any, way1: any, status: any): any[];
|
|
69
|
+
getNextOptions(way: any, way1: any, reload: boolean, props: any): Promise<unknown>;
|
|
70
|
+
static _isCrossing(way1: any, way2: any, exact?: boolean): any[];
|
|
71
|
+
static _crossing(A: any, B: any, C: any, D: any, exact?: boolean): any;
|
|
72
|
+
static _getBoundary(location: any, radius: any): {
|
|
73
|
+
northeast: {};
|
|
74
|
+
southwest: {};
|
|
75
|
+
};
|
|
76
|
+
isWithinBoundary(location: any): boolean;
|
|
77
|
+
static _generateQuery(location: any, radius: any): string;
|
|
78
|
+
static _boundaryToString(boundary: any): string;
|
|
79
|
+
}
|
|
80
|
+
export declare function splitAtPointInfo(way: any, pointInfo: any): any[][];
|
|
81
|
+
export declare function getUntilFirstBranch(w: any, props: any): any;
|
|
82
|
+
export declare function isRoundabout(w: any, strictCheck?: boolean): boolean;
|
|
83
|
+
export declare function splitAtIndex(way: any, idxSplit: any): any[][];
|
|
84
|
+
export declare function splitAtPoint(way: any, point: any): {
|
|
85
|
+
id: any;
|
|
86
|
+
path: any[];
|
|
87
|
+
}[];
|
|
88
|
+
export declare function pointEquals(p1: any, p2: any): boolean;
|
|
89
|
+
export declare function isWay(p: any): boolean;
|
|
90
|
+
export declare function isNode(p: any): boolean;
|
|
91
|
+
export declare function isAllowed(way: any, from: any, to: any): boolean;
|
|
92
|
+
export declare function isOneWay(way: any): boolean;
|
|
93
|
+
export declare function getFirstBranch(way: any, ignore: any): any;
|
|
94
|
+
export declare function findAdditional(a1: any, a2: any, id3: any, fn: any): any[];
|
|
95
|
+
export declare function _getPointOnLine(point: any, p1: any, p2: any): any;
|
|
96
|
+
export declare function getPointCrossingPath(point: any, path: any, closest?: boolean): any;
|
|
97
|
+
export declare function getCrossingInfo(way1: any, way2: any): any;
|
|
98
|
+
export declare function getVector(p1: any, p2: any): any;
|
|
99
|
+
export declare function getBounds(lat: any, lng: any, offset: any): {
|
|
100
|
+
northeast: {};
|
|
101
|
+
southwest: {};
|
|
102
|
+
};
|
|
103
|
+
export declare function isWithinBoundary(location: any, boundary: any): boolean;
|
|
104
|
+
export declare function initialBearingTo(p1: any, p2: any): any;
|
|
105
|
+
export declare function alongTrackDistanceTo(point: any, pathStart: any, pathEnd: any, radius?: number): number;
|
|
106
|
+
export declare function destinationPoint(start: any, distance: any, bearing: any, radius?: number): {
|
|
107
|
+
lat: any;
|
|
108
|
+
lng: any;
|
|
109
|
+
};
|
|
110
|
+
export declare const useMapArea: (id: any) => any;
|