@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
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAClF,OAAO,KAAK,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAEhE;;;;;;;;;;;;;;GAcG;AACH,MAAM,WAAW,IAAI;IACnB,0DAA0D;IAC1D,QAAQ,CAAC,EAAE,YAAY,GAAG,gBAAgB,CAAC;IAC3C,uDAAuD;IACvD,QAAQ,CAAC,EAAE,QAAQ,GAAG,gBAAgB,CAAC;IACvC,mCAAmC;IACnC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,8DAA8D;IAC9D,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,qDAAqD;IACrD,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED;;;;;;;;;;;;;;;GAeG;AACH,MAAM,MAAM,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;AAExC;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC,8EAA8E;IAC9E,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,gEAAgE;IAChE,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,gEAAgE;IAChE,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED;;GAEG;AACH,MAAM,WAAW,qBAAsB,SAAQ,kBAAkB;IAC/D,2DAA2D;IAC3D,mBAAmB,CAAC,EAAE,OAAO,CAAC;CAC/B"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
*
|
|
3
|
+
* Note: This function should be called right after a user interaction otherwise it will return false.
|
|
4
|
+
*
|
|
5
|
+
* @returns True if sensor permissions are granted, false otherwise
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* ```typescript
|
|
9
|
+
* import { requestSensorPermissions } from '@wemap/positioning';
|
|
10
|
+
*
|
|
11
|
+
* const hasSensorPermissions = await requestSensorPermissions();
|
|
12
|
+
* console.log(hasSensorPermissions);
|
|
13
|
+
* ```
|
|
14
|
+
*/
|
|
15
|
+
export declare function requestSensorPermissions(): Promise<boolean>;
|
|
16
|
+
/**
|
|
17
|
+
*
|
|
18
|
+
* @returns True if location permissions are granted, false otherwise
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* ```typescript
|
|
22
|
+
* import { requestLocationPermissions } from '@wemap/positioning';
|
|
23
|
+
*
|
|
24
|
+
* const hasLocationPermissions = await requestLocationPermissions();
|
|
25
|
+
* console.log(hasLocationPermissions);
|
|
26
|
+
* ```
|
|
27
|
+
*/
|
|
28
|
+
export declare function requestLocationPermissions(): Promise<boolean>;
|
|
29
|
+
//# sourceMappingURL=permissions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"permissions.d.ts","sourceRoot":"","sources":["../../../src/utils/permissions.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;GAaG;AACH,wBAAsB,wBAAwB,IAAI,OAAO,CAAC,OAAO,CAAC,CAkBjE;AAGD;;;;;;;;;;;GAWG;AACH,wBAAsB,0BAA0B,IAAI,OAAO,CAAC,OAAO,CAAC,CAWnE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vitest.config.d.ts","sourceRoot":"","sources":["../vitest.config.ts"],"names":[],"mappings":";AAMA,wBAcG"}
|
package/package.json
CHANGED
|
@@ -1,66 +1,30 @@
|
|
|
1
1
|
{
|
|
2
|
-
"
|
|
3
|
-
"
|
|
4
|
-
|
|
2
|
+
"name": "@wemap/positioning",
|
|
3
|
+
"version": "14.0.0-0",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"private": false,
|
|
6
|
+
"publishConfig": {
|
|
7
|
+
"access": "public"
|
|
8
|
+
},
|
|
9
|
+
"main": "./dist/index.js",
|
|
10
|
+
"types": "./dist/index.d.ts",
|
|
11
|
+
"exports": {
|
|
12
|
+
".": {
|
|
13
|
+
"import": "./dist/index.js",
|
|
14
|
+
"types": "./dist/index.d.ts"
|
|
15
|
+
}
|
|
5
16
|
},
|
|
6
|
-
"
|
|
7
|
-
"
|
|
8
|
-
"Guillaume Pannetier <guillaume.pannetier@getwemap.com>"
|
|
17
|
+
"files": [
|
|
18
|
+
"dist"
|
|
9
19
|
],
|
|
10
20
|
"dependencies": {
|
|
11
|
-
"@wemap/
|
|
12
|
-
"@wemap/graph": "^2.7.9",
|
|
13
|
-
"@wemap/logger": "^2.7.7",
|
|
14
|
-
"@wemap/maths": "^2.7.7",
|
|
15
|
-
"@wemap/osm": "^2.7.13",
|
|
16
|
-
"@wemap/utils": "^2.7.7",
|
|
17
|
-
"geomagnetism": "^0.1.0",
|
|
18
|
-
"lodash.isempty": "^4.4.0",
|
|
19
|
-
"lodash.isnumber": "^3.0.3",
|
|
20
|
-
"lodash.noop": "^3.0.1"
|
|
21
|
+
"@wemap/core": "14.0.0-0"
|
|
21
22
|
},
|
|
22
|
-
"description": "A package using different geoloc systems",
|
|
23
23
|
"devDependencies": {
|
|
24
|
-
"@
|
|
25
|
-
"@
|
|
26
|
-
"@
|
|
27
|
-
"@
|
|
28
|
-
"
|
|
29
|
-
|
|
30
|
-
"mapbox-gl": "^1.3.0",
|
|
31
|
-
"prop-types": "^15.7.2",
|
|
32
|
-
"react": "^16.11.0",
|
|
33
|
-
"react-dom": "^16.11.0",
|
|
34
|
-
"style-loader": "^1.0.0",
|
|
35
|
-
"webpack": "^4.39.3",
|
|
36
|
-
"webpack-cli": "^3.3.7",
|
|
37
|
-
"webpack-dev-server": "^3.9.0",
|
|
38
|
-
"webpack-merge": "^4.2.1"
|
|
39
|
-
},
|
|
40
|
-
"homepage": "https://github.com/wemap/wemap-modules-js#readme",
|
|
41
|
-
"keywords": [
|
|
42
|
-
"wemap",
|
|
43
|
-
"positioning",
|
|
44
|
-
"pdr",
|
|
45
|
-
"wifi",
|
|
46
|
-
"gnss",
|
|
47
|
-
"mapmatching",
|
|
48
|
-
"step-detection"
|
|
49
|
-
],
|
|
50
|
-
"license": "ISC",
|
|
51
|
-
"main": "index.js",
|
|
52
|
-
"name": "@wemap/positioning",
|
|
53
|
-
"repository": {
|
|
54
|
-
"type": "git",
|
|
55
|
-
"url": "git+https://github.com/wemap/wemap-modules-js.git"
|
|
56
|
-
},
|
|
57
|
-
"scripts": {
|
|
58
|
-
"build": "webpack --display-modules --config webpack/webpack.prod.js",
|
|
59
|
-
"stats": "webpack --config webpack/webpack.prod.js --profile --json > stats.json",
|
|
60
|
-
"start": "webpack-dev-server --config webpack/webpack.dev.js --progress --inline --hot --https",
|
|
61
|
-
"lint": "eslint --ext .js,.jsx --quiet src",
|
|
62
|
-
"test": "mocha -r esm \"src/**/*.spec.js\""
|
|
63
|
-
},
|
|
64
|
-
"version": "2.7.13",
|
|
65
|
-
"gitHead": "bbe3d0a45f1260fcc8c50a62cda4b849ca82ca05"
|
|
24
|
+
"@wemap/geo-legacy": "^13.3.0",
|
|
25
|
+
"@wemap/maths-legacy": "^13.3.0",
|
|
26
|
+
"@wemap/providers-legacy": "^13.3.0",
|
|
27
|
+
"@wemap/routers-legacy": "^13.3.0",
|
|
28
|
+
"@wemap/utils-legacy": "^13.3.0"
|
|
29
|
+
}
|
|
66
30
|
}
|
package/babel.config.js
DELETED
package/config.json
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 Absolute Attitude</title>
|
|
8
|
-
<script src="/js/positioning-components.js"></script>
|
|
9
|
-
</head>
|
|
10
|
-
|
|
11
|
-
<body>
|
|
12
|
-
<div id="app"></div>
|
|
13
|
-
<script>createReactElement(AbsoluteAttitudeComponent, 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 ARCore Absolute</title>
|
|
8
|
-
<script src="/js/positioning-components.js"></script>
|
|
9
|
-
</head>
|
|
10
|
-
|
|
11
|
-
<body>
|
|
12
|
-
<div id="app"></div>
|
|
13
|
-
<script>createReactElement(ArCoreAbsoluteComponent, document.getElementById('app'));</script>
|
|
14
|
-
</body>
|
|
15
|
-
|
|
16
|
-
</html>
|
package/debug/arcore.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 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>
|
|
@@ -1,100 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
|
|
3
|
-
import AbsoluteAttitudeProvider from '../../src/providers/attitude/AbsoluteAttitudeProvider';
|
|
4
|
-
import NavigationConfig from './NavigationConfig';
|
|
5
|
-
import Utils from './Utils';
|
|
6
|
-
import EventType from '../../src/events/EventType';
|
|
7
|
-
import ProvidersLogger from '../../src/providers/ProvidersLogger';
|
|
8
|
-
|
|
9
|
-
ProvidersLogger.enabled = true;
|
|
10
|
-
|
|
11
|
-
class AbsoluteAttitudeComponent extends React.Component {
|
|
12
|
-
|
|
13
|
-
constructor(props, context) {
|
|
14
|
-
super(props, context);
|
|
15
|
-
|
|
16
|
-
this.state = {
|
|
17
|
-
attitudeBrowser: null,
|
|
18
|
-
deviceorientation: null,
|
|
19
|
-
deviceorientationabsolute: null
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
this.absoluteAttitudeProvider = new AbsoluteAttitudeProvider(this.onEvent, this.onError);
|
|
23
|
-
this.absoluteAttitudeProvider.setPosition(NavigationConfig.INITIAL_POSITION);
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
componentDidMount() {
|
|
27
|
-
this.absoluteAttitudeProvider.start();
|
|
28
|
-
|
|
29
|
-
this.onDeviceOrientationEventListener = (e) => this.setState({ deviceorientation: e });
|
|
30
|
-
window.addEventListener('deviceorientation', this.onDeviceOrientationEventListener, true);
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
this.onDeviceOrientationAbsoluteEventListener = (e) => this.setState({ deviceorientationabsolute: e });
|
|
34
|
-
window.addEventListener('deviceorientationabsolute', this.onDeviceOrientationAbsoluteEventListener, true);
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
componentWillUnmount() {
|
|
38
|
-
this.absoluteAttitudeProvider.stop();
|
|
39
|
-
|
|
40
|
-
window.removeEventListener('deviceorientation', this.onDeviceOrientationEventListener, true);
|
|
41
|
-
|
|
42
|
-
window.removeEventListener('deviceorientationabsolute', this.onDeviceOrientationAbsoluteEventListener, true);
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
onEvent = events => {
|
|
46
|
-
events.forEach(event => {
|
|
47
|
-
if (event.dataType === EventType.AbsoluteAttitude) {
|
|
48
|
-
this.setState({ attitudeBrowser: event.data });
|
|
49
|
-
}
|
|
50
|
-
});
|
|
51
|
-
};
|
|
52
|
-
|
|
53
|
-
onError = error => {
|
|
54
|
-
this.setState({ attitudeBrowser: error });
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
render() {
|
|
58
|
-
|
|
59
|
-
let rawRender = <span>Not available</span>;
|
|
60
|
-
|
|
61
|
-
if (this.state.deviceorientation && this.state.deviceorientation.webkitCompassHeading) {
|
|
62
|
-
const alpha = this.state.deviceorientation.alpha;
|
|
63
|
-
const beta = this.state.deviceorientation.beta;
|
|
64
|
-
const gamma = this.state.deviceorientation.gamma;
|
|
65
|
-
const webkitCompassHeading = this.state.deviceorientation.webkitCompassHeading;
|
|
66
|
-
|
|
67
|
-
if (alpha && beta && gamma && webkitCompassHeading) {
|
|
68
|
-
rawRender = <p>alpha: {alpha.toFixed(2)}, <br />
|
|
69
|
-
beta: {beta.toFixed(2)}, <br />
|
|
70
|
-
gamma: {gamma.toFixed(2)}, <br />
|
|
71
|
-
webkitCompassHeading: {webkitCompassHeading.toFixed(2)}</p>;
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
} else if (this.state.deviceorientationabsolute) {
|
|
75
|
-
const alpha = this.state.deviceorientationabsolute.alpha;
|
|
76
|
-
const beta = this.state.deviceorientationabsolute.beta;
|
|
77
|
-
const gamma = this.state.deviceorientationabsolute.gamma;
|
|
78
|
-
|
|
79
|
-
if (alpha && beta && gamma) {
|
|
80
|
-
rawRender = <p>alpha: {alpha.toFixed(2)}, <br />
|
|
81
|
-
beta: {beta.toFixed(2)}, <br />
|
|
82
|
-
gamma: {gamma.toFixed(2)}</p>;
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
const browserRender = Utils.renderAttitude(this.state.attitudeBrowser);
|
|
87
|
-
|
|
88
|
-
return (
|
|
89
|
-
<div>
|
|
90
|
-
<h3>Raw:</h3>
|
|
91
|
-
{rawRender}
|
|
92
|
-
<h3>From browser:</h3>
|
|
93
|
-
{browserRender}
|
|
94
|
-
</div>
|
|
95
|
-
);
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
export default AbsoluteAttitudeComponent;
|
|
100
|
-
|
|
@@ -1,104 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import isEmpty from 'lodash.isempty';
|
|
3
|
-
|
|
4
|
-
import { deg2rad } from '@wemap/maths';
|
|
5
|
-
|
|
6
|
-
import EventType from '../../src/events/EventType';
|
|
7
|
-
import NavigationConfig from './NavigationConfig';
|
|
8
|
-
import Utils from './Utils';
|
|
9
|
-
import ArCoreAbsoluteProvider from '../../src/providers/pose/ArCoreAbsoluteProvider';
|
|
10
|
-
import MapComponent from './MapComponent';
|
|
11
|
-
import ProvidersLogger from '../../src/providers/ProvidersLogger';
|
|
12
|
-
|
|
13
|
-
ProvidersLogger.enabled = true;
|
|
14
|
-
|
|
15
|
-
class ArCoreAbsoluteComponent extends React.Component {
|
|
16
|
-
|
|
17
|
-
errored = false;
|
|
18
|
-
|
|
19
|
-
constructor(props, context) {
|
|
20
|
-
super(props, context);
|
|
21
|
-
this.state = {
|
|
22
|
-
position: null,
|
|
23
|
-
attitude: null,
|
|
24
|
-
barcode: null
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
componentDidMount() {
|
|
30
|
-
|
|
31
|
-
this.arCoreAbsoluteProvider = new ArCoreAbsoluteProvider(
|
|
32
|
-
this.onEvent,
|
|
33
|
-
this.onError
|
|
34
|
-
);
|
|
35
|
-
this.arCoreAbsoluteProvider.setPosition(NavigationConfig.INITIAL_POSITION);
|
|
36
|
-
this.arCoreAbsoluteProvider.setHeading(deg2rad(NavigationConfig.INITIAL_HEADING));
|
|
37
|
-
|
|
38
|
-
this.arCoreAbsoluteProvider.start();
|
|
39
|
-
if (!this.errored) {
|
|
40
|
-
this.arCoreAbsoluteProvider.enableBarcodeScanner();
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
componentWillUnmount() {
|
|
45
|
-
if (!this.errored) {
|
|
46
|
-
this.arCoreAbsoluteProvider.stop();
|
|
47
|
-
this.arCoreAbsoluteProvider.disableBarcodeScanner();
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
onEvent = events => {
|
|
52
|
-
const newState = {};
|
|
53
|
-
events.forEach(event => {
|
|
54
|
-
if (event.dataType === EventType.AbsolutePosition) {
|
|
55
|
-
newState.position = event.data;
|
|
56
|
-
} else if (event.dataType === EventType.AbsoluteAttitude) {
|
|
57
|
-
newState.attitude = event.data;
|
|
58
|
-
} else if (event.dataType === EventType.Barcode) {
|
|
59
|
-
newState.barcode = event.data;
|
|
60
|
-
}
|
|
61
|
-
});
|
|
62
|
-
if (!isEmpty(newState)) {
|
|
63
|
-
this.setState(newState);
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
if (this.map) {
|
|
67
|
-
this.map.parseEvents(events);
|
|
68
|
-
}
|
|
69
|
-
};
|
|
70
|
-
|
|
71
|
-
onError = error => {
|
|
72
|
-
this.errored = true;
|
|
73
|
-
this.setState({
|
|
74
|
-
position: error,
|
|
75
|
-
attitude: error
|
|
76
|
-
});
|
|
77
|
-
};
|
|
78
|
-
|
|
79
|
-
render() {
|
|
80
|
-
const {barcode} = this.state;
|
|
81
|
-
|
|
82
|
-
const attitudeRender = Utils.renderAttitude(this.state.attitude);
|
|
83
|
-
const positionRender = Utils.renderPosition(this.state.position);
|
|
84
|
-
|
|
85
|
-
return (
|
|
86
|
-
<div>
|
|
87
|
-
<h3>Position</h3>
|
|
88
|
-
{positionRender}
|
|
89
|
-
<h3>Attitude</h3>
|
|
90
|
-
{attitudeRender}
|
|
91
|
-
<h3>Barcode</h3>
|
|
92
|
-
{barcode ? barcode : ''}
|
|
93
|
-
<h3>Map</h3>
|
|
94
|
-
<MapComponent
|
|
95
|
-
ref={map => (this.map = map)}
|
|
96
|
-
defaultZoom={21}
|
|
97
|
-
network={NavigationConfig.ITINERARY}
|
|
98
|
-
/>
|
|
99
|
-
</div>
|
|
100
|
-
);
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
export default ArCoreAbsoluteComponent;
|
|
@@ -1,69 +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 ArCoreProvider from '../../src/providers/pose/ArCoreProvider';
|
|
7
|
-
import ProvidersLogger from '../../src/providers/ProvidersLogger';
|
|
8
|
-
|
|
9
|
-
ProvidersLogger.enabled = true;
|
|
10
|
-
class ArCoreComponent extends React.Component {
|
|
11
|
-
|
|
12
|
-
constructor(props, context) {
|
|
13
|
-
super(props, context);
|
|
14
|
-
this.state = {
|
|
15
|
-
position: null,
|
|
16
|
-
attitude: null
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
this.arCoreProvider = new ArCoreProvider(this.onEvent, this.onError);
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
componentDidMount() {
|
|
24
|
-
this.arCoreProvider.start();
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
componentWillUnmount() {
|
|
28
|
-
this.arCoreProvider.stop();
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
onEvent = events => {
|
|
32
|
-
const newState = {};
|
|
33
|
-
events.forEach(event => {
|
|
34
|
-
if (event.dataType === EventType.RelativePosition) {
|
|
35
|
-
newState.position = event.data;
|
|
36
|
-
} else if (event.dataType === EventType.RelativeAttitude) {
|
|
37
|
-
newState.attitude = event.data;
|
|
38
|
-
}
|
|
39
|
-
});
|
|
40
|
-
if (!isEmpty(newState)) {
|
|
41
|
-
this.setState(newState);
|
|
42
|
-
}
|
|
43
|
-
};
|
|
44
|
-
|
|
45
|
-
onError = error => {
|
|
46
|
-
this.setState({
|
|
47
|
-
position: error,
|
|
48
|
-
attitude: error
|
|
49
|
-
});
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
render() {
|
|
53
|
-
|
|
54
|
-
const attitudeRender = Utils.renderAttitude(this.state.attitude);
|
|
55
|
-
const positionRender = Utils.renderRelativePosition(this.state.position);
|
|
56
|
-
|
|
57
|
-
return (
|
|
58
|
-
<div>
|
|
59
|
-
<h3>Position</h3>
|
|
60
|
-
{positionRender}
|
|
61
|
-
<h3>Attitude</h3>
|
|
62
|
-
{attitudeRender}
|
|
63
|
-
</div>
|
|
64
|
-
|
|
65
|
-
);
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
export default ArCoreComponent;
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
|
|
3
|
-
import GnssWifiProvider from '../../src/providers/position/GnssWifiProvider';
|
|
4
|
-
import Utils from './Utils';
|
|
5
|
-
import EventType from '../../src/events/EventType';
|
|
6
|
-
import MapComponent from './MapComponent';
|
|
7
|
-
import ProvidersLogger from '../../src/providers/ProvidersLogger';
|
|
8
|
-
|
|
9
|
-
ProvidersLogger.enabled = true;
|
|
10
|
-
class GnssWifiComponent extends React.Component {
|
|
11
|
-
|
|
12
|
-
constructor(props, context) {
|
|
13
|
-
super(props, context);
|
|
14
|
-
this.state = { position: null };
|
|
15
|
-
|
|
16
|
-
this.gnssWifiProvider = new GnssWifiProvider(this.onEvent, this.onError);
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
componentDidMount() {
|
|
21
|
-
this.gnssWifiProvider.start();
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
componentWillUnmount() {
|
|
25
|
-
this.gnssWifiProvider.stop();
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
onEvent = events => {
|
|
29
|
-
events.forEach(event => {
|
|
30
|
-
if (event.dataType === EventType.AbsolutePosition) {
|
|
31
|
-
this.setState({ position: event.data });
|
|
32
|
-
}
|
|
33
|
-
});
|
|
34
|
-
|
|
35
|
-
if (this.map) {
|
|
36
|
-
this.map.parseEvents(events);
|
|
37
|
-
}
|
|
38
|
-
};
|
|
39
|
-
|
|
40
|
-
onError = error => {
|
|
41
|
-
this.setState({ position: error });
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
render() {
|
|
45
|
-
return (
|
|
46
|
-
<div>
|
|
47
|
-
<h3>Position</h3>
|
|
48
|
-
{Utils.renderPosition(this.state.position)}
|
|
49
|
-
<h3>Map</h3>
|
|
50
|
-
<MapComponent ref={map => (this.map = map)} />
|
|
51
|
-
</div>
|
|
52
|
-
);
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
export default GnssWifiComponent;
|
|
@@ -1,76 +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 EventType from '../../src/events/EventType';
|
|
7
|
-
import GnssWifiPdrProvider from '../../src/providers/pose/GnssWifiPdrProvider';
|
|
8
|
-
import MapComponent from './MapComponent';
|
|
9
|
-
import ProvidersLogger from '../../src/providers/ProvidersLogger';
|
|
10
|
-
|
|
11
|
-
ProvidersLogger.enabled = true;
|
|
12
|
-
|
|
13
|
-
class GnssWifiPdrComponent extends React.Component {
|
|
14
|
-
constructor(props, context) {
|
|
15
|
-
super(props, context);
|
|
16
|
-
this.state = { position: null };
|
|
17
|
-
|
|
18
|
-
this.gnssWifiPdrProvider = new GnssWifiPdrProvider(
|
|
19
|
-
this.onEvent,
|
|
20
|
-
this.onError
|
|
21
|
-
);
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
componentDidMount() {
|
|
25
|
-
this.gnssWifiPdrProvider.enableMapMatching(NavigationConfig.ITINERARY);
|
|
26
|
-
this.gnssWifiPdrProvider.start();
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
componentWillUnmount() {
|
|
30
|
-
this.gnssWifiPdrProvider.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
|
-
const attitudeRender = Utils.renderAttitude(this.state.attitude);
|
|
60
|
-
const positionRender = Utils.renderPosition(this.state.position);
|
|
61
|
-
|
|
62
|
-
return (
|
|
63
|
-
<div>
|
|
64
|
-
<h3>Position</h3>
|
|
65
|
-
{positionRender}
|
|
66
|
-
<h3>Attitude</h3>
|
|
67
|
-
{attitudeRender}
|
|
68
|
-
<h3>Map</h3>
|
|
69
|
-
<MapComponent ref={map => (this.map = map)}
|
|
70
|
-
network={NavigationConfig.ITINERARY} />
|
|
71
|
-
</div>
|
|
72
|
-
);
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
export default GnssWifiPdrComponent;
|