@wemap/providers 3.1.23 → 3.2.1

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 +23 -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 +131 -0
  37. package/src/logger/NavigationLoggerConverter.js +228 -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 +5 -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
@@ -0,0 +1,16 @@
1
+ {
2
+ "presets": [
3
+ [
4
+ "@babel/preset-env",
5
+ {
6
+ "targets": {
7
+ "node": "current"
8
+ }
9
+ }
10
+ ],
11
+ "@babel/preset-react"
12
+ ],
13
+ "plugins": [
14
+ "@babel/plugin-proposal-class-properties"
15
+ ]
16
+ }
@@ -1,11 +1,11 @@
1
1
  import React from 'react';
2
2
 
3
- import { ProvidersInterface } from '..';
3
+ import { ProvidersInterface } from '../index.js';
4
4
 
5
- import MapComponent from './map/MapComponent';
6
- import DetailsComponent from './details/DetailsComponent';
5
+ import MapComponent from './map/MapComponent.jsx';
6
+ import DetailsComponent from './details/DetailsComponent.jsx';
7
7
 
8
- import './Common.css';
8
+ import './css/App.css';
9
9
 
10
10
  class MainComponent extends React.Component {
11
11
 
@@ -14,7 +14,7 @@ class MainComponent extends React.Component {
14
14
  constructor(props, context) {
15
15
  super(props, context);
16
16
  this.state = {
17
- details: true,
17
+ details: false,
18
18
  mapHandler: null
19
19
  };
20
20
 
@@ -6,13 +6,13 @@ import {
6
6
  } from '@wemap/geo';
7
7
  import { TimeUtils } from '@wemap/utils';
8
8
 
9
- import ProvidersLogger from '../../src/events/ProvidersLogger';
9
+ import ProvidersLoggerOld from '../../src/events/ProvidersLoggerOld.js';
10
10
  import {
11
11
  AbsoluteAttitudeFromBrowser, AbsoluteAttitudeFromRelAtt, AbsoluteAttitude, AbsolutePosition
12
- } from '../../src/Providers';
13
- import Utils from './Utils';
12
+ } from '../../src/Providers.js';
13
+ import Utils from './Utils.js';
14
14
 
15
- ProvidersLogger.enabled = true;
15
+ ProvidersLoggerOld.enabled = true;
16
16
 
17
17
  class AbsoluteAttitudeComponent extends React.Component {
18
18
 
@@ -100,7 +100,7 @@ class AbsoluteAttitudeComponent extends React.Component {
100
100
  const beta = this.state.deviceorientationabsolute.beta;
101
101
  const gamma = this.state.deviceorientationabsolute.gamma;
102
102
 
103
- if (alpha && beta && gamma) {
103
+ if (typeof alpha === 'number' && typeof beta === 'number' && typeof gamma === 'number') {
104
104
  rawRender = <p>alpha: {alpha.toFixed(2)}, <br />
105
105
  beta: {beta.toFixed(2)}, <br />
106
106
  gamma: {gamma.toFixed(2)}</p>;
@@ -1,9 +1,9 @@
1
1
  import React from 'react';
2
2
 
3
- import { AbsolutePosition } from '../../src/Providers';
4
- import Utils from './Utils';
5
- import NavigationConfig from './NavigationConfig';
6
- import MapComponent from '../map/MapComponent';
3
+ import { AbsolutePosition, AbsoluteAttitude } from '../../src/Providers.js';
4
+ import Utils from './Utils.js';
5
+ import NavigationConfig from './NavigationConfig.js';
6
+ import MapComponent from '../map/MapComponent.jsx';
7
7
 
8
8
 
9
9
  class AbsolutePositionComponent extends React.Component {
@@ -16,7 +16,8 @@ class AbsolutePositionComponent extends React.Component {
16
16
  componentDidMount() {
17
17
  this.providerId = AbsolutePosition.addEventListener(
18
18
  events => this.onNewPosition(events[0]),
19
- error => this.setState({ absolutePosition: error })
19
+ error => this.setState({ absolutePosition: error }),
20
+ false
20
21
  );
21
22
  }
22
23
 
@@ -26,9 +27,6 @@ class AbsolutePositionComponent extends React.Component {
26
27
 
27
28
  onNewPosition = position => {
28
29
  this.setState({ absolutePosition: position });
29
- if (this.map) {
30
- this.map.updatePosition(position.data);
31
- }
32
30
  };
33
31
 
34
32
  handlePosSubmit() {
@@ -36,7 +34,7 @@ class AbsolutePositionComponent extends React.Component {
36
34
  }
37
35
 
38
36
  handleHeadingSubmit() {
39
- AbsolutePosition.feed(NavigationConfig.INITIAL_HEADING);
37
+ AbsoluteAttitude.feed(NavigationConfig.INITIAL_HEADING);
40
38
  }
41
39
 
42
40
  render() {
@@ -1,11 +1,11 @@
1
1
  import React from 'react';
2
2
 
3
- import Utils from './Utils';
4
- import MapComponent from '../map/MapComponent';
5
- import ProvidersLogger from '../../src/events/ProvidersLogger';
6
- import { GnssWifi } from '../../src/Providers';
3
+ import Utils from './Utils.js';
4
+ import MapComponent from '../map/MapComponent.jsx';
5
+ import ProvidersLoggerOld from '../../src/events/ProvidersLoggerOld.js';
6
+ import { GnssWifi } from '../../src/Providers.js';
7
7
 
8
- ProvidersLogger.enabled = true;
8
+ ProvidersLoggerOld.enabled = true;
9
9
  class GnssWifiComponent extends React.Component {
10
10
 
11
11
  constructor(props, context) {
@@ -1,12 +1,12 @@
1
1
  import React from 'react';
2
2
 
3
- import Utils from './Utils';
4
- import ProvidersLogger from '../../src/events/ProvidersLogger';
3
+ import Utils from './Utils.js';
4
+ import ProvidersLoggerOld from '../../src/events/ProvidersLoggerOld.js';
5
5
  import {
6
6
  Accelerometer, Gyroscope
7
- } from '../../src/Providers';
7
+ } from '../../src/Providers.js';
8
8
 
9
- ProvidersLogger.enabled = true;
9
+ ProvidersLoggerOld.enabled = true;
10
10
 
11
11
  class ImuComponent extends React.Component {
12
12
 
@@ -1,10 +1,10 @@
1
1
  import React from 'react';
2
2
 
3
- import Utils from './Utils';
4
- import ProvidersLogger from '../../src/events/ProvidersLogger';
3
+ import Utils from './Utils.js';
4
+ import ProvidersLoggerOld from '../../src/events/ProvidersLoggerOld.js';
5
5
  import {
6
6
  InclinationFromAcc, InclinationFromRelativeAttitude, Inclination
7
- } from '../../src/Providers';
7
+ } from '../../src/Providers.js';
8
8
 
9
9
 
10
10
  class InclinationComponent extends React.Component {
@@ -12,7 +12,7 @@ class InclinationComponent extends React.Component {
12
12
 
13
13
  constructor(props, context) {
14
14
  super(props, context);
15
- ProvidersLogger.enabled = false;
15
+ ProvidersLoggerOld.enabled = false;
16
16
 
17
17
  this.state = {
18
18
  inclination: null,
@@ -1,12 +1,12 @@
1
1
  import React from 'react';
2
2
 
3
- import Utils from './Utils';
4
- import ProvidersLogger from '../../src/events/ProvidersLogger';
3
+ import Utils from './Utils.js';
4
+ import ProvidersLoggerOld from '../../src/events/ProvidersLoggerOld.js';
5
5
  import {
6
6
  RelativeAttitudeFromBrowser, RelativeAttitudeFromEkf, RelativeAttitude
7
- } from '../../src/Providers';
7
+ } from '../../src/Providers.js';
8
8
 
9
- ProvidersLogger.enabled = true;
9
+ ProvidersLoggerOld.enabled = true;
10
10
 
11
11
  class RelativeAttitudeComponent extends React.Component {
12
12
 
@@ -1,10 +1,10 @@
1
1
  import React from 'react';
2
2
 
3
- import Utils from './Utils';
4
- import ProvidersLogger from '../../src/events/ProvidersLogger';
5
- import { StepDetection } from '../../src/Providers';
3
+ import Utils from './Utils.js';
4
+ import ProvidersLoggerOld from '../../src/events/ProvidersLoggerOld.js';
5
+ import { StepDetection } from '../../src/Providers.js';
6
6
 
7
- ProvidersLogger.enabled = true;
7
+ ProvidersLoggerOld.enabled = true;
8
8
 
9
9
  class StepDetectionComponent extends React.Component {
10
10
 
@@ -3,7 +3,7 @@ import React from 'react'; // eslint-disable-line no-unused-vars
3
3
  import { rad2deg } from '@wemap/maths';
4
4
  import { OsrmUtils } from '@wemap/osm';
5
5
 
6
- import ProviderEvent from '../../src/events/ProviderEvent';
6
+ import ProviderEvent from '../../src/events/ProviderEvent.js';
7
7
 
8
8
  const NOT_AVAILABLE_STR = 'Not available';
9
9
 
@@ -48,46 +48,6 @@ p {
48
48
  font-size: 16px;
49
49
  }
50
50
 
51
- #location-marker {
52
- width: 14px;
53
- height: 14px;
54
- top: -7px;
55
- left: -7px;
56
- position: absolute;
57
- border-radius: 50%;
58
- background: #008DF1;
59
- border:1px solid #000000AA;
60
- }
61
-
62
- #location-marker.inaccurate {
63
- background: #AAAAAA;
64
- }
65
-
66
- #location-marker-compass {
67
- width: 15px;
68
- height: 15px;
69
- border-radius: 50%;
70
- z-index: 10000001;
71
- position: absolute;
72
- top: -14px;
73
- left: -14px;
74
- border: 7px solid;
75
- border-color: transparent;
76
- border-top-color: #008DF1;
77
- opacity: 0.5;
78
- }
79
-
80
- #location-marker-accuracy {
81
- position: absolute;
82
- border-radius: 50%;
83
- background: #008DF134;
84
- border:1px solid #00000034;
85
- }
86
-
87
- #location-marker-accuracy.inaccurate {
88
- background: #AAAAAA34;
89
- }
90
-
91
51
  .loader {
92
52
  display: inline-block;
93
53
  border: 3px solid #f3f3f3; /* Light grey */
@@ -120,10 +80,6 @@ p {
120
80
  border-color: blue;
121
81
  }
122
82
 
123
- .mapboxgl-ctrl button.mapboxgl-ctrl-geolocate-remove .mapboxgl-ctrl-icon {
124
- background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg width='29' height='29' viewBox='0 0 20 20' xmlns='http://www.w3.org/2000/svg' fill='%23aaa'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 005.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 009 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 003.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0011 5.1V5s0-1-1-1zm0 2.5a3.5 3.5 0 110 7 3.5 3.5 0 110-7z'/%3E%3Ccircle cx='10' cy='10' r='2'/%3E%3Cpath d='M14 5l1 1-9 9-1-1 9-9z' fill='red'/%3E%3C/svg%3E")
125
- }
126
-
127
83
  .map-click-list-element {
128
84
  cursor: pointer;
129
85
  -webkit-user-select: none;
@@ -0,0 +1,43 @@
1
+ #location-marker {
2
+ width: 14px;
3
+ height: 14px;
4
+ top: -7px;
5
+ left: -7px;
6
+ position: absolute;
7
+ border-radius: 50%;
8
+ background: #008DF1;
9
+ border:1px solid #000000AA;
10
+ }
11
+
12
+ #location-marker.inaccurate {
13
+ background: #AAAAAA;
14
+ }
15
+
16
+ #location-marker-compass {
17
+ width: 15px;
18
+ height: 15px;
19
+ border-radius: 50%;
20
+ z-index: 10000001;
21
+ position: absolute;
22
+ top: -14px;
23
+ left: -14px;
24
+ border: 7px solid;
25
+ border-color: transparent;
26
+ border-top-color: #008DF1;
27
+ opacity: 0.5;
28
+ }
29
+
30
+ #location-marker-accuracy {
31
+ position: absolute;
32
+ border-radius: 50%;
33
+ background: #008DF134;
34
+ border:1px solid #00000034;
35
+ }
36
+
37
+ #location-marker-accuracy.inaccurate {
38
+ background: #AAAAAA34;
39
+ }
40
+
41
+ .mapboxgl-ctrl button.mapboxgl-ctrl-geolocate-remove .mapboxgl-ctrl-icon {
42
+ background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg width='29' height='29' viewBox='0 0 20 20' xmlns='http://www.w3.org/2000/svg' fill='%23aaa'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 005.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 009 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 003.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0011 5.1V5s0-1-1-1zm0 2.5a3.5 3.5 0 110 7 3.5 3.5 0 110-7z'/%3E%3Ccircle cx='10' cy='10' r='2'/%3E%3Cpath d='M14 5l1 1-9 9-1-1 9-9z' fill='red'/%3E%3C/svg%3E")
43
+ }
@@ -9,7 +9,7 @@ import { TimeUtils } from '@wemap/utils';
9
9
 
10
10
  import {
11
11
  ProvidersInterface, EventType
12
- } from '../..';
12
+ } from '../../index.js';
13
13
 
14
14
  const Orientations = [
15
15
  {
@@ -1,11 +1,10 @@
1
1
  import PropTypes from 'prop-types';
2
2
  import React from 'react';
3
3
 
4
- import '../Common.css';
5
- import MapHandler from '../map/MapHandler';
6
- import DetailsPositionComponent from './DetailsPositionComponent';
7
- import DetailsAttitudeComponent from './DetailsAttitudeComponent';
8
- import ItineraryComponent from './ItineraryComponent';
4
+ import MapHandler from '../map/MapHandler.js';
5
+ import DetailsPositionComponent from './DetailsPositionComponent.jsx';
6
+ import DetailsAttitudeComponent from './DetailsAttitudeComponent.jsx';
7
+ import ItineraryComponent from './ItineraryComponent.jsx';
9
8
 
10
9
 
11
10
  class DetailsComponent extends React.Component {
@@ -9,9 +9,9 @@ import { TimeUtils } from '@wemap/utils';
9
9
 
10
10
  import {
11
11
  ProvidersInterface, EventType
12
- } from '../..';
12
+ } from '../../index.js';
13
13
 
14
- import Utils from '../components/Utils';
14
+ import Utils from '../components/Utils.js';
15
15
 
16
16
 
17
17
  const NOT_AVAILABLE_STR = Utils.NOT_AVAILABLE_STR;
@@ -3,10 +3,8 @@ import React from 'react';
3
3
 
4
4
  import { Level } from '@wemap/geo';
5
5
 
6
- import ItineraryStore from '../stores/ItineraryStore';
7
- import MapHandler from '../map/MapHandler';
8
-
9
- const ItineraryServers = ItineraryStore.Servers;
6
+ import ItineraryStore from '../stores/ItineraryStore.js';
7
+ import MapHandler from '../map/MapHandler.js';
10
8
 
11
9
  const Mode = {
12
10
  Config: 'config',
@@ -68,8 +66,8 @@ class ItineraryComponent extends React.PureComponent {
68
66
 
69
67
  const transformLevel = mapLevel => mapLevel === null ? '' : mapLevel.toString();
70
68
  const map = this.props.mapHandler.mapboxInstance;
71
- this.setState({ endLevel: transformLevel(map.getLevel()) });
72
- map.on('level', () => this.setState({ endLevel: transformLevel(map.getLevel()) }));
69
+ this.setState({ endLevel: transformLevel(map.indoor.getLevel()) });
70
+ map.on('indoor.level.changed', () => this.setState({ endLevel: transformLevel(map.indoor.getLevel()) }));
73
71
  }
74
72
 
75
73
  onItineraryChanged(itinerary) {
@@ -85,9 +83,7 @@ class ItineraryComponent extends React.PureComponent {
85
83
  this.itineraryStore.start = position;
86
84
  this.setState({ mode: Mode.Config });
87
85
  } else if (this.state.mode === Mode.SelectEndOnMap) {
88
- if (this.itineraryStore.itineraryServer === ItineraryServers.Indoor
89
- && this.state.endLevel !== ''
90
- ) {
86
+ if (this.state.endLevel !== '') {
91
87
  position.level = Level.fromString(this.state.endLevel);
92
88
  }
93
89
  this.itineraryStore.end = position;
@@ -150,15 +146,17 @@ class ItineraryComponent extends React.PureComponent {
150
146
  </div>
151
147
  : null}
152
148
  <div>
153
- {this.renderServer()}
149
+ {this.renderStart(lockedMode)}
154
150
  </div>
155
151
 
156
152
  <div style={{ marginTop: '5px' }}>
157
- {this.renderStart(lockedMode)}
153
+ {this.renderEnd(lockedMode)}
158
154
  </div>
159
155
 
160
156
  <div style={{ marginTop: '5px' }}>
161
- {this.renderEnd(lockedMode)}
157
+ <img id='wheelchair-icon'
158
+ className={!this.itineraryStore.useStairs ? 'selected' : null}
159
+ onClick={() => (this.itineraryStore.useStairs = !this.itineraryStore.useStairs)} />
162
160
  </div>
163
161
 
164
162
  <div style={{
@@ -178,44 +176,6 @@ class ItineraryComponent extends React.PureComponent {
178
176
  );
179
177
  }
180
178
 
181
- renderServer() {
182
-
183
- const serversList = Object.values(ItineraryServers);
184
- const serverValue = serversList.indexOf(this.itineraryStore.itineraryServer);
185
-
186
- const handleServerSelectChange = (event) => {
187
- const server = serversList[event.target.value];
188
- this.itineraryStore.itineraryServer = server;
189
- };
190
-
191
- const isIndoor = this.itineraryStore.itineraryServer === ItineraryServers.Indoor;
192
-
193
- return (
194
- <>
195
- Server:
196
- <select
197
- style={{ marginLeft: '5px' }}
198
- value={serverValue}
199
- onChange={handleServerSelectChange}>
200
- {
201
- serversList.map((server, index) =>
202
- <option key={index}
203
- value={index}>
204
- {server.name}
205
- </option>
206
- )
207
- }
208
- </select>
209
-
210
- {isIndoor ? (
211
- <img id='wheelchair-icon'
212
- className={!this.itineraryStore.useStairs ? 'selected' : null}
213
- onClick={() => (this.itineraryStore.useStairs = !this.itineraryStore.useStairs)} />
214
- ) : null}
215
- </>
216
- );
217
- }
218
-
219
179
  renderStart(lockedMode) {
220
180
 
221
181
  let buttons;
@@ -290,30 +250,11 @@ class ItineraryComponent extends React.PureComponent {
290
250
  );
291
251
  }
292
252
 
293
- const isIndoor = this.itineraryStore.itineraryServer === ItineraryServers.Indoor;
294
- const showEndLevel = isIndoor && !this.itineraryStore.end;
295
-
296
253
  return (
297
254
  <>
298
255
  <div>
299
256
  End:
300
257
  <span style={{ marginLeft: '5px' }}>{buttons}</span>
301
- {
302
- showEndLevel ? (
303
- <span style={{ marginLeft: '5px' }}>
304
- level:
305
- <input
306
- disabled={lockedMode && !this.state.mode === Mode.SelectEndOnMap}
307
- value={this.state.endLevel}
308
- onChange={event => this.setState({ endLevel: event.target.value })}
309
- style={{
310
- marginLeft: '5px',
311
- width: '30px'
312
- }}
313
- type='number' />
314
- </span>
315
- ) : null
316
- }
317
258
  </div>
318
259
  </>
319
260
  );
package/debug/index.js CHANGED
@@ -1,14 +1,14 @@
1
1
  import React from 'react';
2
2
  import ReactDOM from 'react-dom';
3
3
 
4
- import AbsoluteAttitudeComponent from './components/AbsoluteAttitudeComponent';
5
- import AbsolutePositionComponent from './components/AbsolutePositionComponent';
6
- import GnssWifiComponent from './components/GnssWifiComponent';
7
- import ImuComponent from './components/ImuComponent';
8
- import InclinationComponent from './components/InclinationComponent';
9
- import MainComponent from './MainComponent';
10
- import RelativeAttitudeComponent from './components/RelativeAttitudeComponent';
11
- import StepDetectionComponent from './components/StepDetectionComponent';
4
+ import AbsoluteAttitudeComponent from './components/AbsoluteAttitudeComponent.jsx';
5
+ import AbsolutePositionComponent from './components/AbsolutePositionComponent.jsx';
6
+ import GnssWifiComponent from './components/GnssWifiComponent.jsx';
7
+ import ImuComponent from './components/ImuComponent.jsx';
8
+ import InclinationComponent from './components/InclinationComponent.jsx';
9
+ import MainComponent from './MainComponent.jsx';
10
+ import RelativeAttitudeComponent from './components/RelativeAttitudeComponent.jsx';
11
+ import StepDetectionComponent from './components/StepDetectionComponent.jsx';
12
12
 
13
13
  const createReactElement = (component, container) => ReactDOM.render(
14
14
  React.createElement(component, {}, null),
@@ -1,15 +1,17 @@
1
1
  import React from 'react';
2
- import mapboxgl from 'mapbox-gl';
3
- import 'mapbox-gl-css';
2
+ import { Map } from 'mapbox-gl';
3
+ import {
4
+ Indoor, IndoorControl, IndoorMap
5
+ } from 'mapbox-gl-indoor';
4
6
  import PropTypes from 'prop-types';
5
7
  import noop from 'lodash.noop';
6
8
 
7
- import MapHandler from './MapHandler';
9
+ import MapHandler from './MapHandler.js';
8
10
 
9
- mapboxgl.accessToken
10
- = 'pk.eyJ1IjoibWFwYm94IiwiYSI6ImNpejY4M29iazA2Z2gycXA4N2pmbDZmangifQ.-g_vE53SD2WrJ6tFX7QHmA';
11
+ import 'mapbox-gl/dist/mapbox-gl.css';
11
12
 
12
- const BELOW_LAYER_ID = 'housenum-label';
13
+ const accessToken
14
+ = 'pk.eyJ1IjoibWFwYm94IiwiYSI6ImNpejY4M29iazA2Z2gycXA4N2pmbDZmangifQ.-g_vE53SD2WrJ6tFX7QHmA';
13
15
 
14
16
  class MapComponent extends React.Component {
15
17
  static propTypes = {
@@ -24,42 +26,48 @@ class MapComponent extends React.Component {
24
26
  };
25
27
 
26
28
  componentDidMount() {
27
- this.map = new mapboxgl.Map({
29
+ this.map = new Map({
30
+ accessToken,
28
31
  container: this.mapContainer,
29
32
  style: 'mapbox://styles/mapbox/streets-v10',
30
33
  maxZoom: this.props.maxZoom
31
34
  });
35
+ this.map.indoor = new Indoor(this.map);
32
36
 
33
- this.mapHandler = new MapHandler(this.map, this.mapContainer);
34
- this.mapHandler.componentDidMount();
35
-
37
+ this.mapHandler = new MapHandler(this.map);
36
38
 
37
39
  const mapLoadedFn = () => this.props.onMapLoaded(this.mapHandler);
38
40
 
39
41
  this.map.on('load', () => {
40
42
  if (this.props.indoorMaps && this.props.indoorMaps.length > 0) {
41
- this.loadIndoorMaps(this.props.indoorMaps)
43
+ this._loadIndoorMaps(this.props.indoorMaps)
42
44
  .then(mapLoadedFn);
43
45
  } else {
44
46
  mapLoadedFn();
45
47
  }
46
48
  });
47
49
 
48
- this.map.addControl(new mapboxgl.IndoorControl());
50
+ this.map.addControl(new IndoorControl(this.map.indoor));
49
51
 
50
52
  }
51
53
 
52
54
  componentWillUnmount() {
53
- this.mapHandler.componentWillUnmount();
54
55
  this.map.remove();
55
56
  }
56
57
 
57
- loadIndoorMaps(mapsPaths) {
58
+ _loadIndoorMaps(mapsPaths) {
59
+ const beforeLayerId = 'housenum-label';
60
+ const layersToHide = ['poi-scalerank4-l15', 'poi-scalerank4-l1', 'poi-scalerank3', 'road-label-small'];
61
+
58
62
  return Promise.all(
59
63
  mapsPaths.map(mapPath =>
60
64
  fetch(mapPath)
61
65
  .then(res => res.json())
62
- .then(geojson => this.map.indoor.addMap(geojson, null, BELOW_LAYER_ID)))
66
+ .then(geojson => this.map.indoor.addMap(IndoorMap.fromGeojson(geojson, {
67
+ beforeLayerId,
68
+ layersToHide,
69
+ showFeaturesWithEmptyLevel: true
70
+ }))))
63
71
  );
64
72
  }
65
73
 
@@ -1,10 +1,10 @@
1
- import mapboxgl from 'mapbox-gl';
1
+ import { Map } from 'mapbox-gl';
2
2
 
3
3
  import { Coordinates } from '@wemap/geo';
4
4
 
5
- import ItineraryMapHandler from './helpers/ItineraryMapHandler';
6
- import UserOnMapHandler from './helpers/UserOnMapHandler';
7
- import MapClickHandler from './helpers/MapClickHandler';
5
+ import ItineraryMapHandler from './helpers/ItineraryMapHandler.js';
6
+ import UserOnMapHandler from './helpers/UserOnMapHandler.js';
7
+ import MapClickHandler from './helpers/MapClickHandler.js';
8
8
 
9
9
  class MapHandler {
10
10
 
@@ -13,24 +13,15 @@ class MapHandler {
13
13
 
14
14
  /**
15
15
  *
16
- * @param {mapboxgl.Map} map
17
- * @param {HTMLDivElement} mapContainer
16
+ * @param {Map} map
18
17
  */
19
- constructor(map, mapContainer) {
18
+ constructor(map) {
20
19
  this.itineraryMapHandler = new ItineraryMapHandler(map);
21
- this.userOnMapHandler = new UserOnMapHandler(map, mapContainer);
20
+ this.userOnMapHandler = new UserOnMapHandler(map);
22
21
  this.mapClickHandler = new MapClickHandler(map, this.userOnMapHandler);
23
22
  this.map = map;
24
23
  }
25
24
 
26
- componentDidMount() {
27
- this.userOnMapHandler.componentDidMount();
28
- }
29
-
30
- componentWillUnmount() {
31
- this.userOnMapHandler.componentWillUnmount();
32
- }
33
-
34
25
  /**
35
26
  * @param {Function} fn
36
27
  */