@openglobus/og 0.17.1 → 0.18.0
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 +75 -46
- package/dist/@openglobus/og.esm.js +1 -20
- package/dist/@openglobus/og.esm.js.map +1 -1
- package/dist/@openglobus/og.umd.js +1 -20
- package/dist/@openglobus/og.umd.js.map +1 -1
- package/dist/@openglobus/res/fonts/Karla-Bold.json +5252 -0
- package/dist/@openglobus/res/fonts/Karla-Bold.ttf.cfg +920 -0
- package/dist/@openglobus/res/fonts/Karla-Bold.ttf.png +0 -0
- package/dist/@openglobus/res/fonts/Karla-Light.json +5252 -0
- package/dist/@openglobus/res/fonts/Karla-Light.ttf.cfg +830 -0
- package/dist/@openglobus/res/fonts/Karla-Light.ttf.png +0 -0
- package/dist/@openglobus/res/fonts/Karla-Medium.json +5252 -0
- package/dist/@openglobus/res/fonts/Karla-Medium.ttf.cfg +1196 -0
- package/dist/@openglobus/res/fonts/Karla-Medium.ttf.png +0 -0
- package/dist/@openglobus/res/fonts/NotoSansArabic-Regular.json +3332 -0
- package/dist/@openglobus/res/fonts/NotoSansArabic-Regular.ttf.cfg +1370 -0
- package/dist/@openglobus/res/fonts/NotoSansArabic-Regular.ttf.png +0 -0
- package/dist/@openglobus/res/fonts/Roboto-Regular.json +37147 -0
- package/dist/@openglobus/res/fonts/Roboto-Regular.ttf.cfg +1340 -0
- package/dist/@openglobus/res/fonts/Roboto-Regular.ttf.png +0 -0
- package/dist/@openglobus/res/fonts/arial.json +4321 -0
- package/dist/@openglobus/res/fonts/arial.ttf.cfg +1570 -0
- package/dist/@openglobus/res/fonts/arial.ttf.png +0 -0
- package/dist/@openglobus/res/night-4326.png +0 -0
- package/dist/@openglobus/res/night.png +0 -0
- package/dist/@openglobus/res/spec.png +0 -0
- package/package.json +25 -23
- package/src/{og/Clock.js → Clock.ts} +100 -78
- package/src/Deferred.ts +17 -0
- package/src/Events.ts +200 -0
- package/src/{og/Extent.js → Extent.ts} +324 -352
- package/src/Globe.ts +363 -0
- package/src/{og/ImageCanvas.js → ImageCanvas.ts} +244 -236
- package/src/Lock.ts +41 -0
- package/src/{og/LonLat.js → LonLat.ts} +50 -47
- package/src/{og/Object3d.js → Object3d.ts} +89 -55
- package/src/Popup.ts +228 -0
- package/src/{og/QueueArray.js → QueueArray.ts} +76 -75
- package/src/{og/Rectangle.js → Rectangle.ts} +115 -111
- package/src/Stack.ts +58 -0
- package/src/{og/astro/astro.js → astro/astro.ts} +49 -51
- package/src/{og/astro/earth.js → astro/earth.ts} +8 -9
- package/src/{og/astro/jd.js → astro/jd.ts} +92 -111
- package/src/{og/astro/orbit.js → astro/orbit.ts} +35 -37
- package/src/{og/astro/rotation.js → astro/rotation.ts} +4 -6
- package/src/{og/bv/Box.js → bv/Box.ts} +21 -17
- package/src/{og/bv/Sphere.js → bv/Sphere.ts} +21 -19
- package/src/bv/index.ts +4 -0
- package/src/{og/camera/Camera.js → camera/Camera.ts} +254 -197
- package/src/{og/camera/Frustum.js → camera/Frustum.ts} +137 -111
- package/src/{og/camera/PlanetCamera.js → camera/PlanetCamera.ts} +248 -185
- package/src/camera/index.ts +4 -0
- package/src/{og/cons.js → cons.ts} +14 -18
- package/src/{og/control/Atmosphere.js → control/Atmosphere.ts} +50 -50
- package/src/{og/control/CompassButton.js → control/CompassButton.ts} +27 -30
- package/src/{og/control/Control.js → control/Control.ts} +76 -70
- package/src/{og/control/DebugInfo.js → control/DebugInfo.ts} +130 -62
- package/src/{og/control/DrawingSwitcher.js → control/DrawingSwitcher.ts} +16 -22
- package/src/control/EarthCoordinates.ts +222 -0
- package/src/control/EarthNavigation.ts +293 -0
- package/src/{og/control/GeoImageDragControl.js → control/GeoImageDragControl.ts} +37 -29
- package/src/control/KeyboardNavigation.ts +168 -0
- package/src/{og/control/LayerAnimation.js → control/LayerAnimation.ts} +74 -90
- package/src/control/LayerSwitcher.ts +76 -0
- package/src/{og/control/Lighting.js → control/Lighting.ts} +158 -120
- package/src/control/MouseNavigation.ts +468 -0
- package/src/control/MouseWheelZoomControl.ts +269 -0
- package/src/{og/control/RulerSwitcher.js → control/RulerSwitcher.ts} +18 -20
- package/src/control/ScaleControl.ts +131 -0
- package/src/control/SegmentBoundVisualization.ts +50 -0
- package/src/control/ShowFps.ts +28 -0
- package/src/control/SimpleNavigation.ts +118 -0
- package/src/{og/control/SimpleSkyBackground.js → control/SimpleSkyBackground.ts} +36 -38
- package/src/{og/control/Sun.js → control/Sun.ts} +56 -64
- package/src/control/ToggleWireframe.ts +35 -0
- package/src/control/TouchNavigation.ts +368 -0
- package/src/control/ZoomControl.ts +111 -0
- package/src/control/drawing/DrawingControl.ts +45 -0
- package/src/{og/control/drawing/LineStringDrawingScene.js → control/drawing/LineStringDrawingScene.ts} +28 -35
- package/src/{og/control/drawing/PolygonDrawingScene.js → control/drawing/PolygonDrawingScene.ts} +148 -201
- package/src/{og/control/elevationProfile/ElevationProfile.js → control/elevationProfile/ElevationProfile.ts} +70 -36
- package/src/control/heightRuler/HeightRuler.ts +16 -0
- package/src/{og/control/heightRuler/HeightRulerScene.js → control/heightRuler/HeightRulerScene.ts} +92 -87
- package/src/{og/control/heightRuler/HeightRulerSwitcher.js → control/heightRuler/HeightRulerSwitcher.ts} +3 -3
- package/src/control/index.ts +45 -0
- package/src/control/ruler/Ruler.ts +35 -0
- package/src/{og/control/ruler/RulerScene.js → control/ruler/RulerScene.ts} +163 -121
- package/src/{og/control/selection/Selection.js → control/selection/Selection.ts} +23 -21
- package/src/{og/control/selection/SelectionScene.js → control/selection/SelectionScene.ts} +64 -50
- package/src/{og/control/timeline/TimelineControl.js → control/timeline/TimelineControl.ts} +37 -28
- package/src/{og/control/timeline/TimelineModel.js → control/timeline/TimelineModel.ts} +50 -35
- package/src/{og/control/timeline/TimelineView.js → control/timeline/TimelineView.ts} +162 -113
- package/src/{og/control/timeline/timelineUtils.js → control/timeline/timelineUtils.ts} +11 -10
- package/src/{og/control → control}/visibleExtent/Segment.js +5 -5
- package/src/{og/control → control}/visibleExtent/VisibleExtent.js +8 -15
- package/src/{og/control/visibleExtent/drawnode.js → control/visibleExtent/drawnode.ts} +1 -3
- package/src/{og/ellipsoid/Ellipsoid.js → ellipsoid/Ellipsoid.ts} +113 -59
- package/src/ellipsoid/index.ts +4 -0
- package/src/{og/ellipsoid/wgs84.js → ellipsoid/wgs84.ts} +1 -3
- package/src/{og/entity/BaseBillboard.js → entity/BaseBillboard.ts} +128 -102
- package/src/entity/BaseBillboardHandler.ts +772 -0
- package/src/{og/entity/Billboard.js → entity/Billboard.ts} +77 -47
- package/src/entity/BillboardHandler.ts +135 -0
- package/src/{og/entity/Entity.js → entity/Entity.ts} +285 -226
- package/src/{og/entity/EntityCollection.js → entity/EntityCollection.ts} +340 -247
- package/src/{og/entity/GeoObject.js → entity/GeoObject.ts} +122 -67
- package/src/{og/entity/GeoObjectHandler.js → entity/GeoObjectHandler.ts} +273 -198
- package/src/entity/Geometry.ts +486 -0
- package/src/{og/entity/GeometryHandler.js → entity/GeometryHandler.ts} +383 -541
- package/src/{og/entity/Label.js → entity/Label.ts} +131 -83
- package/src/{og/entity/LabelHandler.js → entity/LabelHandler.ts} +289 -255
- package/src/{og/entity/LabelWorker.js → entity/LabelWorker.ts} +26 -36
- package/src/{og/entity/PointCloud.js → entity/PointCloud.ts} +200 -164
- package/src/entity/PointCloudHandler.ts +125 -0
- package/src/{og/entity/Polyline.js → entity/Polyline.ts} +517 -539
- package/src/{og/entity/PolylineHandler.js → entity/PolylineHandler.ts} +29 -31
- package/src/{og/entity/Ray.js → entity/Ray.ts} +89 -60
- package/src/{og/entity/RayHandler.js → entity/RayHandler.ts} +201 -306
- package/src/{og/entity/Strip.js → entity/Strip.ts} +143 -100
- package/src/{og/entity/StripHandler.js → entity/StripHandler.ts} +76 -72
- package/src/entity/index.ts +12 -0
- package/src/index.ts +173 -0
- package/src/input/KeyboardHandler.ts +196 -0
- package/src/{og/input/MouseHandler.js → input/MouseHandler.ts} +46 -35
- package/src/input/TouchHandler.ts +54 -0
- package/src/{og/input/input.js → input/input.ts} +1 -3
- package/src/{og/layer/BaseGeoImage.js → layer/BaseGeoImage.ts} +174 -107
- package/src/{og/layer/CanvasTiles.js → layer/CanvasTiles.ts} +139 -105
- package/src/{og/layer/GeoImage.js → layer/GeoImage.ts} +62 -52
- package/src/layer/GeoTexture2d.ts +56 -0
- package/src/{og/layer/GeoVideo.js → layer/GeoVideo.ts} +53 -53
- package/src/{og/layer/KML.js → layer/KML.ts} +63 -74
- package/src/{og/layer/Layer.js → layer/Layer.ts} +399 -223
- package/src/{og/layer/Material.js → layer/Material.ts} +40 -35
- package/src/{og/layer/Vector.js → layer/Vector.ts} +319 -267
- package/src/{og/layer/WMS.js → layer/WMS.ts} +76 -64
- package/src/{og/layer/XYZ.js → layer/XYZ.ts} +123 -98
- package/src/layer/index.ts +12 -0
- package/src/{og/light/LightSource.js → light/LightSource.ts} +132 -93
- package/src/{og/math/Line2.js → math/Line2.ts} +11 -8
- package/src/{og/math/Line3.js → math/Line3.ts} +49 -27
- package/src/{og/math/Mat3.js → math/Mat3.ts} +43 -27
- package/src/{og/math/Mat4.js → math/Mat4.ts} +110 -77
- package/src/{og/math/Plane.js → math/Plane.ts} +28 -23
- package/src/{og/math/Quat.js → math/Quat.ts} +238 -222
- package/src/{og/math/Ray.js → math/Ray.ts} +59 -63
- package/src/{og/math/Vec2.js → math/Vec2.ts} +85 -76
- package/src/{og/math/Vec3.js → math/Vec3.ts} +141 -140
- package/src/{og/math/Vec4.js → math/Vec4.ts} +64 -53
- package/src/{og/math/coder.js → math/coder.ts} +30 -27
- package/src/math/index.ts +26 -0
- package/src/{og/math.js → math.ts} +46 -49
- package/src/{og/mercator.js → mercator.ts} +143 -149
- package/src/{og/proj/EPSG3857.js → proj/EPSG3857.ts} +1 -3
- package/src/{og/proj/EPSG4326.js → proj/EPSG4326.ts} +11 -13
- package/src/{og/proj/Proj.js → proj/Proj.ts} +27 -23
- package/src/{og/quadTree/EPSG4326QuadTreeStrategy.js → quadTree/EPSG4326QuadTreeStrategy.ts} +10 -13
- package/src/{og/quadTree/EarthQuadTreeStrategy.js → quadTree/EarthQuadTreeStrategy.ts} +11 -13
- package/src/quadTree/EntityCollectionNode.ts +395 -0
- package/src/{og/quadTree/MarsQuadTreeStrategy.js → quadTree/MarsQuadTreeStrategy.ts} +10 -13
- package/src/{og/quadTree/Node.js → quadTree/Node.ts} +283 -191
- package/src/{og/quadTree/QuadTreeStrategy.js → quadTree/QuadTreeStrategy.ts} +35 -29
- package/src/quadTree/Wgs84QuadTreeStrategy.ts +22 -0
- package/src/quadTree/index.ts +14 -0
- package/src/{og/quadTree/quadTree.js → quadTree/quadTree.ts} +75 -77
- package/src/{og/renderer/Renderer.js → renderer/Renderer.ts} +454 -298
- package/src/{og/renderer/RendererEvents.js → renderer/RendererEvents.ts} +347 -270
- package/src/{og/scene/Axes.js → scene/Axes.ts} +26 -22
- package/src/{og/scene/BaseNode.js → scene/BaseNode.ts} +53 -47
- package/src/{og/scene/Planet.js → scene/Planet.ts} +777 -595
- package/src/{og/scene/RenderNode.js → scene/RenderNode.ts} +105 -91
- package/src/{og/scene/SkyBox.js → scene/SkyBox.ts} +29 -25
- package/src/scene/index.ts +6 -0
- package/src/{og/segment/Segment.js → segment/Segment.ts} +497 -371
- package/src/{og/segment/SegmentLonLat.js → segment/SegmentLonLat.ts} +81 -87
- package/src/{og/segment/SegmentLonLatWgs84.js → segment/SegmentLonLatWgs84.ts} +9 -16
- package/src/{og/segment/Slice.js → segment/Slice.ts} +15 -9
- package/src/{og/segment/segmentHelper.js → segment/segmentHelper.ts} +57 -49
- package/src/{og/shaders/atmos.js → shaders/atmos.ts} +4 -6
- package/src/{og/shaders/billboard.js → shaders/billboard.ts} +3 -5
- package/src/{og/shaders/bloom.js → shaders/bloom.ts} +2 -4
- package/src/{og/shaders/blur.js → shaders/blur.ts} +4 -7
- package/src/{og/shaders/depth.js → shaders/depth.ts} +1 -3
- package/src/{og/shaders/drawnode.js → shaders/drawnode.ts} +19 -21
- package/src/{og/shaders/geoObject.js → shaders/geoObject.ts} +17 -19
- package/src/{og/shaders/label.js → shaders/label.ts} +4 -6
- package/src/{og/shaders/lumFilter.js → shaders/lumFilter.ts} +2 -4
- package/src/{og/shaders/pickingMask.js → shaders/pickingMask.ts} +2 -4
- package/src/{og/shaders/pointCloud.js → shaders/pointCloud.ts} +7 -10
- package/src/{og/shaders/polyline.js → shaders/polyline.ts} +3 -200
- package/src/{og/shaders/ray.js → shaders/ray.ts} +2 -4
- package/src/{og/shaders/screenFrame.js → shaders/screenFrame.ts} +2 -4
- package/src/{og/shaders/skybox.js → shaders/skybox.ts} +7 -9
- package/src/{og/shaders/toneMapping.js → shaders/toneMapping.ts} +2 -4
- package/src/{og/shaders/utils.js → shaders/utils.ts} +0 -2
- package/src/{og/terrain/BilTerrain.js → terrain/BilTerrain.ts} +38 -32
- package/src/terrain/EmptyTerrain.ts +230 -0
- package/src/{og/terrain/Geoid.js → terrain/Geoid.ts} +67 -41
- package/src/{og/terrain/GlobusTerrain.js → terrain/GlobusTerrain.ts} +159 -153
- package/src/{og/terrain/MapboxTerrain.js → terrain/MapboxTerrain.ts} +58 -61
- package/src/terrain/index.ts +6 -0
- package/src/ui/Button.ts +121 -0
- package/src/ui/ButtonGroup.ts +63 -0
- package/src/ui/Dialog.ts +244 -0
- package/src/ui/Slider.ts +188 -0
- package/src/ui/ToggleButton.ts +68 -0
- package/src/{og/ui/View.js → ui/View.ts} +66 -59
- package/src/utils/BaseWorker.ts +60 -0
- package/src/utils/FontAtlas.ts +356 -0
- package/src/{og/utils/GeoImageCreator.js → utils/GeoImageCreator.ts} +45 -29
- package/src/{og/utils/ImagesCacheManager.js → utils/ImagesCacheManager.ts} +85 -70
- package/src/utils/Loader.ts +247 -0
- package/src/{og/utils/NormalMapCreator.js → utils/NormalMapCreator.ts} +114 -77
- package/src/{og/utils/PlainSegmentWorker.js → utils/PlainSegmentWorker.ts} +41 -24
- package/src/{og/utils/TerrainWorker.js → utils/TerrainWorker.ts} +51 -36
- package/src/utils/TextureAtlas.ts +322 -0
- package/src/{og/utils/VectorTileCreator.js → utils/VectorTileCreator.ts} +67 -52
- package/src/{og/utils/colorTable.js → utils/colorTable.ts} +142 -144
- package/src/{og/utils/earcut.js → utils/earcut.ts} +664 -661
- package/src/{og/utils/objParser.js → utils/objParser.ts} +66 -37
- package/src/{og/utils/shared.js → utils/shared.ts} +267 -206
- package/src/utils/units.ts +78 -0
- package/src/webgl/BaseFramebuffer.ts +125 -0
- package/src/webgl/Framebuffer.ts +206 -0
- package/src/webgl/Handler.ts +1414 -0
- package/src/webgl/Multisample.ts +153 -0
- package/src/webgl/Program.ts +451 -0
- package/src/{og/webgl/ProgramController.js → webgl/ProgramController.ts} +44 -43
- package/src/webgl/index.ts +13 -0
- package/src/{og/webgl/types.js → webgl/types.ts} +29 -31
- package/src/webgl/variableHandlers.ts +114 -0
- package/src/og/Deferred.js +0 -11
- package/src/og/Events.js +0 -185
- package/src/og/Globe.js +0 -342
- package/src/og/Lock.js +0 -44
- package/src/og/Popup.js +0 -187
- package/src/og/Stack.js +0 -49
- package/src/og/bv/index.js +0 -4
- package/src/og/camera/index.js +0 -4
- package/src/og/control/EarthCoordinates.js +0 -214
- package/src/og/control/EarthNavigation.js +0 -258
- package/src/og/control/KeyboardNavigation.js +0 -149
- package/src/og/control/LayerSwitcher.js +0 -424
- package/src/og/control/MouseNavigation.js +0 -436
- package/src/og/control/MouseWheelZoomControl.js +0 -253
- package/src/og/control/ScaleControl.js +0 -119
- package/src/og/control/SegmentBoundVisualization.js +0 -54
- package/src/og/control/ShowFps.js +0 -40
- package/src/og/control/SimpleNavigation.js +0 -123
- package/src/og/control/ToggleWireframe.js +0 -35
- package/src/og/control/TouchNavigation.js +0 -350
- package/src/og/control/ZoomControl.js +0 -115
- package/src/og/control/drawing/DrawingControl.js +0 -51
- package/src/og/control/heightRuler/HeightRuler.js +0 -12
- package/src/og/control/index.js +0 -56
- package/src/og/control/ruler/Ruler.js +0 -39
- package/src/og/ellipsoid/index.js +0 -4
- package/src/og/entity/BillboardHandler.js +0 -883
- package/src/og/entity/Geometry.js +0 -320
- package/src/og/entity/PointCloudHandler.js +0 -122
- package/src/og/entity/index.js +0 -9
- package/src/og/index.js +0 -112
- package/src/og/input/KeyboardHandler.js +0 -128
- package/src/og/input/TouchHandler.js +0 -59
- package/src/og/layer/GeoTexture2d.js +0 -50
- package/src/og/layer/index.js +0 -11
- package/src/og/math/index.js +0 -23
- package/src/og/quadTree/EntityCollectionNode.js +0 -391
- package/src/og/quadTree/Wgs84QuadTreeStrategy.js +0 -27
- package/src/og/quadTree/index.js +0 -14
- package/src/og/res/images.js +0 -8
- package/src/og/scene/index.js +0 -5
- package/src/og/terrain/EmptyTerrain.js +0 -174
- package/src/og/terrain/index.js +0 -6
- package/src/og/ui/Button.js +0 -107
- package/src/og/ui/ButtonGroup.js +0 -57
- package/src/og/ui/Dialog.js +0 -239
- package/src/og/ui/Slider.js +0 -170
- package/src/og/ui/ToggleButton.js +0 -51
- package/src/og/ui/UIhelpers.js +0 -155
- package/src/og/utils/BaseWorker.js +0 -46
- package/src/og/utils/FontAtlas.js +0 -218
- package/src/og/utils/Loader.js +0 -188
- package/src/og/utils/TextureAtlas.js +0 -291
- package/src/og/utils/functionComposition.js +0 -13
- package/src/og/utils/units.js +0 -78
- package/src/og/webgl/Framebuffer.js +0 -311
- package/src/og/webgl/Handler.js +0 -1168
- package/src/og/webgl/Multisample.js +0 -275
- package/src/og/webgl/Program.js +0 -407
- package/src/og/webgl/callbacks.js +0 -98
- package/src/og/webgl/index.js +0 -13
- package/src/og.jsdoc +0 -3
- package/types/Clock.d.ts +0 -99
- package/types/Deferred.d.ts +0 -6
- package/types/Events.d.ts +0 -78
- package/types/Extent.d.ts +0 -166
- package/types/Globe.d.ts +0 -108
- package/types/ImageCanvas.d.ts +0 -128
- package/types/Lock.d.ts +0 -12
- package/types/LonLat.d.ts +0 -127
- package/types/Object3d.d.ts +0 -35
- package/types/Popup.d.ts +0 -29
- package/types/QueueArray.d.ts +0 -19
- package/types/Rectangle.d.ts +0 -80
- package/types/Stack.d.ts +0 -19
- package/types/arial.d.ts +0 -49
- package/types/astro/astro.d.ts +0 -38
- package/types/astro/earth.d.ts +0 -7
- package/types/astro/jd.d.ts +0 -254
- package/types/bv/Box.d.ts +0 -30
- package/types/bv/Sphere.d.ts +0 -38
- package/types/bv/index.d.ts +0 -3
- package/types/camera/Camera.d.ts +0 -314
- package/types/camera/Frustum.d.ts +0 -133
- package/types/camera/PlanetCamera.d.ts +0 -219
- package/types/camera/index.d.ts +0 -3
- package/types/cons.d.ts +0 -40
- package/types/control/Atmosphere.d.ts +0 -15
- package/types/control/CompassButton.d.ts +0 -16
- package/types/control/Control.d.ts +0 -104
- package/types/control/DebugInfo.d.ts +0 -19
- package/types/control/DrawingSwitcher.d.ts +0 -13
- package/types/control/EarthCoordinates.d.ts +0 -44
- package/types/control/EarthNavigation.d.ts +0 -43
- package/types/control/GeoImageDragControl.d.ts +0 -14
- package/types/control/KeyboardNavigation.d.ts +0 -24
- package/types/control/LayerAnimation.d.ts +0 -73
- package/types/control/LayerSwitcher.d.ts +0 -64
- package/types/control/Lighting.d.ts +0 -41
- package/types/control/MouseNavigation.d.ts +0 -49
- package/types/control/MouseWheelZoomControl.d.ts +0 -46
- package/types/control/ScaleControl.d.ts +0 -23
- package/types/control/ShowFps.d.ts +0 -11
- package/types/control/SimpleNavigation.d.ts +0 -26
- package/types/control/SimpleSkyBackground.d.ts +0 -15
- package/types/control/Sun.d.ts +0 -53
- package/types/control/ToggleWireframe.d.ts +0 -12
- package/types/control/TouchNavigation.d.ts +0 -54
- package/types/control/ZoomControl.d.ts +0 -26
- package/types/control/drawing/DrawingControl.d.ts +0 -14
- package/types/control/drawing/LineStringDrawingScene.d.ts +0 -5
- package/types/control/drawing/PolygonDrawingScene.d.ts +0 -99
- package/types/control/heightRuler/HeightRuler.d.ts +0 -6
- package/types/control/heightRuler/HeightRulerScene.d.ts +0 -23
- package/types/control/index.d.ts +0 -27
- package/types/control/ruler/Ruler.d.ts +0 -13
- package/types/control/ruler/RulerScene.d.ts +0 -51
- package/types/control/selection/Selection.d.ts +0 -49
- package/types/control/selection/SelectionScene.d.ts +0 -32
- package/types/control/timeline/TimelineControl.d.ts +0 -10
- package/types/control/timeline/TimelineModel.d.ts +0 -33
- package/types/control/timeline/TimelineView.d.ts +0 -57
- package/types/control/timeline/timelineUtils.d.ts +0 -9
- package/types/ellipsoid/Ellipsoid.d.ts +0 -170
- package/types/ellipsoid/index.d.ts +0 -3
- package/types/ellipsoid/wgs84.d.ts +0 -6
- package/types/entity/BaseBillboard.d.ts +0 -215
- package/types/entity/Billboard.d.ts +0 -94
- package/types/entity/BillboardHandler.d.ts +0 -75
- package/types/entity/Entity.d.ts +0 -340
- package/types/entity/EntityCollection.d.ts +0 -303
- package/types/entity/GeoObject.d.ts +0 -117
- package/types/entity/GeoObjectHandler.d.ts +0 -41
- package/types/entity/Geometry.d.ts +0 -79
- package/types/entity/GeometryHandler.d.ts +0 -76
- package/types/entity/Label.d.ts +0 -190
- package/types/entity/LabelHandler.d.ts +0 -31
- package/types/entity/LabelWorker.d.ts +0 -9
- package/types/entity/PointCloud.d.ts +0 -174
- package/types/entity/PointCloudHandler.d.ts +0 -38
- package/types/entity/Polyline.d.ts +0 -307
- package/types/entity/PolylineHandler.d.ts +0 -18
- package/types/entity/Ray.d.ts +0 -122
- package/types/entity/RayHandler.d.ts +0 -63
- package/types/entity/Strip.d.ts +0 -119
- package/types/entity/StripHandler.d.ts +0 -38
- package/types/entity/index.d.ts +0 -8
- package/types/index.d.ts +0 -53
- package/types/input/KeyboardHandler.d.ts +0 -10
- package/types/input/MouseHandler.d.ts +0 -5
- package/types/input/TouchHandler.d.ts +0 -5
- package/types/input/input.d.ts +0 -42
- package/types/layer/BaseGeoImage.d.ts +0 -116
- package/types/layer/CanvasTiles.d.ts +0 -73
- package/types/layer/GeoImage.d.ts +0 -51
- package/types/layer/GeoTexture2d.d.ts +0 -7
- package/types/layer/GeoVideo.d.ts +0 -47
- package/types/layer/KML.d.ts +0 -93
- package/types/layer/Layer.d.ts +0 -320
- package/types/layer/Material.d.ts +0 -45
- package/types/layer/Vector.d.ts +0 -211
- package/types/layer/WMS.d.ts +0 -66
- package/types/layer/XYZ.d.ts +0 -122
- package/types/layer/index.d.ts +0 -10
- package/types/light/LightSource.d.ts +0 -178
- package/types/math/Line2.d.ts +0 -11
- package/types/math/Line3.d.ts +0 -10
- package/types/math/Mat3.d.ts +0 -65
- package/types/math/Mat4.d.ts +0 -176
- package/types/math/Plane.d.ts +0 -18
- package/types/math/Quat.d.ts +0 -379
- package/types/math/Ray.d.ts +0 -82
- package/types/math/Vec2.d.ts +0 -309
- package/types/math/Vec3.d.ts +0 -472
- package/types/math/Vec4.d.ts +0 -161
- package/types/math/coder.d.ts +0 -43
- package/types/math/index.d.ts +0 -11
- package/types/math.d.ts +0 -268
- package/types/mercator.d.ts +0 -92
- package/types/proj/EPSG3857.d.ts +0 -6
- package/types/proj/EPSG4326.d.ts +0 -6
- package/types/proj/Proj.d.ts +0 -42
- package/types/quadTree/EPSG4326QuadTreeStrategy.d.ts +0 -3
- package/types/quadTree/EarthQuadTreeStrategy.d.ts +0 -3
- package/types/quadTree/EntityCollectionNode.d.ts +0 -41
- package/types/quadTree/MarsQuadTreeStrategy.d.ts +0 -3
- package/types/quadTree/Node.d.ts +0 -58
- package/types/quadTree/QuadTreeStrategy.d.ts +0 -21
- package/types/quadTree/Wgs84QuadTreeStrategy.d.ts +0 -3
- package/types/quadTree/index.d.ts +0 -12
- package/types/quadTree/quadTree.d.ts +0 -40
- package/types/renderer/Renderer.d.ts +0 -291
- package/types/renderer/RendererEvents.d.ts +0 -255
- package/types/res/images.d.ts +0 -2
- package/types/scene/Axes.d.ts +0 -10
- package/types/scene/BaseNode.d.ts +0 -60
- package/types/scene/Planet.d.ts +0 -595
- package/types/scene/RenderNode.d.ts +0 -152
- package/types/scene/SkyBox.d.ts +0 -9
- package/types/scene/index.d.ts +0 -4
- package/types/segment/Segment.d.ts +0 -273
- package/types/segment/SegmentLonLat.d.ts +0 -22
- package/types/segment/SegmentLonLatWgs84.d.ts +0 -4
- package/types/segment/Slice.d.ts +0 -10
- package/types/segment/segmentHelper.d.ts +0 -13
- package/types/shaders/atmos.d.ts +0 -4
- package/types/shaders/billboard.d.ts +0 -3
- package/types/shaders/depth.d.ts +0 -2
- package/types/shaders/drawnode.d.ts +0 -8
- package/types/shaders/geoObject.d.ts +0 -3
- package/types/shaders/label.d.ts +0 -4
- package/types/shaders/pickingMask.d.ts +0 -2
- package/types/shaders/pointCloud.d.ts +0 -2
- package/types/shaders/polyline.d.ts +0 -3
- package/types/shaders/ray.d.ts +0 -2
- package/types/shaders/screenFrame.d.ts +0 -2
- package/types/shaders/skybox.d.ts +0 -2
- package/types/shaders/toneMapping.d.ts +0 -2
- package/types/shaders/utils.d.ts +0 -1
- package/types/terrain/BilTerrain.d.ts +0 -14
- package/types/terrain/EmptyTerrain.d.ts +0 -87
- package/types/terrain/Geoid.d.ts +0 -17
- package/types/terrain/GlobusTerrain.d.ts +0 -122
- package/types/terrain/MapboxTerrain.d.ts +0 -14
- package/types/terrain/index.d.ts +0 -5
- package/types/ui/Button.d.ts +0 -21
- package/types/ui/ButtonGroup.d.ts +0 -12
- package/types/ui/Dialog.d.ts +0 -41
- package/types/ui/Slider.d.ts +0 -33
- package/types/ui/ToggleButton.d.ts +0 -10
- package/types/ui/UIhelpers.d.ts +0 -13
- package/types/ui/View.d.ts +0 -33
- package/types/ui/icons.d.ts +0 -1
- package/types/utils/BaseWorker.d.ts +0 -14
- package/types/utils/FontAtlas.d.ts +0 -16
- package/types/utils/GeoImageCreator.d.ts +0 -30
- package/types/utils/ImagesCacheManager.d.ts +0 -10
- package/types/utils/Loader.d.ts +0 -31
- package/types/utils/NormalMapCreator.d.ts +0 -39
- package/types/utils/PlainSegmentWorker.d.ts +0 -8
- package/types/utils/TerrainWorker.d.ts +0 -7
- package/types/utils/TextureAtlas.d.ts +0 -113
- package/types/utils/VectorTileCreator.d.ts +0 -14
- package/types/utils/colorTable.d.ts +0 -143
- package/types/utils/earcut.d.ts +0 -6
- package/types/utils/functionComposition.d.ts +0 -5
- package/types/utils/objParser.d.ts +0 -8
- package/types/utils/shared.d.ts +0 -241
- package/types/utils/units.d.ts +0 -20
- package/types/webgl/Framebuffer.d.ts +0 -134
- package/types/webgl/Handler.d.ts +0 -403
- package/types/webgl/Multisample.d.ts +0 -91
- package/types/webgl/Program.d.ts +0 -163
- package/types/webgl/ProgramController.d.ts +0 -89
- package/types/webgl/callbacks.d.ts +0 -1
- package/types/webgl/index.d.ts +0 -6
- package/types/webgl/types.d.ts +0 -2
- /package/{src/og → dist/@openglobus/res/fonts}/arial.js +0 -0
- /package/src/{og/ui/icons.js → ui/icons.ts} +0 -0
|
@@ -1,51 +1,49 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
*
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
*
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
*
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
*
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
*
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
tai
|
|
49
|
-
|
|
50
|
-
return tai + 0.001658 * Math.sin(g + 1.671e-2 * Math.sin(g)) * jd.ONE_BY_SECONDS_PER_DAY;
|
|
51
|
-
}
|
|
1
|
+
import {JulianDate, ONE_BY_SECONDS_PER_DAY, J2000} from "./jd";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Angle between J2000 mean equator and the ecliptic plane.
|
|
5
|
+
* 23 deg 26' 21".448 (Seidelmann, _Explanatory Supplement to the
|
|
6
|
+
* Astronomical Almanac_ (1992), eqn 3.222-1.
|
|
7
|
+
* @const
|
|
8
|
+
* @type{number}
|
|
9
|
+
*/
|
|
10
|
+
export const J2000_OBLIQUITY = 23.4392911;
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* IAU 1976 value
|
|
14
|
+
* @const
|
|
15
|
+
* @type{number}
|
|
16
|
+
*/
|
|
17
|
+
export const AU_TO_METERS = 1.4959787e11;
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Terrestrial and atomic time difference.
|
|
21
|
+
* @const
|
|
22
|
+
* @type{number}
|
|
23
|
+
*/
|
|
24
|
+
export const TDT_TAI = 32.184;
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Earth gravitational parameter product of gravitational constant G and the mass M of the Earth.
|
|
28
|
+
* @const
|
|
29
|
+
* @type{number}
|
|
30
|
+
*/
|
|
31
|
+
export const EARTH_GRAVITATIONAL_PARAMETER = 3.98600435e14;
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Sun gravitational parameter product of gravitational constant G and the mass M of the Sun.
|
|
35
|
+
* @const
|
|
36
|
+
* @type{number}
|
|
37
|
+
*/
|
|
38
|
+
export const SUN_GRAVITATIONAL_PARAMETER = 1.32712440018e20;
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Converts atomic time to barycentric dynamical time.
|
|
42
|
+
* @param {JulianDate} tai - Atomic time.
|
|
43
|
+
* @returns {JulianDate} - returns barycentric dynamical time.
|
|
44
|
+
*/
|
|
45
|
+
export function TAItoTDB(tai: JulianDate): JulianDate {
|
|
46
|
+
tai += TDT_TAI * ONE_BY_SECONDS_PER_DAY;
|
|
47
|
+
const g = 6.239996 + 0.0172019696544 * (tai - J2000);
|
|
48
|
+
return tai + 0.001658 * Math.sin(g + 1.671e-2 * Math.sin(g)) * ONE_BY_SECONDS_PER_DAY;
|
|
49
|
+
}
|
|
@@ -1,17 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import * as jd from "./jd.js";
|
|
1
|
+
import * as math from "../math";
|
|
2
|
+
import { Quat } from "../math/Quat";
|
|
3
|
+
import { Vec3 } from "../math/Vec3";
|
|
4
|
+
import * as astro from "./astro";
|
|
5
|
+
import * as jd from "./jd";
|
|
6
|
+
import {JulianDate} from "./jd";
|
|
8
7
|
|
|
9
8
|
/**
|
|
10
9
|
* Returns Sun position in the geocentric coordinate system by the time.
|
|
11
|
-
* @param {
|
|
10
|
+
* @param {JulianDate} jDate - Julian date time.
|
|
12
11
|
* @returns {Vec3} - Sun geocentric coordinates.
|
|
13
12
|
*/
|
|
14
|
-
export function getSunPosition(jDate) {
|
|
13
|
+
export function getSunPosition(jDate: JulianDate): Vec3 {
|
|
15
14
|
// http://stjarnhimlen.se/comp/tutorial.html
|
|
16
15
|
// a Mean distance, or semi-major axis
|
|
17
16
|
// e Eccentricity
|
|
@@ -1,160 +1,139 @@
|
|
|
1
|
-
|
|
1
|
+
import {binarySearch} from "../utils/shared";
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
export type JulianDate = number;
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Seconds in millisecond.
|
|
7
7
|
* @const
|
|
8
|
-
* @default
|
|
9
8
|
*/
|
|
10
9
|
export const SECONDS_PER_MILLISECOND = 0.001;
|
|
11
10
|
|
|
12
11
|
/**
|
|
13
12
|
* Milliseconds in second.
|
|
14
13
|
* @const
|
|
15
|
-
* @default
|
|
16
14
|
*/
|
|
17
15
|
export const MILLISECONDS_PER_SECOND = 1000.0;
|
|
18
16
|
|
|
19
17
|
/**
|
|
20
18
|
* Seconds in minute.
|
|
21
19
|
* @const
|
|
22
|
-
* @default
|
|
23
20
|
*/
|
|
24
21
|
export const SECONDS_PER_MINUTE = 60.0;
|
|
25
22
|
|
|
26
23
|
/**
|
|
27
24
|
* One by seconds in minute.
|
|
28
25
|
* @const
|
|
29
|
-
* @default
|
|
30
26
|
*/
|
|
31
27
|
export const ONE_BY_SECONDS_PER_MINUTE = 1.0 / SECONDS_PER_MINUTE;
|
|
32
28
|
|
|
33
29
|
/**
|
|
34
30
|
* Minutes in hour.
|
|
35
31
|
* @const
|
|
36
|
-
* @default
|
|
37
32
|
*/
|
|
38
33
|
export const MINUTES_PER_HOUR = 60.0;
|
|
39
34
|
|
|
40
35
|
/**
|
|
41
36
|
* Hours in day.
|
|
42
37
|
* @const
|
|
43
|
-
* @default
|
|
44
38
|
*/
|
|
45
39
|
export const HOURS_PER_DAY = 24.0;
|
|
46
40
|
|
|
47
41
|
/**
|
|
48
42
|
* One by hours in day.
|
|
49
43
|
* @const
|
|
50
|
-
* @default
|
|
51
44
|
*/
|
|
52
45
|
export const ONE_BY_HOURS_PER_DAY = 1.0 / HOURS_PER_DAY;
|
|
53
46
|
|
|
54
47
|
/**
|
|
55
48
|
* Seconds in hour.
|
|
56
49
|
* @const
|
|
57
|
-
* @default
|
|
58
50
|
*/
|
|
59
51
|
export const SECONDS_PER_HOUR = 3600.0;
|
|
60
52
|
|
|
61
53
|
/**
|
|
62
54
|
* One by seconds in hour.
|
|
63
55
|
* @const
|
|
64
|
-
* @default
|
|
65
56
|
*/
|
|
66
57
|
export const ONE_BY_SECONDS_PER_HOUR = 1.0 / SECONDS_PER_HOUR;
|
|
67
58
|
|
|
68
59
|
/**
|
|
69
60
|
* Seconds in 12 hours.
|
|
70
61
|
* @const
|
|
71
|
-
* @default
|
|
72
62
|
*/
|
|
73
63
|
export const SECONDS_PER_12_HOURS = 12.0 * SECONDS_PER_HOUR;
|
|
74
64
|
|
|
75
65
|
/**
|
|
76
66
|
* Minutes in day.
|
|
77
67
|
* @const
|
|
78
|
-
* @default
|
|
79
68
|
*/
|
|
80
69
|
export const MINUTES_PER_DAY = 1440.0;
|
|
81
70
|
|
|
82
71
|
/**
|
|
83
72
|
* One by minutes in day.
|
|
84
73
|
* @const
|
|
85
|
-
* @default
|
|
86
74
|
*/
|
|
87
75
|
export const ONE_BY_MINUTES_PER_DAY = 1.0 / MINUTES_PER_DAY;
|
|
88
76
|
|
|
89
77
|
/**
|
|
90
78
|
* Seconds in day.
|
|
91
79
|
* @const
|
|
92
|
-
* @default
|
|
93
80
|
*/
|
|
94
81
|
export const SECONDS_PER_DAY = 86400.0;
|
|
95
82
|
|
|
96
83
|
/**
|
|
97
84
|
* Milliseconds in day.
|
|
98
85
|
* @const
|
|
99
|
-
* @default
|
|
100
86
|
*/
|
|
101
87
|
export const MILLISECONDS_PER_DAY = 86400000.0;
|
|
102
88
|
|
|
103
89
|
/**
|
|
104
90
|
* One by milliseconds in day.
|
|
105
91
|
* @const
|
|
106
|
-
* @default
|
|
107
92
|
*/
|
|
108
93
|
export const ONE_BY_MILLISECONDS_PER_DAY = 1.0 / MILLISECONDS_PER_DAY;
|
|
109
94
|
|
|
110
95
|
/**
|
|
111
96
|
* One by seconds in day.
|
|
112
97
|
* @const
|
|
113
|
-
* @default
|
|
114
98
|
*/
|
|
115
99
|
export const ONE_BY_SECONDS_PER_DAY = 1.0 / SECONDS_PER_DAY;
|
|
116
100
|
|
|
117
101
|
/**
|
|
118
102
|
* Days in julian century.
|
|
119
103
|
* @const
|
|
120
|
-
* @default
|
|
121
104
|
*/
|
|
122
105
|
export const DAYS_PER_JULIAN_CENTURY = 36525.0;
|
|
123
106
|
|
|
124
107
|
/**
|
|
125
108
|
* Days in julian year.
|
|
126
109
|
* @const
|
|
127
|
-
* @default
|
|
128
110
|
*/
|
|
129
111
|
export const DAYS_PER_JULIAN_YEAR = 365.25;
|
|
130
112
|
|
|
131
113
|
/**
|
|
132
|
-
* Seconds in
|
|
114
|
+
* Seconds in picoseconds.
|
|
133
115
|
* @const
|
|
134
|
-
* @default
|
|
135
116
|
*/
|
|
136
117
|
export const PICOSECOND = 0.000000001;
|
|
137
118
|
|
|
138
119
|
/**
|
|
139
120
|
* Modified julian date difference.
|
|
140
121
|
* @const
|
|
141
|
-
* @default
|
|
142
122
|
*/
|
|
143
123
|
export const MODIFIED_JULIAN_DATE_DIFFERENCE = 2400000.5;
|
|
144
124
|
|
|
145
125
|
/**
|
|
146
126
|
* Julian date of 2000 year. Epoch.
|
|
147
127
|
* @const
|
|
148
|
-
* @default
|
|
149
128
|
*/
|
|
150
129
|
export const J2000 = 2451545.0;
|
|
151
130
|
|
|
152
131
|
/**
|
|
153
132
|
* Returns julian days from Epoch.
|
|
154
|
-
* @param {
|
|
133
|
+
* @param {JulianDate} jd - Julian date.
|
|
155
134
|
* @returns {number} Days from epoch
|
|
156
135
|
*/
|
|
157
|
-
export function T(jd) {
|
|
136
|
+
export function T(jd: JulianDate): number {
|
|
158
137
|
return (jd - J2000) / DAYS_PER_JULIAN_CENTURY;
|
|
159
138
|
}
|
|
160
139
|
|
|
@@ -163,11 +142,11 @@ export function T(jd) {
|
|
|
163
142
|
* @param {number} year - Year.
|
|
164
143
|
* @param {number} month - Month.
|
|
165
144
|
* @param {number} day - Day.
|
|
166
|
-
* @returns {
|
|
145
|
+
* @returns {number} Day number
|
|
167
146
|
*/
|
|
168
|
-
export function getDayNumber(year, month, day) {
|
|
169
|
-
|
|
170
|
-
|
|
147
|
+
export function getDayNumber(year: number, month: number, day: number): number {
|
|
148
|
+
let a = ((month - 14) / 12) | 0;
|
|
149
|
+
let b = year + 4800 + a;
|
|
171
150
|
return (
|
|
172
151
|
(((1461 * b) / 4) | 0) +
|
|
173
152
|
(((367 * (month - 2 - 12 * a)) / 12) | 0) -
|
|
@@ -180,17 +159,17 @@ export function getDayNumber(year, month, day) {
|
|
|
180
159
|
/**
|
|
181
160
|
* Converts javascript date to the universal(UTC) julian date.
|
|
182
161
|
* @param {Date} date - Date.
|
|
183
|
-
* @returns {
|
|
162
|
+
* @returns {JulianDate} UTC julian date
|
|
184
163
|
*/
|
|
185
|
-
export function DateToUTC(date) {
|
|
186
|
-
|
|
164
|
+
export function DateToUTC(date: Date): JulianDate {
|
|
165
|
+
let dayNumber = getDayNumber(date.getUTCFullYear(), date.getUTCMonth() + 1, date.getUTCDate());
|
|
187
166
|
|
|
188
|
-
|
|
167
|
+
let hour = date.getUTCHours() - 12;
|
|
189
168
|
if (hour < 0) {
|
|
190
169
|
hour += 24;
|
|
191
170
|
}
|
|
192
171
|
|
|
193
|
-
|
|
172
|
+
let secondsOfDay =
|
|
194
173
|
date.getUTCSeconds() +
|
|
195
174
|
hour * SECONDS_PER_HOUR +
|
|
196
175
|
date.getUTCMinutes() * SECONDS_PER_MINUTE +
|
|
@@ -200,7 +179,7 @@ export function DateToUTC(date) {
|
|
|
200
179
|
dayNumber--;
|
|
201
180
|
}
|
|
202
181
|
|
|
203
|
-
|
|
182
|
+
let extraDays = (secondsOfDay * ONE_BY_SECONDS_PER_DAY) | 0;
|
|
204
183
|
dayNumber += extraDays;
|
|
205
184
|
secondsOfDay -= SECONDS_PER_DAY * extraDays;
|
|
206
185
|
|
|
@@ -215,21 +194,21 @@ export function DateToUTC(date) {
|
|
|
215
194
|
/**
|
|
216
195
|
* Converts javascript date to the atomic(TAI) julian date.
|
|
217
196
|
* @param {Date} date - Date.
|
|
218
|
-
* @returns {
|
|
197
|
+
* @returns {JulianDate} TAI julian date
|
|
219
198
|
*/
|
|
220
|
-
export function DateToTAI(date) {
|
|
199
|
+
export function DateToTAI(date: Date): JulianDate {
|
|
221
200
|
return UTCtoTAI(DateToUTC(date));
|
|
222
201
|
}
|
|
223
202
|
|
|
224
203
|
/**
|
|
225
204
|
* Converts coordinated universal(UTC) julian date to atomic(TAI) julian date.
|
|
226
|
-
* @param {
|
|
227
|
-
* @returns {
|
|
205
|
+
* @param {JulianDate} jd - UTC julian date.
|
|
206
|
+
* @returns {JulianDate} TAI julian date
|
|
228
207
|
*/
|
|
229
|
-
export function UTCtoTAI(jd) {
|
|
230
|
-
|
|
208
|
+
export function UTCtoTAI(jd: JulianDate): JulianDate {
|
|
209
|
+
let leapSeconds = leapSecondsTable;
|
|
231
210
|
|
|
232
|
-
|
|
211
|
+
let index = binarySearch(leapSeconds, jd, function (a: number, b: LeapSeconds) {
|
|
233
212
|
return a - b.jd;
|
|
234
213
|
});
|
|
235
214
|
|
|
@@ -241,7 +220,7 @@ export function UTCtoTAI(jd) {
|
|
|
241
220
|
index = leapSeconds.length - 1;
|
|
242
221
|
}
|
|
243
222
|
|
|
244
|
-
|
|
223
|
+
let offset = leapSeconds[index].leapSeconds;
|
|
245
224
|
|
|
246
225
|
if (index !== 0) {
|
|
247
226
|
if ((leapSeconds[index].jd - jd) * SECONDS_PER_DAY > offset) {
|
|
@@ -254,12 +233,12 @@ export function UTCtoTAI(jd) {
|
|
|
254
233
|
|
|
255
234
|
/**
|
|
256
235
|
* Converts atomic julian date(TAI) to the coordinated universal(UTC) julian date.
|
|
257
|
-
* @param {
|
|
258
|
-
* @returns {
|
|
236
|
+
* @param {JulianDate} tai - TAI julian date.
|
|
237
|
+
* @returns {JulianDate | undefined} UTC julian date
|
|
259
238
|
*/
|
|
260
|
-
export function TAItoUTC(tai) {
|
|
261
|
-
|
|
262
|
-
|
|
239
|
+
export function TAItoUTC(tai: JulianDate): JulianDate | undefined {
|
|
240
|
+
let leapSeconds = leapSecondsTable;
|
|
241
|
+
let index = binarySearch(leapSeconds, tai, function (a: JulianDate, b: LeapSeconds) {
|
|
263
242
|
return a - b.jd;
|
|
264
243
|
});
|
|
265
244
|
|
|
@@ -275,14 +254,14 @@ export function TAItoUTC(tai) {
|
|
|
275
254
|
return tai - leapSeconds[0].leapSeconds * ONE_BY_SECONDS_PER_DAY;
|
|
276
255
|
}
|
|
277
256
|
|
|
278
|
-
|
|
257
|
+
let diff = (leapSeconds[index].jd - tai) * SECONDS_PER_DAY;
|
|
279
258
|
|
|
280
259
|
if (diff === 0) {
|
|
281
260
|
return tai - leapSeconds[index].leapSeconds * ONE_BY_SECONDS_PER_DAY;
|
|
282
261
|
}
|
|
283
262
|
|
|
284
263
|
if (diff <= 1.0) {
|
|
285
|
-
return
|
|
264
|
+
return;
|
|
286
265
|
}
|
|
287
266
|
|
|
288
267
|
return tai - leapSeconds[index - 1].leapSeconds * ONE_BY_SECONDS_PER_DAY;
|
|
@@ -290,34 +269,34 @@ export function TAItoUTC(tai) {
|
|
|
290
269
|
|
|
291
270
|
/**
|
|
292
271
|
* Converts UTC julian date to the javascript date object.
|
|
293
|
-
* @param {
|
|
272
|
+
* @param {JulianDate} utc - UTC julian date.
|
|
294
273
|
* @returns {Date} JavaScript Date object
|
|
295
274
|
*/
|
|
296
|
-
export function UTCtoDate(utc) {
|
|
297
|
-
|
|
298
|
-
|
|
275
|
+
export function UTCtoDate(utc: JulianDate): Date {
|
|
276
|
+
let julianDayNumber = utc | 0;
|
|
277
|
+
let secondsOfDay = (utc - julianDayNumber) * SECONDS_PER_DAY;
|
|
299
278
|
|
|
300
279
|
if (secondsOfDay >= SECONDS_PER_12_HOURS) {
|
|
301
280
|
julianDayNumber++;
|
|
302
281
|
}
|
|
303
282
|
|
|
304
|
-
|
|
305
|
-
|
|
283
|
+
let L = (julianDayNumber + 68569) | 0;
|
|
284
|
+
let N = ((4 * L) / 146097) | 0;
|
|
306
285
|
L = (L - (((146097 * N + 3) / 4) | 0)) | 0;
|
|
307
|
-
|
|
286
|
+
let I = ((4000 * (L + 1)) / 1461001) | 0;
|
|
308
287
|
L = (L - (((1461 * I) / 4) | 0) + 31) | 0;
|
|
309
|
-
|
|
310
|
-
|
|
288
|
+
let J = ((80 * L) / 2447) | 0;
|
|
289
|
+
let day = (L - (((2447 * J) / 80) | 0)) | 0;
|
|
311
290
|
L = (J / 11) | 0;
|
|
312
|
-
|
|
313
|
-
|
|
291
|
+
let month = (J + 2 - 12 * L) | 0;
|
|
292
|
+
let year = (100 * (N - 49) + I + L) | 0;
|
|
314
293
|
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
294
|
+
let hour = (secondsOfDay * ONE_BY_SECONDS_PER_HOUR) | 0;
|
|
295
|
+
let remainingSeconds = secondsOfDay - hour * SECONDS_PER_HOUR;
|
|
296
|
+
let minute = (remainingSeconds * ONE_BY_SECONDS_PER_MINUTE) | 0;
|
|
318
297
|
remainingSeconds = remainingSeconds - minute * SECONDS_PER_MINUTE;
|
|
319
|
-
|
|
320
|
-
|
|
298
|
+
let second = remainingSeconds | 0;
|
|
299
|
+
let millisecond = ((remainingSeconds - second) * MILLISECONDS_PER_SECOND) | 0;
|
|
321
300
|
|
|
322
301
|
hour += 12;
|
|
323
302
|
if (hour > 23) {
|
|
@@ -329,14 +308,14 @@ export function UTCtoDate(utc) {
|
|
|
329
308
|
|
|
330
309
|
/**
|
|
331
310
|
* Converts TAI julian date to the javascript date object.
|
|
332
|
-
* @param {
|
|
311
|
+
* @param {JulianDate} tai - TAI julian date.
|
|
333
312
|
* @returns {Date} JavaScript Date object
|
|
334
313
|
*/
|
|
335
|
-
export function TAItoDate(tai) {
|
|
336
|
-
|
|
314
|
+
export function TAItoDate(tai: JulianDate): Date {
|
|
315
|
+
let utc = TAItoUTC(tai);
|
|
337
316
|
if (!utc) {
|
|
338
|
-
utc = TAItoUTC(addSeconds(tai, -1))
|
|
339
|
-
console.
|
|
317
|
+
utc = TAItoUTC(addSeconds(tai, -1))!;
|
|
318
|
+
console.trace(`TAItoDate - can't convert ${tai.toString()} to utc.`);
|
|
340
319
|
}
|
|
341
320
|
|
|
342
321
|
return UTCtoDate(utc);
|
|
@@ -344,90 +323,90 @@ export function TAItoDate(tai) {
|
|
|
344
323
|
|
|
345
324
|
/**
|
|
346
325
|
* Adds milliseconds to the julian date.
|
|
347
|
-
* @param {
|
|
326
|
+
* @param {JulianDate} jd - Julian date.
|
|
348
327
|
* @param {number} milliseconds - Milliseconds to add.
|
|
349
|
-
* @returns {
|
|
328
|
+
* @returns {JulianDate} Julian date
|
|
350
329
|
*/
|
|
351
|
-
export function addMilliseconds(jd, milliseconds) {
|
|
330
|
+
export function addMilliseconds(jd: JulianDate, milliseconds: number): JulianDate {
|
|
352
331
|
return jd + milliseconds * ONE_BY_MILLISECONDS_PER_DAY;
|
|
353
332
|
}
|
|
354
333
|
|
|
355
334
|
/**
|
|
356
335
|
* Adds seconds to the julian date.
|
|
357
|
-
* @param {
|
|
336
|
+
* @param {JulianDate} jd - Julian date.
|
|
358
337
|
* @param {number} seconds - Seconds to add.
|
|
359
|
-
* @returns {
|
|
338
|
+
* @returns {JulianDate} Julian date
|
|
360
339
|
*/
|
|
361
|
-
export function addSeconds(jd, seconds) {
|
|
340
|
+
export function addSeconds(jd: JulianDate, seconds: number): JulianDate {
|
|
362
341
|
return jd + seconds * ONE_BY_SECONDS_PER_DAY;
|
|
363
342
|
}
|
|
364
343
|
|
|
365
344
|
/**
|
|
366
345
|
* Adds hours to the julian date.
|
|
367
|
-
* @param {
|
|
346
|
+
* @param {JulianDate} jd - Julian date.
|
|
368
347
|
* @param {number} hours - Hours to add.
|
|
369
|
-
* @returns {
|
|
348
|
+
* @returns {JulianDate} Julian date
|
|
370
349
|
*/
|
|
371
|
-
export function addHours(jd, hours) {
|
|
350
|
+
export function addHours(jd: JulianDate, hours: number): JulianDate {
|
|
372
351
|
return jd + hours * ONE_BY_HOURS_PER_DAY;
|
|
373
352
|
}
|
|
374
353
|
|
|
375
354
|
/**
|
|
376
355
|
* Adds minutes to the julian date.
|
|
377
|
-
* @param {
|
|
356
|
+
* @param {JulianDate} jd - Julian date.
|
|
378
357
|
* @param {number} minutes - Minutes to add.
|
|
379
|
-
* @returns {
|
|
358
|
+
* @returns {JulianDate} Julian date
|
|
380
359
|
*/
|
|
381
|
-
export function addMinutes(jd, minutes) {
|
|
360
|
+
export function addMinutes(jd: JulianDate, minutes: number): JulianDate {
|
|
382
361
|
return jd + minutes * MINUTES_PER_DAY;
|
|
383
362
|
}
|
|
384
363
|
|
|
385
364
|
/**
|
|
386
365
|
* Adds days to the julian date.
|
|
387
|
-
* @param {
|
|
366
|
+
* @param {JulianDate} jd - Julian date.
|
|
388
367
|
* @param {number} days - Days to add.
|
|
389
|
-
* @returns {
|
|
368
|
+
* @returns {JulianDate} Julian date
|
|
390
369
|
*/
|
|
391
|
-
export function addDays(jd, days) {
|
|
370
|
+
export function addDays(jd: JulianDate, days: number): JulianDate {
|
|
392
371
|
return jd + days;
|
|
393
372
|
}
|
|
394
373
|
|
|
395
374
|
/**
|
|
396
375
|
* Gets milliseconds of a julian date.
|
|
397
|
-
* @param {
|
|
376
|
+
* @param {JulianDate} jd - julian date.
|
|
398
377
|
* @returns {number} Milliseconds
|
|
399
378
|
*/
|
|
400
|
-
export function getMilliseconds(jd) {
|
|
401
|
-
|
|
379
|
+
export function getMilliseconds(jd: JulianDate): number {
|
|
380
|
+
let s = jd - (jd | 0);
|
|
402
381
|
s *= SECONDS_PER_DAY;
|
|
403
382
|
return ((s - (s | 0)) * MILLISECONDS_PER_SECOND) | 0;
|
|
404
383
|
}
|
|
405
384
|
|
|
406
385
|
/**
|
|
407
386
|
* Gets seconds of a julian date.
|
|
408
|
-
* @param {
|
|
387
|
+
* @param {JulianDate} jd - julian date.
|
|
409
388
|
* @returns {number} Seconds
|
|
410
389
|
*/
|
|
411
|
-
export function getSeconds(jd) {
|
|
412
|
-
|
|
390
|
+
export function getSeconds(jd: JulianDate): number {
|
|
391
|
+
let s = jd - (jd | 0);
|
|
413
392
|
return s * SECONDS_PER_DAY;
|
|
414
393
|
}
|
|
415
394
|
|
|
416
395
|
/**
|
|
417
396
|
* Gets hours of a julian date.
|
|
418
|
-
* @param {
|
|
397
|
+
* @param {JulianDate} jd - julian date.
|
|
419
398
|
* @returns {number} Hours
|
|
420
399
|
*/
|
|
421
|
-
export function getHours(jd) {
|
|
422
|
-
|
|
423
|
-
|
|
400
|
+
export function getHours(jd: JulianDate): number {
|
|
401
|
+
let julianDayNumber = jd | 0;
|
|
402
|
+
let secondsOfDay = (jd - julianDayNumber) * SECONDS_PER_DAY;
|
|
424
403
|
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
404
|
+
let hour = (secondsOfDay * ONE_BY_SECONDS_PER_HOUR) | 0;
|
|
405
|
+
let remainingSeconds = secondsOfDay - hour * SECONDS_PER_HOUR;
|
|
406
|
+
let minute = (remainingSeconds * ONE_BY_SECONDS_PER_MINUTE) | 0;
|
|
428
407
|
remainingSeconds = remainingSeconds - minute * SECONDS_PER_MINUTE;
|
|
429
|
-
|
|
430
|
-
|
|
408
|
+
let second = remainingSeconds | 0;
|
|
409
|
+
let millisecond = ((remainingSeconds - second) * MILLISECONDS_PER_SECOND) | 0;
|
|
431
410
|
|
|
432
411
|
hour += 12 + minute / 60 + second / 3600 + millisecond / 1000;
|
|
433
412
|
if (hour > 23) {
|
|
@@ -439,20 +418,20 @@ export function getHours(jd) {
|
|
|
439
418
|
|
|
440
419
|
/**
|
|
441
420
|
* Gets minutes of a julian date.
|
|
442
|
-
* @param {
|
|
421
|
+
* @param {JulianDate} jd - julian date.
|
|
443
422
|
* @returns {number} Minutes
|
|
444
423
|
*/
|
|
445
|
-
export function getMinutes(jd) {
|
|
446
|
-
|
|
424
|
+
export function getMinutes(jd: JulianDate): number {
|
|
425
|
+
let s = jd - (jd | 0);
|
|
447
426
|
return (s * MINUTES_PER_DAY) | 0;
|
|
448
427
|
}
|
|
449
428
|
|
|
450
429
|
/**
|
|
451
430
|
* Gets days of a julian date.
|
|
452
|
-
* @param {
|
|
431
|
+
* @param {JulianDate} jd - julian date.
|
|
453
432
|
* @returns {number} Days
|
|
454
433
|
*/
|
|
455
|
-
export function getDays(jd) {
|
|
434
|
+
export function getDays(jd: JulianDate): number {
|
|
456
435
|
return jd | 0;
|
|
457
436
|
}
|
|
458
437
|
|
|
@@ -461,7 +440,7 @@ export function getDays(jd) {
|
|
|
461
440
|
* @param {number} s - Seconds.
|
|
462
441
|
* @returns {number} Days
|
|
463
442
|
*/
|
|
464
|
-
export function secondsToDays(s) {
|
|
443
|
+
export function secondsToDays(s: number): number {
|
|
465
444
|
return s * ONE_BY_SECONDS_PER_DAY;
|
|
466
445
|
}
|
|
467
446
|
|
|
@@ -470,18 +449,20 @@ export function secondsToDays(s) {
|
|
|
470
449
|
* @param {number} d - Days.
|
|
471
450
|
* @returns {number} Seconds
|
|
472
451
|
*/
|
|
473
|
-
export function daysToSeconds(d) {
|
|
452
|
+
export function daysToSeconds(d: number): number {
|
|
474
453
|
return d * SECONDS_PER_DAY;
|
|
475
454
|
}
|
|
476
455
|
|
|
477
|
-
|
|
456
|
+
type LeapSeconds = { jd: JulianDate, leapSeconds: number };
|
|
457
|
+
|
|
458
|
+
function __ls(jd: JulianDate, leapSeconds: number): LeapSeconds {
|
|
478
459
|
return {
|
|
479
460
|
jd: jd,
|
|
480
461
|
leapSeconds: leapSeconds
|
|
481
462
|
};
|
|
482
463
|
}
|
|
483
464
|
|
|
484
|
-
const leapSecondsTable = [
|
|
465
|
+
const leapSecondsTable: LeapSeconds[] = [
|
|
485
466
|
__ls(2441317.5, 10.0), // 1972-01-01T00:00:00.000Z
|
|
486
467
|
__ls(2441499.5, 11.0), // 1972-07-01T00:00:00.000Z
|
|
487
468
|
__ls(2441683.5, 12.0), // 1973-01-01T00:00:00.000Z
|