@wemap/positioning 2.3.10 → 2.4.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/package.json CHANGED
@@ -8,9 +8,10 @@
8
8
  "Guillaume Pannetier <guillaume.pannetier@getwemap.com>"
9
9
  ],
10
10
  "dependencies": {
11
- "@wemap/geo": "^0.1.4",
12
- "@wemap/logger": "^0.1.4",
13
- "@wemap/maths": "^0.1.2",
11
+ "@wemap/geo": "^0.2.1",
12
+ "@wemap/logger": "^0.1.5",
13
+ "@wemap/maths": "^0.2.0",
14
+ "@wemap/osm": "^0.1.1",
14
15
  "@wemap/utils": "^0.1.2",
15
16
  "file-saver": "^2.0.2",
16
17
  "geomagnetism": "^0.1.0",
@@ -81,5 +82,5 @@
81
82
  "lint": "eslint --ext .js,.jsx --quiet src",
82
83
  "test": "mocha -r esm \"src/**/*.spec.js\""
83
84
  },
84
- "version": "2.3.10"
85
+ "version": "2.4.0"
85
86
  }
@@ -1,12 +1,9 @@
1
1
  import React from 'react';
2
2
 
3
- import { WGS84 } from '@wemap/geo';
4
-
5
3
  import AbsoluteAttitudeProvider from '../providers/attitude/AbsoluteAttitudeProvider';
6
4
  import Utils from './Utils';
7
5
  import EventType from '../events/EventType';
8
6
 
9
- const userPosition = new WGS84(43.609275, 3.884236);
10
7
 
11
8
  class AbsoluteAttitudeComponent extends React.Component {
12
9
 
@@ -20,7 +17,7 @@ class AbsoluteAttitudeComponent extends React.Component {
20
17
  };
21
18
 
22
19
  this.absoluteAttitudeProvider = new AbsoluteAttitudeProvider(this.onEvent, this.onError);
23
- this.absoluteAttitudeProvider.setPosition(userPosition);
20
+ this.absoluteAttitudeProvider.setPosition(Utils.INITIAL_POSITION);
24
21
  }
25
22
 
26
23
  componentDidMount() {
@@ -1,27 +1,15 @@
1
1
  import React from 'react';
2
2
  import isEmpty from 'lodash.isempty';
3
3
 
4
+ import { deg2rad } from '@wemap/maths';
5
+
4
6
  import EventType from '../events/EventType';
5
7
  import Utils from './Utils';
6
8
  import ArCoreAbsoluteProvider from '../providers/pose/ArCoreAbsoluteProvider';
7
- import { deg2rad } from '@wemap/maths';
8
- import {
9
- WGS84UserPosition, Itinerary
10
- } from '@wemap/geo';
11
9
  import MapComponent from './MapComponent';
12
10
 
13
- const INITIAL_POSITION = new WGS84UserPosition(43.6091955, 3.8841255);
14
- const INITIAL_HEADING = 191.9;
15
- const ITINERARY = Itinerary.fromPoints([
16
- [INITIAL_POSITION.lat, INITIAL_POSITION.lng],
17
- [43.6091883, 3.8841242],
18
- [43.6091709, 3.8842382],
19
- [43.6091288, 3.884226],
20
- [43.6091461, 3.884112]
21
- ], false);
22
11
 
23
12
  class ArCoreAbsoluteComponent extends React.Component {
24
-
25
13
  constructor(props, context) {
26
14
  super(props, context);
27
15
  this.state = {
@@ -29,10 +17,12 @@ class ArCoreAbsoluteComponent extends React.Component {
29
17
  attitude: null
30
18
  };
31
19
 
32
- this.arCoreAbsoluteProvider = new ArCoreAbsoluteProvider(this.onEvent, this.onError);
33
- this.arCoreAbsoluteProvider.setPosition(INITIAL_POSITION);
34
- this.arCoreAbsoluteProvider.setHeading(deg2rad(INITIAL_HEADING));
35
-
20
+ this.arCoreAbsoluteProvider = new ArCoreAbsoluteProvider(
21
+ this.onEvent,
22
+ this.onError
23
+ );
24
+ this.arCoreAbsoluteProvider.setPosition(Utils.INITIAL_POSITION);
25
+ this.arCoreAbsoluteProvider.setHeading(deg2rad(Utils.INITIAL_HEADING));
36
26
  }
37
27
 
38
28
  componentDidMount() {
@@ -43,51 +33,50 @@ class ArCoreAbsoluteComponent extends React.Component {
43
33
  this.arCoreAbsoluteProvider.stop();
44
34
  }
45
35
 
46
- onEvent = events => {
47
- const newState = {};
48
- events.forEach(event => {
49
- if (event.dataType === EventType.AbsolutePosition) {
50
- newState.position = event.data;
51
- } else if (event.dataType === EventType.AbsoluteAttitude) {
52
- newState.attitude = event.data;
53
- }
54
- });
55
- if (!isEmpty(newState)) {
56
- this.setState(newState);
57
- }
58
-
59
- if (this.map) {
60
- this.map.parseEvents(events);
61
- }
62
- };
63
-
64
- onError = error => {
65
- this.setState({
66
- position: error,
67
- attitude: error
68
- });
69
- }
70
-
71
- render() {
72
-
73
- const attitudeRender = Utils.renderAttitude(this.state.attitude);
74
- const positionRender = Utils.renderPosition(this.state.position);
75
-
76
- return (
77
- <div>
78
- <h3>Position</h3>
79
- {positionRender}
80
- <h3>Attitude</h3>
81
- {attitudeRender}
82
- <h3>Map</h3>
83
- <MapComponent
84
- ref={map => (this.map = map)}
85
- defaultZoom={21}
86
- network={ITINERARY} />
87
- </div>
88
-
89
- );
90
- }
36
+ onEvent = events => {
37
+ const newState = {};
38
+ events.forEach(event => {
39
+ if (event.dataType === EventType.AbsolutePosition) {
40
+ newState.position = event.data;
41
+ } else if (event.dataType === EventType.AbsoluteAttitude) {
42
+ newState.attitude = event.data;
43
+ }
44
+ });
45
+ if (!isEmpty(newState)) {
46
+ this.setState(newState);
47
+ }
48
+
49
+ if (this.map) {
50
+ this.map.parseEvents(events);
51
+ }
52
+ };
53
+
54
+ onError = error => {
55
+ this.setState({
56
+ position: error,
57
+ attitude: error
58
+ });
59
+ };
60
+
61
+ render() {
62
+ const attitudeRender = Utils.renderAttitude(this.state.attitude);
63
+ const positionRender = Utils.renderPosition(this.state.position);
64
+
65
+ return (
66
+ <div>
67
+ <h3>Position</h3>
68
+ {positionRender}
69
+ <h3>Attitude</h3>
70
+ {attitudeRender}
71
+ <h3>Map</h3>
72
+ <MapComponent
73
+ ref={map => (this.map = map)}
74
+ defaultZoom={21}
75
+ network={Utils.ITINERARY}
76
+ />
77
+ </div>
78
+ );
79
+ }
91
80
  }
92
81
 
93
82
  export default ArCoreAbsoluteComponent;
@@ -1,36 +1,24 @@
1
1
  import isEmpty from 'lodash.isempty';
2
2
  import React from 'react';
3
3
 
4
- import {
5
- Itinerary, WGS84UserPosition
6
- } from '@wemap/geo';
7
-
8
4
  import Utils from './Utils';
9
5
  import EventType from '../events/EventType';
10
6
  import GnssWifiPdrProvider from '../providers/pose/GnssWifiPdrProvider';
11
7
  import MapComponent from './MapComponent';
12
8
 
13
- const INITIAL_POSITION = new WGS84UserPosition(43.6091955, 3.8841255);
14
- const ITINERARY = Itinerary.fromPoints([
15
- [INITIAL_POSITION.lat, INITIAL_POSITION.lng],
16
- [43.6091883, 3.8841242],
17
- [43.6091709, 3.8842382],
18
- [43.6091288, 3.884226],
19
- [43.6091461, 3.884112]
20
- ], false);
21
-
22
9
  class GnssWifiPdrComponent extends React.Component {
23
-
24
10
  constructor(props, context) {
25
11
  super(props, context);
26
12
  this.state = { position: null };
27
13
 
28
- this.gnssWifiPdrProvider = new GnssWifiPdrProvider(this.onEvent, this.onError);
14
+ this.gnssWifiPdrProvider = new GnssWifiPdrProvider(
15
+ this.onEvent,
16
+ this.onError
17
+ );
29
18
  }
30
19
 
31
-
32
20
  componentDidMount() {
33
- this.gnssWifiPdrProvider.enableMapMatching(ITINERARY);
21
+ this.gnssWifiPdrProvider.enableMapMatching(Utils.ITINERARY);
34
22
  this.gnssWifiPdrProvider.start();
35
23
  }
36
24
 
@@ -38,50 +26,47 @@ class GnssWifiPdrComponent extends React.Component {
38
26
  this.gnssWifiPdrProvider.stop();
39
27
  }
40
28
 
41
- onEvent = events => {
42
- const newState = {};
43
- events.forEach(event => {
44
- if (event.dataType === EventType.AbsolutePosition) {
45
- newState.position = event.data;
46
- } else if (event.dataType === EventType.AbsoluteAttitude) {
47
- newState.attitude = event.data;
48
- }
49
- });
50
- if (!isEmpty(newState)) {
51
- this.setState(newState);
52
- }
53
-
54
- if (this.map) {
55
- this.map.parseEvents(events);
56
- }
57
- };
58
-
59
- onError = error => {
60
- this.setState({
61
- position: error,
62
- attitude: error
63
- });
64
- }
65
-
66
- render() {
67
-
68
- const attitudeRender = Utils.renderAttitude(this.state.attitude);
69
- const positionRender = Utils.renderPosition(this.state.position);
70
-
71
- return (
72
- <div>
73
- <h3>Position</h3>
74
- {positionRender}
75
- <h3>Attitude</h3>
76
- {attitudeRender}
77
- <h3>Map</h3>
78
- <MapComponent
79
- ref={map => (this.map = map)}
80
- network={ITINERARY} />
81
- </div>
82
-
83
- );
84
- }
29
+ onEvent = events => {
30
+ const newState = {};
31
+ events.forEach(event => {
32
+ if (event.dataType === EventType.AbsolutePosition) {
33
+ newState.position = event.data;
34
+ } else if (event.dataType === EventType.AbsoluteAttitude) {
35
+ newState.attitude = event.data;
36
+ }
37
+ });
38
+ if (!isEmpty(newState)) {
39
+ this.setState(newState);
40
+ }
41
+
42
+ if (this.map) {
43
+ this.map.parseEvents(events);
44
+ }
45
+ };
46
+
47
+ onError = error => {
48
+ this.setState({
49
+ position: error,
50
+ attitude: error
51
+ });
52
+ };
53
+
54
+ render() {
55
+ const attitudeRender = Utils.renderAttitude(this.state.attitude);
56
+ const positionRender = Utils.renderPosition(this.state.position);
57
+
58
+ return (
59
+ <div>
60
+ <h3>Position</h3>
61
+ {positionRender}
62
+ <h3>Attitude</h3>
63
+ {attitudeRender}
64
+ <h3>Map</h3>
65
+ <MapComponent ref={map => (this.map = map)}
66
+ network={Utils.ITINERARY} />
67
+ </div>
68
+ );
69
+ }
85
70
  }
86
71
 
87
72
  export default GnssWifiPdrComponent;
@@ -4,8 +4,9 @@ import 'mapbox-gl/dist/mapbox-gl.css';
4
4
  import PropTypes from 'prop-types';
5
5
 
6
6
  import {
7
- WGS84, Attitude, Network
7
+ Attitude, Network, WGS84
8
8
  } from '@wemap/geo';
9
+
9
10
  import EventType from '../events/EventType';
10
11
 
11
12
  mapboxgl.accessToken = 'pk.eyJ1IjoibWFwYm94IiwiYSI6ImNpejY4M29iazA2Z2gycXA4N2pmbDZmangifQ.-g_vE53SD2WrJ6tFX7QHmA';
@@ -209,11 +210,11 @@ class MapComponent extends React.Component {
209
210
  }
210
211
  };
211
212
 
212
- for (let i = 0; i < network.length; i++) {
213
+ for (let i = 0; i < network.edges.length; i++) {
213
214
  layer.source.data.geometry.coordinates.push(
214
215
  [
215
- [network.edges[i].node1.lng, network.edges[i].node1.lat],
216
- [network.edges[i].node2.lng, network.edges[i].node2.lat]
216
+ [network.edges[i].node1.coords.lng, network.edges[i].node1.coords.lat],
217
+ [network.edges[i].node2.coords.lng, network.edges[i].node2.coords.lat]
217
218
  ]
218
219
  );
219
220
  }
@@ -1,39 +1,23 @@
1
1
  import isEmpty from 'lodash.isempty';
2
2
  import React from 'react';
3
3
 
4
- import {
5
- Itinerary, WGS84UserPosition
6
- } from '@wemap/geo';
7
-
8
4
  import Utils from './Utils';
9
5
  import PdrProvider from '../providers/pose/pdr/PdrProvider';
10
6
  import EventType from '../events/EventType';
11
7
  import MapComponent from './MapComponent';
12
8
 
13
- const INITIAL_POSITION = new WGS84UserPosition(43.6091955, 3.8841255);
14
- const INITIAL_HEADING = 191.9;
15
- const ITINERARY = Itinerary.fromPoints([
16
- [INITIAL_POSITION.lat, INITIAL_POSITION.lng],
17
- [43.6091883, 3.8841242],
18
- [43.6091709, 3.8842382],
19
- [43.6091288, 3.884226],
20
- [43.6091461, 3.884112]
21
- ], false);
22
-
23
9
  class PdrComponent extends React.Component {
24
-
25
10
  constructor(props, context) {
26
11
  super(props, context);
27
12
  this.state = { position: null };
28
13
 
29
14
  this.pdrProvider = new PdrProvider(this.onEvent, this.onError);
30
- this.pdrProvider.enableMapMatching(ITINERARY);
15
+ this.pdrProvider.enableMapMatching(Utils.ITINERARY);
31
16
  }
32
17
 
33
-
34
18
  componentDidMount() {
35
- this.pdrProvider.setPosition(INITIAL_POSITION);
36
- this.pdrProvider.setHeading(INITIAL_HEADING);
19
+ this.pdrProvider.setPosition(Utils.INITIAL_POSITION);
20
+ this.pdrProvider.setHeading(Utils.INITIAL_HEADING);
37
21
  this.pdrProvider.start();
38
22
  }
39
23
 
@@ -41,50 +25,47 @@ class PdrComponent extends React.Component {
41
25
  this.pdrProvider.stop();
42
26
  }
43
27
 
44
- onEvent = events => {
45
- const newState = {};
46
- events.forEach(event => {
47
- if (event.dataType === EventType.AbsolutePosition) {
48
- newState.position = event.data;
49
- } else if (event.dataType === EventType.AbsoluteAttitude) {
50
- newState.attitude = event.data;
51
- }
52
- });
53
- if (!isEmpty(newState)) {
54
- this.setState(newState);
55
- }
56
-
57
- if (this.map) {
58
- this.map.parseEvents(events);
59
- }
60
- };
61
-
62
- onError = error => {
63
- this.setState({
64
- position: error,
65
- attitude: error
66
- });
67
- }
68
-
69
- render() {
70
-
71
- const attitudeRender = Utils.renderAttitude(this.state.attitude);
72
- const positionRender = Utils.renderPosition(this.state.position);
73
-
74
- return (
75
- <div>
76
- <h3>Position</h3>
77
- {positionRender}
78
- <h3>Attitude</h3>
79
- {attitudeRender}
80
- <h3>Map</h3>
81
- <MapComponent
82
- ref={map => (this.map = map)}
83
- network={ITINERARY} />
84
- </div>
85
-
86
- );
87
- }
28
+ onEvent = events => {
29
+ const newState = {};
30
+ events.forEach(event => {
31
+ if (event.dataType === EventType.AbsolutePosition) {
32
+ newState.position = event.data;
33
+ } else if (event.dataType === EventType.AbsoluteAttitude) {
34
+ newState.attitude = event.data;
35
+ }
36
+ });
37
+ if (!isEmpty(newState)) {
38
+ this.setState(newState);
39
+ }
40
+
41
+ if (this.map) {
42
+ this.map.parseEvents(events);
43
+ }
44
+ };
45
+
46
+ onError = error => {
47
+ this.setState({
48
+ position: error,
49
+ attitude: error
50
+ });
51
+ };
52
+
53
+ render() {
54
+ const attitudeRender = Utils.renderAttitude(this.state.attitude);
55
+ const positionRender = Utils.renderPosition(this.state.position);
56
+
57
+ return (
58
+ <div>
59
+ <h3>Position</h3>
60
+ {positionRender}
61
+ <h3>Attitude</h3>
62
+ {attitudeRender}
63
+ <h3>Map</h3>
64
+ <MapComponent ref={map => (this.map = map)}
65
+ network={Utils.ITINERARY} />
66
+ </div>
67
+ );
68
+ }
88
69
  }
89
70
 
90
71
  export default PdrComponent;
@@ -21,11 +21,17 @@ class PositioningInclinationComponent extends React.Component {
21
21
 
22
22
 
23
23
  start() {
24
- this.id = this.props.positioningHandler.start(
24
+ const output = this.props.positioningHandler.start(
25
25
  [EventType.Inclination],
26
26
  this.onEvents,
27
27
  this.onError
28
- ).id;
28
+ );
29
+
30
+ if (!output) {
31
+ return;
32
+ }
33
+
34
+ this.id = output.id;
29
35
  }
30
36
 
31
37
 
@@ -51,7 +57,7 @@ class PositioningInclinationComponent extends React.Component {
51
57
 
52
58
  onError = error => {
53
59
  this.setState({
54
- errorer: true,
60
+ errored: true,
55
61
  inclination: error
56
62
  });
57
63
  }
@@ -6,116 +6,101 @@ import EventType from '../events/EventType';
6
6
  import Utils from './Utils';
7
7
  import PositioningHandler from '../PositioningHandler';
8
8
  import StartStopComponent from './StartStopComponent';
9
- import {
10
- WGS84UserPosition, Itinerary
11
- } from '@wemap/geo';
12
9
  import MapComponent from './MapComponent';
13
10
 
14
- const INITIAL_POSITION = new WGS84UserPosition(43.6091955, 3.8841255);
15
- const INITIAL_HEADING = 191.9;
16
- const ITINERARY = Itinerary.fromPoints([
17
- [INITIAL_POSITION.lat, INITIAL_POSITION.lng],
18
- [43.6091883, 3.8841242],
19
- [43.6091709, 3.8842382],
20
- [43.6091288, 3.884226],
21
- [43.6091461, 3.884112]
22
- ], false);
23
11
 
24
12
  class PositioningPoseComponent extends React.Component {
25
-
26
- static propTypes = { positioningHandler: PropTypes.instanceOf(PositioningHandler).isRequired };
27
-
28
- constructor(props, context) {
29
- super(props, context);
30
- this.state = {
31
- position: null,
32
- attitude: null,
33
- errored: false
34
- };
35
- }
36
-
37
-
38
- start() {
39
- const output = this.props.positioningHandler.start(
40
- [EventType.AbsolutePosition, EventType.AbsoluteAttitude],
41
- this.onEvents,
42
- this.onError,
43
- {
44
- waitInputPosition: true,
45
- useMapMatching: true
46
- }
47
- );
48
-
49
- if (!output) {
50
- return;
51
- }
52
-
53
- this.id = output.id;
54
-
55
- this.props.positioningHandler.setItinerary(this.id, ITINERARY);
56
- this.props.positioningHandler.setNetwork(this.id, ITINERARY);
57
- this.props.positioningHandler.setPosition(this.id, INITIAL_POSITION);
58
- this.props.positioningHandler.setHeading(this.id, INITIAL_HEADING);
59
- }
60
-
61
-
62
- stop() {
63
- this.props.positioningHandler.stop(this.id);
64
- this.setState({
65
- position: null,
66
- attitude: null,
67
- errored: false
68
- });
69
- }
70
-
71
- onEvents = (events) => {
72
- const newState = {};
73
- events.forEach(event => {
74
- if (event.dataType === EventType.AbsolutePosition) {
75
- newState.position = event.data;
76
- } else if (event.dataType === EventType.AbsoluteAttitude) {
77
- newState.attitude = event.data;
78
- }
79
- });
80
- if (!isEmpty(newState)) {
81
- this.setState(newState);
82
- }
83
-
84
- if (this.map) {
85
- this.map.parseEvents(events);
86
- }
87
- };
88
-
89
- onError = error => {
90
- this.setState({
91
- position: error,
92
- attitude: error,
93
- errored: true
94
- });
95
- }
96
-
97
- render() {
98
- const attitudeRender = Utils.renderAttitude(this.state.attitude);
99
- const positionRender = Utils.renderPosition(this.state.position);
100
-
101
- return (
102
- <div>
103
- <StartStopComponent
104
- onStart={() => this.start()}
105
- onStop={() => this.stop()}
106
- errored={this.state.errored} />
107
-
108
- <h3>Position</h3>
109
- {positionRender}
110
- <h3>Attitude</h3>
111
- {attitudeRender}
112
- <h3>Map</h3>
113
- <MapComponent
114
- ref={map => (this.map = map)}
115
- network={ITINERARY} />
116
- </div>
117
- );
118
- }
13
+ static propTypes = {positioningHandler: PropTypes.instanceOf(PositioningHandler).isRequired};
14
+
15
+ constructor(props, context) {
16
+ super(props, context);
17
+ this.state = {
18
+ position: null,
19
+ attitude: null,
20
+ errored: false
21
+ };
22
+ }
23
+
24
+ start() {
25
+ const output = this.props.positioningHandler.start(
26
+ [EventType.AbsolutePosition, EventType.AbsoluteAttitude],
27
+ this.onEvents,
28
+ this.onError,
29
+ {
30
+ waitInputPosition: true,
31
+ useMapMatching: true
32
+ }
33
+ );
34
+
35
+ if (!output) {
36
+ return;
37
+ }
38
+
39
+ this.id = output.id;
40
+
41
+ this.props.positioningHandler.setItinerary(this.id, Utils.ITINERARY);
42
+ this.props.positioningHandler.setNetwork(this.id, Utils.ITINERARY);
43
+ this.props.positioningHandler.setPosition(this.id, Utils.INITIAL_POSITION);
44
+ this.props.positioningHandler.setHeading(this.id, Utils.INITIAL_HEADING);
45
+ }
46
+
47
+ stop() {
48
+ this.props.positioningHandler.stop(this.id);
49
+ this.setState({
50
+ position: null,
51
+ attitude: null,
52
+ errored: false
53
+ });
54
+ }
55
+
56
+ onEvents = events => {
57
+ const newState = {};
58
+ events.forEach(event => {
59
+ if (event.dataType === EventType.AbsolutePosition) {
60
+ newState.position = event.data;
61
+ } else if (event.dataType === EventType.AbsoluteAttitude) {
62
+ newState.attitude = event.data;
63
+ }
64
+ });
65
+ if (!isEmpty(newState)) {
66
+ this.setState(newState);
67
+ }
68
+
69
+ if (this.map) {
70
+ this.map.parseEvents(events);
71
+ }
72
+ };
73
+
74
+ onError = error => {
75
+ this.setState({
76
+ position: error,
77
+ attitude: error,
78
+ errored: true
79
+ });
80
+ };
81
+
82
+ render() {
83
+ const attitudeRender = Utils.renderAttitude(this.state.attitude);
84
+ const positionRender = Utils.renderPosition(this.state.position);
85
+
86
+ return (
87
+ <div>
88
+ <StartStopComponent
89
+ onStart={() => this.start()}
90
+ onStop={() => this.stop()}
91
+ errored={this.state.errored}
92
+ />
93
+
94
+ <h3>Position</h3>
95
+ {positionRender}
96
+ <h3>Attitude</h3>
97
+ {attitudeRender}
98
+ <h3>Map</h3>
99
+ <MapComponent ref={map => (this.map = map)}
100
+ network={Utils.ITINERARY} />
101
+ </div>
102
+ );
103
+ }
119
104
  }
120
105
 
121
106
  export default PositioningPoseComponent;
@@ -1,10 +1,29 @@
1
1
  import React from 'react'; // eslint-disable-line no-unused-vars
2
+
3
+ import {
4
+ Itinerary, WGS84UserPosition
5
+ } from '@wemap/geo';
2
6
  import { rad2deg } from '@wemap/maths';
3
7
 
4
8
  const NOT_AVAILABLE_STR = 'Not available';
5
9
 
6
10
  class Utils {
7
11
 
12
+ static INITIAL_POSITION = new WGS84UserPosition(43.6091955, 3.8841255);
13
+ static INITIAL_HEADING = 191.9;
14
+ static ITINERARY = Itinerary.fromOrderedPointsArray(
15
+ [
16
+ [Utils.INITIAL_POSITION.lat, Utils.INITIAL_POSITION.lng],
17
+ [43.6091883, 3.8841242],
18
+ [43.6091709, 3.8842382],
19
+ [43.6091288, 3.884226],
20
+ [43.6091461, 3.884112]
21
+ ],
22
+ [Utils.INITIAL_POSITION.lat, Utils.INITIAL_POSITION.lng],
23
+ [43.6091461, 3.884112],
24
+ false
25
+ );
26
+
8
27
  static renderAttitude(attitude) {
9
28
 
10
29
  if (!attitude) {
@@ -87,6 +106,7 @@ class Utils {
87
106
  return (<span><strong>[{error.constructor.name}]</strong> {error.message}</span>);
88
107
  }
89
108
 
109
+
90
110
  }
91
111
 
92
112
  export default Utils;
@@ -1,6 +1,6 @@
1
1
  import Provider from '../Provider';
2
2
  import {
3
- WGS84, Edge, Itinerary, Network, MapMatching
3
+ Edge, Itinerary, MapMatching, Network, WGS84
4
4
  } from '@wemap/geo';
5
5
 
6
6
  class MapMatchingProvider extends Provider {
@@ -115,7 +115,7 @@ class MapMatchingProvider extends Provider {
115
115
  if (edge.node1.equalsTo(projection.nearestElement)) {
116
116
  break;
117
117
  }
118
- traveledDistance += edge.getLength();
118
+ traveledDistance += edge.length;
119
119
  }
120
120
 
121
121
 
@@ -127,7 +127,7 @@ class MapMatchingProvider extends Provider {
127
127
  traveledDistance += edge.node1.distanceTo(projection.projection);
128
128
  break;
129
129
  }
130
- traveledDistance += edge.getLength();
130
+ traveledDistance += edge.length;
131
131
  }
132
132
 
133
133
  } else {
@@ -193,7 +193,7 @@ class GnssWifiPdrProvider extends MapMatchingProvider {
193
193
  }
194
194
 
195
195
  let startEdge;
196
- if (itinerary.firstEdge.getLength() <= MM_GNSS_DIST) {
196
+ if (itinerary.firstEdge.length <= MM_GNSS_DIST) {
197
197
  startEdge = itinerary.firstEdge;
198
198
  } else {
199
199
  startEdge = itinerary.secondEdge;
@@ -201,7 +201,7 @@ class GnssWifiPdrProvider extends MapMatchingProvider {
201
201
  const startPoint = WGS84UserPosition.fromWGS84(startEdge.node1);
202
202
  startPoint.alt = Constants.DEFAULT_ALTITUDE;
203
203
  this.pdrProvider.setPosition(startPoint);
204
- this.pdrProvider.setStepDetectionLockerOrientation(startEdge.getBearing());
204
+ this.pdrProvider.setStepDetectionLockerOrientation(startEdge.bearing);
205
205
  }
206
206
 
207
207
  }
@@ -1,7 +1,7 @@
1
1
  import noop from 'lodash.noop';
2
2
 
3
3
  import {
4
- Constants as GeoConstants, Itinerary, WGS84UserPosition, WGS84
4
+ Constants as GeoConstants, Itinerary, WGS84, WGS84UserPosition
5
5
  } from '@wemap/geo';
6
6
  import {
7
7
  rad2deg, Quaternion
@@ -314,14 +314,15 @@ class PdrProvider extends MapMatchingProvider {
314
314
  throw new Error('Empty itinerary');
315
315
  }
316
316
 
317
- if (itinerary.firstEdge.getLength() > LO_SEGMENT_SIZE) {
318
- return itinerary.firstEdge.getBearing();
317
+ const edgeAt = itinerary.getEdgeAt(LO_SEGMENT_SIZE);
318
+ if (edgeAt) {
319
+ return edgeAt.bearing;
319
320
  }
320
321
 
321
322
  if (itinerary.length < 2) {
322
323
  throw new Error('Itinerary is too short');
323
324
  }
324
- return itinerary.secondEdge.getBearing();
325
+ return itinerary.secondEdge.bearing;
325
326
  }
326
327
 
327
328
  setStepDetectionLockerOrientation(orientation) {