proximiio-js-library 1.13.13 → 1.13.15
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/components/map/guidanceStepsGenerator.d.ts +12 -1
- package/lib/components/map/guidanceStepsGenerator.js +112 -69
- package/lib/components/map/i18n.d.ts +14 -0
- package/lib/components/map/i18n.js +14 -0
- package/lib/components/map/main.d.ts +2 -0
- package/lib/components/map/main.js +27 -12
- package/lib/components/map/routing.d.ts +2 -1
- package/lib/components/map/routing.js +44 -17
- package/lib/components/map/sources/routing_source.d.ts +6 -0
- package/lib/components/map/sources/routing_source.js +21 -3
- package/lib/proximiio.js +1 -1
- package/package.json +1 -1
|
@@ -4,9 +4,20 @@ export default class GuidanceStepsGenerator {
|
|
|
4
4
|
points: Feature[];
|
|
5
5
|
steps: GuidanceStep[];
|
|
6
6
|
language: string;
|
|
7
|
-
|
|
7
|
+
landMarkNav: boolean;
|
|
8
|
+
pois?: Feature[];
|
|
9
|
+
levelChangers?: Feature[];
|
|
10
|
+
constructor({ points, language, landMarkNav, pois, levelChangers, }: {
|
|
11
|
+
points: Feature[];
|
|
12
|
+
language: string;
|
|
13
|
+
landMarkNav: boolean;
|
|
14
|
+
pois?: Feature[];
|
|
15
|
+
levelChangers?: Feature[];
|
|
16
|
+
});
|
|
17
|
+
private capitalize;
|
|
8
18
|
private generateStepsFromPoints;
|
|
9
19
|
private generateInstruction;
|
|
20
|
+
private getDirectionInstruction;
|
|
10
21
|
private getBearingFromLastStep;
|
|
11
22
|
private getStepDirection;
|
|
12
23
|
private getDistanceFromLastStep;
|
|
@@ -3,6 +3,7 @@ import bearing from '@turf/bearing';
|
|
|
3
3
|
import distance from '@turf/distance';
|
|
4
4
|
import { lineString } from '@turf/helpers';
|
|
5
5
|
import { translations } from './i18n';
|
|
6
|
+
import nearestPoint from '@turf/nearest-point';
|
|
6
7
|
var Direction;
|
|
7
8
|
(function (Direction) {
|
|
8
9
|
Direction["Start"] = "START";
|
|
@@ -39,9 +40,15 @@ var LevelChangerTypes;
|
|
|
39
40
|
LevelChangerTypes["ramp"] = "RAMP";
|
|
40
41
|
})(LevelChangerTypes || (LevelChangerTypes = {}));
|
|
41
42
|
export default class GuidanceStepsGenerator {
|
|
42
|
-
constructor(points, language) {
|
|
43
|
+
constructor({ points, language, landMarkNav, pois, levelChangers, }) {
|
|
44
|
+
this.capitalize = (s) => s && String(s[0]).toUpperCase() + String(s).slice(1);
|
|
43
45
|
this.points = points;
|
|
44
46
|
this.language = language;
|
|
47
|
+
if (landMarkNav) {
|
|
48
|
+
this.landMarkNav = landMarkNav;
|
|
49
|
+
this.pois = pois;
|
|
50
|
+
this.levelChangers = levelChangers;
|
|
51
|
+
}
|
|
45
52
|
if (this.points && this.points.length > 0) {
|
|
46
53
|
this.generateStepsFromPoints();
|
|
47
54
|
}
|
|
@@ -51,18 +58,37 @@ export default class GuidanceStepsGenerator {
|
|
|
51
58
|
const previousPoint = this.points[index - 1] ? new Feature(this.points[index - 1]) : null;
|
|
52
59
|
const currentPoint = new Feature(point);
|
|
53
60
|
const nextPoint = this.points[index + 1] ? new Feature(this.points[index + 1]) : null;
|
|
61
|
+
const secondNextPoint = this.points[index + 2] ? new Feature(this.points[index + 2]) : null;
|
|
54
62
|
const data = {
|
|
55
63
|
previousPoint,
|
|
56
64
|
currentPoint,
|
|
57
65
|
nextPoint,
|
|
66
|
+
secondNextPoint,
|
|
58
67
|
};
|
|
59
68
|
const direction = this.getStepDirection(data);
|
|
69
|
+
const nextStepDirection = this.getStepDirection({
|
|
70
|
+
previousPoint: currentPoint,
|
|
71
|
+
currentPoint: nextPoint,
|
|
72
|
+
nextPoint: secondNextPoint,
|
|
73
|
+
});
|
|
60
74
|
const distanceFromLastStep = this.getDistanceFromLastStep(data);
|
|
61
75
|
const extendedData = Object.assign(Object.assign({}, data), { direction, distanceFromLastStep });
|
|
76
|
+
if (this.landMarkNav &&
|
|
77
|
+
(direction === Direction.Start ||
|
|
78
|
+
direction === Direction.Finish ||
|
|
79
|
+
direction === Direction.TurnAround ||
|
|
80
|
+
direction === `${Direction.Exit}_${LevelChangerTypes[currentPoint.properties.type]}` ||
|
|
81
|
+
distanceFromLastStep === 0)) {
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
62
84
|
return {
|
|
63
85
|
bearingFromLastStep: this.getBearingFromLastStep(data),
|
|
64
86
|
coordinates: [point.geometry.coordinates[0], point.geometry.coordinates[1]],
|
|
65
|
-
direction
|
|
87
|
+
direction: this.landMarkNav
|
|
88
|
+
? nextStepDirection === Direction.Finish
|
|
89
|
+
? Direction.Finish
|
|
90
|
+
: direction
|
|
91
|
+
: direction,
|
|
66
92
|
distanceFromLastStep,
|
|
67
93
|
level: point.properties.level,
|
|
68
94
|
levelChangerId: currentPoint.isLevelChanger ? currentPoint.id : null,
|
|
@@ -76,83 +102,98 @@ export default class GuidanceStepsGenerator {
|
|
|
76
102
|
};
|
|
77
103
|
});
|
|
78
104
|
}
|
|
79
|
-
generateInstruction({ previousPoint, currentPoint, nextPoint, direction, distanceFromLastStep, }) {
|
|
105
|
+
generateInstruction({ previousPoint, currentPoint, nextPoint, secondNextPoint, direction, distanceFromLastStep, }) {
|
|
80
106
|
let instruction = '';
|
|
107
|
+
if (previousPoint.isLevelChanger) {
|
|
108
|
+
const levelChangerFeature = this.levelChangers.find((f) => f.id === previousPoint.id);
|
|
109
|
+
const levelChangeDirection = this.getStepDirection({
|
|
110
|
+
previousPoint: levelChangerFeature,
|
|
111
|
+
currentPoint: previousPoint,
|
|
112
|
+
nextPoint: currentPoint,
|
|
113
|
+
levelChangerDirection: true,
|
|
114
|
+
});
|
|
115
|
+
instruction += `${this.capitalize(this.getDirectionInstruction(levelChangeDirection))} `;
|
|
116
|
+
}
|
|
81
117
|
if (distanceFromLastStep > 0) {
|
|
82
|
-
instruction += `${translations[this.language].IN} ${distanceFromLastStep.toFixed(0)} ${translations[this.language].METERS} `;
|
|
118
|
+
instruction += `${this.capitalize(translations[this.language].IN)} ${distanceFromLastStep.toFixed(0)} ${translations[this.language].METERS} `;
|
|
119
|
+
}
|
|
120
|
+
if (direction === Direction.TurnAround || direction === Direction.Start || direction === Direction.Finish) {
|
|
121
|
+
instruction += this.getDirectionInstruction(direction);
|
|
122
|
+
return instruction;
|
|
123
|
+
}
|
|
124
|
+
if (this.landMarkNav) {
|
|
125
|
+
const featureCollection = {
|
|
126
|
+
type: 'FeatureCollection',
|
|
127
|
+
features: this.pois.filter((f) => f.properties.level === currentPoint.properties.level),
|
|
128
|
+
};
|
|
129
|
+
const nextPointDirection = this.getStepDirection({
|
|
130
|
+
previousPoint: currentPoint,
|
|
131
|
+
currentPoint: nextPoint,
|
|
132
|
+
nextPoint: secondNextPoint,
|
|
133
|
+
});
|
|
134
|
+
if (nextPointDirection === Direction.Finish) {
|
|
135
|
+
instruction += `${translations[this.language].DESTINATION} ${nextPoint.properties.title_i18n && nextPoint.properties.title_i18n[this.language]
|
|
136
|
+
? nextPoint.properties.title_i18n[this.language]
|
|
137
|
+
: nextPoint.properties.title} ${translations[this.language].IS_ON_YOUR} ${this.getDirectionInstruction(direction).replace('turn ', '')}`;
|
|
138
|
+
return instruction;
|
|
139
|
+
}
|
|
140
|
+
instruction += this.getDirectionInstruction(direction);
|
|
141
|
+
const nearestPoi = nearestPoint(currentPoint.geometry.coordinates, featureCollection);
|
|
142
|
+
instruction = `${instruction.slice(0, -1)} ${translations[this.language].BY} ${nearestPoi.properties.title_i18n && nearestPoi.properties.title_i18n[this.language]
|
|
143
|
+
? nearestPoi.properties.title_i18n[this.language]
|
|
144
|
+
: nearestPoi.properties.title}`;
|
|
83
145
|
}
|
|
146
|
+
return instruction;
|
|
147
|
+
}
|
|
148
|
+
getDirectionInstruction(direction) {
|
|
84
149
|
switch (direction) {
|
|
85
150
|
case Direction.Start:
|
|
86
|
-
|
|
87
|
-
break;
|
|
151
|
+
return translations[this.language].START;
|
|
88
152
|
case Direction.Finish:
|
|
89
|
-
|
|
90
|
-
break;
|
|
153
|
+
return translations[this.language].DESTINATION;
|
|
91
154
|
case Direction.Straight:
|
|
92
|
-
|
|
93
|
-
break;
|
|
155
|
+
return translations[this.language].STRAIGHT;
|
|
94
156
|
case Direction.TurnAround:
|
|
95
|
-
|
|
96
|
-
break;
|
|
157
|
+
return translations[this.language].TURN_AROUND;
|
|
97
158
|
case Direction.HardLeft:
|
|
98
|
-
|
|
99
|
-
break;
|
|
159
|
+
return translations[this.language].HARD_LEFT;
|
|
100
160
|
case Direction.SlightLeft:
|
|
101
|
-
|
|
102
|
-
break;
|
|
161
|
+
return translations[this.language].SLIGHT_LEFT;
|
|
103
162
|
case Direction.Left:
|
|
104
|
-
|
|
105
|
-
break;
|
|
163
|
+
return translations[this.language].LEFT;
|
|
106
164
|
case Direction.HardRight:
|
|
107
|
-
|
|
108
|
-
break;
|
|
165
|
+
return translations[this.language].HARD_RIGHT;
|
|
109
166
|
case Direction.SlightRight:
|
|
110
|
-
|
|
111
|
-
break;
|
|
167
|
+
return translations[this.language].SLIGHT_RIGHT;
|
|
112
168
|
case Direction.Right:
|
|
113
|
-
|
|
114
|
-
break;
|
|
169
|
+
return translations[this.language].RIGHT;
|
|
115
170
|
case Direction.UpStaircase:
|
|
116
|
-
|
|
117
|
-
break;
|
|
171
|
+
return translations[this.language].UP_STAIRCASE;
|
|
118
172
|
case Direction.UpEscalator:
|
|
119
|
-
|
|
120
|
-
break;
|
|
173
|
+
return translations[this.language].UP_ESCALATOR;
|
|
121
174
|
case Direction.UpElevator:
|
|
122
|
-
|
|
123
|
-
break;
|
|
175
|
+
return translations[this.language].UP_ELEVATOR;
|
|
124
176
|
case Direction.UpRamp:
|
|
125
|
-
|
|
126
|
-
break;
|
|
177
|
+
return translations[this.language].UP_RAMP;
|
|
127
178
|
case Direction.DownStaircase:
|
|
128
|
-
|
|
129
|
-
break;
|
|
179
|
+
return translations[this.language].DOWN_STAIRCASE;
|
|
130
180
|
case Direction.DownEscalator:
|
|
131
|
-
|
|
132
|
-
break;
|
|
181
|
+
return translations[this.language].DOWN_ESCALATOR;
|
|
133
182
|
case Direction.DownElevator:
|
|
134
|
-
|
|
135
|
-
break;
|
|
183
|
+
return translations[this.language].DOWN_ELEVATOR;
|
|
136
184
|
case Direction.DownRamp:
|
|
137
|
-
|
|
138
|
-
break;
|
|
185
|
+
return translations[this.language].DOWN_RAMP;
|
|
139
186
|
case Direction.ExitStaircase:
|
|
140
|
-
|
|
141
|
-
break;
|
|
187
|
+
return translations[this.language].EXIT_STAIRCASE;
|
|
142
188
|
case Direction.ExitEscalator:
|
|
143
|
-
|
|
144
|
-
break;
|
|
189
|
+
return translations[this.language].EXIT_ESCALATOR;
|
|
145
190
|
case Direction.ExitElevator:
|
|
146
|
-
|
|
147
|
-
break;
|
|
191
|
+
return translations[this.language].EXIT_ELEVATOR;
|
|
148
192
|
case Direction.ExitRamp:
|
|
149
|
-
|
|
150
|
-
break;
|
|
193
|
+
return translations[this.language].EXIT_RAMP;
|
|
151
194
|
default:
|
|
152
|
-
|
|
153
|
-
break;
|
|
195
|
+
return translations[this.language].CONTINUE;
|
|
154
196
|
}
|
|
155
|
-
return instruction;
|
|
156
197
|
}
|
|
157
198
|
getBearingFromLastStep({ previousPoint, currentPoint, nextPoint, }) {
|
|
158
199
|
if (!previousPoint) {
|
|
@@ -161,24 +202,26 @@ export default class GuidanceStepsGenerator {
|
|
|
161
202
|
const bearingVar = bearing(previousPoint.geometry.coordinates, currentPoint.geometry.coordinates);
|
|
162
203
|
return bearingVar;
|
|
163
204
|
}
|
|
164
|
-
getStepDirection({ previousPoint, currentPoint, nextPoint, }) {
|
|
165
|
-
if (!
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
205
|
+
getStepDirection({ previousPoint, currentPoint, nextPoint, levelChangerDirection = false, }) {
|
|
206
|
+
if (!levelChangerDirection) {
|
|
207
|
+
if (!previousPoint) {
|
|
208
|
+
return Direction.Start;
|
|
209
|
+
}
|
|
210
|
+
if (!nextPoint) {
|
|
211
|
+
return Direction.Finish;
|
|
212
|
+
}
|
|
213
|
+
if (currentPoint.isPoi && nextPoint.isPoi && currentPoint.id === nextPoint.id) {
|
|
214
|
+
return Direction.Finish;
|
|
215
|
+
}
|
|
216
|
+
if (currentPoint.isLevelChanger && nextPoint.properties.level > currentPoint.properties.level) {
|
|
217
|
+
return `${Direction.Up}_${LevelChangerTypes[currentPoint.properties.type]}`;
|
|
218
|
+
}
|
|
219
|
+
if (currentPoint.isLevelChanger && nextPoint.properties.level < currentPoint.properties.level) {
|
|
220
|
+
return `${Direction.Down}_${LevelChangerTypes[currentPoint.properties.type]}`;
|
|
221
|
+
}
|
|
222
|
+
if (previousPoint.isLevelChanger && currentPoint.isLevelChanger) {
|
|
223
|
+
return `${Direction.Exit}_${LevelChangerTypes[currentPoint.properties.type]}`;
|
|
224
|
+
}
|
|
182
225
|
}
|
|
183
226
|
const bearingVar = bearing(currentPoint.geometry.coordinates, nextPoint.geometry.coordinates) -
|
|
184
227
|
bearing(previousPoint.geometry.coordinates, currentPoint.geometry.coordinates);
|
|
@@ -35,6 +35,8 @@ export declare const translations: {
|
|
|
35
35
|
CONTINUE: string;
|
|
36
36
|
TO: string;
|
|
37
37
|
FLOOR: string;
|
|
38
|
+
BY: string;
|
|
39
|
+
IS_ON_YOUR: string;
|
|
38
40
|
};
|
|
39
41
|
fi: {
|
|
40
42
|
ELEVATOR: string;
|
|
@@ -72,6 +74,8 @@ export declare const translations: {
|
|
|
72
74
|
CONTINUE: string;
|
|
73
75
|
TO: string;
|
|
74
76
|
FLOOR: string;
|
|
77
|
+
BY: string;
|
|
78
|
+
IS_ON_YOUR: string;
|
|
75
79
|
};
|
|
76
80
|
ar: {
|
|
77
81
|
ELEVATOR: string;
|
|
@@ -109,6 +113,8 @@ export declare const translations: {
|
|
|
109
113
|
CONTINUE: string;
|
|
110
114
|
TO: string;
|
|
111
115
|
FLOOR: string;
|
|
116
|
+
BY: string;
|
|
117
|
+
IS_ON_YOUR: string;
|
|
112
118
|
};
|
|
113
119
|
it: {
|
|
114
120
|
ELEVATOR: string;
|
|
@@ -146,6 +152,8 @@ export declare const translations: {
|
|
|
146
152
|
CONTINUE: string;
|
|
147
153
|
TO: string;
|
|
148
154
|
FLOOR: string;
|
|
155
|
+
BY: string;
|
|
156
|
+
IS_ON_YOUR: string;
|
|
149
157
|
};
|
|
150
158
|
id: {
|
|
151
159
|
ELEVATOR: string;
|
|
@@ -183,6 +191,8 @@ export declare const translations: {
|
|
|
183
191
|
CONTINUE: string;
|
|
184
192
|
TO: string;
|
|
185
193
|
FLOOR: string;
|
|
194
|
+
BY: string;
|
|
195
|
+
IS_ON_YOUR: string;
|
|
186
196
|
};
|
|
187
197
|
zh: {
|
|
188
198
|
ELEVATOR: string;
|
|
@@ -220,6 +230,8 @@ export declare const translations: {
|
|
|
220
230
|
CONTINUE: string;
|
|
221
231
|
TO: string;
|
|
222
232
|
FLOOR: string;
|
|
233
|
+
BY: string;
|
|
234
|
+
IS_ON_YOUR: string;
|
|
223
235
|
};
|
|
224
236
|
ru: {
|
|
225
237
|
ELEVATOR: string;
|
|
@@ -257,5 +269,7 @@ export declare const translations: {
|
|
|
257
269
|
CONTINUE: string;
|
|
258
270
|
TO: string;
|
|
259
271
|
FLOOR: string;
|
|
272
|
+
BY: string;
|
|
273
|
+
IS_ON_YOUR: string;
|
|
260
274
|
};
|
|
261
275
|
};
|
|
@@ -35,6 +35,8 @@ export const translations = {
|
|
|
35
35
|
CONTINUE: 'continue.',
|
|
36
36
|
TO: 'to',
|
|
37
37
|
FLOOR: 'floor',
|
|
38
|
+
BY: 'by',
|
|
39
|
+
IS_ON_YOUR: 'is on your',
|
|
38
40
|
},
|
|
39
41
|
fi: {
|
|
40
42
|
ELEVATOR: 'Hissi',
|
|
@@ -72,6 +74,8 @@ export const translations = {
|
|
|
72
74
|
CONTINUE: 'jatka.',
|
|
73
75
|
TO: 'osoitteeseen',
|
|
74
76
|
FLOOR: 'lattia',
|
|
77
|
+
BY: 'liikkeellä',
|
|
78
|
+
IS_ON_YOUR: 'on sinun',
|
|
75
79
|
},
|
|
76
80
|
ar: {
|
|
77
81
|
ELEVATOR: 'المصعد',
|
|
@@ -109,6 +113,8 @@ export const translations = {
|
|
|
109
113
|
CONTINUE: 'تابع.',
|
|
110
114
|
TO: 'إلى',
|
|
111
115
|
FLOOR: 'الطابق',
|
|
116
|
+
BY: 'بواسطة',
|
|
117
|
+
IS_ON_YOUR: 'في',
|
|
112
118
|
},
|
|
113
119
|
it: {
|
|
114
120
|
ELEVATOR: 'Ascensore',
|
|
@@ -146,6 +152,8 @@ export const translations = {
|
|
|
146
152
|
CONTINUE: 'continua.',
|
|
147
153
|
TO: 'al',
|
|
148
154
|
FLOOR: 'piano',
|
|
155
|
+
BY: 'per',
|
|
156
|
+
IS_ON_YOUR: 'su',
|
|
149
157
|
},
|
|
150
158
|
id: {
|
|
151
159
|
ELEVATOR: 'Lift',
|
|
@@ -183,6 +191,8 @@ export const translations = {
|
|
|
183
191
|
CONTINUE: 'lanjutkan.',
|
|
184
192
|
TO: 'ke',
|
|
185
193
|
FLOOR: 'lantai',
|
|
194
|
+
BY: 'oleh',
|
|
195
|
+
IS_ON_YOUR: 'di',
|
|
186
196
|
},
|
|
187
197
|
zh: {
|
|
188
198
|
ELEVATOR: '电梯',
|
|
@@ -220,6 +230,8 @@ export const translations = {
|
|
|
220
230
|
CONTINUE: '继续',
|
|
221
231
|
TO: '到 ',
|
|
222
232
|
FLOOR: '楼层',
|
|
233
|
+
BY: '通过',
|
|
234
|
+
IS_ON_YOUR: '在',
|
|
223
235
|
},
|
|
224
236
|
ru: {
|
|
225
237
|
ELEVATOR: 'Лифт',
|
|
@@ -257,5 +269,7 @@ export const translations = {
|
|
|
257
269
|
CONTINUE: 'продолжать',
|
|
258
270
|
TO: 'к',
|
|
259
271
|
FLOOR: 'пол',
|
|
272
|
+
BY: 'по',
|
|
273
|
+
IS_ON_YOUR: 'на',
|
|
260
274
|
},
|
|
261
275
|
};
|
|
@@ -82,6 +82,7 @@ export interface Options {
|
|
|
82
82
|
allowNewFeatureModal?: boolean;
|
|
83
83
|
newFeatureModalEvent?: string;
|
|
84
84
|
enableTBTNavigation?: boolean;
|
|
85
|
+
landmarkTBTNavigation?: boolean;
|
|
85
86
|
mapboxOptions?: MapboxOptions;
|
|
86
87
|
zoomIntoPlace?: boolean;
|
|
87
88
|
defaultPlaceId?: string;
|
|
@@ -142,6 +143,7 @@ export interface Options {
|
|
|
142
143
|
cityPointIconUrl?: string;
|
|
143
144
|
cityRouteMaxDuration?: number;
|
|
144
145
|
autoStart?: boolean;
|
|
146
|
+
autoContinue?: boolean;
|
|
145
147
|
};
|
|
146
148
|
useRasterTiles?: boolean;
|
|
147
149
|
rasterTilesOptions?: {
|
|
@@ -96,6 +96,7 @@ export class Map {
|
|
|
96
96
|
allowNewFeatureModal: false,
|
|
97
97
|
newFeatureModalEvent: 'click',
|
|
98
98
|
enableTBTNavigation: true,
|
|
99
|
+
landmarkTBTNavigation: false,
|
|
99
100
|
zoomIntoPlace: true,
|
|
100
101
|
defaultFloorLevel: 0,
|
|
101
102
|
isKiosk: false,
|
|
@@ -200,6 +201,7 @@ export class Map {
|
|
|
200
201
|
cityRouteSpeedMultiplier: 5,
|
|
201
202
|
cityRouteMaxDuration: 5,
|
|
202
203
|
autoStart: true,
|
|
204
|
+
autoContinue: true,
|
|
203
205
|
},
|
|
204
206
|
useRasterTiles: false,
|
|
205
207
|
handleUrlParams: false,
|
|
@@ -504,6 +506,11 @@ export class Map {
|
|
|
504
506
|
if (this.defaultOptions.routeWithDetails !== null && this.defaultOptions.routeWithDetails !== undefined) {
|
|
505
507
|
this.routingSource.routing.routeWithDetails = this.defaultOptions.routeWithDetails;
|
|
506
508
|
}
|
|
509
|
+
if (this.defaultOptions.landmarkTBTNavigation) {
|
|
510
|
+
this.routingSource.setLandmarkTBT(this.defaultOptions.landmarkTBTNavigation);
|
|
511
|
+
this.routingSource.setPois(optimizedFeatures.features.filter((f) => f.geometry.coordinates && f.geometry.type === 'Point' && f.properties.type === 'poi'));
|
|
512
|
+
this.routingSource.setLevelChangers(levelChangers);
|
|
513
|
+
}
|
|
507
514
|
this.geojsonSource.fetch(optimizedFeatures);
|
|
508
515
|
this.routingSource.routing.setData(new FeatureCollection(features));
|
|
509
516
|
this.prepareStyle(style);
|
|
@@ -1949,7 +1956,7 @@ export class Map {
|
|
|
1949
1956
|
this.filterOutFeatures();
|
|
1950
1957
|
}
|
|
1951
1958
|
if (!isTemporary) {
|
|
1952
|
-
this.state.
|
|
1959
|
+
this.state.optimizedFeatures.features.push(featureVar);
|
|
1953
1960
|
yield addFeatures({
|
|
1954
1961
|
type: 'FeatureCollection',
|
|
1955
1962
|
features: [featureVar.json],
|
|
@@ -1989,18 +1996,18 @@ export class Map {
|
|
|
1989
1996
|
this.filterOutFeatures();
|
|
1990
1997
|
}
|
|
1991
1998
|
if (!isTemporary) {
|
|
1992
|
-
const featureIndex = this.state.
|
|
1993
|
-
this.state.
|
|
1999
|
+
const featureIndex = this.state.optimizedFeatures.features.findIndex((x) => x.id === featureVar.id || x.properties.id === featureVar.id);
|
|
2000
|
+
this.state.optimizedFeatures.features[featureIndex] = featureVar;
|
|
1994
2001
|
yield addFeatures({
|
|
1995
2002
|
type: 'FeatureCollection',
|
|
1996
2003
|
features: [featureVar.json],
|
|
1997
2004
|
});
|
|
1998
2005
|
}
|
|
1999
2006
|
else {
|
|
2000
|
-
const featureIndex = this.state.
|
|
2007
|
+
const featureIndex = this.state.optimizedFeatures.features.findIndex((x) => x.id === featureVar.id || x.properties.id === featureVar.id);
|
|
2001
2008
|
const dynamicIndex = this.state.dynamicFeatures.features.findIndex((x) => x.id === featureVar.id || x.properties.id === featureVar.id);
|
|
2002
2009
|
if (featureIndex)
|
|
2003
|
-
this.state.
|
|
2010
|
+
this.state.optimizedFeatures.features[featureIndex] = featureVar;
|
|
2004
2011
|
if (dynamicIndex)
|
|
2005
2012
|
this.state.dynamicFeatures.features[dynamicIndex] = featureVar;
|
|
2006
2013
|
}
|
|
@@ -2022,8 +2029,8 @@ export class Map {
|
|
|
2022
2029
|
throw new Error(`Deleting feature failed: Feature with id '${id}' has not been found!`);
|
|
2023
2030
|
}
|
|
2024
2031
|
if (!isTemporary) {
|
|
2025
|
-
const featureIndex = this.state.
|
|
2026
|
-
this.state.
|
|
2032
|
+
const featureIndex = this.state.optimizedFeatures.features.findIndex((x) => x.id === id || x.properties.id === id);
|
|
2033
|
+
this.state.optimizedFeatures.features.splice(featureIndex, 1);
|
|
2027
2034
|
yield deleteFeatures({
|
|
2028
2035
|
type: 'FeatureCollection',
|
|
2029
2036
|
features: [foundFeature],
|
|
@@ -2988,6 +2995,8 @@ export class Map {
|
|
|
2988
2995
|
this.removeStopMarkers();
|
|
2989
2996
|
this.routingSource.cancel();
|
|
2990
2997
|
this.onRouteCancelListener.next('route cancelled');
|
|
2998
|
+
this.currentStep = 0;
|
|
2999
|
+
this.currentStop = 0;
|
|
2991
3000
|
}
|
|
2992
3001
|
centerOnPoi(poi) {
|
|
2993
3002
|
if (this.state.floor.level !== parseInt(poi.properties.level, 0)) {
|
|
@@ -3142,8 +3151,9 @@ export class Map {
|
|
|
3142
3151
|
? this.routingSource.route[`path-part-${this.currentStep}`]
|
|
3143
3152
|
: lineString(this.routingSource.levelPoints[this.state.floor.level].map((i) => i.geometry.coordinates), { level: this.state.floor.level });
|
|
3144
3153
|
let routeUntilNextStep;
|
|
3145
|
-
if (this.routingSource.navigationType === 'city') {
|
|
3154
|
+
if (this.routingSource.navigationType === 'city' || this.defaultOptions.landmarkTBTNavigation) {
|
|
3146
3155
|
const routePoints = this.routingSource.lines
|
|
3156
|
+
.filter((i) => i.properties.level === this.state.floor.level)
|
|
3147
3157
|
.map((i, index) => {
|
|
3148
3158
|
if (index > this.currentStep) {
|
|
3149
3159
|
return null;
|
|
@@ -3192,8 +3202,11 @@ export class Map {
|
|
|
3192
3202
|
return;
|
|
3193
3203
|
}
|
|
3194
3204
|
setTimeout(() => {
|
|
3195
|
-
this.
|
|
3196
|
-
|
|
3205
|
+
if (this.defaultOptions.routeAnimation.autoContinue) {
|
|
3206
|
+
this.setNavStep('next');
|
|
3207
|
+
}
|
|
3208
|
+
if (this.defaultOptions.autoRestartAnimationAfterFloorChange &&
|
|
3209
|
+
!this.defaultOptions.landmarkTBTNavigation) {
|
|
3197
3210
|
this.restartRouteAnimation({ delay: 0, recenter: true });
|
|
3198
3211
|
}
|
|
3199
3212
|
}, 2000);
|
|
@@ -3205,7 +3218,9 @@ export class Map {
|
|
|
3205
3218
|
// Interpolate the current point along the route
|
|
3206
3219
|
const currentPoint = along(route, currentDistance);
|
|
3207
3220
|
// cut the line at the point
|
|
3208
|
-
const lineAlong = lineSplit(this.routingSource.navigationType === 'city'
|
|
3221
|
+
const lineAlong = lineSplit(this.routingSource.navigationType === 'city' || this.defaultOptions.landmarkTBTNavigation
|
|
3222
|
+
? routeUntilNextStep
|
|
3223
|
+
: route, currentPoint).features[0];
|
|
3209
3224
|
// Update the point position
|
|
3210
3225
|
// @ts-ignore
|
|
3211
3226
|
const pointData = this.map.getSource('pointAlong')._data;
|
|
@@ -3976,7 +3991,7 @@ export class Map {
|
|
|
3976
3991
|
this.animateRoute();
|
|
3977
3992
|
}
|
|
3978
3993
|
else {
|
|
3979
|
-
if (this.routingSource.isMultipoint) {
|
|
3994
|
+
if (this.routingSource.isMultipoint || this.defaultOptions.enableTBTNavigation) {
|
|
3980
3995
|
this.animateRoute();
|
|
3981
3996
|
}
|
|
3982
3997
|
this.centerOnRoute(this.routingSource.route[`path-part-${newStep}`]);
|
|
@@ -9,10 +9,11 @@ export default class Routing {
|
|
|
9
9
|
setData(collection: FeatureCollection): void;
|
|
10
10
|
toggleOnlyAccessible(onlyAccessible: any): void;
|
|
11
11
|
setConfig(config: WayfindingConfigModel): void;
|
|
12
|
-
route({ start, finish, stops }: {
|
|
12
|
+
route({ start, finish, stops, landmarkTBT, }: {
|
|
13
13
|
start: Feature;
|
|
14
14
|
finish?: Feature;
|
|
15
15
|
stops?: Feature[];
|
|
16
|
+
landmarkTBT?: boolean;
|
|
16
17
|
}): {
|
|
17
18
|
paths: any;
|
|
18
19
|
points: any;
|
|
@@ -60,7 +60,7 @@ export default class Routing {
|
|
|
60
60
|
setConfig(config) {
|
|
61
61
|
this.wayfinding.setConfiguration(config);
|
|
62
62
|
}
|
|
63
|
-
route({ start, finish, stops }) {
|
|
63
|
+
route({ start, finish, stops, landmarkTBT = false, }) {
|
|
64
64
|
const isMultipoint = stops && stops.length > 1;
|
|
65
65
|
let points = null;
|
|
66
66
|
let details = null;
|
|
@@ -114,26 +114,53 @@ export default class Routing {
|
|
|
114
114
|
const pathPoints = {};
|
|
115
115
|
let pathPartIndex = 0;
|
|
116
116
|
points.forEach((p, index) => {
|
|
117
|
-
var _a;
|
|
118
|
-
if (
|
|
119
|
-
if (typeof pathPoints[
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
117
|
+
var _a, _b, _c;
|
|
118
|
+
if (landmarkTBT) {
|
|
119
|
+
if (typeof pathPoints[`path-part-${pathPartIndex}`] === 'undefined') {
|
|
120
|
+
if (p.isLevelChanger && p.properties.level !== points[index + 1].properties.level) {
|
|
121
|
+
return;
|
|
122
|
+
}
|
|
123
|
+
else if (p.isPoi && p.id === ((_a = points[index + 1]) === null || _a === void 0 ? void 0 : _a.id)) {
|
|
124
|
+
return;
|
|
125
|
+
}
|
|
126
|
+
else if ((_b = points[index + 1]) === null || _b === void 0 ? void 0 : _b.isPoi) {
|
|
127
|
+
// do not add another path part if next poi is finish
|
|
128
|
+
return;
|
|
129
|
+
}
|
|
130
|
+
if (points[index + 1]) {
|
|
131
|
+
pathPoints[`path-part-${pathPartIndex}`] = [];
|
|
132
|
+
if (points[index + 2] && points[index + 2].isPoi) {
|
|
133
|
+
// if second next poi is path destination, add three points to path part as there won't be another path part added
|
|
134
|
+
pathPoints[`path-part-${pathPartIndex}`].push(p, points[index + 1], points[index + 2]);
|
|
135
|
+
}
|
|
136
|
+
else {
|
|
137
|
+
pathPoints[`path-part-${pathPartIndex}`].push(p, points[index + 1]);
|
|
138
|
+
}
|
|
139
|
+
pathPartIndex++;
|
|
140
|
+
}
|
|
125
141
|
}
|
|
126
142
|
}
|
|
127
143
|
else {
|
|
128
|
-
if (
|
|
129
|
-
pathPoints[
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
144
|
+
if (this.forceFloorLevel !== null && this.forceFloorLevel !== undefined) {
|
|
145
|
+
if (typeof pathPoints['path-part-'.concat(pathPartIndex)] === 'undefined') {
|
|
146
|
+
pathPoints['path-part-'.concat(pathPartIndex)] = [];
|
|
147
|
+
}
|
|
148
|
+
pathPoints['path-part-'.concat(pathPartIndex)].push(p);
|
|
149
|
+
if (p.isLevelChanger && points[index + 1].isLevelChanger && p.level !== points[index + 1].level) {
|
|
150
|
+
pathPartIndex++;
|
|
151
|
+
}
|
|
134
152
|
}
|
|
135
|
-
else
|
|
136
|
-
pathPartIndex
|
|
153
|
+
else {
|
|
154
|
+
if (typeof pathPoints[`path-part-${pathPartIndex}`] === 'undefined') {
|
|
155
|
+
pathPoints[`path-part-${pathPartIndex}`] = [];
|
|
156
|
+
}
|
|
157
|
+
pathPoints[`path-part-${pathPartIndex}`].push(p);
|
|
158
|
+
if (p.isLevelChanger && p.properties.level !== points[index + 1].properties.level) {
|
|
159
|
+
pathPartIndex++;
|
|
160
|
+
}
|
|
161
|
+
else if (p.isPoi && p.id === ((_c = points[index + 1]) === null || _c === void 0 ? void 0 : _c.id)) {
|
|
162
|
+
pathPartIndex++;
|
|
163
|
+
}
|
|
137
164
|
}
|
|
138
165
|
}
|
|
139
166
|
});
|
|
@@ -34,10 +34,16 @@ export default class RoutingSource extends DataSource {
|
|
|
34
34
|
navigationType: 'mall' | 'city';
|
|
35
35
|
fullPath?: Feature;
|
|
36
36
|
isMultipoint: boolean;
|
|
37
|
+
landmarkTBT: boolean;
|
|
38
|
+
pois?: Feature[];
|
|
39
|
+
levelChangers?: Feature[];
|
|
37
40
|
constructor();
|
|
38
41
|
toggleAccessible(value: any): void;
|
|
39
42
|
setConfig(config: WayfindingConfigModel): void;
|
|
40
43
|
setNavigationType(type: 'mall' | 'city'): void;
|
|
44
|
+
setLandmarkTBT(value: boolean): void;
|
|
45
|
+
setPois(pois: Feature[]): void;
|
|
46
|
+
setLevelChangers(levelChangers: Feature[]): void;
|
|
41
47
|
update({ start, finish, stops, preview, language, }: {
|
|
42
48
|
start?: Feature;
|
|
43
49
|
finish?: Feature;
|