@openglobus/og 0.18.0 → 0.18.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 +8 -8
- package/lib/@openglobus/og.esm.js +2 -0
- package/lib/@openglobus/og.esm.js.map +1 -0
- package/lib/@openglobus/og.umd.js +2 -0
- package/lib/@openglobus/og.umd.js.map +1 -0
- package/lib/js/Clock.d.ts +106 -0
- package/{src/Clock.ts → lib/js/Clock.js} +31 -126
- package/lib/js/Deferred.d.ts +6 -0
- package/lib/js/Deferred.js +13 -0
- package/lib/js/Events.d.ts +90 -0
- package/{src/Events.ts → lib/js/Events.js} +29 -84
- package/lib/js/Extent.d.ts +145 -0
- package/{src/Extent.ts → lib/js/Extent.js} +74 -120
- package/lib/js/Globe.d.ts +132 -0
- package/{src/Globe.ts → lib/js/Globe.js} +61 -159
- package/lib/js/ImageCanvas.d.ts +128 -0
- package/{src/ImageCanvas.ts → lib/js/ImageCanvas.js} +24 -65
- package/lib/js/Lock.d.ts +15 -0
- package/{src/Lock.ts → lib/js/Lock.js} +7 -21
- package/lib/js/LonLat.d.ts +128 -0
- package/{src/LonLat.ts → lib/js/LonLat.js} +44 -75
- package/lib/js/Object3d.d.ts +49 -0
- package/{src/Object3d.ts → lib/js/Object3d.js} +64 -184
- package/lib/js/Popup.d.ts +46 -0
- package/{src/Popup.ts → lib/js/Popup.js} +42 -110
- package/lib/js/QueueArray.d.ts +16 -0
- package/{src/QueueArray.ts → lib/js/QueueArray.js} +12 -25
- package/lib/js/Rectangle.d.ts +76 -0
- package/{src/Rectangle.ts → lib/js/Rectangle.js} +12 -50
- package/lib/js/Stack.d.ts +20 -0
- package/{src/Stack.ts → lib/js/Stack.js} +13 -29
- package/lib/js/astro/astro.d.ts +39 -0
- package/{src/astro/astro.ts → lib/js/astro/astro.js} +2 -8
- package/lib/js/astro/earth.d.ts +8 -0
- package/{src/astro/earth.ts → lib/js/astro/earth.js} +3 -39
- package/lib/js/astro/jd.d.ts +234 -0
- package/{src/astro/jd.ts → lib/js/astro/jd.js} +55 -134
- package/lib/js/astro/orbit.d.ts +5 -0
- package/{src/astro/orbit.ts → lib/js/astro/orbit.js} +26 -39
- package/lib/js/astro/rotation.d.ts +2 -0
- package/{src/astro/rotation.ts → lib/js/astro/rotation.js} +2 -11
- package/lib/js/bv/Box.d.ts +32 -0
- package/{src/bv/Box.ts → lib/js/bv/Box.js} +7 -35
- package/lib/js/bv/Sphere.d.ts +37 -0
- package/{src/bv/Sphere.ts → lib/js/bv/Sphere.js} +6 -34
- package/{src/bv/index.ts → lib/js/bv/index.d.ts} +0 -1
- package/lib/js/bv/index.js +3 -0
- package/lib/js/camera/Camera.d.ts +314 -0
- package/{src/camera/Camera.ts → lib/js/camera/Camera.js} +77 -326
- package/lib/js/camera/Frustum.d.ts +139 -0
- package/{src/camera/Frustum.ts → lib/js/camera/Frustum.js} +66 -185
- package/lib/js/camera/PlanetCamera.d.ts +234 -0
- package/{src/camera/PlanetCamera.ts → lib/js/camera/PlanetCamera.js} +65 -338
- package/{src/camera/index.ts → lib/js/camera/index.d.ts} +0 -1
- package/lib/js/camera/index.js +3 -0
- package/lib/js/cons.d.ts +40 -0
- package/{src/cons.ts → lib/js/cons.js} +10 -22
- package/lib/js/control/Atmosphere.d.ts +16 -0
- package/{src/control/Atmosphere.ts → lib/js/control/Atmosphere.js} +33 -86
- package/lib/js/control/CompassButton.d.ts +16 -0
- package/{src/control/CompassButton.ts → lib/js/control/CompassButton.js} +18 -43
- package/lib/js/control/Control.d.ts +100 -0
- package/{src/control/Control.ts → lib/js/control/Control.js} +22 -89
- package/lib/js/control/DebugInfo.d.ts +25 -0
- package/{src/control/DebugInfo.ts → lib/js/control/DebugInfo.js} +38 -84
- package/lib/js/control/DrawingSwitcher.d.ts +13 -0
- package/{src/control/DrawingSwitcher.ts → lib/js/control/DrawingSwitcher.js} +13 -30
- package/lib/js/control/EarthCoordinates.d.ts +41 -0
- package/{src/control/EarthCoordinates.ts → lib/js/control/EarthCoordinates.js} +58 -119
- package/lib/js/control/EarthNavigation.d.ts +50 -0
- package/{src/control/EarthNavigation.ts → lib/js/control/EarthNavigation.js} +70 -161
- package/lib/js/control/GeoImageDragControl.d.ts +22 -0
- package/{src/control/GeoImageDragControl.ts → lib/js/control/GeoImageDragControl.js} +26 -49
- package/lib/js/control/KeyboardNavigation.d.ts +28 -0
- package/{src/control/KeyboardNavigation.ts → lib/js/control/KeyboardNavigation.js} +67 -92
- package/lib/js/control/LayerAnimation.d.ts +71 -0
- package/{src/control/LayerAnimation.ts → lib/js/control/LayerAnimation.js} +82 -162
- package/lib/js/control/LayerSwitcher.d.ts +21 -0
- package/{src/control/LayerSwitcher.ts → lib/js/control/LayerSwitcher.js} +16 -41
- package/lib/js/control/Lighting.d.ts +49 -0
- package/{src/control/Lighting.ts → lib/js/control/Lighting.js} +106 -219
- package/lib/js/control/MouseNavigation.d.ts +62 -0
- package/{src/control/MouseNavigation.ts → lib/js/control/MouseNavigation.js} +105 -211
- package/lib/js/control/MouseWheelZoomControl.d.ts +44 -0
- package/lib/js/control/MouseWheelZoomControl.js +181 -0
- package/lib/js/control/RulerSwitcher.d.ts +17 -0
- package/{src/control/RulerSwitcher.ts → lib/js/control/RulerSwitcher.js} +13 -28
- package/lib/js/control/ScaleControl.d.ts +24 -0
- package/lib/js/control/ScaleControl.js +91 -0
- package/lib/js/control/SegmentBoundVisualization.d.ts +12 -0
- package/lib/js/control/SegmentBoundVisualization.js +37 -0
- package/lib/js/control/ShowFps.d.ts +9 -0
- package/lib/js/control/ShowFps.js +20 -0
- package/lib/js/control/SimpleNavigation.d.ts +25 -0
- package/{src/control/SimpleNavigation.ts → lib/js/control/SimpleNavigation.js} +29 -51
- package/lib/js/control/SimpleSkyBackground.d.ts +15 -0
- package/{src/control/SimpleSkyBackground.ts → lib/js/control/SimpleSkyBackground.js} +21 -48
- package/lib/js/control/Sun.d.ts +33 -0
- package/{src/control/Sun.ts → lib/js/control/Sun.js} +34 -85
- package/lib/js/control/ToggleWireframe.d.ts +14 -0
- package/lib/js/control/ToggleWireframe.js +28 -0
- package/lib/js/control/TouchNavigation.d.ts +52 -0
- package/{src/control/TouchNavigation.ts → lib/js/control/TouchNavigation.js} +88 -193
- package/lib/js/control/ZoomControl.d.ts +27 -0
- package/{src/control/ZoomControl.ts → lib/js/control/ZoomControl.js} +25 -50
- package/lib/js/control/drawing/DrawingControl.d.ts +12 -0
- package/{src/control/drawing/DrawingControl.ts → lib/js/control/drawing/DrawingControl.js} +10 -20
- package/lib/js/control/drawing/LineStringDrawingScene.d.ts +15 -0
- package/{src/control/drawing/LineStringDrawingScene.ts → lib/js/control/drawing/LineStringDrawingScene.js} +28 -85
- package/lib/js/control/drawing/PolygonDrawingScene.d.ts +98 -0
- package/{src/control/drawing/PolygonDrawingScene.ts → lib/js/control/drawing/PolygonDrawingScene.js} +190 -388
- package/lib/js/control/elevationProfile/ElevationProfile.d.ts +61 -0
- package/{src/control/elevationProfile/ElevationProfile.ts → lib/js/control/elevationProfile/ElevationProfile.js} +56 -148
- package/lib/js/control/heightRuler/HeightRuler.d.ts +7 -0
- package/{src/control/heightRuler/HeightRuler.ts → lib/js/control/heightRuler/HeightRuler.js} +4 -9
- package/lib/js/control/heightRuler/HeightRulerScene.d.ts +35 -0
- package/{src/control/heightRuler/HeightRulerScene.ts → lib/js/control/heightRuler/HeightRulerScene.js} +47 -99
- package/lib/js/control/heightRuler/HeightRulerSwitcher.d.ts +6 -0
- package/{src/control/heightRuler/HeightRulerSwitcher.ts → lib/js/control/heightRuler/HeightRulerSwitcher.js} +2 -4
- package/{src/control/index.ts → lib/js/control/index.d.ts} +1 -18
- package/lib/js/control/index.js +28 -0
- package/lib/js/control/ruler/Ruler.d.ts +13 -0
- package/lib/js/control/ruler/Ruler.js +23 -0
- package/lib/js/control/ruler/RulerScene.d.ts +88 -0
- package/lib/js/control/ruler/RulerScene.js +324 -0
- package/lib/js/control/selection/Selection.d.ts +55 -0
- package/{src/control/selection/Selection.ts → lib/js/control/selection/Selection.js} +15 -34
- package/lib/js/control/selection/SelectionScene.d.ts +44 -0
- package/{src/control/selection/SelectionScene.ts → lib/js/control/selection/SelectionScene.js} +26 -113
- package/lib/js/control/timeline/TimelineControl.d.ts +18 -0
- package/{src/control/timeline/TimelineControl.ts → lib/js/control/timeline/TimelineControl.js} +13 -43
- package/lib/js/control/timeline/TimelineModel.d.ts +41 -0
- package/{src/control/timeline/TimelineModel.ts → lib/js/control/timeline/TimelineModel.js} +26 -74
- package/lib/js/control/timeline/TimelineView.d.ts +85 -0
- package/{src/control/timeline/TimelineView.ts → lib/js/control/timeline/TimelineView.js} +133 -281
- package/lib/js/control/timeline/timelineUtils.d.ts +12 -0
- package/lib/js/control/timeline/timelineUtils.js +112 -0
- package/lib/js/control/visibleExtent/Segment.d.ts +277 -0
- package/{src → lib/js}/control/visibleExtent/Segment.js +145 -698
- package/lib/js/control/visibleExtent/VisibleExtent.d.ts +5 -0
- package/{src → lib/js}/control/visibleExtent/VisibleExtent.js +1 -18
- package/lib/js/control/visibleExtent/drawnode.d.ts +7 -0
- package/{src/control/visibleExtent/drawnode.ts → lib/js/control/visibleExtent/drawnode.js} +1 -28
- package/lib/js/ellipsoid/Ellipsoid.d.ts +187 -0
- package/{src/ellipsoid/Ellipsoid.ts → lib/js/ellipsoid/Ellipsoid.js} +82 -267
- package/lib/js/ellipsoid/index.d.ts +3 -0
- package/lib/js/ellipsoid/index.js +3 -0
- package/lib/js/ellipsoid/wgs84.d.ts +6 -0
- package/{src/ellipsoid/wgs84.ts → lib/js/ellipsoid/wgs84.js} +1 -2
- package/lib/js/entity/BaseBillboard.d.ts +222 -0
- package/{src/entity/BaseBillboard.ts → lib/js/entity/BaseBillboard.js} +48 -165
- package/lib/js/entity/BaseBillboardHandler.d.ts +81 -0
- package/{src/entity/BaseBillboardHandler.ts → lib/js/entity/BaseBillboardHandler.js} +139 -365
- package/lib/js/entity/Billboard.d.ts +113 -0
- package/{src/entity/Billboard.ts → lib/js/entity/Billboard.js} +19 -83
- package/lib/js/entity/BillboardHandler.d.ts +15 -0
- package/{src/entity/BillboardHandler.ts → lib/js/entity/BillboardHandler.js} +27 -59
- package/lib/js/entity/Entity.d.ts +354 -0
- package/{src/entity/Entity.ts → lib/js/entity/Entity.js} +101 -373
- package/lib/js/entity/EntityCollection.d.ts +364 -0
- package/{src/entity/EntityCollection.ts → lib/js/entity/EntityCollection.js} +51 -353
- package/lib/js/entity/GeoObject.d.ts +138 -0
- package/{src/entity/GeoObject.ts → lib/js/entity/GeoObject.js} +41 -146
- package/lib/js/entity/GeoObjectHandler.d.ts +99 -0
- package/{src/entity/GeoObjectHandler.ts → lib/js/entity/GeoObjectHandler.js} +162 -423
- package/lib/js/entity/Geometry.d.ts +111 -0
- package/lib/js/entity/Geometry.js +283 -0
- package/lib/js/entity/GeometryHandler.d.ts +84 -0
- package/{src/entity/GeometryHandler.ts → lib/js/entity/GeometryHandler.js} +162 -657
- package/lib/js/entity/Label.d.ts +207 -0
- package/{src/entity/Label.ts → lib/js/entity/Label.js} +62 -164
- package/lib/js/entity/LabelHandler.d.ts +65 -0
- package/{src/entity/LabelHandler.ts → lib/js/entity/LabelHandler.js} +175 -408
- package/lib/js/entity/LabelWorker.d.ts +15 -0
- package/{src/entity/LabelWorker.ts → lib/js/entity/LabelWorker.js} +24 -45
- package/lib/js/entity/PointCloud.d.ts +179 -0
- package/{src/entity/PointCloud.ts → lib/js/entity/PointCloud.js} +65 -265
- package/lib/js/entity/PointCloudHandler.d.ts +42 -0
- package/{src/entity/PointCloudHandler.ts → lib/js/entity/PointCloudHandler.js} +19 -62
- package/lib/js/entity/Polyline.d.ts +337 -0
- package/{src/entity/Polyline.ts → lib/js/entity/Polyline.js} +289 -924
- package/lib/js/entity/PolylineHandler.d.ts +22 -0
- package/{src/entity/PolylineHandler.ts → lib/js/entity/PolylineHandler.js} +12 -37
- package/lib/js/entity/Ray.d.ts +133 -0
- package/{src/entity/Ray.ts → lib/js/entity/Ray.js} +26 -146
- package/lib/js/entity/RayHandler.d.ts +70 -0
- package/{src/entity/RayHandler.ts → lib/js/entity/RayHandler.js} +102 -342
- package/lib/js/entity/Strip.d.ts +127 -0
- package/{src/entity/Strip.ts → lib/js/entity/Strip.js} +102 -372
- package/lib/js/entity/StripHandler.d.ts +42 -0
- package/{src/entity/StripHandler.ts → lib/js/entity/StripHandler.js} +22 -74
- package/{src/entity/index.ts → lib/js/entity/index.d.ts} +1 -2
- package/lib/js/entity/index.js +11 -0
- package/lib/js/index.d.ts +33 -0
- package/lib/js/index.js +33 -0
- package/lib/js/input/KeyboardHandler.d.ts +33 -0
- package/{src/input/KeyboardHandler.ts → lib/js/input/KeyboardHandler.js} +45 -84
- package/lib/js/input/MouseHandler.d.ts +16 -0
- package/{src/input/MouseHandler.ts → lib/js/input/MouseHandler.js} +12 -36
- package/lib/js/input/TouchHandler.d.ts +11 -0
- package/{src/input/TouchHandler.ts → lib/js/input/TouchHandler.js} +11 -23
- package/lib/js/input/input.d.ts +3 -0
- package/{src/input/input.ts → lib/js/input/input.js} +1 -1
- package/lib/js/layer/BaseGeoImage.d.ts +145 -0
- package/{src/layer/BaseGeoImage.ts → lib/js/layer/BaseGeoImage.js} +70 -235
- package/lib/js/layer/CanvasTiles.d.ts +103 -0
- package/{src/layer/CanvasTiles.ts → lib/js/layer/CanvasTiles.js} +54 -146
- package/lib/js/layer/GeoImage.d.ts +61 -0
- package/{src/layer/GeoImage.ts → lib/js/layer/GeoImage.js} +24 -54
- package/lib/js/layer/GeoTexture2d.d.ts +17 -0
- package/lib/js/layer/GeoTexture2d.js +37 -0
- package/lib/js/layer/GeoVideo.d.ts +68 -0
- package/{src/layer/GeoVideo.ts → lib/js/layer/GeoVideo.js} +31 -61
- package/lib/js/layer/KML.d.ts +72 -0
- package/{src/layer/KML.ts → lib/js/layer/KML.js} +94 -138
- package/lib/js/layer/Layer.d.ts +401 -0
- package/{src/layer/Layer.ts → lib/js/layer/Layer.js} +92 -443
- package/lib/js/layer/Material.d.ts +34 -0
- package/{src/layer/Material.ts → lib/js/layer/Material.js} +9 -43
- package/lib/js/layer/Vector.d.ts +244 -0
- package/{src/layer/Vector.ts → lib/js/layer/Vector.js} +147 -418
- package/lib/js/layer/WMS.d.ts +75 -0
- package/{src/layer/WMS.ts → lib/js/layer/WMS.js} +18 -100
- package/lib/js/layer/XYZ.d.ts +149 -0
- package/{src/layer/XYZ.ts → lib/js/layer/XYZ.js} +71 -171
- package/lib/js/layer/index.d.ts +11 -0
- package/lib/js/layer/index.js +11 -0
- package/lib/js/light/LightSource.d.ts +174 -0
- package/{src/light/LightSource.ts → lib/js/light/LightSource.js} +22 -131
- package/lib/js/math/Line2.d.ts +11 -0
- package/{src/math/Line2.ts → lib/js/math/Line2.js} +5 -15
- package/lib/js/math/Line3.d.ts +28 -0
- package/lib/js/math/Line3.js +85 -0
- package/lib/js/math/Mat3.d.ts +77 -0
- package/{src/math/Mat3.ts → lib/js/math/Mat3.js} +22 -51
- package/lib/js/math/Mat4.d.ts +195 -0
- package/{src/math/Mat4.ts → lib/js/math/Mat4.js} +53 -219
- package/lib/js/math/Plane.d.ts +20 -0
- package/{src/math/Plane.ts → lib/js/math/Plane.js} +26 -40
- package/lib/js/math/Quat.d.ts +373 -0
- package/{src/math/Quat.ts → lib/js/math/Quat.js} +106 -319
- package/lib/js/math/Ray.d.ts +76 -0
- package/{src/math/Ray.ts → lib/js/math/Ray.js} +21 -66
- package/lib/js/math/Vec2.d.ts +310 -0
- package/{src/math/Vec2.ts → lib/js/math/Vec2.js} +55 -121
- package/lib/js/math/Vec3.d.ts +472 -0
- package/{src/math/Vec3.ts → lib/js/math/Vec3.js} +103 -236
- package/lib/js/math/Vec4.d.ts +163 -0
- package/{src/math/Vec4.ts → lib/js/math/Vec4.js} +23 -79
- package/lib/js/math/coder.d.ts +51 -0
- package/{src/math/coder.ts → lib/js/math/coder.js} +14 -20
- package/lib/js/math/index.d.ts +11 -0
- package/lib/js/math/index.js +11 -0
- package/lib/js/math.d.ts +266 -0
- package/{src/math.ts → lib/js/math.js} +37 -85
- package/lib/js/mercator.d.ts +92 -0
- package/{src/mercator.ts → lib/js/mercator.js} +13 -37
- package/lib/js/proj/EPSG3857.d.ts +9 -0
- package/{src/proj/EPSG3857.ts → lib/js/proj/EPSG3857.js} +0 -2
- package/lib/js/proj/EPSG4326.d.ts +9 -0
- package/{src/proj/EPSG4326.ts → lib/js/proj/EPSG4326.js} +0 -2
- package/lib/js/proj/Proj.d.ts +43 -0
- package/{src/proj/Proj.ts → lib/js/proj/Proj.js} +4 -29
- package/lib/js/quadTree/EPSG4326QuadTreeStrategy.d.ts +6 -0
- package/lib/js/quadTree/EPSG4326QuadTreeStrategy.js +17 -0
- package/lib/js/quadTree/EarthQuadTreeStrategy.d.ts +6 -0
- package/lib/js/quadTree/EarthQuadTreeStrategy.js +19 -0
- package/lib/js/quadTree/EntityCollectionNode.d.ts +54 -0
- package/{src/quadTree/EntityCollectionNode.ts → lib/js/quadTree/EntityCollectionNode.js} +83 -150
- package/lib/js/quadTree/MarsQuadTreeStrategy.d.ts +6 -0
- package/lib/js/quadTree/MarsQuadTreeStrategy.js +17 -0
- package/lib/js/quadTree/Node.d.ts +61 -0
- package/{src/quadTree/Node.ts → lib/js/quadTree/Node.js} +140 -357
- package/lib/js/quadTree/QuadTreeStrategy.d.ts +25 -0
- package/{src/quadTree/QuadTreeStrategy.ts → lib/js/quadTree/QuadTreeStrategy.js} +13 -44
- package/lib/js/quadTree/Wgs84QuadTreeStrategy.d.ts +6 -0
- package/lib/js/quadTree/Wgs84QuadTreeStrategy.js +15 -0
- package/lib/js/quadTree/index.d.ts +12 -0
- package/lib/js/quadTree/index.js +12 -0
- package/lib/js/quadTree/quadTree.d.ts +40 -0
- package/{src/quadTree/quadTree.ts → lib/js/quadTree/quadTree.js} +0 -9
- package/lib/js/renderer/Renderer.d.ts +311 -0
- package/{src/renderer/Renderer.ts → lib/js/renderer/Renderer.js} +169 -611
- package/lib/js/renderer/RendererEvents.d.ts +237 -0
- package/{src/renderer/RendererEvents.ts → lib/js/renderer/RendererEvents.js} +134 -471
- package/lib/js/scene/Axes.d.ts +12 -0
- package/lib/js/scene/Axes.js +59 -0
- package/lib/js/scene/BaseNode.d.ts +61 -0
- package/{src/scene/BaseNode.ts → lib/js/scene/BaseNode.js} +11 -57
- package/lib/js/scene/Planet.d.ts +623 -0
- package/{src/scene/Planet.ts → lib/js/scene/Planet.js} +251 -935
- package/lib/js/scene/RenderNode.d.ts +150 -0
- package/{src/scene/RenderNode.ts → lib/js/scene/RenderNode.js} +33 -138
- package/lib/js/scene/SkyBox.d.ts +13 -0
- package/{src/scene/SkyBox.ts → lib/js/scene/SkyBox.js} +16 -37
- package/{src/scene/index.ts → lib/js/scene/index.d.ts} +0 -1
- package/lib/js/scene/index.js +5 -0
- package/lib/js/segment/Segment.d.ts +278 -0
- package/{src/segment/Segment.ts → lib/js/segment/Segment.js} +242 -913
- package/lib/js/segment/SegmentLonLat.d.ts +48 -0
- package/{src/segment/SegmentLonLat.ts → lib/js/segment/SegmentLonLat.js} +58 -132
- package/lib/js/segment/SegmentLonLatWgs84.d.ts +10 -0
- package/lib/js/segment/SegmentLonLatWgs84.js +23 -0
- package/lib/js/segment/Slice.d.ts +13 -0
- package/{src/segment/Slice.ts → lib/js/segment/Slice.js} +4 -22
- package/lib/js/segment/segmentHelper.d.ts +18 -0
- package/{src/segment/segmentHelper.ts → lib/js/segment/segmentHelper.js} +30 -88
- package/lib/js/shaders/atmos.d.ts +4 -0
- package/{src/shaders/atmos.ts → lib/js/shaders/atmos.js} +8 -26
- package/lib/js/shaders/billboard.d.ts +3 -0
- package/{src/shaders/billboard.ts → lib/js/shaders/billboard.js} +9 -18
- package/lib/js/shaders/bloom.d.ts +2 -0
- package/{src/shaders/bloom.ts → lib/js/shaders/bloom.js} +5 -8
- package/lib/js/shaders/blur.d.ts +3 -0
- package/{src/shaders/blur.ts → lib/js/shaders/blur.js} +11 -19
- package/lib/js/shaders/depth.d.ts +2 -0
- package/{src/shaders/depth.ts → lib/js/shaders/depth.js} +3 -6
- package/lib/js/shaders/drawnode.d.ts +8 -0
- package/{src/shaders/drawnode.ts → lib/js/shaders/drawnode.js} +23 -75
- package/lib/js/shaders/geoObject.d.ts +3 -0
- package/{src/shaders/geoObject.ts → lib/js/shaders/geoObject.js} +51 -63
- package/lib/js/shaders/label.d.ts +4 -0
- package/{src/shaders/label.ts → lib/js/shaders/label.js} +12 -25
- package/lib/js/shaders/lumFilter.d.ts +2 -0
- package/{src/shaders/lumFilter.ts → lib/js/shaders/lumFilter.js} +4 -7
- package/lib/js/shaders/pickingMask.d.ts +2 -0
- package/{src/shaders/pickingMask.ts → lib/js/shaders/pickingMask.js} +5 -8
- package/lib/js/shaders/pointCloud.d.ts +2 -0
- package/{src/shaders/pointCloud.ts → lib/js/shaders/pointCloud.js} +4 -7
- package/lib/js/shaders/polyline.d.ts +3 -0
- package/{src/shaders/polyline.ts → lib/js/shaders/polyline.js} +7 -22
- package/lib/js/shaders/ray.d.ts +2 -0
- package/{src/shaders/ray.ts → lib/js/shaders/ray.js} +4 -7
- package/lib/js/shaders/screenFrame.d.ts +2 -0
- package/{src/shaders/screenFrame.ts → lib/js/shaders/screenFrame.js} +5 -8
- package/lib/js/shaders/skybox.d.ts +2 -0
- package/{src/shaders/skybox.ts → lib/js/shaders/skybox.js} +10 -13
- package/lib/js/shaders/toneMapping.d.ts +2 -0
- package/{src/shaders/toneMapping.ts → lib/js/shaders/toneMapping.js} +5 -8
- package/lib/js/shaders/utils.d.ts +1 -0
- package/{src/shaders/utils.ts → lib/js/shaders/utils.js} +1 -1
- package/lib/js/terrain/BilTerrain.d.ts +18 -0
- package/{src/terrain/BilTerrain.ts → lib/js/terrain/BilTerrain.js} +21 -118
- package/lib/js/terrain/EmptyTerrain.d.ts +106 -0
- package/{src/terrain/EmptyTerrain.ts → lib/js/terrain/EmptyTerrain.js} +20 -144
- package/lib/js/terrain/Geoid.d.ts +33 -0
- package/lib/js/terrain/Geoid.js +191 -0
- package/lib/js/terrain/GlobusTerrain.d.ts +134 -0
- package/{src/terrain/GlobusTerrain.ts → lib/js/terrain/GlobusTerrain.js} +82 -239
- package/lib/js/terrain/MapboxTerrain.d.ts +21 -0
- package/{src/terrain/MapboxTerrain.ts → lib/js/terrain/MapboxTerrain.js} +46 -215
- package/{src/terrain/index.ts → lib/js/terrain/index.d.ts} +0 -1
- package/lib/js/terrain/index.js +5 -0
- package/lib/js/ui/Button.d.ts +32 -0
- package/lib/js/ui/Button.js +78 -0
- package/lib/js/ui/ButtonGroup.d.ts +16 -0
- package/lib/js/ui/ButtonGroup.js +41 -0
- package/lib/js/ui/Dialog.d.ts +55 -0
- package/lib/js/ui/Dialog.js +173 -0
- package/lib/js/ui/Slider.d.ts +38 -0
- package/lib/js/ui/Slider.js +129 -0
- package/lib/js/ui/ToggleButton.d.ts +20 -0
- package/lib/js/ui/ToggleButton.js +42 -0
- package/lib/js/ui/View.d.ts +37 -0
- package/{src/ui/View.ts → lib/js/ui/View.js} +31 -77
- package/lib/js/ui/icons.d.ts +1 -0
- package/{src/ui/icons.ts → lib/js/ui/icons.js} +1 -1
- package/lib/js/utils/BaseWorker.d.ts +14 -0
- package/{src/utils/BaseWorker.ts → lib/js/utils/BaseWorker.js} +15 -28
- package/lib/js/utils/FontAtlas.d.ts +82 -0
- package/{src/utils/FontAtlas.ts → lib/js/utils/FontAtlas.js} +45 -181
- package/lib/js/utils/GeoImageCreator.d.ts +34 -0
- package/{src/utils/GeoImageCreator.ts → lib/js/utils/GeoImageCreator.js} +34 -91
- package/lib/js/utils/ImagesCacheManager.d.ts +22 -0
- package/{src/utils/ImagesCacheManager.ts → lib/js/utils/ImagesCacheManager.js} +16 -38
- package/lib/js/utils/Loader.d.ts +63 -0
- package/lib/js/utils/Loader.js +156 -0
- package/lib/js/utils/NormalMapCreator.d.ts +52 -0
- package/{src/utils/NormalMapCreator.ts → lib/js/utils/NormalMapCreator.js} +64 -195
- package/lib/js/utils/PlainSegmentWorker.d.ts +24 -0
- package/{src/utils/PlainSegmentWorker.ts → lib/js/utils/PlainSegmentWorker.js} +24 -56
- package/lib/js/utils/TerrainWorker.d.ts +28 -0
- package/{src/utils/TerrainWorker.ts → lib/js/utils/TerrainWorker.js} +19 -56
- package/lib/js/utils/TextureAtlas.d.ts +113 -0
- package/{src/utils/TextureAtlas.ts → lib/js/utils/TextureAtlas.js} +40 -131
- package/lib/js/utils/VectorTileCreator.d.ts +18 -0
- package/{src/utils/VectorTileCreator.ts → lib/js/utils/VectorTileCreator.js} +61 -147
- package/lib/js/utils/colorTable.d.ts +3 -0
- package/{src/utils/colorTable.ts → lib/js/utils/colorTable.js} +2 -2
- package/lib/js/utils/earcut.d.ts +7 -0
- package/{src/utils/earcut.ts → lib/js/utils/earcut.js} +95 -223
- package/lib/js/utils/objParser.d.ts +24 -0
- package/{src/utils/objParser.ts → lib/js/utils/objParser.js} +38 -93
- package/lib/js/utils/shared.d.ts +267 -0
- package/{src/utils/shared.ts → lib/js/utils/shared.js} +184 -341
- package/lib/js/utils/units.d.ts +16 -0
- package/lib/js/utils/units.js +61 -0
- package/lib/js/webgl/BaseFramebuffer.d.ts +53 -0
- package/{src/webgl/BaseFramebuffer.ts → lib/js/webgl/BaseFramebuffer.js} +22 -59
- package/lib/js/webgl/Framebuffer.d.ts +69 -0
- package/{src/webgl/Framebuffer.ts → lib/js/webgl/Framebuffer.js} +30 -87
- package/lib/js/webgl/Handler.d.ts +473 -0
- package/{src/webgl/Handler.ts → lib/js/webgl/Handler.js} +175 -586
- package/lib/js/webgl/Multisample.d.ts +27 -0
- package/lib/js/webgl/Multisample.js +77 -0
- package/lib/js/webgl/Program.d.ts +159 -0
- package/{src/webgl/Program.ts → lib/js/webgl/Program.js} +73 -210
- package/lib/js/webgl/ProgramController.d.ts +86 -0
- package/{src/webgl/ProgramController.ts → lib/js/webgl/ProgramController.js} +11 -45
- package/{src/webgl/index.ts → lib/js/webgl/index.d.ts} +1 -8
- package/lib/js/webgl/index.js +6 -0
- package/lib/js/webgl/types.d.ts +9 -0
- package/{src/webgl/types.ts → lib/js/webgl/types.js} +5 -8
- package/lib/js/webgl/variableHandlers.d.ts +22 -0
- package/lib/js/webgl/variableHandlers.js +78 -0
- package/package.json +23 -34
- package/dist/@openglobus/og.esm.js +0 -2
- package/dist/@openglobus/og.esm.js.map +0 -1
- package/dist/@openglobus/og.umd.js +0 -2
- package/dist/@openglobus/og.umd.js.map +0 -1
- package/src/Deferred.ts +0 -17
- package/src/control/MouseWheelZoomControl.ts +0 -269
- package/src/control/ScaleControl.ts +0 -131
- package/src/control/SegmentBoundVisualization.ts +0 -50
- package/src/control/ShowFps.ts +0 -28
- package/src/control/ToggleWireframe.ts +0 -35
- package/src/control/ruler/Ruler.ts +0 -35
- package/src/control/ruler/RulerScene.ts +0 -437
- package/src/control/timeline/timelineUtils.ts +0 -133
- package/src/ellipsoid/index.ts +0 -4
- package/src/entity/Geometry.ts +0 -486
- package/src/index.ts +0 -173
- package/src/layer/GeoTexture2d.ts +0 -56
- package/src/layer/index.ts +0 -12
- package/src/math/Line3.ts +0 -162
- package/src/math/index.ts +0 -26
- package/src/quadTree/EPSG4326QuadTreeStrategy.ts +0 -24
- package/src/quadTree/EarthQuadTreeStrategy.ts +0 -28
- package/src/quadTree/MarsQuadTreeStrategy.ts +0 -25
- package/src/quadTree/Wgs84QuadTreeStrategy.ts +0 -22
- package/src/quadTree/index.ts +0 -14
- package/src/scene/Axes.ts +0 -78
- package/src/segment/SegmentLonLatWgs84.ts +0 -33
- package/src/terrain/Geoid.ts +0 -273
- package/src/ui/Button.ts +0 -121
- package/src/ui/ButtonGroup.ts +0 -63
- package/src/ui/Dialog.ts +0 -244
- package/src/ui/Slider.ts +0 -188
- package/src/ui/ToggleButton.ts +0 -68
- package/src/utils/Loader.ts +0 -247
- package/src/utils/units.ts +0 -78
- package/src/webgl/Multisample.ts +0 -153
- package/src/webgl/variableHandlers.ts +0 -114
- /package/{dist → lib}/@openglobus/og.css +0 -0
- /package/{dist → lib}/@openglobus/res/fonts/Karla-Bold.json +0 -0
- /package/{dist → lib}/@openglobus/res/fonts/Karla-Bold.ttf.cfg +0 -0
- /package/{dist → lib}/@openglobus/res/fonts/Karla-Bold.ttf.png +0 -0
- /package/{dist → lib}/@openglobus/res/fonts/Karla-Light.json +0 -0
- /package/{dist → lib}/@openglobus/res/fonts/Karla-Light.ttf.cfg +0 -0
- /package/{dist → lib}/@openglobus/res/fonts/Karla-Light.ttf.png +0 -0
- /package/{dist → lib}/@openglobus/res/fonts/Karla-Medium.json +0 -0
- /package/{dist → lib}/@openglobus/res/fonts/Karla-Medium.ttf.cfg +0 -0
- /package/{dist → lib}/@openglobus/res/fonts/Karla-Medium.ttf.png +0 -0
- /package/{dist → lib}/@openglobus/res/fonts/NotoSansArabic-Regular.json +0 -0
- /package/{dist → lib}/@openglobus/res/fonts/NotoSansArabic-Regular.ttf.cfg +0 -0
- /package/{dist → lib}/@openglobus/res/fonts/NotoSansArabic-Regular.ttf.png +0 -0
- /package/{dist → lib}/@openglobus/res/fonts/Roboto-Regular.json +0 -0
- /package/{dist → lib}/@openglobus/res/fonts/Roboto-Regular.ttf.cfg +0 -0
- /package/{dist → lib}/@openglobus/res/fonts/Roboto-Regular.ttf.png +0 -0
- /package/{dist → lib}/@openglobus/res/fonts/arial.js +0 -0
- /package/{dist → lib}/@openglobus/res/fonts/arial.json +0 -0
- /package/{dist → lib}/@openglobus/res/fonts/arial.ttf.cfg +0 -0
- /package/{dist → lib}/@openglobus/res/fonts/arial.ttf.png +0 -0
- /package/{dist → lib}/@openglobus/res/night-4326.png +0 -0
- /package/{dist → lib}/@openglobus/res/night.png +0 -0
- /package/{dist → lib}/@openglobus/res/spec.png +0 -0
|
@@ -1,63 +1,52 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @module og/utils/shared
|
|
3
3
|
*/
|
|
4
|
-
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
|
|
11
|
-
import {colorTable} from "./colorTable";
|
|
12
|
-
|
|
13
|
-
export function getDefault(param?: any, def?: any): boolean {
|
|
4
|
+
import { Extent } from "../Extent";
|
|
5
|
+
import { LonLat } from "../LonLat";
|
|
6
|
+
import { Vec2 } from "../math/Vec2";
|
|
7
|
+
import { Vec3 } from "../math/Vec3";
|
|
8
|
+
import { Vec4 } from "../math/Vec4";
|
|
9
|
+
import { colorTable } from "./colorTable";
|
|
10
|
+
export function getDefault(param, def) {
|
|
14
11
|
return param != undefined ? param : def;
|
|
15
12
|
}
|
|
16
|
-
|
|
17
|
-
export function isEmpty(v: any): boolean {
|
|
13
|
+
export function isEmpty(v) {
|
|
18
14
|
return v == null;
|
|
19
15
|
}
|
|
20
|
-
|
|
21
16
|
/**
|
|
22
17
|
* Returns true if the object pointer is undefined.
|
|
23
18
|
* @function
|
|
24
19
|
* @param {Object} obj - Object pointer.
|
|
25
20
|
* @returns {boolean} Returns true if object is undefined.
|
|
26
21
|
*/
|
|
27
|
-
export function isUndef(obj
|
|
22
|
+
export function isUndef(obj) {
|
|
28
23
|
return obj === void 0;
|
|
29
24
|
}
|
|
30
|
-
|
|
31
|
-
export function isUndefExt(obj: any, defVal: any): any {
|
|
25
|
+
export function isUndefExt(obj, defVal) {
|
|
32
26
|
return isUndef(obj) ? defVal : obj;
|
|
33
27
|
}
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
export function stamp(obj: any): number {
|
|
28
|
+
let _stampCounter = 0;
|
|
29
|
+
export function stamp(obj) {
|
|
38
30
|
let stamp = obj._openglobus_id;
|
|
39
31
|
if (!stamp) {
|
|
40
32
|
stamp = obj._openglobus_id = ++_stampCounter;
|
|
41
33
|
}
|
|
42
34
|
return stamp;
|
|
43
35
|
}
|
|
44
|
-
|
|
45
|
-
export function isString(s: any): boolean {
|
|
36
|
+
export function isString(s) {
|
|
46
37
|
return typeof s === "string" || s instanceof String;
|
|
47
38
|
}
|
|
48
|
-
|
|
49
39
|
/**
|
|
50
40
|
* Convert html color string to the RGBA number vector.
|
|
51
41
|
* @param {string} htmlColor - HTML string("#C6C6C6" or "#EF5" or "rgb(8,8,8)" or "rgba(8,8,8)") color.
|
|
52
42
|
* @param {number} [opacity] - Opacity for the output vector.
|
|
53
43
|
* @returns {Vec4} -
|
|
54
44
|
*/
|
|
55
|
-
export function htmlColorToRgba(htmlColor
|
|
56
|
-
let hColor
|
|
45
|
+
export function htmlColorToRgba(htmlColor, opacity) {
|
|
46
|
+
let hColor = colorTable[htmlColor];
|
|
57
47
|
if (hColor) {
|
|
58
48
|
htmlColor = hColor;
|
|
59
49
|
}
|
|
60
|
-
|
|
61
50
|
if (htmlColor[0] === "#") {
|
|
62
51
|
let shorthandRegex = /^#?([a-f\d])([a-f\d])([a-f\d])$/i;
|
|
63
52
|
let hex = htmlColor.replace(shorthandRegex, function (m, r, g, b) {
|
|
@@ -65,45 +54,34 @@ export function htmlColorToRgba(htmlColor: string, opacity?: number): Vec4 {
|
|
|
65
54
|
});
|
|
66
55
|
let result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex);
|
|
67
56
|
if (result) {
|
|
68
|
-
return new Vec4(
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
parseInt(result[3], 16) / 255,
|
|
72
|
-
isEmpty(opacity) ? 1.0 : opacity
|
|
73
|
-
);
|
|
74
|
-
} else {
|
|
57
|
+
return new Vec4(parseInt(result[1], 16) / 255, parseInt(result[2], 16) / 255, parseInt(result[3], 16) / 255, isEmpty(opacity) ? 1.0 : opacity);
|
|
58
|
+
}
|
|
59
|
+
else {
|
|
75
60
|
return new Vec4();
|
|
76
61
|
}
|
|
77
|
-
}
|
|
62
|
+
}
|
|
63
|
+
else {
|
|
78
64
|
if (isEmpty(opacity)) {
|
|
79
65
|
opacity = 1.0;
|
|
80
66
|
}
|
|
81
67
|
let m = htmlColor.split(",");
|
|
82
|
-
return new Vec4(
|
|
83
|
-
parseInt(m[0].split("(")[1]) / 255,
|
|
84
|
-
parseInt(m[1]) / 255,
|
|
85
|
-
parseInt(m[2]) / 255,
|
|
86
|
-
!isEmpty(m[3]) ? parseFloat(m[3]) : opacity
|
|
87
|
-
);
|
|
68
|
+
return new Vec4(parseInt(m[0].split("(")[1]) / 255, parseInt(m[1]) / 255, parseInt(m[2]) / 255, !isEmpty(m[3]) ? parseFloat(m[3]) : opacity);
|
|
88
69
|
}
|
|
89
70
|
}
|
|
90
|
-
|
|
91
|
-
export function htmlColorToFloat32Array(htmlColor: string, opacity?: number): Float32Array {
|
|
71
|
+
export function htmlColorToFloat32Array(htmlColor, opacity) {
|
|
92
72
|
let c = htmlColorToRgba(htmlColor, opacity);
|
|
93
73
|
return new Float32Array([c.x, c.y, c.z, c.w]);
|
|
94
74
|
}
|
|
95
|
-
|
|
96
75
|
/**
|
|
97
76
|
* Convert html color string to the RGB number vector.
|
|
98
77
|
* @param {string} htmlColor - HTML string("#C6C6C6" or "#EF5" or "rgb(8,8,8)" or "rgba(8,8,8)") color.
|
|
99
78
|
* @returns {Vec3} -
|
|
100
79
|
*/
|
|
101
|
-
export function htmlColorToRgb(htmlColor
|
|
102
|
-
let hColor
|
|
80
|
+
export function htmlColorToRgb(htmlColor) {
|
|
81
|
+
let hColor = colorTable[htmlColor];
|
|
103
82
|
if (hColor) {
|
|
104
83
|
htmlColor = hColor;
|
|
105
84
|
}
|
|
106
|
-
|
|
107
85
|
if (htmlColor[0] === "#") {
|
|
108
86
|
let shorthandRegex = /^#?([a-f\d])([a-f\d])([a-f\d])$/i;
|
|
109
87
|
let hex = htmlColor.replace(shorthandRegex, function (m, r, g, b) {
|
|
@@ -111,24 +89,17 @@ export function htmlColorToRgb(htmlColor: string): Vec3 {
|
|
|
111
89
|
});
|
|
112
90
|
let result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex);
|
|
113
91
|
if (result) {
|
|
114
|
-
return new Vec3(
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
parseInt(result[3], 16) / 255
|
|
118
|
-
);
|
|
119
|
-
} else {
|
|
92
|
+
return new Vec3(parseInt(result[1], 16) / 255, parseInt(result[2], 16) / 255, parseInt(result[3], 16) / 255);
|
|
93
|
+
}
|
|
94
|
+
else {
|
|
120
95
|
return new Vec3();
|
|
121
96
|
}
|
|
122
|
-
}
|
|
97
|
+
}
|
|
98
|
+
else {
|
|
123
99
|
let m = htmlColor.split(",");
|
|
124
|
-
return new Vec3(
|
|
125
|
-
parseInt(m[0].split("(")[1]) / 255,
|
|
126
|
-
parseInt(m[1]) / 255,
|
|
127
|
-
parseInt(m[2]) / 255
|
|
128
|
-
);
|
|
100
|
+
return new Vec3(parseInt(m[0].split("(")[1]) / 255, parseInt(m[1]) / 255, parseInt(m[2]) / 255);
|
|
129
101
|
}
|
|
130
102
|
}
|
|
131
|
-
|
|
132
103
|
/**
|
|
133
104
|
* Replace template substrings between '{' and '}' tokens.
|
|
134
105
|
* @param {string} template - String with templates in "{" and "}"
|
|
@@ -144,28 +115,25 @@ export function htmlColorToRgb(htmlColor: string): Vec3 {
|
|
|
144
115
|
* og.utils.stringTemplate("http://earth3.openglobus.org/{z}/{y}/{x}.ddm", substrings);
|
|
145
116
|
* //returns http://earth3.openglobus.org/8/15/12.ddm
|
|
146
117
|
*/
|
|
147
|
-
export function stringTemplate(template
|
|
118
|
+
export function stringTemplate(template, params) {
|
|
148
119
|
return template.replace(/{[^{}]+}/g, function (key) {
|
|
149
120
|
return params[key.replace(/[{}]+/g, "")] || "";
|
|
150
121
|
});
|
|
151
122
|
}
|
|
152
|
-
|
|
153
|
-
export function getHTML(template: string, params?: any): string {
|
|
123
|
+
export function getHTML(template, params) {
|
|
154
124
|
return stringTemplate(template, params);
|
|
155
125
|
}
|
|
156
|
-
|
|
157
|
-
export function parseHTML(htmlStr: string): HTMLElement[] {
|
|
126
|
+
export function parseHTML(htmlStr) {
|
|
158
127
|
let p = document.createElement("div");
|
|
159
128
|
p.innerHTML = htmlStr;
|
|
160
|
-
let domArr
|
|
129
|
+
let domArr = [];
|
|
161
130
|
for (let i = 0; i < p.childNodes.length; i++) {
|
|
162
|
-
domArr.push(p.childNodes[i]
|
|
131
|
+
domArr.push(p.childNodes[i]);
|
|
163
132
|
p.removeChild(p.childNodes[i]);
|
|
164
133
|
}
|
|
165
134
|
return domArr;
|
|
166
135
|
}
|
|
167
|
-
|
|
168
|
-
export function print2d(id: string, text: string, x: number, y: number) {
|
|
136
|
+
export function print2d(id, text, x, y) {
|
|
169
137
|
let el = document.getElementById(id);
|
|
170
138
|
if (!el) {
|
|
171
139
|
el = document.createElement("div");
|
|
@@ -177,111 +145,118 @@ export function print2d(id: string, text: string, x: number, y: number) {
|
|
|
177
145
|
el.style.left = `${x}px`;
|
|
178
146
|
el.style.top = `${y}px`;
|
|
179
147
|
}
|
|
180
|
-
|
|
181
|
-
export function defaultString(str?: string, def: string = ""): string {
|
|
148
|
+
export function defaultString(str, def = "") {
|
|
182
149
|
return str ? str.trim().toLowerCase() : def;
|
|
183
150
|
}
|
|
184
|
-
|
|
185
|
-
export function createVector3(v?: Vec3 | Vec2 | NumberArray3 | NumberArray2 | null, def?: Vec3): Vec3 {
|
|
151
|
+
export function createVector3(v, def) {
|
|
186
152
|
if (v) {
|
|
187
153
|
if (v instanceof Vec3) {
|
|
188
154
|
return v.clone();
|
|
189
|
-
}
|
|
155
|
+
}
|
|
156
|
+
else if (v instanceof Array) {
|
|
190
157
|
return Vec3.fromVec(v);
|
|
191
|
-
}
|
|
158
|
+
}
|
|
159
|
+
else if (v instanceof Vec2) {
|
|
192
160
|
return new Vec3(v.x, v.y, 0.0);
|
|
193
161
|
}
|
|
194
|
-
}
|
|
162
|
+
}
|
|
163
|
+
else if (def) {
|
|
195
164
|
return def;
|
|
196
165
|
}
|
|
197
166
|
return new Vec3();
|
|
198
167
|
}
|
|
199
|
-
|
|
200
|
-
export function createVector4(v?: Vec4 | NumberArray4 | null, def?: Vec4): Vec4 {
|
|
168
|
+
export function createVector4(v, def) {
|
|
201
169
|
if (v) {
|
|
202
170
|
if (v instanceof Vec4) {
|
|
203
171
|
return v.clone();
|
|
204
|
-
}
|
|
172
|
+
}
|
|
173
|
+
else if (v instanceof Array) {
|
|
205
174
|
return Vec4.fromVec(v);
|
|
206
175
|
}
|
|
207
|
-
}
|
|
176
|
+
}
|
|
177
|
+
else if (def) {
|
|
208
178
|
return def;
|
|
209
179
|
}
|
|
210
180
|
return new Vec4();
|
|
211
181
|
}
|
|
212
|
-
|
|
213
|
-
export function createColorRGBA(c?: string | NumberArray4 | Vec4 | null, def?: Vec4): Vec4 {
|
|
182
|
+
export function createColorRGBA(c, def) {
|
|
214
183
|
if (c) {
|
|
215
184
|
if (isString(c)) {
|
|
216
|
-
return htmlColorToRgba(c
|
|
217
|
-
}
|
|
185
|
+
return htmlColorToRgba(c);
|
|
186
|
+
}
|
|
187
|
+
else if (c instanceof Array) {
|
|
218
188
|
return Vec4.fromVec(c);
|
|
219
|
-
}
|
|
189
|
+
}
|
|
190
|
+
else if (c instanceof Vec4) {
|
|
220
191
|
return c.clone();
|
|
221
192
|
}
|
|
222
|
-
}
|
|
193
|
+
}
|
|
194
|
+
else if (def) {
|
|
223
195
|
return def;
|
|
224
196
|
}
|
|
225
197
|
return new Vec4(1.0, 1.0, 1.0, 1.0);
|
|
226
198
|
}
|
|
227
|
-
|
|
228
|
-
export function createColorRGB(c?: string | NumberArray3 | Vec3 | null, def?: Vec3): Vec3 {
|
|
199
|
+
export function createColorRGB(c, def) {
|
|
229
200
|
if (c) {
|
|
230
201
|
if (isString(c)) {
|
|
231
|
-
return htmlColorToRgb(c
|
|
232
|
-
}
|
|
202
|
+
return htmlColorToRgb(c);
|
|
203
|
+
}
|
|
204
|
+
else if (c instanceof Array) {
|
|
233
205
|
return Vec3.fromVec(c);
|
|
234
|
-
} else if (c instanceof Vec3) {
|
|
235
|
-
return (c as Vec3).clone();
|
|
236
206
|
}
|
|
237
|
-
|
|
207
|
+
else if (c instanceof Vec3) {
|
|
208
|
+
return c.clone();
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
else if (def) {
|
|
238
212
|
return def;
|
|
239
213
|
}
|
|
240
214
|
return new Vec3(1.0, 1.0, 1.0);
|
|
241
215
|
}
|
|
242
|
-
|
|
243
|
-
export function createExtent(e?: Extent | [[number, number], [number, number]] | null, def?: Extent): Extent {
|
|
216
|
+
export function createExtent(e, def) {
|
|
244
217
|
if (e) {
|
|
245
218
|
if (e instanceof Array) {
|
|
246
219
|
return new Extent(createLonLat(e[0]), createLonLat(e[1]));
|
|
247
|
-
}
|
|
220
|
+
}
|
|
221
|
+
else if (e instanceof Extent) {
|
|
248
222
|
return e.clone();
|
|
249
223
|
}
|
|
250
|
-
}
|
|
224
|
+
}
|
|
225
|
+
else if (def) {
|
|
251
226
|
return def;
|
|
252
227
|
}
|
|
253
228
|
return new Extent();
|
|
254
229
|
}
|
|
255
|
-
|
|
256
|
-
export function createLonLat(l?: LonLat | NumberArray2 | NumberArray3, def?: LonLat): LonLat {
|
|
230
|
+
export function createLonLat(l, def) {
|
|
257
231
|
if (l) {
|
|
258
232
|
if (l instanceof Array) {
|
|
259
233
|
return new LonLat(l[0], l[1], l[2]);
|
|
260
|
-
}
|
|
234
|
+
}
|
|
235
|
+
else if (l instanceof LonLat) {
|
|
261
236
|
return l.clone();
|
|
262
237
|
}
|
|
263
|
-
}
|
|
238
|
+
}
|
|
239
|
+
else if (def) {
|
|
264
240
|
return def;
|
|
265
241
|
}
|
|
266
242
|
return new LonLat();
|
|
267
243
|
}
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
let start = 0,
|
|
271
|
-
end = arr.length - 1;
|
|
244
|
+
export function binarySearchFast(arr, x) {
|
|
245
|
+
let start = 0, end = arr.length - 1;
|
|
272
246
|
while (start <= end) {
|
|
273
247
|
let k = Math.floor((start + end) * 0.5);
|
|
274
248
|
if (arr[k] === x) {
|
|
275
249
|
return k;
|
|
276
|
-
}
|
|
250
|
+
}
|
|
251
|
+
else if (arr[k] < x) {
|
|
277
252
|
start = k + 1;
|
|
278
|
-
}
|
|
253
|
+
}
|
|
254
|
+
else {
|
|
279
255
|
end = k - 1;
|
|
280
256
|
}
|
|
281
257
|
}
|
|
282
258
|
return -1;
|
|
283
259
|
}
|
|
284
|
-
|
|
285
260
|
/**
|
|
286
261
|
* Finds an item in a sorted array.
|
|
287
262
|
* @param {any[]} ar The sorted array to search.
|
|
@@ -298,7 +273,7 @@ export function binarySearchFast(arr: number[] | TypedArray, x: number) {
|
|
|
298
273
|
* var numbers = [0, 2, 4, 6, 8];
|
|
299
274
|
* var index = og.utils.binarySearch(numbers, 6, comparator); // 3
|
|
300
275
|
*/
|
|
301
|
-
export function binarySearch(ar
|
|
276
|
+
export function binarySearch(ar, el, compare_fn) {
|
|
302
277
|
let m = 0;
|
|
303
278
|
let n = ar.length - 1;
|
|
304
279
|
while (m <= n) {
|
|
@@ -306,15 +281,16 @@ export function binarySearch(ar: any[], el: any, compare_fn: Function): number {
|
|
|
306
281
|
let cmp = compare_fn(el, ar[k], k);
|
|
307
282
|
if (cmp > 0) {
|
|
308
283
|
m = k + 1;
|
|
309
|
-
}
|
|
284
|
+
}
|
|
285
|
+
else if (cmp < 0) {
|
|
310
286
|
n = k - 1;
|
|
311
|
-
}
|
|
287
|
+
}
|
|
288
|
+
else {
|
|
312
289
|
return k;
|
|
313
290
|
}
|
|
314
291
|
}
|
|
315
292
|
return -m - 1;
|
|
316
293
|
}
|
|
317
|
-
|
|
318
294
|
/**
|
|
319
295
|
* Binary insertion that uses binarySearch algorithm.
|
|
320
296
|
* @param {any[]} ar - The sorted array to insert.
|
|
@@ -323,7 +299,7 @@ export function binarySearch(ar: any[], el: any, compare_fn: Function): number {
|
|
|
323
299
|
* elements in the array.
|
|
324
300
|
* @returns {number} Array index position in which item inserted in.
|
|
325
301
|
*/
|
|
326
|
-
export function binaryInsert(ar
|
|
302
|
+
export function binaryInsert(ar, el, compare_fn) {
|
|
327
303
|
let i = binarySearch(ar, el, compare_fn);
|
|
328
304
|
if (i < 0) {
|
|
329
305
|
i = ~i;
|
|
@@ -331,7 +307,6 @@ export function binaryInsert(ar: any[], el: any, compare_fn: Function): number {
|
|
|
331
307
|
ar.splice(i, 0, el);
|
|
332
308
|
return i;
|
|
333
309
|
}
|
|
334
|
-
|
|
335
310
|
/**
|
|
336
311
|
* Returns two segment lines intersection coordinate.
|
|
337
312
|
* @static
|
|
@@ -342,36 +317,26 @@ export function binaryInsert(ar: any[], el: any, compare_fn: Function): number {
|
|
|
342
317
|
* @param {boolean} [isSegment] - Lines are segments.
|
|
343
318
|
* @return {Vec2} - Intersection coordinate.
|
|
344
319
|
*/
|
|
345
|
-
export function getLinesIntersection2v(start1
|
|
320
|
+
export function getLinesIntersection2v(start1, end1, start2, end2, isSegment) {
|
|
346
321
|
let dir1 = end1.sub(start1);
|
|
347
322
|
let dir2 = end2.sub(start2);
|
|
348
|
-
|
|
349
323
|
let a1 = -dir1.y;
|
|
350
324
|
let b1 = +dir1.x;
|
|
351
325
|
let d1 = -(a1 * start1.x + b1 * start1.y);
|
|
352
|
-
|
|
353
326
|
let a2 = -dir2.y;
|
|
354
327
|
let b2 = +dir2.x;
|
|
355
328
|
let d2 = -(a2 * start2.x + b2 * start2.y);
|
|
356
|
-
|
|
357
329
|
let seg1_line2_start = a2 * start1.x + b2 * start1.y + d2;
|
|
358
330
|
let seg1_line2_end = a2 * end1.x + b2 * end1.y + d2;
|
|
359
|
-
|
|
360
331
|
let seg2_line1_start = a1 * start2.x + b1 * start2.y + d1;
|
|
361
332
|
let seg2_line1_end = a1 * end2.x + b1 * end2.y + d1;
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
isSegment &&
|
|
365
|
-
(seg1_line2_start * seg1_line2_end > 0 || seg2_line1_start * seg2_line1_end > 0)
|
|
366
|
-
) {
|
|
333
|
+
if (isSegment &&
|
|
334
|
+
(seg1_line2_start * seg1_line2_end > 0 || seg2_line1_start * seg2_line1_end > 0)) {
|
|
367
335
|
return undefined;
|
|
368
336
|
}
|
|
369
|
-
|
|
370
337
|
let u = seg1_line2_start / (seg1_line2_start - seg1_line2_end);
|
|
371
|
-
|
|
372
338
|
return new Vec2(start1.x + u * dir1.x, start1.y + u * dir1.y);
|
|
373
339
|
}
|
|
374
|
-
|
|
375
340
|
/**
|
|
376
341
|
* Returns two segment lines intersection coordinate.
|
|
377
342
|
* @static
|
|
@@ -382,46 +347,35 @@ export function getLinesIntersection2v(start1: Vec2, end1: Vec2, start2: Vec2, e
|
|
|
382
347
|
* @param {boolean} [isSegment=false] - Lines are segments.
|
|
383
348
|
* @return {Vec2} - Intersection coordinate.
|
|
384
349
|
*/
|
|
385
|
-
export function getLinesIntersectionLonLat(start1
|
|
350
|
+
export function getLinesIntersectionLonLat(start1, end1, start2, end2, isSegment = false) {
|
|
386
351
|
let dir1 = new LonLat(end1.lon - start1.lon, end1.lat - start1.lat);
|
|
387
352
|
let dir2 = new LonLat(end2.lon - start2.lon, end2.lat - start2.lat);
|
|
388
|
-
|
|
389
353
|
let a1 = -dir1.lat;
|
|
390
354
|
let b1 = +dir1.lon;
|
|
391
355
|
let d1 = -(a1 * start1.lon + b1 * start1.lat);
|
|
392
|
-
|
|
393
356
|
let a2 = -dir2.lat;
|
|
394
357
|
let b2 = +dir2.lon;
|
|
395
358
|
let d2 = -(a2 * start2.lon + b2 * start2.lat);
|
|
396
|
-
|
|
397
359
|
let seg1_line2_start = a2 * start1.lon + b2 * start1.lat + d2;
|
|
398
360
|
let seg1_line2_end = a2 * end1.lon + b2 * end1.lat + d2;
|
|
399
|
-
|
|
400
361
|
let seg2_line1_start = a1 * start2.lon + b1 * start2.lat + d1;
|
|
401
362
|
let seg2_line1_end = a1 * end2.lon + b1 * end2.lat + d1;
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
isSegment &&
|
|
405
|
-
(seg1_line2_start * seg1_line2_end > 0 || seg2_line1_start * seg2_line1_end > 0)
|
|
406
|
-
) {
|
|
363
|
+
if (isSegment &&
|
|
364
|
+
(seg1_line2_start * seg1_line2_end > 0 || seg2_line1_start * seg2_line1_end > 0)) {
|
|
407
365
|
return undefined;
|
|
408
366
|
}
|
|
409
|
-
|
|
410
367
|
let u = seg1_line2_start / (seg1_line2_start - seg1_line2_end);
|
|
411
|
-
|
|
412
368
|
return new LonLat(start1.lon + u * dir1.lon, start1.lat + u * dir1.lat);
|
|
413
369
|
}
|
|
414
|
-
|
|
415
370
|
/**
|
|
416
371
|
* Converts XML to JSON
|
|
417
372
|
* @static
|
|
418
373
|
* @param {Object} xml - Xml object
|
|
419
374
|
* @return {Object} - Json converted object.
|
|
420
375
|
*/
|
|
421
|
-
export function xmlToJson(xml
|
|
376
|
+
export function xmlToJson(xml) {
|
|
422
377
|
// Create the return object
|
|
423
|
-
let obj
|
|
424
|
-
|
|
378
|
+
let obj = {};
|
|
425
379
|
if (xml.nodeType === 1) {
|
|
426
380
|
// element
|
|
427
381
|
// do attributes
|
|
@@ -432,11 +386,11 @@ export function xmlToJson(xml: any): any {
|
|
|
432
386
|
obj["@attributes"][attribute.nodeName] = attribute.nodeValue;
|
|
433
387
|
}
|
|
434
388
|
}
|
|
435
|
-
}
|
|
389
|
+
}
|
|
390
|
+
else if (xml.nodeType === 3) {
|
|
436
391
|
// text
|
|
437
392
|
obj = xml.nodeValue;
|
|
438
393
|
}
|
|
439
|
-
|
|
440
394
|
// do children
|
|
441
395
|
if (xml.hasChildNodes()) {
|
|
442
396
|
for (let i = 0; i < xml.childNodes.length; i++) {
|
|
@@ -444,7 +398,8 @@ export function xmlToJson(xml: any): any {
|
|
|
444
398
|
let nodeName = item.nodeName;
|
|
445
399
|
if (typeof obj[nodeName] === "undefined") {
|
|
446
400
|
obj[nodeName] = xmlToJson(item);
|
|
447
|
-
}
|
|
401
|
+
}
|
|
402
|
+
else {
|
|
448
403
|
if (typeof obj[nodeName].push === "undefined") {
|
|
449
404
|
let old = obj[nodeName];
|
|
450
405
|
obj[nodeName] = [];
|
|
@@ -456,37 +411,29 @@ export function xmlToJson(xml: any): any {
|
|
|
456
411
|
}
|
|
457
412
|
return obj;
|
|
458
413
|
}
|
|
459
|
-
|
|
460
414
|
export const castType = {
|
|
461
|
-
string: function (v
|
|
415
|
+
string: function (v) {
|
|
462
416
|
return isEmpty(v) ? v : v.toString();
|
|
463
417
|
},
|
|
464
|
-
|
|
465
|
-
date: function (v: any) {
|
|
418
|
+
date: function (v) {
|
|
466
419
|
return isEmpty(v) ? v : new Date(v * 1000);
|
|
467
420
|
},
|
|
468
|
-
|
|
469
|
-
datetime: function (v: any) {
|
|
421
|
+
datetime: function (v) {
|
|
470
422
|
return isEmpty(v) ? v : new Date(v * 1000);
|
|
471
423
|
},
|
|
472
|
-
|
|
473
|
-
time: function (v: any) {
|
|
424
|
+
time: function (v) {
|
|
474
425
|
return isEmpty(v) ? v : parseInt(v);
|
|
475
426
|
},
|
|
476
|
-
|
|
477
|
-
integer: function (v: any) {
|
|
427
|
+
integer: function (v) {
|
|
478
428
|
return isEmpty(v) ? v : parseInt(v);
|
|
479
429
|
},
|
|
480
|
-
|
|
481
|
-
float: function (v: any) {
|
|
430
|
+
float: function (v) {
|
|
482
431
|
return isEmpty(v) ? v : parseFloat(v);
|
|
483
432
|
},
|
|
484
|
-
|
|
485
|
-
boolean: function (str: any) {
|
|
433
|
+
boolean: function (str) {
|
|
486
434
|
if (str === null) {
|
|
487
435
|
return str;
|
|
488
436
|
}
|
|
489
|
-
|
|
490
437
|
if (typeof str === "boolean") {
|
|
491
438
|
if (str === true) {
|
|
492
439
|
return true;
|
|
@@ -510,39 +457,29 @@ export const castType = {
|
|
|
510
457
|
return false;
|
|
511
458
|
}
|
|
512
459
|
};
|
|
513
|
-
|
|
514
|
-
export function base64toBlob(base64Data: string, contentType: string = ""): Blob {
|
|
515
|
-
|
|
460
|
+
export function base64toBlob(base64Data, contentType = "") {
|
|
516
461
|
let sliceSize = 1024;
|
|
517
462
|
let byteCharacters = atob(base64Data);
|
|
518
463
|
let bytesLength = byteCharacters.length;
|
|
519
464
|
let slicesCount = Math.ceil(bytesLength / sliceSize);
|
|
520
465
|
let byteArrays = new Array(slicesCount);
|
|
521
|
-
|
|
522
466
|
for (let sliceIndex = 0; sliceIndex < slicesCount; ++sliceIndex) {
|
|
523
|
-
|
|
524
467
|
let begin = sliceIndex * sliceSize;
|
|
525
468
|
let end = Math.min(begin + sliceSize, bytesLength);
|
|
526
469
|
let bytes = new Array(end - begin);
|
|
527
|
-
|
|
528
470
|
for (let offset = begin, i = 0; offset < end; ++i, ++offset) {
|
|
529
471
|
bytes[i] = byteCharacters[offset].charCodeAt(0);
|
|
530
472
|
}
|
|
531
|
-
|
|
532
473
|
byteArrays[sliceIndex] = new Uint8Array(bytes);
|
|
533
474
|
}
|
|
534
|
-
return new Blob(byteArrays, {type: contentType});
|
|
475
|
+
return new Blob(byteArrays, { type: contentType });
|
|
535
476
|
}
|
|
536
|
-
|
|
537
|
-
export function base64StringToBlog(string: string): Blob {
|
|
538
|
-
|
|
477
|
+
export function base64StringToBlog(string) {
|
|
539
478
|
let block = string.split(";");
|
|
540
479
|
let contentType = block[0].split(":")[1];
|
|
541
480
|
let data = block[1].split(",")[1];
|
|
542
|
-
|
|
543
481
|
return base64toBlob(data, contentType);
|
|
544
482
|
}
|
|
545
|
-
|
|
546
483
|
///**
|
|
547
484
|
// *
|
|
548
485
|
// * @param {LonLat} p
|
|
@@ -552,7 +489,6 @@ export function base64StringToBlog(string: string): Blob {
|
|
|
552
489
|
// * @param {Array<Number>} res
|
|
553
490
|
// */
|
|
554
491
|
//export function cartesianToBarycentricLonLat(p, v1, v2, v3, res) {
|
|
555
|
-
|
|
556
492
|
// const y2y3 = v2.lat - v3.lat,
|
|
557
493
|
// x3x2 = v3.lon - v2.lon,
|
|
558
494
|
// x1x3 = v1.lon - v3.lon,
|
|
@@ -560,33 +496,30 @@ export function base64StringToBlog(string: string): Blob {
|
|
|
560
496
|
// y3y1 = v3.lat - v1.lat,
|
|
561
497
|
// xx3 = p.lon - v3.lon,
|
|
562
498
|
// yy3 = p.lat - v3.lat;
|
|
563
|
-
|
|
564
499
|
// const d = y2y3 * x1x3 + x3x2 * y1y3,
|
|
565
500
|
// lambda1 = (y2y3 * xx3 + x3x2 * yy3) / d,
|
|
566
501
|
// lambda2 = (y3y1 * xx3 + x1x3 * yy3) / d;
|
|
567
|
-
|
|
568
502
|
// res[0] = lambda1;
|
|
569
503
|
// res[1] = lambda2;
|
|
570
504
|
// res[2] = 1 - lambda1 - lambda2;
|
|
571
|
-
|
|
572
505
|
// return 0 <= res[0] && res[0] <= 1 && 0 <= lambda1 && lambda1 <= 1 && 0 <= lambda2 && lambda2 <= 1;
|
|
573
506
|
//};
|
|
574
|
-
|
|
575
507
|
/**
|
|
576
508
|
* Callback throttling
|
|
577
509
|
* @param {any} func
|
|
578
510
|
* @param {Number} limit
|
|
579
511
|
* @param {boolean} [skip]
|
|
580
512
|
*/
|
|
581
|
-
export function throttle(func
|
|
582
|
-
let lastFunc
|
|
583
|
-
let lastRan
|
|
513
|
+
export function throttle(func, limit, skip) {
|
|
514
|
+
let lastFunc;
|
|
515
|
+
let lastRan = 0;
|
|
584
516
|
return function () {
|
|
585
517
|
const args = arguments;
|
|
586
518
|
if (!lastRan) {
|
|
587
519
|
func.apply(null, args);
|
|
588
520
|
lastRan = Date.now();
|
|
589
|
-
}
|
|
521
|
+
}
|
|
522
|
+
else {
|
|
590
523
|
if (skip) {
|
|
591
524
|
clearTimeout(lastFunc);
|
|
592
525
|
}
|
|
@@ -599,7 +532,6 @@ export function throttle(func: Function, limit: number, skip: boolean) {
|
|
|
599
532
|
}
|
|
600
533
|
};
|
|
601
534
|
}
|
|
602
|
-
|
|
603
535
|
/**
|
|
604
536
|
*
|
|
605
537
|
* y2-----Q12--------------Q22---
|
|
@@ -628,189 +560,138 @@ export function throttle(func: Function, limit: number, skip: boolean) {
|
|
|
628
560
|
* @param {Number} [y1=0.0] -
|
|
629
561
|
* @param {Number} [y2=1.0] -
|
|
630
562
|
*/
|
|
631
|
-
export function blerp(
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
fQ12 * (x2 - x) * (y - y1) +
|
|
638
|
-
fQ22 * (x - x1) * (y - y1)) /
|
|
639
|
-
((x2 - x1) * (y2 - y1))
|
|
640
|
-
);
|
|
563
|
+
export function blerp(x, y, fQ11, fQ21, fQ12, fQ22, x1 = 0.0, x2 = 1.0, y1 = 0.0, y2 = 1.0) {
|
|
564
|
+
return ((fQ11 * (x2 - x) * (y2 - y) +
|
|
565
|
+
fQ21 * (x - x1) * (y2 - y) +
|
|
566
|
+
fQ12 * (x2 - x) * (y - y1) +
|
|
567
|
+
fQ22 * (x - x1) * (y - y1)) /
|
|
568
|
+
((x2 - x1) * (y2 - y1)));
|
|
641
569
|
}
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
return (
|
|
645
|
-
fQ11 * (1.0 - x) * (1.0 - y) + fQ21 * x * (1.0 - y) + fQ12 * (1.0 - x) * y + fQ22 * x * y
|
|
646
|
-
);
|
|
570
|
+
export function blerp2(x, y, fQ11, fQ21, fQ12, fQ22) {
|
|
571
|
+
return (fQ11 * (1.0 - x) * (1.0 - y) + fQ21 * x * (1.0 - y) + fQ12 * (1.0 - x) * y + fQ22 * x * y);
|
|
647
572
|
}
|
|
648
|
-
|
|
649
|
-
export function extractElevationTiles(rgbaData: number[] | TypedArray, outCurrenElevations: number[] | TypedArray, outChildrenElevations: number[][][] | TypedArray[][]) {
|
|
573
|
+
export function extractElevationTiles(rgbaData, outCurrenElevations, outChildrenElevations) {
|
|
650
574
|
let destSize = Math.sqrt(outCurrenElevations.length) - 1;
|
|
651
575
|
let destSizeOne = destSize + 1;
|
|
652
576
|
let sourceSize = Math.sqrt(rgbaData.length / 4);
|
|
653
577
|
let dt = sourceSize / destSize;
|
|
654
|
-
|
|
655
|
-
let
|
|
656
|
-
bottomHeigh = 0;
|
|
657
|
-
|
|
658
|
-
for (
|
|
659
|
-
let k = 0, currIndex = 0, sourceDataLength = rgbaData.length / 4;
|
|
660
|
-
k < sourceDataLength;
|
|
661
|
-
k++
|
|
662
|
-
) {
|
|
578
|
+
let rightHeigh = 0, bottomHeigh = 0;
|
|
579
|
+
for (let k = 0, currIndex = 0, sourceDataLength = rgbaData.length / 4; k < sourceDataLength; k++) {
|
|
663
580
|
let height = rgbaData[k * 4];
|
|
664
|
-
|
|
665
|
-
let
|
|
666
|
-
j = k % sourceSize;
|
|
667
|
-
|
|
668
|
-
let tileX = Math.floor(j / destSize),
|
|
669
|
-
tileY = Math.floor(i / destSize);
|
|
670
|
-
|
|
581
|
+
let i = Math.floor(k / sourceSize), j = k % sourceSize;
|
|
582
|
+
let tileX = Math.floor(j / destSize), tileY = Math.floor(i / destSize);
|
|
671
583
|
let destArr = outChildrenElevations[tileY][tileX];
|
|
672
|
-
|
|
673
|
-
let ii = i % destSize,
|
|
674
|
-
jj = j % destSize;
|
|
675
|
-
|
|
584
|
+
let ii = i % destSize, jj = j % destSize;
|
|
676
585
|
let destIndex = (ii + tileY) * destSizeOne + jj + tileX;
|
|
677
|
-
|
|
678
586
|
destArr[destIndex] = height;
|
|
679
|
-
|
|
680
587
|
if ((i + tileY) % dt === 0 && (j + tileX) % dt === 0) {
|
|
681
588
|
outCurrenElevations[currIndex++] = height;
|
|
682
589
|
}
|
|
683
|
-
|
|
684
590
|
if ((j + 1) % destSize === 0 && j !== sourceSize - 1) {
|
|
685
591
|
//current tile
|
|
686
592
|
rightHeigh = rgbaData[(k + 1) * 4];
|
|
687
593
|
let middleHeight = (height + rightHeigh) * 0.5;
|
|
688
594
|
destIndex = (ii + tileY) * destSizeOne + jj + 1;
|
|
689
595
|
destArr[destIndex] = middleHeight;
|
|
690
|
-
|
|
691
596
|
if ((i + tileY) % dt === 0) {
|
|
692
597
|
outCurrenElevations[currIndex++] = middleHeight;
|
|
693
598
|
}
|
|
694
|
-
|
|
695
599
|
//next right tile
|
|
696
600
|
let rightindex = (ii + tileY) * destSizeOne + ((jj + 1) % destSize);
|
|
697
601
|
outChildrenElevations[tileY][tileX + 1][rightindex] = middleHeight;
|
|
698
602
|
}
|
|
699
|
-
|
|
700
603
|
if ((i + 1) % destSize === 0 && i !== sourceSize - 1) {
|
|
701
604
|
//current tile
|
|
702
605
|
bottomHeigh = rgbaData[(k + sourceSize) * 4];
|
|
703
606
|
let middleHeight = (height + bottomHeigh) * 0.5;
|
|
704
607
|
destIndex = (ii + 1) * destSizeOne + jj + tileX;
|
|
705
608
|
destArr[destIndex] = middleHeight;
|
|
706
|
-
|
|
707
609
|
if ((j + tileX) % dt === 0) {
|
|
708
610
|
outCurrenElevations[currIndex++] = middleHeight;
|
|
709
611
|
}
|
|
710
|
-
|
|
711
612
|
//next bottom tile
|
|
712
613
|
let bottomindex = ((ii + 1) % destSize) * destSizeOne + jj + tileX;
|
|
713
614
|
outChildrenElevations[tileY + 1][tileX][bottomindex] = middleHeight;
|
|
714
615
|
}
|
|
715
|
-
|
|
716
|
-
if (
|
|
717
|
-
(j + 1) % destSize === 0 &&
|
|
616
|
+
if ((j + 1) % destSize === 0 &&
|
|
718
617
|
j !== sourceSize - 1 &&
|
|
719
618
|
(i + 1) % destSize === 0 &&
|
|
720
|
-
i !== sourceSize - 1
|
|
721
|
-
) {
|
|
619
|
+
i !== sourceSize - 1) {
|
|
722
620
|
//current tile
|
|
723
621
|
let rightBottomHeight = rgbaData[(k + sourceSize + 1) * 4];
|
|
724
622
|
let middleHeight = (height + rightHeigh + bottomHeigh + rightBottomHeight) * 0.25;
|
|
725
623
|
destIndex = (ii + 1) * destSizeOne + (jj + 1);
|
|
726
624
|
destArr[destIndex] = middleHeight;
|
|
727
|
-
|
|
728
625
|
outCurrenElevations[currIndex++] = middleHeight;
|
|
729
|
-
|
|
730
626
|
//next right tile
|
|
731
627
|
let rightindex = (ii + 1) * destSizeOne;
|
|
732
628
|
outChildrenElevations[tileY][tileX + 1][rightindex] = middleHeight;
|
|
733
|
-
|
|
734
629
|
//next bottom tile
|
|
735
630
|
let bottomindex = destSize;
|
|
736
631
|
outChildrenElevations[tileY + 1][tileX][bottomindex] = middleHeight;
|
|
737
|
-
|
|
738
632
|
//next right bottom tile
|
|
739
633
|
let rightBottomindex = 0;
|
|
740
634
|
outChildrenElevations[tileY + 1][tileX + 1][rightBottomindex] = middleHeight;
|
|
741
635
|
}
|
|
742
636
|
}
|
|
743
637
|
}
|
|
744
|
-
|
|
745
|
-
export type TypedArray =
|
|
746
|
-
| Int8Array
|
|
747
|
-
| Uint8Array
|
|
748
|
-
| Uint8ClampedArray
|
|
749
|
-
| Int16Array
|
|
750
|
-
| Uint16Array
|
|
751
|
-
| Int32Array
|
|
752
|
-
| Uint32Array
|
|
753
|
-
| Float32Array
|
|
754
|
-
| Float64Array;
|
|
755
|
-
|
|
756
638
|
/**
|
|
757
639
|
* Concatenates two the same type arrays
|
|
758
640
|
* @param {TypedArray} a
|
|
759
641
|
* @param {TypedArray | number[]} b
|
|
760
642
|
*/
|
|
761
|
-
export function concatTypedArrays(a
|
|
762
|
-
let c = new
|
|
643
|
+
export function concatTypedArrays(a, b) {
|
|
644
|
+
let c = new a.constructor(a.length + b.length); //hacky
|
|
763
645
|
c.set(a, 0);
|
|
764
646
|
c.set(b, a.length);
|
|
765
647
|
return c;
|
|
766
648
|
}
|
|
767
|
-
|
|
768
649
|
/**
|
|
769
650
|
* Concatenates two the same arrays
|
|
770
651
|
* @param {TypedArray | number[]} [a=[]] - First array
|
|
771
652
|
* @param {TypedArray | number[]} [b=[]] - Second array
|
|
772
653
|
* @return {TypedArray | number[]} -
|
|
773
654
|
*/
|
|
774
|
-
export function concatArrays(a
|
|
655
|
+
export function concatArrays(a = [], b = []) {
|
|
775
656
|
if (ArrayBuffer.isView(a)) {
|
|
776
|
-
return concatTypedArrays(a
|
|
777
|
-
}
|
|
657
|
+
return concatTypedArrays(a, b);
|
|
658
|
+
}
|
|
659
|
+
else {
|
|
778
660
|
for (let i = 0; i < b.length; i++) {
|
|
779
661
|
a.push(b[i]);
|
|
780
662
|
}
|
|
781
663
|
return a;
|
|
782
664
|
}
|
|
783
665
|
}
|
|
784
|
-
|
|
785
666
|
/**
|
|
786
667
|
* Convert simple array to typed
|
|
787
668
|
* @param arr {number[]}
|
|
788
669
|
* @param ctor {Float32Array}
|
|
789
670
|
* @returns {TypedArray}
|
|
790
671
|
*/
|
|
791
|
-
export function makeArrayTyped(arr
|
|
672
|
+
export function makeArrayTyped(arr, ctor = Float32Array) {
|
|
792
673
|
if (!ArrayBuffer.isView(arr)) {
|
|
793
|
-
const typedArr = new
|
|
674
|
+
const typedArr = new ctor(arr.length); //hacky
|
|
794
675
|
typedArr.set(arr, 0);
|
|
795
676
|
return typedArr;
|
|
796
|
-
}
|
|
677
|
+
}
|
|
678
|
+
else {
|
|
797
679
|
return arr;
|
|
798
680
|
}
|
|
799
681
|
}
|
|
800
|
-
|
|
801
682
|
/**
|
|
802
683
|
* Convert typed array to array
|
|
803
684
|
* @param arr {TypedArray | number[]}
|
|
804
685
|
* @returns {number[]}
|
|
805
686
|
*/
|
|
806
|
-
export function makeArray(arr
|
|
687
|
+
export function makeArray(arr) {
|
|
807
688
|
if (ArrayBuffer.isView(arr)) {
|
|
808
689
|
return Array.from(arr);
|
|
809
|
-
}
|
|
690
|
+
}
|
|
691
|
+
else {
|
|
810
692
|
return arr;
|
|
811
693
|
}
|
|
812
694
|
}
|
|
813
|
-
|
|
814
695
|
/**
|
|
815
696
|
*
|
|
816
697
|
* @param {TypedArray | Array} arr
|
|
@@ -818,19 +699,20 @@ export function makeArray(arr: TypedArray | number[]): number[] {
|
|
|
818
699
|
* @param {Number} deleteCount
|
|
819
700
|
* @param {{ result: number[] }} [out]
|
|
820
701
|
*/
|
|
821
|
-
|
|
822
|
-
export function spliceArray(arr: TypedArray | number[], starting: number, deleteCount: number, out?: { result: number[] } | { result: TypedArray }): TypedArray | number[] {
|
|
702
|
+
export function spliceArray(arr, starting, deleteCount, out) {
|
|
823
703
|
if (ArrayBuffer.isView(arr)) {
|
|
824
704
|
if (starting < 0) {
|
|
825
705
|
deleteCount = Math.abs(starting);
|
|
826
706
|
starting += arr.length;
|
|
827
707
|
}
|
|
828
|
-
return spliceTypedArray(arr, starting, deleteCount, out
|
|
829
|
-
}
|
|
708
|
+
return spliceTypedArray(arr, starting, deleteCount, out);
|
|
709
|
+
}
|
|
710
|
+
else {
|
|
830
711
|
let res;
|
|
831
712
|
if (starting < 0) {
|
|
832
713
|
res = arr.splice(starting);
|
|
833
|
-
}
|
|
714
|
+
}
|
|
715
|
+
else {
|
|
834
716
|
res = arr.splice(starting, deleteCount);
|
|
835
717
|
}
|
|
836
718
|
if (out) {
|
|
@@ -839,7 +721,6 @@ export function spliceArray(arr: TypedArray | number[], starting: number, delete
|
|
|
839
721
|
return arr;
|
|
840
722
|
}
|
|
841
723
|
}
|
|
842
|
-
|
|
843
724
|
/**
|
|
844
725
|
*
|
|
845
726
|
* @param {TypedArray} arr
|
|
@@ -847,20 +728,19 @@ export function spliceArray(arr: TypedArray | number[], starting: number, delete
|
|
|
847
728
|
* @param {Number} deleteCount
|
|
848
729
|
* @param {{ result: TypedArray }} [out]
|
|
849
730
|
*/
|
|
850
|
-
export function spliceTypedArray
|
|
731
|
+
export function spliceTypedArray(arr, starting, deleteCount, out) {
|
|
851
732
|
if (arr.length === 0) {
|
|
852
733
|
return arr;
|
|
853
734
|
}
|
|
854
735
|
const newSize = arr.length - deleteCount;
|
|
855
|
-
const splicedArray = new
|
|
736
|
+
const splicedArray = new arr.constructor(newSize); //hacky
|
|
856
737
|
splicedArray.set(arr.subarray(0, starting));
|
|
857
738
|
splicedArray.set(arr.subarray(starting + deleteCount), starting);
|
|
858
739
|
if (out) {
|
|
859
|
-
out.result = arr.subarray(starting, starting + deleteCount)
|
|
740
|
+
out.result = arr.subarray(starting, starting + deleteCount);
|
|
860
741
|
}
|
|
861
742
|
return splicedArray;
|
|
862
743
|
}
|
|
863
|
-
|
|
864
744
|
/**
|
|
865
745
|
* Returns 64-bit triangle coordinate array from inside of the source triangle array.
|
|
866
746
|
* @static
|
|
@@ -872,29 +752,22 @@ export function spliceTypedArray<T extends TypedArray>(arr: T, starting: number,
|
|
|
872
752
|
* @return {Float64Array} Triangle coordinates array from the source array.
|
|
873
753
|
* @TODO: optimization
|
|
874
754
|
*/
|
|
875
|
-
export function getMatrixSubArray64(sourceArr
|
|
876
|
-
|
|
755
|
+
export function getMatrixSubArray64(sourceArr, gridSize, i0, j0, size) {
|
|
877
756
|
const size_1 = size + 1;
|
|
878
757
|
const i0size = i0 + size_1;
|
|
879
758
|
const j0size = j0 + size_1;
|
|
880
|
-
|
|
881
759
|
let res = new Float64Array(size_1 * size_1 * 3);
|
|
882
760
|
let vInd = 0;
|
|
883
|
-
|
|
884
761
|
for (let i = i0; i < i0size; i++) {
|
|
885
762
|
for (let j = j0; j < j0size; j++) {
|
|
886
|
-
|
|
887
763
|
let ind = 3 * (i * (gridSize + 1) + j);
|
|
888
|
-
|
|
889
764
|
res[vInd++] = sourceArr[ind];
|
|
890
765
|
res[vInd++] = sourceArr[ind + 1];
|
|
891
766
|
res[vInd++] = sourceArr[ind + 2];
|
|
892
767
|
}
|
|
893
768
|
}
|
|
894
|
-
|
|
895
769
|
return res;
|
|
896
770
|
}
|
|
897
|
-
|
|
898
771
|
/**
|
|
899
772
|
* Returns 32-bit triangle coordinate array from inside of the source triangle array.
|
|
900
773
|
* @static
|
|
@@ -905,29 +778,22 @@ export function getMatrixSubArray64(sourceArr: TypedArray | number[], gridSize:
|
|
|
905
778
|
* @param {number} size - Square matrix result size.
|
|
906
779
|
* @return {Float32Array} Triangle coordinates array from the source array.
|
|
907
780
|
*/
|
|
908
|
-
export function getMatrixSubArray32(sourceArr
|
|
909
|
-
|
|
781
|
+
export function getMatrixSubArray32(sourceArr, gridSize, i0, j0, size) {
|
|
910
782
|
const size_1 = size + 1;
|
|
911
783
|
const i0size = i0 + size_1;
|
|
912
784
|
const j0size = j0 + size_1;
|
|
913
|
-
|
|
914
785
|
let res = new Float32Array(size_1 * size_1 * 3);
|
|
915
786
|
let vInd = 0;
|
|
916
|
-
|
|
917
787
|
for (let i = i0; i < i0size; i++) {
|
|
918
788
|
for (let j = j0; j < j0size; j++) {
|
|
919
|
-
|
|
920
789
|
let ind = 3 * (i * (gridSize + 1) + j);
|
|
921
|
-
|
|
922
790
|
res[vInd++] = sourceArr[ind];
|
|
923
791
|
res[vInd++] = sourceArr[ind + 1];
|
|
924
792
|
res[vInd++] = sourceArr[ind + 2];
|
|
925
793
|
}
|
|
926
794
|
}
|
|
927
|
-
|
|
928
795
|
return res;
|
|
929
796
|
}
|
|
930
|
-
|
|
931
797
|
/**
|
|
932
798
|
* Returns two float32 triangle coordinate arrays from inside of the source triangle array.
|
|
933
799
|
* @static
|
|
@@ -940,108 +806,85 @@ export function getMatrixSubArray32(sourceArr: TypedArray | number[], gridSize:
|
|
|
940
806
|
* @return{Array.<number>} Triangle coordinates array from the source array.
|
|
941
807
|
* @TODO: optimization
|
|
942
808
|
*/
|
|
943
|
-
export function getMatrixSubArrayBoundsExt(
|
|
944
|
-
sourceArr: TypedArray | number[],
|
|
945
|
-
sourceArrHigh: TypedArray | number[],
|
|
946
|
-
sourceArrLow: TypedArray | number[],
|
|
947
|
-
noDataVertices: TypedArray | number[] | undefined,
|
|
948
|
-
gridSize: number,
|
|
949
|
-
i0: number,
|
|
950
|
-
j0: number,
|
|
951
|
-
size: number,
|
|
952
|
-
outArr: TypedArray | number[],
|
|
953
|
-
outArrHigh: TypedArray | number[],
|
|
954
|
-
outArrLow: TypedArray | number[],
|
|
955
|
-
outBounds: any,
|
|
956
|
-
outNoDataVertices: TypedArray | number[]
|
|
957
|
-
) {
|
|
809
|
+
export function getMatrixSubArrayBoundsExt(sourceArr, sourceArrHigh, sourceArrLow, noDataVertices, gridSize, i0, j0, size, outArr, outArrHigh, outArrLow, outBounds, outNoDataVertices) {
|
|
958
810
|
const i0size = i0 + size + 1;
|
|
959
811
|
const j0size = j0 + size + 1;
|
|
960
|
-
|
|
961
812
|
gridSize += 1;
|
|
962
|
-
|
|
963
|
-
let vInd = 0,
|
|
964
|
-
nInd = 0;
|
|
965
|
-
|
|
813
|
+
let vInd = 0, nInd = 0;
|
|
966
814
|
for (let i = i0; i < i0size; i++) {
|
|
967
815
|
for (let j = j0; j < j0size; j++) {
|
|
968
|
-
let indBy3 = i * gridSize + j,
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
let x = sourceArr[ind],
|
|
972
|
-
y = sourceArr[ind + 1],
|
|
973
|
-
z = sourceArr[ind + 2];
|
|
974
|
-
|
|
816
|
+
let indBy3 = i * gridSize + j, ind = 3 * indBy3;
|
|
817
|
+
let x = sourceArr[ind], y = sourceArr[ind + 1], z = sourceArr[ind + 2];
|
|
975
818
|
if (!noDataVertices || noDataVertices[indBy3] === 0) {
|
|
976
|
-
if (x < outBounds.xmin)
|
|
977
|
-
|
|
978
|
-
if (
|
|
979
|
-
|
|
980
|
-
if (
|
|
981
|
-
|
|
982
|
-
|
|
819
|
+
if (x < outBounds.xmin)
|
|
820
|
+
outBounds.xmin = x;
|
|
821
|
+
if (x > outBounds.xmax)
|
|
822
|
+
outBounds.xmax = x;
|
|
823
|
+
if (y < outBounds.ymin)
|
|
824
|
+
outBounds.ymin = y;
|
|
825
|
+
if (y > outBounds.ymax)
|
|
826
|
+
outBounds.ymax = y;
|
|
827
|
+
if (z < outBounds.zmin)
|
|
828
|
+
outBounds.zmin = z;
|
|
829
|
+
if (z > outBounds.zmax)
|
|
830
|
+
outBounds.zmax = z;
|
|
831
|
+
}
|
|
832
|
+
else {
|
|
983
833
|
outNoDataVertices[nInd] = 1;
|
|
984
834
|
}
|
|
985
|
-
|
|
986
835
|
nInd++;
|
|
987
|
-
|
|
988
836
|
outArr[vInd] = x;
|
|
989
837
|
outArrLow[vInd] = sourceArrLow[ind];
|
|
990
838
|
outArrHigh[vInd++] = sourceArrHigh[ind];
|
|
991
|
-
|
|
992
839
|
outArr[vInd] = y;
|
|
993
840
|
outArrLow[vInd] = sourceArrLow[ind + 1];
|
|
994
841
|
outArrHigh[vInd++] = sourceArrHigh[ind + 1];
|
|
995
|
-
|
|
996
842
|
outArr[vInd] = z;
|
|
997
843
|
outArrLow[vInd] = sourceArrLow[ind + 2];
|
|
998
844
|
outArrHigh[vInd++] = sourceArrHigh[ind + 2];
|
|
999
845
|
}
|
|
1000
846
|
}
|
|
1001
847
|
}
|
|
1002
|
-
|
|
1003
|
-
export function cloneArray(items: any[]): any[] {
|
|
848
|
+
export function cloneArray(items) {
|
|
1004
849
|
return items.map((item) => (Array.isArray(item) ? cloneArray(item) : item));
|
|
1005
850
|
}
|
|
1006
|
-
|
|
1007
851
|
/**
|
|
1008
852
|
* Promise for load images
|
|
1009
853
|
* @function
|
|
1010
854
|
* @param {string} url - link to image.
|
|
1011
855
|
* @returns {Promise<Image>} Returns promise.
|
|
1012
856
|
*/
|
|
1013
|
-
export async function loadImage(url
|
|
1014
|
-
return new Promise
|
|
857
|
+
export async function loadImage(url) {
|
|
858
|
+
return new Promise(resolve => {
|
|
1015
859
|
const image = new Image();
|
|
1016
860
|
image.addEventListener('load', () => {
|
|
1017
861
|
resolve(image);
|
|
1018
862
|
});
|
|
1019
863
|
image.src = url;
|
|
1020
|
-
image.crossOrigin = ""
|
|
864
|
+
image.crossOrigin = "";
|
|
1021
865
|
return image;
|
|
1022
866
|
});
|
|
1023
867
|
}
|
|
1024
|
-
|
|
1025
868
|
/**
|
|
1026
869
|
* Gets image is loaded
|
|
1027
870
|
* @param {HTMLImageElement} image
|
|
1028
871
|
* @returns {boolean} Returns true is the image is loaded
|
|
1029
872
|
*/
|
|
1030
|
-
export function isImageLoaded(image
|
|
873
|
+
export function isImageLoaded(image) {
|
|
1031
874
|
return image.complete && image.naturalHeight !== 0;
|
|
1032
875
|
}
|
|
1033
|
-
|
|
1034
|
-
export function distanceFormat(v: number): string {
|
|
876
|
+
export function distanceFormat(v) {
|
|
1035
877
|
if (v > 1000) {
|
|
1036
878
|
return `${(v / 1000).toFixed(1)} km`;
|
|
1037
|
-
}
|
|
879
|
+
}
|
|
880
|
+
else if (v > 9) {
|
|
1038
881
|
return `${Math.round(v)} m`;
|
|
1039
|
-
}
|
|
882
|
+
}
|
|
883
|
+
else {
|
|
1040
884
|
return `${v.toFixed(1)} m`;
|
|
1041
885
|
}
|
|
1042
886
|
}
|
|
1043
|
-
|
|
1044
|
-
export function getUrlParam(paramName: string): number | undefined {
|
|
887
|
+
export function getUrlParam(paramName) {
|
|
1045
888
|
let urlParams = new URLSearchParams(location.search);
|
|
1046
889
|
let param = urlParams.get(paramName);
|
|
1047
890
|
if (param) {
|