@wemap/geo 0.3.4 → 0.3.6
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 +2 -2
- package/src/coordinates/WGS84.js +0 -4
- package/src/graph/Itinerary.js +22 -8
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.6",
|
|
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": "32a1062949091aeb9ab107da3e75bc69589538ba"
|
|
35
35
|
}
|
package/src/coordinates/WGS84.js
CHANGED
|
@@ -281,10 +281,6 @@ class WGS84 {
|
|
|
281
281
|
return new WGS84(message.lat, message.lng, message.alt, Level.fromString(message.level));
|
|
282
282
|
}
|
|
283
283
|
|
|
284
|
-
static fromPinpoint(pinpoint) {
|
|
285
|
-
return new WGS84(pinpoint.latitude, pinpoint.longitude, pinpoint.altitude);
|
|
286
|
-
}
|
|
287
|
-
|
|
288
284
|
static sampleRoute(route, stepSize = 0.7, maxLength = Number.MAX_VALUE) {
|
|
289
285
|
|
|
290
286
|
let p1, p2 = null;
|
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;
|