@wemap/routers 12.10.4 → 12.10.5

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/routers"
13
13
  },
14
14
  "name": "@wemap/routers",
15
- "version": "12.10.4",
15
+ "version": "12.10.5",
16
16
  "bugs": {
17
17
  "url": "https://github.com/wemap/wemap-modules-js/issues"
18
18
  },
@@ -53,5 +53,5 @@
53
53
  },
54
54
  "./helpers/*": "./helpers/*"
55
55
  },
56
- "gitHead": "3bbef0e77b4af2df051ec488c8707827a2df43f4"
56
+ "gitHead": "bf59d394660dd70c2457b331d8073ccd1c8a4edd"
57
57
  }
@@ -164,7 +164,7 @@ describe('GraphRouter - with level', () => {
164
164
 
165
165
  const {
166
166
  graph, start, end
167
- } = createModel([1, [1, 2], [1, 2], 1]);
167
+ } = createModel([1, [1, 2], [1, 2], 2]);
168
168
 
169
169
  start.level = 1;
170
170
  end.level = 2;
@@ -173,7 +173,7 @@ describe('GraphRouter - with level', () => {
173
173
 
174
174
  const router = new GraphRouter(graph);
175
175
  const route = getShortestRoute(router, start, end);
176
- expect(getVerticesNames(route)).deep.equals(['p0', 'p1', 'p2']);
176
+ expect(getVerticesNames(route)).deep.equals(['p0', 'p1', 'p3']);
177
177
 
178
178
  });
179
179
  });
@@ -95,7 +95,8 @@ class GraphRouter extends GraphRouterEngine {
95
95
 
96
96
  const projectionsOptions = {
97
97
  maxDistance: options.projectionMaxDistance,
98
- acceptEdgeFn: options.acceptEdgeFn
98
+ acceptEdgeFn: options.acceptEdgeFn,
99
+ useMultiLevelSegments: options.useMultiLevelSegments,
99
100
  };
100
101
 
101
102
  const getOrCreateVertex = (coords: Coordinates): Vertex | null => {
@@ -5,6 +5,7 @@ export type GraphRouterOptions = {
5
5
  projectionMaxDistance?: number; // in meters
6
6
  weightEdgeFn?: (edge: Edge) => number;
7
7
  acceptEdgeFn?: (edge: Edge) => boolean;
8
+ useMultiLevelSegments?: boolean;
8
9
  }
9
10
 
10
11
  export type GraphRouterOptionsJson = {
@@ -9,7 +9,7 @@ export default class GraphRouterOptionsBuilder {
9
9
  public avoidElevators = false;
10
10
  public avoidMovingWalkways = false;
11
11
  public avoidTicketRestrictedAreas = false;
12
-
12
+ public useMultiLevelSegments = false;
13
13
  public projectionMaxDistance?: number;
14
14
 
15
15
  static DEFAULT = new GraphRouterOptionsBuilder().build();
@@ -40,6 +40,11 @@ export default class GraphRouterOptionsBuilder {
40
40
  return this;
41
41
  }
42
42
 
43
+ setUseMultiLevelSegments(useMultiLevelSegments: boolean) {
44
+ this.useMultiLevelSegments = useMultiLevelSegments;
45
+ return this;
46
+ }
47
+
43
48
  static fromJson(options: GraphRouterOptionsJson) {
44
49
  const builder = new GraphRouterOptionsBuilder();
45
50
  Object.assign(builder, options);
@@ -85,7 +90,8 @@ export default class GraphRouterOptionsBuilder {
85
90
  },
86
91
  weightEdgeFn,
87
92
  acceptEdgeFn,
88
- projectionMaxDistance: this.projectionMaxDistance
93
+ projectionMaxDistance: this.projectionMaxDistance,
94
+ useMultiLevelSegments: this.useMultiLevelSegments
89
95
  };
90
96
  }
91
97