@wemap/positioning 2.1.0 → 2.2.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/debug/arcore.html +16 -0
- package/package.json +2 -1
- package/src/components/ArCoreComponent.jsx +74 -0
- package/src/components/GnssWifiComponent.jsx +14 -2
- package/src/components/GnssWifiPdrComponent.jsx +9 -0
- package/src/components/MapComponent.jsx +226 -0
- package/src/components/PdrComponent.jsx +9 -0
- package/src/components/PoseComponent.jsx +7 -0
- package/src/components/PositioningPoseComponent.jsx +9 -0
- package/src/components/Utils.js +18 -0
- package/src/components/index.js +2 -0
- package/src/errors/MissingArCoreError.js +9 -0
- package/src/errors/MissingNativeInterfaceError.js +9 -0
- package/src/providers/Provider.js +15 -3
- package/src/providers/pose/ArCoreProvider.js +127 -0
- package/src/providers/pose/pdr/PdrProvider.js +1 -1
- package/webpack/webpack.common.js +1 -1
- package/src.old/Constants.js +0 -11
- package/src.old/NavigationHandler.js +0 -244
- package/src.old/Pose.js +0 -8
- package/src.old/attitude/AttitudeHandler.js +0 -342
- package/src.old/attitude/EkfAttitude.js +0 -238
- package/src.old/attitude/EkfAttitude.spec.js +0 -116
- package/src.old/components/AbsoluteAttitude.jsx +0 -136
- package/src.old/components/Imu.jsx +0 -89
- package/src.old/components/LocationSource.jsx +0 -434
- package/src.old/components/Logger.jsx +0 -113
- package/src.old/components/NavigationDebugApp.jsx +0 -106
- package/src.old/components/Others.jsx +0 -121
- package/src.old/components/RelativeAttitude.jsx +0 -104
- package/src.old/components/Utils.js +0 -35
- package/src.old/components/index.js +0 -13
- package/src.old/index.js +0 -7
- package/src.old/providers/FixedLocationImuLocationSource.js +0 -66
- package/src.old/providers/GnssLocationSource.js +0 -118
- package/src.old/providers/GnssPdrLocationSource.js +0 -182
- package/src.old/providers/IPLocationSource.js +0 -96
- package/src.old/providers/LocationSource.js +0 -290
- package/src.old/providers/PdrLocationSource.js +0 -320
- package/src.old/providers/ProvidersLogger.js +0 -77
- package/src.old/providers/pdr/HeadingUnlocker.js +0 -41
- package/src.old/providers/pdr/HeadingUnlocker.spec.js +0 -26
- package/src.old/providers/pdr/Smoother.js +0 -90
- package/src.old/providers/pdr/Smoother.spec.js +0 -424
- package/src.old/providers/pdr/ThugDetector.js +0 -37
- package/src.old/providers/steps/StepDetection.js +0 -7
- package/src.old/providers/steps/StepDetectionLadetto.js +0 -67
- package/src.old/providers/steps/StepDetectionMinMaxPeaks.js +0 -80
- package/src.old/providers/steps/StepDetectionMinMaxPeaks2.js +0 -108
- package/src.old/sensors/SensorsCompatibility.js +0 -486
- package/src.old/sensors/SensorsCompatibility.spec.js +0 -270
- package/src.old/sensors/SensorsLogger.js +0 -94
- package/src.old/sensors/SensorsLoggerUtils.js +0 -35
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html>
|
|
3
|
+
|
|
4
|
+
<head>
|
|
5
|
+
<meta charset="utf-8">
|
|
6
|
+
<meta name="viewport" content="width=device-width, user-scalable=no">
|
|
7
|
+
<title>Debug ARCore</title>
|
|
8
|
+
<script src="/js/positioning-components.js"></script>
|
|
9
|
+
</head>
|
|
10
|
+
|
|
11
|
+
<body>
|
|
12
|
+
<div id="app"></div>
|
|
13
|
+
<script>createReactElement(ArCoreComponent, document.getElementById('app'));</script>
|
|
14
|
+
</body>
|
|
15
|
+
|
|
16
|
+
</html>
|
package/package.json
CHANGED
|
@@ -51,6 +51,7 @@
|
|
|
51
51
|
"request": "^2.88.0",
|
|
52
52
|
"request-promise": "^4.2.4",
|
|
53
53
|
"simple-git": "^1.124.0",
|
|
54
|
+
"style-loader": "^1.0.0",
|
|
54
55
|
"url-parse": "^1.4.7",
|
|
55
56
|
"webpack": "^4.39.3",
|
|
56
57
|
"webpack-cli": "^3.3.7",
|
|
@@ -80,5 +81,5 @@
|
|
|
80
81
|
"lint": "eslint --ext .js,.jsx --quiet src",
|
|
81
82
|
"test": "mocha -r esm \"src/**/*.spec.js\""
|
|
82
83
|
},
|
|
83
|
-
"version": "2.
|
|
84
|
+
"version": "2.2.0"
|
|
84
85
|
}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import isEmpty from 'lodash.isempty';
|
|
3
|
+
|
|
4
|
+
import EventType from '../events/EventType';
|
|
5
|
+
import Utils from './Utils';
|
|
6
|
+
import ArCoreProvider from '../providers/pose/ArCoreProvider';
|
|
7
|
+
|
|
8
|
+
class ArCoreComponent extends React.Component {
|
|
9
|
+
|
|
10
|
+
constructor(props, context) {
|
|
11
|
+
super(props, context);
|
|
12
|
+
this.state = {
|
|
13
|
+
position: null,
|
|
14
|
+
attitude: null
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
this.poseProvider = new ArCoreProvider(this.onEvent, this.onError);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
componentDidMount() {
|
|
22
|
+
this.poseProvider.start();
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
componentWillUnmount() {
|
|
26
|
+
this.poseProvider.stop();
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
onEvent = events => {
|
|
30
|
+
const newState = {};
|
|
31
|
+
events.forEach(event => {
|
|
32
|
+
if (event.dataType === EventType.RelativePosition) {
|
|
33
|
+
newState.position = event.data;
|
|
34
|
+
} else if (event.dataType === EventType.RelativeAttitude) {
|
|
35
|
+
newState.attitude = event.data;
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
if (!isEmpty(newState)) {
|
|
39
|
+
this.setState(newState);
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
onError = events => {
|
|
44
|
+
const newState = {};
|
|
45
|
+
events.forEach(event => {
|
|
46
|
+
if (event.dataType === EventType.RelativePosition) {
|
|
47
|
+
newState.position = event.error;
|
|
48
|
+
} else if (event.dataType === EventType.RelativeAttitude) {
|
|
49
|
+
newState.attitude = event.error;
|
|
50
|
+
}
|
|
51
|
+
});
|
|
52
|
+
if (!isEmpty(newState)) {
|
|
53
|
+
this.setState(newState);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
render() {
|
|
58
|
+
|
|
59
|
+
const attitudeRender = Utils.renderAttitude(this.state.attitude);
|
|
60
|
+
const positionRender = Utils.renderRelativePosition(this.state.position);
|
|
61
|
+
|
|
62
|
+
return (
|
|
63
|
+
<div>
|
|
64
|
+
<h3>Position</h3>
|
|
65
|
+
{positionRender}
|
|
66
|
+
<h3>Attitude</h3>
|
|
67
|
+
{attitudeRender}
|
|
68
|
+
</div>
|
|
69
|
+
|
|
70
|
+
);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
export default ArCoreComponent;
|
|
@@ -3,12 +3,13 @@ import React from 'react';
|
|
|
3
3
|
import GnssWifiProvider from '../providers/position/GnssWifiProvider';
|
|
4
4
|
import Utils from './Utils';
|
|
5
5
|
import EventType from '../events/EventType';
|
|
6
|
+
import MapComponent from './MapComponent';
|
|
6
7
|
|
|
7
8
|
class GnssWifiComponent extends React.Component {
|
|
8
9
|
|
|
9
10
|
constructor(props, context) {
|
|
10
11
|
super(props, context);
|
|
11
|
-
this.state = {position: null};
|
|
12
|
+
this.state = { position: null };
|
|
12
13
|
|
|
13
14
|
this.gnssWifiProvider = new GnssWifiProvider(this.onEvent, this.onError);
|
|
14
15
|
}
|
|
@@ -28,6 +29,10 @@ class GnssWifiComponent extends React.Component {
|
|
|
28
29
|
this.setState({ position: event.data });
|
|
29
30
|
}
|
|
30
31
|
});
|
|
32
|
+
|
|
33
|
+
if (this.map) {
|
|
34
|
+
this.map.parseEvents(events);
|
|
35
|
+
}
|
|
31
36
|
};
|
|
32
37
|
|
|
33
38
|
onError = events => {
|
|
@@ -39,7 +44,14 @@ class GnssWifiComponent extends React.Component {
|
|
|
39
44
|
}
|
|
40
45
|
|
|
41
46
|
render() {
|
|
42
|
-
return
|
|
47
|
+
return (
|
|
48
|
+
<div>
|
|
49
|
+
<h3>Position</h3>
|
|
50
|
+
{Utils.renderPosition(this.state.position)}
|
|
51
|
+
<h3>Map</h3>
|
|
52
|
+
<MapComponent ref={map => (this.map = map)} />
|
|
53
|
+
</div>
|
|
54
|
+
);
|
|
43
55
|
}
|
|
44
56
|
}
|
|
45
57
|
|
|
@@ -8,6 +8,7 @@ import {
|
|
|
8
8
|
import Utils from './Utils';
|
|
9
9
|
import EventType from '../events/EventType';
|
|
10
10
|
import GnssWifiPdrProvider from '../providers/pose/GnssWifiPdrProvider';
|
|
11
|
+
import MapComponent from './MapComponent';
|
|
11
12
|
|
|
12
13
|
const INITIAL_LOCATION = new WGS84UserPosition(43.6091955, 3.8841255);
|
|
13
14
|
const ITINERARY = Itinerary.fromPoints([
|
|
@@ -49,6 +50,10 @@ class GnssWifiPdrComponent extends React.Component {
|
|
|
49
50
|
if (!isEmpty(newState)) {
|
|
50
51
|
this.setState(newState);
|
|
51
52
|
}
|
|
53
|
+
|
|
54
|
+
if (this.map) {
|
|
55
|
+
this.map.parseEvents(events);
|
|
56
|
+
}
|
|
52
57
|
};
|
|
53
58
|
|
|
54
59
|
onError = events => {
|
|
@@ -76,6 +81,10 @@ class GnssWifiPdrComponent extends React.Component {
|
|
|
76
81
|
{positionRender}
|
|
77
82
|
<h3>Attitude</h3>
|
|
78
83
|
{attitudeRender}
|
|
84
|
+
<h3>Map</h3>
|
|
85
|
+
<MapComponent
|
|
86
|
+
ref={map => (this.map = map)}
|
|
87
|
+
network={ITINERARY} />
|
|
79
88
|
</div>
|
|
80
89
|
|
|
81
90
|
);
|
|
@@ -0,0 +1,226 @@
|
|
|
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
|
+
WGS84, Attitude, Network
|
|
8
|
+
} from '@wemap/geo';
|
|
9
|
+
import EventType from '../events/EventType';
|
|
10
|
+
|
|
11
|
+
mapboxgl.accessToken = 'pk.eyJ1IjoibWFwYm94IiwiYSI6ImNpejY4M29iazA2Z2gycXA4N2pmbDZmangifQ.-g_vE53SD2WrJ6tFX7QHmA';
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
const COMPASS_STYLE = {
|
|
15
|
+
'width': '15px',
|
|
16
|
+
'height': '15px',
|
|
17
|
+
'border-radius': '50%',
|
|
18
|
+
'z-index': '10000001',
|
|
19
|
+
'position': 'absolute',
|
|
20
|
+
'top': '-14px',
|
|
21
|
+
'left': '-14px',
|
|
22
|
+
'border': '7px solid',
|
|
23
|
+
'border-color': 'transparent',
|
|
24
|
+
'border-top-color': '#008DF1',
|
|
25
|
+
'opacity': 0.5
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
const LOCATION_STYLE = {
|
|
29
|
+
'width': '15px',
|
|
30
|
+
'height': '15px',
|
|
31
|
+
'top': '-7px',
|
|
32
|
+
'left': '-7px',
|
|
33
|
+
'position': 'absolute',
|
|
34
|
+
'border-radius': '50%',
|
|
35
|
+
'background': '#008DF1'
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
class MapComponent extends React.Component {
|
|
40
|
+
|
|
41
|
+
static propTypes = { network: PropTypes.instanceOf(Network) };
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
componentDidMount() {
|
|
45
|
+
this.map = new mapboxgl.Map({
|
|
46
|
+
container: this.mapContainer,
|
|
47
|
+
style: 'mapbox://styles/mapbox/streets-v9'
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
componentWillUnmount() {
|
|
52
|
+
this.map.remove();
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
createMarker(options) {
|
|
56
|
+
var elem, marker;
|
|
57
|
+
|
|
58
|
+
elem = document.createElement('div');
|
|
59
|
+
elem.style.marginLeft = '-' + options.iconAnchor[0] + 'px';
|
|
60
|
+
elem.style.marginTop = '-' + options.iconAnchor[1] + 'px';
|
|
61
|
+
elem.style.width = 0;
|
|
62
|
+
elem.style.height = 0;
|
|
63
|
+
elem.appendChild(options.dom);
|
|
64
|
+
|
|
65
|
+
marker = new mapboxgl.Marker(elem);
|
|
66
|
+
marker.setLngLat([options.longitude, options.latitude]);
|
|
67
|
+
return marker;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
createLocationMarker(location) {
|
|
71
|
+
const coreIcon = document.createElement('div');
|
|
72
|
+
this.applyStyleToDomElement(coreIcon, LOCATION_STYLE);
|
|
73
|
+
|
|
74
|
+
this.locationIcon = document.createElement('div');
|
|
75
|
+
this.locationIcon.appendChild(coreIcon);
|
|
76
|
+
|
|
77
|
+
return this.createMarker({
|
|
78
|
+
dom: this.locationIcon,
|
|
79
|
+
iconAnchor: [0, 0],
|
|
80
|
+
latitude: location[1],
|
|
81
|
+
longitude: location[0]
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
createCompassElement() {
|
|
86
|
+
if (!this.locationIcon) {
|
|
87
|
+
throw new Error('createLocationMarker() should be called before');
|
|
88
|
+
}
|
|
89
|
+
this.compassIcon = document.createElement('div');
|
|
90
|
+
this.applyStyleToDomElement(this.compassIcon, COMPASS_STYLE);
|
|
91
|
+
this.locationIcon.appendChild(this.compassIcon);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
applyStyleToDomElement(domElement, style) {
|
|
95
|
+
for (const key in style) {
|
|
96
|
+
if (style.hasOwnProperty(key)) {
|
|
97
|
+
domElement.style[key] = style[key];
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
parseEvents(events) {
|
|
103
|
+
if (!this.map) {
|
|
104
|
+
return;
|
|
105
|
+
}
|
|
106
|
+
events.forEach(event => {
|
|
107
|
+
if (event.dataType === EventType.AbsolutePosition) {
|
|
108
|
+
this.updatePosition(event.data);
|
|
109
|
+
|
|
110
|
+
} else if (event.dataType === EventType.AbsoluteAttitude) {
|
|
111
|
+
this.updateAttitude(event.data);
|
|
112
|
+
}
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
updatePosition(position) {
|
|
117
|
+
|
|
118
|
+
if (!this.map) {
|
|
119
|
+
return;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
if (!(position instanceof WGS84)) {
|
|
123
|
+
if (this.mapMarker) {
|
|
124
|
+
this.mapMarker.remove();
|
|
125
|
+
this.mapMarker = null;
|
|
126
|
+
this.locationIcon = null;
|
|
127
|
+
}
|
|
128
|
+
return;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
const lngLat = [position.lng, position.lat];
|
|
132
|
+
|
|
133
|
+
if (!this.mapMarker) {
|
|
134
|
+
this.mapMarker = this.createLocationMarker(lngLat)
|
|
135
|
+
.addTo(this.map);
|
|
136
|
+
this.map.jumpTo({
|
|
137
|
+
center: lngLat,
|
|
138
|
+
zoom: 19
|
|
139
|
+
});
|
|
140
|
+
} else {
|
|
141
|
+
this.mapMarker.setLngLat(lngLat);
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
updateAttitude(attitude) {
|
|
147
|
+
|
|
148
|
+
if (!this.locationIcon) {
|
|
149
|
+
return;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
if (!(attitude instanceof Attitude)) {
|
|
153
|
+
if (this.compassIcon) {
|
|
154
|
+
this.locationIcon.removeChild(this.compassIcon);
|
|
155
|
+
}
|
|
156
|
+
return;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
if (!this.compassIcon) {
|
|
160
|
+
this.createCompassElement();
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
this.locationIcon.style.transform = 'rotate(' + attitude.headingDegrees + 'deg)';
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
renderNetwork() {
|
|
167
|
+
|
|
168
|
+
if (!this.map) {
|
|
169
|
+
return;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
const network = this.props.network;
|
|
173
|
+
|
|
174
|
+
if (!network) {
|
|
175
|
+
if (this.networkLayer) {
|
|
176
|
+
this.map.removeLayer(this.networkLayer);
|
|
177
|
+
this.networkLayer = null;
|
|
178
|
+
}
|
|
179
|
+
return;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
const layer = {
|
|
183
|
+
id: 'network',
|
|
184
|
+
type: 'line',
|
|
185
|
+
source: {
|
|
186
|
+
type: 'geojson',
|
|
187
|
+
data: {
|
|
188
|
+
type: 'Feature',
|
|
189
|
+
properties: {},
|
|
190
|
+
geometry: {
|
|
191
|
+
type: 'MultiLineString',
|
|
192
|
+
coordinates: []
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
},
|
|
196
|
+
paint: {
|
|
197
|
+
'line-color': '#0000FF',
|
|
198
|
+
'line-width': 3
|
|
199
|
+
}
|
|
200
|
+
};
|
|
201
|
+
|
|
202
|
+
for (let i = 0; i < network.length; i++) {
|
|
203
|
+
layer.source.data.geometry.coordinates.push(
|
|
204
|
+
[
|
|
205
|
+
[network.edges[i].node1.lng, network.edges[i].node1.lat],
|
|
206
|
+
[network.edges[i].node2.lng, network.edges[i].node2.lat]
|
|
207
|
+
]
|
|
208
|
+
);
|
|
209
|
+
}
|
|
210
|
+
this.map.on('load', () => {
|
|
211
|
+
this.networkLayer = this.map.addLayer(layer);
|
|
212
|
+
});
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
render() {
|
|
216
|
+
this.renderNetwork();
|
|
217
|
+
return (
|
|
218
|
+
<div
|
|
219
|
+
ref={map => (this.mapContainer = map)}
|
|
220
|
+
style={{ height: '300px' }} />
|
|
221
|
+
);
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
|
|
226
|
+
export default MapComponent;
|
|
@@ -8,6 +8,7 @@ import {
|
|
|
8
8
|
import Utils from './Utils';
|
|
9
9
|
import PdrProvider from '../providers/pose/pdr/PdrProvider';
|
|
10
10
|
import EventType from '../events/EventType';
|
|
11
|
+
import MapComponent from './MapComponent';
|
|
11
12
|
|
|
12
13
|
const INITIAL_LOCATION = new WGS84UserPosition(43.6091955, 3.8841255);
|
|
13
14
|
const INITIAL_HEADING = 191.9;
|
|
@@ -52,6 +53,10 @@ class PdrComponent extends React.Component {
|
|
|
52
53
|
if (!isEmpty(newState)) {
|
|
53
54
|
this.setState(newState);
|
|
54
55
|
}
|
|
56
|
+
|
|
57
|
+
if (this.map) {
|
|
58
|
+
this.map.parseEvents(events);
|
|
59
|
+
}
|
|
55
60
|
};
|
|
56
61
|
|
|
57
62
|
onError = events => {
|
|
@@ -79,6 +84,10 @@ class PdrComponent extends React.Component {
|
|
|
79
84
|
{positionRender}
|
|
80
85
|
<h3>Attitude</h3>
|
|
81
86
|
{attitudeRender}
|
|
87
|
+
<h3>Map</h3>
|
|
88
|
+
<MapComponent
|
|
89
|
+
ref={map => (this.map = map)}
|
|
90
|
+
network={ITINERARY} />
|
|
82
91
|
</div>
|
|
83
92
|
|
|
84
93
|
);
|
|
@@ -4,6 +4,7 @@ import isEmpty from 'lodash.isempty';
|
|
|
4
4
|
import EventType from '../events/EventType';
|
|
5
5
|
import Utils from './Utils';
|
|
6
6
|
import PoseProvider from '../providers/pose/PoseProvider';
|
|
7
|
+
import MapComponent from './MapComponent';
|
|
7
8
|
|
|
8
9
|
class PoseComponent extends React.Component {
|
|
9
10
|
|
|
@@ -38,6 +39,10 @@ class PoseComponent extends React.Component {
|
|
|
38
39
|
if (!isEmpty(newState)) {
|
|
39
40
|
this.setState(newState);
|
|
40
41
|
}
|
|
42
|
+
|
|
43
|
+
if (this.map) {
|
|
44
|
+
this.map.parseEvents(events);
|
|
45
|
+
}
|
|
41
46
|
};
|
|
42
47
|
|
|
43
48
|
onError = events => {
|
|
@@ -65,6 +70,8 @@ class PoseComponent extends React.Component {
|
|
|
65
70
|
{positionRender}
|
|
66
71
|
<h3>Attitude</h3>
|
|
67
72
|
{attitudeRender}
|
|
73
|
+
<h3>Map</h3>
|
|
74
|
+
<MapComponent ref={map => (this.map = map)} />
|
|
68
75
|
</div>
|
|
69
76
|
|
|
70
77
|
);
|
|
@@ -9,6 +9,7 @@ import StartStopComponent from './StartStopComponent';
|
|
|
9
9
|
import {
|
|
10
10
|
WGS84UserPosition, Itinerary
|
|
11
11
|
} from '@wemap/geo';
|
|
12
|
+
import MapComponent from './MapComponent';
|
|
12
13
|
|
|
13
14
|
const INITIAL_LOCATION = new WGS84UserPosition(43.6091955, 3.8841255);
|
|
14
15
|
const INITIAL_HEADING = 191.9;
|
|
@@ -74,6 +75,10 @@ class PositioningPoseComponent extends React.Component {
|
|
|
74
75
|
if (!isEmpty(newState)) {
|
|
75
76
|
this.setState(newState);
|
|
76
77
|
}
|
|
78
|
+
|
|
79
|
+
if (this.map) {
|
|
80
|
+
this.map.parseEvents(events);
|
|
81
|
+
}
|
|
77
82
|
};
|
|
78
83
|
|
|
79
84
|
onErrors = events => {
|
|
@@ -103,6 +108,10 @@ class PositioningPoseComponent extends React.Component {
|
|
|
103
108
|
{positionRender}
|
|
104
109
|
<h3>Attitude</h3>
|
|
105
110
|
{attitudeRender}
|
|
111
|
+
<h3>Map</h3>
|
|
112
|
+
<MapComponent
|
|
113
|
+
ref={map => (this.map = map)}
|
|
114
|
+
network={ITINERARY} />
|
|
106
115
|
</div>
|
|
107
116
|
);
|
|
108
117
|
}
|
package/src/components/Utils.js
CHANGED
|
@@ -55,6 +55,24 @@ class Utils {
|
|
|
55
55
|
|
|
56
56
|
}
|
|
57
57
|
|
|
58
|
+
static renderRelativePosition(position) {
|
|
59
|
+
|
|
60
|
+
if (!position) {
|
|
61
|
+
return <p>Waiting</p>;
|
|
62
|
+
}
|
|
63
|
+
if (position instanceof Error) {
|
|
64
|
+
return Utils.renderError(position);
|
|
65
|
+
}
|
|
66
|
+
return (
|
|
67
|
+
<p>
|
|
68
|
+
x: {position[0].toFixed(2)}<br />
|
|
69
|
+
y: {position[1].toFixed(2)}<br />
|
|
70
|
+
z: {position[2].toFixed(2)}
|
|
71
|
+
</p>
|
|
72
|
+
);
|
|
73
|
+
|
|
74
|
+
}
|
|
75
|
+
|
|
58
76
|
static renderInclination(inclination) {
|
|
59
77
|
if (inclination === null) {
|
|
60
78
|
return 'Waiting';
|
package/src/components/index.js
CHANGED
|
@@ -2,6 +2,7 @@ import React from 'react';
|
|
|
2
2
|
import ReactDOM from 'react-dom';
|
|
3
3
|
|
|
4
4
|
import AbsoluteAttitudeComponent from './AbsoluteAttitudeComponent';
|
|
5
|
+
import ArCoreComponent from './ArCoreComponent';
|
|
5
6
|
import GnssWifiComponent from './GnssWifiComponent';
|
|
6
7
|
import GnssWifiPdrComponent from './GnssWifiPdrComponent';
|
|
7
8
|
import ImuComponent from './ImuComponent';
|
|
@@ -18,6 +19,7 @@ const createReactElement = (component, container) => ReactDOM.render(
|
|
|
18
19
|
|
|
19
20
|
export {
|
|
20
21
|
AbsoluteAttitudeComponent,
|
|
22
|
+
ArCoreComponent,
|
|
21
23
|
ImuComponent,
|
|
22
24
|
InclinationComponent,
|
|
23
25
|
GnssWifiComponent,
|
|
@@ -5,6 +5,7 @@ import ProviderEvent from '../events/ProviderEvent';
|
|
|
5
5
|
import Logger from '@wemap/logger';
|
|
6
6
|
import ProviderError from '../events/ProviderError';
|
|
7
7
|
import ProvidersLogger from './ProvidersLogger';
|
|
8
|
+
import MissingNativeInterfaceError from '../errors/MissingNativeInterfaceError';
|
|
8
9
|
|
|
9
10
|
let uniqueId = 1;
|
|
10
11
|
|
|
@@ -103,9 +104,8 @@ class Provider {
|
|
|
103
104
|
}
|
|
104
105
|
|
|
105
106
|
ProvidersLogger.addEvent(this, 'start');
|
|
106
|
-
this.startInternal();
|
|
107
107
|
this.state = Provider.State.STARTED;
|
|
108
|
-
|
|
108
|
+
this.startInternal();
|
|
109
109
|
}
|
|
110
110
|
|
|
111
111
|
/**
|
|
@@ -128,8 +128,8 @@ class Provider {
|
|
|
128
128
|
}
|
|
129
129
|
|
|
130
130
|
ProvidersLogger.addEvent(this, 'stop');
|
|
131
|
-
this.stopInternal();
|
|
132
131
|
this.state = Provider.State.STOPPPED;
|
|
132
|
+
this.stopInternal();
|
|
133
133
|
}
|
|
134
134
|
|
|
135
135
|
/**
|
|
@@ -213,6 +213,18 @@ class Provider {
|
|
|
213
213
|
return this.constructor.createError(dataType, error, timestamp);
|
|
214
214
|
}
|
|
215
215
|
|
|
216
|
+
|
|
217
|
+
static hasNativeInterface() {
|
|
218
|
+
return Boolean(Provider.getNativeInterface());
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
static getNativeInterface() {
|
|
222
|
+
return global.WemapProvidersAndroid;
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
static createMissingNativeInterfaceError(dataType) {
|
|
226
|
+
return this.createError(dataType, new MissingNativeInterfaceError());
|
|
227
|
+
}
|
|
216
228
|
}
|
|
217
229
|
|
|
218
230
|
export default Provider;
|