@openglobus/og 0.19.4 → 0.20.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (308) hide show
  1. package/README.md +3 -3
  2. package/css/og.css +18 -4
  3. package/lib/@openglobus/js/Clock.d.ts +106 -0
  4. package/lib/@openglobus/js/Deferred.d.ts +6 -0
  5. package/lib/@openglobus/js/Events.d.ts +90 -0
  6. package/lib/@openglobus/js/Extent.d.ts +145 -0
  7. package/lib/@openglobus/js/Globe.d.ts +134 -0
  8. package/lib/@openglobus/js/ImageCanvas.d.ts +128 -0
  9. package/lib/@openglobus/js/Lock.d.ts +15 -0
  10. package/lib/@openglobus/js/LonLat.d.ts +128 -0
  11. package/lib/@openglobus/js/Object3d.d.ts +64 -0
  12. package/lib/@openglobus/js/Popup.d.ts +46 -0
  13. package/lib/@openglobus/js/QueueArray.d.ts +16 -0
  14. package/lib/@openglobus/js/Rectangle.d.ts +76 -0
  15. package/lib/@openglobus/js/Stack.d.ts +20 -0
  16. package/lib/@openglobus/js/astro/astro.d.ts +39 -0
  17. package/lib/@openglobus/js/astro/earth.d.ts +8 -0
  18. package/lib/@openglobus/js/astro/jd.d.ts +234 -0
  19. package/lib/@openglobus/js/astro/orbit.d.ts +5 -0
  20. package/lib/@openglobus/js/astro/rotation.d.ts +2 -0
  21. package/lib/@openglobus/js/bv/Box.d.ts +32 -0
  22. package/lib/@openglobus/js/bv/Sphere.d.ts +37 -0
  23. package/lib/@openglobus/js/bv/index.d.ts +3 -0
  24. package/lib/@openglobus/js/camera/Camera.d.ts +314 -0
  25. package/lib/@openglobus/js/camera/Frustum.d.ts +139 -0
  26. package/lib/@openglobus/js/camera/PlanetCamera.d.ts +234 -0
  27. package/lib/@openglobus/js/camera/index.d.ts +3 -0
  28. package/lib/@openglobus/js/cons.d.ts +40 -0
  29. package/lib/@openglobus/js/control/Atmosphere.d.ts +16 -0
  30. package/lib/@openglobus/js/control/CompassButton.d.ts +16 -0
  31. package/lib/@openglobus/js/control/Control.d.ts +100 -0
  32. package/lib/@openglobus/js/control/DebugInfo.d.ts +25 -0
  33. package/lib/@openglobus/js/control/DrawingSwitcher.d.ts +13 -0
  34. package/lib/@openglobus/js/control/EarthCoordinates.d.ts +41 -0
  35. package/lib/@openglobus/js/control/EarthNavigation.d.ts +50 -0
  36. package/lib/@openglobus/js/control/GeoImageDragControl.d.ts +22 -0
  37. package/lib/@openglobus/js/control/KeyboardNavigation.d.ts +28 -0
  38. package/lib/@openglobus/js/control/LayerAnimation.d.ts +71 -0
  39. package/lib/@openglobus/js/control/LayerSwitcher.d.ts +36 -0
  40. package/lib/@openglobus/js/control/Lighting.d.ts +53 -0
  41. package/lib/@openglobus/js/control/MouseNavigation.d.ts +64 -0
  42. package/lib/@openglobus/js/control/MouseWheelZoomControl.d.ts +44 -0
  43. package/lib/@openglobus/js/control/RulerSwitcher.d.ts +17 -0
  44. package/lib/@openglobus/js/control/ScaleControl.d.ts +24 -0
  45. package/lib/@openglobus/js/control/SegmentBoundVisualization.d.ts +12 -0
  46. package/lib/@openglobus/js/control/ShowFps.d.ts +9 -0
  47. package/lib/@openglobus/js/control/SimpleNavigation.d.ts +25 -0
  48. package/lib/@openglobus/js/control/SimpleSkyBackground.d.ts +17 -0
  49. package/lib/@openglobus/js/control/Sun.d.ts +33 -0
  50. package/lib/@openglobus/js/control/ToggleWireframe.d.ts +14 -0
  51. package/lib/@openglobus/js/control/TouchNavigation.d.ts +52 -0
  52. package/lib/@openglobus/js/control/ZoomControl.d.ts +27 -0
  53. package/lib/@openglobus/js/control/drawing/DrawingControl.d.ts +12 -0
  54. package/lib/@openglobus/js/control/drawing/LineStringDrawingScene.d.ts +15 -0
  55. package/lib/@openglobus/js/control/drawing/PolygonDrawingScene.d.ts +98 -0
  56. package/lib/@openglobus/js/control/elevationProfile/ElevationProfile.d.ts +77 -0
  57. package/lib/@openglobus/js/control/elevationProfile/ElevationProfileButtonsView.d.ts +14 -0
  58. package/lib/@openglobus/js/control/elevationProfile/ElevationProfileControl.d.ts +33 -0
  59. package/lib/@openglobus/js/control/elevationProfile/ElevationProfileLegend.d.ts +20 -0
  60. package/lib/@openglobus/js/control/elevationProfile/ElevationProfileScene.d.ts +80 -0
  61. package/lib/@openglobus/js/control/elevationProfile/ElevationProfileView.d.ts +63 -0
  62. package/lib/@openglobus/js/control/elevationProfile/PointListDialog.d.ts +12 -0
  63. package/lib/@openglobus/js/control/heightRuler/HeightRuler.d.ts +7 -0
  64. package/lib/@openglobus/js/control/heightRuler/HeightRulerScene.d.ts +35 -0
  65. package/lib/@openglobus/js/control/heightRuler/HeightRulerSwitcher.d.ts +6 -0
  66. package/lib/@openglobus/js/control/index.d.ts +29 -0
  67. package/lib/@openglobus/js/control/ruler/Ruler.d.ts +13 -0
  68. package/lib/@openglobus/js/control/ruler/RulerScene.d.ts +88 -0
  69. package/lib/@openglobus/js/control/selection/Selection.d.ts +55 -0
  70. package/lib/@openglobus/js/control/selection/SelectionScene.d.ts +44 -0
  71. package/lib/@openglobus/js/control/timeline/TimelineControl.d.ts +18 -0
  72. package/lib/@openglobus/js/control/timeline/TimelineModel.d.ts +41 -0
  73. package/lib/@openglobus/js/control/timeline/TimelineView.d.ts +85 -0
  74. package/lib/@openglobus/js/control/timeline/timelineUtils.d.ts +12 -0
  75. package/lib/@openglobus/js/control/visibleExtent/drawnode.d.ts +7 -0
  76. package/lib/@openglobus/js/ellipsoid/Ellipsoid.d.ts +193 -0
  77. package/lib/@openglobus/js/ellipsoid/index.d.ts +3 -0
  78. package/lib/@openglobus/js/ellipsoid/wgs84.d.ts +6 -0
  79. package/lib/@openglobus/js/entity/BaseBillboard.d.ts +222 -0
  80. package/lib/@openglobus/js/entity/BaseBillboardHandler.d.ts +81 -0
  81. package/lib/@openglobus/js/entity/Billboard.d.ts +113 -0
  82. package/lib/@openglobus/js/entity/BillboardHandler.d.ts +15 -0
  83. package/lib/@openglobus/js/entity/Entity.d.ts +354 -0
  84. package/lib/@openglobus/js/entity/EntityCollection.d.ts +363 -0
  85. package/lib/@openglobus/js/entity/GeoObject.d.ts +152 -0
  86. package/lib/@openglobus/js/entity/GeoObjectHandler.d.ts +104 -0
  87. package/lib/@openglobus/js/entity/Geometry.d.ts +124 -0
  88. package/lib/@openglobus/js/entity/GeometryHandler.d.ts +84 -0
  89. package/lib/@openglobus/js/entity/Label.d.ts +214 -0
  90. package/lib/@openglobus/js/entity/LabelHandler.d.ts +65 -0
  91. package/lib/@openglobus/js/entity/LabelWorker.d.ts +15 -0
  92. package/lib/@openglobus/js/entity/PointCloud.d.ts +179 -0
  93. package/lib/@openglobus/js/entity/PointCloudHandler.d.ts +42 -0
  94. package/lib/@openglobus/js/entity/Polyline.d.ts +345 -0
  95. package/lib/@openglobus/js/entity/PolylineHandler.d.ts +22 -0
  96. package/lib/@openglobus/js/entity/Ray.d.ts +133 -0
  97. package/lib/@openglobus/js/entity/RayHandler.d.ts +70 -0
  98. package/lib/@openglobus/js/entity/Strip.d.ts +139 -0
  99. package/lib/@openglobus/js/entity/StripHandler.d.ts +42 -0
  100. package/lib/@openglobus/js/entity/index.d.ts +10 -0
  101. package/lib/@openglobus/js/index.d.ts +33 -0
  102. package/lib/@openglobus/js/input/KeyboardHandler.d.ts +33 -0
  103. package/lib/@openglobus/js/input/MouseHandler.d.ts +16 -0
  104. package/lib/@openglobus/js/input/TouchHandler.d.ts +11 -0
  105. package/lib/@openglobus/js/input/input.d.ts +3 -0
  106. package/lib/@openglobus/js/layer/BaseGeoImage.d.ts +145 -0
  107. package/lib/@openglobus/js/layer/Bing.d.ts +4 -0
  108. package/lib/@openglobus/js/layer/CanvasTiles.d.ts +103 -0
  109. package/lib/@openglobus/js/layer/GeoImage.d.ts +61 -0
  110. package/lib/@openglobus/js/layer/GeoTexture2d.d.ts +17 -0
  111. package/lib/@openglobus/js/layer/GeoVideo.d.ts +68 -0
  112. package/lib/@openglobus/js/layer/KML.d.ts +72 -0
  113. package/lib/@openglobus/js/layer/Layer.d.ts +415 -0
  114. package/lib/@openglobus/js/layer/Material.d.ts +34 -0
  115. package/lib/@openglobus/js/layer/OpenStreetMap.d.ts +4 -0
  116. package/lib/@openglobus/js/layer/Vector.d.ts +246 -0
  117. package/lib/@openglobus/js/layer/WMS.d.ts +75 -0
  118. package/lib/@openglobus/js/layer/XYZ.d.ts +148 -0
  119. package/lib/@openglobus/js/layer/index.d.ts +12 -0
  120. package/lib/@openglobus/js/light/LightSource.d.ts +174 -0
  121. package/lib/@openglobus/js/math/Line2.d.ts +11 -0
  122. package/lib/@openglobus/js/math/Line3.d.ts +28 -0
  123. package/lib/@openglobus/js/math/Mat3.d.ts +77 -0
  124. package/lib/@openglobus/js/math/Mat4.d.ts +195 -0
  125. package/lib/@openglobus/js/math/Plane.d.ts +20 -0
  126. package/lib/@openglobus/js/math/Quat.d.ts +373 -0
  127. package/lib/@openglobus/js/math/Ray.d.ts +76 -0
  128. package/lib/@openglobus/js/math/Vec2.d.ts +310 -0
  129. package/lib/@openglobus/js/math/Vec3.d.ts +472 -0
  130. package/lib/@openglobus/js/math/Vec4.d.ts +163 -0
  131. package/lib/@openglobus/js/math/coder.d.ts +51 -0
  132. package/lib/@openglobus/js/math/index.d.ts +11 -0
  133. package/lib/@openglobus/js/math.d.ts +266 -0
  134. package/lib/@openglobus/js/mercator.d.ts +92 -0
  135. package/lib/@openglobus/js/proj/EPSG3857.d.ts +9 -0
  136. package/lib/@openglobus/js/proj/EPSG4326.d.ts +9 -0
  137. package/lib/@openglobus/js/proj/Proj.d.ts +43 -0
  138. package/lib/@openglobus/js/quadTree/EPSG4326QuadTreeStrategy.d.ts +6 -0
  139. package/lib/@openglobus/js/quadTree/EarthQuadTreeStrategy.d.ts +9 -0
  140. package/lib/@openglobus/js/quadTree/EntityCollectionNode.d.ts +54 -0
  141. package/lib/@openglobus/js/quadTree/MarsQuadTreeStrategy.d.ts +11 -0
  142. package/lib/@openglobus/js/quadTree/Node.d.ts +80 -0
  143. package/lib/@openglobus/js/quadTree/QuadTreeStrategy.d.ts +28 -0
  144. package/lib/@openglobus/js/quadTree/Wgs84QuadTreeStrategy.d.ts +6 -0
  145. package/lib/@openglobus/js/quadTree/index.d.ts +12 -0
  146. package/lib/@openglobus/js/quadTree/quadTree.d.ts +40 -0
  147. package/lib/@openglobus/js/renderer/Renderer.d.ts +319 -0
  148. package/lib/@openglobus/js/renderer/RendererEvents.d.ts +240 -0
  149. package/lib/@openglobus/js/scene/Axes.d.ts +12 -0
  150. package/lib/@openglobus/js/scene/BaseNode.d.ts +61 -0
  151. package/lib/@openglobus/js/scene/Planet.d.ts +652 -0
  152. package/lib/@openglobus/js/scene/RenderNode.d.ts +150 -0
  153. package/lib/@openglobus/js/scene/SkyBox.d.ts +13 -0
  154. package/lib/@openglobus/js/scene/index.d.ts +5 -0
  155. package/lib/@openglobus/js/segment/Segment.d.ts +288 -0
  156. package/lib/@openglobus/js/segment/SegmentLonLat.d.ts +44 -0
  157. package/lib/@openglobus/js/segment/SegmentLonLatWgs84.d.ts +10 -0
  158. package/lib/@openglobus/js/segment/Slice.d.ts +13 -0
  159. package/lib/@openglobus/js/segment/segmentHelper.d.ts +18 -0
  160. package/lib/@openglobus/js/shaders/atmos.d.ts +4 -0
  161. package/lib/@openglobus/js/shaders/billboard.d.ts +3 -0
  162. package/lib/@openglobus/js/shaders/bloom.d.ts +2 -0
  163. package/lib/@openglobus/js/shaders/blur.d.ts +3 -0
  164. package/lib/@openglobus/js/shaders/depth.d.ts +2 -0
  165. package/lib/@openglobus/js/shaders/drawnode.d.ts +8 -0
  166. package/lib/@openglobus/js/shaders/geoObject.d.ts +3 -0
  167. package/lib/@openglobus/js/shaders/label.d.ts +4 -0
  168. package/lib/@openglobus/js/shaders/lumFilter.d.ts +2 -0
  169. package/lib/@openglobus/js/shaders/pointCloud.d.ts +2 -0
  170. package/lib/@openglobus/js/shaders/polyline.d.ts +3 -0
  171. package/lib/@openglobus/js/shaders/ray.d.ts +2 -0
  172. package/lib/@openglobus/js/shaders/screenFrame.d.ts +2 -0
  173. package/lib/@openglobus/js/shaders/skybox.d.ts +2 -0
  174. package/lib/@openglobus/js/shaders/toneMapping.d.ts +2 -0
  175. package/lib/@openglobus/js/shaders/utils.d.ts +1 -0
  176. package/lib/@openglobus/js/terrain/BilTerrain.d.ts +18 -0
  177. package/lib/@openglobus/js/terrain/EmptyTerrain.d.ts +113 -0
  178. package/lib/@openglobus/js/terrain/Geoid.d.ts +33 -0
  179. package/lib/@openglobus/js/terrain/GlobusRgbTerrain.d.ts +6 -0
  180. package/lib/@openglobus/js/terrain/GlobusTerrain.d.ts +137 -0
  181. package/lib/{js/terrain/MapboxTerrain.d.ts → @openglobus/js/terrain/RgbTerrain.d.ts} +5 -5
  182. package/lib/@openglobus/js/terrain/index.d.ts +6 -0
  183. package/lib/@openglobus/js/ui/Button.d.ts +32 -0
  184. package/lib/@openglobus/js/ui/ButtonGroup.d.ts +16 -0
  185. package/lib/@openglobus/js/ui/Color.d.ts +22 -0
  186. package/lib/@openglobus/js/ui/Dialog.d.ts +55 -0
  187. package/lib/@openglobus/js/ui/Slider.d.ts +38 -0
  188. package/lib/@openglobus/js/ui/ToggleButton.d.ts +20 -0
  189. package/lib/@openglobus/js/ui/View.d.ts +37 -0
  190. package/lib/@openglobus/js/ui/icons.d.ts +1 -0
  191. package/lib/@openglobus/js/utils/BaseWorker.d.ts +14 -0
  192. package/lib/@openglobus/js/utils/FontAtlas.d.ts +82 -0
  193. package/lib/@openglobus/js/utils/GeoImageCreator.d.ts +34 -0
  194. package/lib/@openglobus/js/utils/ImagesCacheManager.d.ts +22 -0
  195. package/lib/@openglobus/js/utils/Loader.d.ts +63 -0
  196. package/lib/@openglobus/js/utils/NormalMapCreator.d.ts +52 -0
  197. package/lib/@openglobus/js/utils/PlainSegmentWorker.d.ts +24 -0
  198. package/lib/@openglobus/js/utils/TerrainWorker.d.ts +28 -0
  199. package/lib/@openglobus/js/utils/TextureAtlas.d.ts +113 -0
  200. package/lib/@openglobus/js/utils/VectorTileCreator.d.ts +18 -0
  201. package/lib/@openglobus/js/utils/colorTable.d.ts +3 -0
  202. package/lib/@openglobus/js/utils/earcut.d.ts +7 -0
  203. package/lib/@openglobus/js/utils/objParser.d.ts +24 -0
  204. package/lib/@openglobus/js/utils/shared.d.ts +263 -0
  205. package/lib/@openglobus/js/utils/units.d.ts +16 -0
  206. package/lib/@openglobus/js/webgl/BaseFramebuffer.d.ts +53 -0
  207. package/lib/@openglobus/js/webgl/Framebuffer.d.ts +69 -0
  208. package/lib/@openglobus/js/webgl/Handler.d.ts +473 -0
  209. package/lib/@openglobus/js/webgl/Multisample.d.ts +27 -0
  210. package/lib/@openglobus/js/webgl/Program.d.ts +159 -0
  211. package/lib/@openglobus/js/webgl/ProgramController.d.ts +86 -0
  212. package/lib/@openglobus/js/webgl/index.d.ts +6 -0
  213. package/lib/@openglobus/js/webgl/types.d.ts +9 -0
  214. package/lib/@openglobus/js/webgl/variableHandlers.d.ts +22 -0
  215. package/lib/@openglobus/og.css +1 -1
  216. package/lib/@openglobus/og.esm.js +1 -1
  217. package/lib/@openglobus/og.esm.js.map +1 -1
  218. package/lib/@openglobus/og.umd.js +1 -1
  219. package/lib/@openglobus/og.umd.js.map +1 -1
  220. package/lib/js/Extent.js +2 -2
  221. package/lib/js/Globe.d.ts +1 -1
  222. package/lib/js/Object3d.d.ts +8 -1
  223. package/lib/js/Object3d.js +12 -2
  224. package/lib/js/camera/Frustum.d.ts +1 -1
  225. package/lib/js/camera/Frustum.js +3 -2
  226. package/lib/js/control/DebugInfo.js +19 -18
  227. package/lib/js/control/Lighting.d.ts +4 -0
  228. package/lib/js/control/Lighting.js +51 -12
  229. package/lib/js/control/SimpleSkyBackground.d.ts +2 -0
  230. package/lib/js/control/SimpleSkyBackground.js +13 -3
  231. package/lib/js/control/drawing/PolygonDrawingScene.js +2 -2
  232. package/lib/js/control/visibleExtent/drawnode.js +1 -1
  233. package/lib/js/entity/GeoObject.d.ts +12 -3
  234. package/lib/js/entity/GeoObject.js +34 -2
  235. package/lib/js/entity/GeoObjectHandler.d.ts +5 -0
  236. package/lib/js/entity/GeoObjectHandler.js +47 -0
  237. package/lib/js/entity/Geometry.d.ts +24 -11
  238. package/lib/js/entity/Geometry.js +17 -9
  239. package/lib/js/entity/GeometryHandler.js +5 -5
  240. package/lib/js/entity/Label.d.ts +7 -0
  241. package/lib/js/entity/Label.js +11 -0
  242. package/lib/js/entity/Polyline.d.ts +15 -7
  243. package/lib/js/entity/Polyline.js +54 -6
  244. package/lib/js/entity/Strip.d.ts +12 -0
  245. package/lib/js/entity/Strip.js +16 -0
  246. package/lib/js/entity/StripHandler.js +1 -1
  247. package/lib/js/entity/index.d.ts +10 -11
  248. package/lib/js/entity/index.js +10 -11
  249. package/lib/js/index.d.ts +5 -5
  250. package/lib/js/index.js +5 -5
  251. package/lib/js/layer/Bing.d.ts +4 -0
  252. package/lib/js/layer/Bing.js +40 -0
  253. package/lib/js/layer/GeoImage.d.ts +1 -1
  254. package/lib/js/layer/GeoVideo.d.ts +1 -1
  255. package/lib/js/layer/Layer.d.ts +1 -1
  256. package/lib/js/layer/Layer.js +2 -2
  257. package/lib/js/layer/OpenStreetMap.d.ts +4 -0
  258. package/lib/js/layer/OpenStreetMap.js +19 -0
  259. package/lib/js/layer/Vector.d.ts +3 -0
  260. package/lib/js/layer/Vector.js +3 -3
  261. package/lib/js/layer/index.d.ts +12 -11
  262. package/lib/js/layer/index.js +12 -11
  263. package/lib/js/math/Mat4.js +18 -17
  264. package/lib/js/mercator.js +2 -1
  265. package/lib/js/quadTree/EPSG4326QuadTreeStrategy.js +4 -5
  266. package/lib/js/quadTree/EarthQuadTreeStrategy.d.ts +3 -0
  267. package/lib/js/quadTree/EarthQuadTreeStrategy.js +40 -5
  268. package/lib/js/quadTree/EntityCollectionNode.d.ts +2 -2
  269. package/lib/js/quadTree/EntityCollectionNode.js +13 -14
  270. package/lib/js/quadTree/MarsQuadTreeStrategy.d.ts +5 -0
  271. package/lib/js/quadTree/MarsQuadTreeStrategy.js +31 -5
  272. package/lib/js/quadTree/Node.d.ts +2 -1
  273. package/lib/js/quadTree/Node.js +38 -28
  274. package/lib/js/quadTree/QuadTreeStrategy.d.ts +3 -0
  275. package/lib/js/quadTree/QuadTreeStrategy.js +17 -0
  276. package/lib/js/quadTree/Wgs84QuadTreeStrategy.js +3 -3
  277. package/lib/js/renderer/Renderer.js +1 -0
  278. package/lib/js/scene/Planet.js +6 -4
  279. package/lib/js/segment/Segment.d.ts +12 -9
  280. package/lib/js/segment/Segment.js +47 -24
  281. package/lib/js/segment/SegmentLonLat.d.ts +1 -5
  282. package/lib/js/segment/SegmentLonLat.js +8 -100
  283. package/lib/js/segment/SegmentLonLatWgs84.js +5 -3
  284. package/lib/js/shaders/billboard.js +4 -4
  285. package/lib/js/shaders/drawnode.js +16 -19
  286. package/lib/js/shaders/geoObject.js +4 -5
  287. package/lib/js/shaders/ray.js +7 -3
  288. package/lib/js/terrain/BilTerrain.d.ts +1 -1
  289. package/lib/js/terrain/BilTerrain.js +7 -6
  290. package/lib/js/terrain/EmptyTerrain.d.ts +7 -0
  291. package/lib/js/terrain/EmptyTerrain.js +7 -0
  292. package/lib/js/terrain/GlobusRgbTerrain.d.ts +6 -0
  293. package/lib/js/terrain/GlobusRgbTerrain.js +25 -0
  294. package/lib/js/terrain/GlobusTerrain.d.ts +5 -5
  295. package/lib/js/terrain/GlobusTerrain.js +35 -30
  296. package/lib/js/terrain/RgbTerrain.d.ts +22 -0
  297. package/lib/js/terrain/RgbTerrain.js +415 -0
  298. package/lib/js/terrain/index.d.ts +3 -2
  299. package/lib/js/terrain/index.js +3 -2
  300. package/lib/js/ui/Color.d.ts +22 -0
  301. package/lib/js/ui/Color.js +58 -0
  302. package/lib/js/utils/GeoImageCreator.js +1 -1
  303. package/lib/js/utils/NormalMapCreator.js +1 -1
  304. package/lib/js/utils/VectorTileCreator.js +3 -3
  305. package/lib/js/utils/shared.d.ts +1 -8
  306. package/lib/js/utils/shared.js +17 -8
  307. package/package.json +2 -1
  308. package/lib/js/terrain/MapboxTerrain.js +0 -305
@@ -384,23 +384,24 @@ export class Mat4 {
384
384
  * @returns {Mat4} -
385
385
  */
386
386
  setPerspective(left, right, bottom, top, near, far) {
387
- let h = right - left, i = top - bottom, j = far - near;
388
- this._m[0] = (near * 2) / h;
389
- this._m[1] = 0;
390
- this._m[2] = 0;
391
- this._m[3] = 0;
392
- this._m[4] = 0;
393
- this._m[5] = (near * 2) / i;
394
- this._m[6] = 0;
395
- this._m[7] = 0;
396
- this._m[8] = (right + left) / h;
397
- this._m[9] = (top + bottom) / i;
398
- this._m[10] = -(far + near) / j;
399
- this._m[11] = -1;
400
- this._m[12] = 0;
401
- this._m[13] = 0;
402
- this._m[14] = -(far * near * 2) / j;
403
- this._m[15] = 0;
387
+ let h = right - left, i = top - bottom, j = near - far, n2 = 2 * near;
388
+ let mm = this._m;
389
+ mm[0] = n2 / h;
390
+ mm[1] = 0;
391
+ mm[2] = 0;
392
+ mm[3] = 0;
393
+ mm[4] = 0;
394
+ mm[5] = n2 / i;
395
+ mm[6] = 0;
396
+ mm[7] = 0;
397
+ mm[8] = (right + left) / h;
398
+ mm[9] = (top + bottom) / i;
399
+ mm[10] = (far + near) / j;
400
+ mm[11] = -1;
401
+ mm[12] = 0;
402
+ mm[13] = 0;
403
+ mm[14] = (n2 * far) / j;
404
+ mm[15] = 0;
404
405
  return this;
405
406
  }
406
407
  /**
@@ -102,7 +102,8 @@ export function forwardArray(lonlatArr) {
102
102
  return res;
103
103
  }
104
104
  export function getTileExtent(x, y, z) {
105
- let size = POLE2 / Math.pow(2, z), sw = new LonLat(-POLE + x * size, POLE - y * size - size);
105
+ let size = POLE2 / (1 << z), //Math.pow(2, z),
106
+ sw = new LonLat(-POLE + x * size, POLE - y * size - size);
106
107
  return new Extent(sw, new LonLat(sw.lon + size, sw.lat + size));
107
108
  }
108
109
  /**
@@ -1,4 +1,3 @@
1
- import * as quadTree from "../quadTree/quadTree";
2
1
  import { Extent } from "../Extent";
3
2
  import { EPSG4326 } from "../proj/EPSG4326";
4
3
  import { Node } from "../quadTree/Node";
@@ -9,9 +8,9 @@ export class EPSG4326QuadTreeStrategy extends QuadTreeStrategy {
9
8
  super(planet, "EPSG4326", EPSG4326);
10
9
  }
11
10
  init() {
12
- let earthQuadTreeSouth = new Node(SegmentLonLatWgs84, this.planet, quadTree.NW, null, 0, 0, Extent.createFromArray([-180, -90, 0, 90]));
13
- let earthQuadTreeWest = new Node(SegmentLonLatWgs84, this.planet, quadTree.NW, null, 0, 0, Extent.createFromArray([0, -90, 180, 90]));
14
- this._quadTreeList.push(earthQuadTreeSouth);
15
- this._quadTreeList.push(earthQuadTreeWest);
11
+ this._quadTreeList = [
12
+ new Node(SegmentLonLatWgs84, this.planet, 0, null, 0, Extent.createFromArray([-180, -90, 0, 90])),
13
+ new Node(SegmentLonLatWgs84, this.planet, 0, null, 0, Extent.createFromArray([0, -90, 180, 90]))
14
+ ];
16
15
  }
17
16
  }
@@ -1,6 +1,9 @@
1
1
  import { Planet } from "../scene/Planet";
2
2
  import { QuadTreeStrategy } from "./QuadTreeStrategy";
3
+ import { LonLat } from "../LonLat";
3
4
  export declare class EarthQuadTreeStrategy extends QuadTreeStrategy {
4
5
  constructor(planet: Planet);
5
6
  init(): void;
7
+ getTileXY(lonLat: LonLat, zoom: number): [number, number, number, number];
8
+ getLonLatTileOffset(lonLat: LonLat, x: number, y: number, z: number, gridSize: number): [number, number];
6
9
  }
@@ -1,9 +1,8 @@
1
1
  import * as mercator from "../mercator";
2
- import * as quadTree from "../quadTree/quadTree";
3
2
  import { Extent } from "../Extent";
4
3
  import { Node } from "../quadTree/Node";
5
4
  import { QuadTreeStrategy } from "./QuadTreeStrategy";
6
- import { Segment } from "../segment/Segment";
5
+ import { Segment, TILEGROUP_NORTH, TILEGROUP_SOUTH, getTileGroupByLat, getTileCellExtent, getTileCellIndex } from "../segment/Segment";
7
6
  import { SegmentLonLat } from "../segment/SegmentLonLat";
8
7
  export class EarthQuadTreeStrategy extends QuadTreeStrategy {
9
8
  constructor(planet) {
@@ -11,9 +10,45 @@ export class EarthQuadTreeStrategy extends QuadTreeStrategy {
11
10
  }
12
11
  init() {
13
12
  this._quadTreeList = [
14
- new Node(Segment, this.planet, quadTree.NW, null, 0, 0, Extent.createFromArray([-20037508.34, -20037508.34, 20037508.34, 20037508.34])),
15
- new Node(SegmentLonLat, this.planet, quadTree.NW, null, 0, 0, Extent.createFromArray([-180, mercator.MAX_LAT, 180, 90])),
16
- new Node(SegmentLonLat, this.planet, quadTree.NW, null, 0, 0, Extent.createFromArray([-180, -90, 180, mercator.MIN_LAT]))
13
+ new Node(Segment, this.planet, 0, null, 0, Extent.createFromArray([-20037508.34, -20037508.34, 20037508.34, 20037508.34])),
14
+ new Node(SegmentLonLat, this.planet, 0, null, 0, Extent.createFromArray([-180, mercator.MAX_LAT, 180, 90])),
15
+ new Node(SegmentLonLat, this.planet, 0, null, 0, Extent.createFromArray([-180, -90, 180, mercator.MIN_LAT]))
17
16
  ];
18
17
  }
18
+ getTileXY(lonLat, zoom) {
19
+ let tileGroup = getTileGroupByLat(lonLat.lat, mercator.MAX_LAT), z = zoom, x = -1, y = -1, pz = (1 << z) /*Math.pow(2, z)*/;
20
+ if (tileGroup === TILEGROUP_NORTH) {
21
+ x = getTileCellIndex(lonLat.lon, 360 / pz, -180);
22
+ y = getTileCellIndex(lonLat.lat, (90 - mercator.MAX_LAT) / pz, 90);
23
+ }
24
+ else if (tileGroup === TILEGROUP_SOUTH) {
25
+ x = getTileCellIndex(lonLat.lon, 360 / pz, -180);
26
+ y = getTileCellIndex(lonLat.lat, (90 - mercator.MAX_LAT) / pz, mercator.MIN_LAT);
27
+ }
28
+ else {
29
+ let merc = mercator.forward(lonLat);
30
+ x = getTileCellIndex(merc.lon, mercator.POLE2 / pz, -mercator.POLE);
31
+ y = getTileCellIndex(merc.lat, mercator.POLE2 / pz, mercator.POLE);
32
+ }
33
+ return [x, y, z, tileGroup];
34
+ }
35
+ getLonLatTileOffset(lonLat, x, y, z, gridSize) {
36
+ let coords = lonLat;
37
+ let extent = new Extent();
38
+ if (lonLat.lat > mercator.MAX_LAT) {
39
+ let worldExtent = Extent.createFromArray([-180, mercator.MAX_LAT, 180, 90]);
40
+ extent = getTileCellExtent(x, y, z, worldExtent);
41
+ }
42
+ else if (lonLat.lat < mercator.MIN_LAT) {
43
+ let worldExtent = Extent.createFromArray([-180, -90, 180, mercator.MIN_LAT]);
44
+ extent = getTileCellExtent(x, y, z, worldExtent);
45
+ }
46
+ else {
47
+ coords = mercator.forward(lonLat);
48
+ extent = mercator.getTileExtent(x, y, z);
49
+ }
50
+ let sizeImgW = extent.getWidth() / (gridSize - 1), sizeImgH = extent.getHeight() / (gridSize - 1);
51
+ let i = gridSize - Math.ceil((coords.lat - extent.southWest.lat) / sizeImgH) - 1, j = Math.floor((coords.lon - extent.southWest.lon) / sizeImgW);
52
+ return [i, j];
53
+ }
19
54
  }
@@ -25,7 +25,7 @@ declare class EntityCollectionNode {
25
25
  zoom: number;
26
26
  bsphere: Sphere;
27
27
  _inTheQueue: boolean;
28
- constructor(layer: Vector, partId: number, parent: EntityCollectionNode | null, id: number, extent: Extent, planet: Planet, zoom: number);
28
+ constructor(layer: Vector, partId: number, parent: EntityCollectionNode | null, extent: Extent, planet: Planet, zoom: number);
29
29
  insertEntity(entity: Entity, rightNow?: boolean): void;
30
30
  protected _addEntitiesToCollection(entities: Entity[], rightNow?: boolean): void;
31
31
  protected _setExtentBounds(): void;
@@ -43,7 +43,7 @@ declare class EntityCollectionNode {
43
43
  }
44
44
  declare class EntityCollectionNodeWGS84 extends EntityCollectionNode {
45
45
  isNorth: boolean;
46
- constructor(layer: Vector, partId: number, parent: EntityCollectionNodeWGS84 | null, id: number, extent: Extent, planet: Planet, zoom: number);
46
+ constructor(layer: Vector, partId: number, parent: EntityCollectionNodeWGS84 | null, extent: Extent, planet: Planet, zoom: number);
47
47
  createChildrenNodes(): void;
48
48
  protected _setExtentBounds(): void;
49
49
  __setLonLat__(entity: Entity): LonLat;
@@ -9,12 +9,13 @@ import { Vec3 } from '../math/Vec3';
9
9
  * @todo: remove planet parameter. It's already available in the layer.
10
10
  */
11
11
  class EntityCollectionNode {
12
- constructor(layer, partId, parent, id, extent, planet, zoom) {
12
+ constructor(layer, partId, parent, extent, planet, zoom) {
13
13
  this.layer = layer;
14
14
  this.parentNode = parent;
15
15
  this.childrenNodes = [];
16
16
  this.partId = partId;
17
- this.nodeId = partId + id;
17
+ //this.nodeId = partId + id;
18
+ this.nodeId = partId + (parent ? parent.nodeId * 4 + 1 : 0);
18
19
  this.state = null;
19
20
  this.extent = extent;
20
21
  this.count = 0;
@@ -125,15 +126,14 @@ class EntityCollectionNode {
125
126
  const size_y = ext.getHeight() * 0.5;
126
127
  const ne = ext.northEast;
127
128
  const sw = ext.southWest;
128
- const id = this.nodeId * 4 + 1;
129
129
  const c = new LonLat(sw.lon + size_x, sw.lat + size_y);
130
130
  const nd = this.childrenNodes;
131
131
  const p = this.layer._planet;
132
132
  const z = this.zoom + 1;
133
- nd[NW] = new EntityCollectionNode(l, NW, this, id, new Extent(new LonLat(sw.lon, sw.lat + size_y), new LonLat(sw.lon + size_x, ne.lat)), p, z);
134
- nd[NE] = new EntityCollectionNode(l, NE, this, id, new Extent(c, new LonLat(ne.lon, ne.lat)), p, z);
135
- nd[SW] = new EntityCollectionNode(l, SW, this, id, new Extent(new LonLat(sw.lon, sw.lat), c), p, z);
136
- nd[SE] = new EntityCollectionNode(l, SE, this, id, new Extent(new LonLat(sw.lon + size_x, sw.lat), new LonLat(ne.lon, sw.lat + size_y)), p, z);
133
+ nd[NW] = new EntityCollectionNode(l, NW, this, new Extent(new LonLat(sw.lon, sw.lat + size_y), new LonLat(sw.lon + size_x, ne.lat)), p, z);
134
+ nd[NE] = new EntityCollectionNode(l, NE, this, new Extent(c, new LonLat(ne.lon, ne.lat)), p, z);
135
+ nd[SW] = new EntityCollectionNode(l, SW, this, new Extent(new LonLat(sw.lon, sw.lat), c), p, z);
136
+ nd[SE] = new EntityCollectionNode(l, SE, this, new Extent(new LonLat(sw.lon + size_x, sw.lat), new LonLat(ne.lon, sw.lat + size_y)), p, z);
137
137
  }
138
138
  collectRenderCollectionsPASS1(visibleNodes, outArr) {
139
139
  const n = visibleNodes[this.nodeId];
@@ -258,8 +258,8 @@ class EntityCollectionNode {
258
258
  }
259
259
  }
260
260
  class EntityCollectionNodeWGS84 extends EntityCollectionNode {
261
- constructor(layer, partId, parent, id, extent, planet, zoom) {
262
- super(layer, partId, parent, id, extent, planet, zoom);
261
+ constructor(layer, partId, parent, extent, planet, zoom) {
262
+ super(layer, partId, parent, extent, planet, zoom);
263
263
  this.isNorth = false;
264
264
  }
265
265
  createChildrenNodes() {
@@ -269,15 +269,14 @@ class EntityCollectionNodeWGS84 extends EntityCollectionNode {
269
269
  const size_y = ext.getHeight() * 0.5;
270
270
  const ne = ext.northEast;
271
271
  const sw = ext.southWest;
272
- const id = this.nodeId * 4 + 1;
273
272
  const c = new LonLat(sw.lon + size_x, sw.lat + size_y);
274
273
  const nd = this.childrenNodes;
275
274
  const p = this.layer._planet;
276
275
  const z = this.zoom + 1;
277
- nd[NW] = new EntityCollectionNodeWGS84(l, NW, this, id, new Extent(new LonLat(sw.lon, sw.lat + size_y), new LonLat(sw.lon + size_x, ne.lat)), p, z);
278
- nd[NE] = new EntityCollectionNodeWGS84(l, NE, this, id, new Extent(c, new LonLat(ne.lon, ne.lat)), p, z);
279
- nd[SW] = new EntityCollectionNodeWGS84(l, SW, this, id, new Extent(new LonLat(sw.lon, sw.lat), c), p, z);
280
- nd[SE] = new EntityCollectionNodeWGS84(l, SE, this, id, new Extent(new LonLat(sw.lon + size_x, sw.lat), new LonLat(ne.lon, sw.lat + size_y)), p, z);
276
+ nd[NW] = new EntityCollectionNodeWGS84(l, NW, this, new Extent(new LonLat(sw.lon, sw.lat + size_y), new LonLat(sw.lon + size_x, ne.lat)), p, z);
277
+ nd[NE] = new EntityCollectionNodeWGS84(l, NE, this, new Extent(c, new LonLat(ne.lon, ne.lat)), p, z);
278
+ nd[SW] = new EntityCollectionNodeWGS84(l, SW, this, new Extent(new LonLat(sw.lon, sw.lat), c), p, z);
279
+ nd[SE] = new EntityCollectionNodeWGS84(l, SE, this, new Extent(new LonLat(sw.lon + size_x, sw.lat), new LonLat(ne.lon, sw.lat + size_y)), p, z);
281
280
  }
282
281
  _setExtentBounds() {
283
282
  if (this.extent.northEast.lat > 0) {
@@ -1,6 +1,11 @@
1
1
  import { Planet } from "../scene/Planet";
2
2
  import { QuadTreeStrategy } from "./QuadTreeStrategy";
3
+ import { LonLat } from "../LonLat";
3
4
  export declare class MarsQuadTreeStrategy extends QuadTreeStrategy {
5
+ private _westExtent;
6
+ private _eastExtent;
4
7
  constructor(planet: Planet);
5
8
  init(): void;
9
+ getTileXY(lonLat: LonLat, zoom: number): [number, number, number, number];
10
+ getLonLatTileOffset(lonLat: LonLat, x: number, y: number, z: number, gridSize: number): [number, number];
6
11
  }
@@ -1,17 +1,43 @@
1
- import * as quadTree from "../quadTree/quadTree";
2
1
  import { Extent } from "../Extent";
3
2
  import { EPSG4326 } from "../proj/EPSG4326";
4
3
  import { Node } from "../quadTree/Node";
5
4
  import { SegmentLonLatWgs84 } from "../segment/SegmentLonLatWgs84";
6
5
  import { QuadTreeStrategy } from "./QuadTreeStrategy";
6
+ import { getTileCellExtent, getTileCellIndex, TILEGROUP_COMMON } from "../segment/Segment";
7
7
  export class MarsQuadTreeStrategy extends QuadTreeStrategy {
8
8
  constructor(planet) {
9
9
  super(planet, "Mars", EPSG4326);
10
+ this._westExtent = Extent.createFromArray([-180, -90, 0, 90]);
11
+ this._eastExtent = Extent.createFromArray([0, -90, 180, 90]);
10
12
  }
11
13
  init() {
12
- let earthQuadTreeSouth = new Node(SegmentLonLatWgs84, this.planet, quadTree.NW, null, 0, 0, Extent.createFromArray([-180, -90, 0, 90]));
13
- let earthQuadTreeWest = new Node(SegmentLonLatWgs84, this.planet, quadTree.NW, null, 0, 0, Extent.createFromArray([0, -90, 180, 90]));
14
- this._quadTreeList.push(earthQuadTreeSouth);
15
- this._quadTreeList.push(earthQuadTreeWest);
14
+ this._quadTreeList = [
15
+ new Node(SegmentLonLatWgs84, this.planet, 0, null, 0, this._westExtent),
16
+ new Node(SegmentLonLatWgs84, this.planet, 0, null, 0, this._eastExtent)
17
+ ];
18
+ }
19
+ getTileXY(lonLat, zoom) {
20
+ let z = zoom, x = -1, y = -1, pz = (1 << z);
21
+ if (lonLat.lon > 0) {
22
+ x = getTileCellIndex(lonLat.lon, 180 / pz, 0) + pz;
23
+ }
24
+ else {
25
+ x = getTileCellIndex(lonLat.lon, 180 / pz, -180);
26
+ }
27
+ y = getTileCellIndex(lonLat.lat, 180 / pz, 90);
28
+ return [x, y, z, TILEGROUP_COMMON];
29
+ }
30
+ getLonLatTileOffset(lonLat, x, y, z, gridSize) {
31
+ let coords = lonLat;
32
+ let extent = new Extent();
33
+ if (lonLat.lon > 0) {
34
+ extent = getTileCellExtent(x - (1 << z), y, z, this._westExtent);
35
+ }
36
+ else {
37
+ extent = getTileCellExtent(x, y, z, this._eastExtent);
38
+ }
39
+ let sizeImgW = extent.getWidth() / (gridSize - 1), sizeImgH = extent.getHeight() / (gridSize - 1);
40
+ let i = gridSize - Math.ceil((coords.lat - extent.southWest.lat) / sizeImgH) - 1, j = Math.floor((coords.lon - extent.southWest.lon) / sizeImgW);
41
+ return [i, j];
16
42
  }
17
43
  }
@@ -14,6 +14,7 @@ import { PlanetCamera } from "../camera/PlanetCamera";
14
14
  * @param {Extent} extent - Planet segment extent.
15
15
  */
16
16
  declare class Node {
17
+ __id: number;
17
18
  SegmentPrototype: typeof Segment;
18
19
  planet: Planet;
19
20
  parentNode: Node | null;
@@ -31,7 +32,7 @@ declare class Node {
31
32
  _cameraInside: boolean;
32
33
  inFrustum: number;
33
34
  _fadingNodes: Node[];
34
- constructor(SegmentPrototype: typeof Segment, planet: Planet, partId: number, parent: Node | null, id: number, tileZoom: number, extent: Extent);
35
+ constructor(SegmentPrototype: typeof Segment, planet: Planet, partId: number, parent: Node | null, tileZoom: number, extent: Extent);
35
36
  createChildrenNodes(): void;
36
37
  createBounds(): void;
37
38
  getState(): number | null;
@@ -19,6 +19,7 @@ let BOUNDS = {
19
19
  xmin: 0.0, ymin: 0.0, zmin: 0.0,
20
20
  xmax: 0.0, ymax: 0.0, zmax: 0.0
21
21
  };
22
+ let __staticCounter = 0;
22
23
  /**
23
24
  * Quad tree planet segment node.
24
25
  * @constructor
@@ -31,13 +32,14 @@ let BOUNDS = {
31
32
  * @param {Extent} extent - Planet segment extent.
32
33
  */
33
34
  class Node {
34
- constructor(SegmentPrototype, planet, partId, parent, id, tileZoom, extent) {
35
+ constructor(SegmentPrototype, planet, partId, parent, tileZoom, extent) {
35
36
  planet._createdNodesCount++;
37
+ this.__id = __staticCounter++;
36
38
  this.SegmentPrototype = SegmentPrototype;
37
39
  this.planet = planet;
38
40
  this.parentNode = parent;
39
41
  this.partId = partId;
40
- this.nodeId = partId + id;
42
+ this.nodeId = partId + (parent ? parent.nodeId * 4 + 1 : 0);
41
43
  this.state = null;
42
44
  this.prevState = null;
43
45
  this.appliedTerrainNodeId = -1;
@@ -63,13 +65,12 @@ class Node {
63
65
  const size_y = ext.getHeight() * 0.5;
64
66
  const ne = ext.northEast;
65
67
  const sw = ext.southWest;
66
- const id = this.nodeId * 4 + 1;
67
68
  const c = new LonLat(sw.lon + size_x, sw.lat + size_y);
68
69
  const nd = this.nodes;
69
- nd[NW] = new Node(this.SegmentPrototype, p, NW, this, id, z, new Extent(new LonLat(sw.lon, sw.lat + size_y), new LonLat(sw.lon + size_x, ne.lat)));
70
- nd[NE] = new Node(this.SegmentPrototype, p, NE, this, id, z, new Extent(c, new LonLat(ne.lon, ne.lat)));
71
- nd[SW] = new Node(this.SegmentPrototype, p, SW, this, id, z, new Extent(new LonLat(sw.lon, sw.lat), c));
72
- nd[SE] = new Node(this.SegmentPrototype, p, SE, this, id, z, new Extent(new LonLat(sw.lon + size_x, sw.lat), new LonLat(ne.lon, sw.lat + size_y)));
70
+ nd[NW] = new Node(this.SegmentPrototype, p, NW, this, z, new Extent(new LonLat(sw.lon, sw.lat + size_y), new LonLat(sw.lon + size_x, ne.lat)));
71
+ nd[NE] = new Node(this.SegmentPrototype, p, NE, this, z, new Extent(c, new LonLat(ne.lon, ne.lat)));
72
+ nd[SW] = new Node(this.SegmentPrototype, p, SW, this, z, new Extent(new LonLat(sw.lon, sw.lat), c));
73
+ nd[SE] = new Node(this.SegmentPrototype, p, SE, this, z, new Extent(new LonLat(sw.lon + size_x, sw.lat), new LonLat(ne.lon, sw.lat + size_y)));
73
74
  }
74
75
  createBounds() {
75
76
  let seg = this.segment;
@@ -155,9 +156,6 @@ class Node {
155
156
  }
156
157
  this.state = WALKTHROUGH;
157
158
  this.clearNeighbors();
158
- // for (let i = 0; i < this._fadingNodes.length; i++) {
159
- // this._fadingNodes[i].neighbors && this._fadingNodes[i].clearNeighbors();
160
- // }
161
159
  let seg = this.segment, planet = this.planet;
162
160
  this._cameraInside = false;
163
161
  // Search a node which the camera is flying over.
@@ -207,7 +205,7 @@ class Node {
207
205
  let altVis = seg.tileZoom < 2 || seg.tileZoom > 19 ||
208
206
  /* Could be replaced with camera frustum always looking down check,
209
207
  and not to go througn nodes from the oppositeside of the globe*/
210
- (seg.tileZoom < 5 && !seg.terrainReady);
208
+ (seg.tileZoom < 6 && !seg.terrainReady);
211
209
  altVis = altVis ||
212
210
  cam.eye.distance2(seg._sw) < horizonDist ||
213
211
  cam.eye.distance2(seg._nw) < horizonDist ||
@@ -316,7 +314,7 @@ class Node {
316
314
  pn = pn.parentNode;
317
315
  }
318
316
  // not sure it's necessary here
319
- //this.parentNode.whileTerrainLoading();
317
+ this.parentNode.whileTerrainLoading();
320
318
  this._fadingNodes.push(this.parentNode);
321
319
  this.parentNode.segment._transitionOpacity = 2.0;
322
320
  this.parentNode.segment._transitionTimestamp = timestamp;
@@ -327,7 +325,7 @@ class Node {
327
325
  for (let i = 0; i < this.nodes.length; i++) {
328
326
  let ni = this.nodes[i];
329
327
  // not sure it's necessary here
330
- //ni.whileTerrainLoading();
328
+ ni.whileTerrainLoading();
331
329
  this._fadingNodes.push(ni);
332
330
  ni.segment._transitionOpacity = 2.0;
333
331
  ni.segment._transitionTimestamp = timestamp;
@@ -341,12 +339,14 @@ class Node {
341
339
  }
342
340
  clearNeighbors() {
343
341
  //this.sideSizeLog2[0] = this.sideSizeLog2[1] = this.sideSizeLog2[2] = this.sideSizeLog2[3] = Math.log2(this.segment.gridSize);
344
- // @ts-ignore
345
- this.neighbors[0] = this.neighbors[1] = this.neighbors[2] = this.neighbors[3] = null;
346
- this.neighbors[0] = [];
347
- this.neighbors[1] = [];
348
- this.neighbors[2] = [];
349
- this.neighbors[3] = [];
342
+ if (this.neighbors) {
343
+ // @ts-ignore
344
+ this.neighbors[0] = this.neighbors[1] = this.neighbors[2] = this.neighbors[3] = null;
345
+ this.neighbors[0] = [];
346
+ this.neighbors[1] = [];
347
+ this.neighbors[2] = [];
348
+ this.neighbors[3] = [];
349
+ }
350
350
  }
351
351
  _refreshTransitionOpacity() {
352
352
  if (this._fadingNodes.length === 0) {
@@ -358,6 +358,13 @@ class Node {
358
358
  this._fadingNodes = [];
359
359
  }
360
360
  else {
361
+ // Looks like a bug fix for suddenly empty spaces
362
+ for (let i = 0; i < this._fadingNodes.length; i++) {
363
+ if (this.segment._transitionOpacity < 1.0 && this._fadingNodes[i].segment._transitionOpacity === 0) {
364
+ this._fadingNodes[i].segment._transitionOpacity = 0;
365
+ this.segment._transitionOpacity = 1.0;
366
+ }
367
+ }
361
368
  this.segment.increaseTransitionOpacity();
362
369
  }
363
370
  }
@@ -457,23 +464,25 @@ class Node {
457
464
  else if (a_sw_lat === b_ne_lat && ((a_sw_lon >= b_sw_lon && a_ne_lon <= b_ne_lon) || (a_sw_lon <= b_sw_lon && a_ne_lon >= b_ne_lon))) {
458
465
  return S;
459
466
  }
460
- else if (bs.tileX === 0 && as.tileX === Math.pow(2, as.tileZoom) - 1 && ((a_ne_lat <= b_ne_lat && a_sw_lat >= b_sw_lat) || (a_ne_lat >= b_ne_lat && a_sw_lat <= b_sw_lat))) {
467
+ // World edge 180 to -180
468
+ else if (bs.tileX === 0 && b_sw_lon === -a_ne_lon && ((a_ne_lat <= b_ne_lat && a_sw_lat >= b_sw_lat) || (a_ne_lat >= b_ne_lat && a_sw_lat <= b_sw_lat))) {
461
469
  return E;
462
470
  }
463
- else if (as.tileX === 0 && bs.tileX === Math.pow(2, bs.tileZoom) - 1 && ((a_ne_lat <= b_ne_lat && a_sw_lat >= b_sw_lat) || (a_ne_lat >= b_ne_lat && a_sw_lat <= b_sw_lat))) {
471
+ else if (as.tileX === 0 && a_sw_lon === -b_ne_lon && ((a_ne_lat <= b_ne_lat && a_sw_lat >= b_sw_lat) || (a_ne_lat >= b_ne_lat && a_sw_lat <= b_sw_lat))) {
464
472
  return W;
465
473
  }
466
474
  }
467
- if (as._tileGroup === TILEGROUP_COMMON && bs._tileGroup === TILEGROUP_NORTH && as.tileY === 0 && bs.tileY === Math.pow(2, bs.tileZoom) - 1 && ((a_sw_lon >= b_sw_lon && a_ne_lon <= b_ne_lon) || (a_sw_lon <= b_sw_lon && a_ne_lon >= b_ne_lon))) {
475
+ // @todo: replace to the default strategy
476
+ if (as._tileGroup === TILEGROUP_COMMON && bs._tileGroup === TILEGROUP_NORTH && as.tileY === 0 && bs.tileY === bs.powTileZoom /*Math.pow(2, bs.tileZoom)*/ - 1 && ((a_sw_lon >= b_sw_lon && a_ne_lon <= b_ne_lon) || (a_sw_lon <= b_sw_lon && a_ne_lon >= b_ne_lon))) {
468
477
  return N;
469
478
  }
470
- else if (as._tileGroup === TILEGROUP_SOUTH && bs._tileGroup === TILEGROUP_COMMON && as.tileY === 0 && bs.tileY === Math.pow(2, bs.tileZoom) - 1 && ((a_sw_lon >= b_sw_lon && a_ne_lon <= b_ne_lon) || (a_sw_lon <= b_sw_lon && a_ne_lon >= b_ne_lon))) {
471
- return N;
472
- }
473
- else if (bs._tileGroup === TILEGROUP_NORTH && as._tileGroup === TILEGROUP_COMMON && as.tileY === Math.pow(2, as.tileZoom) - 1 && bs.tileY === 0 && ((a_sw_lon >= b_sw_lon && a_ne_lon <= b_ne_lon) || (a_sw_lon <= b_sw_lon && a_ne_lon >= b_ne_lon))) {
479
+ else if (as._tileGroup === TILEGROUP_COMMON && bs._tileGroup === TILEGROUP_SOUTH && as.tileY === as.powTileZoom /*Math.pow(2, as.tileZoom)*/ - 1 && bs.tileY === 0 && ((a_sw_lon >= b_sw_lon && a_ne_lon <= b_ne_lon) || (a_sw_lon <= b_sw_lon && a_ne_lon >= b_ne_lon))) {
474
480
  return S;
475
481
  }
476
- else if (as._tileGroup === TILEGROUP_NORTH && bs._tileGroup === TILEGROUP_COMMON && as.tileY === Math.pow(2, as.tileZoom) - 1 && bs.tileY === 0 && ((a_sw_lon >= b_sw_lon && a_ne_lon <= b_ne_lon) || (a_sw_lon <= b_sw_lon && a_ne_lon >= b_ne_lon))) {
482
+ else if (as._tileGroup === TILEGROUP_SOUTH && bs._tileGroup === TILEGROUP_COMMON && as.tileY === 0 && bs.tileY === bs.powTileZoom /*Math.pow(2, bs.tileZoom)*/ - 1 && ((a_sw_lon >= b_sw_lon && a_ne_lon <= b_ne_lon) || (a_sw_lon <= b_sw_lon && a_ne_lon >= b_ne_lon))) {
483
+ return N;
484
+ }
485
+ else if (as._tileGroup === TILEGROUP_NORTH && bs._tileGroup === TILEGROUP_COMMON && as.tileY === as.powTileZoom /*Math.pow(2, as.tileZoom)*/ - 1 && bs.tileY === 0 && ((a_sw_lon >= b_sw_lon && a_ne_lon <= b_ne_lon) || (a_sw_lon <= b_sw_lon && a_ne_lon >= b_ne_lon))) {
477
486
  return S;
478
487
  }
479
488
  }
@@ -506,7 +515,8 @@ class Node {
506
515
  }
507
516
  }
508
517
  if (pn.segment.terrainReady && this.appliedTerrainNodeId !== pn.nodeId) {
509
- let dZ2 = 2 << (seg.tileZoom - pn.segment.tileZoom - 1), offsetX = seg.tileX - pn.segment.tileX * dZ2, offsetY = seg.tileY - pn.segment.tileY * dZ2;
518
+ let dZ2 = 2 << (seg.tileZoom - pn.segment.tileZoom - 1), // 2 * Math.pow(2, dZ-1)
519
+ offsetX = seg.tileX - pn.segment.tileX * dZ2, offsetY = seg.tileY - pn.segment.tileY * dZ2;
510
520
  const pseg = pn.segment;
511
521
  let tempVertices, tempVerticesHigh, tempVerticesLow, noDataVertices;
512
522
  this.appliedTerrainNodeId = pn.nodeId;
@@ -2,6 +2,7 @@ import { Layer } from "../layer/Layer";
2
2
  import { Node } from "../quadTree/Node";
3
3
  import { Planet } from "../scene/Planet";
4
4
  import { Proj } from "../proj/Proj";
5
+ import { LonLat } from "../LonLat";
5
6
  export declare class QuadTreeStrategy {
6
7
  name: string;
7
8
  projection: Proj;
@@ -22,4 +23,6 @@ export declare class QuadTreeStrategy {
22
23
  collectRenderNodes(): void;
23
24
  clear(): void;
24
25
  get quadTreeList(): Node[];
26
+ getTileXY(lonLat: LonLat, zoom: number): [number, number, number, number];
27
+ getLonLatTileOffset(lonLat: LonLat, x: number, y: number, z: number, gridSize: number): [number, number];
25
28
  }
@@ -1,4 +1,6 @@
1
1
  import { EPSG3857 } from "../proj/EPSG3857";
2
+ import { getTileCellExtent, getTileCellIndex, TILEGROUP_COMMON } from "../segment/Segment";
3
+ import { Extent } from "../Extent";
2
4
  export class QuadTreeStrategy {
3
5
  constructor(planet, name = "", proj = EPSG3857) {
4
6
  this.name = name;
@@ -66,4 +68,19 @@ export class QuadTreeStrategy {
66
68
  get quadTreeList() {
67
69
  return this._quadTreeList;
68
70
  }
71
+ getTileXY(lonLat, zoom) {
72
+ let z = zoom, x = -1, y = -1, pz = (1 << z);
73
+ x = getTileCellIndex(lonLat.lon, 360 / pz, -180);
74
+ y = getTileCellIndex(lonLat.lat, 180 / pz, 90);
75
+ return [x, y, z, TILEGROUP_COMMON];
76
+ }
77
+ getLonLatTileOffset(lonLat, x, y, z, gridSize) {
78
+ let coords = lonLat;
79
+ let extent = new Extent();
80
+ let worldExtent = Extent.createFromArray([-180, -90, 180, 90]);
81
+ extent = getTileCellExtent(x, y, z, worldExtent);
82
+ let sizeImgW = extent.getWidth() / (gridSize - 1), sizeImgH = extent.getHeight() / (gridSize - 1);
83
+ let i = gridSize - Math.ceil((coords.lat - extent.southWest.lat) / sizeImgH) - 1, j = Math.floor((coords.lon - extent.southWest.lon) / sizeImgW);
84
+ return [i, j];
85
+ }
69
86
  }
@@ -1,4 +1,3 @@
1
- import * as quadTree from "../quadTree/quadTree";
2
1
  import { Extent } from "../Extent";
3
2
  import { EPSG4326 } from "../proj/EPSG4326";
4
3
  import { Node } from "../quadTree/Node";
@@ -9,7 +8,8 @@ export class Wgs84QuadTreeStrategy extends QuadTreeStrategy {
9
8
  super(planet, "wgs84", EPSG4326);
10
9
  }
11
10
  init() {
12
- let wgs84QuadTree = new Node(SegmentLonLatWgs84, this.planet, quadTree.NW, null, 0, 0, Extent.createFromArray([-180, -90, 180, 90]));
13
- this._quadTreeList.push(wgs84QuadTree);
11
+ this._quadTreeList = [
12
+ new Node(SegmentLonLatWgs84, this.planet, 0, null, 0, Extent.createFromArray([-180, -90, 180, 90]))
13
+ ];
14
14
  }
15
15
  }
@@ -954,6 +954,7 @@ class Renderer {
954
954
  //this.geoObjectsTextureAtlas.clear()
955
955
  //this.fontAtlas.clear();
956
956
  this._entityCollections = [];
957
+ this.handler.ONCANVASRESIZE = null;
957
958
  this.handler.destroy();
958
959
  // @ts-ignore
959
960
  this.handler = null;
@@ -63,8 +63,8 @@ export class Planet extends RenderNode {
63
63
  let isEq = this.terrain.equalizeVertices;
64
64
  for (let j = 0, len = currentNode._fadingNodes.length; j < len; j++) {
65
65
  let f = currentNode._fadingNodes[j].segment;
66
- if (this._fadingNodes.has(currentNode._fadingNodes[0].nodeId) && !nodes.has(f.node.nodeId)) {
67
- nodes.set(f.node.nodeId, true);
66
+ if (this._fadingNodes.has(currentNode._fadingNodes[0].__id) && !nodes.has(f.node.__id)) {
67
+ nodes.set(f.node.__id, true);
68
68
  if (f._transitionOpacity < 1.0) {
69
69
  outTransparentSegments.push(f);
70
70
  }
@@ -88,8 +88,8 @@ export class Planet extends RenderNode {
88
88
  gl.disable(gl.DEPTH_TEST);
89
89
  for (let j = 0, len = currentNode._fadingNodes.length; j < len; j++) {
90
90
  let f = currentNode._fadingNodes[j].segment;
91
- if (this._fadingNodes.has(currentNode._fadingNodes[0].nodeId) && !nodes.has(f.node.nodeId)) {
92
- nodes.set(f.node.nodeId, true);
91
+ if (this._fadingNodes.has(currentNode._fadingNodes[0].__id) && !nodes.has(f.node.__id)) {
92
+ nodes.set(f.node.__id, true);
93
93
  if (isFirstPass) {
94
94
  isEq && f.equalize();
95
95
  f.readyToEngage && f.engage();
@@ -803,6 +803,7 @@ export class Planet extends RenderNode {
803
803
  ri._collectFadingNodes();
804
804
  ri._refreshTransitionOpacity();
805
805
  if (ri.segment._transitionOpacity >= 1.0) {
806
+ ri.clearNeighbors();
806
807
  ri.getRenderedNodesNeighbors(opaqueNodes);
807
808
  opaqueNodes.push(ri);
808
809
  }
@@ -810,6 +811,7 @@ export class Planet extends RenderNode {
810
811
  for (let j = 0; j < ri._fadingNodes.length; j++) {
811
812
  let rij = ri._fadingNodes[j];
812
813
  if (rij.segment && rij.segment._transitionOpacity >= 1.0) {
814
+ rij.clearNeighbors();
813
815
  rij.getRenderedNodesNeighbors(opaqueNodes);
814
816
  opaqueNodes.push(rij);
815
817
  }
@@ -16,9 +16,12 @@ import { NumberArray6, Sphere } from "../bv/Sphere";
16
16
  import { Slice } from "./Slice";
17
17
  import { Vec3 } from "../math/Vec3";
18
18
  import { IPlainSegmentWorkerData } from "../utils/PlainSegmentWorker";
19
+ export declare function getTileCellIndex(coordinate: number, tileSize: number, worldEdge: number): number;
20
+ export declare function getTileCellExtent(x: number, y: number, z: number, worldExtent: Extent): Extent;
19
21
  export declare const TILEGROUP_COMMON = 0;
20
- export declare const TILEGROUP_NORTH = 1;
21
- export declare const TILEGROUP_SOUTH = 2;
22
+ export declare const TILEGROUP_NORTH = 20;
23
+ export declare const TILEGROUP_SOUTH = 300;
24
+ export declare function getTileGroupByLat(lat: number, maxLat?: number): number;
22
25
  /**
23
26
  * Planet segment Web Mercator tile class that stored and rendered with a quad-tree.
24
27
  * @class
@@ -32,6 +35,7 @@ declare class Segment {
32
35
  isPole: boolean;
33
36
  _tileGroup: number;
34
37
  _projection: Proj;
38
+ elevationData: TypedArray | null;
35
39
  /**
36
40
  * Quad tree node of the segment.
37
41
  * @type {Node}
@@ -81,6 +85,11 @@ declare class Segment {
81
85
  * @type {number}
82
86
  */
83
87
  tileZoom: number;
88
+ /**
89
+ * Equals to pow(2, tileZoom).
90
+ * @type {number}
91
+ */
92
+ powTileZoom: number;
84
93
  /**
85
94
  * Horizontal tile index.
86
95
  * @type {number}
@@ -243,6 +252,7 @@ declare class Segment {
243
252
  createPlainSegmentAsync(): void;
244
253
  _plainSegmentWorkerCallback(data: IPlainSegmentWorkerData): void;
245
254
  createPlainSegment(): void;
255
+ protected _projToDeg(lon: number, lat: number): LonLat;
246
256
  protected _createPlainVertices(): void;
247
257
  /**
248
258
  * Gets specific layer material.
@@ -267,19 +277,12 @@ declare class Segment {
267
277
  colorPickingRendering(sh: Program, layerSlice: Layer[], sliceIndex: number, defaultTexture?: WebGLTextureExt | null, isOverlay?: boolean): void;
268
278
  depthRendering(sh: Program, layerSlice: Layer[]): void;
269
279
  protected _getIndexBuffer(): WebGLBufferExt;
270
- /**
271
- * @todo: replace to the strategy
272
- */
273
280
  _collectVisibleNodes(): void;
274
281
  layerOverlap(layer: Layer): boolean;
275
282
  getDefaultTexture(): WebGLTextureExt | null;
276
283
  getExtentLonLat(): Extent;
277
284
  getExtentMerc(): Extent;
278
285
  getExtent(): Extent;
279
- /**
280
- * @todo replace to the strategy
281
- */
282
- getNodeState(): number;
283
286
  getNeighborSide(b: Segment): 0 | 1 | 2 | 3 | -1;
284
287
  }
285
288
  export { Segment };