@openglobus/og 0.11.5 → 0.12.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 (267) hide show
  1. package/css/og.css +5 -2
  2. package/package.json +12 -14
  3. package/src/og/Clock.js +6 -10
  4. package/src/og/Events.js +5 -7
  5. package/src/og/Extent.js +73 -32
  6. package/src/og/Globe.js +25 -10
  7. package/src/og/ImageCanvas.js +18 -15
  8. package/src/og/LonLat.js +13 -10
  9. package/src/og/Popup.js +19 -17
  10. package/src/og/QueueArray.js +3 -4
  11. package/src/og/Rectangle.js +4 -6
  12. package/src/og/Stack.js +2 -4
  13. package/src/og/ajax.js +20 -14
  14. package/src/og/astro/earth.js +21 -15
  15. package/src/og/bv/Box.js +2 -3
  16. package/src/og/bv/Sphere.js +10 -7
  17. package/src/og/camera/Camera.js +70 -79
  18. package/src/og/camera/Frustum.js +19 -12
  19. package/src/og/camera/PlanetCamera.js +33 -34
  20. package/src/og/control/CompassButton.js +1 -2
  21. package/src/og/control/Control.js +7 -9
  22. package/src/og/control/DebugInfo.js +2 -3
  23. package/src/og/control/EarthNavigation.js +26 -17
  24. package/src/og/control/KeyboardNavigation.js +9 -9
  25. package/src/og/control/LayerSwitcher.js +21 -20
  26. package/src/og/control/Lighting.js +74 -64
  27. package/src/og/control/MouseNavigation.js +30 -29
  28. package/src/og/control/MouseWheelZoomControl.js +257 -0
  29. package/src/og/control/SegmentBoundVisualization.js +5 -6
  30. package/src/og/control/ShowFps.js +12 -7
  31. package/src/og/control/SimpleNavigation.js +5 -7
  32. package/src/og/control/Sun.js +24 -14
  33. package/src/og/control/ToggleWireframe.js +3 -3
  34. package/src/og/control/TouchNavigation.js +43 -32
  35. package/src/og/control/ZoomControl.js +40 -24
  36. package/src/og/control/index.js +2 -0
  37. package/src/og/control/visibleExtent/Segment.js +1862 -0
  38. package/src/og/control/visibleExtent/VisibleExtent.js +80 -0
  39. package/src/og/control/visibleExtent/drawnode.js +751 -0
  40. package/src/og/ellipsoid/Ellipsoid.js +149 -57
  41. package/src/og/ellipsoid/wgs84.js +3 -3
  42. package/src/og/entity/BaseBillboard.js +72 -30
  43. package/src/og/entity/Billboard.js +9 -5
  44. package/src/og/entity/BillboardHandler.js +315 -62
  45. package/src/og/entity/Entity.js +742 -704
  46. package/src/og/entity/EntityCollection.js +47 -24
  47. package/src/og/entity/GeoObject.js +228 -0
  48. package/src/og/entity/GeoObjectHandler.js +895 -0
  49. package/src/og/entity/GeometryHandler.js +595 -123
  50. package/src/og/entity/Label.js +62 -30
  51. package/src/og/entity/LabelHandler.js +42 -243
  52. package/src/og/entity/LabelWorker.js +218 -0
  53. package/src/og/entity/Object3d.js +504 -0
  54. package/src/og/entity/PointCloud.js +76 -28
  55. package/src/og/entity/PointCloudHandler.js +5 -5
  56. package/src/og/entity/Ray.js +49 -16
  57. package/src/og/entity/Strip.js +72 -43
  58. package/src/og/entity/StripHandler.js +23 -23
  59. package/src/og/layer/BaseGeoImage.js +50 -19
  60. package/src/og/layer/CanvasTiles.js +16 -17
  61. package/src/og/layer/GeoImage.js +8 -16
  62. package/src/og/layer/GeoTexture2d.js +2 -10
  63. package/src/og/layer/GeoVideo.js +2 -10
  64. package/src/og/layer/KML.js +55 -33
  65. package/src/og/layer/Layer.js +24 -33
  66. package/src/og/layer/Material.js +1 -1
  67. package/src/og/layer/Vector.js +94 -48
  68. package/src/og/layer/WMS.js +33 -18
  69. package/src/og/layer/XYZ.js +24 -26
  70. package/src/og/light/LightSource.js +19 -12
  71. package/src/og/math/Mat3.js +24 -12
  72. package/src/og/math/Mat4.js +603 -603
  73. package/src/og/math/Plane.js +19 -18
  74. package/src/og/math/Ray.js +17 -12
  75. package/src/og/math/Vec2.js +24 -14
  76. package/src/og/math/Vec3.js +78 -32
  77. package/src/og/math/coder.js +7 -7
  78. package/src/og/proj/EPSG3857.js +3 -3
  79. package/src/og/proj/EPSG4326.js +3 -3
  80. package/src/og/proj/Proj.js +2 -4
  81. package/src/og/quadTree/Node.js +50 -95
  82. package/src/og/quadTree/quadTree.js +1 -1
  83. package/src/og/renderer/Renderer.js +106 -126
  84. package/src/og/renderer/RendererEvents.js +45 -23
  85. package/src/og/scene/BaseNode.js +2 -3
  86. package/src/og/scene/Planet.js +139 -191
  87. package/src/og/scene/RenderNode.js +15 -8
  88. package/src/og/segment/Segment.js +93 -268
  89. package/src/og/segment/Slice.js +45 -0
  90. package/src/og/shaders/drawnode.js +174 -360
  91. package/src/og/shaders/geoObject.js +211 -0
  92. package/src/og/shaders/pointCloud.js +41 -41
  93. package/src/og/shaders/shape.js +12 -18
  94. package/src/og/shaders/skybox.js +36 -36
  95. package/src/og/shaders/toneMapping.js +1 -0
  96. package/src/og/shapes/BaseShape.js +108 -36
  97. package/src/og/shapes/Icosphere.js +25 -10
  98. package/src/og/shapes/Sphere.js +8 -11
  99. package/src/og/terrain/EmptyTerrain.js +3 -2
  100. package/src/og/terrain/GlobusTerrain.js +2 -0
  101. package/src/og/utils/FontAtlas.js +6 -2
  102. package/src/og/utils/GeoImageCreator.js +5 -1
  103. package/src/og/utils/Loader.js +1 -1
  104. package/src/og/utils/PlainSegmentWorker.js +0 -13
  105. package/src/og/utils/TextureAtlas.js +18 -20
  106. package/src/og/utils/VectorTileCreator.js +1 -3
  107. package/src/og/utils/shared.js +2 -2
  108. package/src/og/webgl/Handler.js +219 -162
  109. package/src/og/webgl/Multisample.js +44 -16
  110. package/src/og/webgl/Program.js +78 -33
  111. package/src/og/webgl/callbacks.js +3 -3
  112. package/types/Clock.d.ts +0 -94
  113. package/types/Deferred.d.ts +0 -6
  114. package/types/Events.d.ts +0 -77
  115. package/types/Extent.d.ts +0 -166
  116. package/types/Globe.d.ts +0 -82
  117. package/types/ImageCanvas.d.ts +0 -123
  118. package/types/Lock.d.ts +0 -12
  119. package/types/LonLat.d.ts +0 -108
  120. package/types/Popup.d.ts +0 -42
  121. package/types/QueueArray.d.ts +0 -19
  122. package/types/Rectangle.d.ts +0 -80
  123. package/types/Stack.d.ts +0 -19
  124. package/types/ajax.d.ts +0 -24
  125. package/types/arial.d.ts +0 -48
  126. package/types/astro/astro.d.ts +0 -38
  127. package/types/astro/earth.d.ts +0 -7
  128. package/types/astro/jd.d.ts +0 -254
  129. package/types/bv/Box.d.ts +0 -30
  130. package/types/bv/Sphere.d.ts +0 -38
  131. package/types/bv/index.d.ts +0 -3
  132. package/types/camera/Camera.d.ts +0 -312
  133. package/types/camera/Frustum.d.ts +0 -133
  134. package/types/camera/PlanetCamera.d.ts +0 -218
  135. package/types/camera/index.d.ts +0 -3
  136. package/types/cons.d.ts +0 -40
  137. package/types/control/CompassButton.d.ts +0 -17
  138. package/types/control/Control.d.ts +0 -104
  139. package/types/control/DebugInfo.d.ts +0 -15
  140. package/types/control/EarthCoordinates.d.ts +0 -47
  141. package/types/control/EarthNavigation.d.ts +0 -42
  142. package/types/control/GeoImageDragControl.d.ts +0 -6
  143. package/types/control/KeyboardNavigation.d.ts +0 -21
  144. package/types/control/LayerSwitcher.d.ts +0 -21
  145. package/types/control/Lighting.d.ts +0 -16
  146. package/types/control/MouseNavigation.d.ts +0 -47
  147. package/types/control/ScaleControl.d.ts +0 -22
  148. package/types/control/ShowFps.d.ts +0 -11
  149. package/types/control/SimpleNavigation.d.ts +0 -25
  150. package/types/control/Sun.d.ts +0 -50
  151. package/types/control/ToggleWireframe.d.ts +0 -12
  152. package/types/control/TouchNavigation.d.ts +0 -48
  153. package/types/control/ZoomControl.d.ts +0 -27
  154. package/types/control/index.d.ts +0 -17
  155. package/types/ellipsoid/Ellipsoid.d.ts +0 -146
  156. package/types/ellipsoid/index.d.ts +0 -3
  157. package/types/ellipsoid/wgs84.d.ts +0 -6
  158. package/types/entity/BaseBillboard.d.ts +0 -208
  159. package/types/entity/Billboard.d.ts +0 -94
  160. package/types/entity/BillboardHandler.d.ts +0 -78
  161. package/types/entity/Entity.d.ts +0 -333
  162. package/types/entity/EntityCollection.d.ts +0 -311
  163. package/types/entity/Geometry.d.ts +0 -74
  164. package/types/entity/GeometryHandler.d.ts +0 -76
  165. package/types/entity/Label.d.ts +0 -189
  166. package/types/entity/LabelHandler.d.ts +0 -29
  167. package/types/entity/PointCloud.d.ts +0 -174
  168. package/types/entity/PointCloudHandler.d.ts +0 -38
  169. package/types/entity/Polyline.d.ts +0 -306
  170. package/types/entity/PolylineHandler.d.ts +0 -18
  171. package/types/entity/Ray.d.ts +0 -124
  172. package/types/entity/RayHandler.d.ts +0 -67
  173. package/types/entity/ShapeHandler.d.ts +0 -22
  174. package/types/entity/Strip.d.ts +0 -119
  175. package/types/entity/StripHandler.d.ts +0 -38
  176. package/types/entity/index.d.ts +0 -8
  177. package/types/index.core.d.ts +0 -65
  178. package/types/index.d.ts +0 -45
  179. package/types/index.webgl.d.ts +0 -7
  180. package/types/input/KeyboardHandler.d.ts +0 -10
  181. package/types/input/MouseHandler.d.ts +0 -5
  182. package/types/input/TouchHandler.d.ts +0 -5
  183. package/types/input/input.d.ts +0 -34
  184. package/types/layer/BaseGeoImage.d.ts +0 -94
  185. package/types/layer/CanvasTiles.d.ts +0 -68
  186. package/types/layer/GeoImage.d.ts +0 -52
  187. package/types/layer/GeoTexture2d.d.ts +0 -8
  188. package/types/layer/GeoVideo.d.ts +0 -55
  189. package/types/layer/KML.d.ts +0 -63
  190. package/types/layer/Layer.d.ts +0 -326
  191. package/types/layer/Material.d.ts +0 -45
  192. package/types/layer/Vector.d.ts +0 -208
  193. package/types/layer/WMS.d.ts +0 -63
  194. package/types/layer/XYZ.d.ts +0 -120
  195. package/types/layer/index.d.ts +0 -10
  196. package/types/light/LightSource.d.ts +0 -178
  197. package/types/math/Line2.d.ts +0 -11
  198. package/types/math/Line3.d.ts +0 -10
  199. package/types/math/Mat3.d.ts +0 -65
  200. package/types/math/Mat4.d.ts +0 -176
  201. package/types/math/Plane.d.ts +0 -18
  202. package/types/math/Quat.d.ts +0 -379
  203. package/types/math/Ray.d.ts +0 -82
  204. package/types/math/Vec2.d.ts +0 -309
  205. package/types/math/Vec3.d.ts +0 -460
  206. package/types/math/Vec4.d.ts +0 -162
  207. package/types/math/coder.d.ts +0 -43
  208. package/types/math/index.d.ts +0 -11
  209. package/types/math.d.ts +0 -261
  210. package/types/mercator.d.ts +0 -92
  211. package/types/proj/EPSG3857.d.ts +0 -6
  212. package/types/proj/EPSG4326.d.ts +0 -6
  213. package/types/proj/Proj.d.ts +0 -42
  214. package/types/quadTree/EntityCollectionNode.d.ts +0 -34
  215. package/types/quadTree/Node.d.ts +0 -61
  216. package/types/quadTree/quadTree.d.ts +0 -40
  217. package/types/renderer/Renderer.d.ts +0 -298
  218. package/types/renderer/RendererEvents.d.ts +0 -233
  219. package/types/res/images.d.ts +0 -3
  220. package/types/scene/Axes.d.ts +0 -11
  221. package/types/scene/BaseNode.d.ts +0 -60
  222. package/types/scene/Planet.d.ts +0 -577
  223. package/types/scene/RenderNode.d.ts +0 -142
  224. package/types/scene/SkyBox.d.ts +0 -10
  225. package/types/scene/index.d.ts +0 -4
  226. package/types/segment/Segment.d.ts +0 -279
  227. package/types/segment/SegmentLonLat.d.ts +0 -16
  228. package/types/segment/segmentHelper.d.ts +0 -13
  229. package/types/shaders/billboard.d.ts +0 -3
  230. package/types/shaders/depth.d.ts +0 -2
  231. package/types/shaders/drawnode.d.ts +0 -7
  232. package/types/shaders/label.d.ts +0 -4
  233. package/types/shaders/pointCloud.d.ts +0 -2
  234. package/types/shaders/polyline.d.ts +0 -3
  235. package/types/shaders/ray.d.ts +0 -2
  236. package/types/shaders/screenFrame.d.ts +0 -2
  237. package/types/shaders/shape.d.ts +0 -4
  238. package/types/shaders/skybox.d.ts +0 -2
  239. package/types/shaders/toneMapping.d.ts +0 -2
  240. package/types/shapes/BaseShape.d.ts +0 -250
  241. package/types/shapes/Sphere.d.ts +0 -41
  242. package/types/terrain/BilTerrain.d.ts +0 -7
  243. package/types/terrain/EmptyTerrain.d.ts +0 -72
  244. package/types/terrain/Geoid.d.ts +0 -26
  245. package/types/terrain/GlobusTerrain.d.ts +0 -116
  246. package/types/terrain/MapboxTerrain.d.ts +0 -7
  247. package/types/terrain/index.d.ts +0 -5
  248. package/types/utils/FontAtlas.d.ts +0 -14
  249. package/types/utils/GeoImageCreator.d.ts +0 -30
  250. package/types/utils/ImagesCacheManager.d.ts +0 -10
  251. package/types/utils/Loader.d.ts +0 -25
  252. package/types/utils/NormalMapCreator.d.ts +0 -39
  253. package/types/utils/PlainSegmentWorker.d.ts +0 -10
  254. package/types/utils/TerrainWorker.d.ts +0 -9
  255. package/types/utils/TextureAtlas.d.ts +0 -111
  256. package/types/utils/VectorTileCreator.d.ts +0 -16
  257. package/types/utils/colorTable.d.ts +0 -143
  258. package/types/utils/earcut.d.ts +0 -6
  259. package/types/utils/shared.d.ts +0 -231
  260. package/types/webgl/Framebuffer.d.ts +0 -135
  261. package/types/webgl/Handler.d.ts +0 -388
  262. package/types/webgl/Multisample.d.ts +0 -89
  263. package/types/webgl/Program.d.ts +0 -155
  264. package/types/webgl/ProgramController.d.ts +0 -89
  265. package/types/webgl/callbacks.d.ts +0 -1
  266. package/types/webgl/index.d.ts +0 -6
  267. package/types/webgl/types.d.ts +0 -2
package/css/og.css CHANGED
@@ -50,7 +50,7 @@
50
50
  height: 19px;
51
51
  position: absolute;
52
52
  background-color: rgba(22, 76, 155, 1) !important;
53
- z-index: 12000;
53
+ z-index: 35000;
54
54
  }
55
55
 
56
56
  .ogAttribution {
@@ -153,7 +153,7 @@
153
153
  right: 0px;
154
154
  width: 17em;
155
155
  background-color: rgba(22, 76, 155, 0.4);
156
- z-index: 5000;
156
+ z-index: 25000;
157
157
  padding: 0 0 0 10px;
158
158
  font-family: "Segoe UI", Frutiger, "Frutiger Linotype", "Dejavu Sans", "Helvetica Neue", Arial, sans-serif;
159
159
  border-radius: 2px;
@@ -261,6 +261,8 @@
261
261
  text-shadow: 0px 0px 3px #616161;
262
262
  padding: 10px;
263
263
  pointer-events: none;
264
+ transform: scale(1.0);
265
+ transform-origin: top left;
264
266
  }
265
267
 
266
268
  .og-debug-info .og-watch-line {
@@ -448,6 +450,7 @@
448
450
 
449
451
  .og-lighing .og-value {
450
452
  float: left;
453
+ width: 50px;
451
454
  }
452
455
 
453
456
  .og-lighing #layers {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openglobus/og",
3
- "version": "0.11.5",
3
+ "version": "0.12.0",
4
4
  "description": "[OpenGlobus](http://www.openglobus.org/) is a javascript library designed to display interactive 3d maps and planets with map tiles, imagery and vector data, markers and 3d objects. It uses the WebGL technology, open source and completely free.",
5
5
  "directories": {
6
6
  "example": "./sandbox"
@@ -17,9 +17,8 @@
17
17
  "test": "jest --env=jsdom",
18
18
  "test_watch": "jest --env=jsdom --watch",
19
19
  "lint": "eslint src/og",
20
- "generate_types": "rm -rf types; tsc src/**/*.js --declaration --allowJs --emitDeclarationOnly --outDir types; exit 0",
21
- "compile_js_as_ts": "tsc src/og/index.js --AllowJs --checkJs --outDir dist/@openglobus/src/",
22
- "prepare": "husky install"
20
+ "generate_types": "rm -rf types; tsc src/**/*.js --declaration --allowJs --emitDeclarationOnly --outDir types",
21
+ "compile_js_as_ts": "tsc src/og/index.js --AllowJs --checkJs --outDir dist/@openglobus/src/"
23
22
  },
24
23
  "repository": {
25
24
  "type": "git",
@@ -44,25 +43,24 @@
44
43
  "./css/og.css": "./css/og.css"
45
44
  },
46
45
  "devDependencies": {
47
- "@babel/preset-env": "^7.15.8",
46
+ "@babel/preset-env": "^7.16.4",
48
47
  "@rollup/plugin-json": "^4.1.0",
49
- "@types/jest": "^27.0.2",
50
- "eslint": "^8.1.0",
51
- "husky": "^7.0.4",
48
+ "@types/jest": "^27.0.3",
49
+ "eslint": "^8.3.0",
52
50
  "jaguarjs-jsdoc": "^1.1.0",
53
51
  "jest": "^27.3.1",
54
52
  "jest-canvas-mock": "^2.3.1",
55
53
  "jest-webgl-canvas-mock": "^0.2.3",
56
54
  "jsdoc": "^3.6.7",
57
- "lint-staged": "^11.2.6",
55
+ "lint-staged": "^12.1.2",
58
56
  "local-web-server": "^5.1.1",
59
57
  "msdf-bmfont-xml": "^2.5.4",
60
- "postcss": "^8.3.11",
61
- "prettier": "^2.4.1",
62
- "rollup": "^2.58.3",
63
- "rollup-plugin-postcss": "^4.0.1",
58
+ "postcss": "^8.4.1",
59
+ "prettier": "^2.5.0",
60
+ "rollup": "^2.60.1",
61
+ "rollup-plugin-postcss": "^4.0.2",
64
62
  "rollup-plugin-terser": "^7.0.2",
65
- "typescript": "^4.4.4"
63
+ "typescript": "^4.5.2"
66
64
  },
67
65
  "lint-staged": {
68
66
  "*.{js,ts}": [
package/src/og/Clock.js CHANGED
@@ -2,10 +2,10 @@
2
2
  * @module og/Clock
3
3
  */
4
4
 
5
- 'use strict';
5
+ "use strict";
6
6
 
7
- import { Events } from './Events.js';
8
- import * as jd from './astro/jd.js';
7
+ import { Events } from "./Events.js";
8
+ import * as jd from "./astro/jd.js";
9
9
 
10
10
  /**
11
11
  * Class represents application timer that stores custom current julian datetime, and time speed multiplier.
@@ -17,7 +17,6 @@ import * as jd from './astro/jd.js';
17
17
  * @param {number} [params.multiplier=1.0] - Time speed multiolier.
18
18
  */
19
19
  class Clock {
20
-
21
20
  static get _staticCounter() {
22
21
  if (!this._counter && this._counter !== 0) {
23
22
  this._counter = 0;
@@ -30,7 +29,7 @@ class Clock {
30
29
  }
31
30
 
32
31
  /**
33
- *
32
+ *
34
33
  * @param {Object} [params] - Clock parameters:
35
34
  */
36
35
  constructor(params) {
@@ -50,10 +49,7 @@ class Clock {
50
49
  * @public
51
50
  * @type {Events}
52
51
  */
53
- this.events = new Events([
54
- "tick",
55
- "end"
56
- ], this);
52
+ this.events = new Events(["tick", "end"], this);
57
53
 
58
54
  /**
59
55
  * Start julian date clock loop.
@@ -195,4 +191,4 @@ class Clock {
195
191
  }
196
192
  }
197
193
 
198
- export { Clock };
194
+ export { Clock };
package/src/og/Events.js CHANGED
@@ -2,20 +2,19 @@
2
2
  * @module og/Events
3
3
  */
4
4
 
5
- 'use strict';
5
+ "use strict";
6
6
 
7
- import { stamp, binaryInsert } from './utils/shared.js';
7
+ import { stamp, binaryInsert } from "./utils/shared.js";
8
8
 
9
9
  /**
10
10
  * Base events class to handle custom events.
11
11
  * @class
12
12
  */
13
13
  class Events {
14
-
15
14
  /**
16
- *
15
+ *
17
16
  * @param {Array.<string>} [eventNames] - Event names that could be dispatched.
18
- * @param {*} [sender]
17
+ * @param {*} [sender]
19
18
  */
20
19
  constructor(eventNames, sender) {
21
20
  /**
@@ -80,7 +79,6 @@ class Events {
80
79
  * @return {boolean} -
81
80
  */
82
81
  _stamp(name, obj) {
83
-
84
82
  var ogid = stamp(obj);
85
83
 
86
84
  var st = this._getStamp(name, this.__id, ogid);
@@ -187,4 +185,4 @@ class Events {
187
185
  }
188
186
  }
189
187
 
190
- export { Events };
188
+ export { Events };
package/src/og/Extent.js CHANGED
@@ -2,11 +2,11 @@
2
2
  * @module og/Extent
3
3
  */
4
4
 
5
- 'use strict';
5
+ "use strict";
6
6
 
7
- import * as math from './math.js';
8
- import * as mercator from './mercator.js';
9
- import { LonLat } from './LonLat.js';
7
+ import * as math from "./math.js";
8
+ import * as mercator from "./mercator.js";
9
+ import { LonLat } from "./LonLat.js";
10
10
 
11
11
  /**
12
12
  * Represents geographical coordinates extent.
@@ -15,7 +15,6 @@ import { LonLat } from './LonLat.js';
15
15
  * @param {LonLat} [ne] - North East extent corner coordiantes.
16
16
  */
17
17
  export class Extent {
18
-
19
18
  /**
20
19
  * @param {LonLat} [sw] - South West extent corner coordiantes.
21
20
  * @param {LonLat} [ne] - North East extent corner coordiantes.
@@ -35,19 +34,25 @@ export class Extent {
35
34
  * Whole mercator extent.
36
35
  * @const
37
36
  */
38
- static get FULL_MERC() { return new Extent(LonLat.SW_MERC, LonLat.NE_MERC); }
37
+ static get FULL_MERC() {
38
+ return new Extent(LonLat.SW_MERC, LonLat.NE_MERC);
39
+ }
39
40
 
40
41
  /**
41
42
  * Degrees extent from north mercator limit to north pole.
42
43
  * @const
43
44
  */
44
- static get NORTH_POLE_DEG() { return new Extent(LonLat.NW_MERC_DEG, new LonLat(180.0, 90.0)); }
45
+ static get NORTH_POLE_DEG() {
46
+ return new Extent(LonLat.NW_MERC_DEG, new LonLat(180.0, 90.0));
47
+ }
45
48
 
46
49
  /**
47
50
  * Degrees extent from south pole to south mercator limit.
48
51
  * @const
49
52
  */
50
- static get SOUTH_POLE_DEG() { return new Extent(new LonLat(-180.0, -90.0), LonLat.SE_MERC_DEG); }
53
+ static get SOUTH_POLE_DEG() {
54
+ return new Extent(new LonLat(-180.0, -90.0), LonLat.SE_MERC_DEG);
55
+ }
51
56
 
52
57
  /**
53
58
  * Creates extent instance from values in array.
@@ -66,8 +71,10 @@ export class Extent {
66
71
  * @return {Extent} Extent object.
67
72
  */
68
73
  static createByCoordinates(arr) {
69
- let lonmin = math.MAX, lonmax = math.MIN,
70
- latmin = math.MAX, latmax = math.MIN;
74
+ let lonmin = math.MAX,
75
+ lonmax = math.MIN,
76
+ latmin = math.MAX,
77
+ latmax = math.MIN;
71
78
  for (let i = 0; i < arr.length; i++) {
72
79
  const vi = arr[i];
73
80
  if (vi.lon < lonmin) lonmin = vi.lon;
@@ -85,8 +92,10 @@ export class Extent {
85
92
  * @return {Extent} Extent object.
86
93
  */
87
94
  static createByCoordinatesArr(arr) {
88
- let lonmin = math.MAX, lonmax = math.MIN,
89
- latmin = math.MAX, latmax = math.MIN;
95
+ let lonmin = math.MAX,
96
+ lonmax = math.MIN,
97
+ latmin = math.MAX,
98
+ latmax = math.MIN;
90
99
  for (let i = 0; i < arr.length; i++) {
91
100
  const vi = arr[i];
92
101
  if (vi[0] < lonmin) lonmin = vi[0];
@@ -130,8 +139,10 @@ export class Extent {
130
139
  * @return {Extent} Current extent.
131
140
  */
132
141
  setByCoordinates(arr) {
133
- let lonmin = math.MAX, lonmax = math.MIN,
134
- latmin = math.MAX, latmax = math.MIN;
142
+ let lonmin = math.MAX,
143
+ lonmax = math.MIN,
144
+ latmin = math.MAX,
145
+ latmax = math.MIN;
135
146
  for (let i = 0; i < arr.length; i++) {
136
147
  const vi = arr[i];
137
148
  if (vi.lon < lonmin) lonmin = vi.lon;
@@ -155,8 +166,12 @@ export class Extent {
155
166
  isInside(lonlat) {
156
167
  const sw = this.southWest,
157
168
  ne = this.northEast;
158
- return lonlat.lon >= sw.lon && lonlat.lon <= ne.lon &&
159
- lonlat.lat >= sw.lat && lonlat.lat <= ne.lat;
169
+ return (
170
+ lonlat.lon >= sw.lon &&
171
+ lonlat.lon <= ne.lon &&
172
+ lonlat.lat >= sw.lat &&
173
+ lonlat.lat <= ne.lat
174
+ );
160
175
  }
161
176
 
162
177
  /**
@@ -168,8 +183,12 @@ export class Extent {
168
183
  overlaps(e) {
169
184
  const sw = this.southWest,
170
185
  ne = this.northEast;
171
- return sw.lon <= e.northEast.lon && ne.lon >= e.southWest.lon &&
172
- sw.lat <= e.northEast.lat && ne.lat >= e.southWest.lat;
186
+ return (
187
+ sw.lon <= e.northEast.lon &&
188
+ ne.lon >= e.southWest.lon &&
189
+ sw.lat <= e.northEast.lat &&
190
+ ne.lat >= e.southWest.lat
191
+ );
173
192
  }
174
193
 
175
194
  /**
@@ -205,7 +224,8 @@ export class Extent {
205
224
  * @return {number} Center coordinate.
206
225
  */
207
226
  getCenter() {
208
- const sw = this.southWest, ne = this.northEast;
227
+ const sw = this.southWest,
228
+ ne = this.northEast;
209
229
  return new LonLat(sw.lon + (ne.lon - sw.lon) * 0.5, sw.lat + (ne.lat - sw.lat) * 0.5);
210
230
  }
211
231
 
@@ -265,8 +285,12 @@ export class Extent {
265
285
  * @returns {boolean} -
266
286
  */
267
287
  equals(extent) {
268
- return this.southWest.lon === extent.southWest.lon && this.southWest.lat === extent.southWest.lat &&
269
- this.northEast.lon === extent.northEast.lon && this.northEast.lat === extent.northEast.lat;
288
+ return (
289
+ this.southWest.lon === extent.southWest.lon &&
290
+ this.southWest.lat === extent.southWest.lat &&
291
+ this.northEast.lon === extent.northEast.lon &&
292
+ this.northEast.lat === extent.northEast.lat
293
+ );
270
294
  }
271
295
 
272
296
  /**
@@ -294,17 +318,25 @@ export class Extent {
294
318
  * @return {Array.<number>} Cartesian 3d coordinate array. (exactly 6 entries)
295
319
  */
296
320
  getCartesianBounds(ellipsoid) {
297
- let xmin = math.MAX, xmax = math.MIN, ymin = math.MAX,
298
- ymax = math.MIN, zmin = math.MAX, zmax = math.MIN;
299
-
300
- const v = [new LonLat(this.southWest.lon, this.southWest.lat),
301
- new LonLat(this.southWest.lon, this.northEast.lat),
302
- new LonLat(this.northEast.lon, this.northEast.lat),
303
- new LonLat(this.northEast.lon, this.southWest.lat)];
321
+ let xmin = math.MAX,
322
+ xmax = math.MIN,
323
+ ymin = math.MAX,
324
+ ymax = math.MIN,
325
+ zmin = math.MAX,
326
+ zmax = math.MIN;
327
+
328
+ const v = [
329
+ new LonLat(this.southWest.lon, this.southWest.lat),
330
+ new LonLat(this.southWest.lon, this.northEast.lat),
331
+ new LonLat(this.northEast.lon, this.northEast.lat),
332
+ new LonLat(this.northEast.lon, this.southWest.lat)
333
+ ];
304
334
 
305
335
  for (let i = 0; i < v.length; i++) {
306
336
  const coord = ellipsoid.lonLatToCartesian(v[i]);
307
- const x = coord.x, y = coord.y, z = coord.z;
337
+ const x = coord.x,
338
+ y = coord.y,
339
+ z = coord.z;
308
340
  if (x < xmin) xmin = x;
309
341
  if (x > xmax) xmax = x;
310
342
  if (y < ymin) ymin = y;
@@ -317,7 +349,16 @@ export class Extent {
317
349
  }
318
350
 
319
351
  toString() {
320
- return "[" + this.southWest.lon + ", " + this.southWest.lat + ", " + this.northEast.lon + ", " + this.northEast.lat + "]";
352
+ return (
353
+ "[" +
354
+ this.southWest.lon +
355
+ ", " +
356
+ this.southWest.lat +
357
+ ", " +
358
+ this.northEast.lon +
359
+ ", " +
360
+ this.northEast.lat +
361
+ "]"
362
+ );
321
363
  }
322
-
323
- }
364
+ }
package/src/og/Globe.js CHANGED
@@ -16,7 +16,7 @@ import { Renderer } from "./renderer/Renderer.js";
16
16
  import { Planet } from "./scene/Planet.js";
17
17
  import { EmptyTerrain } from "./terrain/EmptyTerrain.js";
18
18
  import { isEmpty } from "./utils/shared.js";
19
- import { Handler } from "./webgl/Handler.js";
19
+ import { Handler } from "./webgl/Handler.js";
20
20
 
21
21
  /** @const {string} */
22
22
  const CANVAS_ID_PREFIX = "globus_viewport_";
@@ -60,10 +60,13 @@ const PLANET_NAME_PREFIX = "globus_planet_";
60
60
  * @param {DOMElement} [options.attributionContainer] - Container for attribution list.
61
61
  * @param {Number} [options.maxGridSize] = Maximal segment grid size. 128 is default
62
62
  * @param {boolean} [options.useSpecularTexture] - use specular water mask
63
- * @param {boolean} [options.useNightTexture] - show night cities
64
- * @param {Number} [options.maxEqualZoomAltitude=850000.0] - Maximal altitude since segments on the screen bacame the same zoom level
63
+ * @param {boolean} [options.useNightTexture] - show night cities
64
+ * @param {Number} [options.maxAltitude=15000000.0] - Maximal camera altitude above terrain
65
+ * @param {Number} [options.minAltitude=1.0] - Minimal camera altitude above terrain
66
+ * @param {Number} [options.maxEqualZoomAltitude=15000000.0] - Maximal altitude since segments on the screen bacame the same zoom level
65
67
  * @param {Number} [options.minEqualZoomAltitude=10000.0] - Minimal altitude since segments on the screen bacame the same zoom level
66
68
  * @param {Number} [options.minEqualZoomCameraSlope=0.8] - Minimal camera slope above te globe where segments on the screen bacame the same zoom level
69
+ * @param {Number} [options.loadingBatchSize=12] -
67
70
  */
68
71
 
69
72
  class Globe {
@@ -95,7 +98,16 @@ class Globe {
95
98
  }
96
99
 
97
100
  this.div.appendChild(this._canvas);
98
- this.div.classList.add("ogViewport");
101
+ this.div.classList.add("ogViewport");
102
+
103
+ document.addEventListener("visibilitychange", () => {
104
+ if (document.visibilityState === 'visible') {
105
+ this.renderer.handler.start();
106
+ this.renderer && this.renderer.resize();
107
+ } else {
108
+ this.renderer.handler.stop();
109
+ }
110
+ });
99
111
 
100
112
  function _disableWheel(e) {
101
113
  e.preventDefault();
@@ -117,7 +129,8 @@ class Globe {
117
129
  * @type {Renderer}
118
130
  */
119
131
  this.renderer = new Renderer(
120
- new Handler(_canvasId, {
132
+ new Handler(_canvasId, {
133
+ pixelRatio: window.devicePixelRatio + 0.15,
121
134
  context: {
122
135
  alpha: false,
123
136
  antialias: false,
@@ -159,16 +172,18 @@ class Globe {
159
172
  // TODO:
160
173
  } else {
161
174
  this.planet = new Planet({
162
- name: this._planetName,
175
+ name: this._planetName,
176
+ frustums: options.frustums,
163
177
  ellipsoid: options.ellipsoid,
164
178
  maxGridSize: options.maxGridSize,
165
179
  useNightTexture: options.useNightTexture,
166
180
  useSpecularTexture: options.useSpecularTexture,
167
181
  minAltitude: options.minAltitude,
168
- maxAltitude: options.maxAltitude,
182
+ maxAltitude: options.maxAltitude || 15000000,
169
183
  maxEqualZoomAltitude: options.maxEqualZoomAltitude,
170
184
  minEqualZoomAltitude: options.minEqualZoomAltitude,
171
- minEqualZoomCameraSlope: options.minEqualZoomCameraSlope
185
+ minEqualZoomCameraSlope: options.minEqualZoomCameraSlope,
186
+ loadingBatchSize: options.loadingBatchSize
172
187
  });
173
188
  }
174
189
 
@@ -190,8 +205,8 @@ class Globe {
190
205
  options.useEarthNavigation
191
206
  ? new EarthNavigation()
192
207
  : new MouseNavigation({
193
- minSlope: options.minSlope
194
- }),
208
+ minSlope: options.minSlope
209
+ }),
195
210
  new TouchNavigation(),
196
211
  new EarthCoordinates(),
197
212
  new ScaleControl(),
@@ -2,14 +2,13 @@
2
2
  * @module og/ImageCanvas
3
3
  */
4
4
 
5
- 'use strict';
5
+ "use strict";
6
6
 
7
7
  /**
8
8
  * Usefull class for working with JS canvas object.
9
9
  * @class
10
10
  */
11
11
  class ImageCanvas {
12
-
13
12
  /**
14
13
  * @param {number} [width] - Canvas width. Default 256.
15
14
  * @param {number} [height] - Canvas height. Default 256.
@@ -29,7 +28,7 @@ class ImageCanvas {
29
28
  * @protected
30
29
  * @type {Object}
31
30
  */
32
- this._context = this._canvas.getContext('2d');
31
+ this._context = this._canvas.getContext("2d");
33
32
  }
34
33
 
35
34
  /**
@@ -103,7 +102,7 @@ class ImageCanvas {
103
102
  resize(width, height) {
104
103
  this._canvas.width = width;
105
104
  this._canvas.height = height;
106
- this._context = this._canvas.getContext('2d');
105
+ this._context = this._canvas.getContext("2d");
107
106
  }
108
107
 
109
108
  /**
@@ -116,7 +115,7 @@ class ImageCanvas {
116
115
  * @param {number} [height] - Image height slice. Image height is default.
117
116
  */
118
117
  drawImage(img, x, y, width, height) {
119
- this._context = this._canvas.getContext('2d');
118
+ this._context = this._canvas.getContext("2d");
120
119
  this._context.drawImage(img, x || 0, y || 0, width || img.width, height || img.height);
121
120
  }
122
121
 
@@ -154,8 +153,8 @@ class ImageCanvas {
154
153
  * @param {string} [color] - Css font color.
155
154
  */
156
155
  drawText(text, x, y, font, color) {
157
- this._context.fillStyle = color || 'black';
158
- this._context.font = font || 'normal 14px Verdana';
156
+ this._context.fillStyle = color || "black";
157
+ this._context.font = font || "normal 14px Verdana";
159
158
  this._context.fillText(text, x || 0, y || 14);
160
159
  }
161
160
 
@@ -201,14 +200,18 @@ class ImageCanvas {
201
200
  openImage() {
202
201
  var img = this.getImage();
203
202
  var dataUrl = img.src;
204
- var windowContent = '<!DOCTYPE html>';
205
- windowContent += '<html>';
206
- windowContent += '<head><title>Print</title></head>';
207
- windowContent += '<body>';
203
+ var windowContent = "<!DOCTYPE html>";
204
+ windowContent += "<html>";
205
+ windowContent += "<head><title>Print</title></head>";
206
+ windowContent += "<body>";
208
207
  windowContent += '<img src="' + dataUrl + '">';
209
- windowContent += '</body>';
210
- windowContent += '</html>';
211
- var printWin = window.open('', '', 'width=' + img.width + 'px ,height=' + img.height + 'px');
208
+ windowContent += "</body>";
209
+ windowContent += "</html>";
210
+ var printWin = window.open(
211
+ "",
212
+ "",
213
+ "width=" + img.width + "px ,height=" + img.height + "px"
214
+ );
212
215
  printWin.document.open();
213
216
  printWin.document.write(windowContent);
214
217
  printWin.document.close();
@@ -223,4 +226,4 @@ class ImageCanvas {
223
226
  }
224
227
  }
225
228
 
226
- export { ImageCanvas };
229
+ export { ImageCanvas };
package/src/og/LonLat.js CHANGED
@@ -2,9 +2,9 @@
2
2
  * @module og/LonLat
3
3
  */
4
4
 
5
- 'use strict';
5
+ "use strict";
6
6
 
7
- import * as mercator from './mercator.js';
7
+ import * as mercator from "./mercator.js";
8
8
 
9
9
  const HALF_PI = Math.PI * 0.5;
10
10
  const INV_PI_BY_180 = 180.0 / Math.PI;
@@ -20,14 +20,12 @@ const INV_PI_BY_180_HALF_PI = INV_PI_BY_180 * HALF_PI;
20
20
  * @param {number} [height] - Height over the surface.
21
21
  */
22
22
  export class LonLat {
23
-
24
23
  /**
25
24
  * @param {number} [lon] - Longitude.
26
25
  * @param {number} [lat] - Latitude.
27
26
  * @param {number} [height] - Height over the surface.
28
27
  */
29
28
  constructor(lon, lat, height) {
30
-
31
29
  /**
32
30
  * Longitude.
33
31
  * @public
@@ -88,9 +86,11 @@ export class LonLat {
88
86
  * @returns {LonLat} -
89
87
  */
90
88
  static forwardMercator(lon, lat, height) {
91
- return new LonLat(lon * mercator.POLE_BY_180,
89
+ return new LonLat(
90
+ lon * mercator.POLE_BY_180,
92
91
  Math.log(Math.tan((90.0 + lat) * PI_BY_360)) * mercator.POLE_BY_PI,
93
- height);
92
+ height
93
+ );
94
94
  }
95
95
 
96
96
  /**
@@ -102,9 +102,11 @@ export class LonLat {
102
102
  * @returns {LonLat} -
103
103
  */
104
104
  static inverseMercator(x, y, height) {
105
- return new LonLat(x * mercator.INV_POLE_BY_180,
105
+ return new LonLat(
106
+ x * mercator.INV_POLE_BY_180,
106
107
  INV_PI_BY_360 * Math.atan(Math.exp(y * mercator.PI_BY_POLE)) - INV_PI_BY_180_HALF_PI,
107
- height);
108
+ height
109
+ );
108
110
  }
109
111
 
110
112
  /**
@@ -162,7 +164,8 @@ export class LonLat {
162
164
  }
163
165
  return new LonLat(
164
166
  this.lon * mercator.POLE_BY_180,
165
- Math.log(Math.tan((90.0 + lat) * PI_BY_360)) * mercator.POLE_BY_PI);
167
+ Math.log(Math.tan((90.0 + lat) * PI_BY_360)) * mercator.POLE_BY_PI
168
+ );
166
169
  }
167
170
 
168
171
  /**
@@ -187,4 +190,4 @@ export class LonLat {
187
190
  return this.lon === b.lon && this.lat === b.lat;
188
191
  }
189
192
  }
190
- }
193
+ }