@twinmatrix/spatialverse-sdk-web 0.0.2 → 0.0.3
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/index.js +9 -9
- package/lib/cjs/index.js.map +1 -1
- package/lib/cjs/meta-atlas-sdk/3DMap/CustomThreeJsWrapper/CustomThreeJsWrapper.js +213 -294
- package/lib/cjs/meta-atlas-sdk/3DMap/CustomThreeJsWrapper/CustomThreeJsWrapper.js.map +1 -1
- package/lib/cjs/meta-atlas-sdk/3DMap/CustomThreeJsWrapper/utility/utils.js +43 -45
- package/lib/cjs/meta-atlas-sdk/3DMap/CustomThreeJsWrapper/utility/utils.js.map +1 -1
- package/lib/cjs/meta-atlas-sdk/3DMap/MainMap.js +241 -271
- package/lib/cjs/meta-atlas-sdk/3DMap/MainMap.js.map +1 -1
- package/lib/cjs/meta-atlas-sdk/MetaAtlasCore/fetch-published-json.js +167 -215
- package/lib/cjs/meta-atlas-sdk/MetaAtlasCore/fetch-published-json.js.map +1 -1
- package/lib/cjs/meta-atlas-sdk/MetaAtlasCore/fetchMapObjectsData.js +28 -30
- package/lib/cjs/meta-atlas-sdk/MetaAtlasCore/fetchMapObjectsData.js.map +1 -1
- package/lib/cjs/meta-atlas-sdk/MetaAtlasCore/meta-atlas-sdk-core.js +876 -1188
- 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 +173 -163
- package/lib/cjs/meta-atlas-sdk/MetaAtlasCore/routing-core/index.js.map +1 -1
- package/lib/cjs/meta-atlas-sdk/MetaAtlasCore/routing-core/interfaces.js +6 -6
- package/lib/cjs/meta-atlas-sdk/MetaAtlasCore/routing-core/interfaces.js.map +1 -1
- package/lib/cjs/meta-atlas-sdk/MetaAtlasCore/routing-core/mapObjectsHelper.js +6 -6
- package/lib/cjs/meta-atlas-sdk/MetaAtlasCore/routing-core/mapObjectsHelper.js.map +1 -1
- package/lib/cjs/meta-atlas-sdk/MetaAtlasCore/routing-core/routeLayers.js +3 -3
- package/lib/cjs/meta-atlas-sdk/MetaAtlasCore/routing-core/routeLayers.js.map +1 -1
- package/lib/cjs/meta-atlas-sdk/MetaAtlasCore/routing-core/routing-helpers.js +546 -620
- 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 +155 -160
- package/lib/cjs/meta-atlas-sdk/MetaAtlasCore/routing-core/utils.js.map +1 -1
- package/lib/cjs/meta-atlas-sdk/customStyles.js +2 -2
- package/lib/cjs/meta-atlas-sdk/customStyles.js.map +1 -1
- package/lib/cjs/meta-atlas-sdk/customerLayer.js +15 -29
- package/lib/cjs/meta-atlas-sdk/customerLayer.js.map +1 -1
- package/lib/cjs/meta-atlas-sdk/customerLayerVariant.js +5 -5
- package/lib/cjs/meta-atlas-sdk/customerLayerVariant.js.map +1 -1
- package/lib/cjs/meta-atlas-sdk/meta-atlas-sdk.js +832 -1060
- package/lib/cjs/meta-atlas-sdk/meta-atlas-sdk.js.map +1 -1
- package/lib/cjs/meta-atlas-sdk/utils/helpers.js +33 -50
- package/lib/cjs/meta-atlas-sdk/utils/helpers.js.map +1 -1
- package/lib/cjs/meta-atlas-sdk/utils/local-storage.js +18 -36
- package/lib/cjs/meta-atlas-sdk/utils/local-storage.js.map +1 -1
- package/lib/cjs/meta-atlas-sdk/utils/mapobjects-store.js +6 -6
- package/lib/cjs/meta-atlas-sdk/utils/mapobjects-store.js.map +1 -1
- package/lib/cjs/meta-atlas-sdk/utils/routing-store.js +6 -6
- package/lib/cjs/meta-atlas-sdk/utils/routing-store.js.map +1 -1
- package/lib/cjs/meta-atlas-sdk/utils/routing-visualizer/index.js +428 -556
- package/lib/cjs/meta-atlas-sdk/utils/routing-visualizer/index.js.map +1 -1
- package/lib/cjs/react/MetaAtlasMap.js +127 -0
- package/lib/cjs/react/MetaAtlasMap.js.map +1 -0
- package/lib/cjs/react/hooks/useDrawing/index.js +17 -18
- package/lib/cjs/react/hooks/useDrawing/index.js.map +1 -1
- package/lib/cjs/react/hooks/useFocus/index.js +48 -55
- package/lib/cjs/react/hooks/useFocus/index.js.map +1 -1
- package/lib/cjs/react/hooks/useMapEvents/index.js +40 -50
- package/lib/cjs/react/hooks/useMapEvents/index.js.map +1 -1
- package/lib/cjs/react/hooks/useMapOverlays/index.js +20 -21
- package/lib/cjs/react/hooks/useMapOverlays/index.js.map +1 -1
- package/lib/cjs/react/hooks/useMetaAtlas/index.js +77 -95
- package/lib/cjs/react/hooks/useMetaAtlas/index.js.map +1 -1
- package/lib/cjs/react/hooks/useMetaAtlas.js +78 -96
- package/lib/cjs/react/hooks/useMetaAtlas.js.map +1 -1
- package/lib/cjs/react/hooks/useRouting/index.js +21 -20
- package/lib/cjs/react/hooks/useRouting/index.js.map +1 -1
- package/lib/cjs/react/hooks/useSearch/index.js +35 -34
- package/lib/cjs/react/hooks/useSearch/index.js.map +1 -1
- package/lib/cjs/react/hooks/useStampRally/index.js +30 -29
- package/lib/cjs/react/hooks/useStampRally/index.js.map +1 -1
- package/lib/cjs/react/hooks/useStampRally/utils.js +2 -2
- package/lib/cjs/react/hooks/useStampRally/utils.js.map +1 -1
- package/lib/cjs/react/index.js +31 -31
- package/lib/cjs/react/index.js.map +1 -1
- package/lib/cjs/react/stores/useMapDataStore.js +53 -64
- package/lib/cjs/react/stores/useMapDataStore.js.map +1 -1
- package/lib/cjs/react/stores/useMetaAtlasStore.js +27 -40
- package/lib/cjs/react/stores/useMetaAtlasStore.js.map +1 -1
- package/lib/esm/index.js +3 -7
- package/lib/esm/index.js.map +1 -1
- package/lib/esm/meta-atlas-sdk/3DMap/CustomThreeJsWrapper/CustomThreeJsWrapper.js +2 -1
- package/lib/esm/meta-atlas-sdk/3DMap/CustomThreeJsWrapper/CustomThreeJsWrapper.js.map +1 -1
- package/lib/esm/meta-atlas-sdk/3DMap/CustomThreeJsWrapper/utility/utils.js +10 -9
- package/lib/esm/meta-atlas-sdk/3DMap/CustomThreeJsWrapper/utility/utils.js.map +1 -1
- package/lib/esm/meta-atlas-sdk/3DMap/MainMap.js +2 -2
- 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/fetchMapObjectsData.js +4 -3
- package/lib/esm/meta-atlas-sdk/MetaAtlasCore/fetchMapObjectsData.js.map +1 -1
- package/lib/esm/meta-atlas-sdk/MetaAtlasCore/meta-atlas-sdk-core.js +22 -14
- 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 +8 -8
- package/lib/esm/meta-atlas-sdk/MetaAtlasCore/routing-core/index.js.map +1 -1
- package/lib/esm/meta-atlas-sdk/MetaAtlasCore/routing-core/mapObjectsHelper.js +3 -3
- package/lib/esm/meta-atlas-sdk/MetaAtlasCore/routing-core/mapObjectsHelper.js.map +1 -1
- package/lib/esm/meta-atlas-sdk/MetaAtlasCore/routing-core/routing-helpers.js +18 -11
- 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 +4 -3
- package/lib/esm/meta-atlas-sdk/MetaAtlasCore/routing-core/utils.js.map +1 -1
- package/lib/esm/meta-atlas-sdk/customerLayer.js +4 -1
- package/lib/esm/meta-atlas-sdk/customerLayer.js.map +1 -1
- package/lib/esm/meta-atlas-sdk/meta-atlas-sdk.js +80 -61
- package/lib/esm/meta-atlas-sdk/meta-atlas-sdk.js.map +1 -1
- package/lib/esm/meta-atlas-sdk/utils/helpers.js +3 -1
- package/lib/esm/meta-atlas-sdk/utils/helpers.js.map +1 -1
- package/lib/esm/meta-atlas-sdk/utils/routing-visualizer/index.js +19 -15
- package/lib/esm/meta-atlas-sdk/utils/routing-visualizer/index.js.map +1 -1
- package/lib/esm/react/MetaAtlasMap.js +120 -0
- package/lib/esm/react/MetaAtlasMap.js.map +1 -0
- package/lib/esm/react/hooks/useDrawing/index.js +2 -2
- package/lib/esm/react/hooks/useDrawing/index.js.map +1 -1
- package/lib/esm/react/hooks/useFocus/index.js +4 -3
- package/lib/esm/react/hooks/useFocus/index.js.map +1 -1
- package/lib/esm/react/hooks/useMapEvents/index.js +3 -3
- package/lib/esm/react/hooks/useMapEvents/index.js.map +1 -1
- package/lib/esm/react/hooks/useMapOverlays/index.js +2 -2
- package/lib/esm/react/hooks/useMapOverlays/index.js.map +1 -1
- package/lib/esm/react/hooks/useMetaAtlas/index.js +162 -60
- package/lib/esm/react/hooks/useMetaAtlas/index.js.map +1 -1
- package/lib/esm/react/hooks/useMetaAtlas.js +162 -60
- package/lib/esm/react/hooks/useMetaAtlas.js.map +1 -1
- package/lib/esm/react/hooks/useRouting/index.js +2 -2
- package/lib/esm/react/hooks/useRouting/index.js.map +1 -1
- package/lib/esm/react/hooks/useSearch/index.js +2 -2
- package/lib/esm/react/hooks/useSearch/index.js.map +1 -1
- package/lib/esm/react/hooks/useStampRally/index.js +8 -7
- package/lib/esm/react/hooks/useStampRally/index.js.map +1 -1
- package/lib/esm/react/index.js +11 -15
- package/lib/esm/react/index.js.map +1 -1
- package/package.json +9 -6
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["_lodash","require","_maplibreGl","_interopRequireDefault","_helpers","_length","_nearestPointOnLine","_turf","_interopRequireWildcard","turf","_transformTranslate","_interfaces","_routingHelpers","_routeLayers","_routingStore","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","_typeof","has","get","set","_t","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","Symbol","iterator","constructor","prototype","_regeneratorValues","next","isNaN","length","value","done","TypeError","_regenerator","toStringTag","c","Generator","u","create","_regeneratorDefine2","p","y","G","v","a","d","bind","l","GeneratorFunction","GeneratorFunctionPrototype","getPrototypeOf","setPrototypeOf","displayName","w","m","_regeneratorDefine","_invoke","enumerable","configurable","writable","asyncGeneratorStep","Promise","resolve","then","_asyncToGenerator","arguments","apply","_next","_throw","_createForOfIteratorHelper","Array","isArray","_unsupportedIterableToArray","_n","F","s","_toConsumableArray","_arrayWithoutHoles","_iterableToArray","_nonIterableSpread","_arrayLikeToArray","toString","slice","name","from","test","_classCallCheck","_defineProperties","_toPropertyKey","key","_createClass","_defineProperty","_toPrimitive","toPrimitive","String","Number","RoutingVisualizer","exports","sdk","_this","type","features","to","routeFeature","cloneDeep","animateRouteSegmentFeatureCollection","currentTime","Date","now","elapsed","animationStartTime","writeToSource","feature","coords","geometry","coordinates","routeSource","map","getSource","animateRouteSourceName","setData","animationDuration","progress","fullRoute","end","currentEnd","customProgress","prevsum","actsum","distance","point","or","actRoute","concat","animationFrameID","requestAnimationFrame","animateHighlightedRouteSegment","resetRouteSegmentAnimation","main","getCurrentFocus","filterWhereDimension","dimension","focusTo","setupRouting","addSource","routeSourceName","data","patchFeatureCollection","_iterator","routeLayers","_step","layer","source","addLayer","err","_iterator2","routeAnimateLayers","_step2","_computeRoute","_callee","startMapObjectId","endMapObjectId","wheelChairAccessibleRouting","shouldAddOverviewSegment","indexOffset","generatedRoute","_args","_context","undefined","currentPatchNumber","createRoute","console","log","generateInstructions","segments","computeRoute","_x","_x2","handleAllRouteUpdate","allSegments","userPosition","segmentIndex","featureLineStringToUpdate","filter","lineStringToUpdate","lineString","subLine","nearestPoint","nearestPointOnLine","sourceCoords","unshift","coordsToUpdate","index","properties","coordsToKeep","featureIndex","_computeRoutes","_callee2","mapObjectIds","_this2","wheelChairAccessibleRouteOnly","mergedRoute","dummySegment","_loop","overviewSegment","_args3","_context3","warn","walkingDistance","transportDistance","walkingTime","transportTime","distanceUnit","DISTANCE_UNIT","speed","WALK_SPEED","push","id","routeData","_point","feats","segmentOverview","j","segment","_context2","useRouteDataStore","getState","project","queryRenderedFeatures","RouteDimension","Edge","mapObjectId","edgeData","lines","maneuverType","ManeuverType","SectionOverview","instructions","startEdge","endEdge","generateOverviewSegment","computeRoutes","_x3","updateRouteSource","updatedFeatureCollection","updateAnimateRouteSource","setActiveRoute","route","getActiveRoute","cancelAnimationFrame","updateFeaturesToAnimate","segmentNumber","whereDimensionForFeatures","routeSegment","lineFeaturesOfSegment","getLineStringFeaturesOfRouteSegment","ls","nearest","toDist","location","highlightRouteSegment","segmentNumberToHighlight","updateFilters","highlightedSegmentNumber","segmentWhereDimension","ExitPortal","Static","whereDimension","routeFeaturesToUse","segmentPatchNumber","patchNumber","featureCollectionToDraw","getFeaturesForPatch","includeOverviewFeatures","isOverviewSegment","patchNumberForOverviewFeatures","updatedFeatures","getStartCoords","canvas","getCanvas","clientWidth","h","clientHeight","fitBoundsConfig","padding","top","bottom","left","right","duration","bearing","getBearing","pitch","getPitch","currentPatchFeatures","getPatch","startCoords","sw","maplibregl","LngLat","ne","llb","LngLatBounds","element","extend","_iterator3","_step3","coord","fitBounds","transformedFeatures","turfPoint","forwardTransformed","transformTranslate","reverseTransformed","bbox","clearRoute"],"sources":["../../../../../src/meta-atlas-sdk/utils/routing-visualizer/index.ts"],"sourcesContent":["import { cloneDeep } from 'lodash';\nimport maplibregl, { Feature, Map } from 'maplibre-gl';\nimport {\n Units, point as turfPoint,\n point,\n} from '@turf/helpers';\nimport length from '@turf/length';\nimport { nearestPointOnLine } from \"@turf/nearest-point-on-line\";\n// import { distance } from \"@turf/distance\";\nimport * as turf from '@turf/turf';\nimport { transformTranslate } from \"@turf/transform-translate\";\nimport { FeatureCollection } from 'geojson';\nimport { DISTANCE_UNIT, WALK_SPEED, RouteDimension, UserPosition } from '../../MetaAtlasCore/routing-core/interfaces';\nimport {\n ManeuverType, Route, RouteSegment, createRoute, generateInstructions, generateOverviewSegment, getFeaturesForPatch, getLineStringFeaturesOfRouteSegment, getPatch, highlightRouteSegment,\n isOverviewSegment,\n} from '../../MetaAtlasCore/routing-core/routing-helpers';\nimport { routeAnimateLayers, routeLayers } from '../../MetaAtlasCore/routing-core/routeLayers';\nimport { lineString } from '@turf/turf';\nimport useRouteDataStore from '../routing-store';\n\nexport class RoutingVisualizer {\n map: Map;\n\n // Routing\n routeSourceName = 'routeGeojson';\n\n patchFeatureCollection = {\n type: 'FeatureCollection',\n features: [],\n } as FeatureCollection;\n\n route: Route | null;\n\n highlightedSegmentNumber = -1;\n\n currentPatchNumber = -1;\n\n // Routing animation\n animateRouteSourceName = 'routeAnimateGeojson';\n\n animationFrameID = -1;\n\n animateRouteSegmentFeatureCollection = {\n type: 'FeatureCollection',\n features: [],\n } as FeatureCollection;\n\n animationStartTime = 0;\n\n end = {\n from: 0,\n to: 0,\n };\n\n main: any;\n\n constructor(sdk: any) {\n this.main = sdk\n }\n\n // MetaAtlasCore To Editor\n // eslint-disable-next-line class-methods-use-this\n getCurrentFocus() {\n return this.main.getCurrentFocus();\n }\n\n // eslint-disable-next-line class-methods-use-this\n filterWhereDimension(dimension: string) {\n this.main.focusTo(dimension, false);\n }\n\n // Routing\n setupRouting(map: Map) {\n this.map = map;\n this.map.addSource(this.routeSourceName, {\n type: 'geojson',\n data: this.patchFeatureCollection,\n });\n\n for (const layer of routeLayers) {\n (layer as any).source = this.routeSourceName;\n this.map.addLayer(layer as any);\n }\n\n // Animation data\n this.map.addSource(this.animateRouteSourceName, {\n type: 'geojson',\n data: this.animateRouteSegmentFeatureCollection,\n });\n\n for (const layer of routeAnimateLayers) {\n (layer as any).source = this.animateRouteSourceName;\n this.map.addLayer(layer as any);\n }\n }\n\n // eslint-disable-next-line class-methods-use-this\n async computeRoute(\n startMapObjectId: string,\n endMapObjectId: string,\n wheelChairAccessibleRouting = false,\n shouldAddOverviewSegment = true,\n indexOffset = 0, // offset for patch and segment numbers calculation\n ): Promise<Route> {\n this.currentPatchNumber = -1;\n\n const generatedRoute = await createRoute(\n startMapObjectId,\n endMapObjectId,\n wheelChairAccessibleRouting,\n shouldAddOverviewSegment,\n indexOffset,\n );\n\n console.log('internal generated: ', generatedRoute);\n\n // Generate textual instructions\n generateInstructions(generatedRoute);\n console.log(generatedRoute.segments);\n\n return generatedRoute;\n }\n\n handleAllRouteUpdate(allSegments: any, userPosition: UserPosition, segmentIndex) {\n // Get the LineString Feature of the route\n const featureLineStringToUpdate = allSegments[segmentIndex].features.filter(\n f => f.geometry.type === 'LineString'\n )[0];\n\n // Create a LineString with the coordinates of the route that would be updated accordingly\n const lineStringToUpdate = lineString(featureLineStringToUpdate.geometry.coordinates.slice(1));\n\n // Create a subset of LineString that contains the first two coords of the route which actually represent the route edge\n const subLine = lineString([\n featureLineStringToUpdate.geometry.coordinates[0],\n featureLineStringToUpdate.geometry.coordinates[1]\n ]);\n\n // Find the nearest point to the user position on the sub line and update the LineString.\n const nearestPoint = nearestPointOnLine(subLine, userPosition.sourceCoords);\n lineStringToUpdate.geometry.coordinates.unshift(userPosition.sourceCoords, nearestPoint.geometry.coordinates);\n const coordsToUpdate = lineStringToUpdate.geometry.coordinates;\n const index = nearestPoint.properties.index;\n const coordsToKeep = coordsToUpdate.slice(index);\n lineStringToUpdate.geometry.coordinates = coordsToKeep;\n lineStringToUpdate.geometry.coordinates.unshift(userPosition.sourceCoords);\n lineStringToUpdate.properties = featureLineStringToUpdate.properties;\n let featureIndex = -1;\n allSegments[segmentIndex].features.map((f, i) => {\n if (f.geometry.type === 'LineString') {\n featureIndex = i;\n }\n });\n\n // Update the new LineString in the route\n allSegments[segmentIndex].features[featureIndex] = lineStringToUpdate;\n allSegments[segmentIndex].coordinates = lineStringToUpdate.geometry.coordinates;\n }\n\n async computeRoutes(mapObjectIds: string[], wheelChairAccessibleRouteOnly = false): Promise<Route | undefined> {\n if (mapObjectIds.length < 2) {\n console.warn('Invalid array passed to computeRoutes');\n return undefined;\n }\n\n console.log('calling computeRoutes with mapObjectIds: ', mapObjectIds);\n\n const mergedRoute = {\n segments: [] as RouteSegment[],\n walkingDistance: 0,\n transportDistance: 0,\n walkingTime: 0,\n transportTime: 0,\n\n distanceUnit: DISTANCE_UNIT as Units,\n speed: WALK_SPEED,\n } as Route;\n\n // Dummy segment for overview segment\n const dummySegment = {};\n mergedRoute.segments.push(dummySegment as any);\n let indexOffset = 1; // Index set to 1, since overview segment will be added to 0th index\n\n for (let index = 0; index < mapObjectIds.length - 1; index += 1) {\n let startMapObjectId = mapObjectIds[index];\n const endMapObjectId = mapObjectIds[index + 1];\n\n const shouldAddOverviewSegment = true; // include overview segment in first route\n\n const id = mapObjectIds[0] as unknown as UserPosition;\n if (typeof mapObjectIds[0] !== 'string') {\n // Run queryRenderedFeatures.\n const routeData = useRouteDataStore.getState().data;\n const point = this.map.project([id.sourceCoords[0], id.sourceCoords[1]]);\n const feats = this.map.queryRenderedFeatures(point);\n feats.map(f => {\n if (routeData[RouteDimension.Edge].hasOwnProperty(f.properties.mapObjectId)) {\n const edgeData = routeData[RouteDimension.Edge][f.properties.mapObjectId];\n if (edgeData.lines.length > 0) {\n startMapObjectId = f.properties.mapObjectId;\n }\n }\n });\n }\n\n // eslint-disable-next-line no-await-in-loop\n const generatedRoute = await this.computeRoute(startMapObjectId, endMapObjectId, wheelChairAccessibleRouteOnly, shouldAddOverviewSegment, indexOffset);\n const allSegments = generatedRoute.segments;\n // if (typeof mapObjectIds[index] !== 'string' && typeof startMapObjectId === 'string') {\n // //Handle SectionOverview:\n // this.handleAllRouteUpdate(allSegments, id as UserPosition, 0);\n\n // // Handle the second segment.\n // const secondSegmentFeatures = generatedRoute.segments[1].features;\n // if (secondSegmentFeatures.length < 3 && secondSegmentFeatures[0].geometry.type === 'Point') {\n // secondSegmentFeatures[0].geometry.coordinates = id.sourceCoords;\n // allSegments[1].coordinates = id.sourceCoords as any;\n // } else {\n // this.handleAllRouteUpdate(allSegments, id as UserPosition, 1);\n // }\n\n // // Handle third segment\n // const thirdSegmentFeatures = generatedRoute.segments[2].features;\n // if (thirdSegmentFeatures.length < 3 && thirdSegmentFeatures.geometry.type === 'Point') {\n // allSegments[1].features[0].geometry.coordinates = id.sourceCoords;\n // allSegments[1].coordinates = id.sourceCoords as any;\n // } else {\n // this.handleAllRouteUpdate(allSegments, id as UserPosition, 2);\n // }\n // }\n \n if (generatedRoute.segments.length > 0) {\n const segmentOverview = generatedRoute.segments[0];\n segmentOverview.maneuverType = ManeuverType.SectionOverview;\n segmentOverview.instructions = [`${segmentOverview.startEdge.name} to ${segmentOverview.endEdge.name}`];\n }\n for (let j = 0; j < generatedRoute.segments.length; j += 1) {\n const segment = generatedRoute.segments[j];\n mergedRoute.segments.push(segment);\n }\n mergedRoute.walkingDistance += generatedRoute.walkingDistance;\n mergedRoute.transportDistance += generatedRoute.transportDistance;\n mergedRoute.walkingTime += generatedRoute.walkingTime;\n mergedRoute.transportTime += generatedRoute.transportTime;\n\n // Increment by segment count\n indexOffset += generatedRoute.segments.length;\n }\n\n if (mergedRoute.segments.length > 1) { // Use 1 here because 1 dummy segment will always be included\n const overviewSegment = generateOverviewSegment(mergedRoute);\n mergedRoute.segments[0] = overviewSegment;\n } else {\n mergedRoute.segments.length = 0; // Remove dummy segment\n }\n\n console.log('merged route: ', mergedRoute);\n\n return mergedRoute;\n }\n\n updateRouteSource(updatedFeatureCollection: FeatureCollection) {\n if (!this.map) return false;\n this.patchFeatureCollection = updatedFeatureCollection;\n const routeSource = (this.map.getSource(this.routeSourceName) as maplibregl.GeoJSONSource);\n if (routeSource) routeSource.setData(updatedFeatureCollection);\n\n return true;\n }\n\n updateAnimateRouteSource(updatedFeatureCollection: FeatureCollection) {\n if (!this.map) return false;\n this.animateRouteSegmentFeatureCollection = updatedFeatureCollection;\n const routeSource = (this.map.getSource(this.animateRouteSourceName) as maplibregl.GeoJSONSource);\n if (routeSource) routeSource.setData(updatedFeatureCollection);\n\n return true;\n }\n\n setActiveRoute(route: Route) {\n this.route = route;\n }\n\n getActiveRoute(): Route | null {\n return this.route;\n }\n\n resetRouteSegmentAnimation() {\n this.animationStartTime = Date.now();\n cancelAnimationFrame(this.animationFrameID);\n if (this.animateRouteSegmentFeatureCollection.features.length > 0) {\n const routeFeature = this.animateRouteSegmentFeatureCollection.features[0] as unknown as Feature;\n //@ts-ignore\n if (routeFeature.geometry.type === 'LineString') this.animateHighlightedRouteSegment();\n }\n }\n\n animateHighlightedRouteSegment = () => {\n const routeFeature = cloneDeep(this.animateRouteSegmentFeatureCollection.features[0]) as Feature;\n if (routeFeature) {\n const currentTime = Date.now();\n const elapsed = currentTime - this.animationStartTime;\n\n const writeToSource = (feature: Feature, coords: []) => {\n //@ts-ignore\n feature.geometry.coordinates = coords;\n const routeSource = (this.map.getSource(this.animateRouteSourceName) as maplibregl.GeoJSONSource);\n if (routeSource) {\n //@ts-ignore\n routeSource.setData({\n type: 'FeatureCollection',\n features: [feature],\n } as FeatureCollection);\n }\n };\n const animationDuration = 2000;\n if (elapsed < animationDuration) {\n const progress = 1 - elapsed / animationDuration;\n\n //@ts-ignore\n const fullRoute = routeFeature.geometry.coordinates;\n const { end } = this;\n\n let currentEnd;\n if (progress > 0.5) {\n const customProgress = 2 * (progress - 0.5); // map 0.5 - 1 to 0 - 1 range\n currentEnd = end.from * (1.0 - customProgress) + customProgress * end.to;\n } else {\n const customProgress = progress * 2; // map 0 - 0.5 to 0 - 1 range\n currentEnd = end.from * (1.0 - customProgress) + customProgress * end.to;\n }\n\n // calculate distance along the line using current animation percentage\n // percentage travels 1 - 0\n let prevsum = 0;\n let actsum = 0;\n let i = fullRoute.length - 1;\n while (actsum < currentEnd && i > 0) {\n prevsum = actsum;\n actsum += turf.distance(point(fullRoute[i]), point(fullRoute[i - 1]));\n i -= 1;\n }\n if (progress > 0.5) {\n // Reverse animation\n // if (actsum <= currentEnd) {\n // const actRoute = [\n // ...fullRoute.slice(fullRoute.length - 2, fullRoute.length),\n // ];\n // return {fullRoute, end: {...end, current: currentEnd}, actRoute};\n // }\n\n // Return coordinates from line start to current percentage point\n const r = (currentEnd - prevsum) / (actsum - prevsum);\n const or = 1.0 - r;\n\n const actRoute = [\n ...fullRoute.slice(0, i + 1),\n [\n fullRoute[i][0] * r + fullRoute[i + 1][0] * or,\n fullRoute[i][1] * r + fullRoute[i + 1][1] * or,\n ],\n ];\n\n writeToSource(routeFeature, actRoute as any);\n } else {\n // Forward animation\n if (actsum <= currentEnd) {\n // Return last two points of the line as final result\n const actRoute = [\n ...fullRoute.slice(fullRoute.length - 2, fullRoute.length),\n ];\n\n writeToSource(routeFeature, actRoute as any);\n }\n\n // Return coordinates from line end to current percentage point\n const r = (currentEnd - prevsum) / (actsum - prevsum);\n const or = 1.0 - r;\n\n const actRoute = [\n [\n fullRoute[i][0] * r + fullRoute[i + 1][0] * or,\n fullRoute[i][1] * r + fullRoute[i + 1][1] * or,\n ],\n ...fullRoute.slice(i + 1, fullRoute.length),\n ];\n\n writeToSource(routeFeature, actRoute as any);\n }\n\n this.animationFrameID = requestAnimationFrame(\n this.animateHighlightedRouteSegment,\n );\n } else {\n this.resetRouteSegmentAnimation();\n }\n }\n };\n\n updateFeaturesToAnimate(segmentNumber: number, whereDimensionForFeatures: string) {\n if (this.route && this.route.segments.length > segmentNumber) {\n const routeSegment = this.route.segments[segmentNumber];\n // set features for animated segment source\n if (routeSegment.features.length > 0) {\n const lineFeaturesOfSegment =\n // include where dimension here?\n getLineStringFeaturesOfRouteSegment(\n routeSegment,\n whereDimensionForFeatures,\n );\n\n if (lineFeaturesOfSegment.length > 0) {\n this.updateAnimateRouteSource({\n type: 'FeatureCollection',\n features: lineFeaturesOfSegment,\n } as FeatureCollection);\n\n const ls = lineFeaturesOfSegment[0];\n //@ts-ignore\n const nearest = nearestPointOnLine(ls as any, point(lineFeaturesOfSegment[0].geometry.coordinates[0]));\n const toDist = length(ls) - nearest.properties.location;\n this.end = {\n from: 0,\n to: toDist,\n };\n } else {\n this.updateAnimateRouteSource({\n type: 'FeatureCollection',\n features: [],\n } as FeatureCollection);\n }\n\n this.resetRouteSegmentAnimation();\n }\n }\n }\n\n highlightRouteSegment(segmentNumberToHighlight: number, updateFilters = true) {\n const { route } = this;\n if (route && route.segments.length > segmentNumberToHighlight) {\n if (\n route.segments[segmentNumberToHighlight].coordinates.length > 0\n ) {\n this.highlightedSegmentNumber = segmentNumberToHighlight;\n const routeSegment = route.segments[segmentNumberToHighlight];\n\n const segmentWhereDimension = routeSegment.maneuverType === ManeuverType.ExitPortal || routeSegment.maneuverType === ManeuverType.Static\n ? routeSegment.endEdge.whereDimension\n : routeSegment.startEdge.whereDimension;\n let routeFeaturesToUse = this.patchFeatureCollection.features;\n\n // update visible route features if required\n const segmentPatchNumber = (\n routeSegment.features[0].properties as any\n ).patchNumber;\n if (this.currentPatchNumber !== segmentPatchNumber) {\n this.currentPatchNumber = segmentPatchNumber;\n const featureCollectionToDraw = {\n type: 'FeatureCollection',\n features: getFeaturesForPatch(route, segmentPatchNumber, {\n includeOverviewFeatures: isOverviewSegment(routeSegment),\n patchNumberForOverviewFeatures: segmentPatchNumber,\n }),\n } as FeatureCollection;\n\n routeFeaturesToUse = featureCollectionToDraw.features;\n }\n\n if (\n segmentWhereDimension\n && segmentWhereDimension !== this.getCurrentFocus()\n && updateFilters\n ) {\n this.filterWhereDimension(segmentWhereDimension);\n }\n\n // update highlighted route segment\n const updatedFeatures = highlightRouteSegment(\n routeFeaturesToUse as any,\n segmentNumberToHighlight,\n );\n\n this.updateRouteSource({\n type: 'FeatureCollection',\n features: updatedFeatures,\n });\n\n if (!isOverviewSegment(routeSegment)) {\n this.updateFeaturesToAnimate(\n segmentNumberToHighlight,\n segmentWhereDimension,\n );\n } else {\n // clear animation source\n this.updateAnimateRouteSource({\n type: 'FeatureCollection',\n features: [],\n } as FeatureCollection);\n }\n\n // animate camera to segment\n if (routeSegment) {\n const getStartCoords = (feature: Feature) => {\n //@ts-ignore\n if (feature.geometry.type === 'Point') {\n //@ts-ignore\n return feature.geometry.coordinates;\n }\n\n //@ts-ignore\n return feature.geometry.coordinates[0];\n };\n\n const canvas = this.map.getCanvas();\n const w = canvas.clientWidth;\n const h = canvas.clientHeight;\n const fitBoundsConfig = {\n padding: {\n top: h * 0.2, bottom: h * 0.2, left: w * 0.2, right: w * 0.2,\n },\n duration: 1000,\n bearing: this.map.getBearing(),\n pitch: this.map.getPitch(),\n };\n if (routeSegment.coordinates.length > 1) {\n const currentPatchFeatures = getPatch(route, routeSegment.patchNumber);\n const startCoords = getStartCoords(currentPatchFeatures[0] as any);\n // let index = 0;\n // for (index = 0; index < currentPatchFeatures.length; index++) {\n // const element = currentPatchFeatures[index];\n // if (element.properties.segmentNumber === segmentNumberToHighlight) {\n // startCoords = getStartCoords(element);\n // }\n // }\n const sw = new maplibregl.LngLat(startCoords[0], startCoords[1]);\n const ne = new maplibregl.LngLat(startCoords[0], startCoords[1]);\n const llb = new maplibregl.LngLatBounds(sw, ne);\n for (let index = 0; index < currentPatchFeatures.length; index++) {\n const element = currentPatchFeatures[index];\n if (element.geometry.type === 'Point') {\n llb.extend(element.geometry.coordinates as any);\n } else {\n //@ts-ignore\n for (const coord of element.geometry.coordinates) {\n llb.extend(coord);\n }\n }\n }\n\n this.map.fitBounds(\n llb,\n fitBoundsConfig,\n );\n } else {\n // Translate the point slightly to get another point which can used for the fitBounds function.\n const transformedFeatures = {\n type: 'FeatureCollection',\n features: [turfPoint(routeSegment.coordinates[0])],\n } as FeatureCollection;\n const forwardTransformed = transformTranslate(\n transformedFeatures as any,\n 0.025,\n 3,\n ).features[0].geometry.coordinates;\n\n const reverseTransformed = transformTranslate(\n transformedFeatures as any,\n -0.025,\n -3,\n ).features[0].geometry.coordinates;\n\n const bbox = [reverseTransformed, forwardTransformed];\n this.map.fitBounds(\n bbox as any,\n fitBoundsConfig,\n );\n }\n }\n } else {\n console.log('at vertical portal segment, ignoring!');\n }\n\n console.log(route.segments[segmentNumberToHighlight].instructions);\n } else {\n console.warn(\n 'Invalid segment number passed to highlightRouteSegment',\n );\n }\n }\n\n clearRoute() {\n const featureCollectionToDraw = {\n type: 'FeatureCollection',\n features: [],\n } as FeatureCollection;\n\n this.updateRouteSource(featureCollectionToDraw);\n this.updateAnimateRouteSource(featureCollectionToDraw);\n this.route = null;\n cancelAnimationFrame(this.animationFrameID);\n }\n}\n"],"mappings":";;;;;;AAAA,IAAAA,OAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,QAAA,GAAAH,OAAA;AAIA,IAAAI,OAAA,GAAAF,sBAAA,CAAAF,OAAA;AACA,IAAAK,mBAAA,GAAAL,OAAA;AAEA,IAAAM,KAAA,GAAAC,uBAAA,CAAAP,OAAA;AAAmC,IAAAQ,IAAA,GAAAF,KAAA;AACnC,IAAAG,mBAAA,GAAAT,OAAA;AAEA,IAAAU,WAAA,GAAAV,OAAA;AACA,IAAAW,eAAA,GAAAX,OAAA;AAIA,IAAAY,YAAA,GAAAZ,OAAA;AAEA,IAAAa,aAAA,GAAAX,sBAAA,CAAAF,OAAA;AAAiD,SAAAO,wBAAAO,CAAA,EAAAC,CAAA,6BAAAC,OAAA,MAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAT,uBAAA,YAAAA,wBAAAO,CAAA,EAAAC,CAAA,SAAAA,CAAA,IAAAD,CAAA,IAAAA,CAAA,CAAAK,UAAA,SAAAL,CAAA,MAAAM,CAAA,EAAAC,CAAA,EAAAC,CAAA,KAAAC,SAAA,mBAAAT,CAAA,iBAAAA,CAAA,gBAAAU,OAAA,CAAAV,CAAA,0BAAAA,CAAA,SAAAQ,CAAA,MAAAF,CAAA,GAAAL,CAAA,GAAAG,CAAA,GAAAD,CAAA,QAAAG,CAAA,CAAAK,GAAA,CAAAX,CAAA,UAAAM,CAAA,CAAAM,GAAA,CAAAZ,CAAA,GAAAM,CAAA,CAAAO,GAAA,CAAAb,CAAA,EAAAQ,CAAA,cAAAM,EAAA,IAAAd,CAAA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.js","names":["_lodash","require","_maplibreGl","_interopRequireDefault","_helpers","_length","_nearestPointOnLine","_turf","_interopRequireWildcard","turf","_transformTranslate","_interfaces","_routingHelpers","_routeLayers","_routingStore","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","RoutingVisualizer","routeSourceName","patchFeatureCollection","type","features","highlightedSegmentNumber","currentPatchNumber","animateRouteSourceName","animationFrameID","animateRouteSegmentFeatureCollection","animationStartTime","end","from","to","constructor","sdk","main","getCurrentFocus","filterWhereDimension","dimension","focusTo","setupRouting","map","addSource","data","layer","routeLayers","source","addLayer","routeAnimateLayers","computeRoute","startMapObjectId","endMapObjectId","wheelChairAccessibleRouting","arguments","length","undefined","shouldAddOverviewSegment","indexOffset","generatedRoute","createRoute","console","log","generateInstructions","segments","handleAllRouteUpdate","allSegments","userPosition","segmentIndex","featureLineStringToUpdate","filter","geometry","lineStringToUpdate","lineString","coordinates","slice","subLine","nearestPoint","nearestPointOnLine","sourceCoords","unshift","coordsToUpdate","index","properties","coordsToKeep","featureIndex","computeRoutes","mapObjectIds","wheelChairAccessibleRouteOnly","warn","mergedRoute","walkingDistance","transportDistance","walkingTime","transportTime","distanceUnit","DISTANCE_UNIT","speed","WALK_SPEED","dummySegment","push","id","routeData","useRouteDataStore","getState","point","project","feats","queryRenderedFeatures","RouteDimension","Edge","mapObjectId","edgeData","lines","segmentOverview","maneuverType","ManeuverType","SectionOverview","instructions","startEdge","name","endEdge","j","segment","overviewSegment","generateOverviewSegment","updateRouteSource","updatedFeatureCollection","routeSource","getSource","setData","updateAnimateRouteSource","setActiveRoute","route","getActiveRoute","resetRouteSegmentAnimation","Date","now","cancelAnimationFrame","routeFeature","animateHighlightedRouteSegment","cloneDeep","currentTime","elapsed","writeToSource","feature","coords","animationDuration","progress","fullRoute","currentEnd","customProgress","prevsum","actsum","distance","or","actRoute","requestAnimationFrame","updateFeaturesToAnimate","segmentNumber","whereDimensionForFeatures","routeSegment","lineFeaturesOfSegment","getLineStringFeaturesOfRouteSegment","ls","nearest","toDist","location","highlightRouteSegment","segmentNumberToHighlight","updateFilters","segmentWhereDimension","ExitPortal","Static","whereDimension","routeFeaturesToUse","segmentPatchNumber","patchNumber","featureCollectionToDraw","getFeaturesForPatch","includeOverviewFeatures","isOverviewSegment","patchNumberForOverviewFeatures","updatedFeatures","getStartCoords","canvas","getCanvas","w","clientWidth","h","clientHeight","fitBoundsConfig","padding","top","bottom","left","right","duration","bearing","getBearing","pitch","getPitch","currentPatchFeatures","getPatch","startCoords","sw","maplibregl","LngLat","ne","llb","LngLatBounds","element","extend","coord","fitBounds","transformedFeatures","turfPoint","forwardTransformed","transformTranslate","reverseTransformed","bbox","clearRoute","exports"],"sources":["../../../../../src/meta-atlas-sdk/utils/routing-visualizer/index.ts"],"sourcesContent":["import { cloneDeep } from 'lodash';\nimport maplibregl, { Feature, Map } from 'maplibre-gl';\nimport {\n Units, point as turfPoint,\n point,\n} from '@turf/helpers';\nimport length from '@turf/length';\nimport { nearestPointOnLine } from \"@turf/nearest-point-on-line\";\n// import { distance } from \"@turf/distance\";\nimport * as turf from '@turf/turf';\nimport { transformTranslate } from \"@turf/transform-translate\";\nimport { FeatureCollection } from 'geojson';\nimport { DISTANCE_UNIT, WALK_SPEED, RouteDimension, UserPosition } from '../../MetaAtlasCore/routing-core/interfaces';\nimport {\n ManeuverType, Route, RouteSegment, createRoute, generateInstructions, generateOverviewSegment, getFeaturesForPatch, getLineStringFeaturesOfRouteSegment, getPatch, highlightRouteSegment,\n isOverviewSegment,\n} from '../../MetaAtlasCore/routing-core/routing-helpers';\nimport { routeAnimateLayers, routeLayers } from '../../MetaAtlasCore/routing-core/routeLayers';\nimport { lineString } from '@turf/turf';\nimport useRouteDataStore from '../routing-store';\n\nexport class RoutingVisualizer {\n map: Map;\n\n // Routing\n routeSourceName = 'routeGeojson';\n\n patchFeatureCollection = {\n type: 'FeatureCollection',\n features: [],\n } as FeatureCollection;\n\n route: Route | null;\n\n highlightedSegmentNumber = -1;\n\n currentPatchNumber = -1;\n\n // Routing animation\n animateRouteSourceName = 'routeAnimateGeojson';\n\n animationFrameID = -1;\n\n animateRouteSegmentFeatureCollection = {\n type: 'FeatureCollection',\n features: [],\n } as FeatureCollection;\n\n animationStartTime = 0;\n\n end = {\n from: 0,\n to: 0,\n };\n\n main: any;\n\n constructor(sdk: any) {\n this.main = sdk\n }\n\n // MetaAtlasCore To Editor\n // eslint-disable-next-line class-methods-use-this\n getCurrentFocus() {\n return this.main.getCurrentFocus();\n }\n\n // eslint-disable-next-line class-methods-use-this\n filterWhereDimension(dimension: string) {\n this.main.focusTo(dimension, false);\n }\n\n // Routing\n setupRouting(map: Map) {\n this.map = map;\n this.map.addSource(this.routeSourceName, {\n type: 'geojson',\n data: this.patchFeatureCollection,\n });\n\n for (const layer of routeLayers) {\n (layer as any).source = this.routeSourceName;\n this.map.addLayer(layer as any);\n }\n\n // Animation data\n this.map.addSource(this.animateRouteSourceName, {\n type: 'geojson',\n data: this.animateRouteSegmentFeatureCollection,\n });\n\n for (const layer of routeAnimateLayers) {\n (layer as any).source = this.animateRouteSourceName;\n this.map.addLayer(layer as any);\n }\n }\n\n // eslint-disable-next-line class-methods-use-this\n async computeRoute(\n startMapObjectId: string,\n endMapObjectId: string,\n wheelChairAccessibleRouting = false,\n shouldAddOverviewSegment = true,\n indexOffset = 0, // offset for patch and segment numbers calculation\n ): Promise<Route> {\n this.currentPatchNumber = -1;\n\n const generatedRoute = await createRoute(\n startMapObjectId,\n endMapObjectId,\n wheelChairAccessibleRouting,\n shouldAddOverviewSegment,\n indexOffset,\n );\n\n console.log('internal generated: ', generatedRoute);\n\n // Generate textual instructions\n generateInstructions(generatedRoute);\n console.log(generatedRoute.segments);\n\n return generatedRoute;\n }\n\n handleAllRouteUpdate(allSegments: any, userPosition: UserPosition, segmentIndex) {\n // Get the LineString Feature of the route\n const featureLineStringToUpdate = allSegments[segmentIndex].features.filter(\n f => f.geometry.type === 'LineString'\n )[0];\n\n // Create a LineString with the coordinates of the route that would be updated accordingly\n const lineStringToUpdate = lineString(featureLineStringToUpdate.geometry.coordinates.slice(1));\n\n // Create a subset of LineString that contains the first two coords of the route which actually represent the route edge\n const subLine = lineString([\n featureLineStringToUpdate.geometry.coordinates[0],\n featureLineStringToUpdate.geometry.coordinates[1]\n ]);\n\n // Find the nearest point to the user position on the sub line and update the LineString.\n const nearestPoint = nearestPointOnLine(subLine, userPosition.sourceCoords);\n lineStringToUpdate.geometry.coordinates.unshift(userPosition.sourceCoords, nearestPoint.geometry.coordinates);\n const coordsToUpdate = lineStringToUpdate.geometry.coordinates;\n const index = nearestPoint.properties.index;\n const coordsToKeep = coordsToUpdate.slice(index);\n lineStringToUpdate.geometry.coordinates = coordsToKeep;\n lineStringToUpdate.geometry.coordinates.unshift(userPosition.sourceCoords);\n lineStringToUpdate.properties = featureLineStringToUpdate.properties;\n let featureIndex = -1;\n allSegments[segmentIndex].features.map((f, i) => {\n if (f.geometry.type === 'LineString') {\n featureIndex = i;\n }\n });\n\n // Update the new LineString in the route\n allSegments[segmentIndex].features[featureIndex] = lineStringToUpdate;\n allSegments[segmentIndex].coordinates = lineStringToUpdate.geometry.coordinates;\n }\n\n async computeRoutes(mapObjectIds: string[], wheelChairAccessibleRouteOnly = false): Promise<Route | undefined> {\n if (mapObjectIds.length < 2) {\n console.warn('Invalid array passed to computeRoutes');\n return undefined;\n }\n\n console.log('calling computeRoutes with mapObjectIds: ', mapObjectIds);\n\n const mergedRoute = {\n segments: [] as RouteSegment[],\n walkingDistance: 0,\n transportDistance: 0,\n walkingTime: 0,\n transportTime: 0,\n\n distanceUnit: DISTANCE_UNIT as Units,\n speed: WALK_SPEED,\n } as Route;\n\n // Dummy segment for overview segment\n const dummySegment = {};\n mergedRoute.segments.push(dummySegment as any);\n let indexOffset = 1; // Index set to 1, since overview segment will be added to 0th index\n\n for (let index = 0; index < mapObjectIds.length - 1; index += 1) {\n let startMapObjectId = mapObjectIds[index];\n const endMapObjectId = mapObjectIds[index + 1];\n\n const shouldAddOverviewSegment = true; // include overview segment in first route\n\n const id = mapObjectIds[0] as unknown as UserPosition;\n if (typeof mapObjectIds[0] !== 'string') {\n // Run queryRenderedFeatures.\n const routeData = useRouteDataStore.getState().data;\n const point = this.map.project([id.sourceCoords[0], id.sourceCoords[1]]);\n const feats = this.map.queryRenderedFeatures(point);\n feats.map(f => {\n if (routeData[RouteDimension.Edge].hasOwnProperty(f.properties.mapObjectId)) {\n const edgeData = routeData[RouteDimension.Edge][f.properties.mapObjectId];\n if (edgeData.lines.length > 0) {\n startMapObjectId = f.properties.mapObjectId;\n }\n }\n });\n }\n\n // eslint-disable-next-line no-await-in-loop\n const generatedRoute = await this.computeRoute(startMapObjectId, endMapObjectId, wheelChairAccessibleRouteOnly, shouldAddOverviewSegment, indexOffset);\n const allSegments = generatedRoute.segments;\n // if (typeof mapObjectIds[index] !== 'string' && typeof startMapObjectId === 'string') {\n // //Handle SectionOverview:\n // this.handleAllRouteUpdate(allSegments, id as UserPosition, 0);\n\n // // Handle the second segment.\n // const secondSegmentFeatures = generatedRoute.segments[1].features;\n // if (secondSegmentFeatures.length < 3 && secondSegmentFeatures[0].geometry.type === 'Point') {\n // secondSegmentFeatures[0].geometry.coordinates = id.sourceCoords;\n // allSegments[1].coordinates = id.sourceCoords as any;\n // } else {\n // this.handleAllRouteUpdate(allSegments, id as UserPosition, 1);\n // }\n\n // // Handle third segment\n // const thirdSegmentFeatures = generatedRoute.segments[2].features;\n // if (thirdSegmentFeatures.length < 3 && thirdSegmentFeatures.geometry.type === 'Point') {\n // allSegments[1].features[0].geometry.coordinates = id.sourceCoords;\n // allSegments[1].coordinates = id.sourceCoords as any;\n // } else {\n // this.handleAllRouteUpdate(allSegments, id as UserPosition, 2);\n // }\n // }\n \n if (generatedRoute.segments.length > 0) {\n const segmentOverview = generatedRoute.segments[0];\n segmentOverview.maneuverType = ManeuverType.SectionOverview;\n segmentOverview.instructions = [`${segmentOverview.startEdge.name} to ${segmentOverview.endEdge.name}`];\n }\n for (let j = 0; j < generatedRoute.segments.length; j += 1) {\n const segment = generatedRoute.segments[j];\n mergedRoute.segments.push(segment);\n }\n mergedRoute.walkingDistance += generatedRoute.walkingDistance;\n mergedRoute.transportDistance += generatedRoute.transportDistance;\n mergedRoute.walkingTime += generatedRoute.walkingTime;\n mergedRoute.transportTime += generatedRoute.transportTime;\n\n // Increment by segment count\n indexOffset += generatedRoute.segments.length;\n }\n\n if (mergedRoute.segments.length > 1) { // Use 1 here because 1 dummy segment will always be included\n const overviewSegment = generateOverviewSegment(mergedRoute);\n mergedRoute.segments[0] = overviewSegment;\n } else {\n mergedRoute.segments.length = 0; // Remove dummy segment\n }\n\n console.log('merged route: ', mergedRoute);\n\n return mergedRoute;\n }\n\n updateRouteSource(updatedFeatureCollection: FeatureCollection) {\n if (!this.map) return false;\n this.patchFeatureCollection = updatedFeatureCollection;\n const routeSource = (this.map.getSource(this.routeSourceName) as maplibregl.GeoJSONSource);\n if (routeSource) routeSource.setData(updatedFeatureCollection);\n\n return true;\n }\n\n updateAnimateRouteSource(updatedFeatureCollection: FeatureCollection) {\n if (!this.map) return false;\n this.animateRouteSegmentFeatureCollection = updatedFeatureCollection;\n const routeSource = (this.map.getSource(this.animateRouteSourceName) as maplibregl.GeoJSONSource);\n if (routeSource) routeSource.setData(updatedFeatureCollection);\n\n return true;\n }\n\n setActiveRoute(route: Route) {\n this.route = route;\n }\n\n getActiveRoute(): Route | null {\n return this.route;\n }\n\n resetRouteSegmentAnimation() {\n this.animationStartTime = Date.now();\n cancelAnimationFrame(this.animationFrameID);\n if (this.animateRouteSegmentFeatureCollection.features.length > 0) {\n const routeFeature = this.animateRouteSegmentFeatureCollection.features[0] as unknown as Feature;\n //@ts-ignore\n if (routeFeature.geometry.type === 'LineString') this.animateHighlightedRouteSegment();\n }\n }\n\n animateHighlightedRouteSegment = () => {\n const routeFeature = cloneDeep(this.animateRouteSegmentFeatureCollection.features[0]) as Feature;\n if (routeFeature) {\n const currentTime = Date.now();\n const elapsed = currentTime - this.animationStartTime;\n\n const writeToSource = (feature: Feature, coords: []) => {\n //@ts-ignore\n feature.geometry.coordinates = coords;\n const routeSource = (this.map.getSource(this.animateRouteSourceName) as maplibregl.GeoJSONSource);\n if (routeSource) {\n //@ts-ignore\n routeSource.setData({\n type: 'FeatureCollection',\n features: [feature],\n } as FeatureCollection);\n }\n };\n const animationDuration = 2000;\n if (elapsed < animationDuration) {\n const progress = 1 - elapsed / animationDuration;\n\n //@ts-ignore\n const fullRoute = routeFeature.geometry.coordinates;\n const { end } = this;\n\n let currentEnd;\n if (progress > 0.5) {\n const customProgress = 2 * (progress - 0.5); // map 0.5 - 1 to 0 - 1 range\n currentEnd = end.from * (1.0 - customProgress) + customProgress * end.to;\n } else {\n const customProgress = progress * 2; // map 0 - 0.5 to 0 - 1 range\n currentEnd = end.from * (1.0 - customProgress) + customProgress * end.to;\n }\n\n // calculate distance along the line using current animation percentage\n // percentage travels 1 - 0\n let prevsum = 0;\n let actsum = 0;\n let i = fullRoute.length - 1;\n while (actsum < currentEnd && i > 0) {\n prevsum = actsum;\n actsum += turf.distance(point(fullRoute[i]), point(fullRoute[i - 1]));\n i -= 1;\n }\n if (progress > 0.5) {\n // Reverse animation\n // if (actsum <= currentEnd) {\n // const actRoute = [\n // ...fullRoute.slice(fullRoute.length - 2, fullRoute.length),\n // ];\n // return {fullRoute, end: {...end, current: currentEnd}, actRoute};\n // }\n\n // Return coordinates from line start to current percentage point\n const r = (currentEnd - prevsum) / (actsum - prevsum);\n const or = 1.0 - r;\n\n const actRoute = [\n ...fullRoute.slice(0, i + 1),\n [\n fullRoute[i][0] * r + fullRoute[i + 1][0] * or,\n fullRoute[i][1] * r + fullRoute[i + 1][1] * or,\n ],\n ];\n\n writeToSource(routeFeature, actRoute as any);\n } else {\n // Forward animation\n if (actsum <= currentEnd) {\n // Return last two points of the line as final result\n const actRoute = [\n ...fullRoute.slice(fullRoute.length - 2, fullRoute.length),\n ];\n\n writeToSource(routeFeature, actRoute as any);\n }\n\n // Return coordinates from line end to current percentage point\n const r = (currentEnd - prevsum) / (actsum - prevsum);\n const or = 1.0 - r;\n\n const actRoute = [\n [\n fullRoute[i][0] * r + fullRoute[i + 1][0] * or,\n fullRoute[i][1] * r + fullRoute[i + 1][1] * or,\n ],\n ...fullRoute.slice(i + 1, fullRoute.length),\n ];\n\n writeToSource(routeFeature, actRoute as any);\n }\n\n this.animationFrameID = requestAnimationFrame(\n this.animateHighlightedRouteSegment,\n );\n } else {\n this.resetRouteSegmentAnimation();\n }\n }\n };\n\n updateFeaturesToAnimate(segmentNumber: number, whereDimensionForFeatures: string) {\n if (this.route && this.route.segments.length > segmentNumber) {\n const routeSegment = this.route.segments[segmentNumber];\n // set features for animated segment source\n if (routeSegment.features.length > 0) {\n const lineFeaturesOfSegment =\n // include where dimension here?\n getLineStringFeaturesOfRouteSegment(\n routeSegment,\n whereDimensionForFeatures,\n );\n\n if (lineFeaturesOfSegment.length > 0) {\n this.updateAnimateRouteSource({\n type: 'FeatureCollection',\n features: lineFeaturesOfSegment,\n } as FeatureCollection);\n\n const ls = lineFeaturesOfSegment[0];\n //@ts-ignore\n const nearest = nearestPointOnLine(ls as any, point(lineFeaturesOfSegment[0].geometry.coordinates[0]));\n const toDist = length(ls) - nearest.properties.location;\n this.end = {\n from: 0,\n to: toDist,\n };\n } else {\n this.updateAnimateRouteSource({\n type: 'FeatureCollection',\n features: [],\n } as FeatureCollection);\n }\n\n this.resetRouteSegmentAnimation();\n }\n }\n }\n\n highlightRouteSegment(segmentNumberToHighlight: number, updateFilters = true) {\n const { route } = this;\n if (route && route.segments.length > segmentNumberToHighlight) {\n if (\n route.segments[segmentNumberToHighlight].coordinates.length > 0\n ) {\n this.highlightedSegmentNumber = segmentNumberToHighlight;\n const routeSegment = route.segments[segmentNumberToHighlight];\n\n const segmentWhereDimension = routeSegment.maneuverType === ManeuverType.ExitPortal || routeSegment.maneuverType === ManeuverType.Static\n ? routeSegment.endEdge.whereDimension\n : routeSegment.startEdge.whereDimension;\n let routeFeaturesToUse = this.patchFeatureCollection.features;\n\n // update visible route features if required\n const segmentPatchNumber = (\n routeSegment.features[0].properties as any\n ).patchNumber;\n if (this.currentPatchNumber !== segmentPatchNumber) {\n this.currentPatchNumber = segmentPatchNumber;\n const featureCollectionToDraw = {\n type: 'FeatureCollection',\n features: getFeaturesForPatch(route, segmentPatchNumber, {\n includeOverviewFeatures: isOverviewSegment(routeSegment),\n patchNumberForOverviewFeatures: segmentPatchNumber,\n }),\n } as FeatureCollection;\n\n routeFeaturesToUse = featureCollectionToDraw.features;\n }\n\n if (\n segmentWhereDimension\n && segmentWhereDimension !== this.getCurrentFocus()\n && updateFilters\n ) {\n this.filterWhereDimension(segmentWhereDimension);\n }\n\n // update highlighted route segment\n const updatedFeatures = highlightRouteSegment(\n routeFeaturesToUse as any,\n segmentNumberToHighlight,\n );\n\n this.updateRouteSource({\n type: 'FeatureCollection',\n features: updatedFeatures,\n });\n\n if (!isOverviewSegment(routeSegment)) {\n this.updateFeaturesToAnimate(\n segmentNumberToHighlight,\n segmentWhereDimension,\n );\n } else {\n // clear animation source\n this.updateAnimateRouteSource({\n type: 'FeatureCollection',\n features: [],\n } as FeatureCollection);\n }\n\n // animate camera to segment\n if (routeSegment) {\n const getStartCoords = (feature: Feature) => {\n //@ts-ignore\n if (feature.geometry.type === 'Point') {\n //@ts-ignore\n return feature.geometry.coordinates;\n }\n\n //@ts-ignore\n return feature.geometry.coordinates[0];\n };\n\n const canvas = this.map.getCanvas();\n const w = canvas.clientWidth;\n const h = canvas.clientHeight;\n const fitBoundsConfig = {\n padding: {\n top: h * 0.2, bottom: h * 0.2, left: w * 0.2, right: w * 0.2,\n },\n duration: 1000,\n bearing: this.map.getBearing(),\n pitch: this.map.getPitch(),\n };\n if (routeSegment.coordinates.length > 1) {\n const currentPatchFeatures = getPatch(route, routeSegment.patchNumber);\n const startCoords = getStartCoords(currentPatchFeatures[0] as any);\n // let index = 0;\n // for (index = 0; index < currentPatchFeatures.length; index++) {\n // const element = currentPatchFeatures[index];\n // if (element.properties.segmentNumber === segmentNumberToHighlight) {\n // startCoords = getStartCoords(element);\n // }\n // }\n const sw = new maplibregl.LngLat(startCoords[0], startCoords[1]);\n const ne = new maplibregl.LngLat(startCoords[0], startCoords[1]);\n const llb = new maplibregl.LngLatBounds(sw, ne);\n for (let index = 0; index < currentPatchFeatures.length; index++) {\n const element = currentPatchFeatures[index];\n if (element.geometry.type === 'Point') {\n llb.extend(element.geometry.coordinates as any);\n } else {\n //@ts-ignore\n for (const coord of element.geometry.coordinates) {\n llb.extend(coord);\n }\n }\n }\n\n this.map.fitBounds(\n llb,\n fitBoundsConfig,\n );\n } else {\n // Translate the point slightly to get another point which can used for the fitBounds function.\n const transformedFeatures = {\n type: 'FeatureCollection',\n features: [turfPoint(routeSegment.coordinates[0])],\n } as FeatureCollection;\n const forwardTransformed = transformTranslate(\n transformedFeatures as any,\n 0.025,\n 3,\n ).features[0].geometry.coordinates;\n\n const reverseTransformed = transformTranslate(\n transformedFeatures as any,\n -0.025,\n -3,\n ).features[0].geometry.coordinates;\n\n const bbox = [reverseTransformed, forwardTransformed];\n this.map.fitBounds(\n bbox as any,\n fitBoundsConfig,\n );\n }\n }\n } else {\n console.log('at vertical portal segment, ignoring!');\n }\n\n console.log(route.segments[segmentNumberToHighlight].instructions);\n } else {\n console.warn(\n 'Invalid segment number passed to highlightRouteSegment',\n );\n }\n }\n\n clearRoute() {\n const featureCollectionToDraw = {\n type: 'FeatureCollection',\n features: [],\n } as FeatureCollection;\n\n this.updateRouteSource(featureCollectionToDraw);\n this.updateAnimateRouteSource(featureCollectionToDraw);\n this.route = null;\n cancelAnimationFrame(this.animationFrameID);\n }\n}\n"],"mappings":";;;;;;AAAA,IAAAA,OAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,QAAA,GAAAH,OAAA;AAIA,IAAAI,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B,EACnB,KAAK,EACL,CACJ,CAAC,CAAC/L,QAAQ,CAAC,CAAC,CAAC,CAAC+C,QAAQ,CAACG,WAAW;YAElC,MAAMiJ,kBAAkB,GAAG,IAAAD,sCAAkB,EAC3CH,mBAAmB,EACnB,CAAC,KAAK,EACN,CAAC,CACH,CAAC,CAAC/L,QAAQ,CAAC,CAAC,CAAC,CAAC+C,QAAQ,CAACG,WAAW;YAElC,MAAMkJ,IAAI,GAAG,CAACD,kBAAkB,EAAEF,kBAAkB,CAAC;YACrD,IAAI,CAAC/K,GAAG,CAAC4K,SAAS,CAChBM,IAAI,EACJ7B,eACF,CAAC;UACH;QACF;MACF,CAAC,MAAM;QACLlI,OAAO,CAACC,GAAG,CAAC,uCAAuC,CAAC;MACtD;MAEAD,OAAO,CAACC,GAAG,CAACuE,KAAK,CAACrE,QAAQ,CAACyG,wBAAwB,CAAC,CAACnD,YAAY,CAAC;IACpE,CAAC,MAAM;MACLzD,OAAO,CAAC4B,IAAI,CACV,wDACF,CAAC;IACH;EACF;EAEAoI,UAAUA,CAAA,EAAG;IACX,MAAM3C,uBAAuB,GAAG;MAC9B3J,IAAI,EAAE,mBAAmB;MACzBC,QAAQ,EAAE;IACZ,CAAsB;IAEtB,IAAI,CAACsG,iBAAiB,CAACoD,uBAAuB,CAAC;IAC/C,IAAI,CAAC/C,wBAAwB,CAAC+C,uBAAuB,CAAC;IACtD,IAAI,CAAC7C,KAAK,GAAG,IAAI;IACjBK,oBAAoB,CAAC,IAAI,CAAC9G,gBAAgB,CAAC;EAC7C;AACF;AAACkM,OAAA,CAAA1M,iBAAA,GAAAA,iBAAA","ignoreList":[]}
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.MetaAtlasMap = MetaAtlasMap;
|
|
7
|
+
var _react = require("react");
|
|
8
|
+
var _maplibre = require("react-map-gl/maplibre");
|
|
9
|
+
var _maplibreGl = _interopRequireDefault(require("maplibre-gl"));
|
|
10
|
+
require("maplibre-gl/dist/maplibre-gl.css");
|
|
11
|
+
var _metaAtlasSdk = require("../meta-atlas-sdk/meta-atlas-sdk.js");
|
|
12
|
+
var _useMetaAtlasStore = require("./stores/useMetaAtlasStore.js");
|
|
13
|
+
var _index = require("./hooks/useFocus/index.js");
|
|
14
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
15
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
16
|
+
function MetaAtlasMap(_ref) {
|
|
17
|
+
let {
|
|
18
|
+
accessToken,
|
|
19
|
+
secretKey,
|
|
20
|
+
role = 'changipublic',
|
|
21
|
+
onLoad,
|
|
22
|
+
onLoadFail,
|
|
23
|
+
onRoutingStatusUpdate = _loaded => {},
|
|
24
|
+
onSearchStatusUpdate = _loaded => {},
|
|
25
|
+
initialViewState: initialViewStateProp,
|
|
26
|
+
style,
|
|
27
|
+
children
|
|
28
|
+
} = _ref;
|
|
29
|
+
const mapRef = (0, _react.useRef)(null);
|
|
30
|
+
|
|
31
|
+
// Get store state and actions
|
|
32
|
+
const sdk = (0, _useMetaAtlasStore.useMetaAtlasStore)(state => state.sdk);
|
|
33
|
+
const mapCoreReady = (0, _useMetaAtlasStore.useMetaAtlasStore)(state => state.mapCoreReady);
|
|
34
|
+
const setSdk = (0, _useMetaAtlasStore.useMetaAtlasStore)(state => state.setSdk);
|
|
35
|
+
const setMapCoreReady = (0, _useMetaAtlasStore.useMetaAtlasStore)(state => state.setMapCoreReady);
|
|
36
|
+
const setRoutingReady = (0, _useMetaAtlasStore.useMetaAtlasStore)(state => state.setRoutingReady);
|
|
37
|
+
const setSearchReady = (0, _useMetaAtlasStore.useMetaAtlasStore)(state => state.setSearchReady);
|
|
38
|
+
const setError = (0, _useMetaAtlasStore.useMetaAtlasStore)(state => state.setError);
|
|
39
|
+
|
|
40
|
+
// Get camera props from focusTree when not provided as prop
|
|
41
|
+
const {
|
|
42
|
+
getRootSiteCameraProps,
|
|
43
|
+
isReady
|
|
44
|
+
} = (0, _index.useFocus)();
|
|
45
|
+
|
|
46
|
+
// Default fallback view state
|
|
47
|
+
const defaultViewState = null;
|
|
48
|
+
|
|
49
|
+
// Compute initialViewState: use prop if provided, otherwise try to get from focusTree
|
|
50
|
+
const initialViewState = (0, _react.useMemo)(() => {
|
|
51
|
+
// If prop is provided, use it
|
|
52
|
+
if (initialViewStateProp) {
|
|
53
|
+
return initialViewStateProp;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
// Try to get from focusTree root site camera config
|
|
57
|
+
const cameraProps = getRootSiteCameraProps('web');
|
|
58
|
+
if (cameraProps) {
|
|
59
|
+
return {
|
|
60
|
+
longitude: cameraProps.longitude,
|
|
61
|
+
latitude: cameraProps.latitude,
|
|
62
|
+
zoom: cameraProps.zoom,
|
|
63
|
+
bearing: cameraProps.bearing,
|
|
64
|
+
pitch: cameraProps.pitch
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
// Fallback to default
|
|
69
|
+
return defaultViewState;
|
|
70
|
+
}, [initialViewStateProp, isReady, getRootSiteCameraProps]);
|
|
71
|
+
|
|
72
|
+
// Initialize SDK instance
|
|
73
|
+
(0, _react.useEffect)(() => {
|
|
74
|
+
const handleLoad = () => {
|
|
75
|
+
onLoad?.();
|
|
76
|
+
};
|
|
77
|
+
const handleLoadFail = errorMessage => {
|
|
78
|
+
setError(errorMessage);
|
|
79
|
+
setMapCoreReady(false);
|
|
80
|
+
onLoadFail?.(errorMessage);
|
|
81
|
+
};
|
|
82
|
+
const handleRoutingStatusUpdate = isReady => {
|
|
83
|
+
setRoutingReady(isReady);
|
|
84
|
+
onRoutingStatusUpdate?.(isReady);
|
|
85
|
+
};
|
|
86
|
+
const handleSearchStatusUpdate = isReady => {
|
|
87
|
+
setSearchReady(isReady);
|
|
88
|
+
onSearchStatusUpdate?.(isReady);
|
|
89
|
+
};
|
|
90
|
+
const sdkInstance = new _metaAtlasSdk.MetaAtlasSdk(accessToken, secretKey, handleLoad, handleLoadFail, handleRoutingStatusUpdate, handleSearchStatusUpdate);
|
|
91
|
+
setSdk(sdkInstance);
|
|
92
|
+
return () => {
|
|
93
|
+
// Cleanup if needed
|
|
94
|
+
// Note: SDK cleanup logic can be added here if needed
|
|
95
|
+
};
|
|
96
|
+
}, [accessToken, secretKey]);
|
|
97
|
+
|
|
98
|
+
// Attach SDK to map instance when map is ready
|
|
99
|
+
const handleMapLoad = (0, _react.useCallback)(() => {
|
|
100
|
+
if (mapRef.current && sdk && !mapCoreReady) {
|
|
101
|
+
console.log('map load', mapRef.current);
|
|
102
|
+
const mapInstance = mapRef.current.getMap();
|
|
103
|
+
|
|
104
|
+
// Initialize SDK with the map instance
|
|
105
|
+
sdk.setupMap(role, mapInstance);
|
|
106
|
+
setMapCoreReady(true);
|
|
107
|
+
}
|
|
108
|
+
}, [sdk, setMapCoreReady, mapCoreReady]);
|
|
109
|
+
|
|
110
|
+
// Don't render map until initialViewState is available
|
|
111
|
+
if (!initialViewState) {
|
|
112
|
+
return null;
|
|
113
|
+
}
|
|
114
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_maplibre.Map, {
|
|
115
|
+
ref: mapRef,
|
|
116
|
+
mapLib: _maplibreGl.default,
|
|
117
|
+
initialViewState: initialViewState,
|
|
118
|
+
onLoad: handleMapLoad,
|
|
119
|
+
style: style || {
|
|
120
|
+
width: '100%',
|
|
121
|
+
height: '100%'
|
|
122
|
+
},
|
|
123
|
+
mapStyle: _metaAtlasSdk.DEFAULT_MAP_STYLE,
|
|
124
|
+
children: children
|
|
125
|
+
});
|
|
126
|
+
}
|
|
127
|
+
//# sourceMappingURL=MetaAtlasMap.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MetaAtlasMap.js","names":["_react","require","_maplibre","_maplibreGl","_interopRequireDefault","_metaAtlasSdk","_useMetaAtlasStore","_index","_jsxRuntime","e","__esModule","default","MetaAtlasMap","_ref","accessToken","secretKey","role","onLoad","onLoadFail","onRoutingStatusUpdate","_loaded","onSearchStatusUpdate","initialViewState","initialViewStateProp","style","children","mapRef","useRef","sdk","useMetaAtlasStore","state","mapCoreReady","setSdk","setMapCoreReady","setRoutingReady","setSearchReady","setError","getRootSiteCameraProps","isReady","useFocus","defaultViewState","useMemo","cameraProps","longitude","latitude","zoom","bearing","pitch","useEffect","handleLoad","handleLoadFail","errorMessage","handleRoutingStatusUpdate","handleSearchStatusUpdate","sdkInstance","MetaAtlasSdk","handleMapLoad","useCallback","current","console","log","mapInstance","getMap","setupMap","jsx","Map","ref","mapLib","maplibregl","width","height","mapStyle","DEFAULT_MAP_STYLE"],"sources":["../../../src/react/MetaAtlasMap.tsx"],"sourcesContent":["import { useRef, useEffect, useCallback, useMemo } from 'react';\nimport { Map, MapRef } from 'react-map-gl/maplibre';\nimport maplibregl from 'maplibre-gl';\nimport 'maplibre-gl/dist/maplibre-gl.css';\nimport { MetaAtlasSdk, DEFAULT_MAP_STYLE } from '../meta-atlas-sdk/meta-atlas-sdk';\nimport { useMetaAtlasStore } from './stores/useMetaAtlasStore';\nimport { MetaAtlasMapProps } from './types';\nimport { useFocus } from './hooks/useFocus';\n\nexport function MetaAtlasMap({\n accessToken,\n secretKey,\n role = 'changipublic',\n onLoad,\n onLoadFail,\n onRoutingStatusUpdate = (_loaded: boolean) => {},\n onSearchStatusUpdate = (_loaded: boolean) => {},\n initialViewState: initialViewStateProp,\n style,\n children,\n}: MetaAtlasMapProps) {\n const mapRef = useRef<MapRef>(null);\n \n // Get store state and actions\n const sdk = useMetaAtlasStore((state) => state.sdk);\n const mapCoreReady = useMetaAtlasStore((state) => state.mapCoreReady);\n const setSdk = useMetaAtlasStore((state) => state.setSdk);\n const setMapCoreReady = useMetaAtlasStore((state) => state.setMapCoreReady);\n const setRoutingReady = useMetaAtlasStore((state) => state.setRoutingReady);\n const setSearchReady = useMetaAtlasStore((state) => state.setSearchReady);\n const setError = useMetaAtlasStore((state) => state.setError);\n\n // Get camera props from focusTree when not provided as prop\n const { getRootSiteCameraProps, isReady } = useFocus();\n \n // Default fallback view state\n const defaultViewState = null;\n\n // Compute initialViewState: use prop if provided, otherwise try to get from focusTree\n const initialViewState = useMemo(() => {\n // If prop is provided, use it\n if (initialViewStateProp) {\n return initialViewStateProp;\n }\n \n // Try to get from focusTree root site camera config\n const cameraProps = getRootSiteCameraProps('web');\n if (cameraProps) {\n return {\n longitude: cameraProps.longitude,\n latitude: cameraProps.latitude,\n zoom: cameraProps.zoom,\n bearing: cameraProps.bearing,\n pitch: cameraProps.pitch,\n };\n }\n \n // Fallback to default\n return defaultViewState;\n }, [initialViewStateProp, isReady, getRootSiteCameraProps]);\n\n // Initialize SDK instance\n useEffect(() => {\n const handleLoad = () => {\n onLoad?.();\n };\n\n const handleLoadFail = (errorMessage: string) => {\n setError(errorMessage);\n setMapCoreReady(false);\n onLoadFail?.(errorMessage);\n };\n\n const handleRoutingStatusUpdate = (isReady: boolean) => {\n setRoutingReady(isReady);\n onRoutingStatusUpdate?.(isReady);\n };\n\n const handleSearchStatusUpdate = (isReady: boolean) => {\n setSearchReady(isReady);\n onSearchStatusUpdate?.(isReady);\n };\n\n const sdkInstance = new MetaAtlasSdk(\n accessToken,\n secretKey,\n handleLoad,\n handleLoadFail,\n handleRoutingStatusUpdate,\n handleSearchStatusUpdate\n );\n\n setSdk(sdkInstance);\n\n return () => {\n // Cleanup if needed\n // Note: SDK cleanup logic can be added here if needed\n };\n }, [accessToken, secretKey]);\n\n // Attach SDK to map instance when map is ready\n const handleMapLoad = useCallback(() => {\n if (mapRef.current && sdk && !mapCoreReady) {\n console.log('map load', mapRef.current);\n const mapInstance = mapRef.current.getMap();\n \n // Initialize SDK with the map instance\n sdk.setupMap(role, mapInstance);\n \n setMapCoreReady(true); \n }\n }, [sdk, setMapCoreReady, mapCoreReady]);\n \n // Don't render map until initialViewState is available\n if (!initialViewState) {\n return null;\n }\n\n return (\n <Map\n ref={mapRef}\n mapLib={maplibregl}\n initialViewState={initialViewState}\n onLoad={handleMapLoad}\n style={style || { width: '100%', height: '100%' }}\n mapStyle={DEFAULT_MAP_STYLE}\n >\n {children}\n </Map>\n );\n}\n\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,SAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAC,sBAAA,CAAAH,OAAA;AACAA,OAAA;AAA0C,IAAAI,aAAA,GAAAJ,OAAA;AAAA,IAAAK,kBAAA,GAAAL,OAAA;AAAA,IAAAM,MAAA,GAAAN,OAAA;AAAA,IAAAO,WAAA,GAAAP,OAAA;AAAA,SAAAG,uBAAAK,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAMnC,SAASG,YAAYA,CAAAC,IAAA,EAWN;EAAA,IAXO;IAC3BC,WAAW;IACXC,SAAS;IACTC,IAAI,GAAG,cAAc;IACrBC,MAAM;IACNC,UAAU;IACVC,qBAAqB,GAAIC,OAAgB,IAAK,CAAC,CAAC;IAChDC,oBAAoB,GAAID,OAAgB,IAAK,CAAC,CAAC;IAC/CE,gBAAgB,EAAEC,oBAAoB;IACtCC,KAAK;IACLC;EACiB,CAAC,GAAAZ,IAAA;EAClB,MAAMa,MAAM,GAAG,IAAAC,aAAM,EAAS,IAAI,CAAC;;EAEnC;EACA,MAAMC,GAAG,GAAG,IAAAC,oCAAiB,EAAEC,KAAK,IAAKA,KAAK,CAACF,GAAG,CAAC;EACnD,MAAMG,YAAY,GAAG,IAAAF,oCAAiB,EAAEC,KAAK,IAAKA,KAAK,CAACC,YAAY,CAAC;EACrE,MAAMC,MAAM,GAAG,IAAAH,oCAAiB,EAAEC,KAAK,IAAKA,KAAK,CAACE,MAAM,CAAC;EACzD,MAAMC,eAAe,GAAG,IAAAJ,oCAAiB,EAAEC,KAAK,IAAKA,KAAK,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EC,MAAM,EAAE;IAAO,CAAE;IAClDC,QAAQ,EAAEC,+BAAkB;IAAA/C,QAAA,EAE3BA;EAAQ,CACN,CAAC;AAEV","ignoreList":[]}
|
|
@@ -4,26 +4,25 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.useDrawing = useDrawing;
|
|
7
|
-
var
|
|
8
|
-
var _useMetaAtlasStore = require("../../stores/useMetaAtlasStore");
|
|
7
|
+
var _index = require("../useMetaAtlas/index.js");
|
|
8
|
+
var _useMetaAtlasStore = require("../../stores/useMetaAtlasStore.js");
|
|
9
9
|
function useDrawing() {
|
|
10
|
-
|
|
11
|
-
drawGeometryOnMap
|
|
12
|
-
addDrawingsToBaseMap
|
|
13
|
-
editDrawing
|
|
14
|
-
removeDrawing
|
|
15
|
-
getDrawingById
|
|
16
|
-
isInDrawMode
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
});
|
|
10
|
+
const {
|
|
11
|
+
drawGeometryOnMap,
|
|
12
|
+
addDrawingsToBaseMap,
|
|
13
|
+
editDrawing,
|
|
14
|
+
removeDrawing,
|
|
15
|
+
getDrawingById,
|
|
16
|
+
isInDrawMode
|
|
17
|
+
} = (0, _index.useMetaAtlas)();
|
|
18
|
+
const mapCoreReady = (0, _useMetaAtlasStore.useMetaAtlasStore)(state => state.mapCoreReady);
|
|
20
19
|
return {
|
|
21
|
-
drawGeometryOnMap
|
|
22
|
-
addDrawingsToBaseMap
|
|
23
|
-
editDrawing
|
|
24
|
-
removeDrawing
|
|
25
|
-
getDrawingById
|
|
26
|
-
isInDrawMode
|
|
20
|
+
drawGeometryOnMap,
|
|
21
|
+
addDrawingsToBaseMap,
|
|
22
|
+
editDrawing,
|
|
23
|
+
removeDrawing,
|
|
24
|
+
getDrawingById,
|
|
25
|
+
isInDrawMode,
|
|
27
26
|
isReady: mapCoreReady // Use mapCoreReady flag
|
|
28
27
|
};
|
|
29
28
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["
|
|
1
|
+
{"version":3,"file":"index.js","names":["useDrawing","drawGeometryOnMap","addDrawingsToBaseMap","editDrawing","removeDrawing","getDrawingById","isInDrawMode","useMetaAtlas","mapCoreReady","useMetaAtlasStore","state","isReady"],"sources":["../../../../../src/react/hooks/useDrawing/index.ts"],"sourcesContent":["import { useMetaAtlas } from '../useMetaAtlas';\nimport { useMetaAtlasStore } from '../../stores/useMetaAtlasStore';\nimport { UseDrawingReturn } from './types';\n\nexport function useDrawing(): UseDrawingReturn {\n const { \n drawGeometryOnMap, \n addDrawingsToBaseMap, \n editDrawing, \n removeDrawing, \n getDrawingById, \n isInDrawMode,\n } = useMetaAtlas();\n \n const mapCoreReady = useMetaAtlasStore((state) => state.mapCoreReady);\n\n return {\n drawGeometryOnMap,\n addDrawingsToBaseMap,\n editDrawing,\n removeDrawing,\n getDrawingById,\n isInDrawMode,\n isReady: mapCoreReady, // Use mapCoreReady flag\n };\n}\n\n"],"mappings":";;;;;;;;AAIO,SAASA,UAAUA,CAAA,EAAqB;EAC7C,MAAM;IACJC,iBAAiB;IACjBC,oBAAoB;IACpBC,WAAW;IACXC,aAAa;IACbC,cAAc;IACdC;EACF,CAAC,GAAG,IAAAC,mBAAY,EAAC,CAAC;EAElB,MAAMC,YAAY,GAAG,IAAAC,oCAAiB,EAAEC,KAAK,IAAKA,KAAK,CAACF,YAAY,CAAC;EAErE,OAAO;IACLP,iBAAiB;IACjBC,oBAAoB;IACpBC,WAAW;IACXC,aAAa;IACbC,cAAc;IACdC,YAAY;IACZK,OAAO,EAAEH,YAAY,CAAE;EACzB,CAAC;AACH","ignoreList":[]}
|
|
@@ -4,41 +4,38 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.useFocus = useFocus;
|
|
7
|
-
var
|
|
8
|
-
var _useMetaAtlasStore = require("../../stores/useMetaAtlasStore");
|
|
7
|
+
var _index = require("../useMetaAtlas/index.js");
|
|
8
|
+
var _useMetaAtlasStore = require("../../stores/useMetaAtlasStore.js");
|
|
9
9
|
function useFocus() {
|
|
10
|
-
|
|
11
|
-
focusTo
|
|
12
|
-
getCurrentFocus
|
|
13
|
-
getCurrentFocusBuilding
|
|
14
|
-
getCurrentFocusFloor
|
|
15
|
-
getFocusTree
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
var getBuildingList = function getBuildingList() {
|
|
10
|
+
const {
|
|
11
|
+
focusTo,
|
|
12
|
+
getCurrentFocus,
|
|
13
|
+
getCurrentFocusBuilding,
|
|
14
|
+
getCurrentFocusFloor,
|
|
15
|
+
getFocusTree
|
|
16
|
+
} = (0, _index.useMetaAtlas)();
|
|
17
|
+
const mapCoreReady = (0, _useMetaAtlasStore.useMetaAtlasStore)(state => state.mapCoreReady);
|
|
18
|
+
const getBuildingList = () => {
|
|
20
19
|
if (!mapCoreReady) {
|
|
21
20
|
return [];
|
|
22
21
|
}
|
|
23
|
-
|
|
22
|
+
const focusTree = getFocusTree();
|
|
24
23
|
if (!focusTree || !focusTree.site || !focusTree.site.buildings) {
|
|
25
24
|
return [];
|
|
26
25
|
}
|
|
27
|
-
|
|
28
|
-
|
|
26
|
+
const buildings = [];
|
|
27
|
+
const buildingsObj = focusTree.site.buildings;
|
|
29
28
|
|
|
30
29
|
// Handle both array and object formats
|
|
31
30
|
if (Array.isArray(buildingsObj)) {
|
|
32
|
-
return buildingsObj.map(
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
};
|
|
37
|
-
});
|
|
31
|
+
return buildingsObj.map(building => ({
|
|
32
|
+
name: building.name || '',
|
|
33
|
+
whereTaxonomy: building.taxonomyPath || ''
|
|
34
|
+
}));
|
|
38
35
|
} else {
|
|
39
36
|
// Object format (key-value pairs)
|
|
40
|
-
for (
|
|
41
|
-
|
|
37
|
+
for (const key in buildingsObj) {
|
|
38
|
+
const building = buildingsObj[key];
|
|
42
39
|
if (building && building.taxonomyPath) {
|
|
43
40
|
buildings.push({
|
|
44
41
|
name: building.name || '',
|
|
@@ -49,27 +46,25 @@ function useFocus() {
|
|
|
49
46
|
}
|
|
50
47
|
return buildings;
|
|
51
48
|
};
|
|
52
|
-
|
|
49
|
+
const getLevelList = buildingTaxonomy => {
|
|
53
50
|
if (!mapCoreReady) {
|
|
54
51
|
return [];
|
|
55
52
|
}
|
|
56
|
-
|
|
53
|
+
const focusTree = getFocusTree();
|
|
57
54
|
if (!focusTree || !focusTree.site || !focusTree.site.buildings) {
|
|
58
55
|
return [];
|
|
59
56
|
}
|
|
60
|
-
|
|
61
|
-
|
|
57
|
+
const levels = [];
|
|
58
|
+
const buildingsObj = focusTree.site.buildings;
|
|
62
59
|
|
|
63
60
|
// Find the building by taxonomy path
|
|
64
|
-
|
|
61
|
+
let targetBuilding = null;
|
|
65
62
|
if (Array.isArray(buildingsObj)) {
|
|
66
|
-
targetBuilding = buildingsObj.find(
|
|
67
|
-
return building.taxonomyPath === buildingTaxonomy;
|
|
68
|
-
});
|
|
63
|
+
targetBuilding = buildingsObj.find(building => building.taxonomyPath === buildingTaxonomy);
|
|
69
64
|
} else {
|
|
70
65
|
// Object format (key-value pairs)
|
|
71
|
-
for (
|
|
72
|
-
|
|
66
|
+
for (const key in buildingsObj) {
|
|
67
|
+
const building = buildingsObj[key];
|
|
73
68
|
if (building && building.taxonomyPath === buildingTaxonomy) {
|
|
74
69
|
targetBuilding = building;
|
|
75
70
|
break;
|
|
@@ -79,20 +74,18 @@ function useFocus() {
|
|
|
79
74
|
if (!targetBuilding || !targetBuilding.floors) {
|
|
80
75
|
return [];
|
|
81
76
|
}
|
|
82
|
-
|
|
77
|
+
const floorsObj = targetBuilding.floors;
|
|
83
78
|
|
|
84
79
|
// Handle both array and object formats for floors
|
|
85
80
|
if (Array.isArray(floorsObj)) {
|
|
86
|
-
return floorsObj.map(
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
};
|
|
91
|
-
});
|
|
81
|
+
return floorsObj.map(floor => ({
|
|
82
|
+
name: floor.name || '',
|
|
83
|
+
whereTaxonomy: floor.taxonomyPath || ''
|
|
84
|
+
}));
|
|
92
85
|
} else {
|
|
93
86
|
// Object format (key-value pairs)
|
|
94
|
-
for (
|
|
95
|
-
|
|
87
|
+
for (const key in floorsObj) {
|
|
88
|
+
const floor = floorsObj[key];
|
|
96
89
|
if (floor && floor.taxonomyPath) {
|
|
97
90
|
levels.push({
|
|
98
91
|
name: floor.name || '',
|
|
@@ -103,14 +96,14 @@ function useFocus() {
|
|
|
103
96
|
}
|
|
104
97
|
return levels;
|
|
105
98
|
};
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
99
|
+
const getRootSiteCameraProps = function () {
|
|
100
|
+
let platform = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'web';
|
|
101
|
+
const focusTree = getFocusTree();
|
|
109
102
|
if (!focusTree || !focusTree.site || !focusTree.site.cameraConfigs) {
|
|
110
103
|
return null;
|
|
111
104
|
}
|
|
112
|
-
|
|
113
|
-
|
|
105
|
+
const cameraConfigs = focusTree.site.cameraConfigs;
|
|
106
|
+
const config = cameraConfigs[platform] || cameraConfigs.web || cameraConfigs.mobile;
|
|
114
107
|
if (!config || !config.center || !Array.isArray(config.center) || config.center.length < 2) {
|
|
115
108
|
return null;
|
|
116
109
|
}
|
|
@@ -123,14 +116,14 @@ function useFocus() {
|
|
|
123
116
|
};
|
|
124
117
|
};
|
|
125
118
|
return {
|
|
126
|
-
focusTo
|
|
127
|
-
getCurrentFocus
|
|
128
|
-
getCurrentFocusBuilding
|
|
129
|
-
getCurrentFocusFloor
|
|
130
|
-
getFocusTree
|
|
131
|
-
getBuildingList
|
|
132
|
-
getLevelList
|
|
133
|
-
getRootSiteCameraProps
|
|
119
|
+
focusTo,
|
|
120
|
+
getCurrentFocus,
|
|
121
|
+
getCurrentFocusBuilding,
|
|
122
|
+
getCurrentFocusFloor,
|
|
123
|
+
getFocusTree,
|
|
124
|
+
getBuildingList,
|
|
125
|
+
getLevelList,
|
|
126
|
+
getRootSiteCameraProps,
|
|
134
127
|
isReady: mapCoreReady // Use mapCoreReady flag
|
|
135
128
|
};
|
|
136
129
|
}
|