@wemap/geo 0.3.5 → 0.3.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/package.json
CHANGED
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
"directory": "packages/geo"
|
|
13
13
|
},
|
|
14
14
|
"name": "@wemap/geo",
|
|
15
|
-
"version": "0.3.
|
|
15
|
+
"version": "0.3.7",
|
|
16
16
|
"bugs": {
|
|
17
17
|
"url": "https://github.com/wemap/wemap-utils-js/issues"
|
|
18
18
|
},
|
|
@@ -31,5 +31,5 @@
|
|
|
31
31
|
"lodash.isnumber": "^3.0.3",
|
|
32
32
|
"lodash.isstring": "^4.0.1"
|
|
33
33
|
},
|
|
34
|
-
"gitHead": "
|
|
34
|
+
"gitHead": "dfef19c363ee76ad4b4e23f9e36912034c10ccca"
|
|
35
35
|
}
|
|
@@ -19,16 +19,7 @@ class WGS84UserPosition extends WGS84 {
|
|
|
19
19
|
|
|
20
20
|
// Create a WGS84UserPosition with lat, lng, alt from WGS84 coordinates and
|
|
21
21
|
// other fields from another WGS84UserPosition
|
|
22
|
-
static fromWGS84(wgs84Coordinates
|
|
23
|
-
|
|
24
|
-
if (userPosition) {
|
|
25
|
-
return new WGS84UserPosition(
|
|
26
|
-
wgs84Coordinates.lat, wgs84Coordinates.lng,
|
|
27
|
-
wgs84Coordinates.alt, wgs84Coordinates.level,
|
|
28
|
-
userPosition.time, userPosition.accuracy,
|
|
29
|
-
userPosition.bearing, userPosition.provider);
|
|
30
|
-
}
|
|
31
|
-
|
|
22
|
+
static fromWGS84(wgs84Coordinates) {
|
|
32
23
|
return new WGS84UserPosition(wgs84Coordinates.lat, wgs84Coordinates.lng,
|
|
33
24
|
wgs84Coordinates.alt, wgs84Coordinates.level);
|
|
34
25
|
}
|
package/src/graph/Itinerary.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/* eslint-disable max-statements */
|
|
2
|
-
import { WGS84 } from '@wemap/geo';
|
|
2
|
+
import { WGS84, Level } from '@wemap/geo';
|
|
3
3
|
|
|
4
4
|
import Network from './Network';
|
|
5
5
|
import Edge from './Edge';
|
|
@@ -288,22 +288,36 @@ class Itinerary extends Network {
|
|
|
288
288
|
static fromOrderedPointsArray(points, start, end, lngLatFormat) {
|
|
289
289
|
const route = new Itinerary();
|
|
290
290
|
route._length = 0;
|
|
291
|
-
route.start = new WGS84(
|
|
292
|
-
start[lngLatFormat ?
|
|
293
|
-
|
|
294
|
-
|
|
291
|
+
route.start = new WGS84(
|
|
292
|
+
start[lngLatFormat ? 1 : 0],
|
|
293
|
+
start[lngLatFormat ? 0 : 1],
|
|
294
|
+
null,
|
|
295
|
+
start[2]);
|
|
296
|
+
route.end = new WGS84(
|
|
297
|
+
end[lngLatFormat ? 1 : 0],
|
|
298
|
+
end[lngLatFormat ? 0 : 1],
|
|
299
|
+
null,
|
|
300
|
+
end[2]);
|
|
295
301
|
|
|
296
302
|
let lastPoint = null;
|
|
297
303
|
|
|
298
304
|
for (let i = 0; i < points.length; i++) {
|
|
299
305
|
|
|
300
306
|
const currentPoint = new Node(
|
|
301
|
-
new WGS84(
|
|
302
|
-
points[i][lngLatFormat ?
|
|
307
|
+
new WGS84(
|
|
308
|
+
points[i][lngLatFormat ? 1 : 0],
|
|
309
|
+
points[i][lngLatFormat ? 0 : 1],
|
|
310
|
+
null,
|
|
311
|
+
points[i][2])
|
|
303
312
|
);
|
|
304
313
|
|
|
305
314
|
if (lastPoint) {
|
|
306
|
-
const edge = new Edge(
|
|
315
|
+
const edge = new Edge(
|
|
316
|
+
lastPoint,
|
|
317
|
+
currentPoint,
|
|
318
|
+
null,
|
|
319
|
+
Level.union(lastPoint.coords.level, currentPoint.coords.level)
|
|
320
|
+
);
|
|
307
321
|
route._edgesDirectionReversed.push(false);
|
|
308
322
|
route.edges.push(edge);
|
|
309
323
|
route._length += edge.length;
|