@wemap/positioning 2.7.13 → 14.0.0-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/README.md +51 -0
- package/dist/index.d.ts +19 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +16582 -0
- package/dist/qr-scanner-worker.min-CdBZO1_x.js +2 -0
- package/dist/src/ILocationSource.d.ts +104 -0
- package/dist/src/ILocationSource.d.ts.map +1 -0
- package/dist/src/MapMatching.d.ts +83 -0
- package/dist/src/MapMatching.d.ts.map +1 -0
- package/dist/src/location-sources/GnssWifiLocationSource.d.ts +79 -0
- package/dist/src/location-sources/GnssWifiLocationSource.d.ts.map +1 -0
- package/dist/src/location-sources/LocationSource.d.ts +102 -0
- package/dist/src/location-sources/LocationSource.d.ts.map +1 -0
- package/dist/src/location-sources/VPSLocationSource.d.ts +107 -0
- package/dist/src/location-sources/VPSLocationSource.d.ts.map +1 -0
- package/dist/src/types.d.ts +65 -0
- package/dist/src/types.d.ts.map +1 -0
- package/dist/src/utils/permissions.d.ts +29 -0
- package/dist/src/utils/permissions.d.ts.map +1 -0
- package/dist/vitest.config.d.ts +3 -0
- package/dist/vitest.config.d.ts.map +1 -0
- package/package.json +23 -59
- package/babel.config.js +0 -11
- package/config.json +0 -4
- package/debug/absolute-attitude.html +0 -16
- package/debug/arcore-absolute.html +0 -16
- package/debug/arcore.html +0 -16
- package/debug/components/AbsoluteAttitudeComponent.jsx +0 -100
- package/debug/components/ArCoreAbsoluteComponent.jsx +0 -104
- package/debug/components/ArCoreComponent.jsx +0 -69
- package/debug/components/GnssWifiComponent.jsx +0 -56
- package/debug/components/GnssWifiPdrComponent.jsx +0 -76
- package/debug/components/ImuComponent.jsx +0 -95
- package/debug/components/InclinationComponent.jsx +0 -52
- package/debug/components/MapComponent.jsx +0 -228
- package/debug/components/NavigationConfig.js +0 -92
- package/debug/components/PdrComponent.jsx +0 -75
- package/debug/components/PoseComponent.jsx +0 -77
- package/debug/components/PositioningComponent.jsx +0 -29
- package/debug/components/PositioningInclinationComponent.jsx +0 -82
- package/debug/components/PositioningPoseComponent.jsx +0 -117
- package/debug/components/RelativeAttitudeComponent.jsx +0 -82
- package/debug/components/StartStopComponent.jsx +0 -50
- package/debug/components/Utils.js +0 -128
- package/debug/components/index.js +0 -34
- package/debug/gnss-wifi-pdr.html +0 -16
- package/debug/gnss-wifi.html +0 -16
- package/debug/imu.html +0 -16
- package/debug/inclination.html +0 -16
- package/debug/pdr.html +0 -16
- package/debug/pose.html +0 -16
- package/debug/positioning.html +0 -16
- package/debug/relative-attitude.html +0 -16
- package/dist/wemap-positioning.min.js +0 -1
- package/index.js +0 -8
- package/src/PositioningHandler.js +0 -237
- package/src/PositioningHandler.spec.js +0 -294
- package/src/PositioningOptions.js +0 -34
- package/src/errors/AskImuOnDesktopError.js +0 -9
- package/src/errors/ContainsIgnoredProviderError.js +0 -9
- package/src/errors/GeolocationApiMissingError.js +0 -9
- package/src/errors/GeolocationPermissionDeniedError.js +0 -9
- package/src/errors/GeolocationPositionUnavailableError.js +0 -9
- package/src/errors/IpResolveServerError.js +0 -9
- package/src/errors/MissingAccelerometerError.js +0 -11
- package/src/errors/MissingArCoreError.js +0 -9
- package/src/errors/MissingGyroscopeError.js +0 -11
- package/src/errors/MissingMagnetometerError.js +0 -9
- package/src/errors/MissingNativeInterfaceError.js +0 -9
- package/src/errors/MissingSensorError.js +0 -14
- package/src/errors/NoProviderFoundError.js +0 -9
- package/src/events/Availability.js +0 -30
- package/src/events/EventType.js +0 -22
- package/src/events/ProviderEvent.js +0 -35
- package/src/providers/Constants.js +0 -5
- package/src/providers/Provider.js +0 -247
- package/src/providers/ProvidersList.js +0 -44
- package/src/providers/ProvidersLogger.js +0 -75
- package/src/providers/attitude/AbsoluteAttitudeProvider.js +0 -199
- package/src/providers/attitude/EkfAttitude.js +0 -238
- package/src/providers/attitude/EkfAttitude.spec.js +0 -116
- package/src/providers/attitude/RelativeAttitudeProvider.js +0 -121
- package/src/providers/others/ImuProvider.js +0 -179
- package/src/providers/others/InclinationProvider.js +0 -99
- package/src/providers/others/MapMatchingProvider.js +0 -65
- package/src/providers/pose/ArCoreAbsoluteProvider.js +0 -235
- package/src/providers/pose/ArCoreProvider.js +0 -191
- package/src/providers/pose/GnssWifiPdrProvider.js +0 -219
- package/src/providers/pose/PoseProvider.js +0 -71
- package/src/providers/pose/pdr/PdrProvider.js +0 -364
- package/src/providers/pose/pdr/helpers/HeadingUnlocker.js +0 -41
- package/src/providers/pose/pdr/helpers/HeadingUnlocker.spec.js +0 -26
- package/src/providers/pose/pdr/helpers/Smoother.js +0 -92
- package/src/providers/pose/pdr/helpers/Smoother.spec.js +0 -426
- package/src/providers/pose/pdr/helpers/ThugDetector.js +0 -37
- package/src/providers/pose/pdr/steps/StepDetection.js +0 -7
- package/src/providers/pose/pdr/steps/StepDetectionLadetto.js +0 -67
- package/src/providers/pose/pdr/steps/StepDetectionMinMaxPeaks.js +0 -80
- package/src/providers/pose/pdr/steps/StepDetectionMinMaxPeaks2.js +0 -108
- package/src/providers/position/GnssWifiProvider.js +0 -130
- package/src/providers/position/IpProvider.js +0 -74
- package/webpack/webpack.common.js +0 -20
- package/webpack/webpack.dev.js +0 -24
- package/webpack/webpack.prod.js +0 -15
|
@@ -1,95 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
|
|
3
|
-
import EventType from '../../src/events/EventType';
|
|
4
|
-
import ImuProvider from '../../src/providers/others/ImuProvider';
|
|
5
|
-
import Utils from './Utils';
|
|
6
|
-
import ProvidersLogger from '../../src/providers/ProvidersLogger';
|
|
7
|
-
|
|
8
|
-
ProvidersLogger.enabled = true;
|
|
9
|
-
|
|
10
|
-
class ImuComponent extends React.Component {
|
|
11
|
-
|
|
12
|
-
constructor(props, context) {
|
|
13
|
-
super(props, context);
|
|
14
|
-
|
|
15
|
-
this.state = {
|
|
16
|
-
acc: null,
|
|
17
|
-
gyr: null
|
|
18
|
-
};
|
|
19
|
-
|
|
20
|
-
this.imuProvider = new ImuProvider(this.onEvent, this.onError, {require: [
|
|
21
|
-
EventType.Acceleration, EventType.AngularRate
|
|
22
|
-
]});
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
componentDidMount() {
|
|
26
|
-
this.imuProvider.start();
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
componentWillUnmount() {
|
|
30
|
-
this.imuProvider.stop();
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
onEvent = events => {
|
|
34
|
-
const newState = {};
|
|
35
|
-
|
|
36
|
-
events.forEach(event => {
|
|
37
|
-
if (event.dataType === EventType.Acceleration) {
|
|
38
|
-
newState.acc = event.data;
|
|
39
|
-
}
|
|
40
|
-
if (event.dataType === EventType.AngularRate) {
|
|
41
|
-
newState.gyr = event.data;
|
|
42
|
-
}
|
|
43
|
-
});
|
|
44
|
-
|
|
45
|
-
this.setState(newState);
|
|
46
|
-
};
|
|
47
|
-
|
|
48
|
-
onError = error => {
|
|
49
|
-
this.setState({
|
|
50
|
-
acc: error,
|
|
51
|
-
gyr: error
|
|
52
|
-
});
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
render() {
|
|
56
|
-
|
|
57
|
-
let accelerometerString;
|
|
58
|
-
const acc = this.state.acc;
|
|
59
|
-
if (!acc) {
|
|
60
|
-
accelerometerString = 'Waiting';
|
|
61
|
-
} else if (acc instanceof Error) {
|
|
62
|
-
accelerometerString = Utils.renderError(acc);
|
|
63
|
-
} else {
|
|
64
|
-
accelerometerString = '[' + acc[0].toFixed(2)
|
|
65
|
-
+ ', ' + acc[1].toFixed(2)
|
|
66
|
-
+ ', ' + acc[2].toFixed(2)
|
|
67
|
-
+ ']';
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
let gyroscopeString;
|
|
71
|
-
const gyr = this.state.gyr;
|
|
72
|
-
if (!gyr) {
|
|
73
|
-
gyroscopeString = 'Waiting';
|
|
74
|
-
} else if (gyr instanceof Error) {
|
|
75
|
-
gyroscopeString = Utils.renderError(gyr);
|
|
76
|
-
} else {
|
|
77
|
-
gyroscopeString = '[' + gyr[0].toFixed(2)
|
|
78
|
-
+ ', ' + gyr[1].toFixed(2)
|
|
79
|
-
+ ', ' + gyr[2].toFixed(2)
|
|
80
|
-
+ ']';
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
return (
|
|
84
|
-
<div>
|
|
85
|
-
<h3>Acceleration</h3>
|
|
86
|
-
<p>{accelerometerString}</p>
|
|
87
|
-
<h3>Angular Velocity</h3>
|
|
88
|
-
<p>{gyroscopeString}</p>
|
|
89
|
-
</div>
|
|
90
|
-
);
|
|
91
|
-
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
export default ImuComponent;
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
|
|
3
|
-
import InclinationProvider from '../../src/providers/others/InclinationProvider';
|
|
4
|
-
import EventType from '../../src/events/EventType';
|
|
5
|
-
import Utils from './Utils';
|
|
6
|
-
import ProvidersLogger from '../../src/providers/ProvidersLogger';
|
|
7
|
-
|
|
8
|
-
ProvidersLogger.enabled = true;
|
|
9
|
-
|
|
10
|
-
class InclinationComponent extends React.Component {
|
|
11
|
-
|
|
12
|
-
constructor(props, context) {
|
|
13
|
-
super(props, context);
|
|
14
|
-
|
|
15
|
-
this.state = { inclination: null };
|
|
16
|
-
|
|
17
|
-
this.inclinationProvider = new InclinationProvider(this.onEvent, this.onError);
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
componentDidMount() {
|
|
21
|
-
this.inclinationProvider.start();
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
componentWillUnmount() {
|
|
25
|
-
this.inclinationProvider.stop();
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
onEvent = events => {
|
|
29
|
-
events.forEach(event => {
|
|
30
|
-
if (event.dataType === EventType.Inclination) {
|
|
31
|
-
this.setState({ inclination: event.data });
|
|
32
|
-
}
|
|
33
|
-
});
|
|
34
|
-
};
|
|
35
|
-
|
|
36
|
-
onError = error => {
|
|
37
|
-
this.setState({ inclination: error });
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
render() {
|
|
41
|
-
|
|
42
|
-
return (
|
|
43
|
-
<div>
|
|
44
|
-
<h3>Inclination</h3>
|
|
45
|
-
<p>{Utils.renderInclination(this.state.inclination)}</p>
|
|
46
|
-
</div>
|
|
47
|
-
);
|
|
48
|
-
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
export default InclinationComponent;
|
|
@@ -1,228 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import mapboxgl from 'mapbox-gl';
|
|
3
|
-
import 'mapbox-gl/dist/mapbox-gl.css';
|
|
4
|
-
import PropTypes from 'prop-types';
|
|
5
|
-
|
|
6
|
-
import {
|
|
7
|
-
Attitude, WGS84
|
|
8
|
-
} from '@wemap/geo';
|
|
9
|
-
import { Network } from '@wemap/graph';
|
|
10
|
-
|
|
11
|
-
import EventType from '../../src/events/EventType';
|
|
12
|
-
|
|
13
|
-
mapboxgl.accessToken
|
|
14
|
-
= 'pk.eyJ1IjoibWFwYm94IiwiYSI6ImNpejY4M29iazA2Z2gycXA4N2pmbDZmangifQ.-g_vE53SD2WrJ6tFX7QHmA';
|
|
15
|
-
|
|
16
|
-
const COMPASS_STYLE = {
|
|
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
|
-
const POSITION_STYLE = {
|
|
31
|
-
width: '15px',
|
|
32
|
-
height: '15px',
|
|
33
|
-
top: '-7px',
|
|
34
|
-
left: '-7px',
|
|
35
|
-
position: 'absolute',
|
|
36
|
-
'border-radius': '50%',
|
|
37
|
-
background: '#008DF1'
|
|
38
|
-
};
|
|
39
|
-
|
|
40
|
-
class MapComponent extends React.Component {
|
|
41
|
-
static propTypes = {
|
|
42
|
-
network: PropTypes.instanceOf(Network),
|
|
43
|
-
defaultZoom: PropTypes.number
|
|
44
|
-
};
|
|
45
|
-
|
|
46
|
-
static defaultProps = { defaultZoom: 19 };
|
|
47
|
-
|
|
48
|
-
componentDidMount() {
|
|
49
|
-
this.map = new mapboxgl.Map({
|
|
50
|
-
container: this.mapContainer,
|
|
51
|
-
style: 'mapbox://styles/mapbox/streets-v9'
|
|
52
|
-
});
|
|
53
|
-
this.renderNetwork();
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
componentWillUnmount() {
|
|
57
|
-
this.map.remove();
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
createMarker(options) {
|
|
61
|
-
var elem, marker;
|
|
62
|
-
|
|
63
|
-
elem = document.createElement('div');
|
|
64
|
-
elem.style.marginLeft = '-' + options.iconAnchor[0] + 'px';
|
|
65
|
-
elem.style.marginTop = '-' + options.iconAnchor[1] + 'px';
|
|
66
|
-
elem.style.width = 0;
|
|
67
|
-
elem.style.height = 0;
|
|
68
|
-
elem.appendChild(options.dom);
|
|
69
|
-
|
|
70
|
-
marker = new mapboxgl.Marker(elem);
|
|
71
|
-
marker.setLngLat([options.longitude, options.latitude]);
|
|
72
|
-
return marker;
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
createPositionMarker(position) {
|
|
76
|
-
const coreIcon = document.createElement('div');
|
|
77
|
-
this.applyStyleToDomElement(coreIcon, POSITION_STYLE);
|
|
78
|
-
|
|
79
|
-
this.positionIcon = document.createElement('div');
|
|
80
|
-
this.positionIcon.appendChild(coreIcon);
|
|
81
|
-
|
|
82
|
-
return this.createMarker({
|
|
83
|
-
dom: this.positionIcon,
|
|
84
|
-
iconAnchor: [0, 0],
|
|
85
|
-
latitude: position[1],
|
|
86
|
-
longitude: position[0]
|
|
87
|
-
});
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
createCompassElement() {
|
|
91
|
-
if (!this.positionIcon) {
|
|
92
|
-
throw new Error('createPositionMarker() should be called before');
|
|
93
|
-
}
|
|
94
|
-
this.compassIcon = document.createElement('div');
|
|
95
|
-
this.applyStyleToDomElement(this.compassIcon, COMPASS_STYLE);
|
|
96
|
-
this.positionIcon.appendChild(this.compassIcon);
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
applyStyleToDomElement(domElement, style) {
|
|
100
|
-
for (const key in style) {
|
|
101
|
-
if (style.hasOwnProperty(key)) {
|
|
102
|
-
domElement.style[key] = style[key];
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
parseEvents(events) {
|
|
108
|
-
if (!this.map) {
|
|
109
|
-
return;
|
|
110
|
-
}
|
|
111
|
-
events.forEach(event => {
|
|
112
|
-
if (event.dataType === EventType.AbsolutePosition) {
|
|
113
|
-
this.updatePosition(event.data);
|
|
114
|
-
} else if (event.dataType === EventType.AbsoluteAttitude) {
|
|
115
|
-
this.updateAttitude(event.data);
|
|
116
|
-
}
|
|
117
|
-
});
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
updatePosition(position) {
|
|
121
|
-
if (!this.map) {
|
|
122
|
-
return;
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
if (!(position instanceof WGS84)) {
|
|
126
|
-
if (this.mapMarker) {
|
|
127
|
-
this.mapMarker.remove();
|
|
128
|
-
this.mapMarker = null;
|
|
129
|
-
this.positionIcon = null;
|
|
130
|
-
}
|
|
131
|
-
return;
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
const lngLat = [position.lng, position.lat];
|
|
135
|
-
|
|
136
|
-
if (!this.mapMarker) {
|
|
137
|
-
this.mapMarker = this.createPositionMarker(lngLat).addTo(this.map);
|
|
138
|
-
this.map.jumpTo({
|
|
139
|
-
center: lngLat,
|
|
140
|
-
zoom: this.props.defaultZoom
|
|
141
|
-
});
|
|
142
|
-
} else {
|
|
143
|
-
this.mapMarker.setLngLat(lngLat);
|
|
144
|
-
}
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
updateAttitude(attitude) {
|
|
148
|
-
if (!this.positionIcon) {
|
|
149
|
-
return;
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
if (!(attitude instanceof Attitude)) {
|
|
153
|
-
if (this.compassIcon) {
|
|
154
|
-
this.positionIcon.removeChild(this.compassIcon);
|
|
155
|
-
}
|
|
156
|
-
return;
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
if (!this.compassIcon) {
|
|
160
|
-
this.createCompassElement();
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
this.positionIcon.style.transform
|
|
164
|
-
= 'rotate(' + attitude.headingDegrees + 'deg)';
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
renderNetwork() {
|
|
168
|
-
if (!this.map) {
|
|
169
|
-
return;
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
const network = this.props.network;
|
|
173
|
-
|
|
174
|
-
if (network === this.previousNetwork) {
|
|
175
|
-
return;
|
|
176
|
-
}
|
|
177
|
-
this.previousNetwork = network;
|
|
178
|
-
|
|
179
|
-
if (!network) {
|
|
180
|
-
if (this.networkLayer) {
|
|
181
|
-
this.map.removeLayer(this.networkLayer);
|
|
182
|
-
this.networkLayer = null;
|
|
183
|
-
}
|
|
184
|
-
return;
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
const layer = {
|
|
188
|
-
id: 'network',
|
|
189
|
-
type: 'line',
|
|
190
|
-
source: {
|
|
191
|
-
type: 'geojson',
|
|
192
|
-
data: {
|
|
193
|
-
type: 'Feature',
|
|
194
|
-
properties: {},
|
|
195
|
-
geometry: {
|
|
196
|
-
type: 'MultiLineString',
|
|
197
|
-
coordinates: []
|
|
198
|
-
}
|
|
199
|
-
}
|
|
200
|
-
},
|
|
201
|
-
paint: {
|
|
202
|
-
'line-color': '#0000FF',
|
|
203
|
-
'line-width': 3
|
|
204
|
-
}
|
|
205
|
-
};
|
|
206
|
-
|
|
207
|
-
for (let i = 0; i < network.edges.length; i++) {
|
|
208
|
-
layer.source.data.geometry.coordinates.push([
|
|
209
|
-
[network.edges[i].node1.coords.lng, network.edges[i].node1.coords.lat],
|
|
210
|
-
[network.edges[i].node2.coords.lng, network.edges[i].node2.coords.lat]
|
|
211
|
-
]);
|
|
212
|
-
}
|
|
213
|
-
|
|
214
|
-
this.map.on('load', () => {
|
|
215
|
-
this.networkLayer = this.map.addLayer(layer);
|
|
216
|
-
});
|
|
217
|
-
}
|
|
218
|
-
|
|
219
|
-
render() {
|
|
220
|
-
this.renderNetwork();
|
|
221
|
-
return (
|
|
222
|
-
<div ref={map => (this.mapContainer = map)}
|
|
223
|
-
style={{ height: '300px' }} />
|
|
224
|
-
);
|
|
225
|
-
}
|
|
226
|
-
}
|
|
227
|
-
|
|
228
|
-
export default MapComponent;
|
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
import React from 'react'; // eslint-disable-line no-unused-vars
|
|
2
|
-
|
|
3
|
-
import {
|
|
4
|
-
WGS84UserPosition, Level
|
|
5
|
-
} from '@wemap/geo';
|
|
6
|
-
import { Itinerary } from '@wemap/graph';
|
|
7
|
-
import { deg2rad } from '@wemap/maths';
|
|
8
|
-
|
|
9
|
-
const datasets = {};
|
|
10
|
-
|
|
11
|
-
// Wemap Office
|
|
12
|
-
const wemapOffice = {
|
|
13
|
-
initialPosition: new WGS84UserPosition(43.6091955, 3.8841255, 1.5),
|
|
14
|
-
initialHeading: deg2rad(191.9)
|
|
15
|
-
};
|
|
16
|
-
wemapOffice.itinerary = Itinerary.fromOrderedPointsArray(
|
|
17
|
-
[
|
|
18
|
-
[wemapOffice.initialPosition.lat, wemapOffice.initialPosition.lng],
|
|
19
|
-
[43.6091883, 3.8841242],
|
|
20
|
-
[43.6091709, 3.8842382],
|
|
21
|
-
[43.6091288, 3.884226],
|
|
22
|
-
[43.6091461, 3.884112]
|
|
23
|
-
],
|
|
24
|
-
[wemapOffice.initialPosition.lat, wemapOffice.initialPosition.lng],
|
|
25
|
-
[43.6091461, 3.884112]
|
|
26
|
-
);
|
|
27
|
-
|
|
28
|
-
// Wemap Office Multi-level
|
|
29
|
-
const wemapOfficeMulti = {
|
|
30
|
-
initialPosition: new WGS84UserPosition(43.6091965, 3.8841285, 1.5, new Level(2)),
|
|
31
|
-
initialHeading: deg2rad(191.9)
|
|
32
|
-
};
|
|
33
|
-
wemapOfficeMulti.itinerary = Itinerary.fromOrderedPointsArray(
|
|
34
|
-
[
|
|
35
|
-
[43.6091888, 3.8841263, new Level(2)],
|
|
36
|
-
[43.6091749, 3.8842173, new Level(2)],
|
|
37
|
-
[43.6092935, 3.8842518, new Level(2)],
|
|
38
|
-
[43.6093022, 3.8842702, new Level(2)],
|
|
39
|
-
[43.6093123, 3.8842731, new Level(2)],
|
|
40
|
-
[43.6093234, 3.8842009, new Level(2)],
|
|
41
|
-
[43.6093629, 3.8842127, new Level(1, 2)],
|
|
42
|
-
[43.6093597, 3.8842336, new Level(1, 2)],
|
|
43
|
-
[43.6093202, 3.8842218, new Level(1)],
|
|
44
|
-
[43.6093123, 3.8842731, new Level(1)],
|
|
45
|
-
[43.6092681, 3.8842604, new Level(1)]
|
|
46
|
-
],
|
|
47
|
-
[wemapOfficeMulti.initialPosition.lat, wemapOffice.initialPosition.lng, wemapOfficeMulti.initialPosition.level],
|
|
48
|
-
[43.6092602, 3.8842669, new Level(1)]
|
|
49
|
-
);
|
|
50
|
-
|
|
51
|
-
// Gare de Lyon RER A
|
|
52
|
-
const gareDeLyonRerA = {
|
|
53
|
-
initialPosition: new WGS84UserPosition(48.8442365, 2.3728267, 1.5, new Level(-2)),
|
|
54
|
-
initialHeading: deg2rad(41.6)
|
|
55
|
-
};
|
|
56
|
-
gareDeLyonRerA.itinerary = Itinerary.fromOrderedPointsArray(
|
|
57
|
-
[
|
|
58
|
-
[48.8442368, 2.3728274, new Level(-2)],
|
|
59
|
-
[48.8442378, 2.3728257, new Level(-2)],
|
|
60
|
-
[48.8443732, 2.3726023, new Level(-1)],
|
|
61
|
-
[48.8443864, 2.3726195, new Level(-1)],
|
|
62
|
-
[48.8444032, 2.3726407, new Level(-1)]
|
|
63
|
-
],
|
|
64
|
-
[gareDeLyonRerA.initialPosition.lat, gareDeLyonRerA.initialPosition.lng, gareDeLyonRerA.initialPosition.level],
|
|
65
|
-
[48.8444315, 2.3726809, new Level(-1)]
|
|
66
|
-
);
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
datasets['wemap-office'] = wemapOffice;
|
|
70
|
-
datasets['wemap-office-multi'] = wemapOfficeMulti;
|
|
71
|
-
datasets['gare-de-lyon-rer-a'] = gareDeLyonRerA;
|
|
72
|
-
|
|
73
|
-
class NavigationConfig {
|
|
74
|
-
|
|
75
|
-
static INITIAL_POSITION = wemapOffice.initialPosition;
|
|
76
|
-
static INITIAL_HEADING = wemapOffice.initialHeading;
|
|
77
|
-
static ITINERARY = wemapOffice.itinerary;
|
|
78
|
-
|
|
79
|
-
static load(datasetName) {
|
|
80
|
-
|
|
81
|
-
const dataset = datasets[datasetName];
|
|
82
|
-
if (!dataset) {
|
|
83
|
-
throw new Error('Unknown ' + datasetName);
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
this.INITIAL_POSITION = dataset.initialPosition;
|
|
87
|
-
this.INITIAL_HEADING = dataset.initialHeading;
|
|
88
|
-
this.ITINERARY = dataset.itinerary;
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
export default NavigationConfig;
|
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
import isEmpty from 'lodash.isempty';
|
|
2
|
-
import React from 'react';
|
|
3
|
-
|
|
4
|
-
import NavigationConfig from './NavigationConfig';
|
|
5
|
-
import Utils from './Utils';
|
|
6
|
-
import PdrProvider from '../../src/providers/pose/pdr/PdrProvider';
|
|
7
|
-
import EventType from '../../src/events/EventType';
|
|
8
|
-
import MapComponent from './MapComponent';
|
|
9
|
-
import ProvidersLogger from '../../src/providers/ProvidersLogger';
|
|
10
|
-
|
|
11
|
-
ProvidersLogger.enabled = true;
|
|
12
|
-
|
|
13
|
-
class PdrComponent extends React.Component {
|
|
14
|
-
constructor(props, context) {
|
|
15
|
-
super(props, context);
|
|
16
|
-
this.state = { position: null };
|
|
17
|
-
|
|
18
|
-
this.pdrProvider = new PdrProvider(this.onEvent, this.onError);
|
|
19
|
-
this.pdrProvider.enableMapMatching(NavigationConfig.ITINERARY);
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
componentDidMount() {
|
|
23
|
-
this.pdrProvider.setPosition(NavigationConfig.INITIAL_POSITION);
|
|
24
|
-
this.pdrProvider.setHeading(NavigationConfig.INITIAL_HEADING);
|
|
25
|
-
this.pdrProvider.start();
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
componentWillUnmount() {
|
|
29
|
-
this.pdrProvider.stop();
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
onEvent = events => {
|
|
33
|
-
const newState = {};
|
|
34
|
-
events.forEach(event => {
|
|
35
|
-
if (event.dataType === EventType.AbsolutePosition) {
|
|
36
|
-
newState.position = event.data;
|
|
37
|
-
} else if (event.dataType === EventType.AbsoluteAttitude) {
|
|
38
|
-
newState.attitude = event.data;
|
|
39
|
-
}
|
|
40
|
-
});
|
|
41
|
-
if (!isEmpty(newState)) {
|
|
42
|
-
this.setState(newState);
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
if (this.map) {
|
|
46
|
-
this.map.parseEvents(events);
|
|
47
|
-
}
|
|
48
|
-
};
|
|
49
|
-
|
|
50
|
-
onError = error => {
|
|
51
|
-
this.setState({
|
|
52
|
-
position: error,
|
|
53
|
-
attitude: error
|
|
54
|
-
});
|
|
55
|
-
};
|
|
56
|
-
|
|
57
|
-
render() {
|
|
58
|
-
const attitudeRender = Utils.renderAttitude(this.state.attitude);
|
|
59
|
-
const positionRender = Utils.renderPosition(this.state.position);
|
|
60
|
-
|
|
61
|
-
return (
|
|
62
|
-
<div>
|
|
63
|
-
<h3>Position</h3>
|
|
64
|
-
{positionRender}
|
|
65
|
-
<h3>Attitude</h3>
|
|
66
|
-
{attitudeRender}
|
|
67
|
-
<h3>Map</h3>
|
|
68
|
-
<MapComponent ref={map => (this.map = map)}
|
|
69
|
-
network={NavigationConfig.ITINERARY} />
|
|
70
|
-
</div>
|
|
71
|
-
);
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
export default PdrComponent;
|
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import isEmpty from 'lodash.isempty';
|
|
3
|
-
|
|
4
|
-
import EventType from '../../src/events/EventType';
|
|
5
|
-
import Utils from './Utils';
|
|
6
|
-
import PoseProvider from '../../src/providers/pose/PoseProvider';
|
|
7
|
-
import MapComponent from './MapComponent';
|
|
8
|
-
import ProvidersLogger from '../../src/providers/ProvidersLogger';
|
|
9
|
-
|
|
10
|
-
ProvidersLogger.enabled = true;
|
|
11
|
-
|
|
12
|
-
class PoseComponent extends React.Component {
|
|
13
|
-
|
|
14
|
-
constructor(props, context) {
|
|
15
|
-
super(props, context);
|
|
16
|
-
this.state = {
|
|
17
|
-
position: null,
|
|
18
|
-
attitude: null
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
this.poseProvider = new PoseProvider(this.onEvent, this.onError);
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
componentDidMount() {
|
|
26
|
-
this.poseProvider.start();
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
componentWillUnmount() {
|
|
30
|
-
this.poseProvider.stop();
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
onEvent = events => {
|
|
34
|
-
const newState = {};
|
|
35
|
-
events.forEach(event => {
|
|
36
|
-
if (event.dataType === EventType.AbsolutePosition) {
|
|
37
|
-
newState.position = event.data;
|
|
38
|
-
} else if (event.dataType === EventType.AbsoluteAttitude) {
|
|
39
|
-
newState.attitude = event.data;
|
|
40
|
-
}
|
|
41
|
-
});
|
|
42
|
-
if (!isEmpty(newState)) {
|
|
43
|
-
this.setState(newState);
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
if (this.map) {
|
|
47
|
-
this.map.parseEvents(events);
|
|
48
|
-
}
|
|
49
|
-
};
|
|
50
|
-
|
|
51
|
-
onError = error => {
|
|
52
|
-
this.setState({
|
|
53
|
-
position: error,
|
|
54
|
-
attitude: error
|
|
55
|
-
});
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
render() {
|
|
59
|
-
|
|
60
|
-
const attitudeRender = Utils.renderAttitude(this.state.attitude);
|
|
61
|
-
const positionRender = Utils.renderPosition(this.state.position);
|
|
62
|
-
|
|
63
|
-
return (
|
|
64
|
-
<div>
|
|
65
|
-
<h3>Position</h3>
|
|
66
|
-
{positionRender}
|
|
67
|
-
<h3>Attitude</h3>
|
|
68
|
-
{attitudeRender}
|
|
69
|
-
<h3>Map</h3>
|
|
70
|
-
<MapComponent ref={map => (this.map = map)} />
|
|
71
|
-
</div>
|
|
72
|
-
|
|
73
|
-
);
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
export default PoseComponent;
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import PositioningPoseComponent from './PositioningPoseComponent';
|
|
3
|
-
import PositioningHandler from '../../src/PositioningHandler';
|
|
4
|
-
import PositioningInclinationComponent from './PositioningInclinationComponent';
|
|
5
|
-
import ProvidersLogger from '../../src/providers/ProvidersLogger';
|
|
6
|
-
|
|
7
|
-
ProvidersLogger.enabled = true;
|
|
8
|
-
|
|
9
|
-
class PositioningComponent extends React.Component {
|
|
10
|
-
|
|
11
|
-
constructor(props, context) {
|
|
12
|
-
super(props, context);
|
|
13
|
-
this.positioningHandler = new PositioningHandler();
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
render() {
|
|
17
|
-
|
|
18
|
-
return (
|
|
19
|
-
<div>
|
|
20
|
-
<h2>Pose</h2>
|
|
21
|
-
<div><PositioningPoseComponent positioningHandler={this.positioningHandler} /></div>
|
|
22
|
-
<h2>Inclination</h2>
|
|
23
|
-
<div><PositioningInclinationComponent positioningHandler={this.positioningHandler} /></div>
|
|
24
|
-
</div>
|
|
25
|
-
);
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
export default PositioningComponent;
|