@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,14 +1,18 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
1
|
+
import {Entity} from "./Entity";
|
|
2
|
+
import {Extent} from "../Extent";
|
|
3
|
+
import {LonLat} from "../LonLat";
|
|
4
|
+
import {NumberArray3, Vec3} from "../math/Vec3";
|
|
5
|
+
import {NumberArray2} from "../math/Vec2";
|
|
6
|
+
import {NumberArray4} from "../math/Vec4";
|
|
7
|
+
import {Planet} from "../scene/Planet";
|
|
8
|
+
import {PolylineHandler} from "./PolylineHandler";
|
|
9
|
+
import {RenderNode} from "../scene/RenderNode";
|
|
10
|
+
import {WebGLBufferExt} from "../webgl/Handler";
|
|
6
11
|
import {
|
|
7
12
|
cloneArray, htmlColorToFloat32Array,
|
|
8
|
-
htmlColorToRgba, makeArray, makeArrayTyped
|
|
9
|
-
} from "../utils/shared
|
|
10
|
-
|
|
11
|
-
window.POLYLINE_DEPTH_OFFSET = 0.0;
|
|
13
|
+
htmlColorToRgba, makeArray, makeArrayTyped, TypedArray
|
|
14
|
+
} from "../utils/shared";
|
|
15
|
+
import {Ellipsoid} from "../ellipsoid/Ellipsoid";
|
|
12
16
|
|
|
13
17
|
const VERTICES_BUFFER = 0;
|
|
14
18
|
const INDEX_BUFFER = 1;
|
|
@@ -21,6 +25,30 @@ const G = 1;
|
|
|
21
25
|
const B = 2;
|
|
22
26
|
const A = 3;
|
|
23
27
|
|
|
28
|
+
type Geodetic = LonLat | NumberArray2 | NumberArray3
|
|
29
|
+
type Cartesian = Vec3 | NumberArray3;
|
|
30
|
+
|
|
31
|
+
type SegmentPath3vExt = Cartesian[];
|
|
32
|
+
type SegmentPathLonLatExt = Geodetic[];
|
|
33
|
+
|
|
34
|
+
type SegmentPathColor = NumberArray4[];
|
|
35
|
+
|
|
36
|
+
type SegmentPath3v = Vec3[];
|
|
37
|
+
type SegmentPathLonLat = LonLat[];
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
export interface IPolylineParams {
|
|
41
|
+
altitude?: number;
|
|
42
|
+
thickness?: number;
|
|
43
|
+
opacity?: number;
|
|
44
|
+
color?: string;
|
|
45
|
+
visibility?: boolean;
|
|
46
|
+
isClosed?: boolean;
|
|
47
|
+
pathColors?: SegmentPathColor[];
|
|
48
|
+
path3v?: SegmentPath3vExt[];
|
|
49
|
+
pathLonLat?: SegmentPathLonLatExt[];
|
|
50
|
+
}
|
|
51
|
+
|
|
24
52
|
/**
|
|
25
53
|
* Polyline object.
|
|
26
54
|
* @class
|
|
@@ -30,88 +58,146 @@ const A = 3;
|
|
|
30
58
|
* @param {Vec4} [options.color] - RGBA color.
|
|
31
59
|
* @param {Boolean} [options.opacity] - Line opacity.
|
|
32
60
|
* @param {Boolean} [options.visibility] - Polyline visibility. True default.
|
|
33
|
-
* @param {Boolean} [options.isClosed] - Closed geometry type
|
|
34
|
-
* @param {
|
|
35
|
-
* @param {
|
|
36
|
-
* @param {
|
|
61
|
+
* @param {Boolean} [options.isClosed] - Closed geometry type identification.
|
|
62
|
+
* @param {SegmentPathLonLatExt[]} [options.pathLonLat] - Polyline geodetic coordinates array. [[[0,0,0], [1,1,1],...]]
|
|
63
|
+
* @param {SegmentPath3vExt[]} [options.path3v] - LinesString cartesian coordinates array. [[[0,0,0], [1,1,1],...]]
|
|
64
|
+
* @param {SegmentPathColor[]} [options.pathColors] - Coordinates color. [[[1,0,0,1], [0,1,0,1],...]] for right and green colors.
|
|
37
65
|
*/
|
|
38
66
|
class Polyline {
|
|
39
|
-
|
|
40
|
-
|
|
67
|
+
static __counter__: number = 0;
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* Object uniq identifier.
|
|
71
|
+
* @protected
|
|
72
|
+
* @type {number}
|
|
73
|
+
*/
|
|
74
|
+
protected __id: number;
|
|
75
|
+
|
|
76
|
+
public altitude: number;
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* Polyline thickness in screen pixels.
|
|
80
|
+
* @public
|
|
81
|
+
* @type {number}
|
|
82
|
+
*/
|
|
83
|
+
public thickness: number;
|
|
84
|
+
|
|
85
|
+
protected _opacity: number;
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* Polyline RGBA color.
|
|
89
|
+
* @protected
|
|
90
|
+
* @type {Float32Array} - (exactly 4 entries)
|
|
91
|
+
*/
|
|
92
|
+
protected _defaultColor: Float32Array | NumberArray4;
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* Polyline visibility.
|
|
96
|
+
* @public
|
|
97
|
+
* @type {boolean}
|
|
98
|
+
*/
|
|
99
|
+
public visibility: boolean;
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* Polyline geometry ring type identification.
|
|
103
|
+
* @protected
|
|
104
|
+
* @type {Boolean}
|
|
105
|
+
*/
|
|
106
|
+
protected _closedLine: boolean;
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* Polyline cartesian coordinates.
|
|
110
|
+
* @public
|
|
111
|
+
* @type {Array.<Vec3>}
|
|
112
|
+
*/
|
|
113
|
+
public _path3v: SegmentPath3vExt[];
|
|
114
|
+
|
|
115
|
+
protected _pathLengths: number[];
|
|
116
|
+
|
|
117
|
+
/**
|
|
118
|
+
* Polyline geodetic degrees coordinates.
|
|
119
|
+
* @private
|
|
120
|
+
* @type {Array.<LonLat>}
|
|
121
|
+
*/
|
|
122
|
+
protected _pathLonLat: SegmentPathLonLatExt[];
|
|
123
|
+
|
|
124
|
+
/**
|
|
125
|
+
* Polyline geodetic mercator coordinates.
|
|
126
|
+
* @public
|
|
127
|
+
* @type {Array.<LonLat>}
|
|
128
|
+
*/
|
|
129
|
+
public _pathLonLatMerc: LonLat[][];
|
|
130
|
+
|
|
131
|
+
protected _pathColors: SegmentPathColor[];
|
|
132
|
+
|
|
133
|
+
/**
|
|
134
|
+
* Polyline geodetic extent.
|
|
135
|
+
* @protected
|
|
136
|
+
* @type {Extent}
|
|
137
|
+
*/
|
|
138
|
+
public _extent: Extent;
|
|
139
|
+
protected _verticesHigh: TypedArray | number[];
|
|
140
|
+
protected _verticesLow: TypedArray | number[];
|
|
141
|
+
protected _orders: TypedArray | number[];
|
|
142
|
+
protected _indexes: TypedArray | number[];
|
|
143
|
+
protected _colors: TypedArray | number[];
|
|
144
|
+
|
|
145
|
+
protected _verticesHighBuffer: WebGLBufferExt | null;
|
|
146
|
+
protected _verticesLowBuffer: WebGLBufferExt | null;
|
|
147
|
+
protected _ordersBuffer: WebGLBufferExt | null;
|
|
148
|
+
protected _indexesBuffer: WebGLBufferExt | null;
|
|
149
|
+
protected _colorsBuffer: WebGLBufferExt | null;
|
|
150
|
+
|
|
151
|
+
protected _pickingColor: NumberArray3;
|
|
152
|
+
|
|
153
|
+
protected _renderNode: RenderNode | null;
|
|
154
|
+
|
|
155
|
+
/**
|
|
156
|
+
* Entity instance that holds this Polyline.
|
|
157
|
+
* @public
|
|
158
|
+
* @type {Entity}
|
|
159
|
+
*/
|
|
160
|
+
public _entity: Entity | null;
|
|
161
|
+
|
|
162
|
+
/**
|
|
163
|
+
* Handler that stores and renders this Polyline object.
|
|
164
|
+
* @public
|
|
165
|
+
* @type {PolylineHandler | null}
|
|
166
|
+
*/
|
|
167
|
+
public _handler: PolylineHandler | null;
|
|
168
|
+
public _handlerIndex: number;
|
|
169
|
+
protected _buffersUpdateCallbacks: Function[];
|
|
170
|
+
protected _changedBuffers: boolean[];
|
|
41
171
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
* @readonly
|
|
46
|
-
* @type {number}
|
|
47
|
-
*/
|
|
48
|
-
this.id = Polyline._staticCounter++;
|
|
172
|
+
constructor(options: IPolylineParams = {}) {
|
|
173
|
+
|
|
174
|
+
this.__id = Polyline.__counter__++;
|
|
49
175
|
|
|
50
176
|
this.altitude = options.altitude || 0.0;
|
|
51
177
|
|
|
52
|
-
/**
|
|
53
|
-
* Polyline thickness in screen pixels.
|
|
54
|
-
* @public
|
|
55
|
-
* @type {number}
|
|
56
|
-
*/
|
|
57
178
|
this.thickness = options.thickness || 1.5;
|
|
58
179
|
|
|
59
180
|
this._opacity = options.opacity != undefined ? options.opacity : 1.0;
|
|
60
181
|
|
|
61
|
-
/**
|
|
62
|
-
* Polyline RGBA color.
|
|
63
|
-
* @public
|
|
64
|
-
* @type {Array<number>} - (exactly 4 entries)
|
|
65
|
-
*/
|
|
66
182
|
this._defaultColor = htmlColorToFloat32Array(
|
|
67
183
|
options.color || DEFAULT_COLOR,
|
|
68
184
|
options.opacity
|
|
69
|
-
);
|
|
185
|
+
);
|
|
70
186
|
|
|
71
|
-
/**
|
|
72
|
-
* Polyline visibility.
|
|
73
|
-
* @public
|
|
74
|
-
* @type {boolean}
|
|
75
|
-
*/
|
|
76
187
|
this.visibility = options.visibility != undefined ? options.visibility : true;
|
|
77
188
|
|
|
78
|
-
/**
|
|
79
|
-
* Polyline geometry ring type identificator.
|
|
80
|
-
* @protected
|
|
81
|
-
* @type {Boolean}
|
|
82
|
-
*/
|
|
83
189
|
this._closedLine = options.isClosed || false;
|
|
84
190
|
|
|
85
|
-
/**
|
|
86
|
-
* Polyline cartesian coordinates.
|
|
87
|
-
* @private
|
|
88
|
-
* @type {Array.<Vec3>}
|
|
89
|
-
*/
|
|
90
191
|
this._path3v = [];
|
|
91
192
|
|
|
92
193
|
this._pathLengths = [];
|
|
93
194
|
|
|
94
|
-
/**
|
|
95
|
-
* Polyline geodetic degrees coordinates.
|
|
96
|
-
* @private
|
|
97
|
-
* @type {Array.<LonLat>}
|
|
98
|
-
*/
|
|
99
195
|
this._pathLonLat = [];
|
|
100
196
|
|
|
101
|
-
/**
|
|
102
|
-
* Polyline geodetic mercator coordinates.
|
|
103
|
-
* @private
|
|
104
|
-
* @type {Array.<LonLat>}
|
|
105
|
-
*/
|
|
106
197
|
this._pathLonLatMerc = [];
|
|
107
198
|
|
|
108
199
|
this._pathColors = options.pathColors ? cloneArray(options.pathColors) : [];
|
|
109
200
|
|
|
110
|
-
/**
|
|
111
|
-
* Polyline geodetic extent.
|
|
112
|
-
* @protected
|
|
113
|
-
* @type {Extent}
|
|
114
|
-
*/
|
|
115
201
|
this._extent = new Extent();
|
|
116
202
|
|
|
117
203
|
this._verticesHigh = [];
|
|
@@ -130,18 +216,9 @@ class Polyline {
|
|
|
130
216
|
|
|
131
217
|
this._renderNode = null;
|
|
132
218
|
|
|
133
|
-
/**
|
|
134
|
-
* Entity instance that holds this Polyline.
|
|
135
|
-
* @private
|
|
136
|
-
* @type {Entity}
|
|
137
|
-
*/
|
|
138
219
|
this._entity = null;
|
|
139
220
|
|
|
140
|
-
|
|
141
|
-
* Handler that stores and renders this Polyline object.
|
|
142
|
-
* @private
|
|
143
|
-
* @type {PolylineHandler}
|
|
144
|
-
*/
|
|
221
|
+
|
|
145
222
|
this._handler = null;
|
|
146
223
|
this._handlerIndex = -1;
|
|
147
224
|
|
|
@@ -162,47 +239,25 @@ class Polyline {
|
|
|
162
239
|
this._refresh();
|
|
163
240
|
}
|
|
164
241
|
|
|
165
|
-
static get _staticCounter() {
|
|
166
|
-
if (!this._counter && this._counter !== 0) {
|
|
167
|
-
this._counter = 0;
|
|
168
|
-
}
|
|
169
|
-
return this._counter;
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
static set _staticCounter(n) {
|
|
173
|
-
this._counter = n;
|
|
174
|
-
}
|
|
175
|
-
|
|
176
242
|
/**
|
|
177
243
|
* Appends to the line array new cartesian coordinates line data.
|
|
178
|
-
* @param {Array.<Array.<number>>} path3v - Line coordinates path array. [[0,0,0], [1,1,1],...]
|
|
179
|
-
* @param {Boolean} isClosed - Identificator for the closed line data creation.
|
|
180
|
-
* @param {Number[]} outVertices - Out vertices data array.
|
|
181
|
-
* @param {Number[]} outOrders - Out vertices orders data array.
|
|
182
|
-
* @param {Number[]} outIndexes - Out vertices indexes data array.
|
|
183
|
-
* @param {Ellipsoid} [ellipsoid] - Ellipsoid to coordinates transformation.
|
|
184
|
-
* @param {Array.<Array.<LonLat>>} [outTransformedPathLonLat] - Geodetic coordinates out array.
|
|
185
|
-
* @param {Array.<Array.<LonLat>>} [outPath3v] - Cartesian coordinates out array.
|
|
186
|
-
* @param {Array.<Array.<LonLat>>} [outTransformedPathMerc] - Mercator coordinates out array.
|
|
187
|
-
* @param {Extent} [outExtent] - Geodetic line extent.
|
|
188
|
-
* @param {Array} [outColors]
|
|
189
244
|
* @static
|
|
190
245
|
*/
|
|
191
246
|
static appendLineData3v(
|
|
192
|
-
path3v,
|
|
193
|
-
pathColors,
|
|
194
|
-
defaultColor,
|
|
195
|
-
isClosed,
|
|
196
|
-
outVerticesHigh,
|
|
197
|
-
outVerticesLow,
|
|
198
|
-
outOrders,
|
|
199
|
-
outIndexes,
|
|
200
|
-
ellipsoid,
|
|
201
|
-
outTransformedPathLonLat,
|
|
202
|
-
outPath3v,
|
|
203
|
-
outTransformedPathMerc,
|
|
204
|
-
outExtent,
|
|
205
|
-
outColors
|
|
247
|
+
path3v: SegmentPath3vExt[],
|
|
248
|
+
pathColors: SegmentPathColor[],
|
|
249
|
+
defaultColor: NumberArray4,
|
|
250
|
+
isClosed: boolean,
|
|
251
|
+
outVerticesHigh: number[],
|
|
252
|
+
outVerticesLow: number[],
|
|
253
|
+
outOrders: number[],
|
|
254
|
+
outIndexes: number[],
|
|
255
|
+
ellipsoid: Ellipsoid,
|
|
256
|
+
outTransformedPathLonLat: SegmentPathLonLatExt[],
|
|
257
|
+
outPath3v: SegmentPath3vExt[],
|
|
258
|
+
outTransformedPathMerc: LonLat[][],
|
|
259
|
+
outExtent: Extent,
|
|
260
|
+
outColors: number[]
|
|
206
261
|
) {
|
|
207
262
|
var index = 0;
|
|
208
263
|
|
|
@@ -251,6 +306,10 @@ class Polyline {
|
|
|
251
306
|
if (p1 instanceof Array) {
|
|
252
307
|
p1 = new Vec3(p1[0], p1[1], p1[2]);
|
|
253
308
|
}
|
|
309
|
+
|
|
310
|
+
p0 = p0 as Vec3;
|
|
311
|
+
p1 = p1 as Vec3;
|
|
312
|
+
|
|
254
313
|
last = new Vec3(p0.x + p0.x - p1.x, p0.y + p0.y - p1.y, p0.z + p0.z - p1.z);
|
|
255
314
|
}
|
|
256
315
|
|
|
@@ -260,34 +319,18 @@ class Polyline {
|
|
|
260
319
|
color = pathColors_j[0];
|
|
261
320
|
}
|
|
262
321
|
|
|
263
|
-
Vec3.doubleToTwoFloats(last, v_high, v_low);
|
|
322
|
+
Vec3.doubleToTwoFloats(last as Vec3, v_high, v_low);
|
|
264
323
|
outVerticesHigh.push(
|
|
265
|
-
v_high.x,
|
|
266
|
-
v_high.y,
|
|
267
|
-
v_high.z,
|
|
268
|
-
v_high.x,
|
|
269
|
-
v_high.y,
|
|
270
|
-
v_high.z,
|
|
271
|
-
v_high.x,
|
|
272
|
-
v_high.y,
|
|
273
|
-
v_high.z,
|
|
274
|
-
v_high.x,
|
|
275
|
-
v_high.y,
|
|
276
|
-
v_high.z
|
|
324
|
+
v_high.x, v_high.y, v_high.z,
|
|
325
|
+
v_high.x, v_high.y, v_high.z,
|
|
326
|
+
v_high.x, v_high.y, v_high.z,
|
|
327
|
+
v_high.x, v_high.y, v_high.z
|
|
277
328
|
);
|
|
278
329
|
outVerticesLow.push(
|
|
279
|
-
v_low.x,
|
|
280
|
-
v_low.y,
|
|
281
|
-
v_low.z,
|
|
282
|
-
v_low.x,
|
|
283
|
-
v_low.y,
|
|
284
|
-
v_low.z,
|
|
285
|
-
v_low.x,
|
|
286
|
-
v_low.y,
|
|
287
|
-
v_low.z,
|
|
288
|
-
v_low.x,
|
|
289
|
-
v_low.y,
|
|
290
|
-
v_low.z
|
|
330
|
+
v_low.x, v_low.y, v_low.z,
|
|
331
|
+
v_low.x, v_low.y, v_low.z,
|
|
332
|
+
v_low.x, v_low.y, v_low.z,
|
|
333
|
+
v_low.x, v_low.y, v_low.z
|
|
291
334
|
);
|
|
292
335
|
|
|
293
336
|
let r = color[R],
|
|
@@ -308,10 +351,10 @@ class Polyline {
|
|
|
308
351
|
cur = new Vec3(cur[0], cur[1], cur[2]);
|
|
309
352
|
}
|
|
310
353
|
|
|
311
|
-
outPath3v[j].push(cur);
|
|
354
|
+
outPath3v[j].push(cur as Vec3);
|
|
312
355
|
|
|
313
356
|
if (ellipsoid) {
|
|
314
|
-
var lonLat = ellipsoid.cartesianToLonLat(cur);
|
|
357
|
+
var lonLat = ellipsoid.cartesianToLonLat(cur as Vec3);
|
|
315
358
|
outTransformedPathLonLat[j].push(lonLat);
|
|
316
359
|
outTransformedPathMerc[j].push(lonLat.forwardMercator());
|
|
317
360
|
|
|
@@ -338,34 +381,18 @@ class Polyline {
|
|
|
338
381
|
b = color[B];
|
|
339
382
|
a = color[A] != undefined ? color[A] : 1.0;
|
|
340
383
|
|
|
341
|
-
Vec3.doubleToTwoFloats(cur, v_high, v_low);
|
|
384
|
+
Vec3.doubleToTwoFloats(cur as Vec3, v_high, v_low);
|
|
342
385
|
outVerticesHigh.push(
|
|
343
|
-
v_high.x,
|
|
344
|
-
v_high.y,
|
|
345
|
-
v_high.z,
|
|
346
|
-
v_high.x,
|
|
347
|
-
v_high.y,
|
|
348
|
-
v_high.z,
|
|
349
|
-
v_high.x,
|
|
350
|
-
v_high.y,
|
|
351
|
-
v_high.z,
|
|
352
|
-
v_high.x,
|
|
353
|
-
v_high.y,
|
|
354
|
-
v_high.z
|
|
386
|
+
v_high.x, v_high.y, v_high.z,
|
|
387
|
+
v_high.x, v_high.y, v_high.z,
|
|
388
|
+
v_high.x, v_high.y, v_high.z,
|
|
389
|
+
v_high.x, v_high.y, v_high.z
|
|
355
390
|
);
|
|
356
391
|
outVerticesLow.push(
|
|
357
|
-
v_low.x,
|
|
358
|
-
v_low.y,
|
|
359
|
-
v_low.z,
|
|
360
|
-
v_low.x,
|
|
361
|
-
v_low.y,
|
|
362
|
-
v_low.z,
|
|
363
|
-
v_low.x,
|
|
364
|
-
v_low.y,
|
|
365
|
-
v_low.z,
|
|
366
|
-
v_low.x,
|
|
367
|
-
v_low.y,
|
|
368
|
-
v_low.z
|
|
392
|
+
v_low.x, v_low.y, v_low.z,
|
|
393
|
+
v_low.x, v_low.y, v_low.z,
|
|
394
|
+
v_low.x, v_low.y, v_low.z,
|
|
395
|
+
v_low.x, v_low.y, v_low.z
|
|
369
396
|
);
|
|
370
397
|
|
|
371
398
|
outColors.push(r, g, b, a, r, g, b, a, r, g, b, a, r, g, b, a);
|
|
@@ -384,12 +411,19 @@ class Polyline {
|
|
|
384
411
|
} else {
|
|
385
412
|
let p0 = path[path.length - 1],
|
|
386
413
|
p1 = path[path.length - 2] || p0;
|
|
414
|
+
|
|
387
415
|
if (p0 instanceof Array) {
|
|
388
416
|
p0 = new Vec3(p0[0], p0[1], p0[2]);
|
|
417
|
+
} else {
|
|
418
|
+
p0 = p0 as Vec3;
|
|
389
419
|
}
|
|
420
|
+
|
|
390
421
|
if (p1 instanceof Array) {
|
|
391
422
|
p1 = new Vec3(p1[0], p1[1], p1[2]);
|
|
423
|
+
} else {
|
|
424
|
+
p1 = p1 as Vec3;
|
|
392
425
|
}
|
|
426
|
+
|
|
393
427
|
first = new Vec3(p0.x + p0.x - p1.x, p0.y + p0.y - p1.y, p0.z + p0.z - p1.z);
|
|
394
428
|
outIndexes.push(index - 1, index - 1, index - 1, index - 1);
|
|
395
429
|
}
|
|
@@ -403,34 +437,18 @@ class Polyline {
|
|
|
403
437
|
b = color[B];
|
|
404
438
|
a = color[A] != undefined ? color[A] : 1.0;
|
|
405
439
|
|
|
406
|
-
Vec3.doubleToTwoFloats(first, v_high, v_low);
|
|
440
|
+
Vec3.doubleToTwoFloats(first as Vec3, v_high, v_low);
|
|
407
441
|
outVerticesHigh.push(
|
|
408
|
-
v_high.x,
|
|
409
|
-
v_high.y,
|
|
410
|
-
v_high.z,
|
|
411
|
-
v_high.x,
|
|
412
|
-
v_high.y,
|
|
413
|
-
v_high.z,
|
|
414
|
-
v_high.x,
|
|
415
|
-
v_high.y,
|
|
416
|
-
v_high.z,
|
|
417
|
-
v_high.x,
|
|
418
|
-
v_high.y,
|
|
419
|
-
v_high.z
|
|
442
|
+
v_high.x, v_high.y, v_high.z,
|
|
443
|
+
v_high.x, v_high.y, v_high.z,
|
|
444
|
+
v_high.x, v_high.y, v_high.z,
|
|
445
|
+
v_high.x, v_high.y, v_high.z
|
|
420
446
|
);
|
|
421
447
|
outVerticesLow.push(
|
|
422
|
-
v_low.x,
|
|
423
|
-
v_low.y,
|
|
424
|
-
v_low.z,
|
|
425
|
-
v_low.x,
|
|
426
|
-
v_low.y,
|
|
427
|
-
v_low.z,
|
|
428
|
-
v_low.x,
|
|
429
|
-
v_low.y,
|
|
430
|
-
v_low.z,
|
|
431
|
-
v_low.x,
|
|
432
|
-
v_low.y,
|
|
433
|
-
v_low.z
|
|
448
|
+
v_low.x, v_low.y, v_low.z,
|
|
449
|
+
v_low.x, v_low.y, v_low.z,
|
|
450
|
+
v_low.x, v_low.y, v_low.z,
|
|
451
|
+
v_low.x, v_low.y, v_low.z
|
|
434
452
|
);
|
|
435
453
|
|
|
436
454
|
outColors.push(r, g, b, a, r, g, b, a, r, g, b, a, r, g, b, a);
|
|
@@ -446,33 +464,23 @@ class Polyline {
|
|
|
446
464
|
|
|
447
465
|
/**
|
|
448
466
|
* Appends to the line new cartesian coordinates point data.
|
|
449
|
-
* @param {Array.<Array.<number>>} path3v - Line coordinates path array. [[0,0,0], [1,1,1],...]
|
|
450
|
-
* @param {Boolean} isClosed - Identificator for the closed line data creation.
|
|
451
|
-
* @param {Number[]} outVertices - Out vertices data array.
|
|
452
|
-
* @param {Number[]} outOrders - Out vertices orders data array.
|
|
453
|
-
* @param {Number[]} outIndexes - Out vertices indexes data array.
|
|
454
|
-
* @param {Ellipsoid} [ellipsoid] - Ellipsoid to coordinates transformation.
|
|
455
|
-
* @param {Array.<Array.<LonLat>>} [outTransformedPathLonLat] - Geodetic coordinates out array.
|
|
456
|
-
* @param {Array.<Array.<LonLat>>} [outPath3v] - Cartesian coordinates out array.
|
|
457
|
-
* @param {Array.<Array.<LonLat>>} [outTransformedPathMerc] - Mercator coordinates out array.
|
|
458
|
-
* @param {Extent} [outExtent] - Geodetic line extent.
|
|
459
467
|
* @static
|
|
460
468
|
*/
|
|
461
469
|
static appendPoint3v(
|
|
462
|
-
path3v,
|
|
463
|
-
point3v,
|
|
464
|
-
pathColors,
|
|
465
|
-
color,
|
|
466
|
-
isClosed,
|
|
467
|
-
outVerticesHigh,
|
|
468
|
-
outVerticesLow,
|
|
469
|
-
outColors,
|
|
470
|
-
outOrders,
|
|
471
|
-
outIndexes,
|
|
472
|
-
ellipsoid,
|
|
473
|
-
outTransformedPathLonLat,
|
|
474
|
-
outTransformedPathMerc,
|
|
475
|
-
outExtent
|
|
470
|
+
path3v: SegmentPath3vExt[],
|
|
471
|
+
point3v: Vec3,
|
|
472
|
+
pathColors: SegmentPathColor[],
|
|
473
|
+
color: NumberArray4,
|
|
474
|
+
isClosed: boolean,
|
|
475
|
+
outVerticesHigh: number[],
|
|
476
|
+
outVerticesLow: number[],
|
|
477
|
+
outColors: number[],
|
|
478
|
+
outOrders: number[],
|
|
479
|
+
outIndexes: number[],
|
|
480
|
+
ellipsoid: Ellipsoid | null,
|
|
481
|
+
outTransformedPathLonLat: SegmentPathLonLatExt[],
|
|
482
|
+
outTransformedPathMerc: LonLat[][],
|
|
483
|
+
outExtent: Extent
|
|
476
484
|
) {
|
|
477
485
|
var v_high = new Vec3(),
|
|
478
486
|
v_low = new Vec3();
|
|
@@ -517,18 +525,25 @@ class Polyline {
|
|
|
517
525
|
last = new Vec3(last[0], last[1], last[2]);
|
|
518
526
|
}
|
|
519
527
|
} else {
|
|
520
|
-
|
|
528
|
+
let p0 = path[0],
|
|
521
529
|
p1 = path[1] || p0;
|
|
530
|
+
|
|
522
531
|
if (p0 instanceof Array) {
|
|
523
532
|
p0 = new Vec3(p0[0], p0[1], p0[2]);
|
|
533
|
+
} else {
|
|
534
|
+
p0 = p0 as Vec3;
|
|
524
535
|
}
|
|
536
|
+
|
|
525
537
|
if (p1 instanceof Array) {
|
|
526
538
|
p1 = new Vec3(p1[0], p1[1], p1[2]);
|
|
539
|
+
} else {
|
|
540
|
+
p1 = p1 as Vec3;
|
|
527
541
|
}
|
|
542
|
+
|
|
528
543
|
last = new Vec3(p0.x + p0.x - p1.x, p0.y + p0.y - p1.y, p0.z + p0.z - p1.z);
|
|
529
544
|
}
|
|
530
545
|
|
|
531
|
-
Vec3.doubleToTwoFloats(last, v_high, v_low);
|
|
546
|
+
Vec3.doubleToTwoFloats(last as Vec3, v_high, v_low);
|
|
532
547
|
|
|
533
548
|
let vi = outVerticesHigh.length - 3 * 12;
|
|
534
549
|
|
|
@@ -570,8 +585,7 @@ class Polyline {
|
|
|
570
585
|
outTransformedPathMerc.push([]);
|
|
571
586
|
}
|
|
572
587
|
|
|
573
|
-
var transformedPathLonLat =
|
|
574
|
-
outTransformedPathLonLat[outTransformedPathLonLat.length - 1],
|
|
588
|
+
var transformedPathLonLat = outTransformedPathLonLat[outTransformedPathLonLat.length - 1],
|
|
575
589
|
transformedPathMerc = outTransformedPathMerc[outTransformedPathMerc.length - 1];
|
|
576
590
|
|
|
577
591
|
let lonLat = ellipsoid.cartesianToLonLat(point3v);
|
|
@@ -651,11 +665,11 @@ class Polyline {
|
|
|
651
665
|
//
|
|
652
666
|
var first;
|
|
653
667
|
if (isClosed) {
|
|
654
|
-
first = path[0];
|
|
668
|
+
first = path[0] as Vec3;
|
|
655
669
|
outIndexes.push(startIndex, startIndex + 1, startIndex + 1, startIndex + 1);
|
|
656
670
|
} else {
|
|
657
|
-
let p0 = path[path.length - 1],
|
|
658
|
-
p1 = path[path.length - 2] || p0;
|
|
671
|
+
let p0 = path[path.length - 1] as Vec3,
|
|
672
|
+
p1 = path[path.length - 2] as Vec3 || p0;
|
|
659
673
|
|
|
660
674
|
first = new Vec3(p0.x + p0.x - p1.x, p0.y + p0.y - p1.y, p0.z + p0.z - p1.z);
|
|
661
675
|
outIndexes.push(index - 1, index - 1, index - 1, index - 1);
|
|
@@ -663,32 +677,16 @@ class Polyline {
|
|
|
663
677
|
|
|
664
678
|
Vec3.doubleToTwoFloats(first, v_high, v_low);
|
|
665
679
|
outVerticesHigh.push(
|
|
666
|
-
v_high.x,
|
|
667
|
-
v_high.y,
|
|
668
|
-
v_high.z,
|
|
669
|
-
v_high.x,
|
|
670
|
-
v_high.y,
|
|
671
|
-
v_high.z,
|
|
672
|
-
v_high.x,
|
|
673
|
-
v_high.y,
|
|
674
|
-
v_high.z,
|
|
675
|
-
v_high.x,
|
|
676
|
-
v_high.y,
|
|
677
|
-
v_high.z
|
|
680
|
+
v_high.x, v_high.y, v_high.z,
|
|
681
|
+
v_high.x, v_high.y, v_high.z,
|
|
682
|
+
v_high.x, v_high.y, v_high.z,
|
|
683
|
+
v_high.x, v_high.y, v_high.z
|
|
678
684
|
);
|
|
679
685
|
outVerticesLow.push(
|
|
680
|
-
v_low.x,
|
|
681
|
-
v_low.y,
|
|
682
|
-
v_low.z,
|
|
683
|
-
v_low.x,
|
|
684
|
-
v_low.y,
|
|
685
|
-
v_low.z,
|
|
686
|
-
v_low.x,
|
|
687
|
-
v_low.y,
|
|
688
|
-
v_low.z,
|
|
689
|
-
v_low.x,
|
|
690
|
-
v_low.y,
|
|
691
|
-
v_low.z
|
|
686
|
+
v_low.x, v_low.y, v_low.z,
|
|
687
|
+
v_low.x, v_low.y, v_low.z,
|
|
688
|
+
v_low.x, v_low.y, v_low.z,
|
|
689
|
+
v_low.x, v_low.y, v_low.z
|
|
692
690
|
);
|
|
693
691
|
|
|
694
692
|
outColors.push(r, g, b, a, r, g, b, a, r, g, b, a, r, g, b, a);
|
|
@@ -698,33 +696,23 @@ class Polyline {
|
|
|
698
696
|
|
|
699
697
|
/**
|
|
700
698
|
* Appends to the line array new geodetic coordinates line data.
|
|
701
|
-
* @param {Array.<Array.<number>>} pathLonLat - Line geodetic coordinates path array. [[0,0,0], [1,1,1],...]
|
|
702
|
-
* @param {Boolean} isClosed - Identificator for the closed line data creation.
|
|
703
|
-
* @param {Number[]} outVertices - Out vertices data array.
|
|
704
|
-
* @param {Number[]} outOrders - Out vertices orders data array.
|
|
705
|
-
* @param {Number[]} outIndexes - Out indexes data array.
|
|
706
|
-
* @param {Ellipsoid} ellipsoid - Ellipsoid to coordinates transformation.
|
|
707
|
-
* @param {Array.<Array.<number>>} outTransformedPathCartesian - Cartesian coordinates out array. [[0,0,0], [1,1,1],...]
|
|
708
|
-
* @param {Array.<Array.<LonLat>>} outPathLonLat - Geographic coordinates out array.
|
|
709
|
-
* @param {Array.<Array.<LonLat>>} outTransformedPathMerc - Mercator coordinates out array.
|
|
710
|
-
* @param {Extent} outExtent - Geodetic line extent.
|
|
711
699
|
* @static
|
|
712
700
|
*/
|
|
713
701
|
static appendLineDataLonLat(
|
|
714
|
-
pathLonLat,
|
|
715
|
-
pathColors,
|
|
716
|
-
defaultColor,
|
|
717
|
-
isClosed,
|
|
718
|
-
outVerticesHigh,
|
|
719
|
-
outVerticesLow,
|
|
720
|
-
outOrders,
|
|
721
|
-
outIndexes,
|
|
722
|
-
ellipsoid,
|
|
723
|
-
outTransformedPathCartesian,
|
|
724
|
-
outPathLonLat,
|
|
725
|
-
outTransformedPathMerc,
|
|
726
|
-
outExtent,
|
|
727
|
-
outColors
|
|
702
|
+
pathLonLat: SegmentPathLonLatExt[],
|
|
703
|
+
pathColors: SegmentPathColor[],
|
|
704
|
+
defaultColor: NumberArray4,
|
|
705
|
+
isClosed: boolean,
|
|
706
|
+
outVerticesHigh: number[],
|
|
707
|
+
outVerticesLow: number[],
|
|
708
|
+
outOrders: number[],
|
|
709
|
+
outIndexes: number[],
|
|
710
|
+
ellipsoid: Ellipsoid,
|
|
711
|
+
outTransformedPathCartesian: SegmentPath3vExt[],
|
|
712
|
+
outPathLonLat: SegmentPathLonLatExt[],
|
|
713
|
+
outTransformedPathMerc: LonLat[][],
|
|
714
|
+
outExtent: Extent,
|
|
715
|
+
outColors: number[]
|
|
728
716
|
) {
|
|
729
717
|
var index = 0;
|
|
730
718
|
|
|
@@ -764,7 +752,7 @@ class Polyline {
|
|
|
764
752
|
if (pp instanceof Array) {
|
|
765
753
|
last = ellipsoid.lonLatToCartesian(new LonLat(pp[0], pp[1], pp[2]));
|
|
766
754
|
} else {
|
|
767
|
-
last = ellipsoid.lonLatToCartesian(pp);
|
|
755
|
+
last = ellipsoid.lonLatToCartesian(pp as LonLat);
|
|
768
756
|
}
|
|
769
757
|
} else {
|
|
770
758
|
let p0, p1;
|
|
@@ -772,7 +760,7 @@ class Polyline {
|
|
|
772
760
|
if (pp instanceof Array) {
|
|
773
761
|
p0 = ellipsoid.lonLatToCartesian(new LonLat(pp[0], pp[1], pp[2]));
|
|
774
762
|
} else {
|
|
775
|
-
p0 = ellipsoid.lonLatToCartesian(pp);
|
|
763
|
+
p0 = ellipsoid.lonLatToCartesian(pp as LonLat);
|
|
776
764
|
}
|
|
777
765
|
|
|
778
766
|
pp = path[1];
|
|
@@ -784,7 +772,7 @@ class Polyline {
|
|
|
784
772
|
if (pp instanceof Array) {
|
|
785
773
|
p1 = ellipsoid.lonLatToCartesian(new LonLat(pp[0], pp[1], pp[2]));
|
|
786
774
|
} else {
|
|
787
|
-
p1 = ellipsoid.lonLatToCartesian(pp);
|
|
775
|
+
p1 = ellipsoid.lonLatToCartesian(pp as LonLat);
|
|
788
776
|
}
|
|
789
777
|
|
|
790
778
|
last = new Vec3(p0.x + p0.x - p1.x, p0.y + p0.y - p1.y, p0.z + p0.z - p1.z);
|
|
@@ -798,32 +786,16 @@ class Polyline {
|
|
|
798
786
|
|
|
799
787
|
Vec3.doubleToTwoFloats(last, v_high, v_low);
|
|
800
788
|
outVerticesHigh.push(
|
|
801
|
-
v_high.x,
|
|
802
|
-
v_high.y,
|
|
803
|
-
v_high.z,
|
|
804
|
-
v_high.x,
|
|
805
|
-
v_high.y,
|
|
806
|
-
v_high.z,
|
|
807
|
-
v_high.x,
|
|
808
|
-
v_high.y,
|
|
809
|
-
v_high.z,
|
|
810
|
-
v_high.x,
|
|
811
|
-
v_high.y,
|
|
812
|
-
v_high.z
|
|
789
|
+
v_high.x, v_high.y, v_high.z,
|
|
790
|
+
v_high.x, v_high.y, v_high.z,
|
|
791
|
+
v_high.x, v_high.y, v_high.z,
|
|
792
|
+
v_high.x, v_high.y, v_high.z
|
|
813
793
|
);
|
|
814
794
|
outVerticesLow.push(
|
|
815
|
-
v_low.x,
|
|
816
|
-
v_low.y,
|
|
817
|
-
v_low.z,
|
|
818
|
-
v_low.x,
|
|
819
|
-
v_low.y,
|
|
820
|
-
v_low.z,
|
|
821
|
-
v_low.x,
|
|
822
|
-
v_low.y,
|
|
823
|
-
v_low.z,
|
|
824
|
-
v_low.x,
|
|
825
|
-
v_low.y,
|
|
826
|
-
v_low.z
|
|
795
|
+
v_low.x, v_low.y, v_low.z,
|
|
796
|
+
v_low.x, v_low.y, v_low.z,
|
|
797
|
+
v_low.x, v_low.y, v_low.z,
|
|
798
|
+
v_low.x, v_low.y, v_low.z
|
|
827
799
|
);
|
|
828
800
|
|
|
829
801
|
let r = color[R],
|
|
@@ -853,39 +825,23 @@ class Polyline {
|
|
|
853
825
|
b = color[B];
|
|
854
826
|
a = color[A] != undefined ? color[A] : 1.0;
|
|
855
827
|
|
|
856
|
-
var cartesian = ellipsoid.lonLatToCartesian(cur);
|
|
828
|
+
var cartesian = ellipsoid.lonLatToCartesian(cur as LonLat);
|
|
857
829
|
outTransformedPathCartesian[j].push(cartesian);
|
|
858
|
-
outPathLonLat[j].push(cur);
|
|
859
|
-
outTransformedPathMerc[j].push(cur.forwardMercator());
|
|
830
|
+
outPathLonLat[j].push(cur as LonLat);
|
|
831
|
+
outTransformedPathMerc[j].push((cur as LonLat).forwardMercator());
|
|
860
832
|
|
|
861
833
|
Vec3.doubleToTwoFloats(cartesian, v_high, v_low);
|
|
862
834
|
outVerticesHigh.push(
|
|
863
|
-
v_high.x,
|
|
864
|
-
v_high.y,
|
|
865
|
-
v_high.z,
|
|
866
|
-
v_high.x,
|
|
867
|
-
v_high.y,
|
|
868
|
-
v_high.z,
|
|
869
|
-
v_high.x,
|
|
870
|
-
v_high.y,
|
|
871
|
-
v_high.z,
|
|
872
|
-
v_high.x,
|
|
873
|
-
v_high.y,
|
|
874
|
-
v_high.z
|
|
835
|
+
v_high.x, v_high.y, v_high.z,
|
|
836
|
+
v_high.x, v_high.y, v_high.z,
|
|
837
|
+
v_high.x, v_high.y, v_high.z,
|
|
838
|
+
v_high.x, v_high.y, v_high.z
|
|
875
839
|
);
|
|
876
840
|
outVerticesLow.push(
|
|
877
|
-
v_low.x,
|
|
878
|
-
v_low.y,
|
|
879
|
-
v_low.z,
|
|
880
|
-
v_low.x,
|
|
881
|
-
v_low.y,
|
|
882
|
-
v_low.z,
|
|
883
|
-
v_low.x,
|
|
884
|
-
v_low.y,
|
|
885
|
-
v_low.z,
|
|
886
|
-
v_low.x,
|
|
887
|
-
v_low.y,
|
|
888
|
-
v_low.z
|
|
841
|
+
v_low.x, v_low.y, v_low.z,
|
|
842
|
+
v_low.x, v_low.y, v_low.z,
|
|
843
|
+
v_low.x, v_low.y, v_low.z,
|
|
844
|
+
v_low.x, v_low.y, v_low.z
|
|
889
845
|
);
|
|
890
846
|
|
|
891
847
|
outColors.push(r, g, b, a, r, g, b, a, r, g, b, a, r, g, b, a);
|
|
@@ -893,17 +849,17 @@ class Polyline {
|
|
|
893
849
|
outOrders.push(1, -1, 2, -2);
|
|
894
850
|
outIndexes.push(index++, index++, index++, index++);
|
|
895
851
|
|
|
896
|
-
if (cur.lon < outExtent.southWest.lon) {
|
|
897
|
-
outExtent.southWest.lon = cur.lon;
|
|
852
|
+
if ((cur as LonLat).lon < outExtent.southWest.lon) {
|
|
853
|
+
outExtent.southWest.lon = (cur as LonLat).lon;
|
|
898
854
|
}
|
|
899
|
-
if (cur.lat < outExtent.southWest.lat) {
|
|
900
|
-
outExtent.southWest.lat = cur.lat;
|
|
855
|
+
if ((cur as LonLat).lat < outExtent.southWest.lat) {
|
|
856
|
+
outExtent.southWest.lat = (cur as LonLat).lat;
|
|
901
857
|
}
|
|
902
|
-
if (cur.lon > outExtent.northEast.lon) {
|
|
903
|
-
outExtent.northEast.lon = cur.lon;
|
|
858
|
+
if ((cur as LonLat).lon > outExtent.northEast.lon) {
|
|
859
|
+
outExtent.northEast.lon = (cur as LonLat).lon;
|
|
904
860
|
}
|
|
905
|
-
if (cur.lat > outExtent.northEast.lat) {
|
|
906
|
-
outExtent.northEast.lat = cur.lat;
|
|
861
|
+
if ((cur as LonLat).lat > outExtent.northEast.lat) {
|
|
862
|
+
outExtent.northEast.lat = (cur as LonLat).lat;
|
|
907
863
|
}
|
|
908
864
|
}
|
|
909
865
|
|
|
@@ -913,7 +869,7 @@ class Polyline {
|
|
|
913
869
|
if (pp instanceof Array) {
|
|
914
870
|
first = ellipsoid.lonLatToCartesian(new LonLat(pp[0], pp[1], pp[2]));
|
|
915
871
|
} else {
|
|
916
|
-
first = ellipsoid.lonLatToCartesian(pp);
|
|
872
|
+
first = ellipsoid.lonLatToCartesian(pp as LonLat);
|
|
917
873
|
}
|
|
918
874
|
outIndexes.push(startIndex, startIndex + 1, startIndex + 1, startIndex + 1);
|
|
919
875
|
} else {
|
|
@@ -922,7 +878,7 @@ class Polyline {
|
|
|
922
878
|
if (pp instanceof Array) {
|
|
923
879
|
p0 = ellipsoid.lonLatToCartesian(new LonLat(pp[0], pp[1], pp[2]));
|
|
924
880
|
} else {
|
|
925
|
-
p0 = ellipsoid.lonLatToCartesian(pp);
|
|
881
|
+
p0 = ellipsoid.lonLatToCartesian(pp as LonLat);
|
|
926
882
|
}
|
|
927
883
|
|
|
928
884
|
pp = path[path.length - 2];
|
|
@@ -934,7 +890,7 @@ class Polyline {
|
|
|
934
890
|
if (pp instanceof Array) {
|
|
935
891
|
p1 = ellipsoid.lonLatToCartesian(new LonLat(pp[0], pp[1], pp[2]));
|
|
936
892
|
} else {
|
|
937
|
-
p1 = ellipsoid.lonLatToCartesian(pp);
|
|
893
|
+
p1 = ellipsoid.lonLatToCartesian(pp as LonLat);
|
|
938
894
|
}
|
|
939
895
|
first = new Vec3(p0.x + p0.x - p1.x, p0.y + p0.y - p1.y, p0.z + p0.z - p1.z);
|
|
940
896
|
outIndexes.push(index - 1, index - 1, index - 1, index - 1);
|
|
@@ -951,32 +907,16 @@ class Polyline {
|
|
|
951
907
|
|
|
952
908
|
Vec3.doubleToTwoFloats(first, v_high, v_low);
|
|
953
909
|
outVerticesHigh.push(
|
|
954
|
-
v_high.x,
|
|
955
|
-
v_high.y,
|
|
956
|
-
v_high.z,
|
|
957
|
-
v_high.x,
|
|
958
|
-
v_high.y,
|
|
959
|
-
v_high.z,
|
|
960
|
-
v_high.x,
|
|
961
|
-
v_high.y,
|
|
962
|
-
v_high.z,
|
|
963
|
-
v_high.x,
|
|
964
|
-
v_high.y,
|
|
965
|
-
v_high.z
|
|
910
|
+
v_high.x, v_high.y, v_high.z,
|
|
911
|
+
v_high.x, v_high.y, v_high.z,
|
|
912
|
+
v_high.x, v_high.y, v_high.z,
|
|
913
|
+
v_high.x, v_high.y, v_high.z
|
|
966
914
|
);
|
|
967
915
|
outVerticesLow.push(
|
|
968
|
-
v_low.x,
|
|
969
|
-
v_low.y,
|
|
970
|
-
v_low.z,
|
|
971
|
-
v_low.x,
|
|
972
|
-
v_low.y,
|
|
973
|
-
v_low.z,
|
|
974
|
-
v_low.x,
|
|
975
|
-
v_low.y,
|
|
976
|
-
v_low.z,
|
|
977
|
-
v_low.x,
|
|
978
|
-
v_low.y,
|
|
979
|
-
v_low.z
|
|
916
|
+
v_low.x, v_low.y, v_low.z,
|
|
917
|
+
v_low.x, v_low.y, v_low.z,
|
|
918
|
+
v_low.x, v_low.y, v_low.z,
|
|
919
|
+
v_low.x, v_low.y, v_low.z
|
|
980
920
|
);
|
|
981
921
|
|
|
982
922
|
outColors.push(r, g, b, a, r, g, b, a, r, g, b, a, r, g, b, a);
|
|
@@ -993,9 +933,9 @@ class Polyline {
|
|
|
993
933
|
/**
|
|
994
934
|
* Sets polyline path with cartesian coordinates.
|
|
995
935
|
* @protected
|
|
996
|
-
* @param {
|
|
936
|
+
* @param {SegmentPath3vExt[]} path3v - Cartesian coordinates.
|
|
997
937
|
*/
|
|
998
|
-
_setEqualPath3v(path3v) {
|
|
938
|
+
protected _setEqualPath3v(path3v: SegmentPath3vExt[]) {
|
|
999
939
|
var extent = this._extent;
|
|
1000
940
|
extent.southWest.set(180, 90);
|
|
1001
941
|
extent.northEast.set(-180, -90);
|
|
@@ -1009,10 +949,10 @@ class Polyline {
|
|
|
1009
949
|
m = this._pathLonLatMerc,
|
|
1010
950
|
k = 0;
|
|
1011
951
|
|
|
1012
|
-
var ellipsoid = this._renderNode.ellipsoid;
|
|
952
|
+
var ellipsoid = (this._renderNode as Planet).ellipsoid;
|
|
1013
953
|
|
|
1014
954
|
for (let j = 0; j < path3v.length; j++) {
|
|
1015
|
-
var path = path3v[j];
|
|
955
|
+
var path = path3v[j] as Vec3[];
|
|
1016
956
|
|
|
1017
957
|
var last;
|
|
1018
958
|
if (this._closedLine) {
|
|
@@ -1053,8 +993,8 @@ class Polyline {
|
|
|
1053
993
|
vl[k++] = v_low.z;
|
|
1054
994
|
|
|
1055
995
|
for (let i = 0; i < path.length; i++) {
|
|
1056
|
-
var cur = path[i],
|
|
1057
|
-
pji = this._path3v[j][i];
|
|
996
|
+
var cur = path[i] as Vec3,
|
|
997
|
+
pji = this._path3v[j][i] as Vec3;
|
|
1058
998
|
|
|
1059
999
|
pji.x = cur.x;
|
|
1060
1000
|
pji.y = cur.y;
|
|
@@ -1122,7 +1062,7 @@ class Polyline {
|
|
|
1122
1062
|
);
|
|
1123
1063
|
}
|
|
1124
1064
|
|
|
1125
|
-
Vec3.doubleToTwoFloats(first, v_high, v_low);
|
|
1065
|
+
Vec3.doubleToTwoFloats(first as Vec3, v_high, v_low);
|
|
1126
1066
|
|
|
1127
1067
|
vh[k] = v_high.x;
|
|
1128
1068
|
vl[k++] = v_low.x;
|
|
@@ -1154,9 +1094,9 @@ class Polyline {
|
|
|
1154
1094
|
/**
|
|
1155
1095
|
* Sets polyline with geodetic coordinates.
|
|
1156
1096
|
* @protected
|
|
1157
|
-
* @param {
|
|
1097
|
+
* @param {SegmentPathLonLat[]} pathLonLat - Geodetic polyline path coordinates.
|
|
1158
1098
|
*/
|
|
1159
|
-
_setEqualPathLonLat(pathLonLat) {
|
|
1099
|
+
protected _setEqualPathLonLat(pathLonLat: SegmentPathLonLat[]) {
|
|
1160
1100
|
var extent = this._extent;
|
|
1161
1101
|
extent.southWest.set(180.0, 90.0);
|
|
1162
1102
|
extent.northEast.set(-180.0, -90.0);
|
|
@@ -1171,10 +1111,10 @@ class Polyline {
|
|
|
1171
1111
|
c = this._path3v,
|
|
1172
1112
|
k = 0;
|
|
1173
1113
|
|
|
1174
|
-
var ellipsoid = this._renderNode.ellipsoid;
|
|
1114
|
+
var ellipsoid = (this._renderNode as Planet).ellipsoid;
|
|
1175
1115
|
|
|
1176
1116
|
for (let j = 0; j < pathLonLat.length; j++) {
|
|
1177
|
-
var path = pathLonLat[j];
|
|
1117
|
+
var path = pathLonLat[j] as LonLat[];
|
|
1178
1118
|
|
|
1179
1119
|
var last;
|
|
1180
1120
|
if (this._closedLine) {
|
|
@@ -1213,7 +1153,7 @@ class Polyline {
|
|
|
1213
1153
|
vl[k++] = v_low.z;
|
|
1214
1154
|
|
|
1215
1155
|
for (let i = 0; i < path.length; i++) {
|
|
1216
|
-
var cur = path[i];
|
|
1156
|
+
var cur = path[i] as LonLat;
|
|
1217
1157
|
var cartesian = ellipsoid.lonLatToCartesian(cur);
|
|
1218
1158
|
c[j][i] = cartesian;
|
|
1219
1159
|
m[j][i] = cur.forwardMercator();
|
|
@@ -1298,8 +1238,8 @@ class Polyline {
|
|
|
1298
1238
|
}
|
|
1299
1239
|
}
|
|
1300
1240
|
|
|
1301
|
-
setPointLonLat(lonlat, index, segmentIndex) {
|
|
1302
|
-
if (this._renderNode && this._renderNode.ellipsoid) {
|
|
1241
|
+
public setPointLonLat(lonlat: LonLat, index: number, segmentIndex: number) {
|
|
1242
|
+
if (this._renderNode && (this._renderNode as Planet).ellipsoid) {
|
|
1303
1243
|
let l = this._pathLonLat,
|
|
1304
1244
|
m = this._pathLonLatMerc;
|
|
1305
1245
|
|
|
@@ -1313,7 +1253,7 @@ class Polyline {
|
|
|
1313
1253
|
extent.southWest.set(180.0, 90.0);
|
|
1314
1254
|
extent.northEast.set(-180.0, -90.0);
|
|
1315
1255
|
for (let i = 0; i < l.length; i++) {
|
|
1316
|
-
var pi = l[i];
|
|
1256
|
+
var pi = l[i] as LonLat[];
|
|
1317
1257
|
for (let j = 0; j < pi.length; j++) {
|
|
1318
1258
|
var lon = pi[j].lon,
|
|
1319
1259
|
lat = pi[j].lat;
|
|
@@ -1333,20 +1273,27 @@ class Polyline {
|
|
|
1333
1273
|
}
|
|
1334
1274
|
|
|
1335
1275
|
this.setPoint3v(
|
|
1336
|
-
this._renderNode.ellipsoid.lonLatToCartesian(lonlat),
|
|
1276
|
+
(this._renderNode as Planet).ellipsoid.lonLatToCartesian(lonlat),
|
|
1337
1277
|
index,
|
|
1338
1278
|
segmentIndex,
|
|
1339
1279
|
true
|
|
1340
1280
|
);
|
|
1341
1281
|
} else {
|
|
1342
|
-
let path = this._pathLonLat[segmentIndex];
|
|
1282
|
+
let path = this._pathLonLat[segmentIndex] as LonLat[];
|
|
1343
1283
|
path[index].lon = lonlat.lon;
|
|
1344
1284
|
path[index].lat = lonlat.lat;
|
|
1345
1285
|
path[index].height = lonlat.height;
|
|
1346
1286
|
}
|
|
1347
1287
|
}
|
|
1348
1288
|
|
|
1349
|
-
|
|
1289
|
+
/**
|
|
1290
|
+
* Changes cartesian point coordinates of the path
|
|
1291
|
+
* @param {Vec3} coordinates - New coordinates
|
|
1292
|
+
* @param {number} [index=0] - Path segment index
|
|
1293
|
+
* @param {number} [segmentIndex=0] - Index of the point in the path segment
|
|
1294
|
+
* @param {boolean} [skipLonLat=false] - Do not update geodetic coordinates
|
|
1295
|
+
*/
|
|
1296
|
+
public setPoint3v(coordinates: Vec3, index: number = 0, segmentIndex: number = 0, skipLonLat: boolean = false) {
|
|
1350
1297
|
|
|
1351
1298
|
if (this._renderNode) {
|
|
1352
1299
|
var v_high = new Vec3(),
|
|
@@ -1364,7 +1311,7 @@ class Polyline {
|
|
|
1364
1311
|
//}
|
|
1365
1312
|
kk = this._pathLengths[segmentIndex] * 12 + 24 * segmentIndex;
|
|
1366
1313
|
|
|
1367
|
-
let path = this._path3v[segmentIndex];
|
|
1314
|
+
let path = this._path3v[segmentIndex] as Vec3[];
|
|
1368
1315
|
|
|
1369
1316
|
path[index].x = coordinates.x;
|
|
1370
1317
|
path[index].y = coordinates.y;
|
|
@@ -1415,8 +1362,8 @@ class Polyline {
|
|
|
1415
1362
|
vl[k + 11] = v_low.z;
|
|
1416
1363
|
}
|
|
1417
1364
|
|
|
1418
|
-
if (!skipLonLat && this._renderNode.ellipsoid) {
|
|
1419
|
-
var lonLat = this._renderNode.ellipsoid.cartesianToLonLat(coordinates);
|
|
1365
|
+
if (!skipLonLat && (this._renderNode as Planet).ellipsoid) {
|
|
1366
|
+
var lonLat = (this._renderNode as Planet).ellipsoid.cartesianToLonLat(coordinates);
|
|
1420
1367
|
l[segmentIndex][index] = lonLat;
|
|
1421
1368
|
m[segmentIndex][index] = lonLat.forwardMercator();
|
|
1422
1369
|
|
|
@@ -1427,7 +1374,7 @@ class Polyline {
|
|
|
1427
1374
|
extent.southWest.set(180.0, 90.0);
|
|
1428
1375
|
extent.northEast.set(-180.0, -90.0);
|
|
1429
1376
|
for (let i = 0; i < l.length; i++) {
|
|
1430
|
-
var pi = l[i];
|
|
1377
|
+
var pi = l[i] as LonLat[];
|
|
1431
1378
|
for (let j = 0; j < pi.length; j++) {
|
|
1432
1379
|
var lon = pi[j].lon,
|
|
1433
1380
|
lat = pi[j].lat;
|
|
@@ -1523,38 +1470,54 @@ class Polyline {
|
|
|
1523
1470
|
|
|
1524
1471
|
this._changedBuffers[VERTICES_BUFFER] = true;
|
|
1525
1472
|
} else {
|
|
1526
|
-
let path = this._path3v[segmentIndex];
|
|
1473
|
+
let path = this._path3v[segmentIndex] as Vec3[];
|
|
1527
1474
|
path[index].x = coordinates.x;
|
|
1528
1475
|
path[index].y = coordinates.y;
|
|
1529
1476
|
path[index].z = coordinates.z;
|
|
1530
1477
|
}
|
|
1531
1478
|
}
|
|
1532
1479
|
|
|
1533
|
-
_resizePathLengths(index = 0) {
|
|
1480
|
+
protected _resizePathLengths(index: number = 0) {
|
|
1534
1481
|
this._pathLengths[0] = 0;
|
|
1535
1482
|
for (let i = index + 1, len = this._path3v.length; i <= len; i++) {
|
|
1536
1483
|
this._pathLengths[i] = this._pathLengths[i - 1] + this._path3v[i - 1].length;
|
|
1537
1484
|
}
|
|
1538
1485
|
}
|
|
1539
1486
|
|
|
1540
|
-
|
|
1487
|
+
/**
|
|
1488
|
+
* Remove path segment
|
|
1489
|
+
* @param {number} index - Path segment index
|
|
1490
|
+
*/
|
|
1491
|
+
public removeSegment(index: number) {
|
|
1541
1492
|
this._path3v.splice(index, 1);
|
|
1542
|
-
this.setPath3v([].concat(this._path3v));
|
|
1493
|
+
this.setPath3v(([] as SegmentPath3vExt[]).concat(this._path3v));
|
|
1543
1494
|
}
|
|
1544
1495
|
|
|
1545
|
-
|
|
1496
|
+
/**
|
|
1497
|
+
* Remove point from the path
|
|
1498
|
+
* @param {number} index - Point index in a path segment
|
|
1499
|
+
* @param {number} [multiLineIndex=0] - Segment path index
|
|
1500
|
+
*/
|
|
1501
|
+
public removePoint(index: number, multiLineIndex: number = 0) {
|
|
1546
1502
|
this._path3v[multiLineIndex].splice(index, 1);
|
|
1547
1503
|
if (this._path3v[multiLineIndex].length === 0) {
|
|
1548
1504
|
this._path3v.splice(multiLineIndex, 1);
|
|
1549
1505
|
}
|
|
1550
|
-
this.setPath3v([].concat(this._path3v));
|
|
1506
|
+
this.setPath3v(([] as SegmentPath3vExt[]).concat(this._path3v));
|
|
1551
1507
|
}
|
|
1552
1508
|
|
|
1553
|
-
|
|
1554
|
-
|
|
1509
|
+
/**
|
|
1510
|
+
* Insert point coordinates in a path segment
|
|
1511
|
+
* @param {Vec3} point3v - Point coordinates
|
|
1512
|
+
* @param {number} [index=0] - Index in the path
|
|
1513
|
+
* @param {NumberArray4} [color] - Point color
|
|
1514
|
+
* @param {number} [multilineIndex=0] - Path segment index
|
|
1515
|
+
*/
|
|
1516
|
+
public insertPoint3v(point3v: Vec3, index: number = 0, color?: NumberArray4, multilineIndex: number = 0) {
|
|
1517
|
+
let p = ([] as SegmentPath3vExt[]).concat(this._path3v),
|
|
1555
1518
|
pp = p[multilineIndex];
|
|
1556
1519
|
if (pp) {
|
|
1557
|
-
let c = [].concat(this._pathColors);
|
|
1520
|
+
let c = ([] as SegmentPathColor[]).concat(this._pathColors);
|
|
1558
1521
|
|
|
1559
1522
|
pp.splice(index, 0, point3v);
|
|
1560
1523
|
|
|
@@ -1575,11 +1538,13 @@ class Polyline {
|
|
|
1575
1538
|
/**
|
|
1576
1539
|
* Adds a new cartesian point in the end of the path in a last line segment.
|
|
1577
1540
|
* @public
|
|
1578
|
-
* @param {Vec3} point3v - New
|
|
1541
|
+
* @param {Vec3} point3v - New coordinates.
|
|
1542
|
+
* @param {NumberArray4} [color] -
|
|
1543
|
+
* @param {boolean} [skipEllipsoid] -
|
|
1579
1544
|
*/
|
|
1580
|
-
appendPoint3v(point3v, color, skipEllipsoid) {
|
|
1545
|
+
public appendPoint3v(point3v: Vec3, color?: NumberArray4, skipEllipsoid?: boolean) {
|
|
1581
1546
|
if (this._path3v.length === 0) {
|
|
1582
|
-
this._pathColors.push([color || this._defaultColor]);
|
|
1547
|
+
this._pathColors.push([color || this._defaultColor as NumberArray4]);
|
|
1583
1548
|
this.addPoint3v(point3v);
|
|
1584
1549
|
} else {
|
|
1585
1550
|
//
|
|
@@ -1595,14 +1560,14 @@ class Polyline {
|
|
|
1595
1560
|
this._path3v,
|
|
1596
1561
|
point3v,
|
|
1597
1562
|
this._pathColors,
|
|
1598
|
-
color || this._defaultColor,
|
|
1563
|
+
color || this._defaultColor as NumberArray4,
|
|
1599
1564
|
this._closedLine,
|
|
1600
1565
|
this._verticesHigh,
|
|
1601
1566
|
this._verticesLow,
|
|
1602
1567
|
this._colors,
|
|
1603
1568
|
this._orders,
|
|
1604
1569
|
this._indexes,
|
|
1605
|
-
!skipEllipsoid
|
|
1570
|
+
!skipEllipsoid ? (this._renderNode as Planet).ellipsoid : null,
|
|
1606
1571
|
this._pathLonLat,
|
|
1607
1572
|
this._pathLonLatMerc,
|
|
1608
1573
|
this._extent
|
|
@@ -1617,12 +1582,12 @@ class Polyline {
|
|
|
1617
1582
|
}
|
|
1618
1583
|
|
|
1619
1584
|
/**
|
|
1620
|
-
*
|
|
1585
|
+
* Append new point in the end of the path.
|
|
1621
1586
|
* @public
|
|
1622
|
-
* @param {Vec3} point3v - New
|
|
1623
|
-
* @param {number} [multiLineIndex=0] - Path
|
|
1587
|
+
* @param {Vec3} point3v - New point coordinates.
|
|
1588
|
+
* @param {number} [multiLineIndex=0] - Path segment index, first by default.
|
|
1624
1589
|
*/
|
|
1625
|
-
addPoint3v(point3v, multiLineIndex = 0) {
|
|
1590
|
+
public addPoint3v(point3v: Vec3, multiLineIndex: number = 0) {
|
|
1626
1591
|
//
|
|
1627
1592
|
// TODO: could be optimized
|
|
1628
1593
|
//
|
|
@@ -1630,16 +1595,16 @@ class Polyline {
|
|
|
1630
1595
|
this._path3v.push([]);
|
|
1631
1596
|
}
|
|
1632
1597
|
this._path3v[multiLineIndex].push(point3v);
|
|
1633
|
-
this.setPath3v([].concat(this._path3v));
|
|
1598
|
+
this.setPath3v(([] as SegmentPath3vExt[]).concat(this._path3v));
|
|
1634
1599
|
}
|
|
1635
1600
|
|
|
1636
1601
|
/**
|
|
1637
|
-
*
|
|
1602
|
+
* Append new geodetic point in the end of the path.
|
|
1638
1603
|
* @public
|
|
1639
1604
|
* @param {LonLat} lonLat - New coordinate.
|
|
1640
|
-
* @param {number} [multiLineIndex=0] - Path
|
|
1605
|
+
* @param {number} [multiLineIndex=0] - Path segment index, first by default.
|
|
1641
1606
|
*/
|
|
1642
|
-
addPointLonLat(lonLat, multiLineIndex = 0) {
|
|
1607
|
+
public addPointLonLat(lonLat: LonLat, multiLineIndex: number = 0) {
|
|
1643
1608
|
//
|
|
1644
1609
|
// TODO: could be optimized
|
|
1645
1610
|
//
|
|
@@ -1647,18 +1612,24 @@ class Polyline {
|
|
|
1647
1612
|
this._pathLonLat.push([]);
|
|
1648
1613
|
}
|
|
1649
1614
|
this._pathLonLat[multiLineIndex].push(lonLat);
|
|
1650
|
-
this.setPathLonLat([].concat(this._pathLonLat));
|
|
1615
|
+
this.setPathLonLat(([] as SegmentPathLonLatExt[]).concat(this._pathLonLat));
|
|
1651
1616
|
}
|
|
1652
1617
|
|
|
1653
1618
|
/**
|
|
1654
|
-
* Clear
|
|
1619
|
+
* Clear polyline data.
|
|
1655
1620
|
* @public
|
|
1656
1621
|
*/
|
|
1657
|
-
clear() {
|
|
1622
|
+
public clear() {
|
|
1658
1623
|
this._clearData();
|
|
1659
1624
|
}
|
|
1660
1625
|
|
|
1661
|
-
|
|
1626
|
+
/**
|
|
1627
|
+
* Change path point color
|
|
1628
|
+
* @param {NumberArray4} color - New color
|
|
1629
|
+
* @param {number} [index=0] - Point index
|
|
1630
|
+
* @param {number} [segmentIndex=0] - Path segment index
|
|
1631
|
+
*/
|
|
1632
|
+
public setPointColor(color: NumberArray4, index: number = 0, segmentIndex: number = 0) {
|
|
1662
1633
|
if (this._renderNode && index < this._path3v[segmentIndex].length) {
|
|
1663
1634
|
let colors = this._pathColors[segmentIndex];
|
|
1664
1635
|
|
|
@@ -1701,11 +1672,11 @@ class Polyline {
|
|
|
1701
1672
|
}
|
|
1702
1673
|
|
|
1703
1674
|
/**
|
|
1704
|
-
* Sets
|
|
1675
|
+
* Sets polyline opacity.
|
|
1705
1676
|
* @public
|
|
1706
1677
|
* @param {number} opacity - Opacity.
|
|
1707
1678
|
*/
|
|
1708
|
-
setOpacity(opacity) {
|
|
1679
|
+
public setOpacity(opacity: number) {
|
|
1709
1680
|
this._opacity = opacity;
|
|
1710
1681
|
}
|
|
1711
1682
|
|
|
@@ -1714,7 +1685,7 @@ class Polyline {
|
|
|
1714
1685
|
* @public
|
|
1715
1686
|
* @param {number} thickness - Thickness.
|
|
1716
1687
|
*/
|
|
1717
|
-
setThickness(thickness) {
|
|
1688
|
+
public setThickness(thickness: number) {
|
|
1718
1689
|
this.thickness = thickness;
|
|
1719
1690
|
}
|
|
1720
1691
|
|
|
@@ -1723,7 +1694,7 @@ class Polyline {
|
|
|
1723
1694
|
* @public
|
|
1724
1695
|
* @return {number} Thickness in screen pixels.
|
|
1725
1696
|
*/
|
|
1726
|
-
getThickness() {
|
|
1697
|
+
public getThickness(): number {
|
|
1727
1698
|
return this.thickness;
|
|
1728
1699
|
}
|
|
1729
1700
|
|
|
@@ -1732,7 +1703,7 @@ class Polyline {
|
|
|
1732
1703
|
* @public
|
|
1733
1704
|
* @param {boolean} visibility - Polyline visibility.
|
|
1734
1705
|
*/
|
|
1735
|
-
setVisibility(visibility) {
|
|
1706
|
+
public setVisibility(visibility: boolean) {
|
|
1736
1707
|
this.visibility = visibility;
|
|
1737
1708
|
}
|
|
1738
1709
|
|
|
@@ -1741,7 +1712,7 @@ class Polyline {
|
|
|
1741
1712
|
* @public
|
|
1742
1713
|
* @return {boolean} Polyline visibility.
|
|
1743
1714
|
*/
|
|
1744
|
-
getVisibility() {
|
|
1715
|
+
public getVisibility(): boolean {
|
|
1745
1716
|
return this.visibility;
|
|
1746
1717
|
}
|
|
1747
1718
|
|
|
@@ -1750,29 +1721,31 @@ class Polyline {
|
|
|
1750
1721
|
* @public
|
|
1751
1722
|
* @param {RenderNode} renderNode -
|
|
1752
1723
|
*/
|
|
1753
|
-
setRenderNode(renderNode) {
|
|
1724
|
+
public setRenderNode(renderNode: RenderNode) {
|
|
1754
1725
|
if (renderNode) {
|
|
1755
1726
|
this._renderNode = renderNode;
|
|
1756
1727
|
if (this._pathLonLat.length) {
|
|
1757
|
-
this._createDataLonLat([].concat(this._pathLonLat));
|
|
1728
|
+
this._createDataLonLat(([] as SegmentPathLonLatExt[]).concat(this._pathLonLat));
|
|
1758
1729
|
} else {
|
|
1759
|
-
this._createData3v([].concat(this._path3v));
|
|
1730
|
+
this._createData3v(([] as SegmentPath3vExt[]).concat(this._path3v));
|
|
1760
1731
|
}
|
|
1761
1732
|
this._refresh();
|
|
1762
|
-
if (renderNode.renderer.isInitialized()) {
|
|
1733
|
+
if (renderNode.renderer && renderNode.renderer.isInitialized()) {
|
|
1763
1734
|
this._update();
|
|
1764
1735
|
}
|
|
1765
1736
|
}
|
|
1766
1737
|
}
|
|
1767
1738
|
|
|
1768
|
-
|
|
1769
|
-
|
|
1770
|
-
*/
|
|
1771
|
-
_clearData() {
|
|
1739
|
+
protected _clearData() {
|
|
1740
|
+
//@ts-ignore
|
|
1772
1741
|
this._verticesHigh = null;
|
|
1742
|
+
//@ts-ignore
|
|
1773
1743
|
this._verticesLow = null;
|
|
1744
|
+
//@ts-ignore
|
|
1774
1745
|
this._orders = null;
|
|
1746
|
+
//@ts-ignore
|
|
1775
1747
|
this._indexes = null;
|
|
1748
|
+
//@ts-ignore
|
|
1776
1749
|
this._colors = null;
|
|
1777
1750
|
|
|
1778
1751
|
this._verticesHigh = [];
|
|
@@ -1790,44 +1763,44 @@ class Polyline {
|
|
|
1790
1763
|
this._pathLonLatMerc = [];
|
|
1791
1764
|
}
|
|
1792
1765
|
|
|
1793
|
-
_createData3v(path3v) {
|
|
1766
|
+
protected _createData3v(path3v: SegmentPath3vExt[]) {
|
|
1794
1767
|
this._clearData();
|
|
1795
1768
|
Polyline.appendLineData3v(
|
|
1796
1769
|
path3v,
|
|
1797
1770
|
this._pathColors,
|
|
1798
|
-
this._defaultColor,
|
|
1771
|
+
this._defaultColor as NumberArray4,
|
|
1799
1772
|
this._closedLine,
|
|
1800
|
-
this._verticesHigh,
|
|
1801
|
-
this._verticesLow,
|
|
1802
|
-
this._orders,
|
|
1803
|
-
this._indexes,
|
|
1804
|
-
this._renderNode.ellipsoid,
|
|
1773
|
+
this._verticesHigh as number[],
|
|
1774
|
+
this._verticesLow as number[],
|
|
1775
|
+
this._orders as number[],
|
|
1776
|
+
this._indexes as number[],
|
|
1777
|
+
(this._renderNode as Planet).ellipsoid,
|
|
1805
1778
|
this._pathLonLat,
|
|
1806
1779
|
this._path3v,
|
|
1807
1780
|
this._pathLonLatMerc,
|
|
1808
1781
|
this._extent,
|
|
1809
|
-
this._colors
|
|
1782
|
+
this._colors as number[]
|
|
1810
1783
|
);
|
|
1811
1784
|
this._resizePathLengths(0);
|
|
1812
1785
|
}
|
|
1813
1786
|
|
|
1814
|
-
_createDataLonLat(pathLonlat) {
|
|
1787
|
+
protected _createDataLonLat(pathLonlat: SegmentPathLonLatExt[]) {
|
|
1815
1788
|
this._clearData();
|
|
1816
1789
|
Polyline.appendLineDataLonLat(
|
|
1817
1790
|
pathLonlat,
|
|
1818
1791
|
this._pathColors,
|
|
1819
|
-
this._defaultColor,
|
|
1792
|
+
this._defaultColor as NumberArray4,
|
|
1820
1793
|
this._closedLine,
|
|
1821
|
-
this._verticesHigh,
|
|
1822
|
-
this._verticesLow,
|
|
1823
|
-
this._orders,
|
|
1824
|
-
this._indexes,
|
|
1825
|
-
this._renderNode.ellipsoid,
|
|
1794
|
+
this._verticesHigh as number[],
|
|
1795
|
+
this._verticesLow as number[],
|
|
1796
|
+
this._orders as number[],
|
|
1797
|
+
this._indexes as number[],
|
|
1798
|
+
(this._renderNode as Planet).ellipsoid,
|
|
1826
1799
|
this._path3v,
|
|
1827
1800
|
this._pathLonLat,
|
|
1828
1801
|
this._pathLonLatMerc,
|
|
1829
1802
|
this._extent,
|
|
1830
|
-
this._colors
|
|
1803
|
+
this._colors as number[]
|
|
1831
1804
|
);
|
|
1832
1805
|
this._resizePathLengths(0);
|
|
1833
1806
|
}
|
|
@@ -1836,16 +1809,21 @@ class Polyline {
|
|
|
1836
1809
|
* Removes from an entity.
|
|
1837
1810
|
* @public
|
|
1838
1811
|
*/
|
|
1839
|
-
remove() {
|
|
1812
|
+
public remove() {
|
|
1840
1813
|
this._entity = null;
|
|
1841
1814
|
|
|
1842
1815
|
this._pathColors.length = 0;
|
|
1843
1816
|
this._pathColors = [];
|
|
1844
1817
|
|
|
1818
|
+
//@ts-ignore
|
|
1845
1819
|
this._verticesHigh = null;
|
|
1820
|
+
//@ts-ignore
|
|
1846
1821
|
this._verticesLow = null;
|
|
1822
|
+
//@ts-ignore
|
|
1847
1823
|
this._orders = null;
|
|
1824
|
+
//@ts-ignore
|
|
1848
1825
|
this._indexes = null;
|
|
1826
|
+
//@ts-ignore
|
|
1849
1827
|
this._colors = null;
|
|
1850
1828
|
|
|
1851
1829
|
this._verticesHigh = [];
|
|
@@ -1859,7 +1837,7 @@ class Polyline {
|
|
|
1859
1837
|
this._handler && this._handler.remove(this);
|
|
1860
1838
|
}
|
|
1861
1839
|
|
|
1862
|
-
setPickingColor3v(color) {
|
|
1840
|
+
public setPickingColor3v(color: Vec3) {
|
|
1863
1841
|
this._pickingColor[0] = color.x / 255.0;
|
|
1864
1842
|
this._pickingColor[1] = color.y / 255.0;
|
|
1865
1843
|
this._pickingColor[2] = color.z / 255.0;
|
|
@@ -1870,37 +1848,47 @@ class Polyline {
|
|
|
1870
1848
|
* @public
|
|
1871
1849
|
* @returns {Extent} - Geodetic extent
|
|
1872
1850
|
*/
|
|
1873
|
-
getExtent() {
|
|
1851
|
+
public getExtent(): Extent {
|
|
1874
1852
|
return this._extent.clone();
|
|
1875
1853
|
}
|
|
1876
1854
|
|
|
1877
1855
|
/**
|
|
1878
1856
|
* Returns path cartesian coordinates.
|
|
1879
|
-
* @return {
|
|
1857
|
+
* @return {SegmentPath3vExt[]} Polyline path.
|
|
1880
1858
|
*/
|
|
1881
|
-
getPath3v() {
|
|
1859
|
+
public getPath3v(): SegmentPath3vExt[] {
|
|
1882
1860
|
return this._path3v;
|
|
1883
1861
|
}
|
|
1884
1862
|
|
|
1885
1863
|
/**
|
|
1886
1864
|
* Returns geodetic path coordinates.
|
|
1887
|
-
* @return {
|
|
1865
|
+
* @return {SegmentPathLonLatExt[]} Polyline path.
|
|
1888
1866
|
*/
|
|
1889
|
-
getPathLonLat() {
|
|
1867
|
+
public getPathLonLat(): SegmentPathLonLatExt[] {
|
|
1890
1868
|
return this._pathLonLat;
|
|
1891
1869
|
}
|
|
1892
1870
|
|
|
1893
|
-
getPathColors() {
|
|
1871
|
+
public getPathColors(): NumberArray4[][] {
|
|
1894
1872
|
return this._pathColors;
|
|
1895
1873
|
}
|
|
1896
1874
|
|
|
1897
|
-
|
|
1875
|
+
/**
|
|
1876
|
+
* @todo
|
|
1877
|
+
* @param {NumberArray4[][]} pathColors
|
|
1878
|
+
*/
|
|
1879
|
+
setPathColors(pathColors: NumberArray4[][]) {
|
|
1898
1880
|
if (this._renderNode) {
|
|
1881
|
+
//
|
|
1899
1882
|
// ...
|
|
1883
|
+
//
|
|
1900
1884
|
}
|
|
1901
1885
|
}
|
|
1902
1886
|
|
|
1903
|
-
|
|
1887
|
+
/**
|
|
1888
|
+
* Sets polyline color
|
|
1889
|
+
* @param {string} htmlColor- HTML color
|
|
1890
|
+
*/
|
|
1891
|
+
public setColorHTML(htmlColor: string) {
|
|
1904
1892
|
this._defaultColor = htmlColorToFloat32Array(htmlColor);
|
|
1905
1893
|
|
|
1906
1894
|
let color = htmlColorToRgba(htmlColor),
|
|
@@ -1928,15 +1916,15 @@ class Polyline {
|
|
|
1928
1916
|
}
|
|
1929
1917
|
|
|
1930
1918
|
/**
|
|
1931
|
-
* Sets geodetic coordinates.
|
|
1919
|
+
* Sets polyline geodetic coordinates.
|
|
1932
1920
|
* @public
|
|
1933
|
-
* @param {
|
|
1934
|
-
* @param {Boolean} [forceEqual=false] - Makes assigning faster for size equal coordinates array.
|
|
1921
|
+
* @param {SegmentPathLonLat[]} pathLonLat - Polyline path cartesian coordinates.
|
|
1922
|
+
* @param {Boolean} [forceEqual=false] - OPTIMIZATION FLAG: Makes assigning faster for size equal coordinates array.
|
|
1935
1923
|
*/
|
|
1936
|
-
setPathLonLat(pathLonLat, forceEqual) {
|
|
1937
|
-
if (this._renderNode && this._renderNode.ellipsoid) {
|
|
1924
|
+
public setPathLonLat(pathLonLat: SegmentPathLonLatExt[], forceEqual: boolean = false) {
|
|
1925
|
+
if (this._renderNode && (this._renderNode as Planet).ellipsoid) {
|
|
1938
1926
|
if (forceEqual) {
|
|
1939
|
-
this._setEqualPathLonLat(pathLonLat);
|
|
1927
|
+
this._setEqualPathLonLat(pathLonLat as SegmentPathLonLat[]);
|
|
1940
1928
|
this._changedBuffers[VERTICES_BUFFER] = true;
|
|
1941
1929
|
this._changedBuffers[COLORS_BUFFER] = true;
|
|
1942
1930
|
} else {
|
|
@@ -1946,19 +1934,20 @@ class Polyline {
|
|
|
1946
1934
|
this._changedBuffers[COLORS_BUFFER] = true;
|
|
1947
1935
|
}
|
|
1948
1936
|
} else {
|
|
1949
|
-
this._pathLonLat = [].concat(pathLonLat);
|
|
1937
|
+
this._pathLonLat = ([] as SegmentPathLonLatExt[]).concat(pathLonLat);
|
|
1950
1938
|
}
|
|
1951
1939
|
}
|
|
1952
1940
|
|
|
1953
1941
|
/**
|
|
1954
1942
|
* Sets Polyline cartesian coordinates.
|
|
1955
1943
|
* @public
|
|
1956
|
-
* @param {
|
|
1944
|
+
* @param {SegmentPath3vExt[]} path3v - Polyline path cartesian coordinates. (exactly 3 entries)
|
|
1945
|
+
* @param {SegmentPathColor[]} [pathColors] - Polyline path cartesian coordinates. (exactly 3 entries)
|
|
1957
1946
|
* @param {Boolean} [forceEqual=false] - Makes assigning faster for size equal coordinates array.
|
|
1958
1947
|
*/
|
|
1959
|
-
setPath3v(path3v, pathColors, forceEqual) {
|
|
1948
|
+
public setPath3v(path3v: SegmentPath3vExt[], pathColors?: SegmentPathColor[], forceEqual: boolean = false) {
|
|
1960
1949
|
if (pathColors) {
|
|
1961
|
-
this._pathColors = [].concat(pathColors);
|
|
1950
|
+
this._pathColors = ([] as SegmentPathColor[]).concat(pathColors);
|
|
1962
1951
|
}
|
|
1963
1952
|
|
|
1964
1953
|
if (this._renderNode) {
|
|
@@ -1973,77 +1962,75 @@ class Polyline {
|
|
|
1973
1962
|
this._changedBuffers[COLORS_BUFFER] = true;
|
|
1974
1963
|
}
|
|
1975
1964
|
} else {
|
|
1976
|
-
this._path3v = [].concat(path3v);
|
|
1965
|
+
this._path3v = ([] as SegmentPath3vExt[]).concat(path3v);
|
|
1977
1966
|
}
|
|
1978
1967
|
}
|
|
1979
1968
|
|
|
1980
|
-
draw() {
|
|
1969
|
+
public draw() {
|
|
1981
1970
|
if (this.visibility && this._path3v.length) {
|
|
1982
1971
|
this._update();
|
|
1983
1972
|
|
|
1984
|
-
|
|
1985
|
-
|
|
1986
|
-
|
|
1987
|
-
|
|
1988
|
-
|
|
1973
|
+
let rn = this._renderNode!;
|
|
1974
|
+
let r = rn.renderer!;
|
|
1975
|
+
let sh = r.handler.programs.polyline_screen;
|
|
1976
|
+
let p = sh._program;
|
|
1977
|
+
let gl = r.handler.gl!,
|
|
1989
1978
|
sha = p.attributes,
|
|
1990
|
-
shu = p.uniforms
|
|
1991
|
-
|
|
1979
|
+
shu = p.uniforms;
|
|
1980
|
+
|
|
1981
|
+
let ec = this._handler!._entityCollection;
|
|
1992
1982
|
|
|
1993
1983
|
sh.activate();
|
|
1994
1984
|
|
|
1995
1985
|
gl.disable(gl.CULL_FACE);
|
|
1996
1986
|
|
|
1997
|
-
gl.uniform1f(shu.depthOffset, ec.polygonOffsetUnits
|
|
1987
|
+
gl.uniform1f(shu.depthOffset, ec.polygonOffsetUnits);
|
|
1998
1988
|
|
|
1999
|
-
gl.uniformMatrix4fv(shu.proj, false, r.activeCamera
|
|
2000
|
-
gl.uniformMatrix4fv(shu.view, false, r.activeCamera
|
|
1989
|
+
gl.uniformMatrix4fv(shu.proj, false, r.activeCamera!.getProjectionMatrix());
|
|
1990
|
+
gl.uniformMatrix4fv(shu.view, false, r.activeCamera!.getViewMatrix());
|
|
2001
1991
|
|
|
2002
1992
|
// gl.uniform4fv(shu.color, [this.color.x, this.color.y, this.color.z, this.color.w * this._handler._entityCollection._fadingOpacity]);
|
|
2003
1993
|
|
|
2004
|
-
gl.uniform3fv(shu.eyePositionHigh, r.activeCamera
|
|
2005
|
-
gl.uniform3fv(shu.eyePositionLow, r.activeCamera
|
|
1994
|
+
gl.uniform3fv(shu.eyePositionHigh, r.activeCamera!.eyeHigh);
|
|
1995
|
+
gl.uniform3fv(shu.eyePositionLow, r.activeCamera!.eyeLow);
|
|
2006
1996
|
|
|
2007
|
-
gl.uniform2fv(shu.uFloatParams, [
|
|
2008
|
-
|
|
2009
|
-
r.activeCamera._tanViewAngle_hradOneByHeight
|
|
2010
|
-
]);
|
|
2011
|
-
gl.uniform2fv(shu.viewport, [r.handler.canvas.width, r.handler.canvas.height]);
|
|
1997
|
+
gl.uniform2fv(shu.uFloatParams, [(rn as Planet)._planetRadius2 || 0.0, r.activeCamera!._tanViewAngle_hradOneByHeight]);
|
|
1998
|
+
gl.uniform2fv(shu.viewport, [r.handler.canvas!.width, r.handler.canvas!.height]);
|
|
2012
1999
|
gl.uniform1f(shu.thickness, this.thickness * 0.5);
|
|
2013
2000
|
gl.uniform1f(shu.opacity, this._opacity * ec._fadingOpacity);
|
|
2014
2001
|
|
|
2015
|
-
gl.bindBuffer(gl.ARRAY_BUFFER, this._colorsBuffer);
|
|
2016
|
-
gl.vertexAttribPointer(sha.color, this._colorsBuffer
|
|
2002
|
+
gl.bindBuffer(gl.ARRAY_BUFFER, this._colorsBuffer as WebGLBuffer);
|
|
2003
|
+
gl.vertexAttribPointer(sha.color, this._colorsBuffer!.itemSize, gl.FLOAT, false, 0, 0);
|
|
2017
2004
|
|
|
2018
|
-
|
|
2005
|
+
let v = this._verticesHighBuffer!;
|
|
2019
2006
|
gl.bindBuffer(gl.ARRAY_BUFFER, v);
|
|
2020
2007
|
gl.vertexAttribPointer(sha.prevHigh, v.itemSize, gl.FLOAT, false, 12, 0);
|
|
2021
2008
|
gl.vertexAttribPointer(sha.currentHigh, v.itemSize, gl.FLOAT, false, 12, 48);
|
|
2022
2009
|
gl.vertexAttribPointer(sha.nextHigh, v.itemSize, gl.FLOAT, false, 12, 96);
|
|
2023
2010
|
|
|
2024
|
-
v = this._verticesLowBuffer
|
|
2011
|
+
v = this._verticesLowBuffer!;
|
|
2025
2012
|
gl.bindBuffer(gl.ARRAY_BUFFER, v);
|
|
2026
2013
|
gl.vertexAttribPointer(sha.prevLow, v.itemSize, gl.FLOAT, false, 12, 0);
|
|
2027
2014
|
gl.vertexAttribPointer(sha.currentLow, v.itemSize, gl.FLOAT, false, 12, 48);
|
|
2028
2015
|
gl.vertexAttribPointer(sha.nextLow, v.itemSize, gl.FLOAT, false, 12, 96);
|
|
2029
2016
|
|
|
2030
|
-
gl.bindBuffer(gl.ARRAY_BUFFER, this._ordersBuffer);
|
|
2031
|
-
gl.vertexAttribPointer(sha.order, this._ordersBuffer
|
|
2017
|
+
gl.bindBuffer(gl.ARRAY_BUFFER, this._ordersBuffer as WebGLBuffer);
|
|
2018
|
+
gl.vertexAttribPointer(sha.order, this._ordersBuffer!.itemSize, gl.FLOAT, false, 4, 0);
|
|
2032
2019
|
|
|
2033
|
-
gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, this._indexesBuffer);
|
|
2034
|
-
gl.drawElements(gl.TRIANGLE_STRIP, this._indexesBuffer
|
|
2020
|
+
gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, this._indexesBuffer as WebGLBuffer);
|
|
2021
|
+
gl.drawElements(gl.TRIANGLE_STRIP, this._indexesBuffer!.numItems, gl.UNSIGNED_INT, 0);
|
|
2035
2022
|
|
|
2036
2023
|
gl.enable(gl.CULL_FACE);
|
|
2037
2024
|
}
|
|
2038
2025
|
}
|
|
2039
2026
|
|
|
2040
|
-
drawPicking() {
|
|
2027
|
+
public drawPicking() {
|
|
2041
2028
|
if (this.visibility && this._path3v.length) {
|
|
2042
|
-
|
|
2043
|
-
|
|
2044
|
-
|
|
2045
|
-
|
|
2046
|
-
|
|
2029
|
+
let rn = this._renderNode!;
|
|
2030
|
+
let r = rn.renderer!;
|
|
2031
|
+
let sh = r.handler.programs.polyline_picking;
|
|
2032
|
+
let p = sh._program;
|
|
2033
|
+
let gl = r.handler.gl!,
|
|
2047
2034
|
sha = p.attributes,
|
|
2048
2035
|
shu = p.uniforms;
|
|
2049
2036
|
|
|
@@ -2051,10 +2038,10 @@ class Polyline {
|
|
|
2051
2038
|
|
|
2052
2039
|
gl.disable(gl.CULL_FACE);
|
|
2053
2040
|
|
|
2054
|
-
gl.uniform1f(shu.depthOffset, this._handler
|
|
2041
|
+
gl.uniform1f(shu.depthOffset, this._handler!._entityCollection.polygonOffsetUnits);
|
|
2055
2042
|
|
|
2056
|
-
gl.uniformMatrix4fv(shu.proj, false, r.activeCamera
|
|
2057
|
-
gl.uniformMatrix4fv(shu.view, false, r.activeCamera
|
|
2043
|
+
gl.uniformMatrix4fv(shu.proj, false, r.activeCamera!.getProjectionMatrix());
|
|
2044
|
+
gl.uniformMatrix4fv(shu.view, false, r.activeCamera!.getViewMatrix());
|
|
2058
2045
|
|
|
2059
2046
|
gl.uniform4fv(shu.color, [
|
|
2060
2047
|
this._pickingColor[0],
|
|
@@ -2063,33 +2050,31 @@ class Polyline {
|
|
|
2063
2050
|
1.0
|
|
2064
2051
|
]);
|
|
2065
2052
|
|
|
2066
|
-
gl.uniform3fv(shu.eyePositionHigh, r.activeCamera
|
|
2067
|
-
gl.uniform3fv(shu.eyePositionLow, r.activeCamera
|
|
2053
|
+
gl.uniform3fv(shu.eyePositionHigh, r.activeCamera!.eyeHigh);
|
|
2054
|
+
gl.uniform3fv(shu.eyePositionLow, r.activeCamera!.eyeLow);
|
|
2068
2055
|
|
|
2069
|
-
gl.uniform2fv(shu.uFloatParams, [
|
|
2070
|
-
|
|
2071
|
-
|
|
2072
|
-
]);
|
|
2073
|
-
gl.uniform2fv(shu.viewport, [r.handler.canvas.width, r.handler.canvas.height]);
|
|
2056
|
+
gl.uniform2fv(shu.uFloatParams, [(rn as Planet)._planetRadius2 || 0.0, r.activeCamera!._tanViewAngle_hradOneByHeight]);
|
|
2057
|
+
//@todo: replace to the handler property
|
|
2058
|
+
gl.uniform2fv(shu.viewport, [r.handler.canvas!.width, r.handler.canvas!.height]);
|
|
2074
2059
|
gl.uniform1f(shu.thickness, this.thickness * 0.5);
|
|
2075
2060
|
|
|
2076
|
-
|
|
2061
|
+
let v = this._verticesHighBuffer!;
|
|
2077
2062
|
gl.bindBuffer(gl.ARRAY_BUFFER, v);
|
|
2078
2063
|
gl.vertexAttribPointer(sha.prevHigh, v.itemSize, gl.FLOAT, false, 12, 0);
|
|
2079
2064
|
gl.vertexAttribPointer(sha.currentHigh, v.itemSize, gl.FLOAT, false, 12, 48);
|
|
2080
2065
|
gl.vertexAttribPointer(sha.nextHigh, v.itemSize, gl.FLOAT, false, 12, 96);
|
|
2081
2066
|
|
|
2082
|
-
v = this._verticesLowBuffer
|
|
2067
|
+
v = this._verticesLowBuffer!;
|
|
2083
2068
|
gl.bindBuffer(gl.ARRAY_BUFFER, v);
|
|
2084
2069
|
gl.vertexAttribPointer(sha.prevLow, v.itemSize, gl.FLOAT, false, 12, 0);
|
|
2085
2070
|
gl.vertexAttribPointer(sha.currentLow, v.itemSize, gl.FLOAT, false, 12, 48);
|
|
2086
2071
|
gl.vertexAttribPointer(sha.nextLow, v.itemSize, gl.FLOAT, false, 12, 96);
|
|
2087
2072
|
|
|
2088
|
-
gl.bindBuffer(gl.ARRAY_BUFFER, this._ordersBuffer);
|
|
2089
|
-
gl.vertexAttribPointer(sha.order, this._ordersBuffer
|
|
2073
|
+
gl.bindBuffer(gl.ARRAY_BUFFER, this._ordersBuffer as WebGLBuffer);
|
|
2074
|
+
gl.vertexAttribPointer(sha.order, this._ordersBuffer!.itemSize, gl.FLOAT, false, 4, 0);
|
|
2090
2075
|
|
|
2091
|
-
gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, this._indexesBuffer);
|
|
2092
|
-
gl.drawElements(gl.TRIANGLE_STRIP, this._indexesBuffer
|
|
2076
|
+
gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, this._indexesBuffer as WebGLBuffer);
|
|
2077
|
+
gl.drawElements(gl.TRIANGLE_STRIP, this._indexesBuffer!.numItems, gl.UNSIGNED_INT, 0);
|
|
2093
2078
|
|
|
2094
2079
|
gl.enable(gl.CULL_FACE);
|
|
2095
2080
|
}
|
|
@@ -2099,8 +2084,8 @@ class Polyline {
|
|
|
2099
2084
|
* Refresh buffers.
|
|
2100
2085
|
* @protected
|
|
2101
2086
|
*/
|
|
2102
|
-
_refresh() {
|
|
2103
|
-
|
|
2087
|
+
protected _refresh() {
|
|
2088
|
+
let i = this._changedBuffers.length;
|
|
2104
2089
|
while (i--) {
|
|
2105
2090
|
this._changedBuffers[i] = true;
|
|
2106
2091
|
}
|
|
@@ -2110,9 +2095,9 @@ class Polyline {
|
|
|
2110
2095
|
* Updates render buffers.
|
|
2111
2096
|
* @protected
|
|
2112
2097
|
*/
|
|
2113
|
-
_update() {
|
|
2098
|
+
protected _update() {
|
|
2114
2099
|
if (this._renderNode) {
|
|
2115
|
-
|
|
2100
|
+
let i = this._changedBuffers.length;
|
|
2116
2101
|
while (i--) {
|
|
2117
2102
|
if (this._changedBuffers[i]) {
|
|
2118
2103
|
this._buffersUpdateCallbacks[i].call(this);
|
|
@@ -2124,18 +2109,18 @@ class Polyline {
|
|
|
2124
2109
|
|
|
2125
2110
|
/**
|
|
2126
2111
|
* Clear GL buffers.
|
|
2127
|
-
* @
|
|
2112
|
+
* @public
|
|
2128
2113
|
*/
|
|
2129
|
-
_deleteBuffers() {
|
|
2114
|
+
public _deleteBuffers() {
|
|
2130
2115
|
if (this._renderNode) {
|
|
2131
|
-
|
|
2132
|
-
gl = r.handler.gl
|
|
2116
|
+
let r = this._renderNode.renderer!,
|
|
2117
|
+
gl = r.handler.gl!;
|
|
2133
2118
|
|
|
2134
|
-
gl.deleteBuffer(this._verticesHighBuffer);
|
|
2135
|
-
gl.deleteBuffer(this._verticesLowBuffer);
|
|
2136
|
-
gl.deleteBuffer(this._ordersBuffer);
|
|
2137
|
-
gl.deleteBuffer(this._indexesBuffer);
|
|
2138
|
-
gl.deleteBuffer(this._colorsBuffer);
|
|
2119
|
+
gl.deleteBuffer(this._verticesHighBuffer as WebGLBuffer);
|
|
2120
|
+
gl.deleteBuffer(this._verticesLowBuffer as WebGLBuffer);
|
|
2121
|
+
gl.deleteBuffer(this._ordersBuffer as WebGLBuffer);
|
|
2122
|
+
gl.deleteBuffer(this._indexesBuffer as WebGLBuffer);
|
|
2123
|
+
gl.deleteBuffer(this._colorsBuffer as WebGLBuffer);
|
|
2139
2124
|
|
|
2140
2125
|
this._verticesHighBuffer = null;
|
|
2141
2126
|
this._verticesLowBuffer = null;
|
|
@@ -2146,17 +2131,17 @@ class Polyline {
|
|
|
2146
2131
|
}
|
|
2147
2132
|
|
|
2148
2133
|
/**
|
|
2149
|
-
* Creates
|
|
2134
|
+
* Creates vertices buffers.
|
|
2150
2135
|
* @protected
|
|
2151
2136
|
*/
|
|
2152
|
-
_createVerticesBuffer() {
|
|
2153
|
-
|
|
2137
|
+
protected _createVerticesBuffer() {
|
|
2138
|
+
let h = this._renderNode!.renderer!.handler;
|
|
2154
2139
|
|
|
2155
2140
|
let numItems = this._verticesHigh.length / 3;
|
|
2156
2141
|
|
|
2157
2142
|
if (!this._verticesHighBuffer || this._verticesHighBuffer.numItems !== numItems) {
|
|
2158
|
-
h.gl
|
|
2159
|
-
h.gl
|
|
2143
|
+
h.gl!.deleteBuffer(this._verticesHighBuffer as WebGLBuffer);
|
|
2144
|
+
h.gl!.deleteBuffer(this._verticesLowBuffer as WebGLBuffer);
|
|
2160
2145
|
this._verticesHighBuffer = h.createStreamArrayBuffer(3, numItems);
|
|
2161
2146
|
this._verticesLowBuffer = h.createStreamArrayBuffer(3, numItems);
|
|
2162
2147
|
}
|
|
@@ -2164,40 +2149,33 @@ class Polyline {
|
|
|
2164
2149
|
this._verticesHigh = makeArrayTyped(this._verticesHigh);
|
|
2165
2150
|
this._verticesLow = makeArrayTyped(this._verticesLow);
|
|
2166
2151
|
|
|
2167
|
-
h.setStreamArrayBuffer(this._verticesHighBuffer
|
|
2168
|
-
h.setStreamArrayBuffer(this._verticesLowBuffer
|
|
2152
|
+
h.setStreamArrayBuffer(this._verticesHighBuffer!, this._verticesHigh as Float32Array);
|
|
2153
|
+
h.setStreamArrayBuffer(this._verticesLowBuffer!, this._verticesLow as Float32Array);
|
|
2169
2154
|
}
|
|
2170
2155
|
|
|
2171
2156
|
/**
|
|
2172
2157
|
* Creates gl index and order buffer.
|
|
2173
2158
|
* @protected
|
|
2174
2159
|
*/
|
|
2175
|
-
_createIndexBuffer() {
|
|
2176
|
-
|
|
2177
|
-
h.gl
|
|
2178
|
-
h.gl
|
|
2160
|
+
protected _createIndexBuffer() {
|
|
2161
|
+
let h = this._renderNode!.renderer!.handler;
|
|
2162
|
+
h.gl!.deleteBuffer(this._ordersBuffer as WebGLBuffer);
|
|
2163
|
+
h.gl!.deleteBuffer(this._indexesBuffer as WebGLBuffer);
|
|
2179
2164
|
|
|
2180
2165
|
this._orders = makeArrayTyped(this._orders);
|
|
2181
|
-
|
|
2182
|
-
this._ordersBuffer = h.createArrayBuffer(this._orders, 1, this._orders.length / 2);
|
|
2166
|
+
this._ordersBuffer = h.createArrayBuffer(this._orders as Uint8Array, 1, this._orders.length / 2);
|
|
2183
2167
|
|
|
2184
2168
|
this._indexes = makeArrayTyped(this._indexes, Uint32Array);
|
|
2185
|
-
|
|
2186
|
-
this._indexesBuffer = h.createElementArrayBuffer(this._indexes, 1, this._indexes.length);
|
|
2169
|
+
this._indexesBuffer = h.createElementArrayBuffer(this._indexes as Uint32Array, 1, this._indexes.length);
|
|
2187
2170
|
}
|
|
2188
2171
|
|
|
2189
|
-
_createColorsBuffer() {
|
|
2190
|
-
|
|
2191
|
-
h.gl
|
|
2172
|
+
protected _createColorsBuffer() {
|
|
2173
|
+
let h = this._renderNode!.renderer!.handler;
|
|
2174
|
+
h.gl!.deleteBuffer(this._colorsBuffer as WebGLBuffer);
|
|
2192
2175
|
|
|
2193
2176
|
this._colors = makeArrayTyped(this._colors);
|
|
2194
|
-
|
|
2195
|
-
this._colorsBuffer = h.createArrayBuffer(
|
|
2196
|
-
new Float32Array(this._colors),
|
|
2197
|
-
4,
|
|
2198
|
-
this._colors.length / 4
|
|
2199
|
-
);
|
|
2177
|
+
this._colorsBuffer = h.createArrayBuffer(new Float32Array(this._colors), 4, this._colors.length / 4);
|
|
2200
2178
|
}
|
|
2201
2179
|
}
|
|
2202
2180
|
|
|
2203
|
-
export {
|
|
2181
|
+
export {Polyline};
|