incyclist-services 1.3.19 → 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/base/model/index.d.ts +4 -0
- package/lib/activities/base/repo/db.js +3 -0
- package/lib/activities/base/repo/types.d.ts +1 -0
- package/lib/activities/base/utils/index.js +2 -2
- package/lib/activities/ride/service.js +10 -2
- 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
|
@@ -60,6 +60,8 @@ export type ActivitySummary = {
|
|
|
60
60
|
rideTime: number;
|
|
61
61
|
distance: number;
|
|
62
62
|
startPos: number;
|
|
63
|
+
endPos?: number;
|
|
64
|
+
segment?: string;
|
|
63
65
|
realityFactor: number;
|
|
64
66
|
uploadStatus: Array<UploadInfo>;
|
|
65
67
|
isCompleted?: boolean;
|
|
@@ -133,6 +135,8 @@ export interface ActivityDetails {
|
|
|
133
135
|
timePause: number;
|
|
134
136
|
distance: number;
|
|
135
137
|
startPos: number;
|
|
138
|
+
endPos?: number;
|
|
139
|
+
segment?: string;
|
|
136
140
|
startpos?: number;
|
|
137
141
|
endpos?: number;
|
|
138
142
|
totalElevation: number;
|
|
@@ -155,6 +155,9 @@ let ActivitiesRepository = (() => {
|
|
|
155
155
|
if ((result === null || result === void 0 ? void 0 : result.length) > 0 && (criteria === null || criteria === void 0 ? void 0 : criteria.startPos) !== undefined) {
|
|
156
156
|
result = result.filter(ai => ai.summary.startPos === criteria.startPos);
|
|
157
157
|
}
|
|
158
|
+
if ((result === null || result === void 0 ? void 0 : result.length) > 0 && (criteria === null || criteria === void 0 ? void 0 : criteria.endPos) !== undefined) {
|
|
159
|
+
result = result.filter(ai => ai.summary.endPos === criteria.endPos);
|
|
160
|
+
}
|
|
158
161
|
if ((result === null || result === void 0 ? void 0 : result.length) > 0 && (criteria === null || criteria === void 0 ? void 0 : criteria.realityFactor) !== undefined) {
|
|
159
162
|
result = result.filter(ai => { var _a; return ((_a = ai.summary.realityFactor) !== null && _a !== void 0 ? _a : 100) === criteria.realityFactor; });
|
|
160
163
|
}
|
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.buildSummary = void 0;
|
|
4
4
|
const buildSummary = (activity, proposedName) => {
|
|
5
5
|
var _a;
|
|
6
|
-
const { id, title, route, screenshots, startTime: startTimeUTC, time: rideTime, distance, startPos, realityFactor = 100, links, laps } = activity;
|
|
6
|
+
const { id, title, route, screenshots, startTime: startTimeUTC, time: rideTime, distance, startPos, endPos, segment, realityFactor = 100, links, laps } = activity;
|
|
7
7
|
const name = proposedName !== null && proposedName !== void 0 ? proposedName : activity.name;
|
|
8
8
|
const routeId = route === null || route === void 0 ? void 0 : route.id;
|
|
9
9
|
const routeHash = route === null || route === void 0 ? void 0 : route.hash;
|
|
@@ -18,7 +18,7 @@ const buildSummary = (activity, proposedName) => {
|
|
|
18
18
|
uploadStatus.push({ service: 'strava', status: 'success' });
|
|
19
19
|
}
|
|
20
20
|
return {
|
|
21
|
-
id, title, name, routeId, routeHash, previewImage, startTime, rideTime, distance, startPos, realityFactor, uploadStatus, laps
|
|
21
|
+
id, title, name, routeId, routeHash, previewImage, startTime, rideTime, distance, startPos, endPos, realityFactor, uploadStatus, laps
|
|
22
22
|
};
|
|
23
23
|
};
|
|
24
24
|
exports.buildSummary = buildSummary;
|
|
@@ -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;
|
|
@@ -701,6 +706,7 @@ let ActivityRideService = (() => {
|
|
|
701
706
|
const startTime = new Date(this.tsStart).toUTCString();
|
|
702
707
|
this.current = { deviceData: {}, dataState: {} };
|
|
703
708
|
let startPos = 0;
|
|
709
|
+
let endPos, segment;
|
|
704
710
|
let realityFactor;
|
|
705
711
|
let routeName;
|
|
706
712
|
let routeId;
|
|
@@ -723,6 +729,8 @@ let ActivityRideService = (() => {
|
|
|
723
729
|
(0, route_1.validateRoute)(selectedRoute);
|
|
724
730
|
const s = startSettings;
|
|
725
731
|
startPos = s.startPos;
|
|
732
|
+
endPos = s.endPos;
|
|
733
|
+
segment = s.segment;
|
|
726
734
|
this.current.endPos = s.endPos;
|
|
727
735
|
realityFactor = s.realityFactor;
|
|
728
736
|
routeId = selectedRoute.description.id;
|
|
@@ -759,7 +767,7 @@ let ActivityRideService = (() => {
|
|
|
759
767
|
distance: 0,
|
|
760
768
|
totalElevation: 0,
|
|
761
769
|
logs: [],
|
|
762
|
-
startPos, realityFactor,
|
|
770
|
+
startPos, endPos, segment, realityFactor,
|
|
763
771
|
fileName
|
|
764
772
|
};
|
|
765
773
|
return activity;
|
|
@@ -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;
|