@wemap/routers 12.12.3 → 12.12.4
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/dist/helpers/InstructionManager.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +14 -6
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/dist/index.mjs
CHANGED
|
@@ -9,7 +9,7 @@ import { diffAngleLines, deg2rad, diffAngle, positiveMod, rad2deg } from "@wemap
|
|
|
9
9
|
import Logger from "@wemap/logger";
|
|
10
10
|
import salesman from "@wemap/salesman.js";
|
|
11
11
|
import polyline from "@mapbox/polyline";
|
|
12
|
-
import
|
|
12
|
+
import booleanPointInPolygon from "@turf/boolean-point-in-polygon";
|
|
13
13
|
import { OsmTagsUtils, OsmParser, OsmNode } from "@wemap/osm";
|
|
14
14
|
function routerRequestToJson(routerRequest) {
|
|
15
15
|
const { origin, destination, waypoints, ...rest } = routerRequest;
|
|
@@ -4626,7 +4626,7 @@ class CustomGraphMap {
|
|
|
4626
4626
|
if (!this.routingBounds) {
|
|
4627
4627
|
return false;
|
|
4628
4628
|
}
|
|
4629
|
-
return
|
|
4629
|
+
return booleanPointInPolygon([coordinates.lng, coordinates.lat], this.routingBounds);
|
|
4630
4630
|
}
|
|
4631
4631
|
/**
|
|
4632
4632
|
* Get the list of entry points sorted by the lowest distance between:
|
|
@@ -6867,7 +6867,7 @@ osmtogeojson = function(data, options, featureCallback) {
|
|
|
6867
6867
|
function findOuter(inner) {
|
|
6868
6868
|
var polygonIntersectsPolygon = function(outer2, inner2) {
|
|
6869
6869
|
for (var i2 = 0; i2 < inner2.length; i2++)
|
|
6870
|
-
if (
|
|
6870
|
+
if (pointInPolygon(inner2[i2], outer2))
|
|
6871
6871
|
return true;
|
|
6872
6872
|
return false;
|
|
6873
6873
|
};
|
|
@@ -6876,7 +6876,7 @@ osmtogeojson = function(data, options, featureCallback) {
|
|
|
6876
6876
|
return [+n.lat, +n.lon];
|
|
6877
6877
|
});
|
|
6878
6878
|
};
|
|
6879
|
-
var
|
|
6879
|
+
var pointInPolygon = function(point, polygon) {
|
|
6880
6880
|
var x = point[0], y = point[1], inside = false;
|
|
6881
6881
|
for (var i2 = 0, j3 = polygon.length - 1; i2 < polygon.length; j3 = i2++) {
|
|
6882
6882
|
var xi = polygon[i2][0], yi = polygon[i2][1];
|
|
@@ -13394,7 +13394,10 @@ const _GeoJsonGraphUtils = class _GeoJsonGraphUtils {
|
|
|
13394
13394
|
});
|
|
13395
13395
|
}
|
|
13396
13396
|
});
|
|
13397
|
-
features.filter((f) => f.geometry.type === "Polygon" && f.properties && OsmTagsUtils.isElevator(f.properties)).
|
|
13397
|
+
features.filter((f) => f.geometry.type === "Polygon" && f.properties && OsmTagsUtils.isElevator(f.properties)).filter((f) => {
|
|
13398
|
+
const polygon = f.geometry;
|
|
13399
|
+
return !elevatorsVertices.flatMap(({ vertices: vertices2 }) => vertices2).some((v) => booleanPointInPolygon([v.coords.lng, v.coords.lat], polygon));
|
|
13400
|
+
}).forEach((feature) => {
|
|
13398
13401
|
var _a, _b;
|
|
13399
13402
|
const polygon = feature;
|
|
13400
13403
|
const entryVertices = polygon.geometry.coordinates[0].map((p) => vertices.filter((v) => v.coords.equalsWithoutLevel(new Coordinates(p[1], p[0], null, v.coords.level)))).flat();
|
|
@@ -13582,7 +13585,12 @@ const _OsmGraphUtils = class _OsmGraphUtils {
|
|
|
13582
13585
|
}
|
|
13583
13586
|
});
|
|
13584
13587
|
let fakeOsmNodeId = -1;
|
|
13585
|
-
osmModel.ways.filter((way) => OsmTagsUtils.isElevator(way.tags) && way.isGeometryClosed).
|
|
13588
|
+
osmModel.ways.filter((way) => OsmTagsUtils.isElevator(way.tags) && way.isGeometryClosed).filter((way) => {
|
|
13589
|
+
const polygon = way.getGeoJsonPolygon();
|
|
13590
|
+
return !elevatorVertices.flatMap(([, , vertices]) => vertices).some(
|
|
13591
|
+
(vertex) => booleanPointInPolygon([vertex.coords.lng, vertex.coords.lat], polygon)
|
|
13592
|
+
);
|
|
13593
|
+
}).forEach((way) => {
|
|
13586
13594
|
const entryVertices = way.nodes.map((node) => verticesMapping.filter(([osmId]) => osmId === node.id).map((vm) => vm[1])).flat();
|
|
13587
13595
|
const elevatorCenter = way.nodes.reduce((acc, node) => [acc[0] + node.coords.lat, acc[1] + node.coords.lng], [0, 0]).map((val) => val / way.nodes.length);
|
|
13588
13596
|
const elevatorLevel = entryVertices.reduce((acc, v) => Level.union(acc, v.coords.level), null);
|