@wemap/routers 12.8.7 → 12.8.9

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.8.7",
15
+ "version": "12.8.9",
16
16
  "bugs": {
17
17
  "url": "https://github.com/wemap/wemap-modules-js/issues"
18
18
  },
@@ -34,10 +34,10 @@
34
34
  "@turf/convex": "^6.5.0",
35
35
  "@turf/helpers": "^6.5.0",
36
36
  "@types/mapbox__polyline": "^1.0.2",
37
- "@wemap/geo": "^12.8.5",
37
+ "@wemap/geo": "^12.8.9",
38
38
  "@wemap/logger": "^12.0.0",
39
39
  "@wemap/maths": "^12.0.0",
40
- "@wemap/osm": "^12.8.5",
40
+ "@wemap/osm": "^12.8.9",
41
41
  "@wemap/salesman.js": "^2.1.0"
42
42
  },
43
43
  "devDependencies": {
@@ -52,5 +52,5 @@
52
52
  },
53
53
  "./helpers/*": "./helpers/*"
54
54
  },
55
- "gitHead": "46a066c3198633332b721adc3b98523ab7940939"
55
+ "gitHead": "653f93f7efb8585735ea406aac1ca96f89b4ee12"
56
56
  }
@@ -98,7 +98,7 @@ export default class StepsBuilder {
98
98
  previousEdgeProperties.incline && previousEdgeProperties.areStairs
99
99
  && (!incline || !areStairs)
100
100
  );
101
- const createNewStep = vertex.properties.isSubwayEntrance;
101
+ const isEntrance = vertex.properties.isSubwayEntrance;
102
102
 
103
103
  const stepName = edge.properties.name || null;
104
104
  const duration = graphRoute.edgesWeights[i];
@@ -117,7 +117,7 @@ export default class StepsBuilder {
117
117
  const splitByEndOfLevelChange = previousStep?.levelChange && !Level.isRange(currentCoords.level)
118
118
  || forceEndOfLevelChange;
119
119
 
120
- const splitStepCondition = splitByAngle || splitByLevel || splitByEndOfLevelChange || createNewStep;
120
+ const splitStepCondition = splitByAngle || splitByLevel || splitByEndOfLevelChange || isEntrance;
121
121
 
122
122
  // New step creation
123
123
  if (isFirstStep || splitStepCondition) {
@@ -13,7 +13,7 @@ import OsmGraphUtils from '../wemap-osm/OsmGraphUtils.js';
13
13
 
14
14
 
15
15
  export type ParsingErrors = {
16
- couldNotParseFile: boolean,
16
+ couldNotParseFile?: string,
17
17
  routingIoNotFound: OsmNode[],
18
18
  routingBoundsNotFound: boolean
19
19
  }
@@ -66,7 +66,6 @@ export default class CustomGraphMap {
66
66
  callbackErrors?: (errors: ParsingErrors) => void
67
67
  ) {
68
68
  const errors: ParsingErrors = {
69
- couldNotParseFile: false,
70
69
  routingIoNotFound: [],
71
70
  routingBoundsNotFound: false
72
71
  };
@@ -75,7 +74,7 @@ export default class CustomGraphMap {
75
74
  try {
76
75
  osmModel = OsmParser.parseOsmXmlString(osmXmlString);
77
76
  } catch (e) {
78
- errors.couldNotParseFile = true;
77
+ errors.couldNotParseFile = e instanceof Error ? e.message : "Unknown error";
79
78
  callbackErrors?.(errors);
80
79
  return;
81
80
  }
@@ -15,7 +15,8 @@ export type Error = CouldNotParseFileError
15
15
  | RoutingIoNotOnGraphError;
16
16
 
17
17
  export type CouldNotParseFileError = {
18
- type: 'could-not-parse-file'
18
+ type: 'could-not-parse-file',
19
+ details: string | undefined
19
20
  }
20
21
 
21
22
  export type MultipleGraphComponentsError = {
@@ -42,7 +43,8 @@ export default class CustomGraphMapTester {
42
43
 
43
44
  if (customGraphMapErrors?.couldNotParseFile || !customGraphMap) {
44
45
  errors.push({
45
- type: 'could-not-parse-file'
46
+ type: 'could-not-parse-file',
47
+ details: customGraphMapErrors?.couldNotParseFile
46
48
  });
47
49
  return { errors };
48
50
  }
@@ -136,4 +136,18 @@ describe('OsmGraph - complex', () => {
136
136
 
137
137
  });
138
138
 
139
- });
139
+ it('escalators', () => {
140
+
141
+ const osmXmlString = loadFile('network-escalators.osm');
142
+ const osmModel = OsmParser.parseOsmXmlString(osmXmlString);
143
+ const graph = OsmGraphUtils.createGraphFromOsmModel(osmModel);
144
+
145
+ verifyCoherence(graph);
146
+
147
+ expect(graph.vertices.length).equals(4);
148
+ expect(graph.edges.length).equals(3);
149
+ graph.vertices.forEach(v => expect(v.coords.level).be.a("number"));
150
+
151
+ });
152
+
153
+ });
@@ -72,7 +72,10 @@ export default class OsmGraphUtils {
72
72
  if (vertex) {
73
73
  // In the case where vertices are linked to edges with level change
74
74
  if (!Level.equals(vertex.coords.level, nodeLevel)) {
75
- vertex.coords.level = Level.intersection(vertex.coords.level, nodeLevel) || nodeLevel;
75
+ vertex.coords.level = Level.intersection(vertex.coords.level, nodeLevel);
76
+ if (vertex.coords.level === null) {
77
+ vertex.coords.level = nodeLevel;
78
+ }
76
79
  }
77
80
  return vertex;
78
81
  }