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,19 +1,19 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Reconstruct ring paths from flattened projected bridge pixels.
|
|
3
|
-
*
|
|
4
|
-
* @param {Array<Array>} rings Original bridge rings.
|
|
5
|
-
* @param {Array<Array<number>>} pixels Flattened projected coordinates.
|
|
6
|
-
*
|
|
7
|
-
* @returns {Array<Array<Object>>} Projected x/y paths.
|
|
8
|
-
*/
|
|
9
|
-
export function bridgePaths(rings, pixels) {
|
|
10
|
-
const paths = /* alloc */ [];
|
|
11
|
-
let start = 0, ring, path, i;
|
|
12
|
-
for (ring of rings) {
|
|
13
|
-
path = /* alloc */ [];
|
|
14
|
-
for (i = 0; i < ring.length; i++) path.push(/* alloc */ { x: pixels[start + i][0], y: pixels[start + i][1] });
|
|
15
|
-
paths.push(path);
|
|
16
|
-
start += ring.length;
|
|
17
|
-
}
|
|
18
|
-
return paths;
|
|
19
|
-
}
|
|
1
|
+
/**
|
|
2
|
+
* Reconstruct ring paths from flattened projected bridge pixels.
|
|
3
|
+
*
|
|
4
|
+
* @param {Array<Array>} rings Original bridge rings.
|
|
5
|
+
* @param {Array<Array<number>>} pixels Flattened projected coordinates.
|
|
6
|
+
*
|
|
7
|
+
* @returns {Array<Array<Object>>} Projected x/y paths.
|
|
8
|
+
*/
|
|
9
|
+
export function bridgePaths(rings, pixels) {
|
|
10
|
+
const paths = /* alloc */ [];
|
|
11
|
+
let start = 0, ring, path, i;
|
|
12
|
+
for (ring of rings) {
|
|
13
|
+
path = /* alloc */ [];
|
|
14
|
+
for (i = 0; i < ring.length; i++) path.push(/* alloc */ { x: pixels[start + i][0], y: pixels[start + i][1] });
|
|
15
|
+
paths.push(path);
|
|
16
|
+
start += ring.length;
|
|
17
|
+
}
|
|
18
|
+
return paths;
|
|
19
|
+
}
|
|
@@ -1,37 +1,37 @@
|
|
|
1
|
-
import { triangulate } from '../triangulation/triangulate.js';
|
|
2
|
-
import { local } from '../projections/projectBridgePoint.js';
|
|
3
|
-
import { bridgePaths } from './bridgePaths.js';
|
|
4
|
-
import { indexBridge } from './indexBridge.js';
|
|
5
|
-
import { bridgeFaces } from './bridgeFaces.js';
|
|
6
|
-
import { bridgeSides } from './bridgeSides.js';
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* Project, triangulate and index a bridge polygon, adding its deck geometry.
|
|
10
|
-
*
|
|
11
|
-
* @param {Object} context Bridge projection and destination buffers.
|
|
12
|
-
* @param {Array<Array<Array<number>>>} polygon GeoJSON polygon rings with elevations.
|
|
13
|
-
*/
|
|
14
|
-
export function bridgePolygon(context, polygon) {
|
|
15
|
-
const { backend: layer, map, zoom, crs, origin, metres, base } = context;
|
|
16
|
-
const rings = /* alloc */ [];
|
|
17
|
-
let ring, path, lng, lat, z, p, coordinate, paths, contour, holes, triangles;
|
|
18
|
-
for (ring of polygon) {
|
|
19
|
-
path = ring.slice(0, -1);
|
|
20
|
-
if (path.length >= 3) rings.push(path);
|
|
21
|
-
}
|
|
22
|
-
if (!rings.length) return;
|
|
23
|
-
const pixels = /* alloc */ [], points = /* alloc */ [];
|
|
24
|
-
for (ring of rings) for ([lng, lat, z] of ring) {
|
|
25
|
-
p = map.project(/* alloc */ [lat, lng], zoom);
|
|
26
|
-
pixels.push(/* alloc */ [p.x, p.y, z]);
|
|
27
|
-
}
|
|
28
|
-
for (ring of rings) for (coordinate of ring) points.push(local(coordinate, crs, origin, metres, base));
|
|
29
|
-
try {
|
|
30
|
-
paths = bridgePaths(rings, pixels);
|
|
31
|
-
[contour, ...holes] = paths;
|
|
32
|
-
triangles = triangulate(contour, holes);
|
|
33
|
-
} catch { return; }
|
|
34
|
-
indexBridge(layer, pixels, triangles);
|
|
35
|
-
bridgeFaces(context, points, triangles);
|
|
36
|
-
bridgeSides(context, points, rings);
|
|
37
|
-
}
|
|
1
|
+
import { triangulate } from '../triangulation/triangulate.js';
|
|
2
|
+
import { local } from '../projections/projectBridgePoint.js';
|
|
3
|
+
import { bridgePaths } from './bridgePaths.js';
|
|
4
|
+
import { indexBridge } from './indexBridge.js';
|
|
5
|
+
import { bridgeFaces } from './bridgeFaces.js';
|
|
6
|
+
import { bridgeSides } from './bridgeSides.js';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Project, triangulate and index a bridge polygon, adding its deck geometry.
|
|
10
|
+
*
|
|
11
|
+
* @param {Object} context Bridge projection and destination buffers.
|
|
12
|
+
* @param {Array<Array<Array<number>>>} polygon GeoJSON polygon rings with elevations.
|
|
13
|
+
*/
|
|
14
|
+
export function bridgePolygon(context, polygon) {
|
|
15
|
+
const { backend: layer, map, zoom, crs, origin, metres, base } = context;
|
|
16
|
+
const rings = /* alloc */ [];
|
|
17
|
+
let ring, path, lng, lat, z, p, coordinate, paths, contour, holes, triangles;
|
|
18
|
+
for (ring of polygon) {
|
|
19
|
+
path = ring.slice(0, -1);
|
|
20
|
+
if (path.length >= 3) rings.push(path);
|
|
21
|
+
}
|
|
22
|
+
if (!rings.length) return;
|
|
23
|
+
const pixels = /* alloc */ [], points = /* alloc */ [];
|
|
24
|
+
for (ring of rings) for ([lng, lat, z] of ring) {
|
|
25
|
+
p = map.project(/* alloc */ [lat, lng], zoom);
|
|
26
|
+
pixels.push(/* alloc */ [p.x, p.y, z]);
|
|
27
|
+
}
|
|
28
|
+
for (ring of rings) for (coordinate of ring) points.push(local(coordinate, crs, origin, metres, base));
|
|
29
|
+
try {
|
|
30
|
+
paths = bridgePaths(rings, pixels);
|
|
31
|
+
[contour, ...holes] = paths;
|
|
32
|
+
triangles = triangulate(contour, holes);
|
|
33
|
+
} catch { return; }
|
|
34
|
+
indexBridge(layer, pixels, triangles);
|
|
35
|
+
bridgeFaces(context, points, triangles);
|
|
36
|
+
bridgeSides(context, points, rings);
|
|
37
|
+
}
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import { bridgeEdge } from './bridgeEdge.js';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Append the side faces of each bridge polygon ring.
|
|
5
|
-
*
|
|
6
|
-
* @param {Object} context Destination geometry buffers.
|
|
7
|
-
* @param {Array<Array<number>>} points Flattened local bridge points.
|
|
8
|
-
* @param {Array<Array>} rings Bridge rings defining point counts.
|
|
9
|
-
*/
|
|
10
|
-
export function bridgeSides(context, points, rings) {
|
|
11
|
-
let start = 0, ring, i;
|
|
12
|
-
for (ring of rings) {
|
|
13
|
-
for (i = 0; i < ring.length; i++) {
|
|
14
|
-
bridgeEdge(context, points[start + i], points[start + (i + 1) % ring.length]);
|
|
15
|
-
}
|
|
16
|
-
start += ring.length;
|
|
17
|
-
}
|
|
18
|
-
}
|
|
1
|
+
import { bridgeEdge } from './bridgeEdge.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Append the side faces of each bridge polygon ring.
|
|
5
|
+
*
|
|
6
|
+
* @param {Object} context Destination geometry buffers.
|
|
7
|
+
* @param {Array<Array<number>>} points Flattened local bridge points.
|
|
8
|
+
* @param {Array<Array>} rings Bridge rings defining point counts.
|
|
9
|
+
*/
|
|
10
|
+
export function bridgeSides(context, points, rings) {
|
|
11
|
+
let start = 0, ring, i;
|
|
12
|
+
for (ring of rings) {
|
|
13
|
+
for (i = 0; i < ring.length; i++) {
|
|
14
|
+
bridgeEdge(context, points[start + i], points[start + (i + 1) % ring.length]);
|
|
15
|
+
}
|
|
16
|
+
start += ring.length;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
@@ -1,32 +1,32 @@
|
|
|
1
|
-
import { generateTreeGeometry } from './generateTreeGeometry.js';
|
|
2
|
-
import { lampPostGeometry } from './lampPostGeometry.js';
|
|
3
|
-
import { lightGeometry } from './lightGeometry.js';
|
|
4
|
-
import { treeGeometry } from './treeGeometry.js';
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* Generate tree or night-light geometry for a projected point.
|
|
8
|
-
*
|
|
9
|
-
* @param {Object} context Area geometry and light state.
|
|
10
|
-
* @param {Object} projected Projected point with ground height.
|
|
11
|
-
* @param {Object} style Point geometry style.
|
|
12
|
-
* @param {Object} baseColor Parsed RGB color.
|
|
13
|
-
* @param {string} support Support identifier used to deduplicate lamp posts.
|
|
14
|
-
*
|
|
15
|
-
* @throws {Error} If a night-light flux is not finite and positive.
|
|
16
|
-
*/
|
|
17
|
-
export function buildProjectedPoint(context, projected, style, baseColor, support) {
|
|
18
|
-
const { top } = style;
|
|
19
|
-
if (context.backend.options.nightLight) {
|
|
20
|
-
if (!Number.isFinite(style.lightFlux) || style.lightFlux <= 0) throw /* alloc */ new Error('Invalid light flux');
|
|
21
|
-
if (style.poleRadius > 0 && !context.supports.has(support)) {
|
|
22
|
-
generateTreeGeometry(context, lampPostGeometry, projected, style);
|
|
23
|
-
context.supports.add(support);
|
|
24
|
-
}
|
|
25
|
-
generateTreeGeometry(context, lightGeometry, projected, style);
|
|
26
|
-
context.lights.push(/* alloc */ {
|
|
27
|
-
position: /* alloc */ [projected.x, projected.ground + top, -projected.y],
|
|
28
|
-
radius: Math.hypot(top, style.lightRadius), color: /* alloc */ [baseColor.r, baseColor.g, baseColor.b],
|
|
29
|
-
flux: style.lightFlux,
|
|
30
|
-
});
|
|
31
|
-
} else generateTreeGeometry(context, treeGeometry, projected, style);
|
|
32
|
-
}
|
|
1
|
+
import { generateTreeGeometry } from './generateTreeGeometry.js';
|
|
2
|
+
import { lampPostGeometry } from './lampPostGeometry.js';
|
|
3
|
+
import { lightGeometry } from './lightGeometry.js';
|
|
4
|
+
import { treeGeometry } from './treeGeometry.js';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Generate tree or night-light geometry for a projected point.
|
|
8
|
+
*
|
|
9
|
+
* @param {Object} context Area geometry and light state.
|
|
10
|
+
* @param {Object} projected Projected point with ground height.
|
|
11
|
+
* @param {Object} style Point geometry style.
|
|
12
|
+
* @param {Object} baseColor Parsed RGB color.
|
|
13
|
+
* @param {string} support Support identifier used to deduplicate lamp posts.
|
|
14
|
+
*
|
|
15
|
+
* @throws {Error} If a night-light flux is not finite and positive.
|
|
16
|
+
*/
|
|
17
|
+
export function buildProjectedPoint(context, projected, style, baseColor, support) {
|
|
18
|
+
const { top } = style;
|
|
19
|
+
if (context.backend.options.nightLight) {
|
|
20
|
+
if (!Number.isFinite(style.lightFlux) || style.lightFlux <= 0) throw /* alloc */ new Error('Invalid light flux');
|
|
21
|
+
if (style.poleRadius > 0 && !context.supports.has(support)) {
|
|
22
|
+
generateTreeGeometry(context, lampPostGeometry, projected, style);
|
|
23
|
+
context.supports.add(support);
|
|
24
|
+
}
|
|
25
|
+
generateTreeGeometry(context, lightGeometry, projected, style);
|
|
26
|
+
context.lights.push(/* alloc */ {
|
|
27
|
+
position: /* alloc */ [projected.x, projected.ground + top, -projected.y],
|
|
28
|
+
radius: Math.hypot(top, style.lightRadius), color: /* alloc */ [baseColor.r, baseColor.g, baseColor.b],
|
|
29
|
+
flux: style.lightFlux,
|
|
30
|
+
});
|
|
31
|
+
} else generateTreeGeometry(context, treeGeometry, projected, style);
|
|
32
|
+
}
|
|
@@ -1,34 +1,34 @@
|
|
|
1
|
-
import { triangulate } from '../triangulation/triangulate.js';
|
|
2
|
-
import { addTriangle } from './appendAreaTriangle.js';
|
|
3
|
-
import { isClockWise } from '../triangulation/isClockWise.js';
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Append roof, optional bottom and side triangles for a projected polygon.
|
|
7
|
-
*
|
|
8
|
-
* @param {Object} context Destination area geometry.
|
|
9
|
-
* @param {Array<Array<Object>>} paths Projected outer ring and holes.
|
|
10
|
-
* @param {number} top Extrusion top height.
|
|
11
|
-
* @param {number} bottom Extrusion bottom height.
|
|
12
|
-
* @param {Object} baseColor Parsed RGB color.
|
|
13
|
-
*/
|
|
14
|
-
export function buildProjectedPolygon(context, paths, top, bottom, baseColor) {
|
|
15
|
-
const points = /* alloc */ [];
|
|
16
|
-
let path, point, a, b, c, index, sign, i, length, nx, nz;
|
|
17
|
-
for (path of paths) for (point of path) points.push(point);
|
|
18
|
-
for ([a, b, c] of triangulate(paths[0], paths.slice(1))) {
|
|
19
|
-
addTriangle(context, points[a], top, points[b], top, points[c], top, 0, 1, 0, baseColor);
|
|
20
|
-
if (bottom > 0) addTriangle(context, points[a], bottom, points[b], bottom, points[c], bottom, 0, -1, 0, baseColor);
|
|
21
|
-
}
|
|
22
|
-
for (index = 0; index < paths.length; index++) {
|
|
23
|
-
path = paths[index];
|
|
24
|
-
sign = isClockWise(path) === (index === 0) ? -1 : 1;
|
|
25
|
-
for (i = 0; i < path.length; i++) {
|
|
26
|
-
a = path[i], b = path[(i + 1) % path.length];
|
|
27
|
-
length = Math.hypot(b.x - a.x, b.y - a.y);
|
|
28
|
-
if (!length) continue;
|
|
29
|
-
nx = sign * (b.y - a.y) / length, nz = sign * (b.x - a.x) / length;
|
|
30
|
-
addTriangle(context, a, bottom, b, bottom, b, top, nx, 0, nz, baseColor);
|
|
31
|
-
addTriangle(context, a, bottom, b, top, a, top, nx, 0, nz, baseColor);
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
}
|
|
1
|
+
import { triangulate } from '../triangulation/triangulate.js';
|
|
2
|
+
import { addTriangle } from './appendAreaTriangle.js';
|
|
3
|
+
import { isClockWise } from '../triangulation/isClockWise.js';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Append roof, optional bottom and side triangles for a projected polygon.
|
|
7
|
+
*
|
|
8
|
+
* @param {Object} context Destination area geometry.
|
|
9
|
+
* @param {Array<Array<Object>>} paths Projected outer ring and holes.
|
|
10
|
+
* @param {number} top Extrusion top height.
|
|
11
|
+
* @param {number} bottom Extrusion bottom height.
|
|
12
|
+
* @param {Object} baseColor Parsed RGB color.
|
|
13
|
+
*/
|
|
14
|
+
export function buildProjectedPolygon(context, paths, top, bottom, baseColor) {
|
|
15
|
+
const points = /* alloc */ [];
|
|
16
|
+
let path, point, a, b, c, index, sign, i, length, nx, nz;
|
|
17
|
+
for (path of paths) for (point of path) points.push(point);
|
|
18
|
+
for ([a, b, c] of triangulate(paths[0], paths.slice(1))) {
|
|
19
|
+
addTriangle(context, points[a], top, points[b], top, points[c], top, 0, 1, 0, baseColor);
|
|
20
|
+
if (bottom > 0) addTriangle(context, points[a], bottom, points[b], bottom, points[c], bottom, 0, -1, 0, baseColor);
|
|
21
|
+
}
|
|
22
|
+
for (index = 0; index < paths.length; index++) {
|
|
23
|
+
path = paths[index];
|
|
24
|
+
sign = isClockWise(path) === (index === 0) ? -1 : 1;
|
|
25
|
+
for (i = 0; i < path.length; i++) {
|
|
26
|
+
a = path[i], b = path[(i + 1) % path.length];
|
|
27
|
+
length = Math.hypot(b.x - a.x, b.y - a.y);
|
|
28
|
+
if (!length) continue;
|
|
29
|
+
nx = sign * (b.y - a.y) / length, nz = sign * (b.x - a.x) / length;
|
|
30
|
+
addTriangle(context, a, bottom, b, bottom, b, top, nx, 0, nz, baseColor);
|
|
31
|
+
addTriangle(context, a, bottom, b, top, a, top, nx, 0, nz, baseColor);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}
|
package/src/geometry/circleAt.js
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
import { tau } from '../globals/tau.js';
|
|
2
|
-
import { L } from '../globals/L.js';
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* Compute a point on an elliptical ring with an optional radial offset.
|
|
6
|
-
*
|
|
7
|
-
* @param {L.Point} center Ellipse center.
|
|
8
|
-
* @param {number} radius Horizontal radius.
|
|
9
|
-
* @param {number} radiusY Vertical radius.
|
|
10
|
-
* @param {number} count Ring subdivision count.
|
|
11
|
-
* @param {number} index Ring point index.
|
|
12
|
-
* @param {number} [offset] Offset applied to both radii.
|
|
13
|
-
*
|
|
14
|
-
* @returns {L.Point} Ring point.
|
|
15
|
-
*/
|
|
16
|
-
export function circleAt(center, radius, radiusY, count, index, offset = 0) {
|
|
17
|
-
const angle = index * tau / count;
|
|
18
|
-
return /* alloc */ new L.Point(center.x + Math.max(0, radius + offset) * Math.cos(angle),
|
|
19
|
-
center.y + Math.max(0, radiusY + offset) * Math.sin(angle));
|
|
20
|
-
}
|
|
1
|
+
import { tau } from '../globals/tau.js';
|
|
2
|
+
import { L } from '../globals/L.js';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Compute a point on an elliptical ring with an optional radial offset.
|
|
6
|
+
*
|
|
7
|
+
* @param {L.Point} center Ellipse center.
|
|
8
|
+
* @param {number} radius Horizontal radius.
|
|
9
|
+
* @param {number} radiusY Vertical radius.
|
|
10
|
+
* @param {number} count Ring subdivision count.
|
|
11
|
+
* @param {number} index Ring point index.
|
|
12
|
+
* @param {number} [offset] Offset applied to both radii.
|
|
13
|
+
*
|
|
14
|
+
* @returns {L.Point} Ring point.
|
|
15
|
+
*/
|
|
16
|
+
export function circleAt(center, radius, radiusY, count, index, offset = 0) {
|
|
17
|
+
const angle = index * tau / count;
|
|
18
|
+
return /* alloc */ new L.Point(center.x + Math.max(0, radius + offset) * Math.cos(angle),
|
|
19
|
+
center.y + Math.max(0, radiusY + offset) * Math.sin(angle));
|
|
20
|
+
}
|
|
@@ -1,41 +1,41 @@
|
|
|
1
|
-
import { L } from '../globals/L.js';
|
|
2
|
-
import { disk } from './disk.js';
|
|
3
|
-
import { circleAt } from './circleAt.js';
|
|
4
|
-
import { line } from './line.js';
|
|
5
|
-
import { triangle } from './appendNativeTriangle.js';
|
|
6
|
-
import { projectNativePath } from '../core/projectNativePath.js';
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* Generate native circle or ellipse fill and stroke triangles.
|
|
10
|
-
*
|
|
11
|
-
* @param {L.Circle|L.CircleMarker} source Native circle layer.
|
|
12
|
-
* @param {Object} context Projection, style and destination buffers.
|
|
13
|
-
*/
|
|
14
|
-
export function circleGeometry(source, context) {
|
|
15
|
-
const { map, point, fill, stroke, options, dash, width } = context;
|
|
16
|
-
const center = map.project(source.getLatLng());
|
|
17
|
-
let radius = source.getRadius(), radiusY = radius, index, i;
|
|
18
|
-
if (source instanceof L.Circle) {
|
|
19
|
-
projectNativePath(source);
|
|
20
|
-
const projected = source._point.add(map.getPixelOrigin());
|
|
21
|
-
center.x = projected.x;
|
|
22
|
-
center.y = projected.y;
|
|
23
|
-
radius = source._pxRadius ?? source._radius;
|
|
24
|
-
radiusY = source._pxRadiusY ?? source._radiusY ?? radius;
|
|
25
|
-
}
|
|
26
|
-
if (options.fill) disk(point, center, radius, fill, radiusY);
|
|
27
|
-
const count = Math.max(12, Math.min(128, Math.ceil(Math.PI * Math.sqrt(Math.max(radius, radiusY)))));
|
|
28
|
-
if (dash.length) {
|
|
29
|
-
const points = /* alloc */ [];
|
|
30
|
-
for (index = 0; index < count; index++) points.push(circleAt(center, radius, radiusY, count, index));
|
|
31
|
-
line(context, points, true);
|
|
32
|
-
}
|
|
33
|
-
else if (options.stroke && width > 0) {
|
|
34
|
-
for (i = 0; i < count; i++) {
|
|
35
|
-
triangle(point, stroke, circleAt(center, radius, radiusY, count, i, width / 2),
|
|
36
|
-
circleAt(center, radius, radiusY, count, i, -width / 2), circleAt(center, radius, radiusY, count, i + 1, width / 2));
|
|
37
|
-
triangle(point, stroke, circleAt(center, radius, radiusY, count, i + 1, width / 2),
|
|
38
|
-
circleAt(center, radius, radiusY, count, i, -width / 2), circleAt(center, radius, radiusY, count, i + 1, -width / 2));
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
}
|
|
1
|
+
import { L } from '../globals/L.js';
|
|
2
|
+
import { disk } from './disk.js';
|
|
3
|
+
import { circleAt } from './circleAt.js';
|
|
4
|
+
import { line } from './line.js';
|
|
5
|
+
import { triangle } from './appendNativeTriangle.js';
|
|
6
|
+
import { projectNativePath } from '../core/projectNativePath.js';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Generate native circle or ellipse fill and stroke triangles.
|
|
10
|
+
*
|
|
11
|
+
* @param {L.Circle|L.CircleMarker} source Native circle layer.
|
|
12
|
+
* @param {Object} context Projection, style and destination buffers.
|
|
13
|
+
*/
|
|
14
|
+
export function circleGeometry(source, context) {
|
|
15
|
+
const { map, point, fill, stroke, options, dash, width } = context;
|
|
16
|
+
const center = map.project(source.getLatLng());
|
|
17
|
+
let radius = source.getRadius(), radiusY = radius, index, i;
|
|
18
|
+
if (source instanceof L.Circle) {
|
|
19
|
+
projectNativePath(source);
|
|
20
|
+
const projected = source._point.add(map.getPixelOrigin());
|
|
21
|
+
center.x = projected.x;
|
|
22
|
+
center.y = projected.y;
|
|
23
|
+
radius = source._pxRadius ?? source._radius;
|
|
24
|
+
radiusY = source._pxRadiusY ?? source._radiusY ?? radius;
|
|
25
|
+
}
|
|
26
|
+
if (options.fill) disk(point, center, radius, fill, radiusY);
|
|
27
|
+
const count = Math.max(12, Math.min(128, Math.ceil(Math.PI * Math.sqrt(Math.max(radius, radiusY)))));
|
|
28
|
+
if (dash.length) {
|
|
29
|
+
const points = /* alloc */ [];
|
|
30
|
+
for (index = 0; index < count; index++) points.push(circleAt(center, radius, radiusY, count, index));
|
|
31
|
+
line(context, points, true);
|
|
32
|
+
}
|
|
33
|
+
else if (options.stroke && width > 0) {
|
|
34
|
+
for (i = 0; i < count; i++) {
|
|
35
|
+
triangle(point, stroke, circleAt(center, radius, radiusY, count, i, width / 2),
|
|
36
|
+
circleAt(center, radius, radiusY, count, i, -width / 2), circleAt(center, radius, radiusY, count, i + 1, width / 2));
|
|
37
|
+
triangle(point, stroke, circleAt(center, radius, radiusY, count, i + 1, width / 2),
|
|
38
|
+
circleAt(center, radius, radiusY, count, i, -width / 2), circleAt(center, radius, radiusY, count, i + 1, -width / 2));
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
@@ -1,44 +1,44 @@
|
|
|
1
|
-
import { rendererByLayer } from '../weakmaps/rendererByLayer.js';
|
|
2
|
-
import { createProgram } from '../materials/createProgram.js';
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* Create GPU buffers and a material program for a model primitive.
|
|
6
|
-
*
|
|
7
|
-
* @param {Object} context Model context tracking materials and resources.
|
|
8
|
-
* @param {Object} primitive glTF primitive specification.
|
|
9
|
-
* @param {Object} attributes Prepared geometry attributes.
|
|
10
|
-
*
|
|
11
|
-
* @returns {Object} Device, geometry and program.
|
|
12
|
-
*
|
|
13
|
-
* @throws {Error} If a textured material has no UV attribute.
|
|
14
|
-
*/
|
|
15
|
-
export function createModelGeometry(context, primitive, attributes) {
|
|
16
|
-
const style = context.materials[primitive.material] || /* alloc */ {
|
|
17
|
-
color: /* alloc */ [1, 1, 1], metallic: 1,
|
|
18
|
-
};
|
|
19
|
-
if ((style.baseTexture || style.metalTexture || style.emissiveTexture || style.occlusionTexture) && !attributes.uv) {
|
|
20
|
-
throw /* alloc */ new Error('Textured model mesh requires UV coordinates');
|
|
21
|
-
}
|
|
22
|
-
const program = createProgram(context.backend, style);
|
|
23
|
-
context.resources.push(program);
|
|
24
|
-
const device = rendererByLayer.get(context.backend).device;
|
|
25
|
-
let name, attribute;
|
|
26
|
-
for ([name, attribute] of Object.entries(attributes)) {
|
|
27
|
-
attribute.size ||= 1;
|
|
28
|
-
attribute.count = attribute.data.length / attribute.size;
|
|
29
|
-
attribute.indexFormat = attribute.data instanceof Uint32Array ? 'uint32' : 'uint16';
|
|
30
|
-
attribute.buffer = device.createBuffer(/* alloc */ {
|
|
31
|
-
size: Math.max(4, attribute.data.byteLength),
|
|
32
|
-
usage: name === 'index'
|
|
33
|
-
? GPUBufferUsage.INDEX | GPUBufferUsage.COPY_DST
|
|
34
|
-
: GPUBufferUsage.VERTEX | GPUBufferUsage.COPY_DST,
|
|
35
|
-
});
|
|
36
|
-
device.queue.writeBuffer(attribute.buffer, 0, attribute.data);
|
|
37
|
-
}
|
|
38
|
-
const geometry = /* alloc */ {
|
|
39
|
-
device, attributes,
|
|
40
|
-
drawRange: /* alloc */ { start: 0, count: attributes.index?.count || attributes.position.count },
|
|
41
|
-
};
|
|
42
|
-
context.resources.push(geometry);
|
|
43
|
-
return /* alloc */ { device, geometry, program };
|
|
44
|
-
}
|
|
1
|
+
import { rendererByLayer } from '../weakmaps/rendererByLayer.js';
|
|
2
|
+
import { createProgram } from '../materials/createProgram.js';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Create GPU buffers and a material program for a model primitive.
|
|
6
|
+
*
|
|
7
|
+
* @param {Object} context Model context tracking materials and resources.
|
|
8
|
+
* @param {Object} primitive glTF primitive specification.
|
|
9
|
+
* @param {Object} attributes Prepared geometry attributes.
|
|
10
|
+
*
|
|
11
|
+
* @returns {Object} Device, geometry and program.
|
|
12
|
+
*
|
|
13
|
+
* @throws {Error} If a textured material has no UV attribute.
|
|
14
|
+
*/
|
|
15
|
+
export function createModelGeometry(context, primitive, attributes) {
|
|
16
|
+
const style = context.materials[primitive.material] || /* alloc */ {
|
|
17
|
+
color: /* alloc */ [1, 1, 1], metallic: 1,
|
|
18
|
+
};
|
|
19
|
+
if ((style.baseTexture || style.metalTexture || style.emissiveTexture || style.occlusionTexture) && !attributes.uv) {
|
|
20
|
+
throw /* alloc */ new Error('Textured model mesh requires UV coordinates');
|
|
21
|
+
}
|
|
22
|
+
const program = createProgram(context.backend, style);
|
|
23
|
+
context.resources.push(program);
|
|
24
|
+
const device = rendererByLayer.get(context.backend).device;
|
|
25
|
+
let name, attribute;
|
|
26
|
+
for ([name, attribute] of Object.entries(attributes)) {
|
|
27
|
+
attribute.size ||= 1;
|
|
28
|
+
attribute.count = attribute.data.length / attribute.size;
|
|
29
|
+
attribute.indexFormat = attribute.data instanceof Uint32Array ? 'uint32' : 'uint16';
|
|
30
|
+
attribute.buffer = device.createBuffer(/* alloc */ {
|
|
31
|
+
size: Math.max(4, attribute.data.byteLength),
|
|
32
|
+
usage: name === 'index'
|
|
33
|
+
? GPUBufferUsage.INDEX | GPUBufferUsage.COPY_DST
|
|
34
|
+
: GPUBufferUsage.VERTEX | GPUBufferUsage.COPY_DST,
|
|
35
|
+
});
|
|
36
|
+
device.queue.writeBuffer(attribute.buffer, 0, attribute.data);
|
|
37
|
+
}
|
|
38
|
+
const geometry = /* alloc */ {
|
|
39
|
+
device, attributes,
|
|
40
|
+
drawRange: /* alloc */ { start: 0, count: attributes.index?.count || attributes.position.count },
|
|
41
|
+
};
|
|
42
|
+
context.resources.push(geometry);
|
|
43
|
+
return /* alloc */ { device, geometry, program };
|
|
44
|
+
}
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Compute the cross product of two three-dimensional vectors.
|
|
3
|
-
*
|
|
4
|
-
* @param {ArrayLike<number>} a First vector.
|
|
5
|
-
* @param {ArrayLike<number>} b Second vector.
|
|
6
|
-
*
|
|
7
|
-
* @returns {Array<number>} Cross product.
|
|
8
|
-
*/
|
|
9
|
-
export function cross(a, b) {
|
|
10
|
-
return /* alloc */ [
|
|
11
|
-
a[1] * b[2] - a[2] * b[1],
|
|
12
|
-
a[2] * b[0] - a[0] * b[2],
|
|
13
|
-
a[0] * b[1] - a[1] * b[0]
|
|
14
|
-
];
|
|
15
|
-
}
|
|
1
|
+
/**
|
|
2
|
+
* Compute the cross product of two three-dimensional vectors.
|
|
3
|
+
*
|
|
4
|
+
* @param {ArrayLike<number>} a First vector.
|
|
5
|
+
* @param {ArrayLike<number>} b Second vector.
|
|
6
|
+
*
|
|
7
|
+
* @returns {Array<number>} Cross product.
|
|
8
|
+
*/
|
|
9
|
+
export function cross(a, b) {
|
|
10
|
+
return /* alloc */ [
|
|
11
|
+
a[1] * b[2] - a[2] * b[1],
|
|
12
|
+
a[2] * b[0] - a[0] * b[2],
|
|
13
|
+
a[0] * b[1] - a[1] * b[0]
|
|
14
|
+
];
|
|
15
|
+
}
|
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Parse a Leaflet dash array into a validated even-length numeric pattern.
|
|
3
|
-
*
|
|
4
|
-
* @param {Object} options Leaflet path options.
|
|
5
|
-
*
|
|
6
|
-
* @returns {Array<number>} Dash pattern, or an empty array for a solid line.
|
|
7
|
-
*
|
|
8
|
-
* @throws {Error} If a dash value is negative or non-finite.
|
|
9
|
-
*/
|
|
10
|
-
export function dashValues(options) {
|
|
11
|
-
const values = Array.isArray(options.dashArray) ? options.dashArray :
|
|
12
|
-
String(options.dashArray || '').trim().split(/[ ,]+/);
|
|
13
|
-
const dash = /* alloc */ [];
|
|
14
|
-
let value, allZero = true;
|
|
15
|
-
for (value of values) dash.push(Number(value));
|
|
16
|
-
for (value of dash) {
|
|
17
|
-
if (!Number.isFinite(value) || value < 0) throw /* alloc */ new Error('Invalid Leaflet dashArray');
|
|
18
|
-
if (value !== 0) allZero = false;
|
|
19
|
-
}
|
|
20
|
-
if (allZero) dash.length = 0;
|
|
21
|
-
if (dash.length % 2) dash.push(...dash);
|
|
22
|
-
return dash;
|
|
23
|
-
}
|
|
1
|
+
/**
|
|
2
|
+
* Parse a Leaflet dash array into a validated even-length numeric pattern.
|
|
3
|
+
*
|
|
4
|
+
* @param {Object} options Leaflet path options.
|
|
5
|
+
*
|
|
6
|
+
* @returns {Array<number>} Dash pattern, or an empty array for a solid line.
|
|
7
|
+
*
|
|
8
|
+
* @throws {Error} If a dash value is negative or non-finite.
|
|
9
|
+
*/
|
|
10
|
+
export function dashValues(options) {
|
|
11
|
+
const values = Array.isArray(options.dashArray) ? options.dashArray :
|
|
12
|
+
String(options.dashArray || '').trim().split(/[ ,]+/);
|
|
13
|
+
const dash = /* alloc */ [];
|
|
14
|
+
let value, allZero = true;
|
|
15
|
+
for (value of values) dash.push(Number(value));
|
|
16
|
+
for (value of dash) {
|
|
17
|
+
if (!Number.isFinite(value) || value < 0) throw /* alloc */ new Error('Invalid Leaflet dashArray');
|
|
18
|
+
if (value !== 0) allZero = false;
|
|
19
|
+
}
|
|
20
|
+
if (allZero) dash.length = 0;
|
|
21
|
+
if (dash.length % 2) dash.push(...dash);
|
|
22
|
+
return dash;
|
|
23
|
+
}
|
|
@@ -1,33 +1,33 @@
|
|
|
1
|
-
import { segment } from './segment.js';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Append dashed geometry along a segment while preserving the pattern phase.
|
|
5
|
-
*
|
|
6
|
-
* @param {Object} context Line geometry context and dash pattern.
|
|
7
|
-
* @param {L.Point} a Segment start.
|
|
8
|
-
* @param {L.Point} b Segment end.
|
|
9
|
-
* @param {number} length Segment length.
|
|
10
|
-
* @param {number} distance Distance at the start of the segment.
|
|
11
|
-
* @param {number} period Dash pattern period.
|
|
12
|
-
*
|
|
13
|
-
* @throws {Error} If dash lengths cannot advance at these coordinates.
|
|
14
|
-
*/
|
|
15
|
-
export function dashedSegment(context, a, b, length, distance, period) {
|
|
16
|
-
const dash = context.dash;
|
|
17
|
-
let offset = 0, phase = ((distance % period) + period) % period, index = 0, end, delta, skipped = 0;
|
|
18
|
-
while (index < dash.length - 1 && phase >= dash[index]) phase -= dash[index++];
|
|
19
|
-
let remaining = Math.max(0, dash[index] - phase);
|
|
20
|
-
while (offset < length) {
|
|
21
|
-
end = Math.min(length, offset + remaining);
|
|
22
|
-
if (end > offset && index % 2 === 0) {
|
|
23
|
-
delta = b.subtract(a).divideBy(length);
|
|
24
|
-
segment(context, a.add(delta.multiplyBy(offset)), a.add(delta.multiplyBy(end)), true, true);
|
|
25
|
-
}
|
|
26
|
-
if (end <= offset) {
|
|
27
|
-
if (++skipped >= dash.length) throw /* alloc */ new Error('Leaflet dashArray is too small for these coordinates');
|
|
28
|
-
} else skipped = 0;
|
|
29
|
-
offset = end;
|
|
30
|
-
index = (index + 1) % dash.length;
|
|
31
|
-
remaining = dash[index];
|
|
32
|
-
}
|
|
33
|
-
}
|
|
1
|
+
import { segment } from './segment.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Append dashed geometry along a segment while preserving the pattern phase.
|
|
5
|
+
*
|
|
6
|
+
* @param {Object} context Line geometry context and dash pattern.
|
|
7
|
+
* @param {L.Point} a Segment start.
|
|
8
|
+
* @param {L.Point} b Segment end.
|
|
9
|
+
* @param {number} length Segment length.
|
|
10
|
+
* @param {number} distance Distance at the start of the segment.
|
|
11
|
+
* @param {number} period Dash pattern period.
|
|
12
|
+
*
|
|
13
|
+
* @throws {Error} If dash lengths cannot advance at these coordinates.
|
|
14
|
+
*/
|
|
15
|
+
export function dashedSegment(context, a, b, length, distance, period) {
|
|
16
|
+
const dash = context.dash;
|
|
17
|
+
let offset = 0, phase = ((distance % period) + period) % period, index = 0, end, delta, skipped = 0;
|
|
18
|
+
while (index < dash.length - 1 && phase >= dash[index]) phase -= dash[index++];
|
|
19
|
+
let remaining = Math.max(0, dash[index] - phase);
|
|
20
|
+
while (offset < length) {
|
|
21
|
+
end = Math.min(length, offset + remaining);
|
|
22
|
+
if (end > offset && index % 2 === 0) {
|
|
23
|
+
delta = b.subtract(a).divideBy(length);
|
|
24
|
+
segment(context, a.add(delta.multiplyBy(offset)), a.add(delta.multiplyBy(end)), true, true);
|
|
25
|
+
}
|
|
26
|
+
if (end <= offset) {
|
|
27
|
+
if (++skipped >= dash.length) throw /* alloc */ new Error('Leaflet dashArray is too small for these coordinates');
|
|
28
|
+
} else skipped = 0;
|
|
29
|
+
offset = end;
|
|
30
|
+
index = (index + 1) % dash.length;
|
|
31
|
+
remaining = dash[index];
|
|
32
|
+
}
|
|
33
|
+
}
|