@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,82 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import isEmpty from 'lodash.isempty';
|
|
3
|
-
import PropTypes from 'prop-types';
|
|
4
|
-
|
|
5
|
-
import EventType from '../../src/events/EventType';
|
|
6
|
-
import Utils from './Utils';
|
|
7
|
-
import PositioningHandler from '../../src/PositioningHandler';
|
|
8
|
-
import StartStopComponent from './StartStopComponent';
|
|
9
|
-
import ProvidersLogger from '../../src/providers/ProvidersLogger';
|
|
10
|
-
|
|
11
|
-
ProvidersLogger.enabled = true;
|
|
12
|
-
|
|
13
|
-
class PositioningInclinationComponent extends React.Component {
|
|
14
|
-
|
|
15
|
-
static propTypes = { positioningHandler: PropTypes.instanceOf(PositioningHandler).isRequired };
|
|
16
|
-
|
|
17
|
-
constructor(props, context) {
|
|
18
|
-
super(props, context);
|
|
19
|
-
this.state = {
|
|
20
|
-
inclination: null,
|
|
21
|
-
errored: false
|
|
22
|
-
};
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
start() {
|
|
27
|
-
const output = this.props.positioningHandler.start(
|
|
28
|
-
[EventType.Inclination],
|
|
29
|
-
this.onEvents,
|
|
30
|
-
this.onError
|
|
31
|
-
);
|
|
32
|
-
|
|
33
|
-
if (!output) {
|
|
34
|
-
return;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
this.id = output.id;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
stop() {
|
|
42
|
-
this.props.positioningHandler.stop(this.id);
|
|
43
|
-
this.setState({
|
|
44
|
-
inclination: null,
|
|
45
|
-
errored: false
|
|
46
|
-
});
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
onEvents = (events) => {
|
|
50
|
-
const newState = {};
|
|
51
|
-
events.forEach(event => {
|
|
52
|
-
if (event.dataType === EventType.Inclination) {
|
|
53
|
-
newState.inclination = event.data;
|
|
54
|
-
}
|
|
55
|
-
});
|
|
56
|
-
if (!isEmpty(newState)) {
|
|
57
|
-
this.setState(newState);
|
|
58
|
-
}
|
|
59
|
-
};
|
|
60
|
-
|
|
61
|
-
onError = error => {
|
|
62
|
-
this.setState({
|
|
63
|
-
errored: true,
|
|
64
|
-
inclination: error
|
|
65
|
-
});
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
render() {
|
|
69
|
-
return (
|
|
70
|
-
<div>
|
|
71
|
-
<StartStopComponent
|
|
72
|
-
onStart={() => this.start()}
|
|
73
|
-
onStop={() => this.stop()}
|
|
74
|
-
errored={this.state.errored} />
|
|
75
|
-
|
|
76
|
-
<p>{Utils.renderInclination(this.state.inclination)}</p>
|
|
77
|
-
</div>
|
|
78
|
-
);
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
export default PositioningInclinationComponent;
|
|
@@ -1,117 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import isEmpty from 'lodash.isempty';
|
|
3
|
-
import PropTypes from 'prop-types';
|
|
4
|
-
|
|
5
|
-
import EventType from '../../src/events/EventType';
|
|
6
|
-
import NavigationConfig from './NavigationConfig';
|
|
7
|
-
import Utils from './Utils';
|
|
8
|
-
import PositioningHandler from '../../src/PositioningHandler';
|
|
9
|
-
import StartStopComponent from './StartStopComponent';
|
|
10
|
-
import MapComponent from './MapComponent';
|
|
11
|
-
import ProvidersLogger from '../../src/providers/ProvidersLogger';
|
|
12
|
-
|
|
13
|
-
ProvidersLogger.enabled = true;
|
|
14
|
-
|
|
15
|
-
class PositioningPoseComponent extends React.Component {
|
|
16
|
-
static propTypes = {positioningHandler: PropTypes.instanceOf(PositioningHandler).isRequired};
|
|
17
|
-
|
|
18
|
-
constructor(props, context) {
|
|
19
|
-
super(props, context);
|
|
20
|
-
this.state = {
|
|
21
|
-
position: null,
|
|
22
|
-
attitude: null,
|
|
23
|
-
errored: false
|
|
24
|
-
};
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
start() {
|
|
28
|
-
const output = this.props.positioningHandler.start(
|
|
29
|
-
[EventType.AbsolutePosition, EventType.AbsoluteAttitude],
|
|
30
|
-
this.onEvents,
|
|
31
|
-
this.onError,
|
|
32
|
-
{
|
|
33
|
-
waitInputPosition: true,
|
|
34
|
-
useMapMatching: true
|
|
35
|
-
}
|
|
36
|
-
);
|
|
37
|
-
|
|
38
|
-
if (!output) {
|
|
39
|
-
return;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
this.id = output.id;
|
|
43
|
-
|
|
44
|
-
this.props.positioningHandler.setItinerary(this.id, NavigationConfig.ITINERARY);
|
|
45
|
-
this.props.positioningHandler.setNetwork(this.id, NavigationConfig.ITINERARY);
|
|
46
|
-
this.props.positioningHandler.setPosition(this.id, NavigationConfig.INITIAL_POSITION);
|
|
47
|
-
this.props.positioningHandler.setHeading(this.id, NavigationConfig.INITIAL_HEADING);
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
stop() {
|
|
51
|
-
this.props.positioningHandler.stop(this.id);
|
|
52
|
-
this.setState({
|
|
53
|
-
position: null,
|
|
54
|
-
attitude: null,
|
|
55
|
-
errored: false
|
|
56
|
-
});
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
onEvents = events => {
|
|
60
|
-
const newState = {};
|
|
61
|
-
events.forEach(event => {
|
|
62
|
-
if (event.dataType === EventType.AbsolutePosition) {
|
|
63
|
-
newState.position = event.data;
|
|
64
|
-
} else if (event.dataType === EventType.AbsoluteAttitude) {
|
|
65
|
-
newState.attitude = event.data;
|
|
66
|
-
}
|
|
67
|
-
});
|
|
68
|
-
if (!isEmpty(newState)) {
|
|
69
|
-
this.setState(newState);
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
if (this.map) {
|
|
73
|
-
this.map.parseEvents(events);
|
|
74
|
-
}
|
|
75
|
-
};
|
|
76
|
-
|
|
77
|
-
onError = error => {
|
|
78
|
-
this.setState({
|
|
79
|
-
position: error,
|
|
80
|
-
attitude: error,
|
|
81
|
-
errored: true
|
|
82
|
-
});
|
|
83
|
-
};
|
|
84
|
-
|
|
85
|
-
render() {
|
|
86
|
-
const attitudeRender = Utils.renderAttitude(this.state.attitude);
|
|
87
|
-
const positionRender = Utils.renderPosition(this.state.position);
|
|
88
|
-
|
|
89
|
-
const itineraryRender = Utils.renderItineraryInfo(
|
|
90
|
-
this.state.position && !(this.state.position instanceof Error)
|
|
91
|
-
? NavigationConfig.ITINERARY.getInfo(this.state.position)
|
|
92
|
-
: null
|
|
93
|
-
);
|
|
94
|
-
|
|
95
|
-
return (
|
|
96
|
-
<div>
|
|
97
|
-
<StartStopComponent
|
|
98
|
-
onStart={() => this.start()}
|
|
99
|
-
onStop={() => this.stop()}
|
|
100
|
-
errored={this.state.errored}
|
|
101
|
-
/>
|
|
102
|
-
|
|
103
|
-
<h3>Position</h3>
|
|
104
|
-
{positionRender}
|
|
105
|
-
<h3>Attitude</h3>
|
|
106
|
-
{attitudeRender}
|
|
107
|
-
<h3>Map</h3>
|
|
108
|
-
<MapComponent ref={map => (this.map = map)}
|
|
109
|
-
network={NavigationConfig.ITINERARY} />
|
|
110
|
-
<h3>ItineraryInfo</h3>
|
|
111
|
-
{itineraryRender}
|
|
112
|
-
</div>
|
|
113
|
-
);
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
export default PositioningPoseComponent;
|
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
|
|
3
|
-
import RelativeAttitudeProvider from '../../src/providers/attitude/RelativeAttitudeProvider';
|
|
4
|
-
import Utils from './Utils';
|
|
5
|
-
import EventType from '../../src/events/EventType';
|
|
6
|
-
import ProvidersLogger from '../../src/providers/ProvidersLogger';
|
|
7
|
-
|
|
8
|
-
ProvidersLogger.enabled = true;
|
|
9
|
-
|
|
10
|
-
class RelativeAttitudeComponent extends React.Component {
|
|
11
|
-
|
|
12
|
-
constructor(props, context) {
|
|
13
|
-
super(props, context);
|
|
14
|
-
|
|
15
|
-
this.state = {
|
|
16
|
-
attitude: null,
|
|
17
|
-
deviceorientation: null
|
|
18
|
-
};
|
|
19
|
-
|
|
20
|
-
this.relativeAttitudeProvider = new RelativeAttitudeProvider(this.onEvent, this.onError);
|
|
21
|
-
this.setOffset(0);
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
componentDidMount() {
|
|
25
|
-
this.relativeAttitudeProvider.start();
|
|
26
|
-
window.addEventListener('deviceorientation', this.onDeviceOrientationEventListener, true);
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
componentWillUnmount() {
|
|
30
|
-
this.relativeAttitudeProvider.stop();
|
|
31
|
-
window.removeEventListener('deviceorientation', this.onDeviceOrientationEventListener, true);
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
onEvent = events => {
|
|
35
|
-
events.forEach(event => {
|
|
36
|
-
if (event.dataType === EventType.RelativeAttitude) {
|
|
37
|
-
this.setState({ attitude: event.data });
|
|
38
|
-
}
|
|
39
|
-
});
|
|
40
|
-
};
|
|
41
|
-
|
|
42
|
-
onError = error => {
|
|
43
|
-
this.setState({ attitude: error });
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
onDeviceOrientationEventListener = (e) => this.setState({ deviceorientation: e });
|
|
47
|
-
|
|
48
|
-
setOffset(offset) {
|
|
49
|
-
this.relativeAttitudeProvider.setOffset(offset);
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
render() {
|
|
53
|
-
|
|
54
|
-
let rawRender = <span>Not available</span>;
|
|
55
|
-
|
|
56
|
-
if (this.state.deviceorientation) {
|
|
57
|
-
const alpha = this.state.deviceorientation.alpha;
|
|
58
|
-
const beta = this.state.deviceorientation.beta;
|
|
59
|
-
const gamma = this.state.deviceorientation.gamma;
|
|
60
|
-
|
|
61
|
-
if (alpha && beta && gamma) {
|
|
62
|
-
rawRender = <p>alpha: {alpha.toFixed(2)}, <br />
|
|
63
|
-
beta: {beta.toFixed(2)}, <br />
|
|
64
|
-
gamma: {gamma.toFixed(2)}</p>;
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
const browserRender = Utils.renderAttitude(this.state.attitude);
|
|
69
|
-
|
|
70
|
-
return (
|
|
71
|
-
<div>
|
|
72
|
-
<h3>Raw:</h3>
|
|
73
|
-
{rawRender}
|
|
74
|
-
<h3>From browser:</h3>
|
|
75
|
-
{browserRender}
|
|
76
|
-
</div>
|
|
77
|
-
);
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
export default RelativeAttitudeComponent;
|
|
82
|
-
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
|
-
|
|
4
|
-
class StartStopComponent extends React.Component {
|
|
5
|
-
|
|
6
|
-
static propTypes = {
|
|
7
|
-
onStart: PropTypes.func.isRequired,
|
|
8
|
-
onStop: PropTypes.func.isRequired,
|
|
9
|
-
errored: PropTypes.bool.isRequired
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
constructor(props, context) {
|
|
13
|
-
super(props, context);
|
|
14
|
-
this.state = { started: false };
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
start() {
|
|
18
|
-
this.setState({started: true});
|
|
19
|
-
this.props.onStart();
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
componentWillUnmount() {
|
|
23
|
-
stop();
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
stop() {
|
|
27
|
-
this.setState({started: false});
|
|
28
|
-
this.props.onStop();
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
render() {
|
|
33
|
-
return (
|
|
34
|
-
<div>
|
|
35
|
-
<button onClick={() => this.start()}
|
|
36
|
-
disabled={(this.state.started && !this.props.errored)}>
|
|
37
|
-
Start
|
|
38
|
-
</button>
|
|
39
|
-
<button onClick={() => this.stop()}
|
|
40
|
-
disabled={!(this.state.started && !this.props.errored)}>
|
|
41
|
-
Stop
|
|
42
|
-
</button>
|
|
43
|
-
</div>
|
|
44
|
-
|
|
45
|
-
);
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
export default StartStopComponent;
|
|
@@ -1,128 +0,0 @@
|
|
|
1
|
-
import React from 'react'; // eslint-disable-line no-unused-vars
|
|
2
|
-
|
|
3
|
-
import { rad2deg } from '@wemap/maths';
|
|
4
|
-
import { OsrmUtils } from '@wemap/osm';
|
|
5
|
-
|
|
6
|
-
const NOT_AVAILABLE_STR = 'Not available';
|
|
7
|
-
|
|
8
|
-
class Utils {
|
|
9
|
-
|
|
10
|
-
static renderAttitude(attitude) {
|
|
11
|
-
|
|
12
|
-
if (!attitude) {
|
|
13
|
-
return <p>Waiting</p>;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
if (attitude instanceof Error) {
|
|
17
|
-
return Utils.renderError(attitude);
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
const quaternion = attitude.quaternion;
|
|
21
|
-
|
|
22
|
-
const w = quaternion[0].toFixed(3);
|
|
23
|
-
const x = quaternion[1].toFixed(3);
|
|
24
|
-
const y = quaternion[2].toFixed(3);
|
|
25
|
-
const z = quaternion[3].toFixed(3);
|
|
26
|
-
|
|
27
|
-
const euler = attitude.eulerAnglesDegrees;
|
|
28
|
-
const yaw = euler[0].toFixed(2);
|
|
29
|
-
const pitch = euler[1].toFixed(2);
|
|
30
|
-
const roll = euler[2].toFixed(2);
|
|
31
|
-
const heading = attitude.headingDegrees.toFixed(2);
|
|
32
|
-
|
|
33
|
-
return <p>Quaternion: [{w}, {x}, {y}, {z}]<br />
|
|
34
|
-
Eulers: [{yaw}, {pitch}, {roll}]<br />
|
|
35
|
-
Heading: {heading}</p>;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
static renderPosition(position) {
|
|
39
|
-
|
|
40
|
-
if (!position) {
|
|
41
|
-
return <p>Waiting</p>;
|
|
42
|
-
}
|
|
43
|
-
if (position instanceof Error) {
|
|
44
|
-
return Utils.renderError(position);
|
|
45
|
-
}
|
|
46
|
-
return (
|
|
47
|
-
<p>
|
|
48
|
-
Latitude: {position.lat.toFixed(7)}<br />
|
|
49
|
-
Longitude: {position.lng.toFixed(7)}<br />
|
|
50
|
-
Altitude: {position.alt ? position.alt.toFixed(2) : NOT_AVAILABLE_STR}<br />
|
|
51
|
-
Level: {position.level ? position.level.toString() : NOT_AVAILABLE_STR}<br />
|
|
52
|
-
Bearing: {position.bearing ? position.bearing.toFixed(2) : NOT_AVAILABLE_STR}<br />
|
|
53
|
-
Accuracy: {position.accuracy ? position.accuracy.toFixed(2) : NOT_AVAILABLE_STR}<br />
|
|
54
|
-
Time: {position.time ? position.time.toFixed(2) : NOT_AVAILABLE_STR}<br />
|
|
55
|
-
Provider: {position.provider ? position.provider : NOT_AVAILABLE_STR}
|
|
56
|
-
</p>
|
|
57
|
-
);
|
|
58
|
-
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
static renderRelativePosition(position) {
|
|
62
|
-
|
|
63
|
-
if (!position) {
|
|
64
|
-
return <p>Waiting</p>;
|
|
65
|
-
}
|
|
66
|
-
if (position instanceof Error) {
|
|
67
|
-
return Utils.renderError(position);
|
|
68
|
-
}
|
|
69
|
-
return (
|
|
70
|
-
<p>
|
|
71
|
-
x: {position[0].toFixed(2)}<br />
|
|
72
|
-
y: {position[1].toFixed(2)}<br />
|
|
73
|
-
z: {position[2].toFixed(2)}
|
|
74
|
-
</p>
|
|
75
|
-
);
|
|
76
|
-
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
static renderItineraryInfo(info) {
|
|
80
|
-
|
|
81
|
-
if (!info) {
|
|
82
|
-
return <p>Waiting</p>;
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
const step = info.nextStep;
|
|
86
|
-
let nextStepStr = '[' + step.number + '] ';
|
|
87
|
-
if (step.firstStep) {
|
|
88
|
-
nextStepStr += 'Depart';
|
|
89
|
-
} else if (step.lastStep) {
|
|
90
|
-
nextStepStr += 'Arrive';
|
|
91
|
-
} else {
|
|
92
|
-
nextStepStr += 'Turn '
|
|
93
|
-
+ OsrmUtils.getModifierFromAngle(step.angle);
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
return (
|
|
98
|
-
<p>
|
|
99
|
-
projection: {info.projection.nearestElement.constructor.name}<br />
|
|
100
|
-
distanceOfProjection: {info.projection.distanceFromNearestElement.toFixed(1)}m<br />
|
|
101
|
-
traveledDistance: {info.traveledDistance.toFixed(1)}m
|
|
102
|
-
({(info.traveledPercentage * 100).toFixed(1)}%)<br />
|
|
103
|
-
remainingDistance: {info.remainingDistance.toFixed(1)}m
|
|
104
|
-
({(info.remainingPercentage * 100).toFixed(1)}%)<br />
|
|
105
|
-
nextStep: {nextStepStr}
|
|
106
|
-
</p>
|
|
107
|
-
);
|
|
108
|
-
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
static renderInclination(inclination) {
|
|
112
|
-
if (inclination === null) {
|
|
113
|
-
return 'Waiting';
|
|
114
|
-
}
|
|
115
|
-
if (inclination instanceof Error) {
|
|
116
|
-
return Utils.renderError(inclination);
|
|
117
|
-
}
|
|
118
|
-
return rad2deg(inclination).toFixed(2);
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
static renderError(error) {
|
|
122
|
-
return (<span><strong>[{error.constructor.name}]</strong> {error.message}</span>);
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
export default Utils;
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import ReactDOM from 'react-dom';
|
|
3
|
-
|
|
4
|
-
import AbsoluteAttitudeComponent from './AbsoluteAttitudeComponent';
|
|
5
|
-
import ArCoreComponent from './ArCoreComponent';
|
|
6
|
-
import ArCoreAbsoluteComponent from './ArCoreAbsoluteComponent';
|
|
7
|
-
import GnssWifiComponent from './GnssWifiComponent';
|
|
8
|
-
import GnssWifiPdrComponent from './GnssWifiPdrComponent';
|
|
9
|
-
import ImuComponent from './ImuComponent';
|
|
10
|
-
import InclinationComponent from './InclinationComponent';
|
|
11
|
-
import PdrComponent from './PdrComponent';
|
|
12
|
-
import PoseComponent from './PoseComponent';
|
|
13
|
-
import PositioningComponent from './PositioningComponent';
|
|
14
|
-
import RelativeAttitudeComponent from './RelativeAttitudeComponent';
|
|
15
|
-
|
|
16
|
-
const createReactElement = (component, container) => ReactDOM.render(
|
|
17
|
-
React.createElement(component, {}, null),
|
|
18
|
-
container
|
|
19
|
-
);
|
|
20
|
-
|
|
21
|
-
export {
|
|
22
|
-
AbsoluteAttitudeComponent,
|
|
23
|
-
ArCoreComponent,
|
|
24
|
-
ArCoreAbsoluteComponent,
|
|
25
|
-
ImuComponent,
|
|
26
|
-
InclinationComponent,
|
|
27
|
-
GnssWifiComponent,
|
|
28
|
-
GnssWifiPdrComponent,
|
|
29
|
-
PdrComponent,
|
|
30
|
-
PoseComponent,
|
|
31
|
-
PositioningComponent,
|
|
32
|
-
RelativeAttitudeComponent,
|
|
33
|
-
createReactElement
|
|
34
|
-
};
|
package/debug/gnss-wifi-pdr.html
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
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 GnssWifiPdr</title>
|
|
8
|
-
<script src="/js/positioning-components.js"></script>
|
|
9
|
-
</head>
|
|
10
|
-
|
|
11
|
-
<body>
|
|
12
|
-
<div id="app"></div>
|
|
13
|
-
<script>createReactElement(GnssWifiPdrComponent, document.getElementById('app'));</script>
|
|
14
|
-
</body>
|
|
15
|
-
|
|
16
|
-
</html>
|
package/debug/gnss-wifi.html
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
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 Positioning</title>
|
|
8
|
-
<script src="/js/positioning-components.js"></script>
|
|
9
|
-
</head>
|
|
10
|
-
|
|
11
|
-
<body>
|
|
12
|
-
<div id="app"></div>
|
|
13
|
-
<script>createReactElement(GnssWifiComponent, document.getElementById('app'));</script>
|
|
14
|
-
</body>
|
|
15
|
-
|
|
16
|
-
</html>
|
package/debug/imu.html
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
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 Imu</title>
|
|
8
|
-
<script src="/js/positioning-components.js"></script>
|
|
9
|
-
</head>
|
|
10
|
-
|
|
11
|
-
<body>
|
|
12
|
-
<div id="app"></div>
|
|
13
|
-
<script>createReactElement(ImuComponent, document.getElementById('app'));</script>
|
|
14
|
-
</body>
|
|
15
|
-
|
|
16
|
-
</html>
|
package/debug/inclination.html
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
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 Inclination</title>
|
|
8
|
-
<script src="/js/positioning-components.js"></script>
|
|
9
|
-
</head>
|
|
10
|
-
|
|
11
|
-
<body>
|
|
12
|
-
<div id="app"></div>
|
|
13
|
-
<script>createReactElement(InclinationComponent, document.getElementById('app'));</script>
|
|
14
|
-
</body>
|
|
15
|
-
|
|
16
|
-
</html>
|
package/debug/pdr.html
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
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 PDR</title>
|
|
8
|
-
<script src="/js/positioning-components.js"></script>
|
|
9
|
-
</head>
|
|
10
|
-
|
|
11
|
-
<body>
|
|
12
|
-
<div id="app"></div>
|
|
13
|
-
<script>createReactElement(PdrComponent, document.getElementById('app'));</script>
|
|
14
|
-
</body>
|
|
15
|
-
|
|
16
|
-
</html>
|
package/debug/pose.html
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
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 Pose</title>
|
|
8
|
-
<script src="/js/positioning-components.js"></script>
|
|
9
|
-
</head>
|
|
10
|
-
|
|
11
|
-
<body>
|
|
12
|
-
<div id="app"></div>
|
|
13
|
-
<script>createReactElement(PoseComponent, document.getElementById('app'));</script>
|
|
14
|
-
</body>
|
|
15
|
-
|
|
16
|
-
</html>
|
package/debug/positioning.html
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
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 Positioning</title>
|
|
8
|
-
<script src="/js/positioning-components.js"></script>
|
|
9
|
-
</head>
|
|
10
|
-
|
|
11
|
-
<body>
|
|
12
|
-
<div id="app"></div>
|
|
13
|
-
<script>createReactElement(PositioningComponent, document.getElementById('app'));</script>
|
|
14
|
-
</body>
|
|
15
|
-
|
|
16
|
-
</html>
|
|
@@ -1,16 +0,0 @@
|
|
|
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 Relative Attitude</title>
|
|
8
|
-
<script src="/js/positioning-components.js"></script>
|
|
9
|
-
</head>
|
|
10
|
-
|
|
11
|
-
<body>
|
|
12
|
-
<div id="app"></div>
|
|
13
|
-
<script>createReactElement(RelativeAttitudeComponent, document.getElementById('app'));</script>
|
|
14
|
-
</body>
|
|
15
|
-
|
|
16
|
-
</html>
|