@wemap/providers 3.1.23 → 3.2.2

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.
Files changed (74) hide show
  1. package/babel.config.json +16 -0
  2. package/debug/MainComponent.jsx +5 -5
  3. package/debug/components/AbsoluteAttitudeComponent.jsx +5 -5
  4. package/debug/components/AbsolutePositionComponent.jsx +7 -9
  5. package/debug/components/GnssWifiComponent.jsx +5 -5
  6. package/debug/components/ImuComponent.jsx +4 -4
  7. package/debug/components/InclinationComponent.jsx +4 -4
  8. package/debug/components/RelativeAttitudeComponent.jsx +4 -4
  9. package/debug/components/StepDetectionComponent.jsx +4 -4
  10. package/debug/components/Utils.js +1 -1
  11. package/debug/{Common.css → css/App.css} +0 -44
  12. package/debug/css/UserOnMapHandler.css +43 -0
  13. package/debug/details/DetailsAttitudeComponent.jsx +1 -1
  14. package/debug/details/DetailsComponent.jsx +4 -5
  15. package/debug/details/DetailsPositionComponent.jsx +2 -2
  16. package/debug/details/ItineraryComponent.jsx +10 -69
  17. package/debug/index.js +8 -8
  18. package/debug/map/MapComponent.jsx +23 -15
  19. package/debug/map/MapHandler.js +7 -16
  20. package/debug/map/helpers/ItineraryMapHandler.js +15 -16
  21. package/debug/map/helpers/MapClickHandler.js +9 -7
  22. package/debug/map/helpers/UserOnMapHandler.js +38 -417
  23. package/debug/stores/ItineraryStore.js +23 -48
  24. package/dist/assets/indoor-maps/bureaux-wemap-montpellier.geojson +339 -513
  25. package/dist/js/providers-components.js +2361 -0
  26. package/dist/logger.html +58 -0
  27. package/index.js +7 -5
  28. package/package.json +25 -21
  29. package/src/Providers.js +15 -15
  30. package/src/ProvidersInterface.js +7 -5
  31. package/src/errors/MissingAccelerometerError.js +2 -2
  32. package/src/errors/MissingGyroscopeError.js +2 -2
  33. package/src/errors/MissingMagnetometerError.js +1 -1
  34. package/src/events/ProviderEvent.js +1 -1
  35. package/src/events/{ProvidersLogger.js → ProvidersLoggerOld.js} +7 -7
  36. package/src/logger/NavigationLogger.js +138 -0
  37. package/src/logger/NavigationLoggerConverter.js +263 -0
  38. package/src/providers/FakeProvider.spec.js +3 -4
  39. package/src/providers/MetaProvider.js +3 -3
  40. package/src/providers/Provider.js +12 -11
  41. package/src/providers/Provider.spec.js +5 -7
  42. package/src/providers/attitude/EkfAttitude.spec.js +1 -1
  43. package/src/providers/attitude/absolute/AbsoluteAttitudeFromBrowserProvider.js +9 -8
  44. package/src/providers/attitude/absolute/AbsoluteAttitudeFromRelAttProvider.js +5 -6
  45. package/src/providers/attitude/absolute/AbsoluteAttitudeProvider.js +3 -3
  46. package/src/providers/attitude/relative/RelativeAttitudeFromBrowserProvider.js +7 -5
  47. package/src/providers/attitude/relative/RelativeAttitudeFromEkfProvider.js +5 -5
  48. package/src/providers/attitude/relative/RelativeAttitudeFromInertialProvider.js +3 -3
  49. package/src/providers/attitude/relative/RelativeAttitudeProvider.js +5 -4
  50. package/src/providers/imu/AccelerometerProvider.js +4 -4
  51. package/src/providers/imu/GyroscopeProvider.js +4 -4
  52. package/src/providers/imu/ImuProvider.js +5 -4
  53. package/src/providers/inclination/InclinationFromAccProvider.js +3 -3
  54. package/src/providers/inclination/InclinationFromRelativeAttitudeProvider.js +3 -3
  55. package/src/providers/inclination/InclinationProvider.js +3 -3
  56. package/src/providers/legacy/helpers/HeadingUnlocker.spec.js +1 -1
  57. package/src/providers/others/BarcodeProvider.js +3 -3
  58. package/src/providers/others/CameraNativeProvider.js +4 -4
  59. package/src/providers/others/CameraProjectionMatrixProvider.js +3 -3
  60. package/src/providers/position/absolute/AbsolutePositionFromRelProvider.js +4 -4
  61. package/src/providers/position/absolute/AbsolutePositionProvider.js +5 -5
  62. package/src/providers/position/absolute/GnssWifiProvider.js +9 -6
  63. package/src/providers/position/absolute/IpProvider.js +3 -3
  64. package/src/providers/position/relative/ArCoreProvider.js +5 -5
  65. package/src/providers/position/relative/GeoRelativePositionFromArCoreProvider.js +3 -3
  66. package/src/providers/position/relative/GeoRelativePositionProvider.js +3 -3
  67. package/src/providers/position/relative/PdrProvider.js +3 -3
  68. package/src/providers/steps/StepDetectionProvider.js +11 -4
  69. package/src/smoothers/PositionSmoother.spec.js +1 -1
  70. package/webpack/{webpack.common.js → webpack.common.cjs} +7 -1
  71. package/webpack/{webpack.dev.js → webpack.dev.cjs} +1 -7
  72. package/webpack/{webpack.prod.js → webpack.prod.cjs} +1 -1
  73. package/babel.config.js +0 -11
  74. package/debug/map/MapboxHelper.js +0 -50
@@ -1,11 +1,11 @@
1
- import { Coordinates } from '@wemap/geo';
1
+ import { Coordinates, Level } from '@wemap/geo';
2
2
  import { Itinerary } from '@wemap/graph';
3
3
  import { OsrmUtils } from '@wemap/osm';
4
4
  import { Evented } from '@wemap/utils';
5
5
 
6
6
  import {
7
7
  ProvidersInterface, EventType
8
- } from '../..';
8
+ } from '../../index.js';
9
9
 
10
10
  const Events = {
11
11
  StartChanged: 'itinerary.start.changed',
@@ -13,32 +13,20 @@ const Events = {
13
13
  ItineraryChanged: 'itinerary.changed',
14
14
  ItineraryNotFound: 'itinerary.not.found',
15
15
  ItineraryComputing: 'itinerary.computing',
16
- ItineraryServerChanged: 'itinerary.server.changed',
17
16
  ServerError: 'itinerary.server.error',
18
17
  UseStairsChanged: 'itinerary.use.stairs.changed'
19
18
  };
20
19
 
21
- const Servers = {
22
- Indoor: {
23
- name: 'Indoor',
24
- routingUrl: 'https://osmrouter.getwemap.com'
25
- },
26
- Outdoor: {
27
- name: 'Outdoor',
28
- routingUrl: 'https://routingdev.maaap.it'
29
- }
30
- };
20
+ const SERVER_URL = 'https://routingindoor.maaap.it';
31
21
 
32
22
  class ItineraryStore extends Evented {
33
23
 
34
24
  _start = null;
35
25
  _end = null;
36
26
  _itinerary = null;
37
- _itineraryServer = Servers.Outdoor;
38
27
  _useStairs = true;
39
28
 
40
29
  static Events = Events;
41
- static Servers = Servers;
42
30
 
43
31
  static instance = new ItineraryStore();
44
32
 
@@ -48,10 +36,6 @@ class ItineraryStore extends Evented {
48
36
  set start(start) {
49
37
  this._start = start;
50
38
  this.fire(Events.StartChanged, start);
51
-
52
- if (start !== null && start.level !== null && this.itineraryServer !== Servers.Indoor) {
53
- this.itineraryServer = Servers.Indoor;
54
- }
55
39
  }
56
40
 
57
41
  /**
@@ -99,10 +83,6 @@ class ItineraryStore extends Evented {
99
83
  set end(end) {
100
84
  this._end = end;
101
85
  this.fire(Events.EndChanged, end);
102
-
103
- if (end !== null && end.level !== null && this.itineraryServer !== Servers.Indoor) {
104
- this.itineraryServer = Servers.Indoor;
105
- }
106
86
  }
107
87
 
108
88
  /**
@@ -126,21 +106,6 @@ class ItineraryStore extends Evented {
126
106
  return this.itineraryComputing;
127
107
  }
128
108
 
129
- /**
130
- * @param {Object}
131
- */
132
- set itineraryServer(itineraryServer) {
133
- this._itineraryServer = itineraryServer;
134
- this.fire(Events.ItineraryServerChanged, itineraryServer);
135
- }
136
-
137
- /**
138
- * @return {Object}
139
- */
140
- get itineraryServer() {
141
- return this._itineraryServer;
142
- }
143
-
144
109
  /**
145
110
  * @param {Boolean}
146
111
  */
@@ -172,19 +137,14 @@ class ItineraryStore extends Evented {
172
137
 
173
138
  computingFn(true);
174
139
 
175
- const isIndoor = this._itineraryServer === Servers.Indoor;
176
- const useStartLevel = isIndoor && start.level !== null;
177
- const useEndLevel = isIndoor && end.level !== null;
178
- const useStairs = !isIndoor || this.useStairs;
179
-
180
- const url = this._itineraryServer.routingUrl
140
+ const url = SERVER_URL
181
141
  + '/route/v1/walking/'
182
- + start.lng + ',' + start.lat + (useStartLevel ? ',' + start.level : '')
142
+ + start.lng + ',' + start.lat + (start.level !== null ? ',' + start.level.toString() : '')
183
143
  + ';'
184
- + end.lng + ',' + end.lat + (useEndLevel ? ',' + end.level : '')
144
+ + end.lng + ',' + end.lat + (end.level !== null ? ',' + end.level.toString() : '')
185
145
  + '?geometries=geojson&overview=full'
186
- + (isIndoor ? '&useAltitude=false' : '')
187
- + (!useStairs ? '&useStairs=false' : '');
146
+ + '&useAltitude=false'
147
+ + (!this.useStairs ? '&useStairs=false' : '');
188
148
 
189
149
 
190
150
  fetch(url)
@@ -205,6 +165,21 @@ class ItineraryStore extends Evented {
205
165
  this.itineraryComputing = false;
206
166
  this.fire(Events.ItineraryComputing, false);
207
167
 
168
+ if (itinerary.nodes.length > 0) {
169
+ const firstCoords = itinerary.nodes[0].coords;
170
+ const lastCoords = itinerary.nodes[itinerary.nodes.length - 1].coords;
171
+
172
+ if (!Level.equalsTo(firstCoords.level, start.level)) {
173
+ this.start.level = firstCoords.level;
174
+ this.fire(Events.StartChanged, start);
175
+ }
176
+
177
+ if (!Level.equalsTo(lastCoords.level, end.level)) {
178
+ this.end.level = lastCoords.level;
179
+ this.fire(Events.EndChanged, end);
180
+ }
181
+ }
182
+
208
183
  this._itinerary = itinerary;
209
184
  this.fire(Events.ItineraryChanged, itinerary);
210
185