@wemap/positioning 2.7.6 → 2.7.7
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/{src → debug}/components/AbsoluteAttitudeComponent.jsx +4 -2
- package/{src → debug}/components/ArCoreAbsoluteComponent.jsx +27 -6
- package/{src → debug}/components/ArCoreComponent.jsx +4 -2
- package/{src → debug}/components/GnssWifiComponent.jsx +4 -2
- package/{src → debug}/components/GnssWifiPdrComponent.jsx +5 -2
- package/{src → debug}/components/ImuComponent.jsx +5 -2
- package/{src → debug}/components/InclinationComponent.jsx +5 -2
- package/{src → debug}/components/MapComponent.jsx +1 -1
- package/{src → debug}/components/PdrComponent.jsx +5 -2
- package/{src → debug}/components/PoseComponent.jsx +5 -2
- package/{src → debug}/components/PositioningComponent.jsx +4 -1
- package/{src → debug}/components/PositioningInclinationComponent.jsx +5 -2
- package/{src → debug}/components/PositioningPoseComponent.jsx +4 -2
- package/{src → debug}/components/RelativeAttitudeComponent.jsx +5 -2
- package/package.json +23 -9
- package/src/PositioningHandler.js +22 -0
- package/src/events/EventType.js +1 -0
- package/src/providers/ProvidersLogger.js +2 -4
- package/src/providers/pose/ArCoreAbsoluteProvider.js +21 -2
- package/src/providers/pose/ArCoreProvider.js +37 -10
- package/src/providers/pose/pdr/PdrProvider.js +2 -1
- package/src/providers/position/GnssWifiProvider.js +2 -2
- package/src/providers/position/IpProvider.js +2 -1
- package/webpack/webpack.dev.js +1 -1
- /package/{src → debug}/components/NavigationConfig.js +0 -0
- /package/{src → debug}/components/StartStopComponent.jsx +0 -0
- /package/{src → debug}/components/Utils.js +0 -0
- /package/{src → debug}/components/index.js +0 -0
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
|
|
3
|
-
import AbsoluteAttitudeProvider from '
|
|
3
|
+
import AbsoluteAttitudeProvider from '../../src/providers/attitude/AbsoluteAttitudeProvider';
|
|
4
4
|
import NavigationConfig from './NavigationConfig';
|
|
5
5
|
import Utils from './Utils';
|
|
6
|
-
import EventType from '
|
|
6
|
+
import EventType from '../../src/events/EventType';
|
|
7
|
+
import ProvidersLogger from '../../src/providers/ProvidersLogger';
|
|
7
8
|
|
|
9
|
+
ProvidersLogger.enabled = true;
|
|
8
10
|
|
|
9
11
|
class AbsoluteAttitudeComponent extends React.Component {
|
|
10
12
|
|
|
@@ -3,35 +3,49 @@ import isEmpty from 'lodash.isempty';
|
|
|
3
3
|
|
|
4
4
|
import { deg2rad } from '@wemap/maths';
|
|
5
5
|
|
|
6
|
-
import EventType from '
|
|
6
|
+
import EventType from '../../src/events/EventType';
|
|
7
7
|
import NavigationConfig from './NavigationConfig';
|
|
8
8
|
import Utils from './Utils';
|
|
9
|
-
import ArCoreAbsoluteProvider from '
|
|
9
|
+
import ArCoreAbsoluteProvider from '../../src/providers/pose/ArCoreAbsoluteProvider';
|
|
10
10
|
import MapComponent from './MapComponent';
|
|
11
|
+
import ProvidersLogger from '../../src/providers/ProvidersLogger';
|
|
11
12
|
|
|
13
|
+
ProvidersLogger.enabled = true;
|
|
12
14
|
|
|
13
15
|
class ArCoreAbsoluteComponent extends React.Component {
|
|
16
|
+
|
|
17
|
+
errored = false;
|
|
18
|
+
|
|
14
19
|
constructor(props, context) {
|
|
15
20
|
super(props, context);
|
|
16
21
|
this.state = {
|
|
17
22
|
position: null,
|
|
18
|
-
attitude: null
|
|
23
|
+
attitude: null,
|
|
24
|
+
barcode: null
|
|
19
25
|
};
|
|
20
26
|
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
componentDidMount() {
|
|
30
|
+
|
|
21
31
|
this.arCoreAbsoluteProvider = new ArCoreAbsoluteProvider(
|
|
22
32
|
this.onEvent,
|
|
23
33
|
this.onError
|
|
24
34
|
);
|
|
25
35
|
this.arCoreAbsoluteProvider.setPosition(NavigationConfig.INITIAL_POSITION);
|
|
26
36
|
this.arCoreAbsoluteProvider.setHeading(deg2rad(NavigationConfig.INITIAL_HEADING));
|
|
27
|
-
}
|
|
28
37
|
|
|
29
|
-
componentDidMount() {
|
|
30
38
|
this.arCoreAbsoluteProvider.start();
|
|
39
|
+
if (!this.errored) {
|
|
40
|
+
this.arCoreAbsoluteProvider.enableBarcodeScanner();
|
|
41
|
+
}
|
|
31
42
|
}
|
|
32
43
|
|
|
33
44
|
componentWillUnmount() {
|
|
34
|
-
this.
|
|
45
|
+
if (!this.errored) {
|
|
46
|
+
this.arCoreAbsoluteProvider.stop();
|
|
47
|
+
this.arCoreAbsoluteProvider.disableBarcodeScanner();
|
|
48
|
+
}
|
|
35
49
|
}
|
|
36
50
|
|
|
37
51
|
onEvent = events => {
|
|
@@ -41,6 +55,8 @@ class ArCoreAbsoluteComponent extends React.Component {
|
|
|
41
55
|
newState.position = event.data;
|
|
42
56
|
} else if (event.dataType === EventType.AbsoluteAttitude) {
|
|
43
57
|
newState.attitude = event.data;
|
|
58
|
+
} else if (event.dataType === EventType.Barcode) {
|
|
59
|
+
newState.barcode = event.data;
|
|
44
60
|
}
|
|
45
61
|
});
|
|
46
62
|
if (!isEmpty(newState)) {
|
|
@@ -53,6 +69,7 @@ class ArCoreAbsoluteComponent extends React.Component {
|
|
|
53
69
|
};
|
|
54
70
|
|
|
55
71
|
onError = error => {
|
|
72
|
+
this.errored = true;
|
|
56
73
|
this.setState({
|
|
57
74
|
position: error,
|
|
58
75
|
attitude: error
|
|
@@ -60,6 +77,8 @@ class ArCoreAbsoluteComponent extends React.Component {
|
|
|
60
77
|
};
|
|
61
78
|
|
|
62
79
|
render() {
|
|
80
|
+
const {barcode} = this.state;
|
|
81
|
+
|
|
63
82
|
const attitudeRender = Utils.renderAttitude(this.state.attitude);
|
|
64
83
|
const positionRender = Utils.renderPosition(this.state.position);
|
|
65
84
|
|
|
@@ -69,6 +88,8 @@ class ArCoreAbsoluteComponent extends React.Component {
|
|
|
69
88
|
{positionRender}
|
|
70
89
|
<h3>Attitude</h3>
|
|
71
90
|
{attitudeRender}
|
|
91
|
+
<h3>Barcode</h3>
|
|
92
|
+
{barcode ? barcode : ''}
|
|
72
93
|
<h3>Map</h3>
|
|
73
94
|
<MapComponent
|
|
74
95
|
ref={map => (this.map = map)}
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import isEmpty from 'lodash.isempty';
|
|
3
3
|
|
|
4
|
-
import EventType from '
|
|
4
|
+
import EventType from '../../src/events/EventType';
|
|
5
5
|
import Utils from './Utils';
|
|
6
|
-
import ArCoreProvider from '
|
|
6
|
+
import ArCoreProvider from '../../src/providers/pose/ArCoreProvider';
|
|
7
|
+
import ProvidersLogger from '../../src/providers/ProvidersLogger';
|
|
7
8
|
|
|
9
|
+
ProvidersLogger.enabled = true;
|
|
8
10
|
class ArCoreComponent extends React.Component {
|
|
9
11
|
|
|
10
12
|
constructor(props, context) {
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
|
|
3
|
-
import GnssWifiProvider from '
|
|
3
|
+
import GnssWifiProvider from '../../src/providers/position/GnssWifiProvider';
|
|
4
4
|
import Utils from './Utils';
|
|
5
|
-
import EventType from '
|
|
5
|
+
import EventType from '../../src/events/EventType';
|
|
6
6
|
import MapComponent from './MapComponent';
|
|
7
|
+
import ProvidersLogger from '../../src/providers/ProvidersLogger';
|
|
7
8
|
|
|
9
|
+
ProvidersLogger.enabled = true;
|
|
8
10
|
class GnssWifiComponent extends React.Component {
|
|
9
11
|
|
|
10
12
|
constructor(props, context) {
|
|
@@ -3,9 +3,12 @@ import React from 'react';
|
|
|
3
3
|
|
|
4
4
|
import NavigationConfig from './NavigationConfig';
|
|
5
5
|
import Utils from './Utils';
|
|
6
|
-
import EventType from '
|
|
7
|
-
import GnssWifiPdrProvider from '
|
|
6
|
+
import EventType from '../../src/events/EventType';
|
|
7
|
+
import GnssWifiPdrProvider from '../../src/providers/pose/GnssWifiPdrProvider';
|
|
8
8
|
import MapComponent from './MapComponent';
|
|
9
|
+
import ProvidersLogger from '../../src/providers/ProvidersLogger';
|
|
10
|
+
|
|
11
|
+
ProvidersLogger.enabled = true;
|
|
9
12
|
|
|
10
13
|
class GnssWifiPdrComponent extends React.Component {
|
|
11
14
|
constructor(props, context) {
|
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
|
|
3
|
-
import EventType from '
|
|
4
|
-
import ImuProvider from '
|
|
3
|
+
import EventType from '../../src/events/EventType';
|
|
4
|
+
import ImuProvider from '../../src/providers/others/ImuProvider';
|
|
5
5
|
import Utils from './Utils';
|
|
6
|
+
import ProvidersLogger from '../../src/providers/ProvidersLogger';
|
|
7
|
+
|
|
8
|
+
ProvidersLogger.enabled = true;
|
|
6
9
|
|
|
7
10
|
class ImuComponent extends React.Component {
|
|
8
11
|
|
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
|
|
3
|
-
import InclinationProvider from '
|
|
4
|
-
import EventType from '
|
|
3
|
+
import InclinationProvider from '../../src/providers/others/InclinationProvider';
|
|
4
|
+
import EventType from '../../src/events/EventType';
|
|
5
5
|
import Utils from './Utils';
|
|
6
|
+
import ProvidersLogger from '../../src/providers/ProvidersLogger';
|
|
7
|
+
|
|
8
|
+
ProvidersLogger.enabled = true;
|
|
6
9
|
|
|
7
10
|
class InclinationComponent extends React.Component {
|
|
8
11
|
|
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
} from '@wemap/geo';
|
|
9
9
|
import { Network } from '@wemap/graph';
|
|
10
10
|
|
|
11
|
-
import EventType from '
|
|
11
|
+
import EventType from '../../src/events/EventType';
|
|
12
12
|
|
|
13
13
|
mapboxgl.accessToken
|
|
14
14
|
= 'pk.eyJ1IjoibWFwYm94IiwiYSI6ImNpejY4M29iazA2Z2gycXA4N2pmbDZmangifQ.-g_vE53SD2WrJ6tFX7QHmA';
|
|
@@ -3,9 +3,12 @@ import React from 'react';
|
|
|
3
3
|
|
|
4
4
|
import NavigationConfig from './NavigationConfig';
|
|
5
5
|
import Utils from './Utils';
|
|
6
|
-
import PdrProvider from '
|
|
7
|
-
import EventType from '
|
|
6
|
+
import PdrProvider from '../../src/providers/pose/pdr/PdrProvider';
|
|
7
|
+
import EventType from '../../src/events/EventType';
|
|
8
8
|
import MapComponent from './MapComponent';
|
|
9
|
+
import ProvidersLogger from '../../src/providers/ProvidersLogger';
|
|
10
|
+
|
|
11
|
+
ProvidersLogger.enabled = true;
|
|
9
12
|
|
|
10
13
|
class PdrComponent extends React.Component {
|
|
11
14
|
constructor(props, context) {
|
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import isEmpty from 'lodash.isempty';
|
|
3
3
|
|
|
4
|
-
import EventType from '
|
|
4
|
+
import EventType from '../../src/events/EventType';
|
|
5
5
|
import Utils from './Utils';
|
|
6
|
-
import PoseProvider from '
|
|
6
|
+
import PoseProvider from '../../src/providers/pose/PoseProvider';
|
|
7
7
|
import MapComponent from './MapComponent';
|
|
8
|
+
import ProvidersLogger from '../../src/providers/ProvidersLogger';
|
|
9
|
+
|
|
10
|
+
ProvidersLogger.enabled = true;
|
|
8
11
|
|
|
9
12
|
class PoseComponent extends React.Component {
|
|
10
13
|
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import PositioningPoseComponent from './PositioningPoseComponent';
|
|
3
|
-
import PositioningHandler from '
|
|
3
|
+
import PositioningHandler from '../../src/PositioningHandler';
|
|
4
4
|
import PositioningInclinationComponent from './PositioningInclinationComponent';
|
|
5
|
+
import ProvidersLogger from '../../src/providers/ProvidersLogger';
|
|
6
|
+
|
|
7
|
+
ProvidersLogger.enabled = true;
|
|
5
8
|
|
|
6
9
|
class PositioningComponent extends React.Component {
|
|
7
10
|
|
|
@@ -2,10 +2,13 @@ import React from 'react';
|
|
|
2
2
|
import isEmpty from 'lodash.isempty';
|
|
3
3
|
import PropTypes from 'prop-types';
|
|
4
4
|
|
|
5
|
-
import EventType from '
|
|
5
|
+
import EventType from '../../src/events/EventType';
|
|
6
6
|
import Utils from './Utils';
|
|
7
|
-
import PositioningHandler from '
|
|
7
|
+
import PositioningHandler from '../../src/PositioningHandler';
|
|
8
8
|
import StartStopComponent from './StartStopComponent';
|
|
9
|
+
import ProvidersLogger from '../../src/providers/ProvidersLogger';
|
|
10
|
+
|
|
11
|
+
ProvidersLogger.enabled = true;
|
|
9
12
|
|
|
10
13
|
class PositioningInclinationComponent extends React.Component {
|
|
11
14
|
|
|
@@ -2,13 +2,15 @@ import React from 'react';
|
|
|
2
2
|
import isEmpty from 'lodash.isempty';
|
|
3
3
|
import PropTypes from 'prop-types';
|
|
4
4
|
|
|
5
|
-
import EventType from '
|
|
5
|
+
import EventType from '../../src/events/EventType';
|
|
6
6
|
import NavigationConfig from './NavigationConfig';
|
|
7
7
|
import Utils from './Utils';
|
|
8
|
-
import PositioningHandler from '
|
|
8
|
+
import PositioningHandler from '../../src/PositioningHandler';
|
|
9
9
|
import StartStopComponent from './StartStopComponent';
|
|
10
10
|
import MapComponent from './MapComponent';
|
|
11
|
+
import ProvidersLogger from '../../src/providers/ProvidersLogger';
|
|
11
12
|
|
|
13
|
+
ProvidersLogger.enabled = true;
|
|
12
14
|
|
|
13
15
|
class PositioningPoseComponent extends React.Component {
|
|
14
16
|
static propTypes = {positioningHandler: PropTypes.instanceOf(PositioningHandler).isRequired};
|
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
|
|
3
|
-
import RelativeAttitudeProvider from '
|
|
3
|
+
import RelativeAttitudeProvider from '../../src/providers/attitude/RelativeAttitudeProvider';
|
|
4
4
|
import Utils from './Utils';
|
|
5
|
-
import EventType from '
|
|
5
|
+
import EventType from '../../src/events/EventType';
|
|
6
|
+
import ProvidersLogger from '../../src/providers/ProvidersLogger';
|
|
7
|
+
|
|
8
|
+
ProvidersLogger.enabled = true;
|
|
6
9
|
|
|
7
10
|
class RelativeAttitudeComponent extends React.Component {
|
|
8
11
|
|
package/package.json
CHANGED
|
@@ -8,12 +8,12 @@
|
|
|
8
8
|
"Guillaume Pannetier <guillaume.pannetier@getwemap.com>"
|
|
9
9
|
],
|
|
10
10
|
"dependencies": {
|
|
11
|
-
"@wemap/geo": "^2.7.
|
|
12
|
-
"@wemap/graph": "^2.7.
|
|
13
|
-
"@wemap/logger": "^2.7.
|
|
14
|
-
"@wemap/maths": "^2.7.
|
|
15
|
-
"@wemap/osm": "^2.7.
|
|
16
|
-
"@wemap/utils": "^2.7.
|
|
11
|
+
"@wemap/geo": "^2.7.7",
|
|
12
|
+
"@wemap/graph": "^2.7.7",
|
|
13
|
+
"@wemap/logger": "^2.7.7",
|
|
14
|
+
"@wemap/maths": "^2.7.7",
|
|
15
|
+
"@wemap/osm": "^2.7.7",
|
|
16
|
+
"@wemap/utils": "^2.7.7",
|
|
17
17
|
"geomagnetism": "^0.1.0",
|
|
18
18
|
"lodash.isempty": "^4.4.0",
|
|
19
19
|
"lodash.isnumber": "^3.0.3",
|
|
@@ -21,7 +21,21 @@
|
|
|
21
21
|
},
|
|
22
22
|
"description": "A package using different geoloc systems",
|
|
23
23
|
"devDependencies": {
|
|
24
|
-
"
|
|
24
|
+
"@babel/core": "^7.5.5",
|
|
25
|
+
"@babel/plugin-proposal-class-properties": "^7.5.5",
|
|
26
|
+
"@babel/preset-env": "^7.5.5",
|
|
27
|
+
"@babel/preset-react": "^7.0.0",
|
|
28
|
+
"babel-loader": "^8.0.6",
|
|
29
|
+
"css-loader": "^3.2.0",
|
|
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"
|
|
25
39
|
},
|
|
26
40
|
"homepage": "https://github.com/wemap/wemap-modules-js#readme",
|
|
27
41
|
"keywords": [
|
|
@@ -46,6 +60,6 @@
|
|
|
46
60
|
"lint": "eslint --ext .js,.jsx --quiet src",
|
|
47
61
|
"test": "mocha -r esm \"src/**/*.spec.js\""
|
|
48
62
|
},
|
|
49
|
-
"version": "2.7.
|
|
50
|
-
"gitHead": "
|
|
63
|
+
"version": "2.7.7",
|
|
64
|
+
"gitHead": "988e0675759932cfc6b64df7768c6e6e573df1d9"
|
|
51
65
|
}
|
|
@@ -210,6 +210,28 @@ class PositioningHandler {
|
|
|
210
210
|
provider.setNetwork(network);
|
|
211
211
|
}
|
|
212
212
|
|
|
213
|
+
/**
|
|
214
|
+
* @public
|
|
215
|
+
*/
|
|
216
|
+
enableBarcodeScanner(id) {
|
|
217
|
+
const provider = this.providerInstances[id];
|
|
218
|
+
if (!(provider instanceof ArCoreAbsoluteProvider)) {
|
|
219
|
+
throw new Error('Not available. ArCore not started');
|
|
220
|
+
}
|
|
221
|
+
provider.enableBarcodeScanner();
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
/**
|
|
225
|
+
* @public
|
|
226
|
+
*/
|
|
227
|
+
disableBarcodeScanner(id) {
|
|
228
|
+
const provider = this.providerInstances[id];
|
|
229
|
+
if (!(provider instanceof ArCoreAbsoluteProvider)) {
|
|
230
|
+
throw new Error('Not available. ArCore not started');
|
|
231
|
+
}
|
|
232
|
+
provider.disableBarcodeScanner();
|
|
233
|
+
}
|
|
234
|
+
|
|
213
235
|
}
|
|
214
236
|
|
|
215
237
|
export default PositioningHandler;
|
package/src/events/EventType.js
CHANGED
|
@@ -11,6 +11,8 @@ let initDate;
|
|
|
11
11
|
|
|
12
12
|
class ProvidersLogger {
|
|
13
13
|
|
|
14
|
+
static enabled = false;
|
|
15
|
+
|
|
14
16
|
static initializeInterval() {
|
|
15
17
|
|
|
16
18
|
if (interval) {
|
|
@@ -69,9 +71,5 @@ class ProvidersLogger {
|
|
|
69
71
|
pushEvents[objectId] = counter + 1;
|
|
70
72
|
}
|
|
71
73
|
|
|
72
|
-
static get enabled() {
|
|
73
|
-
return Logger.ENABLED && Logger.LOG_LEVEL === Logger.DEBUG;
|
|
74
|
-
}
|
|
75
|
-
|
|
76
74
|
}
|
|
77
75
|
export default ProvidersLogger;
|
|
@@ -87,6 +87,9 @@ class ArCoreAbsoluteProvider extends MapMatchingProvider {
|
|
|
87
87
|
}
|
|
88
88
|
|
|
89
89
|
onArCoreEvent = events => {
|
|
90
|
+
|
|
91
|
+
const eventsForNotification = [];
|
|
92
|
+
|
|
90
93
|
events.forEach(event => {
|
|
91
94
|
if (event.dataType === EventType.RelativeAttitude) {
|
|
92
95
|
|
|
@@ -126,7 +129,7 @@ class ArCoreAbsoluteProvider extends MapMatchingProvider {
|
|
|
126
129
|
if (this.offsetQuat) {
|
|
127
130
|
const absoluteQuaternion = Quaternion.multiply(this.offsetQuat, this.relativeAttitude.quaternion);
|
|
128
131
|
this.absoluteAttitude = new Attitude(absoluteQuaternion);
|
|
129
|
-
|
|
132
|
+
eventsForNotification.push(this.createEvent(EventType.AbsoluteAttitude, this.absoluteAttitude, event.timestamp));
|
|
130
133
|
}
|
|
131
134
|
}
|
|
132
135
|
|
|
@@ -145,11 +148,19 @@ class ArCoreAbsoluteProvider extends MapMatchingProvider {
|
|
|
145
148
|
this.updatePositionWithMapMatching();
|
|
146
149
|
}
|
|
147
150
|
|
|
148
|
-
|
|
151
|
+
eventsForNotification.push(this.createEvent(EventType.AbsolutePosition, this.position, event.timestamp));
|
|
149
152
|
}
|
|
150
153
|
|
|
151
154
|
this.oldRelativePos = event.data;
|
|
152
155
|
}
|
|
156
|
+
|
|
157
|
+
if (event.dataType === EventType.Barcode) {
|
|
158
|
+
eventsForNotification.push(event);
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
if (eventsForNotification.length !== 0) {
|
|
162
|
+
this.notify(...eventsForNotification);
|
|
163
|
+
}
|
|
153
164
|
});
|
|
154
165
|
}
|
|
155
166
|
|
|
@@ -211,6 +222,14 @@ class ArCoreAbsoluteProvider extends MapMatchingProvider {
|
|
|
211
222
|
this.position.level = projection.projection.level;
|
|
212
223
|
}
|
|
213
224
|
}
|
|
225
|
+
|
|
226
|
+
enableBarcodeScanner() {
|
|
227
|
+
this.arCoreProvider.enableBarcodeScanner();
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
disableBarcodeScanner() {
|
|
231
|
+
this.arCoreProvider.disableBarcodeScanner();
|
|
232
|
+
}
|
|
214
233
|
}
|
|
215
234
|
|
|
216
235
|
export default ArCoreAbsoluteProvider;
|
|
@@ -30,7 +30,7 @@ class ArCoreProvider extends Provider {
|
|
|
30
30
|
* @override
|
|
31
31
|
*/
|
|
32
32
|
static get eventsType() {
|
|
33
|
-
return [EventType.RelativeAttitude, EventType.RelativePosition];
|
|
33
|
+
return [EventType.RelativeAttitude, EventType.RelativePosition, EventType.Barcode];
|
|
34
34
|
}
|
|
35
35
|
|
|
36
36
|
/**
|
|
@@ -66,19 +66,34 @@ class ArCoreProvider extends Provider {
|
|
|
66
66
|
return;
|
|
67
67
|
}
|
|
68
68
|
|
|
69
|
-
const
|
|
70
|
-
if (
|
|
71
|
-
|
|
72
|
-
const position = pose.slice(4, 7);
|
|
73
|
-
this.notify(
|
|
74
|
-
this.createEvent(EventType.RelativeAttitude, attitude),
|
|
75
|
-
this.createEvent(EventType.RelativePosition, position)
|
|
76
|
-
);
|
|
69
|
+
const payload = JSON.parse(ArCoreProvider.nativeProvider.getInfo());
|
|
70
|
+
if (payload.length !== 0) {
|
|
71
|
+
this.parsePayload(payload);
|
|
77
72
|
}
|
|
78
|
-
|
|
79
73
|
requestAnimationFrame(this.pullDataLoop);
|
|
80
74
|
}
|
|
81
75
|
|
|
76
|
+
parsePayload(payload) {
|
|
77
|
+
|
|
78
|
+
const events = [];
|
|
79
|
+
|
|
80
|
+
if (payload[0] !== null) {
|
|
81
|
+
const attitude = new Attitude(payload.slice(0, 4));
|
|
82
|
+
const position = payload.slice(4, 7);
|
|
83
|
+
events.push(this.createEvent(EventType.RelativeAttitude, attitude));
|
|
84
|
+
events.push(this.createEvent(EventType.RelativePosition, position));
|
|
85
|
+
}
|
|
86
|
+
const barcode = payload[7];
|
|
87
|
+
if (barcode !== null) {
|
|
88
|
+
events.push(this.createEvent(EventType.Barcode, barcode));
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
if (events.length !== 0) {
|
|
92
|
+
this.notify(...events);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
|
|
82
97
|
static get nativeProvider() {
|
|
83
98
|
|
|
84
99
|
if (!this._nativeProvider) {
|
|
@@ -121,6 +136,18 @@ class ArCoreProvider extends Provider {
|
|
|
121
136
|
return Availability.yes();
|
|
122
137
|
}
|
|
123
138
|
|
|
139
|
+
enableBarcodeScanner() {
|
|
140
|
+
if (ArCoreProvider.nativeProvider) {
|
|
141
|
+
ArCoreProvider.nativeProvider.enableBarcodeScanner();
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
disableBarcodeScanner() {
|
|
146
|
+
if (ArCoreProvider.nativeProvider) {
|
|
147
|
+
ArCoreProvider.nativeProvider.disableBarcodeScanner();
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
|
|
124
151
|
/**
|
|
125
152
|
* @override
|
|
126
153
|
*/
|
|
@@ -18,6 +18,7 @@ import RelativeAttitudeProvider from '../../attitude/RelativeAttitudeProvider';
|
|
|
18
18
|
import ImuProvider from '../../others/ImuProvider';
|
|
19
19
|
import EventType from '../../../events/EventType';
|
|
20
20
|
import MapMatchingProvider from '../../others/MapMatchingProvider';
|
|
21
|
+
import { TimeUtils } from '@wemap/utils';
|
|
21
22
|
|
|
22
23
|
|
|
23
24
|
const MM_PDR_ANGLE = deg2rad(20);
|
|
@@ -144,7 +145,7 @@ class PdrProvider extends MapMatchingProvider {
|
|
|
144
145
|
if (position instanceof WGS84) {
|
|
145
146
|
this.pdrPosition = WGS84UserPosition.fromWGS84(position);
|
|
146
147
|
if (window && window.performance) {
|
|
147
|
-
this.pdrPosition.time =
|
|
148
|
+
this.pdrPosition.time = TimeUtils.preciseTime / 1e3;
|
|
148
149
|
}
|
|
149
150
|
} else {
|
|
150
151
|
this.pdrPosition = position;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { deg2rad } from '@wemap/maths';
|
|
2
2
|
import { WGS84UserPosition } from '@wemap/geo';
|
|
3
|
-
import {
|
|
3
|
+
import { TimeUtils } from '@wemap/utils';
|
|
4
4
|
|
|
5
5
|
import EventType from '../../events/EventType';
|
|
6
6
|
import GeolocationApiMissingError from '../../errors/GeolocationApiMissingError';
|
|
@@ -92,7 +92,7 @@ class GnssWifiProvider extends Provider {
|
|
|
92
92
|
bearing = deg2rad(coords.heading);
|
|
93
93
|
}
|
|
94
94
|
|
|
95
|
-
const timestamp =
|
|
95
|
+
const timestamp = TimeUtils.unixTimestampToPreciseTime(geolocation.timestamp) / 1e3;
|
|
96
96
|
|
|
97
97
|
const position = new WGS84UserPosition(
|
|
98
98
|
coords.latitude,
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { WGS84UserPosition } from '@wemap/geo';
|
|
2
|
+
import { TimeUtils } from '@wemap/utils';
|
|
2
3
|
|
|
3
4
|
import EventType from '../../events/EventType';
|
|
4
5
|
import Provider from '../Provider';
|
|
@@ -45,7 +46,7 @@ class IpProvider extends Provider {
|
|
|
45
46
|
return;
|
|
46
47
|
}
|
|
47
48
|
|
|
48
|
-
const timestamp =
|
|
49
|
+
const timestamp = TimeUtils.preciseTime / 1e3;
|
|
49
50
|
|
|
50
51
|
const position = new WGS84UserPosition(
|
|
51
52
|
parseFloat(response.loc.split(',')[0]),
|
package/webpack/webpack.dev.js
CHANGED
|
@@ -7,7 +7,7 @@ const debugFolder = path.join(__dirname, '../debug');
|
|
|
7
7
|
|
|
8
8
|
module.exports = merge(common, {
|
|
9
9
|
mode: 'development',
|
|
10
|
-
entry: { 'positioning-components': './
|
|
10
|
+
entry: { 'positioning-components': './debug/components/index.js' },
|
|
11
11
|
output: {
|
|
12
12
|
publicPath: '/js/',
|
|
13
13
|
filename: '[name].js',
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|