@twinmatrix/spatialverse-sdk-web 0.0.3 → 0.0.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/lib/cjs/meta-atlas-sdk/3DMap/CustomThreeJsWrapper/CustomThreeJsWrapper.js +2 -2
- package/lib/cjs/meta-atlas-sdk/3DMap/CustomThreeJsWrapper/CustomThreeJsWrapper.js.map +1 -1
- package/lib/cjs/meta-atlas-sdk/3DMap/CustomThreeJsWrapper/utility/CameraSync.js +293 -0
- package/lib/cjs/meta-atlas-sdk/3DMap/CustomThreeJsWrapper/utility/CameraSync.js.map +1 -0
- package/lib/cjs/meta-atlas-sdk/3DMap/CustomThreeJsWrapper/utility/CameraUtils.js +35 -0
- package/lib/cjs/meta-atlas-sdk/3DMap/CustomThreeJsWrapper/utility/CameraUtils.js.map +1 -0
- package/lib/cjs/meta-atlas-sdk/3DMap/CustomThreeJsWrapper/utility/constants.js +33 -0
- package/lib/cjs/meta-atlas-sdk/3DMap/CustomThreeJsWrapper/utility/constants.js.map +1 -0
- package/lib/cjs/meta-atlas-sdk/3DMap/CustomThreeJsWrapper/utility/suncalc.js +307 -0
- package/lib/cjs/meta-atlas-sdk/3DMap/CustomThreeJsWrapper/utility/suncalc.js.map +1 -0
- package/lib/cjs/meta-atlas-sdk/3DMap/CustomThreeJsWrapper/utility/utils.js +4 -3
- package/lib/cjs/meta-atlas-sdk/3DMap/CustomThreeJsWrapper/utility/utils.js.map +1 -1
- package/lib/cjs/meta-atlas-sdk/3DMap/MainMap.js +202 -198
- package/lib/cjs/meta-atlas-sdk/3DMap/MainMap.js.map +1 -1
- package/lib/cjs/meta-atlas-sdk/MetaAtlasCore/fetch-published-json.js +3 -3
- package/lib/cjs/meta-atlas-sdk/MetaAtlasCore/fetch-published-json.js.map +1 -1
- package/lib/cjs/meta-atlas-sdk/MetaAtlasCore/focustree.json +121 -0
- package/lib/cjs/meta-atlas-sdk/MetaAtlasCore/meta-atlas-sdk-core.js +32 -29
- package/lib/cjs/meta-atlas-sdk/MetaAtlasCore/meta-atlas-sdk-core.js.map +1 -1
- package/lib/cjs/meta-atlas-sdk/MetaAtlasCore/routing-core/index.js +10 -13
- package/lib/cjs/meta-atlas-sdk/MetaAtlasCore/routing-core/index.js.map +1 -1
- package/lib/cjs/meta-atlas-sdk/MetaAtlasCore/routing-core/routing-helpers.js +55 -68
- package/lib/cjs/meta-atlas-sdk/MetaAtlasCore/routing-core/routing-helpers.js.map +1 -1
- package/lib/cjs/meta-atlas-sdk/MetaAtlasCore/routing-core/utils.js +12 -12
- package/lib/cjs/meta-atlas-sdk/MetaAtlasCore/routing-core/utils.js.map +1 -1
- package/lib/cjs/meta-atlas-sdk/MetaAtlasCore/whatTaxonomies.json +170 -0
- package/lib/cjs/meta-atlas-sdk/combined_style.json +2313 -0
- package/lib/cjs/meta-atlas-sdk/mapbox_draw_custom_modes/draw_marker.js +166 -0
- package/lib/cjs/meta-atlas-sdk/mapbox_draw_custom_modes/draw_marker.js.map +1 -0
- package/lib/cjs/meta-atlas-sdk/mapbox_draw_custom_modes/marker_select.js +229 -0
- package/lib/cjs/meta-atlas-sdk/mapbox_draw_custom_modes/marker_select.js.map +1 -0
- package/lib/cjs/meta-atlas-sdk/meta-atlas-sdk.js +73 -69
- package/lib/cjs/meta-atlas-sdk/meta-atlas-sdk.js.map +1 -1
- package/lib/cjs/meta-atlas-sdk/utils/helpers.js +1 -1
- package/lib/cjs/meta-atlas-sdk/utils/helpers.js.map +1 -1
- package/lib/cjs/meta-atlas-sdk/utils/local-storage.js +6 -1
- package/lib/cjs/meta-atlas-sdk/utils/local-storage.js.map +1 -1
- package/lib/cjs/meta-atlas-sdk/utils/routing-visualizer/index.js +103 -103
- package/lib/cjs/meta-atlas-sdk/utils/routing-visualizer/index.js.map +1 -1
- package/lib/cjs/react/MetaAtlasMap.js +4 -4
- package/lib/cjs/react/MetaAtlasMap.js.map +1 -1
- package/lib/cjs/react/hooks/useMapEvents/index.js +6 -3
- package/lib/cjs/react/hooks/useMapEvents/index.js.map +1 -1
- package/lib/cjs/react/hooks/useStampRally/index.js +7 -5
- package/lib/cjs/react/hooks/useStampRally/index.js.map +1 -1
- package/lib/cjs/react/hooks/useStampRally/utils.js +1 -1
- package/lib/cjs/react/hooks/useStampRally/utils.js.map +1 -1
- package/lib/cjs/react/stores/useMapDataStore.js +17 -21
- package/lib/cjs/react/stores/useMapDataStore.js.map +1 -1
- package/lib/esm/meta-atlas-sdk/3DMap/CustomThreeJsWrapper/CustomThreeJsWrapper.js +2 -2
- package/lib/esm/meta-atlas-sdk/3DMap/CustomThreeJsWrapper/CustomThreeJsWrapper.js.map +1 -1
- package/lib/esm/meta-atlas-sdk/3DMap/CustomThreeJsWrapper/utility/CameraSync.js +286 -0
- package/lib/esm/meta-atlas-sdk/3DMap/CustomThreeJsWrapper/utility/CameraSync.js.map +1 -0
- package/lib/esm/meta-atlas-sdk/3DMap/CustomThreeJsWrapper/utility/CameraUtils.js +27 -0
- package/lib/esm/meta-atlas-sdk/3DMap/CustomThreeJsWrapper/utility/CameraUtils.js.map +1 -0
- package/lib/esm/meta-atlas-sdk/3DMap/CustomThreeJsWrapper/utility/constants.js +27 -0
- package/lib/esm/meta-atlas-sdk/3DMap/CustomThreeJsWrapper/utility/constants.js.map +1 -0
- package/lib/esm/meta-atlas-sdk/3DMap/CustomThreeJsWrapper/utility/suncalc.js +305 -0
- package/lib/esm/meta-atlas-sdk/3DMap/CustomThreeJsWrapper/utility/suncalc.js.map +1 -0
- package/lib/esm/meta-atlas-sdk/3DMap/CustomThreeJsWrapper/utility/utils.js +4 -3
- package/lib/esm/meta-atlas-sdk/3DMap/CustomThreeJsWrapper/utility/utils.js.map +1 -1
- package/lib/esm/meta-atlas-sdk/3DMap/MainMap.js +202 -198
- package/lib/esm/meta-atlas-sdk/3DMap/MainMap.js.map +1 -1
- package/lib/esm/meta-atlas-sdk/MetaAtlasCore/fetch-published-json.js +3 -3
- package/lib/esm/meta-atlas-sdk/MetaAtlasCore/fetch-published-json.js.map +1 -1
- package/lib/esm/meta-atlas-sdk/MetaAtlasCore/focustree.json +121 -0
- package/lib/esm/meta-atlas-sdk/MetaAtlasCore/meta-atlas-sdk-core.js +32 -29
- package/lib/esm/meta-atlas-sdk/MetaAtlasCore/meta-atlas-sdk-core.js.map +1 -1
- package/lib/esm/meta-atlas-sdk/MetaAtlasCore/routing-core/index.js +10 -8
- package/lib/esm/meta-atlas-sdk/MetaAtlasCore/routing-core/index.js.map +1 -1
- package/lib/esm/meta-atlas-sdk/MetaAtlasCore/routing-core/routing-helpers.js +55 -68
- package/lib/esm/meta-atlas-sdk/MetaAtlasCore/routing-core/routing-helpers.js.map +1 -1
- package/lib/esm/meta-atlas-sdk/MetaAtlasCore/routing-core/utils.js +12 -12
- package/lib/esm/meta-atlas-sdk/MetaAtlasCore/routing-core/utils.js.map +1 -1
- package/lib/esm/meta-atlas-sdk/MetaAtlasCore/whatTaxonomies.json +170 -0
- package/lib/esm/meta-atlas-sdk/combined_style.json +2313 -0
- package/lib/esm/meta-atlas-sdk/mapbox_draw_custom_modes/draw_marker.js +158 -0
- package/lib/esm/meta-atlas-sdk/mapbox_draw_custom_modes/draw_marker.js.map +1 -0
- package/lib/esm/meta-atlas-sdk/mapbox_draw_custom_modes/marker_select.js +221 -0
- package/lib/esm/meta-atlas-sdk/mapbox_draw_custom_modes/marker_select.js.map +1 -0
- package/lib/esm/meta-atlas-sdk/meta-atlas-sdk.js +73 -68
- package/lib/esm/meta-atlas-sdk/meta-atlas-sdk.js.map +1 -1
- package/lib/esm/meta-atlas-sdk/utils/helpers.js +1 -1
- package/lib/esm/meta-atlas-sdk/utils/helpers.js.map +1 -1
- package/lib/esm/meta-atlas-sdk/utils/local-storage.js +6 -1
- package/lib/esm/meta-atlas-sdk/utils/local-storage.js.map +1 -1
- package/lib/esm/meta-atlas-sdk/utils/routing-visualizer/index.js +103 -101
- package/lib/esm/meta-atlas-sdk/utils/routing-visualizer/index.js.map +1 -1
- package/lib/esm/react/MetaAtlasMap.js +4 -4
- package/lib/esm/react/MetaAtlasMap.js.map +1 -1
- package/lib/esm/react/hooks/useMapEvents/index.js +6 -3
- package/lib/esm/react/hooks/useMapEvents/index.js.map +1 -1
- package/lib/esm/react/hooks/useStampRally/index.js +7 -5
- package/lib/esm/react/hooks/useStampRally/index.js.map +1 -1
- package/lib/esm/react/hooks/useStampRally/utils.js +1 -1
- package/lib/esm/react/hooks/useStampRally/utils.js.map +1 -1
- package/lib/esm/react/stores/useMapDataStore.js +17 -21
- package/lib/esm/react/stores/useMapDataStore.js.map +1 -1
- package/lib/types/meta-atlas-sdk/3DMap/CustomThreeJsWrapper/utility/CameraSync.d.ts +30 -0
- package/lib/types/meta-atlas-sdk/3DMap/CustomThreeJsWrapper/utility/CameraSync.d.ts.map +1 -0
- package/lib/types/meta-atlas-sdk/3DMap/CustomThreeJsWrapper/utility/CameraUtils.d.ts +5 -0
- package/lib/types/meta-atlas-sdk/3DMap/CustomThreeJsWrapper/utility/CameraUtils.d.ts.map +1 -0
- package/lib/types/meta-atlas-sdk/3DMap/CustomThreeJsWrapper/utility/constants.d.ts +21 -0
- package/lib/types/meta-atlas-sdk/3DMap/CustomThreeJsWrapper/utility/constants.d.ts.map +1 -0
- package/lib/types/meta-atlas-sdk/3DMap/CustomThreeJsWrapper/utility/suncalc.d.ts +27 -0
- package/lib/types/meta-atlas-sdk/3DMap/CustomThreeJsWrapper/utility/suncalc.d.ts.map +1 -0
- package/lib/types/meta-atlas-sdk/mapbox_draw_custom_modes/draw_marker.d.ts +18 -0
- package/lib/types/meta-atlas-sdk/mapbox_draw_custom_modes/draw_marker.d.ts.map +1 -0
- package/lib/types/meta-atlas-sdk/mapbox_draw_custom_modes/marker_select.d.ts +37 -0
- package/lib/types/meta-atlas-sdk/mapbox_draw_custom_modes/marker_select.d.ts.map +1 -0
- package/package.json +4 -4
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["aStar","createGraph","point","multiPoint","turf","cloneDeep","isEmpty","toInteger","LineDirection","RouteDimension","WALK_SPEED","getNetworkFeatures","getEdge","getPortalDataForDimension","isMovingPortalTaxonomy","isPortalTaxonomy","DEFAULT_DIMENSION","filterPortalEdgeDataByList","filterPortalEdgeDataByWhere","getParentDimension","optimized","RoutingCore","wheelChairAccessibleRouteOnly","startNode","endNode","changeZoneCheckEnabled","runIntersection","portalData","edgeData","lines","addVertex","graph","coords","mapObjectId","where","what","zone","updateMapObjectId","arguments","length","undefined","vertexName","toString","vertex","getNode","data","zoneUnionVertex","addNode","addLink","vertex1","vertex2","cost","description","timeInSeconds","isPortal","wheelChairAccesible","id","weight","getDistance","coords1","coords2","point1","point2","distance","units","addEdgeToGraph","edge","node","index","line","getCoords","i","Edge","properties","direction","Forward","TwoWay","wheelchair","Backward","addNetworkToGraph","networkFeatures","feature","geometry","type","lineCoords","dimension_where","Network","addVertexByEdge","addPortalLinksToGraph","portalEdgeData","mapObjectId1","portal","links","portalLink","portal1","portal2","initLineString","coordinates","pathToFeatures","source","destination","vertices","segments","segmentStartVertexData","geojsonPaths","curVertex","prevVertex","segment","console","warn","portalPath","getPortalPath","invertStart","prevVertexMapObjId","set","Set","add","portalDataForSet","prevVertexPortalData","j","link","pathFeatures","start","end","distanceToStart","distanceToEnd","coordsToUse","slice","reverse","lineString","getLink","geojson","edges","startFloor","endFloor","push","nextVertex","log","pop","copyOfCurrentVertex","result","routes","findPath","pathFinder","oriented","fromNode","toNode","blocked","isZoneCrossing","parentWhereDimensionOfFromNode","parentWhereDimensionOfStartNode","parentWhereDimensionOfToNode","path","find","setupGraphAndFindPath","networkData","geojsonPath","getRouteWithAllPortals","performance","now","concatenatedEdgeFeatures","concat","concatenatedNetworkFeatures","getRouteWithSpecificPortals","routeWithAllAvailablePortals","portalsToUse","portalDataForList","getDirectRoute","networkFeaturesSourceNode","networkFeaturesDestinationNode","portalDataSourceNode","portalDataDestinationNode","getRoute","mapObjectId2","wheelChairAccessibleRouteOnlyParam","node1","node2","runRouteIteration","directRoute","routeWithAllPortals","finalRoute","route"],"sources":["../../../../../src/meta-atlas-sdk/MetaAtlasCore/routing-core/index.ts"],"sourcesContent":["/* eslint-disable guard-for-in */\n/* eslint-disable no-restricted-syntax */\nimport { aStar } from 'ngraph.path';\nimport createGraph, { Graph, Node } from 'ngraph.graph';\nimport {\n point,\n multiPoint,\n} from '@turf/helpers';\nimport { Feature, LineString, MultiPoint } from 'geojson';\n// import turfDistance from '@turf/distance';\nimport * as turf from '@turf/turf';\nimport { cloneDeep, isEmpty, toInteger } from 'lodash';\nimport {\n CalculationResult, Edge, LineDirection, RouteDimension, RouteResult, WALK_SPEED, EdgeLine, Portal, PortalEdgeData, UserPosition\n} from './interfaces';\nimport {\n getNetworkFeatures, getEdge,\n getPortalDataForDimension,\n} from './mapObjectsHelper';\nimport { isMovingPortalTaxonomy, isPortalTaxonomy } from './routing-helpers';\nimport {\n DEFAULT_DIMENSION, filterPortalEdgeDataByList, filterPortalEdgeDataByWhere, getParentDimension, getPortalEdgeData, optimized,\n} from './utils';\n\n/* eslint-disable @typescript-eslint/no-shadow */\n\nconst RoutingCore = (function () {\n let wheelChairAccessibleRouteOnly = true;\n let startNode: Edge | undefined;\n let endNode: Edge | undefined;\n let changeZoneCheckEnabled = true;\n let runIntersection = false;\n\n let portalData: {\n edgeData: PortalEdgeData,\n lines: EdgeLine[],\n } = { edgeData: {}, lines: [] };\n\n function addVertex(\n graph: Graph,\n coords: number[],\n mapObjectId: string,\n where: string,\n what: string,\n zone: string,\n updateMapObjectId = false,\n ) {\n const vertexName = `${(coords).toString()},${where}`;\n let vertex = graph.getNode(vertexName);\n if (vertex === undefined) {\n const data = {\n mapObjectId,\n coords,\n where,\n what,\n zone,\n zoneUnionVertex: false,\n };\n vertex = graph.addNode(vertexName, data);\n } else if (updateMapObjectId) {\n vertex.data.mapObjectId = mapObjectId;\n\n // Mark the vertex as common vertex between zones\n if (vertex.data.zone !== zone) vertex.data.zoneUnionVertex = true;\n vertex.data.zone = zone;\n }\n return vertex;\n }\n\n function addLink(graph: Graph<any, any>, vertex1 : Node<any>, vertex2 : Node<any>, data :{\n wheelChairAccesible: number,\n cost: number,\n isPortal: boolean,\n description: string | null,\n }) {\n const { cost, description } = data;\n const timeInSeconds = data.isPortal ? cost / WALK_SPEED : cost;\n if (!wheelChairAccessibleRouteOnly || (wheelChairAccessibleRouteOnly && data.wheelChairAccesible)) { graph.addLink(vertex1.id, vertex2.id, { weight: timeInSeconds, cost, description }); }\n }\n\n function getDistance(coords1: number[], coords2: number[]) {\n const point1 = point(coords1);\n const point2 = point(coords2);\n const distance = turf.distance(point1, point2, { units: 'meters' });\n return distance;\n }\n\n function addEdgeToGraph(graph: Graph, edge: Edge) {\n const node = edge;\n if (node) {\n const vertex = addVertex(\n graph,\n node.coords,\n node.id,\n node.where,\n node.what,\n node.zone,\n true,\n );\n for (let index = 0; index < node.lines.length; index += 1) {\n const line = node.lines[index];\n // add edges for coord pairs\n const coords = turf.getCoords(line);\n for (let i = 0; i < coords.length - 1; i += 1) {\n const vertex1 = addVertex(\n graph,\n coords[i],\n 'vertex',\n node.where,\n RouteDimension.Edge,\n line.properties.zone,\n );\n const vertex2 = addVertex(\n graph,\n coords[i + 1],\n 'vertex',\n node.where,\n RouteDimension.Edge,\n line.properties.zone,\n );\n if (vertex1.id !== vertex2.id) {\n const distance = getDistance(coords[i], coords[i + 1]);\n if (line.properties.direction === LineDirection.Forward || line.properties.direction === LineDirection.TwoWay) {\n addLink(graph, vertex1, vertex2, {\n wheelChairAccesible: line.properties.wheelchair,\n cost: distance,\n isPortal: false,\n description: null,\n });\n }\n if (line.properties.direction === LineDirection.Backward || line.properties.direction === LineDirection.TwoWay) {\n addLink(graph, vertex2, vertex1, {\n wheelChairAccesible: line.properties.wheelchair,\n cost: distance,\n isPortal: false,\n description: null,\n });\n }\n }\n }\n }\n return vertex;\n }\n\n return undefined;\n }\n\n function addNetworkToGraph(graph: Graph, networkFeatures: Feature[]) {\n for (let index = 0; index < networkFeatures.length; index += 1) {\n const feature = networkFeatures[index];\n if (feature.geometry.type === 'LineString') {\n // get line\n const lineCoords = turf.getCoords(feature as any);\n if (feature.properties) {\n const where = feature.properties.dimension_where;\n const what = RouteDimension.Network; // feature.properties.dimension_what;\n const { zone } = feature.properties;\n // add edges for coord pairs\n for (let i = 0; i < lineCoords.length - 1; i += 1) {\n const vertex1 = addVertex(graph, lineCoords[i], 'vertex', where, what, zone, true);\n const vertex2 = addVertex(\n graph,\n lineCoords[i + 1],\n 'vertex',\n where,\n what,\n zone,\n true,\n );\n if (vertex1.id !== vertex2.id) {\n const distance = getDistance(lineCoords[i], lineCoords[i + 1]);\n if (feature.properties.direction === LineDirection.Forward || feature.properties.direction === LineDirection.TwoWay) {\n addLink(graph, vertex1, vertex2, {\n wheelChairAccesible: feature.properties.wheelchair,\n cost: distance,\n isPortal: false,\n description: null,\n });\n }\n if (feature.properties.direction === LineDirection.Backward || feature.properties.direction === LineDirection.TwoWay) {\n addLink(graph, vertex2, vertex1, {\n wheelChairAccesible: feature.properties.wheelchair,\n cost: distance,\n isPortal: false,\n description: null,\n });\n }\n }\n }\n }\n }\n }\n }\n\n function addVertexByEdge(graph: Graph, edge: Edge) {\n const node = edge;\n if (node === undefined) {\n return undefined;\n }\n return addVertex(\n graph,\n node.coords,\n node.id,\n node.where,\n node.what,\n node.zone,\n true,\n );\n }\n\n function addPortalLinksToGraph(graph: Graph, portalEdgeData: PortalEdgeData) {\n for (const mapObjectId1 in portalEdgeData) {\n const portal = portalEdgeData[mapObjectId1];\n\n for (let index = 0; index < portal.links.length; index += 1) {\n const portalLink = portal.links[index];\n let { cost } = portalLink;\n cost = toInteger(cost);\n // if (cost <= 1) {\n // cost = portalWeight;\n // }\n const { direction, wheelchair, description } = portalLink;\n const portal1 = addVertexByEdge(graph, portal);\n const portal2 = addVertexByEdge(graph, portalLink);\n if (portal1 !== undefined && portal2 !== undefined && portal1.id !== portal2.id) {\n if (direction === LineDirection.Forward || direction === LineDirection.TwoWay) {\n addLink(graph, portal1, portal2, {\n wheelChairAccesible: wheelchair,\n cost,\n description,\n isPortal: true,\n });\n }\n if (direction === LineDirection.Backward || direction === LineDirection.TwoWay) {\n addLink(graph, portal2, portal1, {\n wheelChairAccesible: wheelchair,\n cost,\n description,\n isPortal: true,\n });\n }\n\n addEdgeToGraph(graph, portalLink);\n }\n }\n\n addEdgeToGraph(graph, portal);\n }\n }\n\n function initLineString(vertex: any) {\n return {\n type: 'Feature',\n geometry: { type: 'LineString', coordinates: [vertex.data.coords] },\n properties: {\n dimension_where: vertex.data.where,\n zone: vertex.data.zone,\n cost: 0,\n },\n } as Feature<LineString | MultiPoint, any>;\n }\n\n function pathToFeatures(source: Edge, destination : Edge, vertices: Node<any>[], graph: Graph) {\n if (vertices.length <= 1) {\n return {} as CalculationResult;\n } // if no path found\n\n const startNode = source;\n const endNode = destination;\n\n const segments: RouteResult[] = [];\n let segmentStartVertexData = vertices[0].data;\n const geojsonPaths = [initLineString(vertices[0])];\n\n for (let i = 1; i < vertices.length; i += 1) {\n const curVertex = vertices[i];\n const prevVertex = vertices[i - 1];\n const line = geojsonPaths[geojsonPaths.length - 1];\n\n // if vertex is map object\n if (curVertex.data.mapObjectId !== 'vertex' || curVertex.data.zoneUnionVertex) {\n let segment;\n if (isPortalTaxonomy(prevVertex.data.what) && isPortalTaxonomy(curVertex.data.what)) {\n if (prevVertex.data.zone !== curVertex.data.zone) {\n console.warn('A portal is triggering a change in zone');\n }\n\n // check if portal path is available to visualize\n let portalPath;\n if (isMovingPortalTaxonomy(prevVertex.data.what)) {\n const getPortalPath = (portalEdgeData: PortalEdgeData, curVertex: Node<any>, prevVertex: Node<any>, invertStart = false) => {\n const prevVertexMapObjId = prevVertex.data.mapObjectId;\n const set = new Set<string>().add(prevVertexMapObjId);\n const portalDataForSet = filterPortalEdgeDataByList(portalEdgeData, set);\n if (portalDataForSet && portalDataForSet.edgeData[prevVertexMapObjId]) {\n const prevVertexPortalData = portalDataForSet.edgeData[prevVertexMapObjId];\n for (let j = 0; j < prevVertexPortalData.links.length; j += 1) {\n const link = prevVertexPortalData.links[j];\n if (link.id === curVertex.data.mapObjectId) {\n if (link.pathFeatures && link.pathFeatures.length > 0) {\n const line = link.pathFeatures[0];\n const start = invertStart === false ? prevVertex.data.coords : curVertex.data.coords;\n const end = invertStart === false ? curVertex.data.coords : prevVertex.data.coords;\n\n const distanceToStart = turf.distance(start, line.geometry.coordinates[0]);\n const distanceToEnd = turf.distance(end, line.geometry.coordinates[0]);\n const coordsToUse = distanceToStart < distanceToEnd ? line.geometry.coordinates : line.geometry.coordinates.slice().reverse();\n return turf.lineString(coordsToUse);\n }\n }\n }\n }\n\n return null;\n };\n\n portalPath = getPortalPath(portalData.edgeData, curVertex, prevVertex, false);\n if (!portalPath) portalPath = getPortalPath(portalData.edgeData, prevVertex, curVertex, true);\n }\n\n // TODO: read description here\n const link = graph.getLink(prevVertex.id, curVertex.id);\n const cost = link ? link.data.cost ? link.data.cost : undefined : undefined;\n const description = link ? link.data.description ? link.data.description : undefined : undefined;\n segment = {\n geojson: multiPoint([\n prevVertex.data.coords,\n curVertex.data.coords,\n ], {\n zone: curVertex.data.zone,\n }),\n edges: [prevVertex.data.mapObjectId, curVertex.data.mapObjectId],\n startFloor: prevVertex.data.where,\n endFloor: curVertex.data.where,\n isPortal: true,\n portalPath,\n cost,\n description,\n } as RouteResult;\n\n segments.push(segment);\n segmentStartVertexData = curVertex.data;\n } else {\n const nextVertex = (i + 1 < vertices.length) ? vertices[i + 1] : undefined;\n if (curVertex.data.zoneUnionVertex\n && (prevVertex && nextVertex && prevVertex?.data.zone === nextVertex?.data.zone)) {\n console.log('ignore zoneUnionVertex in segment');\n } else {\n segment = {\n geojson: line,\n edges: [segmentStartVertexData.mapObjectId, curVertex.data.mapObjectId],\n startFloor: segmentStartVertexData.where,\n endFloor: segmentStartVertexData.where,\n isPortal: false,\n portalPath: undefined,\n cost: line.properties.cost,\n };\n\n segments.push(segment);\n segmentStartVertexData = curVertex.data;\n }\n }\n }\n\n // same line\n if (!(isPortalTaxonomy(prevVertex.data.what) && isPortalTaxonomy(curVertex.data.what))) {\n const link = graph.getLink(prevVertex.id, curVertex.id); // returns a link from 'hello' to 'world'\n const cost = link ? link.data.cost ? link.data.cost : undefined : undefined;\n\n line.geometry.coordinates.push(curVertex.data.coords);\n line.properties.cost += cost;\n } else {\n // new line\n if (line.geometry.coordinates.length < 2) {\n geojsonPaths.pop();\n }\n geojsonPaths.push(initLineString(curVertex));\n }\n\n // new line due to change in zone\n if (curVertex.data.zoneUnionVertex) {\n const prevVertex = (i > 0) ? vertices[i - 1] : undefined;\n const nextVertex = (i + 1 < vertices.length) ? vertices[i + 1] : undefined;\n if (prevVertex && nextVertex && prevVertex?.data.zone === nextVertex?.data.zone) {\n console.log('ignore zoneUnionVertex');\n } else\n // Use zone value of next vertex (when available) as current vertex is a common vertex and can have either of the zone values\n if (nextVertex) {\n const copyOfCurrentVertex = cloneDeep(curVertex);\n copyOfCurrentVertex.data.zone = nextVertex.data.zone;\n geojsonPaths.push(initLineString(copyOfCurrentVertex));\n } else {\n geojsonPaths.push(initLineString(curVertex));\n }\n }\n }\n\n const result: CalculationResult = {\n startNode,\n endNode,\n routes: segments,\n distance: 0,\n };\n\n return result;\n }\n\n function findPath(vertex1: Node<any>, vertex2: Node<any>, graph: Graph) {\n // setup ngraph pathfinder\n const pathFinder = aStar(graph, {\n oriented: true,\n distance(fromNode, toNode, link) {\n return link.data.weight;\n },\n blocked(fromNode, toNode, link) {\n if (changeZoneCheckEnabled) {\n const isZoneCrossing = fromNode?.data.zone !== toNode?.data.zone;\n if (isZoneCrossing) {\n const parentWhereDimensionOfFromNode = getParentDimension(fromNode.data.where);\n const parentWhereDimensionOfStartNode = getParentDimension((startNode as Edge).where);\n const parentWhereDimensionOfToNode = getParentDimension(toNode.data.where);\n if (parentWhereDimensionOfFromNode !== parentWhereDimensionOfStartNode && parentWhereDimensionOfToNode !== parentWhereDimensionOfStartNode) {\n return true;\n }\n }\n }\n return false;\n },\n });\n\n // get shortest path\n const path = pathFinder.find(vertex1.id, vertex2.id).reverse();\n return path;\n }\n\n function setupGraphAndFindPath(source: Edge, destination: Edge, portalEdgeData: PortalEdgeData, networkData: Feature[]) {\n // create ngraph graph\n const graph = createGraph();\n\n // add node & node lines to graph\n const vertex1 = addEdgeToGraph(graph, source);\n const vertex2 = addEdgeToGraph(graph, destination);\n\n if (vertex1 && vertex2) {\n // Add portal links\n addPortalLinksToGraph(graph, portalEdgeData);\n\n // add networks to graph\n addNetworkToGraph(graph, networkData);\n\n const path = findPath(vertex1, vertex2, graph);\n // reconstruct path into geojson features\n const geojsonPath = pathToFeatures(source, destination, path, graph);\n return geojsonPath;\n }\n\n return {} as CalculationResult;\n }\n\n function getRouteWithAllPortals(source: Edge, destination: Edge) {\n let start = performance.now();\n\n // Load network data\n const networkFeatures = getNetworkFeatures(DEFAULT_DIMENSION);\n console.log('time load: ', (performance.now() - start) / 1000);\n\n start = performance.now();\n const concatenatedEdgeFeatures = source.lines.concat(destination.lines, portalData.lines);\n const concatenatedNetworkFeatures = networkFeatures;\n\n if (runIntersection) optimized(concatenatedEdgeFeatures, concatenatedNetworkFeatures);\n console.log('time network: ', (performance.now() - start) / 1000, networkFeatures.length);\n\n return setupGraphAndFindPath(source, destination, portalData.edgeData, concatenatedNetworkFeatures);\n }\n\n function getRouteWithSpecificPortals(source: Edge, destination: Edge, routeWithAllAvailablePortals: CalculationResult) {\n const portalsToUse = new Set<string>();\n for (let index = 0; routeWithAllAvailablePortals.routes && index < routeWithAllAvailablePortals.routes.length; index += 1) {\n const segment = routeWithAllAvailablePortals.routes[index];\n if (segment.isPortal) {\n portalsToUse.add(segment.edges[0]);\n portalsToUse.add(segment.edges[1]);\n }\n }\n\n let start = performance.now();\n // Load data\n // Load network data\n const networkFeatures = getNetworkFeatures(DEFAULT_DIMENSION);\n // Load portal data\n const portalDataForList = filterPortalEdgeDataByList(portalData.edgeData, portalsToUse);\n console.log('time load: ', (performance.now() - start) / 1000);\n\n start = performance.now();\n const concatenatedEdgeFeatures = source.lines.concat(destination.lines, portalDataForList.lines);\n const concatenatedNetworkFeatures = networkFeatures;\n\n if (runIntersection) optimized(concatenatedEdgeFeatures, concatenatedNetworkFeatures);\n console.log('time network: ', (performance.now() - start) / 1000, networkFeatures.length);\n\n return setupGraphAndFindPath(source, destination, portalDataForList.edgeData, concatenatedNetworkFeatures);\n }\n\n function getDirectRoute(source: Edge, destination: Edge) {\n let start = performance.now();\n // Load data\n // Load network data\n const networkFeaturesSourceNode = getNetworkFeatures(getParentDimension(source.where));\n const networkFeaturesDestinationNode = getNetworkFeatures(getParentDimension(destination.where));\n // Load portal data\n const portalDataSourceNode = filterPortalEdgeDataByWhere(portalData.edgeData, getParentDimension(source.where));\n const portalDataDestinationNode = filterPortalEdgeDataByWhere(portalData.edgeData, getParentDimension(destination.where));\n\n console.log('time load: ', (performance.now() - start) / 1000);\n\n start = performance.now();\n const concatenatedEdgeFeatures = source.lines.concat(destination.lines, portalDataSourceNode.lines, portalDataDestinationNode.lines);\n const concatenatedNetworkFeatures = networkFeaturesSourceNode.concat(networkFeaturesDestinationNode);\n\n if (runIntersection) optimized(concatenatedEdgeFeatures, concatenatedNetworkFeatures);\n console.log('time network: ', (performance.now() - start) / 1000, networkFeaturesSourceNode.length);\n\n const portalEdgeData = {\n ...portalDataSourceNode.edgeData,\n ...portalDataDestinationNode.edgeData,\n };\n return setupGraphAndFindPath(source, destination, portalEdgeData, concatenatedNetworkFeatures);\n }\n\n // function to get shortest route\n function getRoute(\n mapObjectId1: string | UserPosition,\n mapObjectId2: string,\n wheelChairAccessibleRouteOnlyParam: boolean\n ) {\n wheelChairAccessibleRouteOnly = wheelChairAccessibleRouteOnlyParam;\n // if same start & end\n if (mapObjectId1 === mapObjectId2) {\n return {} as CalculationResult;\n }\n\n if(typeof(mapObjectId1) !== 'string'\n || typeof(mapObjectId2) !== 'string'\n ) runIntersection = true;\n\n const node1 = getEdge(mapObjectId1);\n const node2 = getEdge(mapObjectId2);\n\n startNode = node1;\n endNode = node2;\n\n let start = performance.now();\n portalData = getPortalDataForDimension(DEFAULT_DIMENSION);\n console.log('time portal load with extrapolation: ', (performance.now() - start) / 1000);\n\n start = performance.now();\n if (startNode && endNode) {\n changeZoneCheckEnabled = true;\n const runRouteIteration = () => {\n const directRoute = getDirectRoute(startNode as Edge, endNode as Edge);\n console.log('Direct route', directRoute);\n if (isEmpty(directRoute)) {\n const routeWithAllPortals = getRouteWithAllPortals(startNode as Edge, endNode as Edge);\n const finalRoute = getRouteWithSpecificPortals(startNode as Edge, endNode as Edge, routeWithAllPortals);\n return finalRoute;\n }\n\n const finalRoute = getRouteWithSpecificPortals(startNode as Edge, endNode as Edge, directRoute);\n return finalRoute;\n };\n\n let route = runRouteIteration();\n if (isEmpty(route)) {\n changeZoneCheckEnabled = false;\n route = runRouteIteration();\n }\n\n console.log('time total: ', (performance.now() - start) / 1000);\n return route;\n }\n\n return {} as CalculationResult;\n }\n\n return { getRoute };\n}());\n\nexport default RoutingCore;\n"],"mappings":"AAAA;AACA;AACA,SAASA,KAAK,QAAQ,aAAa;AACnC,OAAOC,WAAW,MAAuB,cAAc;AACvD,SACEC,KAAK,EACLC,UAAU,QACL,eAAe;AAEtB;AACA,OAAO,KAAKC,IAAI,MAAM,YAAY;AAClC,SAASC,SAAS,EAAEC,OAAO,EAAEC,SAAS,QAAQ,QAAQ;AAAC,SAE5BC,aAAa,EAAEC,cAAc,EAAeC,UAAU;AAAA,SAG/EC,kBAAkB,EAAEC,OAAO,EAC3BC,yBAAyB;AAAA,SAElBC,sBAAsB,EAAEC,gBAAgB;AAAA,SAE/CC,iBAAiB,EAAEC,0BAA0B,EAAEC,2BAA2B,EAAEC,kBAAkB,EAAqBC,SAAS;AAG9H;AAEA,MAAMC,WAAW,GAAI,YAAY;EAC/B,IAAIC,6BAA6B,GAAG,IAAI;EACxC,IAAIC,SAA2B;EAC/B,IAAIC,OAAyB;EAC7B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E;MACxBC,sBAAsB,GAAG,IAAI;MAC7B,MAAMwJ,iBAAiB,GAAGA,CAAA,KAAM;QAC9B,MAAMC,WAAW,GAAGX,cAAc,CAAChJ,SAAS,EAAUC,OAAe,CAAC;QACtEoF,OAAO,CAAC6B,GAAG,CAAC,cAAc,EAAEyC,WAAW,CAAC;QACxC,IAAI5K,OAAO,CAAC4K,WAAW,CAAC,EAAE;UACxB,MAAMC,mBAAmB,GAAGtB,sBAAsB,CAACtI,SAAS,EAAUC,OAAe,CAAC;UACtF,MAAM4J,UAAU,GAAGjB,2BAA2B,CAAC5I,SAAS,EAAUC,OAAO,EAAU2J,mBAAmB,CAAC;UACvG,OAAOC,UAAU;QACnB;QAEA,MAAMA,UAAU,GAAGjB,2BAA2B,CAAC5I,SAAS,EAAUC,OAAO,EAAU0J,WAAW,CAAC;QAC/F,OAAOE,UAAU;MACnB,CAAC;MAED,IAAIC,KAAK,GAAGJ,iBAAiB,CAAC,CAAC;MAC/B,IAAI3K,OAAO,CAAC+K,KAAK,CAAC,EAAE;QAClB5J,sBAAsB,GAAG,KAAK;QAC9B4J,KAAK,GAAGJ,iBAAiB,CAAC,CAAC;MAC7B;MAEArE,OAAO,CAAC6B,GAAG,CAAC,cAAc,EAAE,CAACqB,WAAW,CAACC,GAAG,CAAC,CAAC,GAAGrC,KAAK,IAAI,IAAI,CAAC;MAC/D,OAAO2D,KAAK;IACd;IAEA,OAAO,CAAC,CAAC;EACX;EAEA,OAAO;IAAET;EAAS,CAAC;AACrB,CAAC,CAAC,CAAE;AAEJ,eAAevJ,WAAW","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"index.js","names":["aStar","createGraph","point","multiPoint","turf","cloneDeep","isEmpty","toInteger","LineDirection","RouteDimension","WALK_SPEED","getNetworkFeatures","getEdge","getPortalDataForDimension","isMovingPortalTaxonomy","isPortalTaxonomy","DEFAULT_DIMENSION","filterPortalEdgeDataByList","filterPortalEdgeDataByWhere","getParentDimension","optimized","RoutingCore","wheelChairAccessibleRouteOnly","startNode","endNode","changeZoneCheckEnabled","runIntersection","portalData","edgeData","lines","addVertex","graph","coords","mapObjectId","where","what","zone","updateMapObjectId","arguments","length","undefined","vertexName","concat","toString","vertex","getNode","data","zoneUnionVertex","addNode","addLink","vertex1","vertex2","cost","description","timeInSeconds","isPortal","wheelChairAccesible","id","weight","getDistance","coords1","coords2","point1","point2","distance","units","addEdgeToGraph","edge","node","index","line","getCoords","i","Edge","properties","direction","Forward","TwoWay","wheelchair","Backward","addNetworkToGraph","networkFeatures","feature","geometry","type","lineCoords","dimension_where","Network","addVertexByEdge","addPortalLinksToGraph","portalEdgeData","mapObjectId1","portal","links","portalLink","portal1","portal2","initLineString","coordinates","pathToFeatures","source","destination","vertices","segments","segmentStartVertexData","geojsonPaths","curVertex","prevVertex","segment","console","warn","portalPath","getPortalPath","invertStart","prevVertexMapObjId","set","Set","add","portalDataForSet","prevVertexPortalData","j","link","pathFeatures","start","end","distanceToStart","distanceToEnd","coordsToUse","slice","reverse","lineString","getLink","geojson","edges","startFloor","endFloor","push","nextVertex","log","pop","copyOfCurrentVertex","result","routes","findPath","pathFinder","oriented","fromNode","toNode","blocked","isZoneCrossing","parentWhereDimensionOfFromNode","parentWhereDimensionOfStartNode","parentWhereDimensionOfToNode","path","find","setupGraphAndFindPath","networkData","geojsonPath","getRouteWithAllPortals","performance","now","concatenatedEdgeFeatures","concatenatedNetworkFeatures","getRouteWithSpecificPortals","routeWithAllAvailablePortals","portalsToUse","portalDataForList","getDirectRoute","networkFeaturesSourceNode","networkFeaturesDestinationNode","portalDataSourceNode","portalDataDestinationNode","_objectSpread","getRoute","mapObjectId2","wheelChairAccessibleRouteOnlyParam","node1","node2","runRouteIteration","directRoute","routeWithAllPortals","finalRoute","route"],"sources":["../../../../../src/meta-atlas-sdk/MetaAtlasCore/routing-core/index.ts"],"sourcesContent":["/* eslint-disable guard-for-in */\n/* eslint-disable no-restricted-syntax */\nimport { aStar } from 'ngraph.path';\nimport createGraph, { Graph, Node } from 'ngraph.graph';\nimport {\n point,\n multiPoint,\n} from '@turf/helpers';\nimport { Feature, LineString, MultiPoint } from 'geojson';\n// import turfDistance from '@turf/distance';\nimport * as turf from '@turf/turf';\nimport { cloneDeep, isEmpty, toInteger } from 'lodash';\nimport {\n CalculationResult, Edge, LineDirection, RouteDimension, RouteResult, WALK_SPEED, EdgeLine, Portal, PortalEdgeData, UserPosition\n} from './interfaces';\nimport {\n getNetworkFeatures, getEdge,\n getPortalDataForDimension,\n} from './mapObjectsHelper';\nimport { isMovingPortalTaxonomy, isPortalTaxonomy } from './routing-helpers';\nimport {\n DEFAULT_DIMENSION, filterPortalEdgeDataByList, filterPortalEdgeDataByWhere, getParentDimension, getPortalEdgeData, optimized,\n} from './utils';\n\n/* eslint-disable @typescript-eslint/no-shadow */\n\nconst RoutingCore = (function () {\n let wheelChairAccessibleRouteOnly = true;\n let startNode: Edge | undefined;\n let endNode: Edge | undefined;\n let changeZoneCheckEnabled = true;\n let runIntersection = false;\n\n let portalData: {\n edgeData: PortalEdgeData,\n lines: EdgeLine[],\n } = { edgeData: {}, lines: [] };\n\n function addVertex(\n graph: Graph,\n coords: number[],\n mapObjectId: string,\n where: string,\n what: string,\n zone: string,\n updateMapObjectId = false,\n ) {\n const vertexName = `${(coords).toString()},${where}`;\n let vertex = graph.getNode(vertexName);\n if (vertex === undefined) {\n const data = {\n mapObjectId,\n coords,\n where,\n what,\n zone,\n zoneUnionVertex: false,\n };\n vertex = graph.addNode(vertexName, data);\n } else if (updateMapObjectId) {\n vertex.data.mapObjectId = mapObjectId;\n\n // Mark the vertex as common vertex between zones\n if (vertex.data.zone !== zone) vertex.data.zoneUnionVertex = true;\n vertex.data.zone = zone;\n }\n return vertex;\n }\n\n function addLink(graph: Graph<any, any>, vertex1 : Node<any>, vertex2 : Node<any>, data :{\n wheelChairAccesible: number,\n cost: number,\n isPortal: boolean,\n description: string | null,\n }) {\n const { cost, description } = data;\n const timeInSeconds = data.isPortal ? cost / WALK_SPEED : cost;\n if (!wheelChairAccessibleRouteOnly || (wheelChairAccessibleRouteOnly && data.wheelChairAccesible)) { graph.addLink(vertex1.id, vertex2.id, { weight: timeInSeconds, cost, description }); }\n }\n\n function getDistance(coords1: number[], coords2: number[]) {\n const point1 = point(coords1);\n const point2 = point(coords2);\n const distance = turf.distance(point1, point2, { units: 'meters' });\n return distance;\n }\n\n function addEdgeToGraph(graph: Graph, edge: Edge) {\n const node = edge;\n if (node) {\n const vertex = addVertex(\n graph,\n node.coords,\n node.id,\n node.where,\n node.what,\n node.zone,\n true,\n );\n for (let index = 0; index < node.lines.length; index += 1) {\n const line = node.lines[index];\n // add edges for coord pairs\n const coords = turf.getCoords(line);\n for (let i = 0; i < coords.length - 1; i += 1) {\n const vertex1 = addVertex(\n graph,\n coords[i],\n 'vertex',\n node.where,\n RouteDimension.Edge,\n line.properties.zone,\n );\n const vertex2 = addVertex(\n graph,\n coords[i + 1],\n 'vertex',\n node.where,\n RouteDimension.Edge,\n line.properties.zone,\n );\n if (vertex1.id !== vertex2.id) {\n const distance = getDistance(coords[i], coords[i + 1]);\n if (line.properties.direction === LineDirection.Forward || line.properties.direction === LineDirection.TwoWay) {\n addLink(graph, vertex1, vertex2, {\n wheelChairAccesible: line.properties.wheelchair,\n cost: distance,\n isPortal: false,\n description: null,\n });\n }\n if (line.properties.direction === LineDirection.Backward || line.properties.direction === LineDirection.TwoWay) {\n addLink(graph, vertex2, vertex1, {\n wheelChairAccesible: line.properties.wheelchair,\n cost: distance,\n isPortal: false,\n description: null,\n });\n }\n }\n }\n }\n return vertex;\n }\n\n return undefined;\n }\n\n function addNetworkToGraph(graph: Graph, networkFeatures: Feature[]) {\n for (let index = 0; index < networkFeatures.length; index += 1) {\n const feature = networkFeatures[index];\n if (feature.geometry.type === 'LineString') {\n // get line\n const lineCoords = turf.getCoords(feature as any);\n if (feature.properties) {\n const where = feature.properties.dimension_where;\n const what = RouteDimension.Network; // feature.properties.dimension_what;\n const { zone } = feature.properties;\n // add edges for coord pairs\n for (let i = 0; i < lineCoords.length - 1; i += 1) {\n const vertex1 = addVertex(graph, lineCoords[i], 'vertex', where, what, zone, true);\n const vertex2 = addVertex(\n graph,\n lineCoords[i + 1],\n 'vertex',\n where,\n what,\n zone,\n true,\n );\n if (vertex1.id !== vertex2.id) {\n const distance = getDistance(lineCoords[i], lineCoords[i + 1]);\n if (feature.properties.direction === LineDirection.Forward || feature.properties.direction === LineDirection.TwoWay) {\n addLink(graph, vertex1, vertex2, {\n wheelChairAccesible: feature.properties.wheelchair,\n cost: distance,\n isPortal: false,\n description: null,\n });\n }\n if (feature.properties.direction === LineDirection.Backward || feature.properties.direction === LineDirection.TwoWay) {\n addLink(graph, vertex2, vertex1, {\n wheelChairAccesible: feature.properties.wheelchair,\n cost: distance,\n isPortal: false,\n description: null,\n });\n }\n }\n }\n }\n }\n }\n }\n\n function addVertexByEdge(graph: Graph, edge: Edge) {\n const node = edge;\n if (node === undefined) {\n return undefined;\n }\n return addVertex(\n graph,\n node.coords,\n node.id,\n node.where,\n node.what,\n node.zone,\n true,\n );\n }\n\n function addPortalLinksToGraph(graph: Graph, portalEdgeData: PortalEdgeData) {\n for (const mapObjectId1 in portalEdgeData) {\n const portal = portalEdgeData[mapObjectId1];\n\n for (let index = 0; index < portal.links.length; index += 1) {\n const portalLink = portal.links[index];\n let { cost } = portalLink;\n cost = toInteger(cost);\n // if (cost <= 1) {\n // cost = portalWeight;\n // }\n const { direction, wheelchair, description } = portalLink;\n const portal1 = addVertexByEdge(graph, portal);\n const portal2 = addVertexByEdge(graph, portalLink);\n if (portal1 !== undefined && portal2 !== undefined && portal1.id !== portal2.id) {\n if (direction === LineDirection.Forward || direction === LineDirection.TwoWay) {\n addLink(graph, portal1, portal2, {\n wheelChairAccesible: wheelchair,\n cost,\n description,\n isPortal: true,\n });\n }\n if (direction === LineDirection.Backward || direction === LineDirection.TwoWay) {\n addLink(graph, portal2, portal1, {\n wheelChairAccesible: wheelchair,\n cost,\n description,\n isPortal: true,\n });\n }\n\n addEdgeToGraph(graph, portalLink);\n }\n }\n\n addEdgeToGraph(graph, portal);\n }\n }\n\n function initLineString(vertex: any) {\n return {\n type: 'Feature',\n geometry: { type: 'LineString', coordinates: [vertex.data.coords] },\n properties: {\n dimension_where: vertex.data.where,\n zone: vertex.data.zone,\n cost: 0,\n },\n } as Feature<LineString | MultiPoint, any>;\n }\n\n function pathToFeatures(source: Edge, destination : Edge, vertices: Node<any>[], graph: Graph) {\n if (vertices.length <= 1) {\n return {} as CalculationResult;\n } // if no path found\n\n const startNode = source;\n const endNode = destination;\n\n const segments: RouteResult[] = [];\n let segmentStartVertexData = vertices[0].data;\n const geojsonPaths = [initLineString(vertices[0])];\n\n for (let i = 1; i < vertices.length; i += 1) {\n const curVertex = vertices[i];\n const prevVertex = vertices[i - 1];\n const line = geojsonPaths[geojsonPaths.length - 1];\n\n // if vertex is map object\n if (curVertex.data.mapObjectId !== 'vertex' || curVertex.data.zoneUnionVertex) {\n let segment;\n if (isPortalTaxonomy(prevVertex.data.what) && isPortalTaxonomy(curVertex.data.what)) {\n if (prevVertex.data.zone !== curVertex.data.zone) {\n console.warn('A portal is triggering a change in zone');\n }\n\n // check if portal path is available to visualize\n let portalPath;\n if (isMovingPortalTaxonomy(prevVertex.data.what)) {\n const getPortalPath = (portalEdgeData: PortalEdgeData, curVertex: Node<any>, prevVertex: Node<any>, invertStart = false) => {\n const prevVertexMapObjId = prevVertex.data.mapObjectId;\n const set = new Set<string>().add(prevVertexMapObjId);\n const portalDataForSet = filterPortalEdgeDataByList(portalEdgeData, set);\n if (portalDataForSet && portalDataForSet.edgeData[prevVertexMapObjId]) {\n const prevVertexPortalData = portalDataForSet.edgeData[prevVertexMapObjId];\n for (let j = 0; j < prevVertexPortalData.links.length; j += 1) {\n const link = prevVertexPortalData.links[j];\n if (link.id === curVertex.data.mapObjectId) {\n if (link.pathFeatures && link.pathFeatures.length > 0) {\n const line = link.pathFeatures[0];\n const start = invertStart === false ? prevVertex.data.coords : curVertex.data.coords;\n const end = invertStart === false ? curVertex.data.coords : prevVertex.data.coords;\n\n const distanceToStart = turf.distance(start, line.geometry.coordinates[0]);\n const distanceToEnd = turf.distance(end, line.geometry.coordinates[0]);\n const coordsToUse = distanceToStart < distanceToEnd ? line.geometry.coordinates : line.geometry.coordinates.slice().reverse();\n return turf.lineString(coordsToUse);\n }\n }\n }\n }\n\n return null;\n };\n\n portalPath = getPortalPath(portalData.edgeData, curVertex, prevVertex, false);\n if (!portalPath) portalPath = getPortalPath(portalData.edgeData, prevVertex, curVertex, true);\n }\n\n // TODO: read description here\n const link = graph.getLink(prevVertex.id, curVertex.id);\n const cost = link ? link.data.cost ? link.data.cost : undefined : undefined;\n const description = link ? link.data.description ? link.data.description : undefined : undefined;\n segment = {\n geojson: multiPoint([\n prevVertex.data.coords,\n curVertex.data.coords,\n ], {\n zone: curVertex.data.zone,\n }),\n edges: [prevVertex.data.mapObjectId, curVertex.data.mapObjectId],\n startFloor: prevVertex.data.where,\n endFloor: curVertex.data.where,\n isPortal: true,\n portalPath,\n cost,\n description,\n } as RouteResult;\n\n segments.push(segment);\n segmentStartVertexData = curVertex.data;\n } else {\n const nextVertex = (i + 1 < vertices.length) ? vertices[i + 1] : undefined;\n if (curVertex.data.zoneUnionVertex\n && (prevVertex && nextVertex && prevVertex?.data.zone === nextVertex?.data.zone)) {\n console.log('ignore zoneUnionVertex in segment');\n } else {\n segment = {\n geojson: line,\n edges: [segmentStartVertexData.mapObjectId, curVertex.data.mapObjectId],\n startFloor: segmentStartVertexData.where,\n endFloor: segmentStartVertexData.where,\n isPortal: false,\n portalPath: undefined,\n cost: line.properties.cost,\n };\n\n segments.push(segment);\n segmentStartVertexData = curVertex.data;\n }\n }\n }\n\n // same line\n if (!(isPortalTaxonomy(prevVertex.data.what) && isPortalTaxonomy(curVertex.data.what))) {\n const link = graph.getLink(prevVertex.id, curVertex.id); // returns a link from 'hello' to 'world'\n const cost = link ? link.data.cost ? link.data.cost : undefined : undefined;\n\n line.geometry.coordinates.push(curVertex.data.coords);\n line.properties.cost += cost;\n } else {\n // new line\n if (line.geometry.coordinates.length < 2) {\n geojsonPaths.pop();\n }\n geojsonPaths.push(initLineString(curVertex));\n }\n\n // new line due to change in zone\n if (curVertex.data.zoneUnionVertex) {\n const prevVertex = (i > 0) ? vertices[i - 1] : undefined;\n const nextVertex = (i + 1 < vertices.length) ? vertices[i + 1] : undefined;\n if (prevVertex && nextVertex && prevVertex?.data.zone === nextVertex?.data.zone) {\n console.log('ignore zoneUnionVertex');\n } else\n // Use zone value of next vertex (when available) as current vertex is a common vertex and can have either of the zone values\n if (nextVertex) {\n const copyOfCurrentVertex = cloneDeep(curVertex);\n copyOfCurrentVertex.data.zone = nextVertex.data.zone;\n geojsonPaths.push(initLineString(copyOfCurrentVertex));\n } else {\n geojsonPaths.push(initLineString(curVertex));\n }\n }\n }\n\n const result: CalculationResult = {\n startNode,\n endNode,\n routes: segments,\n distance: 0,\n };\n\n return result;\n }\n\n function findPath(vertex1: Node<any>, vertex2: Node<any>, graph: Graph) {\n // setup ngraph pathfinder\n const pathFinder = aStar(graph, {\n oriented: true,\n distance(fromNode, toNode, link) {\n return link.data.weight;\n },\n blocked(fromNode, toNode, link) {\n if (changeZoneCheckEnabled) {\n const isZoneCrossing = fromNode?.data.zone !== toNode?.data.zone;\n if (isZoneCrossing) {\n const parentWhereDimensionOfFromNode = getParentDimension(fromNode.data.where);\n const parentWhereDimensionOfStartNode = getParentDimension((startNode as Edge).where);\n const parentWhereDimensionOfToNode = getParentDimension(toNode.data.where);\n if (parentWhereDimensionOfFromNode !== parentWhereDimensionOfStartNode && parentWhereDimensionOfToNode !== parentWhereDimensionOfStartNode) {\n return true;\n }\n }\n }\n return false;\n },\n });\n\n // get shortest path\n const path = pathFinder.find(vertex1.id, vertex2.id).reverse();\n return path;\n }\n\n function setupGraphAndFindPath(source: Edge, destination: Edge, portalEdgeData: PortalEdgeData, networkData: Feature[]) {\n // create ngraph graph\n const graph = createGraph();\n\n // add node & node lines to graph\n const vertex1 = addEdgeToGraph(graph, source);\n const vertex2 = addEdgeToGraph(graph, destination);\n\n if (vertex1 && vertex2) {\n // Add portal links\n addPortalLinksToGraph(graph, portalEdgeData);\n\n // add networks to graph\n addNetworkToGraph(graph, networkData);\n\n const path = findPath(vertex1, vertex2, graph);\n // reconstruct path into geojson features\n const geojsonPath = pathToFeatures(source, destination, path, graph);\n return geojsonPath;\n }\n\n return {} as CalculationResult;\n }\n\n function getRouteWithAllPortals(source: Edge, destination: Edge) {\n let start = performance.now();\n\n // Load network data\n const networkFeatures = getNetworkFeatures(DEFAULT_DIMENSION);\n console.log('time load: ', (performance.now() - start) / 1000);\n\n start = performance.now();\n const concatenatedEdgeFeatures = source.lines.concat(destination.lines, portalData.lines);\n const concatenatedNetworkFeatures = networkFeatures;\n\n if (runIntersection) optimized(concatenatedEdgeFeatures, concatenatedNetworkFeatures);\n console.log('time network: ', (performance.now() - start) / 1000, networkFeatures.length);\n\n return setupGraphAndFindPath(source, destination, portalData.edgeData, concatenatedNetworkFeatures);\n }\n\n function getRouteWithSpecificPortals(source: Edge, destination: Edge, routeWithAllAvailablePortals: CalculationResult) {\n const portalsToUse = new Set<string>();\n for (let index = 0; routeWithAllAvailablePortals.routes && index < routeWithAllAvailablePortals.routes.length; index += 1) {\n const segment = routeWithAllAvailablePortals.routes[index];\n if (segment.isPortal) {\n portalsToUse.add(segment.edges[0]);\n portalsToUse.add(segment.edges[1]);\n }\n }\n\n let start = performance.now();\n // Load data\n // Load network data\n const networkFeatures = getNetworkFeatures(DEFAULT_DIMENSION);\n // Load portal data\n const portalDataForList = filterPortalEdgeDataByList(portalData.edgeData, portalsToUse);\n console.log('time load: ', (performance.now() - start) / 1000);\n\n start = performance.now();\n const concatenatedEdgeFeatures = source.lines.concat(destination.lines, portalDataForList.lines);\n const concatenatedNetworkFeatures = networkFeatures;\n\n if (runIntersection) optimized(concatenatedEdgeFeatures, concatenatedNetworkFeatures);\n console.log('time network: ', (performance.now() - start) / 1000, networkFeatures.length);\n\n return setupGraphAndFindPath(source, destination, portalDataForList.edgeData, concatenatedNetworkFeatures);\n }\n\n function getDirectRoute(source: Edge, destination: Edge) {\n let start = performance.now();\n // Load data\n // Load network data\n const networkFeaturesSourceNode = getNetworkFeatures(getParentDimension(source.where));\n const networkFeaturesDestinationNode = getNetworkFeatures(getParentDimension(destination.where));\n // Load portal data\n const portalDataSourceNode = filterPortalEdgeDataByWhere(portalData.edgeData, getParentDimension(source.where));\n const portalDataDestinationNode = filterPortalEdgeDataByWhere(portalData.edgeData, getParentDimension(destination.where));\n\n console.log('time load: ', (performance.now() - start) / 1000);\n\n start = performance.now();\n const concatenatedEdgeFeatures = source.lines.concat(destination.lines, portalDataSourceNode.lines, portalDataDestinationNode.lines);\n const concatenatedNetworkFeatures = networkFeaturesSourceNode.concat(networkFeaturesDestinationNode);\n\n if (runIntersection) optimized(concatenatedEdgeFeatures, concatenatedNetworkFeatures);\n console.log('time network: ', (performance.now() - start) / 1000, networkFeaturesSourceNode.length);\n\n const portalEdgeData = {\n ...portalDataSourceNode.edgeData,\n ...portalDataDestinationNode.edgeData,\n };\n return setupGraphAndFindPath(source, destination, portalEdgeData, concatenatedNetworkFeatures);\n }\n\n // function to get shortest route\n function getRoute(\n mapObjectId1: string | UserPosition,\n mapObjectId2: string,\n wheelChairAccessibleRouteOnlyParam: boolean\n ) {\n wheelChairAccessibleRouteOnly = wheelChairAccessibleRouteOnlyParam;\n // if same start & end\n if (mapObjectId1 === mapObjectId2) {\n return {} as CalculationResult;\n }\n\n if(typeof(mapObjectId1) !== 'string'\n || typeof(mapObjectId2) !== 'string'\n ) runIntersection = true;\n\n const node1 = getEdge(mapObjectId1);\n const node2 = getEdge(mapObjectId2);\n\n startNode = node1;\n endNode = node2;\n\n let start = performance.now();\n portalData = getPortalDataForDimension(DEFAULT_DIMENSION);\n console.log('time portal load with extrapolation: ', (performance.now() - start) / 1000);\n\n start = performance.now();\n if (startNode && endNode) {\n changeZoneCheckEnabled = true;\n const runRouteIteration = () => {\n const directRoute = getDirectRoute(startNode as Edge, endNode as Edge);\n console.log('Direct route', directRoute);\n if (isEmpty(directRoute)) {\n const routeWithAllPortals = getRouteWithAllPortals(startNode as Edge, endNode as Edge);\n const finalRoute = getRouteWithSpecificPortals(startNode as Edge, endNode as Edge, routeWithAllPortals);\n return finalRoute;\n }\n\n const finalRoute = getRouteWithSpecificPortals(startNode as Edge, endNode as Edge, directRoute);\n return finalRoute;\n };\n\n let route = runRouteIteration();\n if (isEmpty(route)) {\n changeZoneCheckEnabled = false;\n route = runRouteIteration();\n }\n\n console.log('time total: ', (performance.now() - start) / 1000);\n return route;\n }\n\n return {} as CalculationResult;\n }\n\n return { getRoute };\n}());\n\nexport default RoutingCore;\n"],"mappings":";;;;;AAAA;AACA;AACA,SAASA,KAAK,QAAQ,aAAa;AACnC,OAAOC,WAAW,MAAuB,cAAc;AACvD,SACEC,KAAK,EACLC,UAAU,QACL,eAAe;AAEtB;AACA,OAAO,KAAKC,IAAI,MAAM,YAAY;AAClC,SAASC,SAAS,EAAEC,OAAO,EAAEC,SAAS,QAAQ,QAAQ;AAAC,SAE5BC,aAAa,EAAEC,cAAc,EAAeC,UAAU;AAAA,SAG/EC,kBAAkB,EAAEC,OAAO,EAC3BC,yBAAyB;AAAA,SAElBC,sBAAsB,EAAEC,gBAAgB;AAAA,SAE/CC,iBAAiB,EAAEC,0BAA0B,EAAEC,2BAA2B,EAAEC,kBAAkB,EAAqBC,SAAS;AAG9H;AAEA,MAAMC,WAAW,GAAI,YAAY;EAC/B,IAAIC,6BAA6B,GAAG,IAAI;EACxC,IAAIC,SAA2B;EAC/B,IAAIC,OAAyB;EAC7B,IAAIC,sBAAsB,GAAG,IAAI;EACjC,IAAIC,eAAe,GAAG,KAAK;EAE3B,IAAIC,UAGH,GAAG;IAAEC,QAAQ,EAAE,CAAC,CAAC;IAAEC,KAAK,EAAE;EAAG,CAAC;EAE/B,SAASC,SAASA,CAChBC,KAAY,EACZC,M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,CAAC;IACzB,IAAIzI,SAAS,IAAIC,OAAO,EAAE;MACxBC,sBAAsB,GAAG,IAAI;MAC7B,MAAMyJ,iBAAiB,GAAGA,CAAA,KAAM;QAC9B,MAAMC,WAAW,GAAGZ,cAAc,CAAChJ,SAAS,EAAUC,OAAe,CAAC;QACtEqF,OAAO,CAAC6B,GAAG,CAAC,cAAc,EAAEyC,WAAW,CAAC;QACxC,IAAI7K,OAAO,CAAC6K,WAAW,CAAC,EAAE;UACxB,MAAMC,mBAAmB,GAAGtB,sBAAsB,CAACvI,SAAS,EAAUC,OAAe,CAAC;UACtF,MAAM6J,UAAU,GAAGlB,2BAA2B,CAAC5I,SAAS,EAAUC,OAAO,EAAU4J,mBAAmB,CAAC;UACvG,OAAOC,UAAU;QACnB;QAEA,MAAMA,UAAU,GAAGlB,2BAA2B,CAAC5I,SAAS,EAAUC,OAAO,EAAU2J,WAAW,CAAC;QAC/F,OAAOE,UAAU;MACnB,CAAC;MAED,IAAIC,KAAK,GAAGJ,iBAAiB,CAAC,CAAC;MAC/B,IAAI5K,OAAO,CAACgL,KAAK,CAAC,EAAE;QAClB7J,sBAAsB,GAAG,KAAK;QAC9B6J,KAAK,GAAGJ,iBAAiB,CAAC,CAAC;MAC7B;MAEArE,OAAO,CAAC6B,GAAG,CAAC,cAAc,EAAE,CAACqB,WAAW,CAACC,GAAG,CAAC,CAAC,GAAGrC,KAAK,IAAI,IAAI,CAAC;MAC/D,OAAO2D,KAAK;IACd;IAEA,OAAO,CAAC,CAAC;EACX;EAEA,OAAO;IAAET;EAAS,CAAC;AACrB,CAAC,CAAC,CAAE;AAEJ,eAAexJ,WAAW","ignoreList":[]}
|
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
2
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
3
|
+
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
4
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
5
|
+
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
1
6
|
import { point, lineString } from '@turf/helpers';
|
|
2
7
|
import length from '@turf/length';
|
|
3
8
|
import { booleanDisjoint, booleanPointInPolygon, getCoord, getCoords, lineIntersect, lineSlice } from '@turf/turf';
|
|
@@ -113,18 +118,15 @@ function getRouteLine(coordinates, segmentNumber, isHighlighted, patchNumber, zo
|
|
|
113
118
|
zone
|
|
114
119
|
};
|
|
115
120
|
// const curved = smooth(coordinates, {iteration: 1});
|
|
116
|
-
const line = lineString(coordinates, {
|
|
117
|
-
...properties,
|
|
121
|
+
const line = lineString(coordinates, _objectSpread(_objectSpread({}, properties), {}, {
|
|
118
122
|
featureBelongsToLineString: true
|
|
119
|
-
});
|
|
120
|
-
const startPoint = point(coordinates[0], {
|
|
121
|
-
...properties,
|
|
123
|
+
}));
|
|
124
|
+
const startPoint = point(coordinates[0], _objectSpread(_objectSpread({}, properties), {}, {
|
|
122
125
|
featureBelongsToLineString: false
|
|
123
|
-
});
|
|
124
|
-
const endPoint = point(coordinates[coordinates.length - 1], {
|
|
125
|
-
...properties,
|
|
126
|
+
}));
|
|
127
|
+
const endPoint = point(coordinates[coordinates.length - 1], _objectSpread(_objectSpread({}, properties), {}, {
|
|
126
128
|
featureBelongsToLineString: false
|
|
127
|
-
});
|
|
129
|
+
}));
|
|
128
130
|
const features = [];
|
|
129
131
|
features.push(startPoint, line, endPoint);
|
|
130
132
|
updateFeatureHighlightState(features, isHighlighted);
|
|
@@ -204,11 +206,10 @@ export async function createRoute(startMapObjectId, endMapObjectId, wheelChairAc
|
|
|
204
206
|
|
|
205
207
|
// Only add the starting static node for the very first node of route
|
|
206
208
|
if (optimizedPath.length === 0) {
|
|
207
|
-
const firstSegment = {
|
|
208
|
-
...createDefaultSegment(pathSegment),
|
|
209
|
+
const firstSegment = _objectSpread(_objectSpread({}, createDefaultSegment(pathSegment)), {}, {
|
|
209
210
|
maneuverType: ManeuverType.Static,
|
|
210
211
|
coordinates: [path[0]]
|
|
211
|
-
};
|
|
212
|
+
});
|
|
212
213
|
optimizedPath.push(firstSegment);
|
|
213
214
|
}
|
|
214
215
|
if (segmentIndex > 0 && optimizedPath.length > 0) {
|
|
@@ -216,12 +217,11 @@ export async function createRoute(startMapObjectId, endMapObjectId, wheelChairAc
|
|
|
216
217
|
const prevZone = prevPathSegment.geojson.properties.zone;
|
|
217
218
|
if (currentZone !== prevZone) {
|
|
218
219
|
const prevPath = prevPathSegment.geojson.geometry.coordinates;
|
|
219
|
-
const pathPoint = {
|
|
220
|
-
...createDefaultSegment(prevPathSegment),
|
|
220
|
+
const pathPoint = _objectSpread(_objectSpread({}, createDefaultSegment(prevPathSegment)), {}, {
|
|
221
221
|
maneuverType: ManeuverType.ChangeZone,
|
|
222
222
|
zone: currentZone,
|
|
223
223
|
coordinates: [prevPath[prevPath.length - 1]]
|
|
224
|
-
};
|
|
224
|
+
});
|
|
225
225
|
optimizedPath.push(pathPoint);
|
|
226
226
|
lastManeuverType = ManeuverType.ChangeZone;
|
|
227
227
|
}
|
|
@@ -233,12 +233,11 @@ export async function createRoute(startMapObjectId, endMapObjectId, wheelChairAc
|
|
|
233
233
|
const endPoint = path[index + 2];
|
|
234
234
|
|
|
235
235
|
// Keep updating endSegment on each iteration
|
|
236
|
-
endSegment = {
|
|
237
|
-
...createDefaultSegment(pathSegment),
|
|
236
|
+
endSegment = _objectSpread(_objectSpread({}, createDefaultSegment(pathSegment)), {}, {
|
|
238
237
|
maneuverType: ManeuverType.Static,
|
|
239
238
|
coordinates: [endPoint],
|
|
240
239
|
zone: currentZone
|
|
241
|
-
};
|
|
240
|
+
});
|
|
242
241
|
|
|
243
242
|
// const line = lineString([startPoint, midPoint]);
|
|
244
243
|
// const segmentDistance = length(line, { units: DISTANCE_UNIT });
|
|
@@ -279,11 +278,10 @@ export async function createRoute(startMapObjectId, endMapObjectId, wheelChairAc
|
|
|
279
278
|
// }
|
|
280
279
|
// }
|
|
281
280
|
|
|
282
|
-
const pathPoint = {
|
|
283
|
-
...createDefaultSegment(pathSegment),
|
|
281
|
+
const pathPoint = _objectSpread(_objectSpread({}, createDefaultSegment(pathSegment)), {}, {
|
|
284
282
|
maneuverType: currentManeuverType,
|
|
285
283
|
zone: currentZone
|
|
286
|
-
};
|
|
284
|
+
});
|
|
287
285
|
if (lastManeuverType === ManeuverType.ContinueStraight) {
|
|
288
286
|
// If last iteration of loop then use the end point as segment end else use mid point
|
|
289
287
|
// Use index + 3 because last two points are skipped by loop
|
|
@@ -304,24 +302,22 @@ export async function createRoute(startMapObjectId, endMapObjectId, wheelChairAc
|
|
|
304
302
|
if (currentManeuverType === ManeuverType.ContinueStraight) {
|
|
305
303
|
optimizedPath[optimizedPath.length - 1].coordinates.push(endPoint);
|
|
306
304
|
} else {
|
|
307
|
-
optimizedPath.push({
|
|
308
|
-
...createDefaultSegment(pathSegment),
|
|
305
|
+
optimizedPath.push(_objectSpread(_objectSpread({}, createDefaultSegment(pathSegment)), {}, {
|
|
309
306
|
maneuverType: ManeuverType.ContinueStraight,
|
|
310
307
|
coordinates: [midPoint, endPoint],
|
|
311
308
|
zone: currentZone
|
|
312
|
-
});
|
|
309
|
+
}));
|
|
313
310
|
}
|
|
314
311
|
}
|
|
315
312
|
}
|
|
316
313
|
lastManeuverType = currentManeuverType;
|
|
317
314
|
}
|
|
318
315
|
} else {
|
|
319
|
-
const pathPoint = {
|
|
320
|
-
...createDefaultSegment(pathSegment),
|
|
316
|
+
const pathPoint = _objectSpread(_objectSpread({}, createDefaultSegment(pathSegment)), {}, {
|
|
321
317
|
maneuverType: ManeuverType.ContinueStraight,
|
|
322
318
|
coordinates: path,
|
|
323
319
|
zone: currentZone
|
|
324
|
-
};
|
|
320
|
+
});
|
|
325
321
|
optimizedPath.push(pathPoint);
|
|
326
322
|
}
|
|
327
323
|
const removeExtraChangeZoneSegment = () => {
|
|
@@ -351,12 +347,11 @@ export async function createRoute(startMapObjectId, endMapObjectId, wheelChairAc
|
|
|
351
347
|
});
|
|
352
348
|
// Only add if length greater then min limit
|
|
353
349
|
if (lengthOfLineBeforeImmigration >= 10) {
|
|
354
|
-
const segmentBeforeImmigration = {
|
|
355
|
-
...createDefaultSegment(pathSegment),
|
|
350
|
+
const segmentBeforeImmigration = _objectSpread(_objectSpread({}, createDefaultSegment(pathSegment)), {}, {
|
|
356
351
|
maneuverType: ManeuverType.ContinueStraight,
|
|
357
352
|
zone: currentZone,
|
|
358
353
|
coordinates: getCoords(lineBeforeImmigration)
|
|
359
|
-
};
|
|
354
|
+
});
|
|
360
355
|
optimizedPath.push(segmentBeforeImmigration);
|
|
361
356
|
} else if (optimizedPath.length > 0) {
|
|
362
357
|
lastSegmentAdded = optimizedPath[optimizedPath.length - 1];
|
|
@@ -373,12 +368,11 @@ export async function createRoute(startMapObjectId, endMapObjectId, wheelChairAc
|
|
|
373
368
|
}
|
|
374
369
|
}
|
|
375
370
|
const immigrationLine = lineSlice(getCoord(intersects.features[0]), getCoord(intersects.features[1]), line);
|
|
376
|
-
const immigrationSegment = {
|
|
377
|
-
...createDefaultSegment(pathSegment),
|
|
371
|
+
const immigrationSegment = _objectSpread(_objectSpread({}, createDefaultSegment(pathSegment)), {}, {
|
|
378
372
|
maneuverType: ManeuverType.PassThroughImmigration,
|
|
379
373
|
zone: currentZone,
|
|
380
374
|
coordinates: getCoords(immigrationLine)
|
|
381
|
-
};
|
|
375
|
+
});
|
|
382
376
|
// The lineBeforeImmigration might not have been added due to length limit
|
|
383
377
|
// And if lineBeforeImmigration was supposed to be the the first segment then prepend this segment with coordinates of lineBeforeImmigration
|
|
384
378
|
if (optimizedPath.length === 0) {
|
|
@@ -390,12 +384,11 @@ export async function createRoute(startMapObjectId, endMapObjectId, wheelChairAc
|
|
|
390
384
|
optimizedPath.push(immigrationSegment);
|
|
391
385
|
const lineCoords = getCoords(line);
|
|
392
386
|
const lineAfterImmigration = lineSlice(getCoord(intersects.features[1]), lineCoords[lineCoords.length - 1], line);
|
|
393
|
-
const segmentAfterImmigration = {
|
|
394
|
-
...createDefaultSegment(pathSegment),
|
|
387
|
+
const segmentAfterImmigration = _objectSpread(_objectSpread({}, createDefaultSegment(pathSegment)), {}, {
|
|
395
388
|
maneuverType: ManeuverType.ContinueStraight,
|
|
396
389
|
zone: currentZone,
|
|
397
390
|
coordinates: getCoords(lineAfterImmigration)
|
|
398
|
-
};
|
|
391
|
+
});
|
|
399
392
|
optimizedPath.push(segmentAfterImmigration);
|
|
400
393
|
// line = segmentAfterImmigration;
|
|
401
394
|
} else if (intersects.features.length > 0) {
|
|
@@ -407,12 +400,11 @@ export async function createRoute(startMapObjectId, endMapObjectId, wheelChairAc
|
|
|
407
400
|
// One intersection point and start point is within polygon
|
|
408
401
|
// Means line start inside and exits the polygon
|
|
409
402
|
const immigrationLine = lineSlice(getCoords(line)[0], getCoord(intersects.features[0]), line);
|
|
410
|
-
const immigrationSegment = {
|
|
411
|
-
...createDefaultSegment(pathSegment),
|
|
403
|
+
const immigrationSegment = _objectSpread(_objectSpread({}, createDefaultSegment(pathSegment)), {}, {
|
|
412
404
|
maneuverType: ManeuverType.PassThroughImmigration,
|
|
413
405
|
zone: currentZone,
|
|
414
406
|
coordinates: getCoords(immigrationLine)
|
|
415
|
-
};
|
|
407
|
+
});
|
|
416
408
|
lastSegmentAdded = optimizedPath.length > 0 ? optimizedPath[optimizedPath.length - 1] : undefined;
|
|
417
409
|
if (lastSegmentAdded && lastSegmentAdded.maneuverType === ManeuverType.ChangeZone) {
|
|
418
410
|
// Remove change zone segment
|
|
@@ -434,12 +426,11 @@ export async function createRoute(startMapObjectId, endMapObjectId, wheelChairAc
|
|
|
434
426
|
optimizedPath.push(immigrationSegment);
|
|
435
427
|
const lineCoords = getCoords(line);
|
|
436
428
|
const lineAfterImmigration = lineSlice(getCoord(intersects.features[0]), lineCoords[lineCoords.length - 1], line);
|
|
437
|
-
const segmentAfterImmigration = {
|
|
438
|
-
...createDefaultSegment(pathSegment),
|
|
429
|
+
const segmentAfterImmigration = _objectSpread(_objectSpread({}, createDefaultSegment(pathSegment)), {}, {
|
|
439
430
|
maneuverType: ManeuverType.ContinueStraight,
|
|
440
431
|
zone: currentZone,
|
|
441
432
|
coordinates: getCoords(lineAfterImmigration)
|
|
442
|
-
};
|
|
433
|
+
});
|
|
443
434
|
optimizedPath.push(segmentAfterImmigration);
|
|
444
435
|
} else {
|
|
445
436
|
// line starts outside immigration and ends inside immigration
|
|
@@ -449,12 +440,11 @@ export async function createRoute(startMapObjectId, endMapObjectId, wheelChairAc
|
|
|
449
440
|
lastSegmentAdded.coordinates = getCoords(previousLine);
|
|
450
441
|
const lineCoords = getCoords(line);
|
|
451
442
|
const lineAfterImmigration = lineSlice(getCoord(intersects.features[0]), lineCoords[lineCoords.length - 1], line);
|
|
452
|
-
const segmentAfterImmigration = {
|
|
453
|
-
...createDefaultSegment(pathSegment),
|
|
443
|
+
const segmentAfterImmigration = _objectSpread(_objectSpread({}, createDefaultSegment(pathSegment)), {}, {
|
|
454
444
|
maneuverType: ManeuverType.PassThroughImmigration,
|
|
455
445
|
zone: currentZone,
|
|
456
446
|
coordinates: getCoords(lineAfterImmigration)
|
|
457
|
-
};
|
|
447
|
+
});
|
|
458
448
|
optimizedPath.push(segmentAfterImmigration);
|
|
459
449
|
// line = segmentAfterImmigration;
|
|
460
450
|
}
|
|
@@ -464,18 +454,16 @@ export async function createRoute(startMapObjectId, endMapObjectId, wheelChairAc
|
|
|
464
454
|
}
|
|
465
455
|
} else {
|
|
466
456
|
// Keep updating endSegment on each iteration
|
|
467
|
-
endSegment = {
|
|
468
|
-
...createDefaultSegment(pathSegment),
|
|
457
|
+
endSegment = _objectSpread(_objectSpread({}, createDefaultSegment(pathSegment)), {}, {
|
|
469
458
|
maneuverType: ManeuverType.Static,
|
|
470
459
|
coordinates: [pathSegment.geojson.geometry.coordinates[1]],
|
|
471
460
|
zone: currentZone,
|
|
472
461
|
isPortal: false
|
|
473
|
-
};
|
|
474
|
-
const enterPortalSegment = {
|
|
475
|
-
...createDefaultSegment(pathSegment),
|
|
462
|
+
});
|
|
463
|
+
const enterPortalSegment = _objectSpread(_objectSpread({}, createDefaultSegment(pathSegment)), {}, {
|
|
476
464
|
maneuverType: ManeuverType.EnterPortal,
|
|
477
465
|
coordinates: [pathSegment.geojson.geometry.coordinates[0]]
|
|
478
|
-
};
|
|
466
|
+
});
|
|
479
467
|
// // Only add this EnterPortal segment if previously same what dimension portal is not being continued
|
|
480
468
|
// // This is done to ensure Take Lift at A, Exit Lift at B, Take lift at B, Exit Lift at C is generated only as Take lift at A, Exit lift at C
|
|
481
469
|
// let lastSegmentAdded = (optimizedPath.length > 0) ? optimizedPath[optimizedPath.length - 1] : undefined;
|
|
@@ -487,11 +475,10 @@ export async function createRoute(startMapObjectId, endMapObjectId, wheelChairAc
|
|
|
487
475
|
// }
|
|
488
476
|
|
|
489
477
|
optimizedPath.push(enterPortalSegment);
|
|
490
|
-
const exitPortalSegment = {
|
|
491
|
-
...createDefaultSegment(pathSegment),
|
|
478
|
+
const exitPortalSegment = _objectSpread(_objectSpread({}, createDefaultSegment(pathSegment)), {}, {
|
|
492
479
|
maneuverType: ManeuverType.ExitPortal,
|
|
493
480
|
coordinates: [pathSegment.geojson.geometry.coordinates[1]]
|
|
494
|
-
};
|
|
481
|
+
});
|
|
495
482
|
// // This logic is tied to the above similar logic for EnterPortal
|
|
496
483
|
// // Only add this ExitPortal segment if previously same what dimension portal is not being continued
|
|
497
484
|
// // This is done to ensure Take Lift at A, Exit Lift at B, Take lift at B, Exit Lift at C is generated only as Take lift at A, Exit lift at C
|
|
@@ -513,12 +500,11 @@ export async function createRoute(startMapObjectId, endMapObjectId, wheelChairAc
|
|
|
513
500
|
if (lastSegmentAdded && lastSegmentAdded.maneuverType === ManeuverType.ExitPortal) {
|
|
514
501
|
optimizedPath.pop();
|
|
515
502
|
if (pathSegment.portalPath) {
|
|
516
|
-
const travelPortalSegment = {
|
|
517
|
-
...createDefaultSegment(pathSegment),
|
|
503
|
+
const travelPortalSegment = _objectSpread(_objectSpread({}, createDefaultSegment(pathSegment)), {}, {
|
|
518
504
|
maneuverType: ManeuverType.TravelPortal,
|
|
519
505
|
coordinates: pathSegment.portalPath.geometry.coordinates,
|
|
520
506
|
zone: currentZone
|
|
521
|
-
};
|
|
507
|
+
});
|
|
522
508
|
optimizedPath.push(travelPortalSegment);
|
|
523
509
|
}
|
|
524
510
|
optimizedPath.push(exitPortalSegment);
|
|
@@ -682,8 +668,9 @@ export function getFeaturesForPatch(route, patchNumber, overviewSegmentInfo) {
|
|
|
682
668
|
const nonHighlightedOverviewFeatures = [];
|
|
683
669
|
const highlightedOverviewFeatures = [];
|
|
684
670
|
for (let j = 0; j < routeSegment.features.length; j++) {
|
|
671
|
+
var _feature$properties;
|
|
685
672
|
const feature = routeSegment.features[j];
|
|
686
|
-
if (feature.properties
|
|
673
|
+
if (((_feature$properties = feature.properties) === null || _feature$properties === void 0 ? void 0 : _feature$properties.patchNumber) !== undefined && feature.properties.patchNumber === overviewSegmentInfo.patchNumberForOverviewFeatures) {
|
|
687
674
|
if (feature.properties.isNonHighlightedOverview !== undefined) {
|
|
688
675
|
if (feature.properties.isNonHighlightedOverview === '1') {
|
|
689
676
|
nonHighlightedOverviewFeatures.push(feature);
|
|
@@ -769,7 +756,7 @@ function getTerminalAndLevelName(whereDimension) {
|
|
|
769
756
|
terminalName = 'Level';
|
|
770
757
|
break;
|
|
771
758
|
}
|
|
772
|
-
const terminal = terminalName === 'Terminal' ?
|
|
759
|
+
const terminal = terminalName === 'Terminal' ? "".concat(terminalName, " ").concat(match[1][1]) : "".concat(terminalName);
|
|
773
760
|
const levelIdentifier = match[2][0];
|
|
774
761
|
let levelName;
|
|
775
762
|
switch (levelIdentifier) {
|
|
@@ -783,7 +770,7 @@ function getTerminalAndLevelName(whereDimension) {
|
|
|
783
770
|
levelName = 'Level';
|
|
784
771
|
break;
|
|
785
772
|
}
|
|
786
|
-
const level =
|
|
773
|
+
const level = "".concat(levelName, " ").concat(match[2].substring(1));
|
|
787
774
|
return {
|
|
788
775
|
Terminal: terminal,
|
|
789
776
|
Level: level
|
|
@@ -821,7 +808,7 @@ function convertSecondsToMinutes(timeInSeconds) {
|
|
|
821
808
|
}
|
|
822
809
|
export function formatTime(value) {
|
|
823
810
|
if (value < 60) return '<1 minute';
|
|
824
|
-
return
|
|
811
|
+
return "~".concat(convertSecondsToMinutes(value), " ").concat(convertSecondsToMinutes(value) > 1 ? 'minutes' : 'minute');
|
|
825
812
|
}
|
|
826
813
|
export function generateInstructions(route) {
|
|
827
814
|
const isFirstSegment = index => {
|
|
@@ -851,7 +838,7 @@ export function generateInstructions(route) {
|
|
|
851
838
|
}
|
|
852
839
|
rotueSegment.instructions.push(instruction);
|
|
853
840
|
} else if (rotueSegment.maneuverType === ManeuverType.ContinueStraight || rotueSegment.maneuverType === ManeuverType.PassThroughImmigration) {
|
|
854
|
-
const postfix = rotueSegment.maneuverType === ManeuverType.ContinueStraight ?
|
|
841
|
+
const postfix = rotueSegment.maneuverType === ManeuverType.ContinueStraight ? "Walk for ".concat(Math.ceil(rotueSegment.distance), " ").concat(route.distanceUnit) : getImmigrationInstruction(rotueSegment);
|
|
855
842
|
|
|
856
843
|
// 0th index if overview segment was not included, else 1st index
|
|
857
844
|
// if (index === 0
|
|
@@ -907,15 +894,15 @@ export function generateInstructions(route) {
|
|
|
907
894
|
// }
|
|
908
895
|
} else if (rotueSegment.maneuverType === ManeuverType.Static) {
|
|
909
896
|
if (isFirstSegment(index)) {
|
|
910
|
-
rotueSegment.instructions.push(
|
|
897
|
+
rotueSegment.instructions.push("Start at ".concat(rotueSegment.startEdge.name));
|
|
911
898
|
}
|
|
912
899
|
if (index === route.segments.length - 1) {
|
|
913
|
-
rotueSegment.instructions.push(
|
|
900
|
+
rotueSegment.instructions.push("Arrive at ".concat(rotueSegment.endEdge.name));
|
|
914
901
|
}
|
|
915
902
|
} else if (rotueSegment.maneuverType === ManeuverType.EnterPortal) {
|
|
916
|
-
let instruction =
|
|
903
|
+
let instruction = "Enter ".concat(rotueSegment.startEdge.name, " at ").concat(rotueSegment.startEdge.whereDimension.split('.').slice(-2).join(' ').toUpperCase());
|
|
917
904
|
if (isNonMovingPortalTaxonomy(rotueSegment.startEdge.whatDimension)) {
|
|
918
|
-
instruction =
|
|
905
|
+
instruction = "Continue to ".concat(getWhereDimensionNameForPortal(rotueSegment.startEdge.whatDimension, rotueSegment.endEdge.whereDimension));
|
|
919
906
|
rotueSegment.instructions.push(instruction);
|
|
920
907
|
} else if (isMovingPortalTaxonomy(rotueSegment.startEdge.whatDimension)) {
|
|
921
908
|
const nextRouteSegment = index + 1 <= route.segments.length - 1 ? route.segments[index + 1] : undefined;
|
|
@@ -924,12 +911,12 @@ export function generateInstructions(route) {
|
|
|
924
911
|
rotueSegment.instructions.push(instruction);
|
|
925
912
|
index += 1;
|
|
926
913
|
const name = getPortalName(nextRouteSegment.startEdge.whatDimension);
|
|
927
|
-
instruction =
|
|
914
|
+
instruction = "Take ".concat(name, " to ").concat(getWhereDimensionNameForPortal(rotueSegment.startEdge.whatDimension, rotueSegment.endEdge.whereDimension));
|
|
928
915
|
nextRouteSegment.instructions.push(instruction);
|
|
929
916
|
if (rotueSegment.description) nextRouteSegment.instructions.push(rotueSegment.description);
|
|
930
917
|
} else {
|
|
931
918
|
const name = getPortalName(rotueSegment.startEdge.whatDimension);
|
|
932
|
-
instruction =
|
|
919
|
+
instruction = "Take ".concat(name, " to ").concat(getWhereDimensionNameForPortal(rotueSegment.startEdge.whatDimension, rotueSegment.endEdge.whereDimension));
|
|
933
920
|
rotueSegment.instructions.push(instruction);
|
|
934
921
|
}
|
|
935
922
|
}
|