@wemap/geo 0.3.5 → 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 CHANGED
@@ -12,7 +12,7 @@
12
12
  "directory": "packages/geo"
13
13
  },
14
14
  "name": "@wemap/geo",
15
- "version": "0.3.5",
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": "8f0c34af735495a9ca59be1f1a2c4b1c2aab9688"
34
+ "gitHead": "32a1062949091aeb9ab107da3e75bc69589538ba"
35
35
  }
@@ -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(start[lngLatFormat ? 1 : 0],
292
- start[lngLatFormat ? 0 : 1]);
293
- route.end = new WGS84(end[lngLatFormat ? 1 : 0],
294
- end[lngLatFormat ? 0 : 1]);
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(points[i][lngLatFormat ? 1 : 0],
302
- points[i][lngLatFormat ? 0 : 1])
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(lastPoint, currentPoint);
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;