@openglobus/og 0.18.0 → 0.18.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +8 -8
- package/lib/@openglobus/og.esm.js +2 -0
- package/lib/@openglobus/og.esm.js.map +1 -0
- package/lib/@openglobus/og.umd.js +2 -0
- package/lib/@openglobus/og.umd.js.map +1 -0
- package/lib/js/Clock.d.ts +106 -0
- package/{src/Clock.ts → lib/js/Clock.js} +31 -126
- package/lib/js/Deferred.d.ts +6 -0
- package/lib/js/Deferred.js +13 -0
- package/lib/js/Events.d.ts +90 -0
- package/{src/Events.ts → lib/js/Events.js} +29 -84
- package/lib/js/Extent.d.ts +145 -0
- package/{src/Extent.ts → lib/js/Extent.js} +74 -120
- package/lib/js/Globe.d.ts +132 -0
- package/{src/Globe.ts → lib/js/Globe.js} +61 -159
- package/lib/js/ImageCanvas.d.ts +128 -0
- package/{src/ImageCanvas.ts → lib/js/ImageCanvas.js} +24 -65
- package/lib/js/Lock.d.ts +15 -0
- package/{src/Lock.ts → lib/js/Lock.js} +7 -21
- package/lib/js/LonLat.d.ts +128 -0
- package/{src/LonLat.ts → lib/js/LonLat.js} +44 -75
- package/lib/js/Object3d.d.ts +49 -0
- package/{src/Object3d.ts → lib/js/Object3d.js} +64 -184
- package/lib/js/Popup.d.ts +46 -0
- package/{src/Popup.ts → lib/js/Popup.js} +42 -110
- package/lib/js/QueueArray.d.ts +16 -0
- package/{src/QueueArray.ts → lib/js/QueueArray.js} +12 -25
- package/lib/js/Rectangle.d.ts +76 -0
- package/{src/Rectangle.ts → lib/js/Rectangle.js} +12 -50
- package/lib/js/Stack.d.ts +20 -0
- package/{src/Stack.ts → lib/js/Stack.js} +13 -29
- package/lib/js/astro/astro.d.ts +39 -0
- package/{src/astro/astro.ts → lib/js/astro/astro.js} +2 -8
- package/lib/js/astro/earth.d.ts +8 -0
- package/{src/astro/earth.ts → lib/js/astro/earth.js} +3 -39
- package/lib/js/astro/jd.d.ts +234 -0
- package/{src/astro/jd.ts → lib/js/astro/jd.js} +55 -134
- package/lib/js/astro/orbit.d.ts +5 -0
- package/{src/astro/orbit.ts → lib/js/astro/orbit.js} +26 -39
- package/lib/js/astro/rotation.d.ts +2 -0
- package/{src/astro/rotation.ts → lib/js/astro/rotation.js} +2 -11
- package/lib/js/bv/Box.d.ts +32 -0
- package/{src/bv/Box.ts → lib/js/bv/Box.js} +7 -35
- package/lib/js/bv/Sphere.d.ts +37 -0
- package/{src/bv/Sphere.ts → lib/js/bv/Sphere.js} +6 -34
- package/{src/bv/index.ts → lib/js/bv/index.d.ts} +0 -1
- package/lib/js/bv/index.js +3 -0
- package/lib/js/camera/Camera.d.ts +314 -0
- package/{src/camera/Camera.ts → lib/js/camera/Camera.js} +77 -326
- package/lib/js/camera/Frustum.d.ts +139 -0
- package/{src/camera/Frustum.ts → lib/js/camera/Frustum.js} +66 -185
- package/lib/js/camera/PlanetCamera.d.ts +234 -0
- package/{src/camera/PlanetCamera.ts → lib/js/camera/PlanetCamera.js} +65 -338
- package/{src/camera/index.ts → lib/js/camera/index.d.ts} +0 -1
- package/lib/js/camera/index.js +3 -0
- package/lib/js/cons.d.ts +40 -0
- package/{src/cons.ts → lib/js/cons.js} +10 -22
- package/lib/js/control/Atmosphere.d.ts +16 -0
- package/{src/control/Atmosphere.ts → lib/js/control/Atmosphere.js} +33 -86
- package/lib/js/control/CompassButton.d.ts +16 -0
- package/{src/control/CompassButton.ts → lib/js/control/CompassButton.js} +18 -43
- package/lib/js/control/Control.d.ts +100 -0
- package/{src/control/Control.ts → lib/js/control/Control.js} +22 -89
- package/lib/js/control/DebugInfo.d.ts +25 -0
- package/{src/control/DebugInfo.ts → lib/js/control/DebugInfo.js} +38 -84
- package/lib/js/control/DrawingSwitcher.d.ts +13 -0
- package/{src/control/DrawingSwitcher.ts → lib/js/control/DrawingSwitcher.js} +13 -30
- package/lib/js/control/EarthCoordinates.d.ts +41 -0
- package/{src/control/EarthCoordinates.ts → lib/js/control/EarthCoordinates.js} +58 -119
- package/lib/js/control/EarthNavigation.d.ts +50 -0
- package/{src/control/EarthNavigation.ts → lib/js/control/EarthNavigation.js} +70 -161
- package/lib/js/control/GeoImageDragControl.d.ts +22 -0
- package/{src/control/GeoImageDragControl.ts → lib/js/control/GeoImageDragControl.js} +26 -49
- package/lib/js/control/KeyboardNavigation.d.ts +28 -0
- package/{src/control/KeyboardNavigation.ts → lib/js/control/KeyboardNavigation.js} +67 -92
- package/lib/js/control/LayerAnimation.d.ts +71 -0
- package/{src/control/LayerAnimation.ts → lib/js/control/LayerAnimation.js} +82 -162
- package/lib/js/control/LayerSwitcher.d.ts +21 -0
- package/{src/control/LayerSwitcher.ts → lib/js/control/LayerSwitcher.js} +16 -41
- package/lib/js/control/Lighting.d.ts +49 -0
- package/{src/control/Lighting.ts → lib/js/control/Lighting.js} +106 -219
- package/lib/js/control/MouseNavigation.d.ts +62 -0
- package/{src/control/MouseNavigation.ts → lib/js/control/MouseNavigation.js} +105 -211
- package/lib/js/control/MouseWheelZoomControl.d.ts +44 -0
- package/lib/js/control/MouseWheelZoomControl.js +181 -0
- package/lib/js/control/RulerSwitcher.d.ts +17 -0
- package/{src/control/RulerSwitcher.ts → lib/js/control/RulerSwitcher.js} +13 -28
- package/lib/js/control/ScaleControl.d.ts +24 -0
- package/lib/js/control/ScaleControl.js +91 -0
- package/lib/js/control/SegmentBoundVisualization.d.ts +12 -0
- package/lib/js/control/SegmentBoundVisualization.js +37 -0
- package/lib/js/control/ShowFps.d.ts +9 -0
- package/lib/js/control/ShowFps.js +20 -0
- package/lib/js/control/SimpleNavigation.d.ts +25 -0
- package/{src/control/SimpleNavigation.ts → lib/js/control/SimpleNavigation.js} +29 -51
- package/lib/js/control/SimpleSkyBackground.d.ts +15 -0
- package/{src/control/SimpleSkyBackground.ts → lib/js/control/SimpleSkyBackground.js} +21 -48
- package/lib/js/control/Sun.d.ts +33 -0
- package/{src/control/Sun.ts → lib/js/control/Sun.js} +34 -85
- package/lib/js/control/ToggleWireframe.d.ts +14 -0
- package/lib/js/control/ToggleWireframe.js +28 -0
- package/lib/js/control/TouchNavigation.d.ts +52 -0
- package/{src/control/TouchNavigation.ts → lib/js/control/TouchNavigation.js} +88 -193
- package/lib/js/control/ZoomControl.d.ts +27 -0
- package/{src/control/ZoomControl.ts → lib/js/control/ZoomControl.js} +25 -50
- package/lib/js/control/drawing/DrawingControl.d.ts +12 -0
- package/{src/control/drawing/DrawingControl.ts → lib/js/control/drawing/DrawingControl.js} +10 -20
- package/lib/js/control/drawing/LineStringDrawingScene.d.ts +15 -0
- package/{src/control/drawing/LineStringDrawingScene.ts → lib/js/control/drawing/LineStringDrawingScene.js} +28 -85
- package/lib/js/control/drawing/PolygonDrawingScene.d.ts +98 -0
- package/{src/control/drawing/PolygonDrawingScene.ts → lib/js/control/drawing/PolygonDrawingScene.js} +190 -388
- package/lib/js/control/elevationProfile/ElevationProfile.d.ts +61 -0
- package/{src/control/elevationProfile/ElevationProfile.ts → lib/js/control/elevationProfile/ElevationProfile.js} +56 -148
- package/lib/js/control/heightRuler/HeightRuler.d.ts +7 -0
- package/{src/control/heightRuler/HeightRuler.ts → lib/js/control/heightRuler/HeightRuler.js} +4 -9
- package/lib/js/control/heightRuler/HeightRulerScene.d.ts +35 -0
- package/{src/control/heightRuler/HeightRulerScene.ts → lib/js/control/heightRuler/HeightRulerScene.js} +47 -99
- package/lib/js/control/heightRuler/HeightRulerSwitcher.d.ts +6 -0
- package/{src/control/heightRuler/HeightRulerSwitcher.ts → lib/js/control/heightRuler/HeightRulerSwitcher.js} +2 -4
- package/{src/control/index.ts → lib/js/control/index.d.ts} +1 -18
- package/lib/js/control/index.js +28 -0
- package/lib/js/control/ruler/Ruler.d.ts +13 -0
- package/lib/js/control/ruler/Ruler.js +23 -0
- package/lib/js/control/ruler/RulerScene.d.ts +88 -0
- package/lib/js/control/ruler/RulerScene.js +324 -0
- package/lib/js/control/selection/Selection.d.ts +55 -0
- package/{src/control/selection/Selection.ts → lib/js/control/selection/Selection.js} +15 -34
- package/lib/js/control/selection/SelectionScene.d.ts +44 -0
- package/{src/control/selection/SelectionScene.ts → lib/js/control/selection/SelectionScene.js} +26 -113
- package/lib/js/control/timeline/TimelineControl.d.ts +18 -0
- package/{src/control/timeline/TimelineControl.ts → lib/js/control/timeline/TimelineControl.js} +13 -43
- package/lib/js/control/timeline/TimelineModel.d.ts +41 -0
- package/{src/control/timeline/TimelineModel.ts → lib/js/control/timeline/TimelineModel.js} +26 -74
- package/lib/js/control/timeline/TimelineView.d.ts +85 -0
- package/{src/control/timeline/TimelineView.ts → lib/js/control/timeline/TimelineView.js} +133 -281
- package/lib/js/control/timeline/timelineUtils.d.ts +12 -0
- package/lib/js/control/timeline/timelineUtils.js +112 -0
- package/lib/js/control/visibleExtent/Segment.d.ts +277 -0
- package/{src → lib/js}/control/visibleExtent/Segment.js +145 -698
- package/lib/js/control/visibleExtent/VisibleExtent.d.ts +5 -0
- package/{src → lib/js}/control/visibleExtent/VisibleExtent.js +1 -18
- package/lib/js/control/visibleExtent/drawnode.d.ts +7 -0
- package/{src/control/visibleExtent/drawnode.ts → lib/js/control/visibleExtent/drawnode.js} +1 -28
- package/lib/js/ellipsoid/Ellipsoid.d.ts +187 -0
- package/{src/ellipsoid/Ellipsoid.ts → lib/js/ellipsoid/Ellipsoid.js} +85 -267
- package/lib/js/ellipsoid/index.d.ts +3 -0
- package/lib/js/ellipsoid/index.js +3 -0
- package/lib/js/ellipsoid/wgs84.d.ts +6 -0
- package/{src/ellipsoid/wgs84.ts → lib/js/ellipsoid/wgs84.js} +1 -2
- package/lib/js/entity/BaseBillboard.d.ts +222 -0
- package/{src/entity/BaseBillboard.ts → lib/js/entity/BaseBillboard.js} +48 -165
- package/lib/js/entity/BaseBillboardHandler.d.ts +81 -0
- package/{src/entity/BaseBillboardHandler.ts → lib/js/entity/BaseBillboardHandler.js} +139 -365
- package/lib/js/entity/Billboard.d.ts +113 -0
- package/{src/entity/Billboard.ts → lib/js/entity/Billboard.js} +19 -83
- package/lib/js/entity/BillboardHandler.d.ts +15 -0
- package/{src/entity/BillboardHandler.ts → lib/js/entity/BillboardHandler.js} +27 -59
- package/lib/js/entity/Entity.d.ts +354 -0
- package/{src/entity/Entity.ts → lib/js/entity/Entity.js} +102 -374
- package/lib/js/entity/EntityCollection.d.ts +363 -0
- package/{src/entity/EntityCollection.ts → lib/js/entity/EntityCollection.js} +57 -359
- package/lib/js/entity/GeoObject.d.ts +138 -0
- package/{src/entity/GeoObject.ts → lib/js/entity/GeoObject.js} +41 -146
- package/lib/js/entity/GeoObjectHandler.d.ts +99 -0
- package/{src/entity/GeoObjectHandler.ts → lib/js/entity/GeoObjectHandler.js} +162 -423
- package/lib/js/entity/Geometry.d.ts +111 -0
- package/lib/js/entity/Geometry.js +283 -0
- package/lib/js/entity/GeometryHandler.d.ts +84 -0
- package/{src/entity/GeometryHandler.ts → lib/js/entity/GeometryHandler.js} +162 -657
- package/lib/js/entity/Label.d.ts +207 -0
- package/{src/entity/Label.ts → lib/js/entity/Label.js} +63 -165
- package/lib/js/entity/LabelHandler.d.ts +65 -0
- package/{src/entity/LabelHandler.ts → lib/js/entity/LabelHandler.js} +175 -408
- package/lib/js/entity/LabelWorker.d.ts +15 -0
- package/{src/entity/LabelWorker.ts → lib/js/entity/LabelWorker.js} +24 -45
- package/lib/js/entity/PointCloud.d.ts +179 -0
- package/{src/entity/PointCloud.ts → lib/js/entity/PointCloud.js} +65 -265
- package/lib/js/entity/PointCloudHandler.d.ts +42 -0
- package/{src/entity/PointCloudHandler.ts → lib/js/entity/PointCloudHandler.js} +19 -62
- package/lib/js/entity/Polyline.d.ts +337 -0
- package/{src/entity/Polyline.ts → lib/js/entity/Polyline.js} +289 -924
- package/lib/js/entity/PolylineHandler.d.ts +22 -0
- package/{src/entity/PolylineHandler.ts → lib/js/entity/PolylineHandler.js} +12 -37
- package/lib/js/entity/Ray.d.ts +133 -0
- package/{src/entity/Ray.ts → lib/js/entity/Ray.js} +26 -146
- package/lib/js/entity/RayHandler.d.ts +70 -0
- package/{src/entity/RayHandler.ts → lib/js/entity/RayHandler.js} +102 -342
- package/lib/js/entity/Strip.d.ts +127 -0
- package/{src/entity/Strip.ts → lib/js/entity/Strip.js} +102 -372
- package/lib/js/entity/StripHandler.d.ts +42 -0
- package/{src/entity/StripHandler.ts → lib/js/entity/StripHandler.js} +22 -74
- package/{src/entity/index.ts → lib/js/entity/index.d.ts} +1 -2
- package/lib/js/entity/index.js +11 -0
- package/lib/js/index.d.ts +33 -0
- package/lib/js/index.js +33 -0
- package/lib/js/input/KeyboardHandler.d.ts +33 -0
- package/{src/input/KeyboardHandler.ts → lib/js/input/KeyboardHandler.js} +45 -84
- package/lib/js/input/MouseHandler.d.ts +16 -0
- package/{src/input/MouseHandler.ts → lib/js/input/MouseHandler.js} +12 -36
- package/lib/js/input/TouchHandler.d.ts +11 -0
- package/{src/input/TouchHandler.ts → lib/js/input/TouchHandler.js} +11 -23
- package/lib/js/input/input.d.ts +3 -0
- package/{src/input/input.ts → lib/js/input/input.js} +1 -1
- package/lib/js/layer/BaseGeoImage.d.ts +145 -0
- package/{src/layer/BaseGeoImage.ts → lib/js/layer/BaseGeoImage.js} +70 -235
- package/lib/js/layer/CanvasTiles.d.ts +103 -0
- package/{src/layer/CanvasTiles.ts → lib/js/layer/CanvasTiles.js} +54 -146
- package/lib/js/layer/GeoImage.d.ts +61 -0
- package/{src/layer/GeoImage.ts → lib/js/layer/GeoImage.js} +24 -54
- package/lib/js/layer/GeoTexture2d.d.ts +17 -0
- package/lib/js/layer/GeoTexture2d.js +37 -0
- package/lib/js/layer/GeoVideo.d.ts +68 -0
- package/{src/layer/GeoVideo.ts → lib/js/layer/GeoVideo.js} +31 -61
- package/lib/js/layer/KML.d.ts +72 -0
- package/{src/layer/KML.ts → lib/js/layer/KML.js} +94 -138
- package/lib/js/layer/Layer.d.ts +401 -0
- package/{src/layer/Layer.ts → lib/js/layer/Layer.js} +92 -443
- package/lib/js/layer/Material.d.ts +34 -0
- package/{src/layer/Material.ts → lib/js/layer/Material.js} +9 -43
- package/lib/js/layer/Vector.d.ts +243 -0
- package/{src/layer/Vector.ts → lib/js/layer/Vector.js} +155 -426
- package/lib/js/layer/WMS.d.ts +75 -0
- package/{src/layer/WMS.ts → lib/js/layer/WMS.js} +18 -100
- package/lib/js/layer/XYZ.d.ts +149 -0
- package/{src/layer/XYZ.ts → lib/js/layer/XYZ.js} +71 -171
- package/lib/js/layer/index.d.ts +11 -0
- package/lib/js/layer/index.js +11 -0
- package/lib/js/light/LightSource.d.ts +174 -0
- package/{src/light/LightSource.ts → lib/js/light/LightSource.js} +22 -131
- package/lib/js/math/Line2.d.ts +11 -0
- package/{src/math/Line2.ts → lib/js/math/Line2.js} +5 -15
- package/lib/js/math/Line3.d.ts +28 -0
- package/lib/js/math/Line3.js +85 -0
- package/lib/js/math/Mat3.d.ts +77 -0
- package/{src/math/Mat3.ts → lib/js/math/Mat3.js} +22 -51
- package/lib/js/math/Mat4.d.ts +195 -0
- package/{src/math/Mat4.ts → lib/js/math/Mat4.js} +53 -219
- package/lib/js/math/Plane.d.ts +20 -0
- package/{src/math/Plane.ts → lib/js/math/Plane.js} +26 -40
- package/lib/js/math/Quat.d.ts +373 -0
- package/{src/math/Quat.ts → lib/js/math/Quat.js} +106 -319
- package/lib/js/math/Ray.d.ts +76 -0
- package/{src/math/Ray.ts → lib/js/math/Ray.js} +21 -66
- package/lib/js/math/Vec2.d.ts +310 -0
- package/{src/math/Vec2.ts → lib/js/math/Vec2.js} +55 -121
- package/lib/js/math/Vec3.d.ts +472 -0
- package/{src/math/Vec3.ts → lib/js/math/Vec3.js} +103 -236
- package/lib/js/math/Vec4.d.ts +163 -0
- package/{src/math/Vec4.ts → lib/js/math/Vec4.js} +23 -79
- package/lib/js/math/coder.d.ts +51 -0
- package/{src/math/coder.ts → lib/js/math/coder.js} +14 -20
- package/lib/js/math/index.d.ts +11 -0
- package/lib/js/math/index.js +11 -0
- package/lib/js/math.d.ts +266 -0
- package/{src/math.ts → lib/js/math.js} +37 -85
- package/lib/js/mercator.d.ts +92 -0
- package/{src/mercator.ts → lib/js/mercator.js} +13 -37
- package/lib/js/proj/EPSG3857.d.ts +9 -0
- package/{src/proj/EPSG3857.ts → lib/js/proj/EPSG3857.js} +0 -2
- package/lib/js/proj/EPSG4326.d.ts +9 -0
- package/{src/proj/EPSG4326.ts → lib/js/proj/EPSG4326.js} +0 -2
- package/lib/js/proj/Proj.d.ts +43 -0
- package/{src/proj/Proj.ts → lib/js/proj/Proj.js} +4 -29
- package/lib/js/quadTree/EPSG4326QuadTreeStrategy.d.ts +6 -0
- package/lib/js/quadTree/EPSG4326QuadTreeStrategy.js +17 -0
- package/lib/js/quadTree/EarthQuadTreeStrategy.d.ts +6 -0
- package/lib/js/quadTree/EarthQuadTreeStrategy.js +19 -0
- package/lib/js/quadTree/EntityCollectionNode.d.ts +54 -0
- package/{src/quadTree/EntityCollectionNode.ts → lib/js/quadTree/EntityCollectionNode.js} +83 -150
- package/lib/js/quadTree/MarsQuadTreeStrategy.d.ts +6 -0
- package/lib/js/quadTree/MarsQuadTreeStrategy.js +17 -0
- package/lib/js/quadTree/Node.d.ts +61 -0
- package/{src/quadTree/Node.ts → lib/js/quadTree/Node.js} +140 -357
- package/lib/js/quadTree/QuadTreeStrategy.d.ts +25 -0
- package/{src/quadTree/QuadTreeStrategy.ts → lib/js/quadTree/QuadTreeStrategy.js} +13 -44
- package/lib/js/quadTree/Wgs84QuadTreeStrategy.d.ts +6 -0
- package/lib/js/quadTree/Wgs84QuadTreeStrategy.js +15 -0
- package/lib/js/quadTree/index.d.ts +12 -0
- package/lib/js/quadTree/index.js +12 -0
- package/lib/js/quadTree/quadTree.d.ts +40 -0
- package/{src/quadTree/quadTree.ts → lib/js/quadTree/quadTree.js} +0 -9
- package/lib/js/renderer/Renderer.d.ts +320 -0
- package/{src/renderer/Renderer.ts → lib/js/renderer/Renderer.js} +265 -622
- package/lib/js/renderer/RendererEvents.d.ts +239 -0
- package/{src/renderer/RendererEvents.ts → lib/js/renderer/RendererEvents.js} +158 -472
- package/lib/js/scene/Axes.d.ts +12 -0
- package/lib/js/scene/Axes.js +59 -0
- package/lib/js/scene/BaseNode.d.ts +61 -0
- package/{src/scene/BaseNode.ts → lib/js/scene/BaseNode.js} +11 -57
- package/lib/js/scene/Planet.d.ts +623 -0
- package/{src/scene/Planet.ts → lib/js/scene/Planet.js} +257 -937
- package/lib/js/scene/RenderNode.d.ts +150 -0
- package/{src/scene/RenderNode.ts → lib/js/scene/RenderNode.js} +33 -138
- package/lib/js/scene/SkyBox.d.ts +13 -0
- package/{src/scene/SkyBox.ts → lib/js/scene/SkyBox.js} +16 -37
- package/{src/scene/index.ts → lib/js/scene/index.d.ts} +0 -1
- package/lib/js/scene/index.js +5 -0
- package/lib/js/segment/Segment.d.ts +278 -0
- package/{src/segment/Segment.ts → lib/js/segment/Segment.js} +242 -913
- package/lib/js/segment/SegmentLonLat.d.ts +48 -0
- package/{src/segment/SegmentLonLat.ts → lib/js/segment/SegmentLonLat.js} +58 -132
- package/lib/js/segment/SegmentLonLatWgs84.d.ts +10 -0
- package/lib/js/segment/SegmentLonLatWgs84.js +23 -0
- package/lib/js/segment/Slice.d.ts +13 -0
- package/{src/segment/Slice.ts → lib/js/segment/Slice.js} +4 -22
- package/lib/js/segment/segmentHelper.d.ts +18 -0
- package/{src/segment/segmentHelper.ts → lib/js/segment/segmentHelper.js} +30 -88
- package/lib/js/shaders/atmos.d.ts +4 -0
- package/{src/shaders/atmos.ts → lib/js/shaders/atmos.js} +8 -26
- package/lib/js/shaders/billboard.d.ts +3 -0
- package/{src/shaders/billboard.ts → lib/js/shaders/billboard.js} +9 -18
- package/lib/js/shaders/bloom.d.ts +2 -0
- package/{src/shaders/bloom.ts → lib/js/shaders/bloom.js} +5 -8
- package/lib/js/shaders/blur.d.ts +3 -0
- package/{src/shaders/blur.ts → lib/js/shaders/blur.js} +11 -19
- package/lib/js/shaders/depth.d.ts +2 -0
- package/{src/shaders/depth.ts → lib/js/shaders/depth.js} +3 -6
- package/lib/js/shaders/drawnode.d.ts +8 -0
- package/{src/shaders/drawnode.ts → lib/js/shaders/drawnode.js} +23 -75
- package/lib/js/shaders/geoObject.d.ts +3 -0
- package/{src/shaders/geoObject.ts → lib/js/shaders/geoObject.js} +51 -63
- package/lib/js/shaders/label.d.ts +4 -0
- package/{src/shaders/label.ts → lib/js/shaders/label.js} +12 -25
- package/lib/js/shaders/lumFilter.d.ts +2 -0
- package/{src/shaders/lumFilter.ts → lib/js/shaders/lumFilter.js} +4 -7
- package/lib/js/shaders/pickingMask.d.ts +2 -0
- package/{src/shaders/pickingMask.ts → lib/js/shaders/pickingMask.js} +5 -8
- package/lib/js/shaders/pointCloud.d.ts +2 -0
- package/{src/shaders/pointCloud.ts → lib/js/shaders/pointCloud.js} +4 -7
- package/lib/js/shaders/polyline.d.ts +3 -0
- package/{src/shaders/polyline.ts → lib/js/shaders/polyline.js} +7 -22
- package/lib/js/shaders/ray.d.ts +2 -0
- package/{src/shaders/ray.ts → lib/js/shaders/ray.js} +4 -7
- package/lib/js/shaders/screenFrame.d.ts +2 -0
- package/{src/shaders/screenFrame.ts → lib/js/shaders/screenFrame.js} +5 -8
- package/lib/js/shaders/skybox.d.ts +2 -0
- package/{src/shaders/skybox.ts → lib/js/shaders/skybox.js} +10 -13
- package/lib/js/shaders/toneMapping.d.ts +2 -0
- package/{src/shaders/toneMapping.ts → lib/js/shaders/toneMapping.js} +5 -8
- package/lib/js/shaders/utils.d.ts +1 -0
- package/{src/shaders/utils.ts → lib/js/shaders/utils.js} +1 -1
- package/lib/js/terrain/BilTerrain.d.ts +18 -0
- package/{src/terrain/BilTerrain.ts → lib/js/terrain/BilTerrain.js} +21 -118
- package/lib/js/terrain/EmptyTerrain.d.ts +106 -0
- package/{src/terrain/EmptyTerrain.ts → lib/js/terrain/EmptyTerrain.js} +20 -144
- package/lib/js/terrain/Geoid.d.ts +33 -0
- package/lib/js/terrain/Geoid.js +191 -0
- package/lib/js/terrain/GlobusTerrain.d.ts +134 -0
- package/{src/terrain/GlobusTerrain.ts → lib/js/terrain/GlobusTerrain.js} +84 -241
- package/lib/js/terrain/MapboxTerrain.d.ts +21 -0
- package/{src/terrain/MapboxTerrain.ts → lib/js/terrain/MapboxTerrain.js} +46 -215
- package/{src/terrain/index.ts → lib/js/terrain/index.d.ts} +0 -1
- package/lib/js/terrain/index.js +5 -0
- package/lib/js/ui/Button.d.ts +32 -0
- package/lib/js/ui/Button.js +78 -0
- package/lib/js/ui/ButtonGroup.d.ts +16 -0
- package/lib/js/ui/ButtonGroup.js +41 -0
- package/lib/js/ui/Dialog.d.ts +55 -0
- package/lib/js/ui/Dialog.js +173 -0
- package/lib/js/ui/Slider.d.ts +38 -0
- package/lib/js/ui/Slider.js +129 -0
- package/lib/js/ui/ToggleButton.d.ts +20 -0
- package/lib/js/ui/ToggleButton.js +42 -0
- package/lib/js/ui/View.d.ts +37 -0
- package/{src/ui/View.ts → lib/js/ui/View.js} +31 -77
- package/lib/js/ui/icons.d.ts +1 -0
- package/{src/ui/icons.ts → lib/js/ui/icons.js} +1 -1
- package/lib/js/utils/BaseWorker.d.ts +14 -0
- package/{src/utils/BaseWorker.ts → lib/js/utils/BaseWorker.js} +15 -28
- package/lib/js/utils/FontAtlas.d.ts +82 -0
- package/{src/utils/FontAtlas.ts → lib/js/utils/FontAtlas.js} +46 -182
- package/lib/js/utils/GeoImageCreator.d.ts +34 -0
- package/{src/utils/GeoImageCreator.ts → lib/js/utils/GeoImageCreator.js} +34 -91
- package/lib/js/utils/ImagesCacheManager.d.ts +22 -0
- package/{src/utils/ImagesCacheManager.ts → lib/js/utils/ImagesCacheManager.js} +16 -38
- package/lib/js/utils/Loader.d.ts +63 -0
- package/lib/js/utils/Loader.js +156 -0
- package/lib/js/utils/NormalMapCreator.d.ts +52 -0
- package/{src/utils/NormalMapCreator.ts → lib/js/utils/NormalMapCreator.js} +64 -195
- package/lib/js/utils/PlainSegmentWorker.d.ts +24 -0
- package/{src/utils/PlainSegmentWorker.ts → lib/js/utils/PlainSegmentWorker.js} +24 -56
- package/lib/js/utils/TerrainWorker.d.ts +28 -0
- package/{src/utils/TerrainWorker.ts → lib/js/utils/TerrainWorker.js} +19 -56
- package/lib/js/utils/TextureAtlas.d.ts +113 -0
- package/{src/utils/TextureAtlas.ts → lib/js/utils/TextureAtlas.js} +40 -131
- package/lib/js/utils/VectorTileCreator.d.ts +18 -0
- package/{src/utils/VectorTileCreator.ts → lib/js/utils/VectorTileCreator.js} +61 -147
- package/lib/js/utils/colorTable.d.ts +3 -0
- package/{src/utils/colorTable.ts → lib/js/utils/colorTable.js} +2 -2
- package/lib/js/utils/earcut.d.ts +7 -0
- package/{src/utils/earcut.ts → lib/js/utils/earcut.js} +95 -223
- package/lib/js/utils/objParser.d.ts +24 -0
- package/{src/utils/objParser.ts → lib/js/utils/objParser.js} +38 -93
- package/lib/js/utils/shared.d.ts +267 -0
- package/{src/utils/shared.ts → lib/js/utils/shared.js} +185 -342
- package/lib/js/utils/units.d.ts +16 -0
- package/lib/js/utils/units.js +61 -0
- package/lib/js/webgl/BaseFramebuffer.d.ts +53 -0
- package/{src/webgl/BaseFramebuffer.ts → lib/js/webgl/BaseFramebuffer.js} +22 -59
- package/lib/js/webgl/Framebuffer.d.ts +69 -0
- package/{src/webgl/Framebuffer.ts → lib/js/webgl/Framebuffer.js} +30 -87
- package/lib/js/webgl/Handler.d.ts +473 -0
- package/{src/webgl/Handler.ts → lib/js/webgl/Handler.js} +175 -586
- package/lib/js/webgl/Multisample.d.ts +27 -0
- package/lib/js/webgl/Multisample.js +77 -0
- package/lib/js/webgl/Program.d.ts +159 -0
- package/{src/webgl/Program.ts → lib/js/webgl/Program.js} +73 -210
- package/lib/js/webgl/ProgramController.d.ts +86 -0
- package/{src/webgl/ProgramController.ts → lib/js/webgl/ProgramController.js} +11 -45
- package/{src/webgl/index.ts → lib/js/webgl/index.d.ts} +1 -8
- package/lib/js/webgl/index.js +6 -0
- package/lib/js/webgl/types.d.ts +9 -0
- package/{src/webgl/types.ts → lib/js/webgl/types.js} +5 -8
- package/lib/js/webgl/variableHandlers.d.ts +22 -0
- package/lib/js/webgl/variableHandlers.js +78 -0
- package/package.json +23 -34
- package/dist/@openglobus/og.esm.js +0 -2
- package/dist/@openglobus/og.esm.js.map +0 -1
- package/dist/@openglobus/og.umd.js +0 -2
- package/dist/@openglobus/og.umd.js.map +0 -1
- package/src/Deferred.ts +0 -17
- package/src/control/MouseWheelZoomControl.ts +0 -269
- package/src/control/ScaleControl.ts +0 -131
- package/src/control/SegmentBoundVisualization.ts +0 -50
- package/src/control/ShowFps.ts +0 -28
- package/src/control/ToggleWireframe.ts +0 -35
- package/src/control/ruler/Ruler.ts +0 -35
- package/src/control/ruler/RulerScene.ts +0 -437
- package/src/control/timeline/timelineUtils.ts +0 -133
- package/src/ellipsoid/index.ts +0 -4
- package/src/entity/Geometry.ts +0 -486
- package/src/index.ts +0 -173
- package/src/layer/GeoTexture2d.ts +0 -56
- package/src/layer/index.ts +0 -12
- package/src/math/Line3.ts +0 -162
- package/src/math/index.ts +0 -26
- package/src/quadTree/EPSG4326QuadTreeStrategy.ts +0 -24
- package/src/quadTree/EarthQuadTreeStrategy.ts +0 -28
- package/src/quadTree/MarsQuadTreeStrategy.ts +0 -25
- package/src/quadTree/Wgs84QuadTreeStrategy.ts +0 -22
- package/src/quadTree/index.ts +0 -14
- package/src/scene/Axes.ts +0 -78
- package/src/segment/SegmentLonLatWgs84.ts +0 -33
- package/src/terrain/Geoid.ts +0 -273
- package/src/ui/Button.ts +0 -121
- package/src/ui/ButtonGroup.ts +0 -63
- package/src/ui/Dialog.ts +0 -244
- package/src/ui/Slider.ts +0 -188
- package/src/ui/ToggleButton.ts +0 -68
- package/src/utils/Loader.ts +0 -247
- package/src/utils/units.ts +0 -78
- package/src/webgl/Multisample.ts +0 -153
- package/src/webgl/variableHandlers.ts +0 -114
- /package/{dist → lib}/@openglobus/og.css +0 -0
- /package/{dist → lib}/@openglobus/res/fonts/Karla-Bold.json +0 -0
- /package/{dist → lib}/@openglobus/res/fonts/Karla-Bold.ttf.cfg +0 -0
- /package/{dist → lib}/@openglobus/res/fonts/Karla-Bold.ttf.png +0 -0
- /package/{dist → lib}/@openglobus/res/fonts/Karla-Light.json +0 -0
- /package/{dist → lib}/@openglobus/res/fonts/Karla-Light.ttf.cfg +0 -0
- /package/{dist → lib}/@openglobus/res/fonts/Karla-Light.ttf.png +0 -0
- /package/{dist → lib}/@openglobus/res/fonts/Karla-Medium.json +0 -0
- /package/{dist → lib}/@openglobus/res/fonts/Karla-Medium.ttf.cfg +0 -0
- /package/{dist → lib}/@openglobus/res/fonts/Karla-Medium.ttf.png +0 -0
- /package/{dist → lib}/@openglobus/res/fonts/NotoSansArabic-Regular.json +0 -0
- /package/{dist → lib}/@openglobus/res/fonts/NotoSansArabic-Regular.ttf.cfg +0 -0
- /package/{dist → lib}/@openglobus/res/fonts/NotoSansArabic-Regular.ttf.png +0 -0
- /package/{dist → lib}/@openglobus/res/fonts/Roboto-Regular.json +0 -0
- /package/{dist → lib}/@openglobus/res/fonts/Roboto-Regular.ttf.cfg +0 -0
- /package/{dist → lib}/@openglobus/res/fonts/Roboto-Regular.ttf.png +0 -0
- /package/{dist → lib}/@openglobus/res/fonts/arial.js +0 -0
- /package/{dist → lib}/@openglobus/res/fonts/arial.json +0 -0
- /package/{dist → lib}/@openglobus/res/fonts/arial.ttf.cfg +0 -0
- /package/{dist → lib}/@openglobus/res/fonts/arial.ttf.png +0 -0
- /package/{dist → lib}/@openglobus/res/night-4326.png +0 -0
- /package/{dist → lib}/@openglobus/res/night.png +0 -0
- /package/{dist → lib}/@openglobus/res/spec.png +0 -0
|
@@ -1,54 +1,15 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
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";
|
|
11
|
-
import {
|
|
12
|
-
cloneArray, htmlColorToFloat32Array,
|
|
13
|
-
htmlColorToRgba, makeArray, makeArrayTyped, TypedArray
|
|
14
|
-
} from "../utils/shared";
|
|
15
|
-
import {Ellipsoid} from "../ellipsoid/Ellipsoid";
|
|
16
|
-
|
|
1
|
+
import { Extent } from "../Extent";
|
|
2
|
+
import { LonLat } from "../LonLat";
|
|
3
|
+
import { Vec3 } from "../math/Vec3";
|
|
4
|
+
import { cloneArray, htmlColorToFloat32Array, htmlColorToRgba, makeArray, makeArrayTyped } from "../utils/shared";
|
|
17
5
|
const VERTICES_BUFFER = 0;
|
|
18
6
|
const INDEX_BUFFER = 1;
|
|
19
7
|
const COLORS_BUFFER = 2;
|
|
20
|
-
|
|
21
8
|
const DEFAULT_COLOR = "#0000FF";
|
|
22
|
-
|
|
23
9
|
const R = 0;
|
|
24
10
|
const G = 1;
|
|
25
11
|
const B = 2;
|
|
26
12
|
const A = 3;
|
|
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
|
-
|
|
52
13
|
/**
|
|
53
14
|
* Polyline object.
|
|
54
15
|
* @class
|
|
@@ -64,300 +25,117 @@ export interface IPolylineParams {
|
|
|
64
25
|
* @param {SegmentPathColor[]} [options.pathColors] - Coordinates color. [[[1,0,0,1], [0,1,0,1],...]] for right and green colors.
|
|
65
26
|
*/
|
|
66
27
|
class Polyline {
|
|
67
|
-
|
|
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[];
|
|
171
|
-
|
|
172
|
-
constructor(options: IPolylineParams = {}) {
|
|
173
|
-
|
|
28
|
+
constructor(options = {}) {
|
|
174
29
|
this.__id = Polyline.__counter__++;
|
|
175
|
-
|
|
176
30
|
this.altitude = options.altitude || 0.0;
|
|
177
|
-
|
|
178
31
|
this.thickness = options.thickness || 1.5;
|
|
179
|
-
|
|
180
32
|
this._opacity = options.opacity != undefined ? options.opacity : 1.0;
|
|
181
|
-
|
|
182
|
-
this._defaultColor = htmlColorToFloat32Array(
|
|
183
|
-
options.color || DEFAULT_COLOR,
|
|
184
|
-
options.opacity
|
|
185
|
-
);
|
|
186
|
-
|
|
33
|
+
this._defaultColor = htmlColorToFloat32Array(options.color || DEFAULT_COLOR, options.opacity);
|
|
187
34
|
this.visibility = options.visibility != undefined ? options.visibility : true;
|
|
188
|
-
|
|
189
35
|
this._closedLine = options.isClosed || false;
|
|
190
|
-
|
|
191
36
|
this._path3v = [];
|
|
192
|
-
|
|
193
37
|
this._pathLengths = [];
|
|
194
|
-
|
|
195
38
|
this._pathLonLat = [];
|
|
196
|
-
|
|
197
39
|
this._pathLonLatMerc = [];
|
|
198
|
-
|
|
199
40
|
this._pathColors = options.pathColors ? cloneArray(options.pathColors) : [];
|
|
200
|
-
|
|
201
41
|
this._extent = new Extent();
|
|
202
|
-
|
|
203
42
|
this._verticesHigh = [];
|
|
204
43
|
this._verticesLow = [];
|
|
205
44
|
this._orders = [];
|
|
206
45
|
this._indexes = [];
|
|
207
46
|
this._colors = [];
|
|
208
|
-
|
|
209
47
|
this._verticesHighBuffer = null;
|
|
210
48
|
this._verticesLowBuffer = null;
|
|
211
49
|
this._ordersBuffer = null;
|
|
212
50
|
this._indexesBuffer = null;
|
|
213
51
|
this._colorsBuffer = null;
|
|
214
|
-
|
|
215
52
|
this._pickingColor = [0, 0, 0];
|
|
216
|
-
|
|
217
53
|
this._renderNode = null;
|
|
218
|
-
|
|
219
54
|
this._entity = null;
|
|
220
|
-
|
|
221
|
-
|
|
222
55
|
this._handler = null;
|
|
223
56
|
this._handlerIndex = -1;
|
|
224
|
-
|
|
225
57
|
this._buffersUpdateCallbacks = [];
|
|
226
58
|
this._buffersUpdateCallbacks[VERTICES_BUFFER] = this._createVerticesBuffer;
|
|
227
59
|
this._buffersUpdateCallbacks[INDEX_BUFFER] = this._createIndexBuffer;
|
|
228
60
|
this._buffersUpdateCallbacks[COLORS_BUFFER] = this._createColorsBuffer;
|
|
229
|
-
|
|
230
61
|
this._changedBuffers = new Array(this._buffersUpdateCallbacks.length);
|
|
231
|
-
|
|
232
62
|
// create path
|
|
233
63
|
if (options.pathLonLat) {
|
|
234
64
|
this.setPathLonLat(options.pathLonLat);
|
|
235
|
-
}
|
|
65
|
+
}
|
|
66
|
+
else if (options.path3v) {
|
|
236
67
|
this.setPath3v(options.path3v);
|
|
237
68
|
}
|
|
238
|
-
|
|
239
69
|
this._refresh();
|
|
240
70
|
}
|
|
241
|
-
|
|
242
71
|
/**
|
|
243
72
|
* Appends to the line array new cartesian coordinates line data.
|
|
244
73
|
* @static
|
|
245
74
|
*/
|
|
246
|
-
static appendLineData3v(
|
|
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[]
|
|
261
|
-
) {
|
|
75
|
+
static appendLineData3v(path3v, pathColors, defaultColor, isClosed, outVerticesHigh, outVerticesLow, outOrders, outIndexes, ellipsoid, outTransformedPathLonLat, outPath3v, outTransformedPathMerc, outExtent, outColors) {
|
|
262
76
|
var index = 0;
|
|
263
|
-
|
|
264
|
-
var v_high = new Vec3(),
|
|
265
|
-
v_low = new Vec3();
|
|
266
|
-
|
|
77
|
+
var v_high = new Vec3(), v_low = new Vec3();
|
|
267
78
|
if (outExtent) {
|
|
268
79
|
outExtent.southWest.set(180.0, 90.0);
|
|
269
80
|
outExtent.northEast.set(-180.0, -90.0);
|
|
270
81
|
}
|
|
271
|
-
|
|
272
82
|
if (outIndexes.length > 0) {
|
|
273
83
|
index = outIndexes[outIndexes.length - 5] + 9;
|
|
274
84
|
outIndexes.push(index, index);
|
|
275
|
-
}
|
|
85
|
+
}
|
|
86
|
+
else {
|
|
276
87
|
outIndexes.push(0, 0);
|
|
277
88
|
}
|
|
278
|
-
|
|
279
89
|
for (let j = 0, len = path3v.length; j < len; j++) {
|
|
280
|
-
var path = path3v[j],
|
|
281
|
-
pathColors_j = pathColors[j];
|
|
282
|
-
|
|
90
|
+
var path = path3v[j], pathColors_j = pathColors[j];
|
|
283
91
|
outTransformedPathLonLat[j] = [];
|
|
284
92
|
outTransformedPathMerc[j] = [];
|
|
285
93
|
outPath3v[j] = [];
|
|
286
|
-
|
|
287
94
|
if (path.length === 0) {
|
|
288
95
|
continue;
|
|
289
96
|
}
|
|
290
|
-
|
|
291
97
|
var startIndex = index;
|
|
292
|
-
|
|
293
98
|
var last;
|
|
294
|
-
|
|
295
99
|
if (isClosed) {
|
|
296
100
|
last = path[path.length - 1];
|
|
297
101
|
if (last instanceof Array) {
|
|
298
102
|
last = new Vec3(last[0], last[1], last[2]);
|
|
299
103
|
}
|
|
300
|
-
}
|
|
301
|
-
|
|
302
|
-
|
|
104
|
+
}
|
|
105
|
+
else {
|
|
106
|
+
var p0 = path[0], p1 = path[1] || p0;
|
|
303
107
|
if (p0 instanceof Array) {
|
|
304
108
|
p0 = new Vec3(p0[0], p0[1], p0[2]);
|
|
305
109
|
}
|
|
306
110
|
if (p1 instanceof Array) {
|
|
307
111
|
p1 = new Vec3(p1[0], p1[1], p1[2]);
|
|
308
112
|
}
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
p1 = p1 as Vec3;
|
|
312
|
-
|
|
113
|
+
p0 = p0;
|
|
114
|
+
p1 = p1;
|
|
313
115
|
last = new Vec3(p0.x + p0.x - p1.x, p0.y + p0.y - p1.y, p0.z + p0.z - p1.z);
|
|
314
116
|
}
|
|
315
|
-
|
|
316
117
|
let color = defaultColor;
|
|
317
|
-
|
|
318
118
|
if (pathColors_j && pathColors_j[0]) {
|
|
319
119
|
color = pathColors_j[0];
|
|
320
120
|
}
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
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
|
|
328
|
-
);
|
|
329
|
-
outVerticesLow.push(
|
|
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
|
|
334
|
-
);
|
|
335
|
-
|
|
336
|
-
let r = color[R],
|
|
337
|
-
g = color[G],
|
|
338
|
-
b = color[B],
|
|
339
|
-
a = color[A] != undefined ? color[A] : 1.0;
|
|
340
|
-
|
|
121
|
+
Vec3.doubleToTwoFloats(last, v_high, v_low);
|
|
122
|
+
outVerticesHigh.push(v_high.x, v_high.y, v_high.z, v_high.x, v_high.y, v_high.z, v_high.x, v_high.y, v_high.z, v_high.x, v_high.y, v_high.z);
|
|
123
|
+
outVerticesLow.push(v_low.x, v_low.y, v_low.z, v_low.x, v_low.y, v_low.z, v_low.x, v_low.y, v_low.z, v_low.x, v_low.y, v_low.z);
|
|
124
|
+
let r = color[R], g = color[G], b = color[B], a = color[A] != undefined ? color[A] : 1.0;
|
|
341
125
|
if (j > 0) {
|
|
342
126
|
outColors.push(r, g, b, a, r, g, b, a, r, g, b, a, r, g, b, a);
|
|
343
127
|
}
|
|
344
|
-
|
|
345
128
|
outOrders.push(1, -1, 2, -2);
|
|
346
|
-
|
|
347
129
|
for (let i = 0, len = path.length; i < len; i++) {
|
|
348
130
|
var cur = path[i];
|
|
349
|
-
|
|
350
131
|
if (cur instanceof Array) {
|
|
351
132
|
cur = new Vec3(cur[0], cur[1], cur[2]);
|
|
352
133
|
}
|
|
353
|
-
|
|
354
|
-
outPath3v[j].push(cur as Vec3);
|
|
355
|
-
|
|
134
|
+
outPath3v[j].push(cur);
|
|
356
135
|
if (ellipsoid) {
|
|
357
|
-
var lonLat = ellipsoid.cartesianToLonLat(cur
|
|
136
|
+
var lonLat = ellipsoid.cartesianToLonLat(cur);
|
|
358
137
|
outTransformedPathLonLat[j].push(lonLat);
|
|
359
138
|
outTransformedPathMerc[j].push(lonLat.forwardMercator());
|
|
360
|
-
|
|
361
139
|
if (lonLat.lon < outExtent.southWest.lon) {
|
|
362
140
|
outExtent.southWest.lon = lonLat.lon;
|
|
363
141
|
}
|
|
@@ -371,36 +149,20 @@ class Polyline {
|
|
|
371
149
|
outExtent.northEast.lat = lonLat.lat;
|
|
372
150
|
}
|
|
373
151
|
}
|
|
374
|
-
|
|
375
152
|
if (pathColors_j && pathColors_j[i]) {
|
|
376
153
|
color = pathColors_j[i];
|
|
377
154
|
}
|
|
378
|
-
|
|
379
155
|
r = color[R];
|
|
380
156
|
g = color[G];
|
|
381
157
|
b = color[B];
|
|
382
158
|
a = color[A] != undefined ? color[A] : 1.0;
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
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
|
|
390
|
-
);
|
|
391
|
-
outVerticesLow.push(
|
|
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
|
|
396
|
-
);
|
|
397
|
-
|
|
159
|
+
Vec3.doubleToTwoFloats(cur, v_high, v_low);
|
|
160
|
+
outVerticesHigh.push(v_high.x, v_high.y, v_high.z, v_high.x, v_high.y, v_high.z, v_high.x, v_high.y, v_high.z, v_high.x, v_high.y, v_high.z);
|
|
161
|
+
outVerticesLow.push(v_low.x, v_low.y, v_low.z, v_low.x, v_low.y, v_low.z, v_low.x, v_low.y, v_low.z, v_low.x, v_low.y, v_low.z);
|
|
398
162
|
outColors.push(r, g, b, a, r, g, b, a, r, g, b, a, r, g, b, a);
|
|
399
|
-
|
|
400
163
|
outOrders.push(1, -1, 2, -2);
|
|
401
164
|
outIndexes.push(index++, index++, index++, index++);
|
|
402
165
|
}
|
|
403
|
-
|
|
404
166
|
var first;
|
|
405
167
|
if (isClosed) {
|
|
406
168
|
first = path[0];
|
|
@@ -408,115 +170,70 @@ class Polyline {
|
|
|
408
170
|
first = new Vec3(first[0], first[1], first[2]);
|
|
409
171
|
}
|
|
410
172
|
outIndexes.push(startIndex, startIndex + 1, startIndex + 1, startIndex + 1);
|
|
411
|
-
}
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
173
|
+
}
|
|
174
|
+
else {
|
|
175
|
+
let p0 = path[path.length - 1], p1 = path[path.length - 2] || p0;
|
|
415
176
|
if (p0 instanceof Array) {
|
|
416
177
|
p0 = new Vec3(p0[0], p0[1], p0[2]);
|
|
417
|
-
} else {
|
|
418
|
-
p0 = p0 as Vec3;
|
|
419
178
|
}
|
|
420
|
-
|
|
179
|
+
else {
|
|
180
|
+
p0 = p0;
|
|
181
|
+
}
|
|
421
182
|
if (p1 instanceof Array) {
|
|
422
183
|
p1 = new Vec3(p1[0], p1[1], p1[2]);
|
|
423
|
-
} else {
|
|
424
|
-
p1 = p1 as Vec3;
|
|
425
184
|
}
|
|
426
|
-
|
|
185
|
+
else {
|
|
186
|
+
p1 = p1;
|
|
187
|
+
}
|
|
427
188
|
first = new Vec3(p0.x + p0.x - p1.x, p0.y + p0.y - p1.y, p0.z + p0.z - p1.z);
|
|
428
189
|
outIndexes.push(index - 1, index - 1, index - 1, index - 1);
|
|
429
190
|
}
|
|
430
|
-
|
|
431
191
|
if (pathColors_j && pathColors_j[path.length - 1]) {
|
|
432
192
|
color = pathColors_j[path.length - 1];
|
|
433
193
|
}
|
|
434
|
-
|
|
435
194
|
r = color[R];
|
|
436
195
|
g = color[G];
|
|
437
196
|
b = color[B];
|
|
438
197
|
a = color[A] != undefined ? color[A] : 1.0;
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
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
|
|
446
|
-
);
|
|
447
|
-
outVerticesLow.push(
|
|
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
|
|
452
|
-
);
|
|
453
|
-
|
|
198
|
+
Vec3.doubleToTwoFloats(first, v_high, v_low);
|
|
199
|
+
outVerticesHigh.push(v_high.x, v_high.y, v_high.z, v_high.x, v_high.y, v_high.z, v_high.x, v_high.y, v_high.z, v_high.x, v_high.y, v_high.z);
|
|
200
|
+
outVerticesLow.push(v_low.x, v_low.y, v_low.z, v_low.x, v_low.y, v_low.z, v_low.x, v_low.y, v_low.z, v_low.x, v_low.y, v_low.z);
|
|
454
201
|
outColors.push(r, g, b, a, r, g, b, a, r, g, b, a, r, g, b, a);
|
|
455
|
-
|
|
456
202
|
outOrders.push(1, -1, 2, -2);
|
|
457
|
-
|
|
458
203
|
if (j < path3v.length - 1 && path3v[j + 1].length !== 0) {
|
|
459
204
|
index += 8;
|
|
460
205
|
outIndexes.push(index, index);
|
|
461
206
|
}
|
|
462
207
|
}
|
|
463
208
|
}
|
|
464
|
-
|
|
465
209
|
/**
|
|
466
210
|
* Appends to the line new cartesian coordinates point data.
|
|
467
211
|
* @static
|
|
468
212
|
*/
|
|
469
|
-
static appendPoint3v(
|
|
470
|
-
|
|
471
|
-
|
|
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
|
|
484
|
-
) {
|
|
485
|
-
var v_high = new Vec3(),
|
|
486
|
-
v_low = new Vec3();
|
|
487
|
-
|
|
488
|
-
var ii = outIndexes.length - 4,
|
|
489
|
-
index = outIndexes[ii - 1] + 1;
|
|
490
|
-
|
|
213
|
+
static appendPoint3v(path3v, point3v, pathColors, color, isClosed, outVerticesHigh, outVerticesLow, outColors, outOrders, outIndexes, ellipsoid, outTransformedPathLonLat, outTransformedPathMerc, outExtent) {
|
|
214
|
+
var v_high = new Vec3(), v_low = new Vec3();
|
|
215
|
+
var ii = outIndexes.length - 4, index = outIndexes[ii - 1] + 1;
|
|
491
216
|
if (path3v.length === 0) {
|
|
492
217
|
path3v.push([]);
|
|
493
218
|
if (!pathColors[0]) {
|
|
494
219
|
pathColors[0] = [];
|
|
495
220
|
}
|
|
496
|
-
}
|
|
221
|
+
}
|
|
222
|
+
else if (!pathColors[path3v.length - 1]) {
|
|
497
223
|
pathColors[path3v.length - 1] = [];
|
|
498
224
|
}
|
|
499
|
-
|
|
500
|
-
var path = path3v[path3v.length - 1],
|
|
501
|
-
len = path.length;
|
|
502
|
-
|
|
225
|
+
var path = path3v[path3v.length - 1], len = path.length;
|
|
503
226
|
path.push(point3v);
|
|
504
|
-
|
|
505
|
-
let r = color[R],
|
|
506
|
-
g = color[G],
|
|
507
|
-
b = color[B],
|
|
508
|
-
a = color[A] != undefined ? color[A] : 1.0,
|
|
509
|
-
pathColors_last = pathColors[path3v.length - 1];
|
|
510
|
-
|
|
227
|
+
let r = color[R], g = color[G], b = color[B], a = color[A] != undefined ? color[A] : 1.0, pathColors_last = pathColors[path3v.length - 1];
|
|
511
228
|
if (pathColors_last[len]) {
|
|
512
229
|
pathColors_last[len][R] = r;
|
|
513
230
|
pathColors_last[len][G] = g;
|
|
514
231
|
pathColors_last[len][B] = b;
|
|
515
232
|
pathColors_last[len][A] = a;
|
|
516
|
-
}
|
|
233
|
+
}
|
|
234
|
+
else {
|
|
517
235
|
pathColors_last.push(color);
|
|
518
236
|
}
|
|
519
|
-
|
|
520
237
|
if (len === 1) {
|
|
521
238
|
var last;
|
|
522
239
|
if (isClosed) {
|
|
@@ -524,29 +241,25 @@ class Polyline {
|
|
|
524
241
|
if (last instanceof Array) {
|
|
525
242
|
last = new Vec3(last[0], last[1], last[2]);
|
|
526
243
|
}
|
|
527
|
-
}
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
244
|
+
}
|
|
245
|
+
else {
|
|
246
|
+
let p0 = path[0], p1 = path[1] || p0;
|
|
531
247
|
if (p0 instanceof Array) {
|
|
532
248
|
p0 = new Vec3(p0[0], p0[1], p0[2]);
|
|
533
|
-
} else {
|
|
534
|
-
p0 = p0 as Vec3;
|
|
535
249
|
}
|
|
536
|
-
|
|
250
|
+
else {
|
|
251
|
+
p0 = p0;
|
|
252
|
+
}
|
|
537
253
|
if (p1 instanceof Array) {
|
|
538
254
|
p1 = new Vec3(p1[0], p1[1], p1[2]);
|
|
539
|
-
} else {
|
|
540
|
-
p1 = p1 as Vec3;
|
|
541
255
|
}
|
|
542
|
-
|
|
256
|
+
else {
|
|
257
|
+
p1 = p1;
|
|
258
|
+
}
|
|
543
259
|
last = new Vec3(p0.x + p0.x - p1.x, p0.y + p0.y - p1.y, p0.z + p0.z - p1.z);
|
|
544
260
|
}
|
|
545
|
-
|
|
546
|
-
Vec3.doubleToTwoFloats(last as Vec3, v_high, v_low);
|
|
547
|
-
|
|
261
|
+
Vec3.doubleToTwoFloats(last, v_high, v_low);
|
|
548
262
|
let vi = outVerticesHigh.length - 3 * 12;
|
|
549
|
-
|
|
550
263
|
outVerticesHigh[vi] = v_high.x;
|
|
551
264
|
outVerticesHigh[vi + 1] = v_high.y;
|
|
552
265
|
outVerticesHigh[vi + 2] = v_high.z;
|
|
@@ -559,7 +272,6 @@ class Polyline {
|
|
|
559
272
|
outVerticesHigh[vi + 9] = v_high.x;
|
|
560
273
|
outVerticesHigh[vi + 10] = v_high.y;
|
|
561
274
|
outVerticesHigh[vi + 11] = v_high.z;
|
|
562
|
-
|
|
563
275
|
outVerticesLow[vi] = v_low.x;
|
|
564
276
|
outVerticesLow[vi + 1] = v_low.y;
|
|
565
277
|
outVerticesLow[vi + 2] = v_low.z;
|
|
@@ -573,25 +285,18 @@ class Polyline {
|
|
|
573
285
|
outVerticesLow[vi + 10] = v_low.y;
|
|
574
286
|
outVerticesLow[vi + 11] = v_low.z;
|
|
575
287
|
}
|
|
576
|
-
|
|
577
288
|
var startIndex = index;
|
|
578
|
-
|
|
579
289
|
if (ellipsoid) {
|
|
580
290
|
if (outTransformedPathLonLat.length === 0) {
|
|
581
291
|
outTransformedPathLonLat.push([]);
|
|
582
292
|
}
|
|
583
|
-
|
|
584
293
|
if (outTransformedPathMerc.length === 0) {
|
|
585
294
|
outTransformedPathMerc.push([]);
|
|
586
295
|
}
|
|
587
|
-
|
|
588
|
-
var transformedPathLonLat = outTransformedPathLonLat[outTransformedPathLonLat.length - 1],
|
|
589
|
-
transformedPathMerc = outTransformedPathMerc[outTransformedPathMerc.length - 1];
|
|
590
|
-
|
|
296
|
+
var transformedPathLonLat = outTransformedPathLonLat[outTransformedPathLonLat.length - 1], transformedPathMerc = outTransformedPathMerc[outTransformedPathMerc.length - 1];
|
|
591
297
|
let lonLat = ellipsoid.cartesianToLonLat(point3v);
|
|
592
298
|
transformedPathLonLat.push(lonLat);
|
|
593
299
|
transformedPathMerc.push(lonLat.forwardMercator());
|
|
594
|
-
|
|
595
300
|
if (lonLat.lon < outExtent.southWest.lon) {
|
|
596
301
|
outExtent.southWest.lon = lonLat.lon;
|
|
597
302
|
}
|
|
@@ -605,11 +310,8 @@ class Polyline {
|
|
|
605
310
|
outExtent.northEast.lat = lonLat.lat;
|
|
606
311
|
}
|
|
607
312
|
}
|
|
608
|
-
|
|
609
313
|
Vec3.doubleToTwoFloats(point3v, v_high, v_low);
|
|
610
|
-
|
|
611
314
|
let vi = outVerticesHigh.length - 12;
|
|
612
|
-
|
|
613
315
|
outVerticesHigh[vi] = v_high.x;
|
|
614
316
|
outVerticesHigh[vi + 1] = v_high.y;
|
|
615
317
|
outVerticesHigh[vi + 2] = v_high.z;
|
|
@@ -622,7 +324,6 @@ class Polyline {
|
|
|
622
324
|
outVerticesHigh[vi + 9] = v_high.x;
|
|
623
325
|
outVerticesHigh[vi + 10] = v_high.y;
|
|
624
326
|
outVerticesHigh[vi + 11] = v_high.z;
|
|
625
|
-
|
|
626
327
|
outVerticesLow[vi] = v_low.x;
|
|
627
328
|
outVerticesLow[vi + 1] = v_low.y;
|
|
628
329
|
outVerticesLow[vi + 2] = v_low.z;
|
|
@@ -635,9 +336,7 @@ class Polyline {
|
|
|
635
336
|
outVerticesLow[vi + 9] = v_low.x;
|
|
636
337
|
outVerticesLow[vi + 10] = v_low.y;
|
|
637
338
|
outVerticesLow[vi + 11] = v_low.z;
|
|
638
|
-
|
|
639
339
|
let ci = outColors.length - 16;
|
|
640
|
-
|
|
641
340
|
outColors[ci] = r;
|
|
642
341
|
outColors[ci + 1] = g;
|
|
643
342
|
outColors[ci + 2] = b;
|
|
@@ -654,319 +353,207 @@ class Polyline {
|
|
|
654
353
|
outColors[ci + 13] = g;
|
|
655
354
|
outColors[ci + 14] = b;
|
|
656
355
|
outColors[ci + 15] = a;
|
|
657
|
-
|
|
658
356
|
outIndexes[ii] = index++;
|
|
659
357
|
outIndexes[ii + 1] = index++;
|
|
660
358
|
outIndexes[ii + 2] = index++;
|
|
661
359
|
outIndexes[ii + 3] = index++;
|
|
662
|
-
|
|
663
360
|
//
|
|
664
361
|
// Close path
|
|
665
362
|
//
|
|
666
363
|
var first;
|
|
667
364
|
if (isClosed) {
|
|
668
|
-
first = path[0]
|
|
365
|
+
first = path[0];
|
|
669
366
|
outIndexes.push(startIndex, startIndex + 1, startIndex + 1, startIndex + 1);
|
|
670
|
-
}
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
367
|
+
}
|
|
368
|
+
else {
|
|
369
|
+
let p0 = path[path.length - 1], p1 = path[path.length - 2] || p0;
|
|
674
370
|
first = new Vec3(p0.x + p0.x - p1.x, p0.y + p0.y - p1.y, p0.z + p0.z - p1.z);
|
|
675
371
|
outIndexes.push(index - 1, index - 1, index - 1, index - 1);
|
|
676
372
|
}
|
|
677
|
-
|
|
678
373
|
Vec3.doubleToTwoFloats(first, v_high, v_low);
|
|
679
|
-
outVerticesHigh.push(
|
|
680
|
-
|
|
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
|
|
684
|
-
);
|
|
685
|
-
outVerticesLow.push(
|
|
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
|
|
690
|
-
);
|
|
691
|
-
|
|
374
|
+
outVerticesHigh.push(v_high.x, v_high.y, v_high.z, v_high.x, v_high.y, v_high.z, v_high.x, v_high.y, v_high.z, v_high.x, v_high.y, v_high.z);
|
|
375
|
+
outVerticesLow.push(v_low.x, v_low.y, v_low.z, v_low.x, v_low.y, v_low.z, v_low.x, v_low.y, v_low.z, v_low.x, v_low.y, v_low.z);
|
|
692
376
|
outColors.push(r, g, b, a, r, g, b, a, r, g, b, a, r, g, b, a);
|
|
693
|
-
|
|
694
377
|
outOrders.push(1, -1, 2, -2);
|
|
695
378
|
}
|
|
696
|
-
|
|
697
379
|
/**
|
|
698
380
|
* Appends to the line array new geodetic coordinates line data.
|
|
699
381
|
* @static
|
|
700
382
|
*/
|
|
701
|
-
static appendLineDataLonLat(
|
|
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[]
|
|
716
|
-
) {
|
|
383
|
+
static appendLineDataLonLat(pathLonLat, pathColors, defaultColor, isClosed, outVerticesHigh, outVerticesLow, outOrders, outIndexes, ellipsoid, outTransformedPathCartesian, outPathLonLat, outTransformedPathMerc, outExtent, outColors) {
|
|
717
384
|
var index = 0;
|
|
718
|
-
|
|
719
|
-
var v_high = new Vec3(),
|
|
720
|
-
v_low = new Vec3();
|
|
721
|
-
|
|
385
|
+
var v_high = new Vec3(), v_low = new Vec3();
|
|
722
386
|
if (outExtent) {
|
|
723
387
|
outExtent.southWest.set(180.0, 90.0);
|
|
724
388
|
outExtent.northEast.set(-180.0, -90.0);
|
|
725
389
|
}
|
|
726
|
-
|
|
727
390
|
if (outIndexes.length > 0) {
|
|
728
391
|
index = outIndexes[outIndexes.length - 5] + 9;
|
|
729
392
|
outIndexes.push(index, index);
|
|
730
|
-
}
|
|
393
|
+
}
|
|
394
|
+
else {
|
|
731
395
|
outIndexes.push(0, 0);
|
|
732
396
|
}
|
|
733
|
-
|
|
734
397
|
for (let j = 0, len = pathLonLat.length; j < len; j++) {
|
|
735
|
-
var path = pathLonLat[j],
|
|
736
|
-
pathColors_j = pathColors[j];
|
|
737
|
-
|
|
398
|
+
var path = pathLonLat[j], pathColors_j = pathColors[j];
|
|
738
399
|
outTransformedPathCartesian[j] = [];
|
|
739
400
|
outTransformedPathMerc[j] = [];
|
|
740
401
|
outPathLonLat[j] = [];
|
|
741
|
-
|
|
742
402
|
if (path.length === 0) {
|
|
743
403
|
continue;
|
|
744
404
|
}
|
|
745
|
-
|
|
746
405
|
var startIndex = index;
|
|
747
|
-
|
|
748
406
|
var last;
|
|
749
|
-
|
|
750
407
|
if (isClosed) {
|
|
751
408
|
let pp = path[path.length - 1];
|
|
752
409
|
if (pp instanceof Array) {
|
|
753
410
|
last = ellipsoid.lonLatToCartesian(new LonLat(pp[0], pp[1], pp[2]));
|
|
754
|
-
} else {
|
|
755
|
-
last = ellipsoid.lonLatToCartesian(pp as LonLat);
|
|
756
411
|
}
|
|
757
|
-
|
|
412
|
+
else {
|
|
413
|
+
last = ellipsoid.lonLatToCartesian(pp);
|
|
414
|
+
}
|
|
415
|
+
}
|
|
416
|
+
else {
|
|
758
417
|
let p0, p1;
|
|
759
418
|
let pp = path[0];
|
|
760
419
|
if (pp instanceof Array) {
|
|
761
420
|
p0 = ellipsoid.lonLatToCartesian(new LonLat(pp[0], pp[1], pp[2]));
|
|
762
|
-
} else {
|
|
763
|
-
p0 = ellipsoid.lonLatToCartesian(pp as LonLat);
|
|
764
421
|
}
|
|
765
|
-
|
|
422
|
+
else {
|
|
423
|
+
p0 = ellipsoid.lonLatToCartesian(pp);
|
|
424
|
+
}
|
|
766
425
|
pp = path[1];
|
|
767
|
-
|
|
768
426
|
if (!pp) {
|
|
769
427
|
pp = path[0];
|
|
770
428
|
}
|
|
771
|
-
|
|
772
429
|
if (pp instanceof Array) {
|
|
773
430
|
p1 = ellipsoid.lonLatToCartesian(new LonLat(pp[0], pp[1], pp[2]));
|
|
774
|
-
} else {
|
|
775
|
-
p1 = ellipsoid.lonLatToCartesian(pp as LonLat);
|
|
776
431
|
}
|
|
777
|
-
|
|
432
|
+
else {
|
|
433
|
+
p1 = ellipsoid.lonLatToCartesian(pp);
|
|
434
|
+
}
|
|
778
435
|
last = new Vec3(p0.x + p0.x - p1.x, p0.y + p0.y - p1.y, p0.z + p0.z - p1.z);
|
|
779
436
|
}
|
|
780
|
-
|
|
781
437
|
let color = defaultColor;
|
|
782
|
-
|
|
783
438
|
if (pathColors_j && pathColors_j[0]) {
|
|
784
439
|
color = pathColors_j[0];
|
|
785
440
|
}
|
|
786
|
-
|
|
787
441
|
Vec3.doubleToTwoFloats(last, v_high, v_low);
|
|
788
|
-
outVerticesHigh.push(
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
v_high.x, v_high.y, v_high.z,
|
|
792
|
-
v_high.x, v_high.y, v_high.z
|
|
793
|
-
);
|
|
794
|
-
outVerticesLow.push(
|
|
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
|
|
799
|
-
);
|
|
800
|
-
|
|
801
|
-
let r = color[R],
|
|
802
|
-
g = color[G],
|
|
803
|
-
b = color[B],
|
|
804
|
-
a = color[A] != undefined ? color[A] : 1.0;
|
|
805
|
-
|
|
442
|
+
outVerticesHigh.push(v_high.x, v_high.y, v_high.z, v_high.x, v_high.y, v_high.z, v_high.x, v_high.y, v_high.z, v_high.x, v_high.y, v_high.z);
|
|
443
|
+
outVerticesLow.push(v_low.x, v_low.y, v_low.z, v_low.x, v_low.y, v_low.z, v_low.x, v_low.y, v_low.z, v_low.x, v_low.y, v_low.z);
|
|
444
|
+
let r = color[R], g = color[G], b = color[B], a = color[A] != undefined ? color[A] : 1.0;
|
|
806
445
|
if (j > 0) {
|
|
807
446
|
outColors.push(r, g, b, a, r, g, b, a, r, g, b, a, r, g, b, a);
|
|
808
447
|
}
|
|
809
|
-
|
|
810
448
|
outOrders.push(1, -1, 2, -2);
|
|
811
|
-
|
|
812
449
|
for (let i = 0, len = path.length; i < len; i++) {
|
|
813
450
|
var cur = path[i];
|
|
814
|
-
|
|
815
451
|
if (cur instanceof Array) {
|
|
816
452
|
cur = new LonLat(cur[0], cur[1], cur[2]);
|
|
817
453
|
}
|
|
818
|
-
|
|
819
454
|
if (pathColors_j && pathColors_j[i]) {
|
|
820
455
|
color = pathColors_j[i];
|
|
821
456
|
}
|
|
822
|
-
|
|
823
457
|
r = color[R];
|
|
824
458
|
g = color[G];
|
|
825
459
|
b = color[B];
|
|
826
460
|
a = color[A] != undefined ? color[A] : 1.0;
|
|
827
|
-
|
|
828
|
-
var cartesian = ellipsoid.lonLatToCartesian(cur as LonLat);
|
|
461
|
+
var cartesian = ellipsoid.lonLatToCartesian(cur);
|
|
829
462
|
outTransformedPathCartesian[j].push(cartesian);
|
|
830
|
-
outPathLonLat[j].push(cur
|
|
831
|
-
outTransformedPathMerc[j].push(
|
|
832
|
-
|
|
463
|
+
outPathLonLat[j].push(cur);
|
|
464
|
+
outTransformedPathMerc[j].push(cur.forwardMercator());
|
|
833
465
|
Vec3.doubleToTwoFloats(cartesian, v_high, v_low);
|
|
834
|
-
outVerticesHigh.push(
|
|
835
|
-
|
|
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
|
|
839
|
-
);
|
|
840
|
-
outVerticesLow.push(
|
|
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
|
|
845
|
-
);
|
|
846
|
-
|
|
466
|
+
outVerticesHigh.push(v_high.x, v_high.y, v_high.z, v_high.x, v_high.y, v_high.z, v_high.x, v_high.y, v_high.z, v_high.x, v_high.y, v_high.z);
|
|
467
|
+
outVerticesLow.push(v_low.x, v_low.y, v_low.z, v_low.x, v_low.y, v_low.z, v_low.x, v_low.y, v_low.z, v_low.x, v_low.y, v_low.z);
|
|
847
468
|
outColors.push(r, g, b, a, r, g, b, a, r, g, b, a, r, g, b, a);
|
|
848
|
-
|
|
849
469
|
outOrders.push(1, -1, 2, -2);
|
|
850
470
|
outIndexes.push(index++, index++, index++, index++);
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
outExtent.southWest.lon = (cur as LonLat).lon;
|
|
471
|
+
if (cur.lon < outExtent.southWest.lon) {
|
|
472
|
+
outExtent.southWest.lon = cur.lon;
|
|
854
473
|
}
|
|
855
|
-
if (
|
|
856
|
-
outExtent.southWest.lat =
|
|
474
|
+
if (cur.lat < outExtent.southWest.lat) {
|
|
475
|
+
outExtent.southWest.lat = cur.lat;
|
|
857
476
|
}
|
|
858
|
-
if (
|
|
859
|
-
outExtent.northEast.lon =
|
|
477
|
+
if (cur.lon > outExtent.northEast.lon) {
|
|
478
|
+
outExtent.northEast.lon = cur.lon;
|
|
860
479
|
}
|
|
861
|
-
if (
|
|
862
|
-
outExtent.northEast.lat =
|
|
480
|
+
if (cur.lat > outExtent.northEast.lat) {
|
|
481
|
+
outExtent.northEast.lat = cur.lat;
|
|
863
482
|
}
|
|
864
483
|
}
|
|
865
|
-
|
|
866
484
|
var first;
|
|
867
485
|
if (isClosed) {
|
|
868
486
|
let pp = path[0];
|
|
869
487
|
if (pp instanceof Array) {
|
|
870
488
|
first = ellipsoid.lonLatToCartesian(new LonLat(pp[0], pp[1], pp[2]));
|
|
871
|
-
}
|
|
872
|
-
|
|
489
|
+
}
|
|
490
|
+
else {
|
|
491
|
+
first = ellipsoid.lonLatToCartesian(pp);
|
|
873
492
|
}
|
|
874
493
|
outIndexes.push(startIndex, startIndex + 1, startIndex + 1, startIndex + 1);
|
|
875
|
-
}
|
|
494
|
+
}
|
|
495
|
+
else {
|
|
876
496
|
let p0, p1;
|
|
877
497
|
let pp = path[path.length - 1];
|
|
878
498
|
if (pp instanceof Array) {
|
|
879
499
|
p0 = ellipsoid.lonLatToCartesian(new LonLat(pp[0], pp[1], pp[2]));
|
|
880
|
-
} else {
|
|
881
|
-
p0 = ellipsoid.lonLatToCartesian(pp as LonLat);
|
|
882
500
|
}
|
|
883
|
-
|
|
501
|
+
else {
|
|
502
|
+
p0 = ellipsoid.lonLatToCartesian(pp);
|
|
503
|
+
}
|
|
884
504
|
pp = path[path.length - 2];
|
|
885
|
-
|
|
886
505
|
if (!pp) {
|
|
887
506
|
pp = path[0];
|
|
888
507
|
}
|
|
889
|
-
|
|
890
508
|
if (pp instanceof Array) {
|
|
891
509
|
p1 = ellipsoid.lonLatToCartesian(new LonLat(pp[0], pp[1], pp[2]));
|
|
892
|
-
}
|
|
893
|
-
|
|
510
|
+
}
|
|
511
|
+
else {
|
|
512
|
+
p1 = ellipsoid.lonLatToCartesian(pp);
|
|
894
513
|
}
|
|
895
514
|
first = new Vec3(p0.x + p0.x - p1.x, p0.y + p0.y - p1.y, p0.z + p0.z - p1.z);
|
|
896
515
|
outIndexes.push(index - 1, index - 1, index - 1, index - 1);
|
|
897
516
|
}
|
|
898
|
-
|
|
899
517
|
if (pathColors_j && pathColors_j[path.length - 1]) {
|
|
900
518
|
color = pathColors_j[path.length - 1];
|
|
901
519
|
}
|
|
902
|
-
|
|
903
520
|
r = color[R];
|
|
904
521
|
g = color[G];
|
|
905
522
|
b = color[B];
|
|
906
523
|
a = color[A] != undefined ? color[A] : 1.0;
|
|
907
|
-
|
|
908
524
|
Vec3.doubleToTwoFloats(first, v_high, v_low);
|
|
909
|
-
outVerticesHigh.push(
|
|
910
|
-
|
|
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
|
|
914
|
-
);
|
|
915
|
-
outVerticesLow.push(
|
|
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
|
|
920
|
-
);
|
|
921
|
-
|
|
525
|
+
outVerticesHigh.push(v_high.x, v_high.y, v_high.z, v_high.x, v_high.y, v_high.z, v_high.x, v_high.y, v_high.z, v_high.x, v_high.y, v_high.z);
|
|
526
|
+
outVerticesLow.push(v_low.x, v_low.y, v_low.z, v_low.x, v_low.y, v_low.z, v_low.x, v_low.y, v_low.z, v_low.x, v_low.y, v_low.z);
|
|
922
527
|
outColors.push(r, g, b, a, r, g, b, a, r, g, b, a, r, g, b, a);
|
|
923
|
-
|
|
924
528
|
outOrders.push(1, -1, 2, -2);
|
|
925
|
-
|
|
926
529
|
if (j < pathLonLat.length - 1 && pathLonLat[j + 1].length !== 0) {
|
|
927
530
|
index += 8;
|
|
928
531
|
outIndexes.push(index, index);
|
|
929
532
|
}
|
|
930
533
|
}
|
|
931
534
|
}
|
|
932
|
-
|
|
933
535
|
/**
|
|
934
536
|
* Sets polyline path with cartesian coordinates.
|
|
935
537
|
* @protected
|
|
936
538
|
* @param {SegmentPath3vExt[]} path3v - Cartesian coordinates.
|
|
937
539
|
*/
|
|
938
|
-
|
|
540
|
+
_setEqualPath3v(path3v) {
|
|
939
541
|
var extent = this._extent;
|
|
940
542
|
extent.southWest.set(180, 90);
|
|
941
543
|
extent.northEast.set(-180, -90);
|
|
942
|
-
|
|
943
|
-
var
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
var vh = this._verticesHigh,
|
|
947
|
-
vl = this._verticesLow,
|
|
948
|
-
l = this._pathLonLat,
|
|
949
|
-
m = this._pathLonLatMerc,
|
|
950
|
-
k = 0;
|
|
951
|
-
|
|
952
|
-
var ellipsoid = (this._renderNode as Planet).ellipsoid;
|
|
953
|
-
|
|
544
|
+
var v_high = new Vec3(), v_low = new Vec3();
|
|
545
|
+
var vh = this._verticesHigh, vl = this._verticesLow, l = this._pathLonLat, m = this._pathLonLatMerc, k = 0;
|
|
546
|
+
var ellipsoid = this._renderNode.ellipsoid;
|
|
954
547
|
for (let j = 0; j < path3v.length; j++) {
|
|
955
|
-
var path = path3v[j]
|
|
956
|
-
|
|
548
|
+
var path = path3v[j];
|
|
957
549
|
var last;
|
|
958
550
|
if (this._closedLine) {
|
|
959
551
|
last = path[path.length - 1];
|
|
960
|
-
} else {
|
|
961
|
-
last = new Vec3(
|
|
962
|
-
path[0].x + path[0].x - path[1].x,
|
|
963
|
-
path[0].y + path[0].y - path[1].y,
|
|
964
|
-
path[0].z + path[0].z - path[1].z
|
|
965
|
-
);
|
|
966
552
|
}
|
|
967
|
-
|
|
553
|
+
else {
|
|
554
|
+
last = new Vec3(path[0].x + path[0].x - path[1].x, path[0].y + path[0].y - path[1].y, path[0].z + path[0].z - path[1].z);
|
|
555
|
+
}
|
|
968
556
|
Vec3.doubleToTwoFloats(last, v_high, v_low);
|
|
969
|
-
|
|
970
557
|
vh[k] = v_high.x;
|
|
971
558
|
vl[k++] = v_low.x;
|
|
972
559
|
vh[k] = v_high.y;
|
|
@@ -991,23 +578,16 @@ class Polyline {
|
|
|
991
578
|
vl[k++] = v_low.y;
|
|
992
579
|
vh[k] = v_high.z;
|
|
993
580
|
vl[k++] = v_low.z;
|
|
994
|
-
|
|
995
581
|
for (let i = 0; i < path.length; i++) {
|
|
996
|
-
var cur = path[i]
|
|
997
|
-
pji = this._path3v[j][i] as Vec3;
|
|
998
|
-
|
|
582
|
+
var cur = path[i], pji = this._path3v[j][i];
|
|
999
583
|
pji.x = cur.x;
|
|
1000
584
|
pji.y = cur.y;
|
|
1001
585
|
pji.z = cur.z;
|
|
1002
|
-
|
|
1003
586
|
if (ellipsoid) {
|
|
1004
587
|
var lonLat = ellipsoid.cartesianToLonLat(cur);
|
|
1005
|
-
|
|
1006
588
|
this._pathLonLat[j][i] = lonLat;
|
|
1007
|
-
|
|
1008
589
|
l[j][i] = lonLat;
|
|
1009
590
|
m[j][i] = lonLat.forwardMercator();
|
|
1010
|
-
|
|
1011
591
|
if (lonLat.lon < extent.southWest.lon) {
|
|
1012
592
|
extent.southWest.lon = lonLat.lon;
|
|
1013
593
|
}
|
|
@@ -1021,9 +601,7 @@ class Polyline {
|
|
|
1021
601
|
extent.northEast.lat = lonLat.lat;
|
|
1022
602
|
}
|
|
1023
603
|
}
|
|
1024
|
-
|
|
1025
604
|
Vec3.doubleToTwoFloats(cur, v_high, v_low);
|
|
1026
|
-
|
|
1027
605
|
vh[k] = v_high.x;
|
|
1028
606
|
vl[k++] = v_low.x;
|
|
1029
607
|
vh[k] = v_high.y;
|
|
@@ -1049,21 +627,15 @@ class Polyline {
|
|
|
1049
627
|
vh[k] = v_high.z;
|
|
1050
628
|
vl[k++] = v_low.z;
|
|
1051
629
|
}
|
|
1052
|
-
|
|
1053
630
|
var first;
|
|
1054
631
|
if (this._closedLine) {
|
|
1055
632
|
first = path[0];
|
|
1056
|
-
}
|
|
633
|
+
}
|
|
634
|
+
else {
|
|
1057
635
|
var l1 = path.length - 1;
|
|
1058
|
-
first = new Vec3(
|
|
1059
|
-
path[l1].x + path[l1].x - path[l1 - 1].x,
|
|
1060
|
-
path[l1].y + path[l1].y - path[l1 - 1].y,
|
|
1061
|
-
path[l1].z + path[l1].z - path[l1 - 1].z
|
|
1062
|
-
);
|
|
636
|
+
first = new Vec3(path[l1].x + path[l1].x - path[l1 - 1].x, path[l1].y + path[l1].y - path[l1 - 1].y, path[l1].z + path[l1].z - path[l1 - 1].z);
|
|
1063
637
|
}
|
|
1064
|
-
|
|
1065
|
-
Vec3.doubleToTwoFloats(first as Vec3, v_high, v_low);
|
|
1066
|
-
|
|
638
|
+
Vec3.doubleToTwoFloats(first, v_high, v_low);
|
|
1067
639
|
vh[k] = v_high.x;
|
|
1068
640
|
vl[k++] = v_low.x;
|
|
1069
641
|
vh[k] = v_high.y;
|
|
@@ -1090,43 +662,29 @@ class Polyline {
|
|
|
1090
662
|
vl[k++] = v_low.z;
|
|
1091
663
|
}
|
|
1092
664
|
}
|
|
1093
|
-
|
|
1094
665
|
/**
|
|
1095
666
|
* Sets polyline with geodetic coordinates.
|
|
1096
667
|
* @protected
|
|
1097
668
|
* @param {SegmentPathLonLat[]} pathLonLat - Geodetic polyline path coordinates.
|
|
1098
669
|
*/
|
|
1099
|
-
|
|
670
|
+
_setEqualPathLonLat(pathLonLat) {
|
|
1100
671
|
var extent = this._extent;
|
|
1101
672
|
extent.southWest.set(180.0, 90.0);
|
|
1102
673
|
extent.northEast.set(-180.0, -90.0);
|
|
1103
|
-
|
|
1104
|
-
var
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
var vh = this._verticesHigh,
|
|
1108
|
-
vl = this._verticesLow,
|
|
1109
|
-
l = this._pathLonLat,
|
|
1110
|
-
m = this._pathLonLatMerc,
|
|
1111
|
-
c = this._path3v,
|
|
1112
|
-
k = 0;
|
|
1113
|
-
|
|
1114
|
-
var ellipsoid = (this._renderNode as Planet).ellipsoid;
|
|
1115
|
-
|
|
674
|
+
var v_high = new Vec3(), v_low = new Vec3();
|
|
675
|
+
var vh = this._verticesHigh, vl = this._verticesLow, l = this._pathLonLat, m = this._pathLonLatMerc, c = this._path3v, k = 0;
|
|
676
|
+
var ellipsoid = this._renderNode.ellipsoid;
|
|
1116
677
|
for (let j = 0; j < pathLonLat.length; j++) {
|
|
1117
|
-
var path = pathLonLat[j]
|
|
1118
|
-
|
|
678
|
+
var path = pathLonLat[j];
|
|
1119
679
|
var last;
|
|
1120
680
|
if (this._closedLine) {
|
|
1121
681
|
last = ellipsoid.lonLatToCartesian(path[path.length - 1]);
|
|
1122
|
-
}
|
|
1123
|
-
|
|
1124
|
-
|
|
682
|
+
}
|
|
683
|
+
else {
|
|
684
|
+
let p0 = ellipsoid.lonLatToCartesian(path[0]), p1 = ellipsoid.lonLatToCartesian(path[1]);
|
|
1125
685
|
last = new Vec3(p0.x + p0.x - p1.x, p0.y + p0.y - p1.y, p0.z + p0.z - p1.z);
|
|
1126
686
|
}
|
|
1127
|
-
|
|
1128
687
|
Vec3.doubleToTwoFloats(last, v_high, v_low);
|
|
1129
|
-
|
|
1130
688
|
vh[k] = v_high.x;
|
|
1131
689
|
vl[k++] = v_low.x;
|
|
1132
690
|
vh[k] = v_high.y;
|
|
@@ -1151,16 +709,13 @@ class Polyline {
|
|
|
1151
709
|
vl[k++] = v_low.y;
|
|
1152
710
|
vh[k] = v_high.z;
|
|
1153
711
|
vl[k++] = v_low.z;
|
|
1154
|
-
|
|
1155
712
|
for (let i = 0; i < path.length; i++) {
|
|
1156
|
-
var cur = path[i]
|
|
713
|
+
var cur = path[i];
|
|
1157
714
|
var cartesian = ellipsoid.lonLatToCartesian(cur);
|
|
1158
715
|
c[j][i] = cartesian;
|
|
1159
716
|
m[j][i] = cur.forwardMercator();
|
|
1160
717
|
l[j][i] = cur;
|
|
1161
|
-
|
|
1162
718
|
Vec3.doubleToTwoFloats(cartesian, v_high, v_low);
|
|
1163
|
-
|
|
1164
719
|
vh[k] = v_high.x;
|
|
1165
720
|
vl[k++] = v_low.x;
|
|
1166
721
|
vh[k] = v_high.y;
|
|
@@ -1185,7 +740,6 @@ class Polyline {
|
|
|
1185
740
|
vl[k++] = v_low.y;
|
|
1186
741
|
vh[k] = v_high.z;
|
|
1187
742
|
vl[k++] = v_low.z;
|
|
1188
|
-
|
|
1189
743
|
if (cur.lon < extent.southWest.lon) {
|
|
1190
744
|
extent.southWest.lon = cur.lon;
|
|
1191
745
|
}
|
|
@@ -1199,18 +753,15 @@ class Polyline {
|
|
|
1199
753
|
extent.northEast.lat = cur.lat;
|
|
1200
754
|
}
|
|
1201
755
|
}
|
|
1202
|
-
|
|
1203
756
|
var first;
|
|
1204
757
|
if (this._closedLine) {
|
|
1205
758
|
first = ellipsoid.lonLatToCartesian(path[0]);
|
|
1206
|
-
}
|
|
1207
|
-
|
|
1208
|
-
|
|
759
|
+
}
|
|
760
|
+
else {
|
|
761
|
+
let p0 = ellipsoid.lonLatToCartesian(path[path.length - 1]), p1 = ellipsoid.lonLatToCartesian(path[path.length - 2]);
|
|
1209
762
|
first = new Vec3(p0.x + p0.x - p1.x, p0.y + p0.y - p1.y, p0.z + p0.z - p1.z);
|
|
1210
763
|
}
|
|
1211
|
-
|
|
1212
764
|
Vec3.doubleToTwoFloats(first, v_high, v_low);
|
|
1213
|
-
|
|
1214
765
|
vh[k] = v_high.x;
|
|
1215
766
|
vl[k++] = v_low.x;
|
|
1216
767
|
vh[k] = v_high.y;
|
|
@@ -1237,15 +788,11 @@ class Polyline {
|
|
|
1237
788
|
vl[k++] = v_low.z;
|
|
1238
789
|
}
|
|
1239
790
|
}
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
let l = this._pathLonLat,
|
|
1244
|
-
m = this._pathLonLatMerc;
|
|
1245
|
-
|
|
791
|
+
setPointLonLat(lonlat, index, segmentIndex) {
|
|
792
|
+
if (this._renderNode && this._renderNode.ellipsoid) {
|
|
793
|
+
let l = this._pathLonLat, m = this._pathLonLatMerc;
|
|
1246
794
|
l[segmentIndex][index] = lonlat;
|
|
1247
795
|
m[segmentIndex][index] = lonlat.forwardMercator();
|
|
1248
|
-
|
|
1249
796
|
//
|
|
1250
797
|
// Apply new extent(TODO: think about optimization)
|
|
1251
798
|
//
|
|
@@ -1253,10 +800,9 @@ class Polyline {
|
|
|
1253
800
|
extent.southWest.set(180.0, 90.0);
|
|
1254
801
|
extent.northEast.set(-180.0, -90.0);
|
|
1255
802
|
for (let i = 0; i < l.length; i++) {
|
|
1256
|
-
var pi = l[i]
|
|
803
|
+
var pi = l[i];
|
|
1257
804
|
for (let j = 0; j < pi.length; j++) {
|
|
1258
|
-
var lon = pi[j].lon,
|
|
1259
|
-
lat = pi[j].lat;
|
|
805
|
+
var lon = pi[j].lon, lat = pi[j].lat;
|
|
1260
806
|
if (lon > extent.northEast.lon) {
|
|
1261
807
|
extent.northEast.lon = lon;
|
|
1262
808
|
}
|
|
@@ -1271,21 +817,15 @@ class Polyline {
|
|
|
1271
817
|
}
|
|
1272
818
|
}
|
|
1273
819
|
}
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
segmentIndex,
|
|
1279
|
-
true
|
|
1280
|
-
);
|
|
1281
|
-
} else {
|
|
1282
|
-
let path = this._pathLonLat[segmentIndex] as LonLat[];
|
|
820
|
+
this.setPoint3v(this._renderNode.ellipsoid.lonLatToCartesian(lonlat), index, segmentIndex, true);
|
|
821
|
+
}
|
|
822
|
+
else {
|
|
823
|
+
let path = this._pathLonLat[segmentIndex];
|
|
1283
824
|
path[index].lon = lonlat.lon;
|
|
1284
825
|
path[index].lat = lonlat.lat;
|
|
1285
826
|
path[index].height = lonlat.height;
|
|
1286
827
|
}
|
|
1287
828
|
}
|
|
1288
|
-
|
|
1289
829
|
/**
|
|
1290
830
|
* Changes cartesian point coordinates of the path
|
|
1291
831
|
* @param {Vec3} coordinates - New coordinates
|
|
@@ -1293,48 +833,29 @@ class Polyline {
|
|
|
1293
833
|
* @param {number} [segmentIndex=0] - Index of the point in the path segment
|
|
1294
834
|
* @param {boolean} [skipLonLat=false] - Do not update geodetic coordinates
|
|
1295
835
|
*/
|
|
1296
|
-
|
|
1297
|
-
|
|
836
|
+
setPoint3v(coordinates, index = 0, segmentIndex = 0, skipLonLat = false) {
|
|
1298
837
|
if (this._renderNode) {
|
|
1299
|
-
var v_high = new Vec3(),
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
var vh = this._verticesHigh,
|
|
1303
|
-
vl = this._verticesLow,
|
|
1304
|
-
l = this._pathLonLat,
|
|
1305
|
-
m = this._pathLonLatMerc,
|
|
1306
|
-
k = 0,
|
|
1307
|
-
kk = 0;
|
|
1308
|
-
|
|
838
|
+
var v_high = new Vec3(), v_low = new Vec3();
|
|
839
|
+
var vh = this._verticesHigh, vl = this._verticesLow, l = this._pathLonLat, m = this._pathLonLatMerc, k = 0, kk = 0;
|
|
1309
840
|
//for (let i = 0; i < segmentIndex; i++) {
|
|
1310
841
|
// kk += this._path3v[i].length * 12 + 24;
|
|
1311
842
|
//}
|
|
1312
843
|
kk = this._pathLengths[segmentIndex] * 12 + 24 * segmentIndex;
|
|
1313
|
-
|
|
1314
|
-
let path = this._path3v[segmentIndex] as Vec3[];
|
|
1315
|
-
|
|
844
|
+
let path = this._path3v[segmentIndex];
|
|
1316
845
|
path[index].x = coordinates.x;
|
|
1317
846
|
path[index].y = coordinates.y;
|
|
1318
847
|
path[index].z = coordinates.z;
|
|
1319
|
-
|
|
1320
848
|
let _closedLine = this._closedLine || path.length === 1;
|
|
1321
|
-
|
|
1322
849
|
if (index === 0 || index === 1) {
|
|
1323
850
|
var last;
|
|
1324
851
|
if (_closedLine) {
|
|
1325
852
|
last = path[path.length - 1];
|
|
1326
|
-
} else {
|
|
1327
|
-
last = new Vec3(
|
|
1328
|
-
path[0].x + path[0].x - path[1].x,
|
|
1329
|
-
path[0].y + path[0].y - path[1].y,
|
|
1330
|
-
path[0].z + path[0].z - path[1].z
|
|
1331
|
-
);
|
|
1332
853
|
}
|
|
1333
|
-
|
|
854
|
+
else {
|
|
855
|
+
last = new Vec3(path[0].x + path[0].x - path[1].x, path[0].y + path[0].y - path[1].y, path[0].z + path[0].z - path[1].z);
|
|
856
|
+
}
|
|
1334
857
|
k = kk;
|
|
1335
|
-
|
|
1336
858
|
Vec3.doubleToTwoFloats(last, v_high, v_low);
|
|
1337
|
-
|
|
1338
859
|
vh[k] = v_high.x;
|
|
1339
860
|
vh[k + 1] = v_high.y;
|
|
1340
861
|
vh[k + 2] = v_high.z;
|
|
@@ -1347,7 +868,6 @@ class Polyline {
|
|
|
1347
868
|
vh[k + 9] = v_high.x;
|
|
1348
869
|
vh[k + 10] = v_high.y;
|
|
1349
870
|
vh[k + 11] = v_high.z;
|
|
1350
|
-
|
|
1351
871
|
vl[k] = v_low.x;
|
|
1352
872
|
vl[k + 1] = v_low.y;
|
|
1353
873
|
vl[k + 2] = v_low.z;
|
|
@@ -1361,12 +881,10 @@ class Polyline {
|
|
|
1361
881
|
vl[k + 10] = v_low.y;
|
|
1362
882
|
vl[k + 11] = v_low.z;
|
|
1363
883
|
}
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
var lonLat = (this._renderNode as Planet).ellipsoid.cartesianToLonLat(coordinates);
|
|
884
|
+
if (!skipLonLat && this._renderNode.ellipsoid) {
|
|
885
|
+
var lonLat = this._renderNode.ellipsoid.cartesianToLonLat(coordinates);
|
|
1367
886
|
l[segmentIndex][index] = lonLat;
|
|
1368
887
|
m[segmentIndex][index] = lonLat.forwardMercator();
|
|
1369
|
-
|
|
1370
888
|
//
|
|
1371
889
|
// Apply new extent(TODO: think about optimization)
|
|
1372
890
|
//
|
|
@@ -1374,10 +892,9 @@ class Polyline {
|
|
|
1374
892
|
extent.southWest.set(180.0, 90.0);
|
|
1375
893
|
extent.northEast.set(-180.0, -90.0);
|
|
1376
894
|
for (let i = 0; i < l.length; i++) {
|
|
1377
|
-
var pi = l[i]
|
|
895
|
+
var pi = l[i];
|
|
1378
896
|
for (let j = 0; j < pi.length; j++) {
|
|
1379
|
-
var lon = pi[j].lon,
|
|
1380
|
-
lat = pi[j].lat;
|
|
897
|
+
var lon = pi[j].lon, lat = pi[j].lat;
|
|
1381
898
|
if (lon > extent.northEast.lon) {
|
|
1382
899
|
extent.northEast.lon = lon;
|
|
1383
900
|
}
|
|
@@ -1393,11 +910,8 @@ class Polyline {
|
|
|
1393
910
|
}
|
|
1394
911
|
}
|
|
1395
912
|
}
|
|
1396
|
-
|
|
1397
913
|
k = kk + index * 12 + 12;
|
|
1398
|
-
|
|
1399
914
|
Vec3.doubleToTwoFloats(coordinates, v_high, v_low);
|
|
1400
|
-
|
|
1401
915
|
vh[k] = v_high.x;
|
|
1402
916
|
vh[k + 1] = v_high.y;
|
|
1403
917
|
vh[k + 2] = v_high.z;
|
|
@@ -1410,7 +924,6 @@ class Polyline {
|
|
|
1410
924
|
vh[k + 9] = v_high.x;
|
|
1411
925
|
vh[k + 10] = v_high.y;
|
|
1412
926
|
vh[k + 11] = v_high.z;
|
|
1413
|
-
|
|
1414
927
|
vl[k] = v_low.x;
|
|
1415
928
|
vl[k + 1] = v_low.y;
|
|
1416
929
|
vl[k + 2] = v_low.z;
|
|
@@ -1423,24 +936,17 @@ class Polyline {
|
|
|
1423
936
|
vl[k + 9] = v_low.x;
|
|
1424
937
|
vl[k + 10] = v_low.y;
|
|
1425
938
|
vl[k + 11] = v_low.z;
|
|
1426
|
-
|
|
1427
939
|
if (index === path.length - 1 || index === path.length - 2) {
|
|
1428
940
|
var first;
|
|
1429
941
|
if (_closedLine) {
|
|
1430
942
|
first = path[0];
|
|
1431
|
-
}
|
|
943
|
+
}
|
|
944
|
+
else {
|
|
1432
945
|
var l1 = path.length - 1;
|
|
1433
|
-
first = new Vec3(
|
|
1434
|
-
path[l1].x + path[l1].x - path[l1 - 1].x,
|
|
1435
|
-
path[l1].y + path[l1].y - path[l1 - 1].y,
|
|
1436
|
-
path[l1].z + path[l1].z - path[l1 - 1].z
|
|
1437
|
-
);
|
|
946
|
+
first = new Vec3(path[l1].x + path[l1].x - path[l1 - 1].x, path[l1].y + path[l1].y - path[l1 - 1].y, path[l1].z + path[l1].z - path[l1 - 1].z);
|
|
1438
947
|
}
|
|
1439
|
-
|
|
1440
948
|
k = kk + path.length * 12 + 12;
|
|
1441
|
-
|
|
1442
949
|
Vec3.doubleToTwoFloats(first, v_high, v_low);
|
|
1443
|
-
|
|
1444
950
|
vh[k] = v_high.x;
|
|
1445
951
|
vh[k + 1] = v_high.y;
|
|
1446
952
|
vh[k + 2] = v_high.z;
|
|
@@ -1453,7 +959,6 @@ class Polyline {
|
|
|
1453
959
|
vh[k + 9] = v_high.x;
|
|
1454
960
|
vh[k + 10] = v_high.y;
|
|
1455
961
|
vh[k + 11] = v_high.z;
|
|
1456
|
-
|
|
1457
962
|
vl[k] = v_low.x;
|
|
1458
963
|
vl[k + 1] = v_low.y;
|
|
1459
964
|
vl[k + 2] = v_low.z;
|
|
@@ -1467,45 +972,41 @@ class Polyline {
|
|
|
1467
972
|
vl[k + 10] = v_low.y;
|
|
1468
973
|
vl[k + 11] = v_low.z;
|
|
1469
974
|
}
|
|
1470
|
-
|
|
1471
975
|
this._changedBuffers[VERTICES_BUFFER] = true;
|
|
1472
|
-
}
|
|
1473
|
-
|
|
976
|
+
}
|
|
977
|
+
else {
|
|
978
|
+
let path = this._path3v[segmentIndex];
|
|
1474
979
|
path[index].x = coordinates.x;
|
|
1475
980
|
path[index].y = coordinates.y;
|
|
1476
981
|
path[index].z = coordinates.z;
|
|
1477
982
|
}
|
|
1478
983
|
}
|
|
1479
|
-
|
|
1480
|
-
protected _resizePathLengths(index: number = 0) {
|
|
984
|
+
_resizePathLengths(index = 0) {
|
|
1481
985
|
this._pathLengths[0] = 0;
|
|
1482
986
|
for (let i = index + 1, len = this._path3v.length; i <= len; i++) {
|
|
1483
987
|
this._pathLengths[i] = this._pathLengths[i - 1] + this._path3v[i - 1].length;
|
|
1484
988
|
}
|
|
1485
989
|
}
|
|
1486
|
-
|
|
1487
990
|
/**
|
|
1488
991
|
* Remove path segment
|
|
1489
992
|
* @param {number} index - Path segment index
|
|
1490
993
|
*/
|
|
1491
|
-
|
|
994
|
+
removeSegment(index) {
|
|
1492
995
|
this._path3v.splice(index, 1);
|
|
1493
|
-
this.setPath3v(
|
|
996
|
+
this.setPath3v([].concat(this._path3v));
|
|
1494
997
|
}
|
|
1495
|
-
|
|
1496
998
|
/**
|
|
1497
999
|
* Remove point from the path
|
|
1498
1000
|
* @param {number} index - Point index in a path segment
|
|
1499
1001
|
* @param {number} [multiLineIndex=0] - Segment path index
|
|
1500
1002
|
*/
|
|
1501
|
-
|
|
1003
|
+
removePoint(index, multiLineIndex = 0) {
|
|
1502
1004
|
this._path3v[multiLineIndex].splice(index, 1);
|
|
1503
1005
|
if (this._path3v[multiLineIndex].length === 0) {
|
|
1504
1006
|
this._path3v.splice(multiLineIndex, 1);
|
|
1505
1007
|
}
|
|
1506
|
-
this.setPath3v(
|
|
1008
|
+
this.setPath3v([].concat(this._path3v));
|
|
1507
1009
|
}
|
|
1508
|
-
|
|
1509
1010
|
/**
|
|
1510
1011
|
* Insert point coordinates in a path segment
|
|
1511
1012
|
* @param {Vec3} point3v - Point coordinates
|
|
@@ -1513,14 +1014,11 @@ class Polyline {
|
|
|
1513
1014
|
* @param {NumberArray4} [color] - Point color
|
|
1514
1015
|
* @param {number} [multilineIndex=0] - Path segment index
|
|
1515
1016
|
*/
|
|
1516
|
-
|
|
1517
|
-
let p =
|
|
1518
|
-
pp = p[multilineIndex];
|
|
1017
|
+
insertPoint3v(point3v, index = 0, color, multilineIndex = 0) {
|
|
1018
|
+
let p = [].concat(this._path3v), pp = p[multilineIndex];
|
|
1519
1019
|
if (pp) {
|
|
1520
|
-
let c =
|
|
1521
|
-
|
|
1020
|
+
let c = [].concat(this._pathColors);
|
|
1522
1021
|
pp.splice(index, 0, point3v);
|
|
1523
|
-
|
|
1524
1022
|
if (color) {
|
|
1525
1023
|
let cc = c[multilineIndex];
|
|
1526
1024
|
if (!cc) {
|
|
@@ -1528,13 +1026,12 @@ class Polyline {
|
|
|
1528
1026
|
}
|
|
1529
1027
|
cc.splice(index, 0, color);
|
|
1530
1028
|
}
|
|
1531
|
-
|
|
1532
1029
|
this.setPath3v(p, c);
|
|
1533
|
-
}
|
|
1030
|
+
}
|
|
1031
|
+
else {
|
|
1534
1032
|
this.addPoint3v(point3v, multilineIndex);
|
|
1535
1033
|
}
|
|
1536
1034
|
}
|
|
1537
|
-
|
|
1538
1035
|
/**
|
|
1539
1036
|
* Adds a new cartesian point in the end of the path in a last line segment.
|
|
1540
1037
|
* @public
|
|
@@ -1542,11 +1039,12 @@ class Polyline {
|
|
|
1542
1039
|
* @param {NumberArray4} [color] -
|
|
1543
1040
|
* @param {boolean} [skipEllipsoid] -
|
|
1544
1041
|
*/
|
|
1545
|
-
|
|
1042
|
+
appendPoint3v(point3v, color, skipEllipsoid) {
|
|
1546
1043
|
if (this._path3v.length === 0) {
|
|
1547
|
-
this._pathColors.push([color || this._defaultColor
|
|
1044
|
+
this._pathColors.push([color || this._defaultColor]);
|
|
1548
1045
|
this.addPoint3v(point3v);
|
|
1549
|
-
}
|
|
1046
|
+
}
|
|
1047
|
+
else {
|
|
1550
1048
|
//
|
|
1551
1049
|
// Making typedArrays suitable for appendPoint function
|
|
1552
1050
|
//
|
|
@@ -1555,39 +1053,20 @@ class Polyline {
|
|
|
1555
1053
|
this._colors = makeArray(this._colors);
|
|
1556
1054
|
this._orders = makeArray(this._orders);
|
|
1557
1055
|
this._indexes = makeArray(this._indexes);
|
|
1558
|
-
|
|
1559
|
-
Polyline.appendPoint3v(
|
|
1560
|
-
this._path3v,
|
|
1561
|
-
point3v,
|
|
1562
|
-
this._pathColors,
|
|
1563
|
-
color || this._defaultColor as NumberArray4,
|
|
1564
|
-
this._closedLine,
|
|
1565
|
-
this._verticesHigh,
|
|
1566
|
-
this._verticesLow,
|
|
1567
|
-
this._colors,
|
|
1568
|
-
this._orders,
|
|
1569
|
-
this._indexes,
|
|
1570
|
-
!skipEllipsoid ? (this._renderNode as Planet).ellipsoid : null,
|
|
1571
|
-
this._pathLonLat,
|
|
1572
|
-
this._pathLonLatMerc,
|
|
1573
|
-
this._extent
|
|
1574
|
-
);
|
|
1575
|
-
|
|
1056
|
+
Polyline.appendPoint3v(this._path3v, point3v, this._pathColors, color || this._defaultColor, this._closedLine, this._verticesHigh, this._verticesLow, this._colors, this._orders, this._indexes, !skipEllipsoid ? this._renderNode.ellipsoid : null, this._pathLonLat, this._pathLonLatMerc, this._extent);
|
|
1576
1057
|
this._pathLengths[this._path3v.length] += 1;
|
|
1577
|
-
|
|
1578
1058
|
this._changedBuffers[VERTICES_BUFFER] = true;
|
|
1579
1059
|
this._changedBuffers[COLORS_BUFFER] = true;
|
|
1580
1060
|
this._changedBuffers[INDEX_BUFFER] = true;
|
|
1581
1061
|
}
|
|
1582
1062
|
}
|
|
1583
|
-
|
|
1584
1063
|
/**
|
|
1585
1064
|
* Append new point in the end of the path.
|
|
1586
1065
|
* @public
|
|
1587
1066
|
* @param {Vec3} point3v - New point coordinates.
|
|
1588
1067
|
* @param {number} [multiLineIndex=0] - Path segment index, first by default.
|
|
1589
1068
|
*/
|
|
1590
|
-
|
|
1069
|
+
addPoint3v(point3v, multiLineIndex = 0) {
|
|
1591
1070
|
//
|
|
1592
1071
|
// TODO: could be optimized
|
|
1593
1072
|
//
|
|
@@ -1595,16 +1074,15 @@ class Polyline {
|
|
|
1595
1074
|
this._path3v.push([]);
|
|
1596
1075
|
}
|
|
1597
1076
|
this._path3v[multiLineIndex].push(point3v);
|
|
1598
|
-
this.setPath3v(
|
|
1077
|
+
this.setPath3v([].concat(this._path3v));
|
|
1599
1078
|
}
|
|
1600
|
-
|
|
1601
1079
|
/**
|
|
1602
1080
|
* Append new geodetic point in the end of the path.
|
|
1603
1081
|
* @public
|
|
1604
1082
|
* @param {LonLat} lonLat - New coordinate.
|
|
1605
1083
|
* @param {number} [multiLineIndex=0] - Path segment index, first by default.
|
|
1606
1084
|
*/
|
|
1607
|
-
|
|
1085
|
+
addPointLonLat(lonLat, multiLineIndex = 0) {
|
|
1608
1086
|
//
|
|
1609
1087
|
// TODO: could be optimized
|
|
1610
1088
|
//
|
|
@@ -1612,122 +1090,111 @@ class Polyline {
|
|
|
1612
1090
|
this._pathLonLat.push([]);
|
|
1613
1091
|
}
|
|
1614
1092
|
this._pathLonLat[multiLineIndex].push(lonLat);
|
|
1615
|
-
this.setPathLonLat(
|
|
1093
|
+
this.setPathLonLat([].concat(this._pathLonLat));
|
|
1616
1094
|
}
|
|
1617
|
-
|
|
1618
1095
|
/**
|
|
1619
1096
|
* Clear polyline data.
|
|
1620
1097
|
* @public
|
|
1621
1098
|
*/
|
|
1622
|
-
|
|
1099
|
+
clear() {
|
|
1623
1100
|
this._clearData();
|
|
1624
1101
|
}
|
|
1625
|
-
|
|
1626
1102
|
/**
|
|
1627
1103
|
* Change path point color
|
|
1628
1104
|
* @param {NumberArray4} color - New color
|
|
1629
1105
|
* @param {number} [index=0] - Point index
|
|
1630
1106
|
* @param {number} [segmentIndex=0] - Path segment index
|
|
1631
1107
|
*/
|
|
1632
|
-
|
|
1108
|
+
setPointColor(color, index = 0, segmentIndex = 0) {
|
|
1633
1109
|
if (this._renderNode && index < this._path3v[segmentIndex].length) {
|
|
1634
1110
|
let colors = this._pathColors[segmentIndex];
|
|
1635
|
-
|
|
1636
1111
|
if (!colors) {
|
|
1637
1112
|
if (this._path3v[segmentIndex] && index < this._path3v[segmentIndex].length) {
|
|
1638
1113
|
this._pathColors[segmentIndex] = new Array(this._path3v[segmentIndex].length);
|
|
1639
|
-
}
|
|
1114
|
+
}
|
|
1115
|
+
else {
|
|
1640
1116
|
return;
|
|
1641
1117
|
}
|
|
1642
1118
|
}
|
|
1643
|
-
|
|
1644
1119
|
if (!colors[index]) {
|
|
1645
1120
|
colors[index] = [color[R], color[G], color[B], color[A] || 1.0];
|
|
1646
|
-
}
|
|
1121
|
+
}
|
|
1122
|
+
else {
|
|
1647
1123
|
colors[index][R] = color[R];
|
|
1648
1124
|
colors[index][G] = color[G];
|
|
1649
1125
|
colors[index][B] = color[B];
|
|
1650
1126
|
colors[index][A] = color[A] || 1.0;
|
|
1651
1127
|
}
|
|
1652
|
-
|
|
1653
1128
|
let c = this._colors;
|
|
1654
|
-
|
|
1655
1129
|
//optimized with this._pathLengths
|
|
1656
1130
|
//for (let i = 0; i < segmentIndex; i++) {
|
|
1657
1131
|
// kk += this._path3v[i].length * 16 + 32;
|
|
1658
1132
|
//}
|
|
1659
|
-
|
|
1660
1133
|
let k = index * 16 + this._pathLengths[segmentIndex] * 16 + 32 * segmentIndex;
|
|
1661
|
-
|
|
1662
1134
|
c[k] = c[k + 4] = c[k + 8] = c[k + 12] = color[R];
|
|
1663
1135
|
c[k + 1] = c[k + 5] = c[k + 9] = c[k + 13] = color[G];
|
|
1664
1136
|
c[k + 2] = c[k + 6] = c[k + 10] = c[k + 14] = color[B];
|
|
1665
1137
|
c[k + 3] = c[k + 7] = c[k + 11] = c[k + 15] = color[A] || 1.0;
|
|
1666
|
-
|
|
1667
1138
|
this._changedBuffers[COLORS_BUFFER] = true;
|
|
1668
|
-
}
|
|
1139
|
+
}
|
|
1140
|
+
else {
|
|
1669
1141
|
let pathColors = this._pathColors[segmentIndex];
|
|
1670
1142
|
pathColors[index] = color;
|
|
1671
1143
|
}
|
|
1672
1144
|
}
|
|
1673
|
-
|
|
1674
1145
|
/**
|
|
1675
1146
|
* Sets polyline opacity.
|
|
1676
1147
|
* @public
|
|
1677
1148
|
* @param {number} opacity - Opacity.
|
|
1678
1149
|
*/
|
|
1679
|
-
|
|
1150
|
+
setOpacity(opacity) {
|
|
1680
1151
|
this._opacity = opacity;
|
|
1681
1152
|
}
|
|
1682
|
-
|
|
1683
1153
|
/**
|
|
1684
1154
|
* Sets Polyline thickness in screen pixels.
|
|
1685
1155
|
* @public
|
|
1686
1156
|
* @param {number} thickness - Thickness.
|
|
1687
1157
|
*/
|
|
1688
|
-
|
|
1158
|
+
setThickness(thickness) {
|
|
1689
1159
|
this.thickness = thickness;
|
|
1690
1160
|
}
|
|
1691
|
-
|
|
1692
1161
|
/**
|
|
1693
1162
|
* Returns thickness.
|
|
1694
1163
|
* @public
|
|
1695
1164
|
* @return {number} Thickness in screen pixels.
|
|
1696
1165
|
*/
|
|
1697
|
-
|
|
1166
|
+
getThickness() {
|
|
1698
1167
|
return this.thickness;
|
|
1699
1168
|
}
|
|
1700
|
-
|
|
1701
1169
|
/**
|
|
1702
1170
|
* Sets visibility.
|
|
1703
1171
|
* @public
|
|
1704
1172
|
* @param {boolean} visibility - Polyline visibility.
|
|
1705
1173
|
*/
|
|
1706
|
-
|
|
1174
|
+
setVisibility(visibility) {
|
|
1707
1175
|
this.visibility = visibility;
|
|
1708
1176
|
}
|
|
1709
|
-
|
|
1710
1177
|
/**
|
|
1711
1178
|
* Gets Polyline visibility.
|
|
1712
1179
|
* @public
|
|
1713
1180
|
* @return {boolean} Polyline visibility.
|
|
1714
1181
|
*/
|
|
1715
|
-
|
|
1182
|
+
getVisibility() {
|
|
1716
1183
|
return this.visibility;
|
|
1717
1184
|
}
|
|
1718
|
-
|
|
1719
1185
|
/**
|
|
1720
1186
|
* Assign with render node.
|
|
1721
1187
|
* @public
|
|
1722
1188
|
* @param {RenderNode} renderNode -
|
|
1723
1189
|
*/
|
|
1724
|
-
|
|
1190
|
+
setRenderNode(renderNode) {
|
|
1725
1191
|
if (renderNode) {
|
|
1726
1192
|
this._renderNode = renderNode;
|
|
1727
1193
|
if (this._pathLonLat.length) {
|
|
1728
|
-
this._createDataLonLat(
|
|
1729
|
-
}
|
|
1730
|
-
|
|
1194
|
+
this._createDataLonLat([].concat(this._pathLonLat));
|
|
1195
|
+
}
|
|
1196
|
+
else {
|
|
1197
|
+
this._createData3v([].concat(this._path3v));
|
|
1731
1198
|
}
|
|
1732
1199
|
this._refresh();
|
|
1733
1200
|
if (renderNode.renderer && renderNode.renderer.isInitialized()) {
|
|
@@ -1735,8 +1202,7 @@ class Polyline {
|
|
|
1735
1202
|
}
|
|
1736
1203
|
}
|
|
1737
1204
|
}
|
|
1738
|
-
|
|
1739
|
-
protected _clearData() {
|
|
1205
|
+
_clearData() {
|
|
1740
1206
|
//@ts-ignore
|
|
1741
1207
|
this._verticesHigh = null;
|
|
1742
1208
|
//@ts-ignore
|
|
@@ -1747,74 +1213,36 @@ class Polyline {
|
|
|
1747
1213
|
this._indexes = null;
|
|
1748
1214
|
//@ts-ignore
|
|
1749
1215
|
this._colors = null;
|
|
1750
|
-
|
|
1751
1216
|
this._verticesHigh = [];
|
|
1752
1217
|
this._verticesLow = [];
|
|
1753
1218
|
this._orders = [];
|
|
1754
1219
|
this._indexes = [];
|
|
1755
1220
|
this._colors = [];
|
|
1756
|
-
|
|
1757
1221
|
this._path3v.length = 0;
|
|
1758
1222
|
this._pathLonLat.length = 0;
|
|
1759
1223
|
this._pathLonLatMerc.length = 0;
|
|
1760
|
-
|
|
1761
1224
|
this._path3v = [];
|
|
1762
1225
|
this._pathLonLat = [];
|
|
1763
1226
|
this._pathLonLatMerc = [];
|
|
1764
1227
|
}
|
|
1765
|
-
|
|
1766
|
-
protected _createData3v(path3v: SegmentPath3vExt[]) {
|
|
1228
|
+
_createData3v(path3v) {
|
|
1767
1229
|
this._clearData();
|
|
1768
|
-
Polyline.appendLineData3v(
|
|
1769
|
-
path3v,
|
|
1770
|
-
this._pathColors,
|
|
1771
|
-
this._defaultColor as NumberArray4,
|
|
1772
|
-
this._closedLine,
|
|
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,
|
|
1778
|
-
this._pathLonLat,
|
|
1779
|
-
this._path3v,
|
|
1780
|
-
this._pathLonLatMerc,
|
|
1781
|
-
this._extent,
|
|
1782
|
-
this._colors as number[]
|
|
1783
|
-
);
|
|
1230
|
+
Polyline.appendLineData3v(path3v, this._pathColors, this._defaultColor, this._closedLine, this._verticesHigh, this._verticesLow, this._orders, this._indexes, this._renderNode.ellipsoid, this._pathLonLat, this._path3v, this._pathLonLatMerc, this._extent, this._colors);
|
|
1784
1231
|
this._resizePathLengths(0);
|
|
1785
1232
|
}
|
|
1786
|
-
|
|
1787
|
-
protected _createDataLonLat(pathLonlat: SegmentPathLonLatExt[]) {
|
|
1233
|
+
_createDataLonLat(pathLonlat) {
|
|
1788
1234
|
this._clearData();
|
|
1789
|
-
Polyline.appendLineDataLonLat(
|
|
1790
|
-
pathLonlat,
|
|
1791
|
-
this._pathColors,
|
|
1792
|
-
this._defaultColor as NumberArray4,
|
|
1793
|
-
this._closedLine,
|
|
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,
|
|
1799
|
-
this._path3v,
|
|
1800
|
-
this._pathLonLat,
|
|
1801
|
-
this._pathLonLatMerc,
|
|
1802
|
-
this._extent,
|
|
1803
|
-
this._colors as number[]
|
|
1804
|
-
);
|
|
1235
|
+
Polyline.appendLineDataLonLat(pathLonlat, this._pathColors, this._defaultColor, this._closedLine, this._verticesHigh, this._verticesLow, this._orders, this._indexes, this._renderNode.ellipsoid, this._path3v, this._pathLonLat, this._pathLonLatMerc, this._extent, this._colors);
|
|
1805
1236
|
this._resizePathLengths(0);
|
|
1806
1237
|
}
|
|
1807
|
-
|
|
1808
1238
|
/**
|
|
1809
1239
|
* Removes from an entity.
|
|
1810
1240
|
* @public
|
|
1811
1241
|
*/
|
|
1812
|
-
|
|
1242
|
+
remove() {
|
|
1813
1243
|
this._entity = null;
|
|
1814
|
-
|
|
1815
1244
|
this._pathColors.length = 0;
|
|
1816
1245
|
this._pathColors = [];
|
|
1817
|
-
|
|
1818
1246
|
//@ts-ignore
|
|
1819
1247
|
this._verticesHigh = null;
|
|
1820
1248
|
//@ts-ignore
|
|
@@ -1825,75 +1253,62 @@ class Polyline {
|
|
|
1825
1253
|
this._indexes = null;
|
|
1826
1254
|
//@ts-ignore
|
|
1827
1255
|
this._colors = null;
|
|
1828
|
-
|
|
1829
1256
|
this._verticesHigh = [];
|
|
1830
1257
|
this._verticesLow = [];
|
|
1831
1258
|
this._orders = [];
|
|
1832
1259
|
this._indexes = [];
|
|
1833
1260
|
this._colors = [];
|
|
1834
|
-
|
|
1835
1261
|
this._deleteBuffers();
|
|
1836
|
-
|
|
1837
1262
|
this._handler && this._handler.remove(this);
|
|
1838
1263
|
}
|
|
1839
|
-
|
|
1840
|
-
public setPickingColor3v(color: Vec3) {
|
|
1264
|
+
setPickingColor3v(color) {
|
|
1841
1265
|
this._pickingColor[0] = color.x / 255.0;
|
|
1842
1266
|
this._pickingColor[1] = color.y / 255.0;
|
|
1843
1267
|
this._pickingColor[2] = color.z / 255.0;
|
|
1844
1268
|
}
|
|
1845
|
-
|
|
1846
1269
|
/**
|
|
1847
1270
|
* Returns polyline geodetic extent.
|
|
1848
1271
|
* @public
|
|
1849
1272
|
* @returns {Extent} - Geodetic extent
|
|
1850
1273
|
*/
|
|
1851
|
-
|
|
1274
|
+
getExtent() {
|
|
1852
1275
|
return this._extent.clone();
|
|
1853
1276
|
}
|
|
1854
|
-
|
|
1855
1277
|
/**
|
|
1856
1278
|
* Returns path cartesian coordinates.
|
|
1857
1279
|
* @return {SegmentPath3vExt[]} Polyline path.
|
|
1858
1280
|
*/
|
|
1859
|
-
|
|
1281
|
+
getPath3v() {
|
|
1860
1282
|
return this._path3v;
|
|
1861
1283
|
}
|
|
1862
|
-
|
|
1863
1284
|
/**
|
|
1864
1285
|
* Returns geodetic path coordinates.
|
|
1865
1286
|
* @return {SegmentPathLonLatExt[]} Polyline path.
|
|
1866
1287
|
*/
|
|
1867
|
-
|
|
1288
|
+
getPathLonLat() {
|
|
1868
1289
|
return this._pathLonLat;
|
|
1869
1290
|
}
|
|
1870
|
-
|
|
1871
|
-
public getPathColors(): NumberArray4[][] {
|
|
1291
|
+
getPathColors() {
|
|
1872
1292
|
return this._pathColors;
|
|
1873
1293
|
}
|
|
1874
|
-
|
|
1875
1294
|
/**
|
|
1876
1295
|
* @todo
|
|
1877
1296
|
* @param {NumberArray4[][]} pathColors
|
|
1878
1297
|
*/
|
|
1879
|
-
setPathColors(pathColors
|
|
1298
|
+
setPathColors(pathColors) {
|
|
1880
1299
|
if (this._renderNode) {
|
|
1881
1300
|
//
|
|
1882
1301
|
// ...
|
|
1883
1302
|
//
|
|
1884
1303
|
}
|
|
1885
1304
|
}
|
|
1886
|
-
|
|
1887
1305
|
/**
|
|
1888
1306
|
* Sets polyline color
|
|
1889
1307
|
* @param {string} htmlColor- HTML color
|
|
1890
1308
|
*/
|
|
1891
|
-
|
|
1309
|
+
setColorHTML(htmlColor) {
|
|
1892
1310
|
this._defaultColor = htmlColorToFloat32Array(htmlColor);
|
|
1893
|
-
|
|
1894
|
-
let color = htmlColorToRgba(htmlColor),
|
|
1895
|
-
p = this._pathColors;
|
|
1896
|
-
|
|
1311
|
+
let color = htmlColorToRgba(htmlColor), p = this._pathColors;
|
|
1897
1312
|
for (let i = 0, len = p.length; i < len; i++) {
|
|
1898
1313
|
let s = p[i];
|
|
1899
1314
|
for (let j = 0, slen = s.length; j < slen; j++) {
|
|
@@ -1903,7 +1318,6 @@ class Polyline {
|
|
|
1903
1318
|
s[j][3] = color.w;
|
|
1904
1319
|
}
|
|
1905
1320
|
}
|
|
1906
|
-
|
|
1907
1321
|
let c = this._colors;
|
|
1908
1322
|
for (let i = 0, len = c.length; i < len; i += 4) {
|
|
1909
1323
|
c[i] = color.x;
|
|
@@ -1911,33 +1325,32 @@ class Polyline {
|
|
|
1911
1325
|
c[i + 2] = color.z;
|
|
1912
1326
|
c[i + 3] = color.w;
|
|
1913
1327
|
}
|
|
1914
|
-
|
|
1915
1328
|
this._changedBuffers[COLORS_BUFFER] = true;
|
|
1916
1329
|
}
|
|
1917
|
-
|
|
1918
1330
|
/**
|
|
1919
1331
|
* Sets polyline geodetic coordinates.
|
|
1920
1332
|
* @public
|
|
1921
1333
|
* @param {SegmentPathLonLat[]} pathLonLat - Polyline path cartesian coordinates.
|
|
1922
1334
|
* @param {Boolean} [forceEqual=false] - OPTIMIZATION FLAG: Makes assigning faster for size equal coordinates array.
|
|
1923
1335
|
*/
|
|
1924
|
-
|
|
1925
|
-
if (this._renderNode &&
|
|
1336
|
+
setPathLonLat(pathLonLat, forceEqual = false) {
|
|
1337
|
+
if (this._renderNode && this._renderNode.ellipsoid) {
|
|
1926
1338
|
if (forceEqual) {
|
|
1927
|
-
this._setEqualPathLonLat(pathLonLat
|
|
1339
|
+
this._setEqualPathLonLat(pathLonLat);
|
|
1928
1340
|
this._changedBuffers[VERTICES_BUFFER] = true;
|
|
1929
1341
|
this._changedBuffers[COLORS_BUFFER] = true;
|
|
1930
|
-
}
|
|
1342
|
+
}
|
|
1343
|
+
else {
|
|
1931
1344
|
this._createDataLonLat(pathLonLat);
|
|
1932
1345
|
this._changedBuffers[VERTICES_BUFFER] = true;
|
|
1933
1346
|
this._changedBuffers[INDEX_BUFFER] = true;
|
|
1934
1347
|
this._changedBuffers[COLORS_BUFFER] = true;
|
|
1935
1348
|
}
|
|
1936
|
-
}
|
|
1937
|
-
|
|
1349
|
+
}
|
|
1350
|
+
else {
|
|
1351
|
+
this._pathLonLat = [].concat(pathLonLat);
|
|
1938
1352
|
}
|
|
1939
1353
|
}
|
|
1940
|
-
|
|
1941
1354
|
/**
|
|
1942
1355
|
* Sets Polyline cartesian coordinates.
|
|
1943
1356
|
* @public
|
|
@@ -1945,157 +1358,123 @@ class Polyline {
|
|
|
1945
1358
|
* @param {SegmentPathColor[]} [pathColors] - Polyline path cartesian coordinates. (exactly 3 entries)
|
|
1946
1359
|
* @param {Boolean} [forceEqual=false] - Makes assigning faster for size equal coordinates array.
|
|
1947
1360
|
*/
|
|
1948
|
-
|
|
1361
|
+
setPath3v(path3v, pathColors, forceEqual = false) {
|
|
1949
1362
|
if (pathColors) {
|
|
1950
|
-
this._pathColors =
|
|
1363
|
+
this._pathColors = [].concat(pathColors);
|
|
1951
1364
|
}
|
|
1952
|
-
|
|
1953
1365
|
if (this._renderNode) {
|
|
1954
1366
|
if (forceEqual) {
|
|
1955
1367
|
this._setEqualPath3v(path3v);
|
|
1956
1368
|
this._changedBuffers[VERTICES_BUFFER] = true;
|
|
1957
1369
|
this._changedBuffers[COLORS_BUFFER] = true;
|
|
1958
|
-
}
|
|
1370
|
+
}
|
|
1371
|
+
else {
|
|
1959
1372
|
this._createData3v(path3v);
|
|
1960
1373
|
this._changedBuffers[VERTICES_BUFFER] = true;
|
|
1961
1374
|
this._changedBuffers[INDEX_BUFFER] = true;
|
|
1962
1375
|
this._changedBuffers[COLORS_BUFFER] = true;
|
|
1963
1376
|
}
|
|
1964
|
-
}
|
|
1965
|
-
|
|
1377
|
+
}
|
|
1378
|
+
else {
|
|
1379
|
+
this._path3v = [].concat(path3v);
|
|
1966
1380
|
}
|
|
1967
1381
|
}
|
|
1968
|
-
|
|
1969
|
-
public draw() {
|
|
1382
|
+
draw() {
|
|
1970
1383
|
if (this.visibility && this._path3v.length) {
|
|
1971
1384
|
this._update();
|
|
1972
|
-
|
|
1973
|
-
let
|
|
1974
|
-
let r = rn.renderer!;
|
|
1385
|
+
let rn = this._renderNode;
|
|
1386
|
+
let r = rn.renderer;
|
|
1975
1387
|
let sh = r.handler.programs.polyline_screen;
|
|
1976
1388
|
let p = sh._program;
|
|
1977
|
-
let gl = r.handler.gl
|
|
1978
|
-
|
|
1979
|
-
shu = p.uniforms;
|
|
1980
|
-
|
|
1981
|
-
let ec = this._handler!._entityCollection;
|
|
1982
|
-
|
|
1389
|
+
let gl = r.handler.gl, sha = p.attributes, shu = p.uniforms;
|
|
1390
|
+
let ec = this._handler._entityCollection;
|
|
1983
1391
|
sh.activate();
|
|
1984
|
-
|
|
1985
1392
|
gl.disable(gl.CULL_FACE);
|
|
1986
|
-
|
|
1987
1393
|
gl.uniform1f(shu.depthOffset, ec.polygonOffsetUnits);
|
|
1988
|
-
|
|
1989
|
-
gl.uniformMatrix4fv(shu.
|
|
1990
|
-
gl.uniformMatrix4fv(shu.view, false, r.activeCamera!.getViewMatrix());
|
|
1991
|
-
|
|
1394
|
+
gl.uniformMatrix4fv(shu.proj, false, r.activeCamera.getProjectionMatrix());
|
|
1395
|
+
gl.uniformMatrix4fv(shu.view, false, r.activeCamera.getViewMatrix());
|
|
1992
1396
|
// gl.uniform4fv(shu.color, [this.color.x, this.color.y, this.color.z, this.color.w * this._handler._entityCollection._fadingOpacity]);
|
|
1993
|
-
|
|
1994
|
-
gl.uniform3fv(shu.
|
|
1995
|
-
gl.
|
|
1996
|
-
|
|
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]);
|
|
1397
|
+
gl.uniform3fv(shu.eyePositionHigh, r.activeCamera.eyeHigh);
|
|
1398
|
+
gl.uniform3fv(shu.eyePositionLow, r.activeCamera.eyeLow);
|
|
1399
|
+
gl.uniform2fv(shu.uFloatParams, [rn._planetRadius2 || 0.0, r.activeCamera._tanViewAngle_hradOneByHeight]);
|
|
1400
|
+
gl.uniform2fv(shu.viewport, [r.handler.canvas.width, r.handler.canvas.height]);
|
|
1999
1401
|
gl.uniform1f(shu.thickness, this.thickness * 0.5);
|
|
2000
1402
|
gl.uniform1f(shu.opacity, this._opacity * ec._fadingOpacity);
|
|
2001
|
-
|
|
2002
|
-
gl.
|
|
2003
|
-
|
|
2004
|
-
|
|
2005
|
-
let v = this._verticesHighBuffer!;
|
|
1403
|
+
gl.bindBuffer(gl.ARRAY_BUFFER, this._colorsBuffer);
|
|
1404
|
+
gl.vertexAttribPointer(sha.color, this._colorsBuffer.itemSize, gl.FLOAT, false, 0, 0);
|
|
1405
|
+
let v = this._verticesHighBuffer;
|
|
2006
1406
|
gl.bindBuffer(gl.ARRAY_BUFFER, v);
|
|
2007
1407
|
gl.vertexAttribPointer(sha.prevHigh, v.itemSize, gl.FLOAT, false, 12, 0);
|
|
2008
1408
|
gl.vertexAttribPointer(sha.currentHigh, v.itemSize, gl.FLOAT, false, 12, 48);
|
|
2009
1409
|
gl.vertexAttribPointer(sha.nextHigh, v.itemSize, gl.FLOAT, false, 12, 96);
|
|
2010
|
-
|
|
2011
|
-
v = this._verticesLowBuffer!;
|
|
1410
|
+
v = this._verticesLowBuffer;
|
|
2012
1411
|
gl.bindBuffer(gl.ARRAY_BUFFER, v);
|
|
2013
1412
|
gl.vertexAttribPointer(sha.prevLow, v.itemSize, gl.FLOAT, false, 12, 0);
|
|
2014
1413
|
gl.vertexAttribPointer(sha.currentLow, v.itemSize, gl.FLOAT, false, 12, 48);
|
|
2015
1414
|
gl.vertexAttribPointer(sha.nextLow, v.itemSize, gl.FLOAT, false, 12, 96);
|
|
2016
|
-
|
|
2017
|
-
gl.
|
|
2018
|
-
gl.
|
|
2019
|
-
|
|
2020
|
-
gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, this._indexesBuffer as WebGLBuffer);
|
|
2021
|
-
gl.drawElements(gl.TRIANGLE_STRIP, this._indexesBuffer!.numItems, gl.UNSIGNED_INT, 0);
|
|
2022
|
-
|
|
1415
|
+
gl.bindBuffer(gl.ARRAY_BUFFER, this._ordersBuffer);
|
|
1416
|
+
gl.vertexAttribPointer(sha.order, this._ordersBuffer.itemSize, gl.FLOAT, false, 4, 0);
|
|
1417
|
+
gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, this._indexesBuffer);
|
|
1418
|
+
gl.drawElements(gl.TRIANGLE_STRIP, this._indexesBuffer.numItems, gl.UNSIGNED_INT, 0);
|
|
2023
1419
|
gl.enable(gl.CULL_FACE);
|
|
2024
1420
|
}
|
|
2025
1421
|
}
|
|
2026
|
-
|
|
2027
|
-
public drawPicking() {
|
|
1422
|
+
drawPicking() {
|
|
2028
1423
|
if (this.visibility && this._path3v.length) {
|
|
2029
|
-
let rn = this._renderNode
|
|
2030
|
-
let r = rn.renderer
|
|
1424
|
+
let rn = this._renderNode;
|
|
1425
|
+
let r = rn.renderer;
|
|
2031
1426
|
let sh = r.handler.programs.polyline_picking;
|
|
2032
1427
|
let p = sh._program;
|
|
2033
|
-
let gl = r.handler.gl
|
|
2034
|
-
sha = p.attributes,
|
|
2035
|
-
shu = p.uniforms;
|
|
2036
|
-
|
|
1428
|
+
let gl = r.handler.gl, sha = p.attributes, shu = p.uniforms;
|
|
2037
1429
|
sh.activate();
|
|
2038
|
-
|
|
2039
1430
|
gl.disable(gl.CULL_FACE);
|
|
2040
|
-
|
|
2041
|
-
gl.
|
|
2042
|
-
|
|
2043
|
-
gl.uniformMatrix4fv(shu.proj, false, r.activeCamera!.getProjectionMatrix());
|
|
2044
|
-
gl.uniformMatrix4fv(shu.view, false, r.activeCamera!.getViewMatrix());
|
|
2045
|
-
|
|
1431
|
+
gl.uniform1f(shu.depthOffset, this._handler._entityCollection.polygonOffsetUnits);
|
|
1432
|
+
gl.uniformMatrix4fv(shu.proj, false, r.activeCamera.getProjectionMatrix());
|
|
1433
|
+
gl.uniformMatrix4fv(shu.view, false, r.activeCamera.getViewMatrix());
|
|
2046
1434
|
gl.uniform4fv(shu.color, [
|
|
2047
1435
|
this._pickingColor[0],
|
|
2048
1436
|
this._pickingColor[1],
|
|
2049
1437
|
this._pickingColor[2],
|
|
2050
1438
|
1.0
|
|
2051
1439
|
]);
|
|
2052
|
-
|
|
2053
|
-
gl.uniform3fv(shu.
|
|
2054
|
-
gl.
|
|
2055
|
-
|
|
2056
|
-
gl.uniform2fv(shu.uFloatParams, [(rn as Planet)._planetRadius2 || 0.0, r.activeCamera!._tanViewAngle_hradOneByHeight]);
|
|
1440
|
+
gl.uniform3fv(shu.eyePositionHigh, r.activeCamera.eyeHigh);
|
|
1441
|
+
gl.uniform3fv(shu.eyePositionLow, r.activeCamera.eyeLow);
|
|
1442
|
+
gl.uniform2fv(shu.uFloatParams, [rn._planetRadius2 || 0.0, r.activeCamera._tanViewAngle_hradOneByHeight]);
|
|
2057
1443
|
//@todo: replace to the handler property
|
|
2058
|
-
gl.uniform2fv(shu.viewport, [r.handler.canvas
|
|
1444
|
+
gl.uniform2fv(shu.viewport, [r.handler.canvas.width, r.handler.canvas.height]);
|
|
2059
1445
|
gl.uniform1f(shu.thickness, this.thickness * 0.5);
|
|
2060
|
-
|
|
2061
|
-
let v = this._verticesHighBuffer!;
|
|
1446
|
+
let v = this._verticesHighBuffer;
|
|
2062
1447
|
gl.bindBuffer(gl.ARRAY_BUFFER, v);
|
|
2063
1448
|
gl.vertexAttribPointer(sha.prevHigh, v.itemSize, gl.FLOAT, false, 12, 0);
|
|
2064
1449
|
gl.vertexAttribPointer(sha.currentHigh, v.itemSize, gl.FLOAT, false, 12, 48);
|
|
2065
1450
|
gl.vertexAttribPointer(sha.nextHigh, v.itemSize, gl.FLOAT, false, 12, 96);
|
|
2066
|
-
|
|
2067
|
-
v = this._verticesLowBuffer!;
|
|
1451
|
+
v = this._verticesLowBuffer;
|
|
2068
1452
|
gl.bindBuffer(gl.ARRAY_BUFFER, v);
|
|
2069
1453
|
gl.vertexAttribPointer(sha.prevLow, v.itemSize, gl.FLOAT, false, 12, 0);
|
|
2070
1454
|
gl.vertexAttribPointer(sha.currentLow, v.itemSize, gl.FLOAT, false, 12, 48);
|
|
2071
1455
|
gl.vertexAttribPointer(sha.nextLow, v.itemSize, gl.FLOAT, false, 12, 96);
|
|
2072
|
-
|
|
2073
|
-
gl.
|
|
2074
|
-
gl.
|
|
2075
|
-
|
|
2076
|
-
gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, this._indexesBuffer as WebGLBuffer);
|
|
2077
|
-
gl.drawElements(gl.TRIANGLE_STRIP, this._indexesBuffer!.numItems, gl.UNSIGNED_INT, 0);
|
|
2078
|
-
|
|
1456
|
+
gl.bindBuffer(gl.ARRAY_BUFFER, this._ordersBuffer);
|
|
1457
|
+
gl.vertexAttribPointer(sha.order, this._ordersBuffer.itemSize, gl.FLOAT, false, 4, 0);
|
|
1458
|
+
gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, this._indexesBuffer);
|
|
1459
|
+
gl.drawElements(gl.TRIANGLE_STRIP, this._indexesBuffer.numItems, gl.UNSIGNED_INT, 0);
|
|
2079
1460
|
gl.enable(gl.CULL_FACE);
|
|
2080
1461
|
}
|
|
2081
1462
|
}
|
|
2082
|
-
|
|
2083
1463
|
/**
|
|
2084
1464
|
* Refresh buffers.
|
|
2085
1465
|
* @protected
|
|
2086
1466
|
*/
|
|
2087
|
-
|
|
1467
|
+
_refresh() {
|
|
2088
1468
|
let i = this._changedBuffers.length;
|
|
2089
1469
|
while (i--) {
|
|
2090
1470
|
this._changedBuffers[i] = true;
|
|
2091
1471
|
}
|
|
2092
1472
|
}
|
|
2093
|
-
|
|
2094
1473
|
/**
|
|
2095
1474
|
* Updates render buffers.
|
|
2096
1475
|
* @protected
|
|
2097
1476
|
*/
|
|
2098
|
-
|
|
1477
|
+
_update() {
|
|
2099
1478
|
if (this._renderNode) {
|
|
2100
1479
|
let i = this._changedBuffers.length;
|
|
2101
1480
|
while (i--) {
|
|
@@ -2106,22 +1485,18 @@ class Polyline {
|
|
|
2106
1485
|
}
|
|
2107
1486
|
}
|
|
2108
1487
|
}
|
|
2109
|
-
|
|
2110
1488
|
/**
|
|
2111
1489
|
* Clear GL buffers.
|
|
2112
1490
|
* @public
|
|
2113
1491
|
*/
|
|
2114
|
-
|
|
1492
|
+
_deleteBuffers() {
|
|
2115
1493
|
if (this._renderNode) {
|
|
2116
|
-
let r = this._renderNode.renderer
|
|
2117
|
-
|
|
2118
|
-
|
|
2119
|
-
gl.deleteBuffer(this.
|
|
2120
|
-
gl.deleteBuffer(this.
|
|
2121
|
-
gl.deleteBuffer(this.
|
|
2122
|
-
gl.deleteBuffer(this._indexesBuffer as WebGLBuffer);
|
|
2123
|
-
gl.deleteBuffer(this._colorsBuffer as WebGLBuffer);
|
|
2124
|
-
|
|
1494
|
+
let r = this._renderNode.renderer, gl = r.handler.gl;
|
|
1495
|
+
gl.deleteBuffer(this._verticesHighBuffer);
|
|
1496
|
+
gl.deleteBuffer(this._verticesLowBuffer);
|
|
1497
|
+
gl.deleteBuffer(this._ordersBuffer);
|
|
1498
|
+
gl.deleteBuffer(this._indexesBuffer);
|
|
1499
|
+
gl.deleteBuffer(this._colorsBuffer);
|
|
2125
1500
|
this._verticesHighBuffer = null;
|
|
2126
1501
|
this._verticesLowBuffer = null;
|
|
2127
1502
|
this._ordersBuffer = null;
|
|
@@ -2129,53 +1504,43 @@ class Polyline {
|
|
|
2129
1504
|
this._colorsBuffer = null;
|
|
2130
1505
|
}
|
|
2131
1506
|
}
|
|
2132
|
-
|
|
2133
1507
|
/**
|
|
2134
1508
|
* Creates vertices buffers.
|
|
2135
1509
|
* @protected
|
|
2136
1510
|
*/
|
|
2137
|
-
|
|
2138
|
-
let h = this._renderNode
|
|
2139
|
-
|
|
1511
|
+
_createVerticesBuffer() {
|
|
1512
|
+
let h = this._renderNode.renderer.handler;
|
|
2140
1513
|
let numItems = this._verticesHigh.length / 3;
|
|
2141
|
-
|
|
2142
1514
|
if (!this._verticesHighBuffer || this._verticesHighBuffer.numItems !== numItems) {
|
|
2143
|
-
h.gl
|
|
2144
|
-
h.gl
|
|
1515
|
+
h.gl.deleteBuffer(this._verticesHighBuffer);
|
|
1516
|
+
h.gl.deleteBuffer(this._verticesLowBuffer);
|
|
2145
1517
|
this._verticesHighBuffer = h.createStreamArrayBuffer(3, numItems);
|
|
2146
1518
|
this._verticesLowBuffer = h.createStreamArrayBuffer(3, numItems);
|
|
2147
1519
|
}
|
|
2148
|
-
|
|
2149
1520
|
this._verticesHigh = makeArrayTyped(this._verticesHigh);
|
|
2150
1521
|
this._verticesLow = makeArrayTyped(this._verticesLow);
|
|
2151
|
-
|
|
2152
|
-
h.setStreamArrayBuffer(this.
|
|
2153
|
-
h.setStreamArrayBuffer(this._verticesLowBuffer!, this._verticesLow as Float32Array);
|
|
1522
|
+
h.setStreamArrayBuffer(this._verticesHighBuffer, this._verticesHigh);
|
|
1523
|
+
h.setStreamArrayBuffer(this._verticesLowBuffer, this._verticesLow);
|
|
2154
1524
|
}
|
|
2155
|
-
|
|
2156
1525
|
/**
|
|
2157
1526
|
* Creates gl index and order buffer.
|
|
2158
1527
|
* @protected
|
|
2159
1528
|
*/
|
|
2160
|
-
|
|
2161
|
-
let h = this._renderNode
|
|
2162
|
-
h.gl
|
|
2163
|
-
h.gl
|
|
2164
|
-
|
|
1529
|
+
_createIndexBuffer() {
|
|
1530
|
+
let h = this._renderNode.renderer.handler;
|
|
1531
|
+
h.gl.deleteBuffer(this._ordersBuffer);
|
|
1532
|
+
h.gl.deleteBuffer(this._indexesBuffer);
|
|
2165
1533
|
this._orders = makeArrayTyped(this._orders);
|
|
2166
|
-
this._ordersBuffer = h.createArrayBuffer(this._orders
|
|
2167
|
-
|
|
1534
|
+
this._ordersBuffer = h.createArrayBuffer(this._orders, 1, this._orders.length / 2);
|
|
2168
1535
|
this._indexes = makeArrayTyped(this._indexes, Uint32Array);
|
|
2169
|
-
this._indexesBuffer = h.createElementArrayBuffer(this._indexes
|
|
1536
|
+
this._indexesBuffer = h.createElementArrayBuffer(this._indexes, 1, this._indexes.length);
|
|
2170
1537
|
}
|
|
2171
|
-
|
|
2172
|
-
|
|
2173
|
-
|
|
2174
|
-
h.gl!.deleteBuffer(this._colorsBuffer as WebGLBuffer);
|
|
2175
|
-
|
|
1538
|
+
_createColorsBuffer() {
|
|
1539
|
+
let h = this._renderNode.renderer.handler;
|
|
1540
|
+
h.gl.deleteBuffer(this._colorsBuffer);
|
|
2176
1541
|
this._colors = makeArrayTyped(this._colors);
|
|
2177
1542
|
this._colorsBuffer = h.createArrayBuffer(new Float32Array(this._colors), 4, this._colors.length / 4);
|
|
2178
1543
|
}
|
|
2179
1544
|
}
|
|
2180
|
-
|
|
2181
|
-
export {Polyline};
|
|
1545
|
+
Polyline.__counter__ = 0;
|
|
1546
|
+
export { Polyline };
|