leaflet-city-mapper 0.1.0 → 0.1.1
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/README.md +1 -1
- package/dist/leaflet-city-mapper-src.js.map +1 -1
- package/dist/leaflet-city-mapper-worker-src.js.map +1 -1
- package/dist/leaflet-city-mapper-worker.js.map +1 -1
- package/dist/leaflet-city-mapper.js.map +1 -1
- package/libs/leaflet-lens.js +151 -151
- package/libs/leaflet.js +3 -3
- package/libs/openlayers-bindings.js +1129 -1129
- package/libs/openlayers-bindings.min.js.map +1 -1
- package/package.json +2 -4
- package/src/animations/cancelCameraAnimation.js +19 -19
- package/src/animations/mapStopPitchBearingAnimation.js +10 -10
- package/src/animations/scheduleCameraAnimation.js +15 -15
- package/src/animations/scheduleMarkerPan.js +14 -14
- package/src/animations/updateZoomCamera.js +25 -25
- package/src/archives/findDirectoryEntry.js +17 -17
- package/src/archives/findTile.js +45 -45
- package/src/archives/getDirectoryEntries.js +30 -30
- package/src/archives/getTileData.js +26 -26
- package/src/archives/readArchiveRange.js +48 -48
- package/src/astronomy/solarTime.js +21 -21
- package/src/camera/cameraMapReady.js +9 -9
- package/src/camera/cleanupCameraMap.js +13 -13
- package/src/camera/constrainCameraToBounds.js +3 -3
- package/src/camera/createSceneCamera.js +25 -25
- package/src/camera/getBearing.js +10 -10
- package/src/camera/getPitch.js +10 -10
- package/src/camera/mapGetBoundsCenterZoom.js +14 -14
- package/src/camera/mapLimitOffset.js +17 -17
- package/src/camera/mapPanBy.js +14 -14
- package/src/camera/setBearing.js +13 -13
- package/src/camera/setPitch.js +13 -13
- package/src/cog/decodeCogTile.js +37 -37
- package/src/cog/finiteCogValues.js +12 -12
- package/src/cog/getCogAssetEntry.js +26 -26
- package/src/cog/getCogBase.js +22 -22
- package/src/cog/getCogHeader.js +10 -10
- package/src/cog/getCogProfile.js +25 -25
- package/src/cog/getCogTile.js +25 -25
- package/src/cog/getColorTile.js +38 -38
- package/src/cog/getElevationTile.js +29 -29
- package/src/cog/hasCogProjection.js +16 -16
- package/src/cog/initCog.js +13 -13
- package/src/cog/invalidCogFullResponse.js +10 -10
- package/src/cog/openCog.js +40 -40
- package/src/cog/openCogAsset.js +22 -22
- package/src/cog/readCog.js +39 -39
- package/src/cog/readCogBlock.js +19 -19
- package/src/cog/readCogBody.js +30 -30
- package/src/cog/readCogDirectories.js +32 -32
- package/src/cog/readCogDirectory.js +34 -34
- package/src/cog/readCogLevel.js +36 -36
- package/src/cog/readCogTag.js +28 -28
- package/src/cog/validCogDimensions.js +15 -15
- package/src/cog/validCogEncoding.js +18 -18
- package/src/cog/validCogGeoArrays.js +17 -17
- package/src/cog/validCogGrid.js +22 -22
- package/src/cog/validCogTileCoordinates.js +13 -13
- package/src/cog/validateCogContainer.js +17 -17
- package/src/cog/validateCogContentRange.js +18 -18
- package/src/cog/validateCogOffsets.js +19 -19
- package/src/cog/validateCogRange.js +16 -16
- package/src/cog/validateCogResponse.js +26 -26
- package/src/collision/collectIntersections.js +41 -41
- package/src/collision/hiddenLightHit.js +19 -19
- package/src/collision/indexTriangle.js +18 -18
- package/src/collision/insideMesh.js +47 -47
- package/src/collision/insideWalker.js +52 -52
- package/src/collision/intersectMeshes.js +40 -40
- package/src/collision/localRay.js +31 -31
- package/src/collision/mergeHits.js +19 -19
- package/src/collision/rayBounds.js +28 -28
- package/src/collision/readTriangle.js +32 -32
- package/src/collision/trafficCollision.js +23 -23
- package/src/collision/transformTriangle.js +18 -18
- package/src/collision/triangleDistance.js +34 -34
- package/src/collision/vertexCount.js +11 -11
- package/src/collision/worldHit.js +30 -30
- package/src/controls/acceptPitchDrag.js +10 -10
- package/src/controls/acceptRotateDrag.js +9 -9
- package/src/controls/addCameraHandler.js +18 -18
- package/src/controls/adjustCameraDrag.js +13 -13
- package/src/controls/cameraDragContextMenu.js +12 -12
- package/src/controls/cameraDragEnd.js +10 -10
- package/src/controls/cameraDragMove.js +31 -31
- package/src/controls/changeCameraTouch.js +17 -17
- package/src/controls/compassOrientation.js +12 -12
- package/src/controls/compassRemoveHooks.js +2 -2
- package/src/controls/containerResizeRemoveHooks.js +2 -2
- package/src/controls/endCameraTouch.js +18 -18
- package/src/controls/failCompassPermission.js +10 -10
- package/src/controls/finishCameraDrag.js +14 -14
- package/src/controls/finishCompassPermission.js +24 -24
- package/src/controls/isEditableTarget.js +9 -9
- package/src/controls/loadCameraControls.js +18 -18
- package/src/controls/moveCameraTouch.js +34 -34
- package/src/controls/refreshRotateFocus.js +5 -5
- package/src/controls/removeCameraDrag.js +28 -28
- package/src/controls/resizeMap.js +7 -7
- package/src/controls/rotateButtonClick.js +16 -16
- package/src/controls/rotateButtonKeydown.js +20 -20
- package/src/controls/rotateControl.js +12 -12
- package/src/controls/shiftRotateRemoveHooks.js +2 -2
- package/src/controls/shiftRotateWheel.js +15 -15
- package/src/core/cameraMarkerOnDrag.js +16 -16
- package/src/core/constructLayer.js +16 -16
- package/src/core/extendLeafletClass.js +12 -12
- package/src/core/extendTerrainPixelBounds.js +41 -41
- package/src/core/layerAddInitHook.js +12 -12
- package/src/core/layerMergeOptions.js +14 -14
- package/src/core/markerInitInteraction.js +10 -10
- package/src/core/markerSetIcon.js +14 -14
- package/src/core/markerSetRotation.js +19 -19
- package/src/core/projectNativePath.js +30 -30
- package/src/core/redrawPath.js +11 -11
- package/src/core/removeLayer.js +26 -26
- package/src/core/setRotation.js +12 -12
- package/src/core/whenReady.js +14 -14
- package/src/geometry/addBridges.js +36 -36
- package/src/geometry/addGeneratedTriangle.js +10 -10
- package/src/geometry/appendAreaTriangle.js +32 -32
- package/src/geometry/appendNativeTriangle.js +17 -17
- package/src/geometry/appendRouteDash.js +33 -33
- package/src/geometry/appendRouteSegment.js +28 -28
- package/src/geometry/assembleAreaGeometry.js +48 -48
- package/src/geometry/bridgeEdge.js +18 -18
- package/src/geometry/bridgeFaces.js +22 -22
- package/src/geometry/bridgePaths.js +19 -19
- package/src/geometry/bridgePolygon.js +37 -37
- package/src/geometry/bridgeSides.js +18 -18
- package/src/geometry/buildProjectedPoint.js +32 -32
- package/src/geometry/buildProjectedPolygon.js +34 -34
- package/src/geometry/circleAt.js +20 -20
- package/src/geometry/circleGeometry.js +41 -41
- package/src/geometry/createModelGeometry.js +44 -44
- package/src/geometry/crossVector.js +15 -15
- package/src/geometry/dashValues.js +23 -23
- package/src/geometry/dashedSegment.js +33 -33
- package/src/geometry/diskAt.js +18 -18
- package/src/geometry/emitter.js +18 -18
- package/src/geometry/fillNativePolygon.js +28 -28
- package/src/geometry/generateTreeGeometry.js +18 -18
- package/src/geometry/indexBridge.js +36 -36
- package/src/geometry/instanceAreaGeometry.js +37 -37
- package/src/geometry/line.js +28 -28
- package/src/geometry/lineJoin.js +35 -35
- package/src/geometry/markerImageBounds.js +20 -20
- package/src/geometry/meshShadowBounds.js +33 -33
- package/src/geometry/offsetBelowGround.js +10 -10
- package/src/geometry/quad.js +23 -23
- package/src/geometry/restoreGeometry.js +29 -29
- package/src/geometry/roofCoverage.js +33 -33
- package/src/geometry/roofFootprint.js +40 -40
- package/src/geometry/samePoint.js +11 -11
- package/src/geometry/segment.js +32 -32
- package/src/geometry/subtractRoofTile.js +28 -28
- package/src/geometry/terrainBuffers.js +36 -36
- package/src/geometry/terrainTileGeometry.js +28 -28
- package/src/geometry/validateTree.js +19 -19
- package/src/globals/L.js +6 -6
- package/src/globals/cameraFov.js +8 -8
- package/src/globals/cogTags.js +6 -6
- package/src/globals/colorTexture.js +11 -11
- package/src/globals/cosObliquity.js +8 -8
- package/src/globals/degrees.js +6 -6
- package/src/globals/earthCirc.js +6 -6
- package/src/globals/geometryWorkerUrl.js +8 -8
- package/src/globals/halfRadians.js +6 -6
- package/src/globals/lampDirections.js +13 -13
- package/src/globals/layerControlAddItem.js +8 -8
- package/src/globals/leafletLayer.js +8 -8
- package/src/globals/lightScale.js +6 -6
- package/src/globals/mvtTextDecoder.js +6 -6
- package/src/globals/nativeScalableStyleKeys.js +6 -6
- package/src/globals/sinObliquity.js +8 -8
- package/src/globals/tau.js +6 -6
- package/src/globals/vectorStyleNamedColors.js +13 -13
- package/src/globals/vectorTileEvents.js +6 -6
- package/src/globals/workerCogSource.js +6 -6
- package/src/gpu/initializeRendererResources.js +39 -39
- package/src/gpu/initializeSharedRenderer.js +59 -59
- package/src/gpu/mountRenderer.js +25 -25
- package/src/layer-controls/layerControlInputId.js +18 -18
- package/src/layer-controls/layerCountTitle.js +16 -16
- package/src/layer-controls/placeEntryElement.js +29 -29
- package/src/layer-controls/renderLayerCount.js +28 -28
- package/src/lighting/visitLightCells.js +26 -26
- package/src/lighting/writeLightCell.js +14 -14
- package/src/materials/createProgramLayout.js +44 -44
- package/src/materials/createProgramUniforms.js +25 -25
- package/src/materials/modelMaterialFor.js +29 -29
- package/src/materials/prepareMeshCutout.js +21 -21
- package/src/materials/terrainRasterProgram.js +65 -65
- package/src/materials/validateRoofMaterial.js +17 -17
- package/src/models/applyModelTransform.js +18 -18
- package/src/models/buildModelNodes.js +24 -24
- package/src/models/createModelContext.js +24 -24
- package/src/models/loadBuffer.js +16 -16
- package/src/models/loadModelResources.js +22 -22
- package/src/models/normalizeAccessor.js +21 -21
- package/src/models/prepareModel.js +29 -29
- package/src/models/prepareModelGeometry.js +35 -35
- package/src/models/prepareModelPrimitive.js +25 -25
- package/src/models/readAccessorValue.js +16 -16
- package/src/models/readModelAttributes.js +32 -32
- package/src/models/readModelIndices.js +28 -28
- package/src/models/readSparseAccessor.js +31 -31
- package/src/models/releaseModelResources.js +15 -15
- package/src/mvt/addMvtCrossings.js +23 -23
- package/src/mvt/appendMvtBandTriangles.js +42 -42
- package/src/mvt/appendMvtCoordinates.js +20 -20
- package/src/mvt/appendMvtPolygonTriangles.js +29 -29
- package/src/mvt/beginMvtPath.js +19 -19
- package/src/mvt/closeMvtPath.js +16 -16
- package/src/mvt/collectMvtEdges.js +29 -29
- package/src/mvt/createMvtReader.js +14 -14
- package/src/mvt/decodeVectorTile.js +39 -39
- package/src/mvt/expectMvtWire.js +11 -11
- package/src/mvt/finishMvtPath.js +14 -14
- package/src/mvt/finiteMvtCoordinate.js +14 -14
- package/src/mvt/groupMvtPolygons.js +35 -35
- package/src/mvt/isMvtFallbackError.js +13 -13
- package/src/mvt/mergeMvtActiveEdges.js +18 -18
- package/src/mvt/mvtEdgeX.js +12 -12
- package/src/mvt/mvtPathsVertices.js +15 -15
- package/src/mvt/mvtPolygonPaths.js +19 -19
- package/src/mvt/numericMvtValue.js +11 -11
- package/src/mvt/readMvtFeature.js +46 -46
- package/src/mvt/readMvtField.js +17 -17
- package/src/mvt/readMvtGeometry.js +42 -42
- package/src/mvt/readMvtInteger.js +22 -22
- package/src/mvt/readMvtKnownValue.js +30 -30
- package/src/mvt/readMvtLayer.js +40 -40
- package/src/mvt/readMvtMessage.js +18 -18
- package/src/mvt/readMvtNumber.js +18 -18
- package/src/mvt/readMvtNumbers.js +18 -18
- package/src/mvt/readMvtString.js +14 -14
- package/src/mvt/readMvtValue.js +29 -29
- package/src/mvt/skipMvtField.js +22 -22
- package/src/mvt/sortMvtActiveEdges.js +20 -20
- package/src/mvt/sortedMvtLevels.js +29 -29
- package/src/mvt/takeMvtBytes.js +18 -18
- package/src/mvt/tessellateVectorRings.js +26 -26
- package/src/mvt/triangulateVectorRings.js +23 -23
- package/src/native/beforeNativeRender.js +21 -21
- package/src/native/bypassNativeEvent.js +21 -21
- package/src/native/canScaleNativeStyle.js +26 -26
- package/src/native/compareNativeHits.js +10 -10
- package/src/native/createNativeMesh.js +46 -46
- package/src/native/forwardNativeError.js +8 -8
- package/src/native/getGridTerrainTile.js +47 -47
- package/src/native/gridTerrainElevation.js +34 -34
- package/src/native/isCurrentNativeLayer.js +11 -11
- package/src/native/loadGridTerrain.js +36 -36
- package/src/native/nativeEventSource.js +27 -27
- package/src/native/nativeProgram.js +28 -28
- package/src/native/nativeTerrainElevation.js +27 -27
- package/src/native/nativeVectorGeometry.js +30 -30
- package/src/native/orderNativeGridLayer.js +20 -20
- package/src/native/prepareGridTerrainRequests.js +23 -23
- package/src/native/pruneNativeResources.js +25 -25
- package/src/native/readyNativeGPU.js +13 -13
- package/src/native/rejectNativeReady.js +2 -2
- package/src/native/removeNativeEvents.js +20 -20
- package/src/native/resolveNativeReady.js +2 -2
- package/src/native/restoreNativeEvents.js +8 -8
- package/src/native/retainGridTerrain.js +15 -15
- package/src/native/styleNativeMesh.js +20 -20
- package/src/native/syncGridTile.js +28 -28
- package/src/native/syncImageOverlay.js +13 -13
- package/src/native/syncNativeStrokeAnchors.js +18 -18
- package/src/native/syncNativeStrokeZoom.js +34 -34
- package/src/native/syncTerrainGridTile.js +38 -38
- package/src/native/terrainGridMesh.js +47 -47
- package/src/native/updateNativeHover.js +15 -15
- package/src/native/updateNativeStrokeRadius.js +14 -14
- package/src/picking/hitColliderCell.js +29 -29
- package/src/picking/validateCameraInverse.js +15 -15
- package/src/projections/displayContainerPoint.js +32 -32
- package/src/projections/projectBridgePoint.js +17 -17
- package/src/projections/toPoint.js +13 -13
- package/src/projections/transformZoomAnimationPoint.js +8 -8
- package/src/projections/verticalGroundY.js +14 -14
- package/src/raster/rasterTileRange.js +32 -32
- package/src/raster/retainRasterTiles.js +21 -21
- package/src/rendering/collectVisibleMesh.js +48 -48
- package/src/rendering/compareMeshDepth.js +14 -14
- package/src/rendering/drawPipeline.js +44 -44
- package/src/rendering/nativeStrokeExpansion.js +11 -11
- package/src/rendering/prepareFrameBuffer.js +24 -24
- package/src/rendering/prepareMeshUniforms.js +36 -36
- package/src/rendering/revealRoofMesh.js +43 -43
- package/src/scene/addSceneLayer.js +24 -24
- package/src/scene/callLayer.js +34 -34
- package/src/scene/createLayer.js +13 -13
- package/src/scene/getLocation.js +12 -12
- package/src/scene/isNativeLayer.js +19 -19
- package/src/scene/removeSceneLayer.js +22 -22
- package/src/scene/reportLayerError.js +9 -9
- package/src/shaders/materialBaseShader.js +26 -26
- package/src/shaders/materialSurfaceShader.js +60 -60
- package/src/shaders/materialVertexShader.js +89 -89
- package/src/shaders/nativeStrokeShader.js +13 -13
- package/src/shaders/roofVertexShader.js +16 -16
- package/src/shadows/shadowMeshMatches.js +19 -19
- package/src/sources/buildAreaFeatures.js +23 -23
- package/src/sources/extrusionStyle.js +21 -21
- package/src/sources/featureAnchor.js +21 -21
- package/src/sources/groundOffset.js +9 -9
- package/src/sources/initVectorTiles.js +21 -21
- package/src/sources/isVectorTileSource.js +11 -11
- package/src/sources/matchesAreaTile.js +17 -17
- package/src/sources/pendingSourceAreas.js +28 -28
- package/src/sources/prepareAreaGeometryJob.js +34 -34
- package/src/sources/projectAreaPolygons.js +25 -25
- package/src/sources/readyVectorTiles.js +17 -17
- package/src/sunlight/addTimeControlToMap.js +18 -18
- package/src/sunlight/addTimeLayer.js +12 -12
- package/src/sunlight/initializeTimeControl.js +18 -18
- package/src/sunlight/onAddSun.js +37 -37
- package/src/sunlight/onAddTimeControl.js +12 -12
- package/src/sunlight/onRemoveSun.js +10 -10
- package/src/sunlight/removeSun.js +25 -25
- package/src/sunlight/removeTimeControl.js +14 -14
- package/src/sunlight/removeTimeLayer.js +11 -11
- package/src/sunlight/requestSunlightRender.js +12 -12
- package/src/sunlight/styleTimeControl.js +13 -13
- package/src/sunlight/tickSun.js +10 -10
- package/src/sunlight/updateCelestialDisc.js +23 -23
- package/src/sunlight/updateSun.js +44 -44
- package/src/sunlight/useLiveTime.js +11 -11
- package/src/sunlight/useSelectedTime.js +26 -26
- package/src/terrain/applyTerrain.js +30 -30
- package/src/terrain/copyTerrainTile.js +20 -20
- package/src/terrain/loadReadyTerrain.js +6 -6
- package/src/terrain/mapElevationOf.js +19 -19
- package/src/terrain/readBridges.js +13 -13
- package/src/terrain/readyTerrainOf.js +14 -14
- package/src/terrain/sampleTerrainTile.js +16 -16
- package/src/terrain/terrainTileQueue.js +34 -34
- package/src/textures/addImageState.js +13 -13
- package/src/textures/bindMeshTextures.js +57 -57
- package/src/textures/collectRoofTiles.js +23 -23
- package/src/textures/loadModelImage.js +29 -29
- package/src/textures/modelTextureFor.js +47 -47
- package/src/textures/prepareMeshTextures.js +31 -31
- package/src/textures/removeImageState.js +13 -13
- package/src/textures/resizeRoofTexture.js +32 -32
- package/src/textures/restoreMaterialTextures.js +22 -22
- package/src/textures/updateRoofAtlas.js +29 -29
- package/src/textures/uploadMeshTexture.js +32 -32
- package/src/textures/uploadNativeImage.js +26 -26
- package/src/textures/uploadRoofTile.js +29 -29
- package/src/traffic/createTrafficMesh.js +17 -17
- package/src/traffic/disposeTrafficObject.js +19 -19
- package/src/traffic/failTraffic.js +12 -12
- package/src/traffic/failedTrafficLoad.js +10 -10
- package/src/traffic/fetchTrafficLanes.js +21 -21
- package/src/traffic/loadedTrafficLanes.js +21 -21
- package/src/traffic/locateTraffic.js +20 -20
- package/src/traffic/moveTraffic.js +21 -21
- package/src/traffic/readyTraffic.js +10 -10
- package/src/traffic/refreshTrafficTrips.js +42 -42
- package/src/traffic/routeColor.js +13 -13
- package/src/traffic/startTraffic.js +12 -12
- package/src/traffic/trafficNow.js +15 -15
- package/src/traffic/trafficStatusText.js +13 -13
- package/src/traffic/trafficStorage.js +13 -13
- package/src/traffic/updateTraffic.js +13 -13
- package/src/traffic/updateTrafficLights.js +23 -23
- package/src/traffic/updateTrafficPose.js +15 -15
- package/src/traffic/updateTrafficTerrain.js +15 -15
- package/src/traffic/uploadTrafficLanes.js +27 -27
- package/src/transforms/composeLocalTransform.js +23 -23
- package/src/transforms/transformNativePoint.js +19 -19
- package/src/transforms/worldMatrixChanged.js +26 -26
- package/src/triangulation/clipEars.js +32 -32
- package/src/triangulation/connectHole.js +30 -30
- package/src/triangulation/cross.js +12 -12
- package/src/triangulation/equal.js +11 -11
- package/src/triangulation/intersects.js +21 -21
- package/src/triangulation/mergeHoles.js +19 -19
- package/src/triangulation/on.js +13 -13
- package/src/triangulation/polygonRings.js +22 -22
- package/src/triangulation/validateArea.js +19 -19
- package/src/utils/compareDistance.js +11 -11
- package/src/utils/yieldTask.js +12 -12
- package/src/vector-style/appendQuotedStyleCharacter.js +30 -30
- package/src/vector-style/arrayContainsRange.js +18 -18
- package/src/vector-style/evaluateBoolean.js +31 -31
- package/src/vector-style/evaluateCoalesceOrCase.js +34 -34
- package/src/vector-style/evaluateComparison.js +29 -29
- package/src/vector-style/evaluateIExpression.js +21 -21
- package/src/vector-style/evaluateInput.js +16 -16
- package/src/vector-style/evaluateInterpolate.js +36 -36
- package/src/vector-style/evaluateMatch.js +21 -21
- package/src/vector-style/evaluateMath.js +26 -26
- package/src/vector-style/evaluateMembership.js +29 -29
- package/src/vector-style/evaluateNegation.js +26 -26
- package/src/vector-style/evaluatePrimitive.js +21 -21
- package/src/vector-style/evaluateStep.js +20 -20
- package/src/vector-style/evaluateStyle.js +43 -43
- package/src/vector-style/evaluateToExpression.js +27 -27
- package/src/vector-style/fillVectorPaint.js +26 -26
- package/src/vector-style/lineVectorPaint.js +31 -31
- package/src/vector-style/parseFunctionalColor.js +23 -23
- package/src/vector-style/parseHexColor.js +20 -20
- package/src/vector-style/parseVectorStyle.js +20 -20
- package/src/vector-style/readPaintValue.js +17 -17
- package/src/vector-style/removeTrailingCommas.js +19 -19
- package/src/vector-style/scaleDashArray.js +25 -25
- package/src/vector-style/skipStyleComment.js +20 -20
- package/src/vector-style/stripStyleComments.js +28 -28
- package/src/vector-style/styleColor.js +18 -18
- package/src/vector-style/validateVectorLayers.js +18 -18
- package/src/vector-style/vectorPaint.js +17 -17
- package/src/vector-style/visibleStyle.js +16 -16
- package/src/vector-tiles/appendVectorBatch.js +34 -34
- package/src/vector-tiles/attachVectorTileBatch.js +25 -25
- package/src/vector-tiles/attachVectorTileBatches.js +26 -26
- package/src/vector-tiles/compareVectorLabelPriority.js +11 -11
- package/src/vector-tiles/compareVectorTileDistance.js +11 -11
- package/src/vector-tiles/createVectorLabel.js +37 -37
- package/src/vector-tiles/forwardVectorTileError.js +10 -10
- package/src/vector-tiles/loadVectorSprite.js +14 -14
- package/src/vector-tiles/loadVectorTile.js +45 -45
- package/src/vector-tiles/onVectorTileAdd.js +44 -44
- package/src/vector-tiles/onVectorTileMessage.js +15 -15
- package/src/vector-tiles/onVectorTileRemove.js +25 -25
- package/src/vector-tiles/onVectorTileWorkerError.js +16 -16
- package/src/vector-tiles/paintVectorTileBatch.js +18 -18
- package/src/vector-tiles/prepareVectorLabel.js +34 -34
- package/src/vector-tiles/prepareVectorStyleLayer.js +38 -38
- package/src/vector-tiles/prepareVectorTile.js +29 -29
- package/src/vector-tiles/projectVectorPaths.js +25 -25
- package/src/vector-tiles/projectVectorPoint.js +15 -15
- package/src/vector-tiles/projectVectorTriangles.js +28 -28
- package/src/vector-tiles/pruneVectorTiles.js +14 -14
- package/src/vector-tiles/pumpVectorTiles.js +21 -21
- package/src/vector-tiles/readTileJSON.js +27 -27
- package/src/vector-tiles/readVectorStyle.js +28 -28
- package/src/vector-tiles/refreshVectorTiles.js +8 -8
- package/src/vector-tiles/reserveVectorLabelCells.js +14 -14
- package/src/vector-tiles/retireVectorTileGroup.js +20 -20
- package/src/vector-tiles/revokeVectorWorkerUrl.js +14 -14
- package/src/vector-tiles/rotateVectorLabel.js +19 -19
- package/src/vector-tiles/rotateVectorLabels.js +9 -9
- package/src/vector-tiles/simplifyVectorPath.js +29 -29
- package/src/vector-tiles/updateVectorLabelMarker.js +36 -36
- package/src/vector-tiles/updateVectorLabelStyle.js +14 -14
- package/src/vector-tiles/updateVectorTileLabels.js +33 -33
- package/src/vector-tiles/updateVectorTilePaint.js +25 -25
- package/src/vector-tiles/updateVectorTiles.js +32 -32
- package/src/vector-tiles/validateVectorTileZooms.js +15 -15
- package/src/vector-tiles/vectorFeaturePaint.js +25 -25
- package/src/vector-tiles/vectorFeaturePaths.js +26 -26
- package/src/vector-tiles/vectorFeatureZoom.js +18 -18
- package/src/vector-tiles/vectorLabelAnchors.js +31 -31
- package/src/vector-tiles/vectorLabelCandidates.js +18 -18
- package/src/vector-tiles/vectorLabelCells.js +32 -32
- package/src/vector-tiles/vectorLabelIcon.js +38 -38
- package/src/vector-tiles/vectorLabelProperty.js +12 -12
- package/src/vector-tiles/vectorLabelText.js +19 -19
- package/src/vector-tiles/vectorSpriteIcon.js +19 -19
- package/src/vector-tiles/vectorStraightRun.js +23 -23
- package/src/vector-tiles/vectorStyleDependencies.js +22 -22
- package/src/vector-tiles/vectorStyleValue.js +16 -16
- package/src/vector-tiles/vectorStyleZoom.js +12 -12
- package/src/vector-tiles/vectorTileAwaited.js +17 -17
- package/src/vector-tiles/vectorTileOverlaps.js +12 -12
- package/src/vector-tiles/vectorTilePaint.js +18 -18
- package/src/vector-tiles/vectorTileSettings.js +27 -27
- package/src/vector-tiles/vectorTilesIdle.js +11 -11
- package/src/vector-tiles/vectorTolerance.js +11 -11
- package/src/vector-tiles/wrapVectorLabel.js +17 -17
- package/src/vehicles/boatModel.js +35 -35
- package/src/vehicles/busModel.js +13 -13
- package/src/vehicles/carModel.js +39 -39
- package/src/walk/initializeWalkControl.js +12 -12
- package/src/walk/isWalkBlocked.js +15 -15
- package/src/walk/landWalker.js +41 -41
- package/src/walk/moveWalker.js +37 -37
- package/src/walk/onAddWalkControl.js +40 -40
- package/src/walk/onRemoveWalkControl.js +17 -17
- package/src/walk/onWalkBlur.js +3 -3
- package/src/walk/onWalkTerrain.js +3 -3
- package/src/walk/resolveWalkerPosition.js +33 -33
- package/src/walk/stepWalkerHeight.js +18 -18
- package/src/walk/toggleWalking.js +4 -4
- package/src/walk/updateWalkerFrame.js +29 -29
- package/src/walk/updateWalkerView.js +31 -31
- package/src/weakmaps/cameraHandlersByMap.js +6 -6
- package/src/weakmaps/geometryWorkersByMap.js +6 -6
- package/src/weakmaps/nativeProgramsByRenderer.js +6 -6
- package/src/weakmaps/pathProjectionByMap.js +6 -6
- package/src/weakmaps/streamTerrainByLayer.js +6 -6
- package/src/weakmaps/streamTerrainByMap.js +6 -6
- package/src/weakmaps/sunByMap.js +6 -6
- package/src/weakmaps/vectorTileOptionsByLayer.js +6 -6
- package/src/weakmaps/vectorWorkerByLayer.js +6 -6
- package/src/weakmaps/walkByMap.js +6 -6
- package/src/weakmaps/workerMapByLayer.js +6 -6
- package/src/workers/acquireGeometryWorker.js +39 -39
- package/src/workers/buildAreaInWorker.js +24 -24
- package/src/workers/closeGeometryWorkers.js +16 -16
- package/src/workers/cogWorker.js +27 -27
- package/src/workers/createGeometryWorker.js +30 -30
- package/src/workers/geometryWorker.js +34 -34
- package/src/workers/getCogInWorker.js +18 -18
- package/src/workers/modelWorker.js +17 -17
- package/src/workers/openCogInWorker.js +22 -22
- package/src/workers/runSourceWorker.js +44 -44
- package/src/workers/settleGeometryWorker.js +16 -16
- package/src/workers/startGeometryWorker.js +23 -23
- package/src/workers/vectorTileWorker.js +15 -15
|
@@ -1,29 +1,29 @@
|
|
|
1
|
-
import { decodeVectorTile } from '../mvt/decodeVectorTile.js';
|
|
2
|
-
import { prepareVectorStyleLayer } from './prepareVectorStyleLayer.js';
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* Decode a vector tile and prepare its styled geometry and label candidates.
|
|
6
|
-
*
|
|
7
|
-
* @param {ArrayBuffer} buffer Encoded vector tile.
|
|
8
|
-
* @param {Object} coords Tile coordinates.
|
|
9
|
-
* @param {Array} style Style layer entries.
|
|
10
|
-
* @param {number} zoom Style zoom.
|
|
11
|
-
* @param {string} source Optional source identifier.
|
|
12
|
-
* @param {number} maxZoom Maximum map zoom for style evaluation.
|
|
13
|
-
* @param {number} mapZoom Current map zoom.
|
|
14
|
-
*
|
|
15
|
-
* @returns {Object} Prepared batches and labels.
|
|
16
|
-
*/
|
|
17
|
-
export function prepareVectorTile(buffer, coords, style, zoom, source, maxZoom = 19, mapZoom = zoom) {
|
|
18
|
-
const layers = decodeVectorTile(buffer), byName = /* alloc */ new Map();
|
|
19
|
-
const job = /* alloc */ { coords, zoom, mapZoom, maxZoom, output: /* alloc */ [], labels: /* alloc */ [],
|
|
20
|
-
triangles: /* alloc */ new WeakMap(), projected: /* alloc */ new WeakMap() };
|
|
21
|
-
let layer, order, entry;
|
|
22
|
-
for (layer of layers) byName.set(layer.name, layer);
|
|
23
|
-
for ([order, entry] of style.entries()) {
|
|
24
|
-
layer = byName.get(entry['source-layer']);
|
|
25
|
-
if (!layer || source !== undefined && entry.source !== source) continue;
|
|
26
|
-
prepareVectorStyleLayer(job, layer, entry, order);
|
|
27
|
-
}
|
|
28
|
-
return /* alloc */ { batches: job.output, labels: job.labels };
|
|
29
|
-
}
|
|
1
|
+
import { decodeVectorTile } from '../mvt/decodeVectorTile.js';
|
|
2
|
+
import { prepareVectorStyleLayer } from './prepareVectorStyleLayer.js';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Decode a vector tile and prepare its styled geometry and label candidates.
|
|
6
|
+
*
|
|
7
|
+
* @param {ArrayBuffer} buffer Encoded vector tile.
|
|
8
|
+
* @param {Object} coords Tile coordinates.
|
|
9
|
+
* @param {Array} style Style layer entries.
|
|
10
|
+
* @param {number} zoom Style zoom.
|
|
11
|
+
* @param {string} source Optional source identifier.
|
|
12
|
+
* @param {number} maxZoom Maximum map zoom for style evaluation.
|
|
13
|
+
* @param {number} mapZoom Current map zoom.
|
|
14
|
+
*
|
|
15
|
+
* @returns {Object} Prepared batches and labels.
|
|
16
|
+
*/
|
|
17
|
+
export function prepareVectorTile(buffer, coords, style, zoom, source, maxZoom = 19, mapZoom = zoom) {
|
|
18
|
+
const layers = decodeVectorTile(buffer), byName = /* alloc */ new Map();
|
|
19
|
+
const job = /* alloc */ { coords, zoom, mapZoom, maxZoom, output: /* alloc */ [], labels: /* alloc */ [],
|
|
20
|
+
triangles: /* alloc */ new WeakMap(), projected: /* alloc */ new WeakMap() };
|
|
21
|
+
let layer, order, entry;
|
|
22
|
+
for (layer of layers) byName.set(layer.name, layer);
|
|
23
|
+
for ([order, entry] of style.entries()) {
|
|
24
|
+
layer = byName.get(entry['source-layer']);
|
|
25
|
+
if (!layer || source !== undefined && entry.source !== source) continue;
|
|
26
|
+
prepareVectorStyleLayer(job, layer, entry, order);
|
|
27
|
+
}
|
|
28
|
+
return /* alloc */ { batches: job.output, labels: job.labels };
|
|
29
|
+
}
|
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
import { projectVectorPoint } from './projectVectorPoint.js';
|
|
2
|
-
import { simplifyVectorPath } from './simplifyVectorPath.js';
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* Simplify and project tile geometry paths to geographic coordinates.
|
|
6
|
-
*
|
|
7
|
-
* @param {Array} geometry Tile coordinate paths.
|
|
8
|
-
* @param {Object} coords Tile coordinates.
|
|
9
|
-
* @param {number} extent Tile coordinate extent.
|
|
10
|
-
* @param {number} tolerance Simplification tolerance.
|
|
11
|
-
*
|
|
12
|
-
* @returns {Array} Projected paths.
|
|
13
|
-
*/
|
|
14
|
-
export function projectVectorPaths(geometry, coords, extent, tolerance) {
|
|
15
|
-
const paths = /* alloc */ [];
|
|
16
|
-
let path, simplified, projected, point;
|
|
17
|
-
for (path of geometry) {
|
|
18
|
-
simplified = simplifyVectorPath(path, tolerance);
|
|
19
|
-
if (simplified.length < 3 && Math.hypot(simplified.at(-1)[0] - simplified[0][0], simplified.at(-1)[1] - simplified[0][1]) < tolerance * 2) continue;
|
|
20
|
-
projected = /* alloc */ [];
|
|
21
|
-
for (point of simplified) projected.push(projectVectorPoint(point, coords, extent));
|
|
22
|
-
paths.push(projected);
|
|
23
|
-
}
|
|
24
|
-
return paths;
|
|
25
|
-
}
|
|
1
|
+
import { projectVectorPoint } from './projectVectorPoint.js';
|
|
2
|
+
import { simplifyVectorPath } from './simplifyVectorPath.js';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Simplify and project tile geometry paths to geographic coordinates.
|
|
6
|
+
*
|
|
7
|
+
* @param {Array} geometry Tile coordinate paths.
|
|
8
|
+
* @param {Object} coords Tile coordinates.
|
|
9
|
+
* @param {number} extent Tile coordinate extent.
|
|
10
|
+
* @param {number} tolerance Simplification tolerance.
|
|
11
|
+
*
|
|
12
|
+
* @returns {Array} Projected paths.
|
|
13
|
+
*/
|
|
14
|
+
export function projectVectorPaths(geometry, coords, extent, tolerance) {
|
|
15
|
+
const paths = /* alloc */ [];
|
|
16
|
+
let path, simplified, projected, point;
|
|
17
|
+
for (path of geometry) {
|
|
18
|
+
simplified = simplifyVectorPath(path, tolerance);
|
|
19
|
+
if (simplified.length < 3 && Math.hypot(simplified.at(-1)[0] - simplified[0][0], simplified.at(-1)[1] - simplified[0][1]) < tolerance * 2) continue;
|
|
20
|
+
projected = /* alloc */ [];
|
|
21
|
+
for (point of simplified) projected.push(projectVectorPoint(point, coords, extent));
|
|
22
|
+
paths.push(projected);
|
|
23
|
+
}
|
|
24
|
+
return paths;
|
|
25
|
+
}
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Project a vector tile point into latitude and longitude.
|
|
3
|
-
*
|
|
4
|
-
* @param {Array<number>} point Tile-local coordinates.
|
|
5
|
-
* @param {Object} coords Tile coordinates.
|
|
6
|
-
* @param {number} extent Tile coordinate extent.
|
|
7
|
-
*
|
|
8
|
-
* @returns {Array<number>} Latitude and longitude.
|
|
9
|
-
*/
|
|
10
|
-
export function projectVectorPoint(point, coords, extent) {
|
|
11
|
-
const size = 2 ** coords.z;
|
|
12
|
-
const x = (coords.x + point[0] / extent) / size;
|
|
13
|
-
const y = (coords.y + point[1] / extent) / size;
|
|
14
|
-
return /* alloc */ [Math.atan(Math.sinh(Math.PI * (1 - 2 * y))) * 180 / Math.PI, x * 360 - 180];
|
|
15
|
-
}
|
|
1
|
+
/**
|
|
2
|
+
* Project a vector tile point into latitude and longitude.
|
|
3
|
+
*
|
|
4
|
+
* @param {Array<number>} point Tile-local coordinates.
|
|
5
|
+
* @param {Object} coords Tile coordinates.
|
|
6
|
+
* @param {number} extent Tile coordinate extent.
|
|
7
|
+
*
|
|
8
|
+
* @returns {Array<number>} Latitude and longitude.
|
|
9
|
+
*/
|
|
10
|
+
export function projectVectorPoint(point, coords, extent) {
|
|
11
|
+
const size = 2 ** coords.z;
|
|
12
|
+
const x = (coords.x + point[0] / extent) / size;
|
|
13
|
+
const y = (coords.y + point[1] / extent) / size;
|
|
14
|
+
return /* alloc */ [Math.atan(Math.sinh(Math.PI * (1 - 2 * y))) * 180 / Math.PI, x * 360 - 180];
|
|
15
|
+
}
|
|
@@ -1,28 +1,28 @@
|
|
|
1
|
-
import { triangulateVectorRings } from '../mvt/triangulateVectorRings.js';
|
|
2
|
-
import { projectVectorPoint } from './projectVectorPoint.js';
|
|
3
|
-
import { simplifyVectorPath } from './simplifyVectorPath.js';
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Simplify polygon rings, triangulate them and project their vertices.
|
|
7
|
-
*
|
|
8
|
-
* @param {Array} geometry Tile coordinate rings.
|
|
9
|
-
* @param {Object} coords Tile coordinates.
|
|
10
|
-
* @param {number} extent Tile coordinate extent.
|
|
11
|
-
* @param {number} tolerance Simplification tolerance.
|
|
12
|
-
*
|
|
13
|
-
* @returns {Array} Projected triangle paths.
|
|
14
|
-
*/
|
|
15
|
-
export function projectVectorTriangles(geometry, coords, extent, tolerance) {
|
|
16
|
-
const paths = /* alloc */ [], rings = /* alloc */ [];
|
|
17
|
-
let triangle, projected, point, ring;
|
|
18
|
-
for (ring of geometry) {
|
|
19
|
-
ring = simplifyVectorPath(ring, tolerance);
|
|
20
|
-
if (ring.length >= 4) rings.push(ring);
|
|
21
|
-
}
|
|
22
|
-
for (triangle of triangulateVectorRings(rings)) {
|
|
23
|
-
projected = /* alloc */ [];
|
|
24
|
-
for (point of triangle) projected.push(projectVectorPoint(point, coords, extent));
|
|
25
|
-
paths.push(/* alloc */ [projected]);
|
|
26
|
-
}
|
|
27
|
-
return paths;
|
|
28
|
-
}
|
|
1
|
+
import { triangulateVectorRings } from '../mvt/triangulateVectorRings.js';
|
|
2
|
+
import { projectVectorPoint } from './projectVectorPoint.js';
|
|
3
|
+
import { simplifyVectorPath } from './simplifyVectorPath.js';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Simplify polygon rings, triangulate them and project their vertices.
|
|
7
|
+
*
|
|
8
|
+
* @param {Array} geometry Tile coordinate rings.
|
|
9
|
+
* @param {Object} coords Tile coordinates.
|
|
10
|
+
* @param {number} extent Tile coordinate extent.
|
|
11
|
+
* @param {number} tolerance Simplification tolerance.
|
|
12
|
+
*
|
|
13
|
+
* @returns {Array} Projected triangle paths.
|
|
14
|
+
*/
|
|
15
|
+
export function projectVectorTriangles(geometry, coords, extent, tolerance) {
|
|
16
|
+
const paths = /* alloc */ [], rings = /* alloc */ [];
|
|
17
|
+
let triangle, projected, point, ring;
|
|
18
|
+
for (ring of geometry) {
|
|
19
|
+
ring = simplifyVectorPath(ring, tolerance);
|
|
20
|
+
if (ring.length >= 4) rings.push(ring);
|
|
21
|
+
}
|
|
22
|
+
for (triangle of triangulateVectorRings(rings)) {
|
|
23
|
+
projected = /* alloc */ [];
|
|
24
|
+
for (point of triangle) projected.push(projectVectorPoint(point, coords, extent));
|
|
25
|
+
paths.push(/* alloc */ [projected]);
|
|
26
|
+
}
|
|
27
|
+
return paths;
|
|
28
|
+
}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { reportError } from '../scene/reportLayerError.js';
|
|
2
|
-
import { vectorTileAwaited } from './vectorTileAwaited.js';
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* Cancel unneeded vector tiles and retire groups no longer needed as fallbacks.
|
|
6
|
-
*/
|
|
7
|
-
export function pruneVectorTiles() {
|
|
8
|
-
let tile, key;
|
|
9
|
-
for ([key, tile] of this.tiles) {
|
|
10
|
-
if (tile.needed || tile.group && vectorTileAwaited(this, tile)) continue;
|
|
11
|
-
tile.controller.abort(); this.tiles.delete(key);
|
|
12
|
-
if (tile.group) this.retire(tile.group).catch(reportError.bind(null, this));
|
|
13
|
-
}
|
|
14
|
-
}
|
|
1
|
+
import { reportError } from '../scene/reportLayerError.js';
|
|
2
|
+
import { vectorTileAwaited } from './vectorTileAwaited.js';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Cancel unneeded vector tiles and retire groups no longer needed as fallbacks.
|
|
6
|
+
*/
|
|
7
|
+
export function pruneVectorTiles() {
|
|
8
|
+
let tile, key;
|
|
9
|
+
for ([key, tile] of this.tiles) {
|
|
10
|
+
if (tile.needed || tile.group && vectorTileAwaited(this, tile)) continue;
|
|
11
|
+
tile.controller.abort(); this.tiles.delete(key);
|
|
12
|
+
if (tile.group) this.retire(tile.group).catch(reportError.bind(null, this));
|
|
13
|
+
}
|
|
14
|
+
}
|
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
import { compareVectorTileDistance } from './compareVectorTileDistance.js';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Start pending needed tiles nearest the map center, up to the concurrency limit.
|
|
5
|
-
*/
|
|
6
|
-
export function pumpVectorTiles() {
|
|
7
|
-
if (!this.session) return;
|
|
8
|
-
const center = this._map.getCenter(), pending = /* alloc */ [];
|
|
9
|
-
let tile, point;
|
|
10
|
-
for (tile of this.tiles.values()) {
|
|
11
|
-
if (!tile.needed || tile.started) continue;
|
|
12
|
-
point = this._map.project(center, tile.coords.z).divideBy(256);
|
|
13
|
-
tile.distance = (tile.coords.x - point.x) ** 2 + (tile.coords.y - point.y) ** 2;
|
|
14
|
-
pending.push(tile);
|
|
15
|
-
}
|
|
16
|
-
pending.sort(compareVectorTileDistance);
|
|
17
|
-
for (tile of pending) {
|
|
18
|
-
if (this.inflight >= 4) break;
|
|
19
|
-
tile.started = true; this.inflight++; this.load(tile);
|
|
20
|
-
}
|
|
21
|
-
}
|
|
1
|
+
import { compareVectorTileDistance } from './compareVectorTileDistance.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Start pending needed tiles nearest the map center, up to the concurrency limit.
|
|
5
|
+
*/
|
|
6
|
+
export function pumpVectorTiles() {
|
|
7
|
+
if (!this.session) return;
|
|
8
|
+
const center = this._map.getCenter(), pending = /* alloc */ [];
|
|
9
|
+
let tile, point;
|
|
10
|
+
for (tile of this.tiles.values()) {
|
|
11
|
+
if (!tile.needed || tile.started) continue;
|
|
12
|
+
point = this._map.project(center, tile.coords.z).divideBy(256);
|
|
13
|
+
tile.distance = (tile.coords.x - point.x) ** 2 + (tile.coords.y - point.y) ** 2;
|
|
14
|
+
pending.push(tile);
|
|
15
|
+
}
|
|
16
|
+
pending.sort(compareVectorTileDistance);
|
|
17
|
+
for (tile of pending) {
|
|
18
|
+
if (this.inflight >= 4) break;
|
|
19
|
+
tile.started = true; this.inflight++; this.load(tile);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
@@ -1,27 +1,27 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Fetch TileJSON metadata and merge its tile URL and defaults into source options.
|
|
3
|
-
*
|
|
4
|
-
* @param {Object} options Source options including the TileJSON URL.
|
|
5
|
-
*
|
|
6
|
-
* @returns {Promise<Object>} Options with resolved tile URL and metadata.
|
|
7
|
-
*
|
|
8
|
-
* @throws {Error} If the metadata request returns an unsuccessful status.
|
|
9
|
-
* @throws {Error} If the metadata lacks a tile URL template.
|
|
10
|
-
*/
|
|
11
|
-
export async function readTileJSON(options) {
|
|
12
|
-
const url = /* alloc */ new URL(options.tileJSON, document.baseURI).href;
|
|
13
|
-
const response = await fetch(url);
|
|
14
|
-
if (!response.ok) throw /* alloc */ new Error(`TileJSON: HTTP ${response.status}`);
|
|
15
|
-
const metadata = await response.json();
|
|
16
|
-
if (!metadata || !Array.isArray(metadata.tiles) || !metadata.tiles.length ||
|
|
17
|
-
typeof metadata.tiles[0] !== 'string') {
|
|
18
|
-
throw /* alloc */ new Error('TileJSON requires a tile URL template');
|
|
19
|
-
}
|
|
20
|
-
return /* alloc */ {
|
|
21
|
-
...options,
|
|
22
|
-
url: /* alloc */ new URL(metadata.tiles[0], url).href,
|
|
23
|
-
minNativeZoom: options.minNativeZoom ?? metadata.minzoom,
|
|
24
|
-
maxNativeZoom: options.maxNativeZoom ?? metadata.maxzoom,
|
|
25
|
-
attribution: options.attribution ?? metadata.attribution,
|
|
26
|
-
};
|
|
27
|
-
}
|
|
1
|
+
/**
|
|
2
|
+
* Fetch TileJSON metadata and merge its tile URL and defaults into source options.
|
|
3
|
+
*
|
|
4
|
+
* @param {Object} options Source options including the TileJSON URL.
|
|
5
|
+
*
|
|
6
|
+
* @returns {Promise<Object>} Options with resolved tile URL and metadata.
|
|
7
|
+
*
|
|
8
|
+
* @throws {Error} If the metadata request returns an unsuccessful status.
|
|
9
|
+
* @throws {Error} If the metadata lacks a tile URL template.
|
|
10
|
+
*/
|
|
11
|
+
export async function readTileJSON(options) {
|
|
12
|
+
const url = /* alloc */ new URL(options.tileJSON, document.baseURI).href;
|
|
13
|
+
const response = await fetch(url);
|
|
14
|
+
if (!response.ok) throw /* alloc */ new Error(`TileJSON: HTTP ${response.status}`);
|
|
15
|
+
const metadata = await response.json();
|
|
16
|
+
if (!metadata || !Array.isArray(metadata.tiles) || !metadata.tiles.length ||
|
|
17
|
+
typeof metadata.tiles[0] !== 'string') {
|
|
18
|
+
throw /* alloc */ new Error('TileJSON requires a tile URL template');
|
|
19
|
+
}
|
|
20
|
+
return /* alloc */ {
|
|
21
|
+
...options,
|
|
22
|
+
url: /* alloc */ new URL(metadata.tiles[0], url).href,
|
|
23
|
+
minNativeZoom: options.minNativeZoom ?? metadata.minzoom,
|
|
24
|
+
maxNativeZoom: options.maxNativeZoom ?? metadata.maxzoom,
|
|
25
|
+
attribution: options.attribution ?? metadata.attribution,
|
|
26
|
+
};
|
|
27
|
+
}
|
|
@@ -1,28 +1,28 @@
|
|
|
1
|
-
import { parseVectorStyle } from '../vector-style/parseVectorStyle.js';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Load or extract vector style layers and validate their identifiers and types.
|
|
5
|
-
*
|
|
6
|
-
* @param {string|Object|Array} style Style URL, document or layer array.
|
|
7
|
-
*
|
|
8
|
-
* @returns {Promise<Array>} Validated style layers.
|
|
9
|
-
*
|
|
10
|
-
* @throws {Error} If the style request returns an unsuccessful status.
|
|
11
|
-
* @throws {Error} If the style does not contain a layer array.
|
|
12
|
-
* @throws {Error} If a style layer lacks a string identifier or type.
|
|
13
|
-
*/
|
|
14
|
-
export async function readVectorStyle(style) {
|
|
15
|
-
if (typeof style === 'string') {
|
|
16
|
-
const response = await fetch(style);
|
|
17
|
-
if (!response.ok) throw /* alloc */ new Error(`Vector style: HTTP ${response.status}`);
|
|
18
|
-
style = parseVectorStyle(await response.text());
|
|
19
|
-
} else style = style?.layers ?? style;
|
|
20
|
-
if (!Array.isArray(style)) throw /* alloc */ new Error('Invalid vector style layers');
|
|
21
|
-
let entry;
|
|
22
|
-
for (entry of style) {
|
|
23
|
-
if (!entry || typeof entry.id !== 'string' || typeof entry.type !== 'string') {
|
|
24
|
-
throw /* alloc */ new Error('Invalid vector style layers');
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
return style;
|
|
28
|
-
}
|
|
1
|
+
import { parseVectorStyle } from '../vector-style/parseVectorStyle.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Load or extract vector style layers and validate their identifiers and types.
|
|
5
|
+
*
|
|
6
|
+
* @param {string|Object|Array} style Style URL, document or layer array.
|
|
7
|
+
*
|
|
8
|
+
* @returns {Promise<Array>} Validated style layers.
|
|
9
|
+
*
|
|
10
|
+
* @throws {Error} If the style request returns an unsuccessful status.
|
|
11
|
+
* @throws {Error} If the style does not contain a layer array.
|
|
12
|
+
* @throws {Error} If a style layer lacks a string identifier or type.
|
|
13
|
+
*/
|
|
14
|
+
export async function readVectorStyle(style) {
|
|
15
|
+
if (typeof style === 'string') {
|
|
16
|
+
const response = await fetch(style);
|
|
17
|
+
if (!response.ok) throw /* alloc */ new Error(`Vector style: HTTP ${response.status}`);
|
|
18
|
+
style = parseVectorStyle(await response.text());
|
|
19
|
+
} else style = style?.layers ?? style;
|
|
20
|
+
if (!Array.isArray(style)) throw /* alloc */ new Error('Invalid vector style layers');
|
|
21
|
+
let entry;
|
|
22
|
+
for (entry of style) {
|
|
23
|
+
if (!entry || typeof entry.id !== 'string' || typeof entry.type !== 'string') {
|
|
24
|
+
throw /* alloc */ new Error('Invalid vector style layers');
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
return style;
|
|
28
|
+
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Debounce vector tile updates after map changes.
|
|
3
|
-
*/
|
|
4
|
-
export function refreshVectorTiles() {
|
|
5
|
-
clearTimeout(this.timer);
|
|
6
|
-
this.changedAt = performance.now();
|
|
7
|
-
this.timer = setTimeout(this.update.bind(this), 180);
|
|
8
|
-
}
|
|
1
|
+
/**
|
|
2
|
+
* Debounce vector tile updates after map changes.
|
|
3
|
+
*/
|
|
4
|
+
export function refreshVectorTiles() {
|
|
5
|
+
clearTimeout(this.timer);
|
|
6
|
+
this.changedAt = performance.now();
|
|
7
|
+
this.timer = setTimeout(this.update.bind(this), 180);
|
|
8
|
+
}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Reserve label cells only if none are already occupied.
|
|
3
|
-
*
|
|
4
|
-
* @param {Iterable<string>} cells Cells required by the label.
|
|
5
|
-
* @param {Set<string>} occupied Previously occupied cells.
|
|
6
|
-
*
|
|
7
|
-
* @returns {boolean} Whether the cells were reserved.
|
|
8
|
-
*/
|
|
9
|
-
export function reserveVectorLabelCells(cells, occupied) {
|
|
10
|
-
let cell;
|
|
11
|
-
for (cell of cells) if (occupied.has(cell)) return false;
|
|
12
|
-
for (cell of cells) occupied.add(cell);
|
|
13
|
-
return true;
|
|
14
|
-
}
|
|
1
|
+
/**
|
|
2
|
+
* Reserve label cells only if none are already occupied.
|
|
3
|
+
*
|
|
4
|
+
* @param {Iterable<string>} cells Cells required by the label.
|
|
5
|
+
* @param {Set<string>} occupied Previously occupied cells.
|
|
6
|
+
*
|
|
7
|
+
* @returns {boolean} Whether the cells were reserved.
|
|
8
|
+
*/
|
|
9
|
+
export function reserveVectorLabelCells(cells, occupied) {
|
|
10
|
+
let cell;
|
|
11
|
+
for (cell of cells) if (occupied.has(cell)) return false;
|
|
12
|
+
for (cell of cells) occupied.add(cell);
|
|
13
|
+
return true;
|
|
14
|
+
}
|
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
import { yieldTask } from '../utils/yieldTask.js';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Remove a tile group's layers incrementally while its session remains current.
|
|
5
|
-
*
|
|
6
|
-
* @param {Object} group Leaflet layer group to retire.
|
|
7
|
-
*
|
|
8
|
-
* @returns {Promise<void>} Completion of retirement.
|
|
9
|
-
*/
|
|
10
|
-
export async function retireVectorTileGroup(group) {
|
|
11
|
-
const session = this.session;
|
|
12
|
-
this.retiring.add(group);
|
|
13
|
-
let removed = 0, layer;
|
|
14
|
-
for (layer of group.getLayers()) {
|
|
15
|
-
if (this.session !== session) return;
|
|
16
|
-
group.removeLayer(layer);
|
|
17
|
-
if (++removed % 8 === 0) await yieldTask();
|
|
18
|
-
}
|
|
19
|
-
group.remove(); this.retiring.delete(group);
|
|
20
|
-
}
|
|
1
|
+
import { yieldTask } from '../utils/yieldTask.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Remove a tile group's layers incrementally while its session remains current.
|
|
5
|
+
*
|
|
6
|
+
* @param {Object} group Leaflet layer group to retire.
|
|
7
|
+
*
|
|
8
|
+
* @returns {Promise<void>} Completion of retirement.
|
|
9
|
+
*/
|
|
10
|
+
export async function retireVectorTileGroup(group) {
|
|
11
|
+
const session = this.session;
|
|
12
|
+
this.retiring.add(group);
|
|
13
|
+
let removed = 0, layer;
|
|
14
|
+
for (layer of group.getLayers()) {
|
|
15
|
+
if (this.session !== session) return;
|
|
16
|
+
group.removeLayer(layer);
|
|
17
|
+
if (++removed % 8 === 0) await yieldTask();
|
|
18
|
+
}
|
|
19
|
+
group.remove(); this.retiring.delete(group);
|
|
20
|
+
}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { vectorWorkerByLayer } from '../weakmaps/vectorWorkerByLayer.js';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Revoke a vector worker's temporary blob URL once it is no longer needed.
|
|
5
|
-
*
|
|
6
|
-
* @param {Object} layer Owning vector tile layer.
|
|
7
|
-
*/
|
|
8
|
-
export function revokeVectorWorkerUrl(layer) {
|
|
9
|
-
const entry = vectorWorkerByLayer.get(layer);
|
|
10
|
-
if (entry?.blobUrl) {
|
|
11
|
-
URL.revokeObjectURL(entry.blobUrl);
|
|
12
|
-
entry.blobUrl = null;
|
|
13
|
-
}
|
|
14
|
-
}
|
|
1
|
+
import { vectorWorkerByLayer } from '../weakmaps/vectorWorkerByLayer.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Revoke a vector worker's temporary blob URL once it is no longer needed.
|
|
5
|
+
*
|
|
6
|
+
* @param {Object} layer Owning vector tile layer.
|
|
7
|
+
*/
|
|
8
|
+
export function revokeVectorWorkerUrl(layer) {
|
|
9
|
+
const entry = vectorWorkerByLayer.get(layer);
|
|
10
|
+
if (entry?.blobUrl) {
|
|
11
|
+
URL.revokeObjectURL(entry.blobUrl);
|
|
12
|
+
entry.blobUrl = null;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
import { radians } from '../globals/radians.js';
|
|
2
|
-
import { markerSetRotation } from '../core/markerSetRotation.js';
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* Rotate a line label to follow its projected segment while keeping text upright.
|
|
6
|
-
*
|
|
7
|
-
* @param {Object} map Leaflet map.
|
|
8
|
-
* @param {Object} marker Label marker.
|
|
9
|
-
* @param {Object} label Label candidate with optional line endpoints.
|
|
10
|
-
*/
|
|
11
|
-
export function rotateVectorLabel(map, marker, label) {
|
|
12
|
-
if (!label.along) return;
|
|
13
|
-
const a = map.latLngToContainerPoint(label.along[0]), b = map.latLngToContainerPoint(label.along[1]);
|
|
14
|
-
let angle = Math.atan2(b.y - a.y, b.x - a.x) / radians;
|
|
15
|
-
if (angle > 90) angle -= 180;
|
|
16
|
-
else if (angle < -90) angle += 180;
|
|
17
|
-
if (marker.options.rotation === angle * radians) return;
|
|
18
|
-
markerSetRotation(marker, angle * radians);
|
|
19
|
-
}
|
|
1
|
+
import { radians } from '../globals/radians.js';
|
|
2
|
+
import { markerSetRotation } from '../core/markerSetRotation.js';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Rotate a line label to follow its projected segment while keeping text upright.
|
|
6
|
+
*
|
|
7
|
+
* @param {Object} map Leaflet map.
|
|
8
|
+
* @param {Object} marker Label marker.
|
|
9
|
+
* @param {Object} label Label candidate with optional line endpoints.
|
|
10
|
+
*/
|
|
11
|
+
export function rotateVectorLabel(map, marker, label) {
|
|
12
|
+
if (!label.along) return;
|
|
13
|
+
const a = map.latLngToContainerPoint(label.along[0]), b = map.latLngToContainerPoint(label.along[1]);
|
|
14
|
+
let angle = Math.atan2(b.y - a.y, b.x - a.x) / radians;
|
|
15
|
+
if (angle > 90) angle -= 180;
|
|
16
|
+
else if (angle < -90) angle += 180;
|
|
17
|
+
if (marker.options.rotation === angle * radians) return;
|
|
18
|
+
markerSetRotation(marker, angle * radians);
|
|
19
|
+
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { rotateVectorLabel } from './rotateVectorLabel.js';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Update the rotation of the bound layer's line labels.
|
|
5
|
-
*/
|
|
6
|
-
export function rotateVectorLabels() {
|
|
7
|
-
let marker;
|
|
8
|
-
for (marker of this.labels.values()) if (marker._mvtLabel) rotateVectorLabel(this._map, marker, marker._mvtLabel);
|
|
9
|
-
}
|
|
1
|
+
import { rotateVectorLabel } from './rotateVectorLabel.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Update the rotation of the bound layer's line labels.
|
|
5
|
+
*/
|
|
6
|
+
export function rotateVectorLabels() {
|
|
7
|
+
let marker;
|
|
8
|
+
for (marker of this.labels.values()) if (marker._mvtLabel) rotateVectorLabel(this._map, marker, marker._mvtLabel);
|
|
9
|
+
}
|
|
@@ -1,29 +1,29 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Simplify a path with a distance tolerance while retaining its endpoints.
|
|
3
|
-
*
|
|
4
|
-
* @param {Array} path Tile-coordinate points.
|
|
5
|
-
* @param {number} tolerance Maximum retained deviation.
|
|
6
|
-
*
|
|
7
|
-
* @returns {Array} Simplified path.
|
|
8
|
-
*/
|
|
9
|
-
export function simplifyVectorPath(path, tolerance) {
|
|
10
|
-
if (path.length < 3) return path;
|
|
11
|
-
const keep = /* alloc */ new Uint8Array(path.length);
|
|
12
|
-
const stack = /* alloc */ [/* alloc */ [0, path.length - 1]], output = /* alloc */ [];
|
|
13
|
-
keep[0] = keep[path.length - 1] = 1;
|
|
14
|
-
let start, end, a, b, dx, dy, length, index, distance, i, p, t, squared;
|
|
15
|
-
while (stack.length) {
|
|
16
|
-
[start, end] = stack.pop(); a = path[start]; b = path[end];
|
|
17
|
-
dx = b[0] - a[0]; dy = b[1] - a[1]; length = dx * dx + dy * dy;
|
|
18
|
-
index = -1; distance = tolerance * tolerance;
|
|
19
|
-
for (i = start + 1; i < end; i++) {
|
|
20
|
-
p = path[i];
|
|
21
|
-
t = length ? Math.max(0, Math.min(1, ((p[0] - a[0]) * dx + (p[1] - a[1]) * dy) / length)) : 0;
|
|
22
|
-
squared = (p[0] - a[0] - t * dx) ** 2 + (p[1] - a[1] - t * dy) ** 2;
|
|
23
|
-
if (squared > distance) { distance = squared; index = i; }
|
|
24
|
-
}
|
|
25
|
-
if (index >= 0) { keep[index] = 1; stack.push(/* alloc */ [start, index], /* alloc */ [index, end]); }
|
|
26
|
-
}
|
|
27
|
-
for (i = 0; i < path.length; i++) if (keep[i]) output.push(path[i]);
|
|
28
|
-
return output;
|
|
29
|
-
}
|
|
1
|
+
/**
|
|
2
|
+
* Simplify a path with a distance tolerance while retaining its endpoints.
|
|
3
|
+
*
|
|
4
|
+
* @param {Array} path Tile-coordinate points.
|
|
5
|
+
* @param {number} tolerance Maximum retained deviation.
|
|
6
|
+
*
|
|
7
|
+
* @returns {Array} Simplified path.
|
|
8
|
+
*/
|
|
9
|
+
export function simplifyVectorPath(path, tolerance) {
|
|
10
|
+
if (path.length < 3) return path;
|
|
11
|
+
const keep = /* alloc */ new Uint8Array(path.length);
|
|
12
|
+
const stack = /* alloc */ [/* alloc */ [0, path.length - 1]], output = /* alloc */ [];
|
|
13
|
+
keep[0] = keep[path.length - 1] = 1;
|
|
14
|
+
let start, end, a, b, dx, dy, length, index, distance, i, p, t, squared;
|
|
15
|
+
while (stack.length) {
|
|
16
|
+
[start, end] = stack.pop(); a = path[start]; b = path[end];
|
|
17
|
+
dx = b[0] - a[0]; dy = b[1] - a[1]; length = dx * dx + dy * dy;
|
|
18
|
+
index = -1; distance = tolerance * tolerance;
|
|
19
|
+
for (i = start + 1; i < end; i++) {
|
|
20
|
+
p = path[i];
|
|
21
|
+
t = length ? Math.max(0, Math.min(1, ((p[0] - a[0]) * dx + (p[1] - a[1]) * dy) / length)) : 0;
|
|
22
|
+
squared = (p[0] - a[0] - t * dx) ** 2 + (p[1] - a[1] - t * dy) ** 2;
|
|
23
|
+
if (squared > distance) { distance = squared; index = i; }
|
|
24
|
+
}
|
|
25
|
+
if (index >= 0) { keep[index] = 1; stack.push(/* alloc */ [start, index], /* alloc */ [index, end]); }
|
|
26
|
+
}
|
|
27
|
+
for (i = 0; i < path.length; i++) if (keep[i]) output.push(path[i]);
|
|
28
|
+
return output;
|
|
29
|
+
}
|