@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,33 +1,57 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import { Extent } from "../Extent.js";
|
|
7
|
-
import * as math from "../math.js";
|
|
8
|
-
import { Vec3 } from "../math/Vec3.js";
|
|
9
|
-
import * as mercator from "../mercator.js";
|
|
1
|
+
import * as math from "../math";
|
|
2
|
+
import * as mercator from "../mercator";
|
|
3
|
+
import * as quadTree from "../quadTree/quadTree";
|
|
4
|
+
import {Entity, IEntityParams} from "../entity/Entity";
|
|
5
|
+
import {EntityCollection} from "../entity/EntityCollection";
|
|
10
6
|
import {
|
|
11
7
|
EntityCollectionNode,
|
|
12
8
|
EntityCollectionNodeWGS84
|
|
13
|
-
} from "../quadTree/EntityCollectionNode
|
|
14
|
-
import
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
9
|
+
} from "../quadTree/EntityCollectionNode";
|
|
10
|
+
import {EventsHandler} from "../Events";
|
|
11
|
+
import {Extent} from "../Extent";
|
|
12
|
+
import {GeometryHandler} from "../entity/GeometryHandler";
|
|
13
|
+
import {ILayerParams, Layer, LayerEventsList} from "./Layer";
|
|
14
|
+
import {NumberArray3, Vec3} from "../math/Vec3";
|
|
15
|
+
import {Node} from "../quadTree/Node";
|
|
16
|
+
import {Planet} from "../scene/Planet";
|
|
17
|
+
import {QueueArray} from "../QueueArray";
|
|
18
|
+
import {Material} from "./Material";
|
|
19
|
+
import {NumberArray4} from "../math/Vec4";
|
|
20
|
+
|
|
21
|
+
export interface IVectorParams extends ILayerParams {
|
|
22
|
+
entities?: Entity[] | IEntityParams[];
|
|
23
|
+
polygonOffsetUnits?: number;
|
|
24
|
+
nodeCapacity?: number;
|
|
25
|
+
relativeToGround?: boolean;
|
|
26
|
+
clampToGround?: boolean;
|
|
27
|
+
async?: boolean;
|
|
28
|
+
pickingScale?: number;
|
|
29
|
+
scaleByDistance?: NumberArray3;
|
|
30
|
+
labelMaxLetters?: number;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
type VectorEventsList = [
|
|
34
|
+
"entitymove",
|
|
35
|
+
"draw",
|
|
36
|
+
"entityadd",
|
|
37
|
+
"entityremove"
|
|
38
|
+
]
|
|
39
|
+
|
|
40
|
+
export type VectorEventsType = EventsHandler<VectorEventsList> & EventsHandler<LayerEventsList>;
|
|
17
41
|
|
|
18
42
|
/**
|
|
19
43
|
* Creates entity instance array.
|
|
20
|
-
* @param {Entity[]} entities - Entity array.
|
|
44
|
+
* @param {Entity[] | IEntityParams[]} entities - Entity array.
|
|
21
45
|
* @returns {Entity[]} - Entity array.
|
|
22
46
|
*/
|
|
23
|
-
function _entitiesConstructor(entities) {
|
|
24
|
-
|
|
47
|
+
function _entitiesConstructor(entities: Entity[] | IEntityParams[]): Entity[] {
|
|
48
|
+
let res: Entity[] = [];
|
|
25
49
|
for (let i = 0; i < entities.length; i++) {
|
|
26
|
-
|
|
27
|
-
if (ei.instanceName === "Entity") {
|
|
28
|
-
res.push(ei);
|
|
50
|
+
let ei = entities[i];
|
|
51
|
+
if ((ei as Entity).instanceName === "Entity") {
|
|
52
|
+
res.push(ei as Entity);
|
|
29
53
|
} else {
|
|
30
|
-
res.push(new Entity(ei));
|
|
54
|
+
res.push(new Entity(ei as IEntityParams));
|
|
31
55
|
}
|
|
32
56
|
}
|
|
33
57
|
return res;
|
|
@@ -39,7 +63,7 @@ function _entitiesConstructor(entities) {
|
|
|
39
63
|
* @class
|
|
40
64
|
* @extends {Layer}
|
|
41
65
|
* @param {string} [name="noname"] - Layer name.
|
|
42
|
-
* @param {
|
|
66
|
+
* @param {IVectorParams} [options] - Layer options:
|
|
43
67
|
* @param {number} [options.minZoom=0] - Minimal visible zoom. 0 is default
|
|
44
68
|
* @param {number} [options.maxZoom=50] - Maximal visible zoom. 50 is default.
|
|
45
69
|
* @param {string} [options.attribution] - Layer attribution.
|
|
@@ -57,73 +81,119 @@ function _entitiesConstructor(entities) {
|
|
|
57
81
|
* @param {boolean} [options.relativeToGround = false] - Place vector data relative to the ground relief.
|
|
58
82
|
* @param {Number} [options.polygonOffsetUnits=0.0] - The multiplier by which an implementation-specific value is multiplied with to create a constant depth offset.
|
|
59
83
|
*
|
|
60
|
-
* @fires
|
|
61
|
-
* @fires
|
|
62
|
-
* @fires
|
|
63
|
-
* @fires
|
|
64
|
-
* @fires
|
|
65
|
-
* @fires
|
|
66
|
-
* @fires
|
|
84
|
+
* @fires EventsHandler<VectorEventsList>#entitymove
|
|
85
|
+
* @fires EventsHandler<VectorEventsList>#draw
|
|
86
|
+
* @fires EventsHandler<VectorEventsList>#add
|
|
87
|
+
* @fires EventsHandler<VectorEventsList>#remove
|
|
88
|
+
* @fires EventsHandler<VectorEventsList>#entityadd
|
|
89
|
+
* @fires EventsHandler<VectorEventsList>#entityremove
|
|
90
|
+
* @fires EventsHandler<VectorEventsList>#visibilitychange
|
|
67
91
|
*/
|
|
68
92
|
class Vector extends Layer {
|
|
93
|
+
|
|
94
|
+
public override events: VectorEventsType;
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* Entities collection.
|
|
98
|
+
* @protected
|
|
99
|
+
*/
|
|
100
|
+
protected _entities: Entity[];
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* First index - near distance to the entity, after that entity becomes full scale.
|
|
104
|
+
* Second index - far distance to the entity, when entity becomes zero scale.
|
|
105
|
+
* Third index - far distance to the entity, when entity becomes invisible.
|
|
106
|
+
* @public
|
|
107
|
+
* @type {NumberArray3} - (exactly 3 entries)
|
|
108
|
+
*/
|
|
109
|
+
public scaleByDistance: NumberArray3;
|
|
110
|
+
|
|
111
|
+
public pickingScale: number;
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* Asynchronous data handling before rendering.
|
|
115
|
+
* @public
|
|
116
|
+
* @type {boolean}
|
|
117
|
+
*/
|
|
118
|
+
public async: boolean;
|
|
119
|
+
|
|
120
|
+
/**
|
|
121
|
+
* Clamp vector data to the ground.
|
|
122
|
+
* @public
|
|
123
|
+
* @type {boolean}
|
|
124
|
+
*/
|
|
125
|
+
public clampToGround: boolean;
|
|
126
|
+
|
|
127
|
+
/**
|
|
128
|
+
* Sets vector data relative to the ground relief.
|
|
129
|
+
* @public
|
|
130
|
+
* @type {boolean}
|
|
131
|
+
*/
|
|
132
|
+
public relativeToGround: boolean;
|
|
133
|
+
|
|
134
|
+
|
|
135
|
+
protected _stripEntityCollection: EntityCollection;
|
|
136
|
+
protected _polylineEntityCollection: EntityCollection;
|
|
137
|
+
protected _geoObjectEntityCollection: EntityCollection;
|
|
138
|
+
public _geometryHandler: GeometryHandler;
|
|
139
|
+
|
|
140
|
+
/**
|
|
141
|
+
* Maximum entities quantity in the tree node.
|
|
142
|
+
* @public
|
|
143
|
+
*/
|
|
144
|
+
public _nodeCapacity: number;
|
|
145
|
+
|
|
146
|
+
protected _entityCollectionsTree: EntityCollectionNode | null;
|
|
147
|
+
protected _entityCollectionsTreeNorth: EntityCollectionNodeWGS84 | null;
|
|
148
|
+
protected _entityCollectionsTreeSouth: EntityCollectionNodeWGS84 | null;
|
|
149
|
+
|
|
150
|
+
public _renderingNodes: Record<number, boolean>;
|
|
151
|
+
public _renderingNodesNorth: Record<number, boolean>;
|
|
152
|
+
public _renderingNodesSouth: Record<number, boolean>;
|
|
153
|
+
|
|
154
|
+
protected _counter: number;
|
|
155
|
+
protected _deferredEntitiesPendingQueue: QueueArray<EntityCollectionNode>;
|
|
156
|
+
|
|
157
|
+
protected _pendingsQueue: Entity[];
|
|
158
|
+
|
|
69
159
|
/**
|
|
70
|
-
*
|
|
71
|
-
* @
|
|
160
|
+
* Specifies the scale Units for gl.polygonOffset function to calculate depth values, 0.0 is default.
|
|
161
|
+
* @public
|
|
162
|
+
* @type {Number}
|
|
72
163
|
*/
|
|
73
|
-
|
|
164
|
+
public polygonOffsetUnits: number;
|
|
165
|
+
|
|
166
|
+
public _secondPASS: EntityCollectionNode[];
|
|
167
|
+
|
|
168
|
+
protected _labelMaxLetters: number;
|
|
169
|
+
|
|
170
|
+
|
|
171
|
+
constructor(name?: string | null, options: IVectorParams = {}) {
|
|
74
172
|
super(name, options);
|
|
75
173
|
|
|
76
|
-
|
|
174
|
+
// @ts-ignore
|
|
175
|
+
this.events = this.events.registerNames(VECTOR_EVENTS);
|
|
77
176
|
|
|
78
177
|
this.isVector = true;
|
|
79
178
|
|
|
80
179
|
this._hasImageryTiles = false;
|
|
81
180
|
|
|
82
|
-
|
|
83
|
-
/**
|
|
84
|
-
* First index - near distance to the entity, after that entity becomes full scale.
|
|
85
|
-
* Second index - far distance to the entity, when entity becomes zero scale.
|
|
86
|
-
* Third index - far distance to the entity, when entity becomes invisible.
|
|
87
|
-
* @public
|
|
88
|
-
* @type {Array.<number>} - (exactly 3 entries)
|
|
89
|
-
*/
|
|
90
181
|
this.scaleByDistance = options.scaleByDistance || [math.MAX32, math.MAX32, math.MAX32];
|
|
91
182
|
|
|
92
183
|
this.pickingScale = options.pickingScale || 1;
|
|
93
184
|
|
|
94
|
-
/**
|
|
95
|
-
* Asynchronous data handling before rendering.
|
|
96
|
-
* @public
|
|
97
|
-
* @type {boolean}
|
|
98
|
-
*/
|
|
99
185
|
this.async = options.async !== undefined ? options.async : true;
|
|
100
186
|
|
|
101
|
-
/**
|
|
102
|
-
* Vector data clamp to ground flag.
|
|
103
|
-
* @public
|
|
104
|
-
* @type {boolean}
|
|
105
|
-
*/
|
|
106
187
|
this.clampToGround = options.clampToGround || false;
|
|
107
188
|
|
|
108
|
-
/**
|
|
109
|
-
* Sets vector data relative to the ground relief.
|
|
110
|
-
* @public
|
|
111
|
-
* @type {boolean}
|
|
112
|
-
*/
|
|
113
189
|
this.relativeToGround = options.relativeToGround || false;
|
|
114
190
|
|
|
115
|
-
/**
|
|
116
|
-
* Maximum entities quantity in the tree node.
|
|
117
|
-
* @private
|
|
118
|
-
*/
|
|
119
191
|
this._nodeCapacity = options.nodeCapacity || 30;
|
|
120
192
|
|
|
121
|
-
/**
|
|
122
|
-
* Stored entities.
|
|
123
|
-
* @private
|
|
124
|
-
*/
|
|
125
193
|
this._entities = _entitiesConstructor(options.entities || []);
|
|
126
194
|
|
|
195
|
+
this._labelMaxLetters = options.labelMaxLetters || 24;
|
|
196
|
+
|
|
127
197
|
this._stripEntityCollection = new EntityCollection({
|
|
128
198
|
pickingEnabled: this.pickingEnabled
|
|
129
199
|
});
|
|
@@ -150,29 +220,28 @@ class Vector extends Layer {
|
|
|
150
220
|
this._renderingNodesSouth = {};
|
|
151
221
|
|
|
152
222
|
this._counter = 0;
|
|
153
|
-
this._deferredEntitiesPendingQueue = new QueueArray();
|
|
223
|
+
this._deferredEntitiesPendingQueue = new QueueArray<EntityCollectionNode>();
|
|
154
224
|
|
|
155
225
|
this._pendingsQueue = [];
|
|
156
226
|
|
|
157
|
-
// Creates collections tree
|
|
158
227
|
this.setEntities(this._entities);
|
|
159
228
|
|
|
160
|
-
|
|
161
|
-
* Specifies the scale Units for gl.polygonOffset function to calculate depth values, 0.0 is default.
|
|
162
|
-
* @public
|
|
163
|
-
* @type {Number}
|
|
164
|
-
*/
|
|
165
|
-
this.polygonOffsetUnits =
|
|
166
|
-
options.polygonOffsetUnits != undefined ? options.polygonOffsetUnits : 0.0;
|
|
229
|
+
this.polygonOffsetUnits = options.polygonOffsetUnits != undefined ? options.polygonOffsetUnits : 0.0;
|
|
167
230
|
|
|
168
231
|
this.pickingEnabled = this._pickingEnabled;
|
|
232
|
+
|
|
233
|
+
this._secondPASS = [];
|
|
169
234
|
}
|
|
170
235
|
|
|
171
|
-
get
|
|
236
|
+
public get labelMaxLetters(): number {
|
|
237
|
+
return this._labelMaxLetters;
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
public override get instanceName() {
|
|
172
241
|
return "Vector";
|
|
173
242
|
}
|
|
174
243
|
|
|
175
|
-
_bindPicking() {
|
|
244
|
+
protected override _bindPicking() {
|
|
176
245
|
this._pickingColor.clear();
|
|
177
246
|
}
|
|
178
247
|
|
|
@@ -180,25 +249,25 @@ class Vector extends Layer {
|
|
|
180
249
|
* Adds layer to the planet.
|
|
181
250
|
* @public
|
|
182
251
|
* @param {Planet} planet - Planet scene object.
|
|
183
|
-
* @returns {
|
|
252
|
+
* @returns {Vector} -
|
|
184
253
|
*/
|
|
185
|
-
addTo(planet) {
|
|
254
|
+
public override addTo(planet: Planet) {
|
|
186
255
|
if (!this._planet) {
|
|
187
256
|
this._assignPlanet(planet);
|
|
188
|
-
this._geometryHandler.assignHandler(planet.renderer
|
|
257
|
+
this._geometryHandler.assignHandler(planet.renderer!.handler);
|
|
189
258
|
this._polylineEntityCollection.addTo(planet, true);
|
|
190
259
|
this._stripEntityCollection.addTo(planet, true);
|
|
191
260
|
this._geoObjectEntityCollection.addTo(planet, true);
|
|
192
261
|
this.setEntities(this._entities);
|
|
193
262
|
}
|
|
194
|
-
return this;
|
|
195
263
|
}
|
|
196
264
|
|
|
197
|
-
remove() {
|
|
265
|
+
public override remove(): this {
|
|
198
266
|
super.remove();
|
|
199
267
|
this._polylineEntityCollection.remove();
|
|
200
268
|
this._stripEntityCollection.remove();
|
|
201
269
|
this._geoObjectEntityCollection.remove();
|
|
270
|
+
return this;
|
|
202
271
|
}
|
|
203
272
|
|
|
204
273
|
/**
|
|
@@ -206,8 +275,8 @@ class Vector extends Layer {
|
|
|
206
275
|
* @public
|
|
207
276
|
* @returns {Array.<Entity>} -
|
|
208
277
|
*/
|
|
209
|
-
getEntities() {
|
|
210
|
-
return [].concat(this._entities);
|
|
278
|
+
public getEntities(): Entity[] {
|
|
279
|
+
return ([] as Entity[]).concat(this._entities);
|
|
211
280
|
}
|
|
212
281
|
|
|
213
282
|
//_fitExtent(entity) {
|
|
@@ -242,10 +311,10 @@ class Vector extends Layer {
|
|
|
242
311
|
* Adds entity to the layer.
|
|
243
312
|
* @public
|
|
244
313
|
* @param {Entity} entity - Entity.
|
|
245
|
-
* @param {boolean} [rightNow] - Entity insertion option. False is default.
|
|
246
|
-
* @returns {
|
|
314
|
+
* @param {boolean} [rightNow=false] - Entity insertion option. False is default.
|
|
315
|
+
* @returns {Vector} - Returns this layer.
|
|
247
316
|
*/
|
|
248
|
-
add(entity, rightNow) {
|
|
317
|
+
public add(entity: Entity, rightNow: boolean = false): this {
|
|
249
318
|
if (!(entity._layer || entity._entityCollection)) {
|
|
250
319
|
entity._layer = this;
|
|
251
320
|
entity._layerIndex = this._entities.length;
|
|
@@ -262,9 +331,9 @@ class Vector extends Layer {
|
|
|
262
331
|
* @param {Entity} entity - Entity.
|
|
263
332
|
* @param {Number} index - Index position.
|
|
264
333
|
* @param {boolean} [rightNow] - Entity insertion option. False is default.
|
|
265
|
-
* @returns {
|
|
334
|
+
* @returns {Vector} - Returns this layer.
|
|
266
335
|
*/
|
|
267
|
-
insert(entity, index, rightNow) {
|
|
336
|
+
public insert(entity: Entity, index: number, rightNow: boolean = false): this {
|
|
268
337
|
if (!(entity._layer || entity._entityCollection)) {
|
|
269
338
|
entity._layer = this;
|
|
270
339
|
entity._layerIndex = index;
|
|
@@ -280,7 +349,7 @@ class Vector extends Layer {
|
|
|
280
349
|
return this;
|
|
281
350
|
}
|
|
282
351
|
|
|
283
|
-
_proceedEntity(entity, rightNow) {
|
|
352
|
+
protected _proceedEntity(entity: Entity, rightNow: boolean = false) {
|
|
284
353
|
let temp = this._hasImageryTiles;
|
|
285
354
|
|
|
286
355
|
if (entity.strip) {
|
|
@@ -298,7 +367,7 @@ class Vector extends Layer {
|
|
|
298
367
|
if (entity.geometry) {
|
|
299
368
|
this._hasImageryTiles = true;
|
|
300
369
|
if (this._planet) {
|
|
301
|
-
this._planet.renderer
|
|
370
|
+
this._planet.renderer!.assignPickingColor<Entity>(entity);
|
|
302
371
|
this._geometryHandler.add(entity.geometry);
|
|
303
372
|
}
|
|
304
373
|
}
|
|
@@ -315,15 +384,14 @@ class Vector extends Layer {
|
|
|
315
384
|
|
|
316
385
|
// north tree
|
|
317
386
|
if (entity._lonLat.lat > mercator.MAX_LAT) {
|
|
318
|
-
this._entityCollectionsTreeNorth
|
|
319
|
-
this._entityCollectionsTreeNorth
|
|
387
|
+
this._entityCollectionsTreeNorth!.__setLonLat__(entity);
|
|
388
|
+
this._entityCollectionsTreeNorth!.insertEntity(entity, rightNow);
|
|
320
389
|
} else if (entity._lonLat.lat < mercator.MIN_LAT) {
|
|
321
|
-
|
|
322
|
-
this._entityCollectionsTreeSouth
|
|
323
|
-
this._entityCollectionsTreeSouth.insertEntity(entity, rightNow);
|
|
390
|
+
this._entityCollectionsTreeSouth!.__setLonLat__(entity);
|
|
391
|
+
this._entityCollectionsTreeSouth!.insertEntity(entity, rightNow);
|
|
324
392
|
} else {
|
|
325
|
-
this._entityCollectionsTree
|
|
326
|
-
this._entityCollectionsTree
|
|
393
|
+
this._entityCollectionsTree!.__setLonLat__(entity);
|
|
394
|
+
this._entityCollectionsTree!.insertEntity(entity, rightNow);
|
|
327
395
|
}
|
|
328
396
|
}
|
|
329
397
|
}
|
|
@@ -339,11 +407,11 @@ class Vector extends Layer {
|
|
|
339
407
|
* Adds entity array to the layer.
|
|
340
408
|
* @public
|
|
341
409
|
* @param {Array.<Entity>} entities - Entities array.
|
|
342
|
-
* @param {boolean} [rightNow] - Entity insertion option. False is default.
|
|
343
|
-
* @returns {
|
|
410
|
+
* @param {boolean} [rightNow=false] - Entity insertion option. False is default.
|
|
411
|
+
* @returns {Vector} - Returns this layer.
|
|
344
412
|
*/
|
|
345
|
-
addEntities(entities, rightNow) {
|
|
346
|
-
|
|
413
|
+
public addEntities(entities: Entity[], rightNow: boolean = false) {
|
|
414
|
+
let i = entities.length;
|
|
347
415
|
while (i--) {
|
|
348
416
|
this.add(entities[i], rightNow);
|
|
349
417
|
}
|
|
@@ -355,22 +423,31 @@ class Vector extends Layer {
|
|
|
355
423
|
* TODO: memory leaks.
|
|
356
424
|
* @public
|
|
357
425
|
* @param {Entity} entity - Entity to remove.
|
|
358
|
-
* @returns {
|
|
426
|
+
* @returns {Vector} - Returns this layer.
|
|
359
427
|
*/
|
|
360
|
-
removeEntity(entity) {
|
|
428
|
+
public removeEntity(entity: Entity): this {
|
|
429
|
+
|
|
361
430
|
if (entity._layer && this.isEqual(entity._layer)) {
|
|
431
|
+
|
|
362
432
|
this._entities.splice(entity._layerIndex, 1);
|
|
433
|
+
|
|
363
434
|
this._reindexEntitiesArray(entity._layerIndex);
|
|
435
|
+
|
|
364
436
|
entity._layer = null;
|
|
437
|
+
|
|
365
438
|
entity._layerIndex = -1;
|
|
366
439
|
|
|
367
440
|
if (entity._entityCollection) {
|
|
441
|
+
|
|
368
442
|
entity._entityCollection._removeEntitySilent(entity);
|
|
443
|
+
|
|
369
444
|
let node = entity._nodePtr;
|
|
445
|
+
|
|
370
446
|
while (node) {
|
|
371
447
|
node.count--;
|
|
372
|
-
node = node.parentNode
|
|
448
|
+
node = node.parentNode!;
|
|
373
449
|
}
|
|
450
|
+
|
|
374
451
|
if (
|
|
375
452
|
entity._nodePtr &&
|
|
376
453
|
entity._nodePtr.count === 0 &&
|
|
@@ -382,15 +459,15 @@ class Vector extends Layer {
|
|
|
382
459
|
//
|
|
383
460
|
}
|
|
384
461
|
} else if (entity._nodePtr && entity._nodePtr.deferredEntities.length) {
|
|
385
|
-
|
|
386
|
-
|
|
462
|
+
let defEntities = entity._nodePtr.deferredEntities;
|
|
463
|
+
let j = defEntities.length;
|
|
387
464
|
while (j--) {
|
|
388
465
|
if (defEntities[j].id === entity.id) {
|
|
389
466
|
defEntities.splice(j, 1);
|
|
390
467
|
let node = entity._nodePtr;
|
|
391
468
|
while (node) {
|
|
392
469
|
node.count--;
|
|
393
|
-
node = node.parentNode
|
|
470
|
+
node = node.parentNode!;
|
|
394
471
|
}
|
|
395
472
|
break;
|
|
396
473
|
}
|
|
@@ -400,13 +477,15 @@ class Vector extends Layer {
|
|
|
400
477
|
if (entity.geometry) {
|
|
401
478
|
if (this._planet) {
|
|
402
479
|
this._geometryHandler.remove(entity.geometry);
|
|
403
|
-
this._planet.renderer
|
|
480
|
+
this._planet.renderer!.clearPickingColor(entity);
|
|
404
481
|
}
|
|
405
482
|
}
|
|
406
483
|
|
|
407
|
-
entity._nodePtr
|
|
484
|
+
entity._nodePtr = undefined;
|
|
485
|
+
|
|
408
486
|
this.events.dispatch(this.events.entityremove, entity);
|
|
409
487
|
}
|
|
488
|
+
|
|
410
489
|
return this;
|
|
411
490
|
}
|
|
412
491
|
|
|
@@ -415,7 +494,8 @@ class Vector extends Layer {
|
|
|
415
494
|
* @public
|
|
416
495
|
* @param {boolean} picking - Picking enable flag.
|
|
417
496
|
*/
|
|
418
|
-
set pickingEnabled(picking) {
|
|
497
|
+
public override set pickingEnabled(picking: boolean) {
|
|
498
|
+
|
|
419
499
|
this._pickingEnabled = picking;
|
|
420
500
|
|
|
421
501
|
this._stripEntityCollection.setPickingEnabled(picking);
|
|
@@ -424,29 +504,26 @@ class Vector extends Layer {
|
|
|
424
504
|
|
|
425
505
|
this._geoObjectEntityCollection.setPickingEnabled(picking);
|
|
426
506
|
|
|
427
|
-
this._entityCollectionsTree &&
|
|
428
|
-
|
|
429
|
-
node.entityCollection.setPickingEnabled(picking);
|
|
507
|
+
this._entityCollectionsTree && this._entityCollectionsTree.traverseTree((node: EntityCollectionNode) => {
|
|
508
|
+
node.entityCollection!.setPickingEnabled(picking);
|
|
430
509
|
});
|
|
431
510
|
|
|
432
|
-
this._entityCollectionsTreeNorth &&
|
|
433
|
-
|
|
434
|
-
node.entityCollection.setPickingEnabled(picking);
|
|
511
|
+
this._entityCollectionsTreeNorth && this._entityCollectionsTreeNorth.traverseTree((node: EntityCollectionNodeWGS84) => {
|
|
512
|
+
node.entityCollection!.setPickingEnabled(picking);
|
|
435
513
|
});
|
|
436
514
|
|
|
437
|
-
this._entityCollectionsTreeSouth &&
|
|
438
|
-
|
|
439
|
-
node.entityCollection.setPickingEnabled(picking);
|
|
515
|
+
this._entityCollectionsTreeSouth && this._entityCollectionsTreeSouth.traverseTree((node: EntityCollectionNodeWGS84) => {
|
|
516
|
+
node.entityCollection!.setPickingEnabled(picking);
|
|
440
517
|
});
|
|
441
518
|
}
|
|
442
519
|
|
|
443
520
|
/**
|
|
444
|
-
* Refresh collected entities indexes from startIndex
|
|
445
|
-
* @
|
|
521
|
+
* Refresh collected entities indexes from startIndex entities collection array position.
|
|
522
|
+
* @protected
|
|
446
523
|
* @param {number} startIndex - Entity array index.
|
|
447
524
|
*/
|
|
448
|
-
_reindexEntitiesArray(startIndex) {
|
|
449
|
-
|
|
525
|
+
protected _reindexEntitiesArray(startIndex: number) {
|
|
526
|
+
const e = this._entities;
|
|
450
527
|
for (let i = startIndex; i < e.length; i++) {
|
|
451
528
|
e[i]._layerIndex = i;
|
|
452
529
|
}
|
|
@@ -456,37 +533,28 @@ class Vector extends Layer {
|
|
|
456
533
|
* Removes entities from layer.
|
|
457
534
|
* @public
|
|
458
535
|
* @param {Array.<Entity>} entities - Entity array.
|
|
459
|
-
* @returns {
|
|
536
|
+
* @returns {Vector} - Returns this layer.
|
|
460
537
|
*/
|
|
461
|
-
removeEntities(entities) {
|
|
462
|
-
|
|
538
|
+
public removeEntities(entities: Entity[]): this {
|
|
539
|
+
let i = entities.length;
|
|
463
540
|
while (i--) {
|
|
464
541
|
this.removeEntity(entities[i]);
|
|
465
542
|
}
|
|
466
543
|
return this;
|
|
467
544
|
}
|
|
468
545
|
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
* @param {number} [farInvisible] - Entity visibility distance.
|
|
475
|
-
* @returns {layer.Vector} -
|
|
476
|
-
*/
|
|
477
|
-
setScaleByDistance(near, far, farInvisible) {
|
|
478
|
-
this.scaleByDistance[0] = near;
|
|
479
|
-
this.scaleByDistance[1] = far;
|
|
480
|
-
this.scaleByDistance[2] = farInvisible || math.MAX32;
|
|
481
|
-
return this;
|
|
482
|
-
}
|
|
546
|
+
// public setScaleByDistance(near, far, farInvisible) {
|
|
547
|
+
// this.scaleByDistance[0] = near;
|
|
548
|
+
// this.scaleByDistance[1] = far;
|
|
549
|
+
// this.scaleByDistance[2] = farInvisible || math.MAX32;
|
|
550
|
+
// }
|
|
483
551
|
|
|
484
552
|
/**
|
|
485
553
|
* TODO: Clear the layer.
|
|
486
554
|
* @public
|
|
487
555
|
*/
|
|
488
|
-
clear() {
|
|
489
|
-
let temp = new Array(this._entities.length);
|
|
556
|
+
public override clear() {
|
|
557
|
+
let temp: Entity[] = new Array(this._entities.length);
|
|
490
558
|
|
|
491
559
|
for (let i = 0; i < temp.length; i++) {
|
|
492
560
|
temp[i] = this._entities[i];
|
|
@@ -511,11 +579,11 @@ class Vector extends Layer {
|
|
|
511
579
|
/**
|
|
512
580
|
* Safety entities loop.
|
|
513
581
|
* @public
|
|
514
|
-
* @param {
|
|
582
|
+
* @param {(entity: Entity, index?: number) => void} callback - Entity callback.
|
|
515
583
|
*/
|
|
516
|
-
each(callback) {
|
|
517
|
-
|
|
518
|
-
|
|
584
|
+
public each(callback: (entity: Entity, index?: number) => void) {
|
|
585
|
+
let e = this._entities;
|
|
586
|
+
let i = e.length;
|
|
519
587
|
while (i--) {
|
|
520
588
|
callback(e[i], i);
|
|
521
589
|
}
|
|
@@ -525,18 +593,18 @@ class Vector extends Layer {
|
|
|
525
593
|
* Removes current entities from layer and adds new entities.
|
|
526
594
|
* @public
|
|
527
595
|
* @param {Array.<Entity>} entities - New entity array.
|
|
528
|
-
* @returns {
|
|
596
|
+
* @returns {Vector} - Returns layer instance.
|
|
529
597
|
*/
|
|
530
|
-
setEntities(entities) {
|
|
531
|
-
|
|
598
|
+
public setEntities(entities: Entity[]): this {
|
|
599
|
+
|
|
600
|
+
let temp: Entity[] = new Array(entities.length);
|
|
601
|
+
|
|
532
602
|
for (let i = 0, len = entities.length; i < len; i++) {
|
|
533
603
|
temp[i] = entities[i];
|
|
534
604
|
}
|
|
535
605
|
|
|
536
606
|
this.clear();
|
|
537
607
|
|
|
538
|
-
//var e = this._extent;
|
|
539
|
-
|
|
540
608
|
this._entities = new Array(temp.length);
|
|
541
609
|
|
|
542
610
|
let entitiesForTree = [];
|
|
@@ -560,18 +628,12 @@ class Vector extends Layer {
|
|
|
560
628
|
if (ei.geometry) {
|
|
561
629
|
this._hasImageryTiles = true;
|
|
562
630
|
if (this._planet) {
|
|
563
|
-
this._planet.renderer
|
|
631
|
+
this._planet.renderer!.assignPickingColor<Entity>(ei);
|
|
564
632
|
this._geometryHandler.add(ei.geometry);
|
|
565
633
|
}
|
|
566
634
|
}
|
|
567
635
|
|
|
568
636
|
this._entities[i] = ei;
|
|
569
|
-
|
|
570
|
-
//var ext = ei.getExtent();
|
|
571
|
-
//if (ext.northEast.lon > e.northEast.lon) e.northEast.lon = ext.northEast.lon;
|
|
572
|
-
//if (ext.northEast.lat > e.northEast.lat) e.northEast.lat = ext.northEast.lat;
|
|
573
|
-
//if (ext.southWest.lon < e.southWest.lon) e.southWest.lon = ext.southWest.lon;
|
|
574
|
-
//if (ext.southWest.lat < e.southWest.lat) e.southWest.lat = ext.southWest.lat;
|
|
575
637
|
}
|
|
576
638
|
|
|
577
639
|
this._createEntityCollectionsTree(entitiesForTree);
|
|
@@ -579,8 +641,13 @@ class Vector extends Layer {
|
|
|
579
641
|
return this;
|
|
580
642
|
}
|
|
581
643
|
|
|
582
|
-
|
|
644
|
+
/**
|
|
645
|
+
* @todo: replace to a strategy node collecting algorithm
|
|
646
|
+
*/
|
|
647
|
+
protected _createEntityCollectionsTree(entitiesForTree: Entity[]) {
|
|
648
|
+
|
|
583
649
|
if (this._planet) {
|
|
650
|
+
|
|
584
651
|
this._entityCollectionsTree = new EntityCollectionNode(
|
|
585
652
|
this,
|
|
586
653
|
quadTree.NW,
|
|
@@ -590,6 +657,7 @@ class Vector extends Layer {
|
|
|
590
657
|
this._planet,
|
|
591
658
|
0
|
|
592
659
|
);
|
|
660
|
+
|
|
593
661
|
this._entityCollectionsTreeNorth = new EntityCollectionNodeWGS84(
|
|
594
662
|
this,
|
|
595
663
|
quadTree.NW,
|
|
@@ -599,6 +667,7 @@ class Vector extends Layer {
|
|
|
599
667
|
this._planet,
|
|
600
668
|
0
|
|
601
669
|
);
|
|
670
|
+
|
|
602
671
|
this._entityCollectionsTreeSouth = new EntityCollectionNodeWGS84(
|
|
603
672
|
this,
|
|
604
673
|
quadTree.NW,
|
|
@@ -628,90 +697,99 @@ class Vector extends Layer {
|
|
|
628
697
|
}
|
|
629
698
|
}
|
|
630
699
|
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
700
|
+
/**
|
|
701
|
+
* @todo (refactoring) could be used in somethig like bindEntityCollectionQuad(...)
|
|
702
|
+
* @param entityCollection
|
|
703
|
+
*/
|
|
704
|
+
public _bindEventsDefault(entityCollection: EntityCollection) {
|
|
705
|
+
|
|
706
|
+
let ve = this.events;
|
|
707
|
+
|
|
708
|
+
//
|
|
709
|
+
// @todo: replace with arrow functions and '...e'
|
|
710
|
+
//
|
|
711
|
+
entityCollection.events.on("entitymove", function (e: any) {
|
|
634
712
|
ve.dispatch(ve.entitymove, e);
|
|
635
713
|
});
|
|
636
|
-
entityCollection.events.on("mousemove", function (e) {
|
|
714
|
+
entityCollection.events.on("mousemove", function (e: any) {
|
|
637
715
|
ve.dispatch(ve.mousemove, e);
|
|
638
716
|
});
|
|
639
|
-
entityCollection.events.on("mouseenter", function (e) {
|
|
717
|
+
entityCollection.events.on("mouseenter", function (e: any) {
|
|
640
718
|
ve.dispatch(ve.mouseenter, e);
|
|
641
719
|
});
|
|
642
|
-
entityCollection.events.on("mouseleave", function (e) {
|
|
720
|
+
entityCollection.events.on("mouseleave", function (e: any) {
|
|
643
721
|
ve.dispatch(ve.mouseleave, e);
|
|
644
722
|
});
|
|
645
|
-
entityCollection.events.on("lclick", function (e) {
|
|
723
|
+
entityCollection.events.on("lclick", function (e: any) {
|
|
646
724
|
ve.dispatch(ve.lclick, e);
|
|
647
725
|
});
|
|
648
|
-
entityCollection.events.on("rclick", function (e) {
|
|
726
|
+
entityCollection.events.on("rclick", function (e: any) {
|
|
649
727
|
ve.dispatch(ve.rclick, e);
|
|
650
728
|
});
|
|
651
|
-
entityCollection.events.on("mclick", function (e) {
|
|
729
|
+
entityCollection.events.on("mclick", function (e: any) {
|
|
652
730
|
ve.dispatch(ve.mclick, e);
|
|
653
731
|
});
|
|
654
|
-
entityCollection.events.on("ldblclick", function (e) {
|
|
732
|
+
entityCollection.events.on("ldblclick", function (e: any) {
|
|
655
733
|
ve.dispatch(ve.ldblclick, e);
|
|
656
734
|
});
|
|
657
|
-
entityCollection.events.on("rdblclick", function (e) {
|
|
735
|
+
entityCollection.events.on("rdblclick", function (e: any) {
|
|
658
736
|
ve.dispatch(ve.rdblclick, e);
|
|
659
737
|
});
|
|
660
|
-
entityCollection.events.on("mdblclick", function (e) {
|
|
738
|
+
entityCollection.events.on("mdblclick", function (e: any) {
|
|
661
739
|
ve.dispatch(ve.mdblclick, e);
|
|
662
740
|
});
|
|
663
|
-
entityCollection.events.on("lup", function (e) {
|
|
741
|
+
entityCollection.events.on("lup", function (e: any) {
|
|
664
742
|
ve.dispatch(ve.lup, e);
|
|
665
743
|
});
|
|
666
|
-
entityCollection.events.on("rup", function (e) {
|
|
744
|
+
entityCollection.events.on("rup", function (e: any) {
|
|
667
745
|
ve.dispatch(ve.rup, e);
|
|
668
746
|
});
|
|
669
|
-
entityCollection.events.on("mup", function (e) {
|
|
747
|
+
entityCollection.events.on("mup", function (e: any) {
|
|
670
748
|
ve.dispatch(ve.mup, e);
|
|
671
749
|
});
|
|
672
|
-
entityCollection.events.on("ldown", function (e) {
|
|
750
|
+
entityCollection.events.on("ldown", function (e: any) {
|
|
673
751
|
ve.dispatch(ve.ldown, e);
|
|
674
752
|
});
|
|
675
|
-
entityCollection.events.on("rdown", function (e) {
|
|
753
|
+
entityCollection.events.on("rdown", function (e: any) {
|
|
676
754
|
ve.dispatch(ve.rdown, e);
|
|
677
755
|
});
|
|
678
|
-
entityCollection.events.on("mdown", function (e) {
|
|
756
|
+
entityCollection.events.on("mdown", function (e: any) {
|
|
679
757
|
ve.dispatch(ve.mdown, e);
|
|
680
758
|
});
|
|
681
|
-
entityCollection.events.on("lhold", function (e) {
|
|
759
|
+
entityCollection.events.on("lhold", function (e: any) {
|
|
682
760
|
ve.dispatch(ve.lhold, e);
|
|
683
761
|
});
|
|
684
|
-
entityCollection.events.on("rhold", function (e) {
|
|
762
|
+
entityCollection.events.on("rhold", function (e: any) {
|
|
685
763
|
ve.dispatch(ve.rhold, e);
|
|
686
764
|
});
|
|
687
|
-
entityCollection.events.on("mhold", function (e) {
|
|
765
|
+
entityCollection.events.on("mhold", function (e: any) {
|
|
688
766
|
ve.dispatch(ve.mhold, e);
|
|
689
767
|
});
|
|
690
|
-
entityCollection.events.on("mousewheel", function (e) {
|
|
768
|
+
entityCollection.events.on("mousewheel", function (e: any) {
|
|
691
769
|
ve.dispatch(ve.mousewheel, e);
|
|
692
770
|
});
|
|
693
|
-
entityCollection.events.on("touchmove", function (e) {
|
|
771
|
+
entityCollection.events.on("touchmove", function (e: any) {
|
|
694
772
|
ve.dispatch(ve.touchmove, e);
|
|
695
773
|
});
|
|
696
|
-
entityCollection.events.on("touchstart", function (e) {
|
|
774
|
+
entityCollection.events.on("touchstart", function (e: any) {
|
|
697
775
|
ve.dispatch(ve.touchstart, e);
|
|
698
776
|
});
|
|
699
|
-
entityCollection.events.on("touchend", function (e) {
|
|
777
|
+
entityCollection.events.on("touchend", function (e: any) {
|
|
700
778
|
ve.dispatch(ve.touchend, e);
|
|
701
779
|
});
|
|
702
|
-
entityCollection.events.on("doubletouch", function (e) {
|
|
780
|
+
entityCollection.events.on("doubletouch", function (e: any) {
|
|
703
781
|
ve.dispatch(ve.doubletouch, e);
|
|
704
782
|
});
|
|
705
|
-
entityCollection.events.on("touchleave", function (e) {
|
|
783
|
+
entityCollection.events.on("touchleave", function (e: any) {
|
|
706
784
|
ve.dispatch(ve.touchleave, e);
|
|
707
785
|
});
|
|
708
|
-
entityCollection.events.on("touchenter", function (e) {
|
|
786
|
+
entityCollection.events.on("touchenter", function (e: any) {
|
|
709
787
|
ve.dispatch(ve.touchenter, e);
|
|
710
788
|
});
|
|
711
789
|
}
|
|
712
790
|
|
|
713
|
-
_collectStripCollectionPASS(outArr) {
|
|
714
|
-
|
|
791
|
+
protected _collectStripCollectionPASS(outArr: EntityCollection[]) {
|
|
792
|
+
let ec = this._stripEntityCollection;
|
|
715
793
|
|
|
716
794
|
ec._fadingOpacity = this._fadingOpacity;
|
|
717
795
|
ec.scaleByDistance = this.scaleByDistance;
|
|
@@ -719,12 +797,9 @@ class Vector extends Layer {
|
|
|
719
797
|
ec.polygonOffsetUnits = this.polygonOffsetUnits;
|
|
720
798
|
|
|
721
799
|
outArr.push(ec);
|
|
722
|
-
//
|
|
723
|
-
// ...TODO: extent
|
|
724
|
-
//
|
|
725
800
|
}
|
|
726
801
|
|
|
727
|
-
_collectPolylineCollectionPASS(outArr) {
|
|
802
|
+
protected _collectPolylineCollectionPASS(outArr: EntityCollection[]) {
|
|
728
803
|
let ec = this._polylineEntityCollection;
|
|
729
804
|
|
|
730
805
|
ec._fadingOpacity = this._fadingOpacity;
|
|
@@ -737,32 +812,32 @@ class Vector extends Layer {
|
|
|
737
812
|
if (this.clampToGround || this.relativeToGround) {
|
|
738
813
|
let rtg = Number(this.relativeToGround);
|
|
739
814
|
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
815
|
+
const nodes = this._planet!._renderedNodes;
|
|
816
|
+
const visibleExtent = this._planet!.getViewExtent();
|
|
817
|
+
let e = ec._entities;
|
|
818
|
+
let e_i = e.length;
|
|
744
819
|
let res = new Vec3();
|
|
745
820
|
|
|
746
821
|
while (e_i--) {
|
|
747
|
-
|
|
748
|
-
if (visibleExtent.overlaps(p._extent)) {
|
|
822
|
+
let p = e[e_i].polyline!;
|
|
823
|
+
if (p && visibleExtent.overlaps(p._extent)) {
|
|
749
824
|
// TODO:this works only for mercator area.
|
|
750
825
|
// needs to be working on poles.
|
|
751
826
|
let coords = p._pathLonLatMerc,
|
|
752
827
|
c_j = coords.length;
|
|
753
828
|
while (c_j--) {
|
|
754
|
-
|
|
829
|
+
let c_j_h = coords[c_j].length;
|
|
755
830
|
while (c_j_h--) {
|
|
756
831
|
let ll = coords[c_j][c_j_h],
|
|
757
832
|
n_k = nodes.length;
|
|
758
833
|
while (n_k--) {
|
|
759
|
-
|
|
834
|
+
let seg = nodes[n_k].segment;
|
|
760
835
|
if (seg._extent.isInside(ll)) {
|
|
761
|
-
let cart = p._path3v[c_j][c_j_h];
|
|
836
|
+
let cart = p._path3v[c_j][c_j_h] as Vec3;
|
|
762
837
|
seg.getTerrainPoint(cart, ll, res);
|
|
763
838
|
let alt = (rtg && p.altitude) || 0.0;
|
|
764
839
|
if (alt) {
|
|
765
|
-
let n = this._planet
|
|
840
|
+
let n = this._planet!.ellipsoid.getSurfaceNormal3v(res);
|
|
766
841
|
p.setPoint3v(res.addA(n.scale(alt)), c_j_h, c_j, true);
|
|
767
842
|
} else {
|
|
768
843
|
p.setPoint3v(res, c_j_h, c_j, true);
|
|
@@ -777,7 +852,7 @@ class Vector extends Layer {
|
|
|
777
852
|
}
|
|
778
853
|
}
|
|
779
854
|
|
|
780
|
-
_collectGeoObjectCollectionPASS(outArr) {
|
|
855
|
+
protected _collectGeoObjectCollectionPASS(outArr: EntityCollection[]) {
|
|
781
856
|
let ec = this._geoObjectEntityCollection;
|
|
782
857
|
|
|
783
858
|
ec._fadingOpacity = this._fadingOpacity;
|
|
@@ -829,12 +904,12 @@ class Vector extends Layer {
|
|
|
829
904
|
// }
|
|
830
905
|
}
|
|
831
906
|
|
|
832
|
-
collectVisibleCollections(outArr) {
|
|
833
|
-
|
|
907
|
+
public collectVisibleCollections(outArr: EntityCollection[]) {
|
|
908
|
+
let p = this._planet!;
|
|
834
909
|
|
|
835
910
|
if (
|
|
836
911
|
(this._fading && this._fadingOpacity > 0.0) ||
|
|
837
|
-
(this.minZoom <=
|
|
912
|
+
(this.minZoom <= p.maxCurrZoom && this.maxZoom >= p.maxCurrZoom)
|
|
838
913
|
) {
|
|
839
914
|
this._renderingNodes = {};
|
|
840
915
|
this._renderingNodesNorth = {};
|
|
@@ -847,52 +922,31 @@ class Vector extends Layer {
|
|
|
847
922
|
|
|
848
923
|
// Merc nodes
|
|
849
924
|
this._secondPASS = [];
|
|
850
|
-
this._entityCollectionsTree &&
|
|
851
|
-
this.
|
|
852
|
-
var i = this._secondPASS.length;
|
|
925
|
+
this._entityCollectionsTree && this._entityCollectionsTree.collectRenderCollectionsPASS1(p._visibleNodes, outArr);
|
|
926
|
+
let i = this._secondPASS.length;
|
|
853
927
|
while (i--) {
|
|
854
|
-
this._secondPASS[i].collectRenderCollectionsPASS2(
|
|
855
|
-
p._visibleNodes,
|
|
856
|
-
outArr,
|
|
857
|
-
this._secondPASS[i].nodeId
|
|
858
|
-
);
|
|
928
|
+
this._secondPASS[i].collectRenderCollectionsPASS2(p._visibleNodes, outArr, this._secondPASS[i].nodeId);
|
|
859
929
|
}
|
|
860
930
|
|
|
861
931
|
// North nodes
|
|
862
932
|
this._secondPASS = [];
|
|
863
|
-
this._entityCollectionsTreeNorth &&
|
|
864
|
-
this._entityCollectionsTreeNorth.collectRenderCollectionsPASS1(
|
|
865
|
-
p._visibleNodesNorth,
|
|
866
|
-
outArr
|
|
867
|
-
);
|
|
933
|
+
this._entityCollectionsTreeNorth && this._entityCollectionsTreeNorth.collectRenderCollectionsPASS1(p._visibleNodesNorth, outArr);
|
|
868
934
|
i = this._secondPASS.length;
|
|
869
935
|
while (i--) {
|
|
870
|
-
this._secondPASS[i].collectRenderCollectionsPASS2(
|
|
871
|
-
p._visibleNodesNorth,
|
|
872
|
-
outArr,
|
|
873
|
-
this._secondPASS[i].nodeId
|
|
874
|
-
);
|
|
936
|
+
this._secondPASS[i].collectRenderCollectionsPASS2(p._visibleNodesNorth, outArr, this._secondPASS[i].nodeId);
|
|
875
937
|
}
|
|
876
938
|
|
|
877
939
|
// South nodes
|
|
878
940
|
this._secondPASS = [];
|
|
879
|
-
this._entityCollectionsTreeSouth &&
|
|
880
|
-
this._entityCollectionsTreeSouth.collectRenderCollectionsPASS1(
|
|
881
|
-
p._visibleNodesSouth,
|
|
882
|
-
outArr
|
|
883
|
-
);
|
|
941
|
+
this._entityCollectionsTreeSouth && this._entityCollectionsTreeSouth.collectRenderCollectionsPASS1(p._visibleNodesSouth, outArr);
|
|
884
942
|
i = this._secondPASS.length;
|
|
885
943
|
while (i--) {
|
|
886
|
-
this._secondPASS[i].collectRenderCollectionsPASS2(
|
|
887
|
-
p._visibleNodesSouth,
|
|
888
|
-
outArr,
|
|
889
|
-
this._secondPASS[i].nodeId
|
|
890
|
-
);
|
|
944
|
+
this._secondPASS[i].collectRenderCollectionsPASS2(p._visibleNodesSouth, outArr, this._secondPASS[i].nodeId);
|
|
891
945
|
}
|
|
892
946
|
}
|
|
893
947
|
}
|
|
894
948
|
|
|
895
|
-
_queueDeferredNode(node) {
|
|
949
|
+
public _queueDeferredNode(node: EntityCollectionNode) {
|
|
896
950
|
if (this._visibility) {
|
|
897
951
|
node._inTheQueue = true;
|
|
898
952
|
if (this._counter >= 1) {
|
|
@@ -903,18 +957,17 @@ class Vector extends Layer {
|
|
|
903
957
|
}
|
|
904
958
|
}
|
|
905
959
|
|
|
906
|
-
_execDeferredNode(node) {
|
|
960
|
+
protected _execDeferredNode(node: EntityCollectionNode) {
|
|
907
961
|
this._counter++;
|
|
908
|
-
|
|
909
|
-
setTimeout(function () {
|
|
962
|
+
setTimeout(() => {
|
|
910
963
|
node.applyCollection();
|
|
911
|
-
|
|
912
|
-
if (
|
|
913
|
-
while (
|
|
914
|
-
|
|
964
|
+
this._counter--;
|
|
965
|
+
if (this._deferredEntitiesPendingQueue.length && this._counter < 1) {
|
|
966
|
+
while (this._deferredEntitiesPendingQueue.length) {
|
|
967
|
+
let n = this._deferredEntitiesPendingQueue.pop()!;
|
|
915
968
|
n._inTheQueue = false;
|
|
916
969
|
if (n.isVisible()) {
|
|
917
|
-
|
|
970
|
+
this._execDeferredNode(n);
|
|
918
971
|
return;
|
|
919
972
|
}
|
|
920
973
|
}
|
|
@@ -926,48 +979,47 @@ class Vector extends Layer {
|
|
|
926
979
|
* Start to load tile material.
|
|
927
980
|
* @public
|
|
928
981
|
* @virtual
|
|
929
|
-
* @param {
|
|
982
|
+
* @param {Material} material - Current material.
|
|
930
983
|
*/
|
|
931
|
-
loadMaterial(material) {
|
|
932
|
-
|
|
984
|
+
public override loadMaterial(material: Material) {
|
|
985
|
+
const seg = material.segment;
|
|
933
986
|
|
|
934
987
|
if (this._isBaseLayer) {
|
|
935
|
-
material.texture = seg._isNorth
|
|
936
|
-
? seg.planet.solidTextureOne
|
|
937
|
-
: seg.planet.solidTextureTwo;
|
|
988
|
+
material.texture = seg._isNorth ? seg.planet.solidTextureOne : seg.planet.solidTextureTwo;
|
|
938
989
|
} else {
|
|
939
990
|
material.texture = seg.planet.transparentTexture;
|
|
940
991
|
}
|
|
941
992
|
|
|
942
|
-
if (this._planet
|
|
993
|
+
if (this._planet!.layerLock.isFree()) {
|
|
943
994
|
material.isReady = false;
|
|
944
995
|
material.isLoading = true;
|
|
945
|
-
this._planet
|
|
996
|
+
this._planet!._vectorTileCreator.add(material);
|
|
946
997
|
}
|
|
947
998
|
}
|
|
948
999
|
|
|
949
1000
|
/**
|
|
950
1001
|
* Abort exact material loading.
|
|
951
1002
|
* @public
|
|
1003
|
+
* @override
|
|
952
1004
|
* @param {Material} material - Segment material.
|
|
953
1005
|
*/
|
|
954
|
-
abortMaterialLoading(material) {
|
|
1006
|
+
public override abortMaterialLoading(material: Material) {
|
|
955
1007
|
material.isLoading = false;
|
|
956
1008
|
material.isReady = false;
|
|
957
1009
|
}
|
|
958
1010
|
|
|
959
|
-
applyMaterial(material) {
|
|
1011
|
+
public override applyMaterial(material: Material, isForced: boolean = false): NumberArray4 {
|
|
960
1012
|
if (material.isReady) {
|
|
961
1013
|
return [0, 0, 1, 1];
|
|
962
1014
|
} else {
|
|
963
1015
|
!material.isLoading && this.loadMaterial(material);
|
|
964
1016
|
|
|
965
|
-
|
|
966
|
-
|
|
1017
|
+
const segment = material.segment;
|
|
1018
|
+
let pn = segment.node,
|
|
967
1019
|
notEmpty = false;
|
|
968
1020
|
|
|
969
|
-
|
|
970
|
-
|
|
1021
|
+
let mId = this.__id;
|
|
1022
|
+
let psegm = material;
|
|
971
1023
|
|
|
972
1024
|
while (pn.parentNode) {
|
|
973
1025
|
if (psegm && psegm.isReady) {
|
|
@@ -982,7 +1034,7 @@ class Vector extends Layer {
|
|
|
982
1034
|
material.appliedNodeId = pn.nodeId;
|
|
983
1035
|
material.texture = psegm.texture;
|
|
984
1036
|
material.pickingMask = psegm.pickingMask;
|
|
985
|
-
|
|
1037
|
+
const dZ2 = 1.0 / (2 << (segment.tileZoom - pn.segment.tileZoom - 1));
|
|
986
1038
|
return [
|
|
987
1039
|
segment.tileX * dZ2 - pn.segment.tileX,
|
|
988
1040
|
segment.tileY * dZ2 - pn.segment.tileY,
|
|
@@ -1003,14 +1055,14 @@ class Vector extends Layer {
|
|
|
1003
1055
|
}
|
|
1004
1056
|
}
|
|
1005
1057
|
|
|
1006
|
-
clearMaterial(material) {
|
|
1058
|
+
public override clearMaterial(material: Material) {
|
|
1007
1059
|
if (material.isReady) {
|
|
1008
|
-
|
|
1060
|
+
const gl = material.segment.handler.gl!;
|
|
1009
1061
|
|
|
1010
1062
|
material.isReady = false;
|
|
1011
1063
|
material.pickingReady = false;
|
|
1012
1064
|
|
|
1013
|
-
|
|
1065
|
+
let t = material.texture;
|
|
1014
1066
|
material.texture = null;
|
|
1015
1067
|
t && !t.default && gl.deleteTexture(t);
|
|
1016
1068
|
|
|
@@ -1033,36 +1085,36 @@ class Vector extends Layer {
|
|
|
1033
1085
|
material.textureExists = false;
|
|
1034
1086
|
}
|
|
1035
1087
|
|
|
1036
|
-
update() {
|
|
1088
|
+
public update() {
|
|
1037
1089
|
this._geometryHandler.update();
|
|
1038
1090
|
this.events.dispatch(this.events.draw, this);
|
|
1039
1091
|
}
|
|
1040
1092
|
}
|
|
1041
1093
|
|
|
1042
|
-
const
|
|
1094
|
+
const VECTOR_EVENTS: VectorEventsList = [
|
|
1043
1095
|
/**
|
|
1044
1096
|
* Triggered when entity has moved.
|
|
1045
|
-
* @event
|
|
1097
|
+
* @event EventsHandler<VectorEventsList>#draw
|
|
1046
1098
|
*/
|
|
1047
1099
|
"entitymove",
|
|
1048
1100
|
|
|
1049
1101
|
/**
|
|
1050
1102
|
* Triggered when layer begin draw.
|
|
1051
|
-
* @event
|
|
1103
|
+
* @event EventsHandler<VectorEventsList>#draw
|
|
1052
1104
|
*/
|
|
1053
1105
|
"draw",
|
|
1054
1106
|
|
|
1055
1107
|
/**
|
|
1056
1108
|
* Triggered when new entity added to the layer.
|
|
1057
|
-
* @event
|
|
1109
|
+
* @event EventsHandler<VectorEventsList>#entityadd
|
|
1058
1110
|
*/
|
|
1059
1111
|
"entityadd",
|
|
1060
1112
|
|
|
1061
1113
|
/**
|
|
1062
1114
|
* Triggered when entity removes from the collection.
|
|
1063
|
-
* @event
|
|
1115
|
+
* @event EventsHandler<VectorEventsList>#entityremove
|
|
1064
1116
|
*/
|
|
1065
1117
|
"entityremove"
|
|
1066
1118
|
];
|
|
1067
1119
|
|
|
1068
|
-
export {
|
|
1120
|
+
export {Vector};
|