@wemap/routers 10.3.0-alpha.1 → 10.3.0

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/index.d.ts CHANGED
@@ -119,4 +119,6 @@ declare module '@wemap/routers' {
119
119
  export function multiplyItineraryLevel(itinerary: Itinerary, levelFactor: number): void;
120
120
  export function multiplyRouterResponseLevel(routerResponse: RouterResponse, levelFactor: number): void;
121
121
 
122
+ // WemapRouterUtils
123
+ export function getTurnInfoFromAngle(angle: number): { direction: 'straight' | 'left' | 'right', directionExtra?: 'slight' | 'sharp' };
122
124
  }
package/package.json CHANGED
@@ -12,7 +12,7 @@
12
12
  "directory": "packages/routers"
13
13
  },
14
14
  "name": "@wemap/routers",
15
- "version": "10.3.0-alpha.1",
15
+ "version": "10.3.0",
16
16
  "bugs": {
17
17
  "url": "https://github.com/wemap/wemap-modules-js/issues"
18
18
  },
@@ -30,10 +30,10 @@
30
30
  "@turf/boolean-point-in-polygon": "^6.5.0",
31
31
  "@turf/convex": "^6.5.0",
32
32
  "@turf/helpers": "^6.5.0",
33
- "@wemap/geo": "^10.3.0-alpha.0",
33
+ "@wemap/geo": "^10.3.0",
34
34
  "@wemap/logger": "^10.0.0",
35
- "@wemap/maths": "^10.3.0-alpha.0",
36
- "@wemap/osm": "^10.3.0-alpha.0"
35
+ "@wemap/maths": "^10.3.0",
36
+ "@wemap/osm": "^10.3.0"
37
37
  },
38
- "gitHead": "37e7a236d38de6fbf772eb6720fb17e4921a8dad"
38
+ "gitHead": "2435b4a1c0218f56a87ff1768e197f8cb738aa4d"
39
39
  }
@@ -147,34 +147,6 @@ class ItineraryInfoManager {
147
147
  return itineraryInfo;
148
148
  }
149
149
 
150
- /**
151
- * @param {Coordinates} position
152
- * @returns {string | null}
153
- */
154
- getInstructionFromPosition(position) {
155
- const itineraryInfo = this.getInfo(position);
156
- if (!itineraryInfo) {
157
- return null;
158
- }
159
-
160
- const { nextStep } = itineraryInfo;
161
- if (!nextStep) {
162
- return null;
163
- }
164
-
165
- const distNextStep = position.distanceTo(nextStep.coords);
166
- const nextStep2 = this._steps.find((step) => step.number > nextStep.number);
167
- if (distNextStep < 3 && nextStep2) {
168
- return nextStep2.instructionLivemap;
169
- }
170
-
171
- if (distNextStep > 10) {
172
- return `Continue for ${distNextStep.toFixed(0)}m`;
173
- }
174
-
175
- return nextStep.instructionLivemap;
176
- }
177
-
178
150
  }
179
151
 
180
152
  export default ItineraryInfoManager;
package/src/model/Step.js CHANGED
@@ -1,6 +1,5 @@
1
1
  import { Coordinates } from '@wemap/geo';
2
2
 
3
- import { getTurnInfoFromAngle } from '../wemap/WemapRouterUtils.js';
4
3
  import LevelChange from './LevelChange.js';
5
4
 
6
5
  class Step {
@@ -47,92 +46,6 @@ class Step {
47
46
  /** @type {!number} */
48
47
  _idCoordsInLeg = null;
49
48
 
50
-
51
- /** @type {{type: string, direction?: string}} */
52
- get instructionInfo() {
53
-
54
- let type, direction, directionExtra, levelChange;
55
-
56
- if (this.levelChange) {
57
- type = 'level-change';
58
- levelChange = this.levelChange;
59
- } else {
60
- type = 'turn';
61
- const turnInfo = getTurnInfoFromAngle(this.angle);
62
- direction = turnInfo.direction;
63
- directionExtra = turnInfo.directionExtra;
64
- }
65
-
66
- return {
67
- type,
68
- direction,
69
- directionExtra,
70
- levelChange,
71
- name: this.name,
72
- indoor: this.coords.level !== null
73
- };
74
- }
75
-
76
- // eslint-disable-next-line max-statements
77
- get instructionLivemap() {
78
-
79
- const {direction, directionExtra} = getTurnInfoFromAngle(this.angle);
80
- const isTurn = direction !== 'straight';
81
-
82
- if (this.lastStep) {
83
- if (isTurn && direction === 'left') {
84
- return 'Your destination is on your left';
85
- } else if (isTurn && direction === 'right') {
86
- return 'Your destination is on your right';
87
- }
88
- }
89
-
90
- const suffix = this.name ? ` on ${this.name}` : '' ;
91
-
92
- if (this.levelChange) {
93
- if (this.levelChange.direction === 'up') {
94
- if (this.levelChange.type === 'conveyor') {
95
- return 'Go up the escalator';
96
- }
97
- if (this.levelChange.type === 'stairs') {
98
- return 'Go up the stairs';
99
- }
100
- return 'Go up' + suffix;
101
- }
102
- if (this.levelChange.direction === 'down') {
103
- if (this.levelChange.type === 'conveyor') {
104
- return 'Go down the escalator';
105
- }
106
- if (this.levelChange.type === 'stairs') {
107
- return 'Go down the stairs';
108
- }
109
- return 'Go down' + suffix;
110
- }
111
- if (this.extras.subwayEntrance) {
112
- return `Take exit ${this.extras.subwayEntranceRef}`;
113
- }
114
- }
115
-
116
- if (isTurn) {
117
- if (direction === 'left') {
118
- if (directionExtra === 'slight') {
119
- return 'Turn slightly left' + suffix;
120
- }
121
- return 'Turn left' + suffix;
122
- }
123
- if (direction === 'right') {
124
- if (directionExtra === 'slight') {
125
- return 'Turn slightly right' + suffix;
126
- }
127
- return 'Turn right' + suffix;
128
- }
129
- }
130
-
131
-
132
- return '';
133
- }
134
-
135
-
136
49
  /**
137
50
  * @param {Step} obj1
138
51
  * @param {Step} obj2