@openglobus/og 0.11.2 → 0.11.7

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 (273) hide show
  1. package/package.json +13 -13
  2. package/src/og/Clock.js +10 -10
  3. package/src/og/Events.js +8 -6
  4. package/src/og/Extent.js +82 -41
  5. package/src/og/Globe.js +25 -13
  6. package/src/og/ImageCanvas.js +22 -16
  7. package/src/og/LonLat.js +16 -13
  8. package/src/og/Popup.js +21 -14
  9. package/src/og/QueueArray.js +6 -2
  10. package/src/og/Rectangle.js +11 -6
  11. package/src/og/Stack.js +5 -2
  12. package/src/og/ajax.js +21 -33
  13. package/src/og/astro/astro.js +5 -5
  14. package/src/og/astro/earth.js +22 -16
  15. package/src/og/astro/jd.js +23 -18
  16. package/src/og/astro/orbit.js +13 -11
  17. package/src/og/astro/rotation.js +17 -8
  18. package/src/og/bv/Box.js +7 -3
  19. package/src/og/bv/Sphere.js +14 -11
  20. package/src/og/camera/Camera.js +51 -54
  21. package/src/og/camera/Frustum.js +29 -18
  22. package/src/og/camera/PlanetCamera.js +32 -23
  23. package/src/og/control/CompassButton.js +5 -1
  24. package/src/og/control/Control.js +12 -10
  25. package/src/og/control/DebugInfo.js +4 -1
  26. package/src/og/control/EarthCoordinates.js +54 -33
  27. package/src/og/control/KeyboardNavigation.js +10 -10
  28. package/src/og/control/LayerSwitcher.js +22 -21
  29. package/src/og/control/Lighting.js +34 -3
  30. package/src/og/control/MouseNavigation.js +1 -1
  31. package/src/og/control/ScaleControl.js +1 -1
  32. package/src/og/control/SegmentBoundVisualization.js +6 -7
  33. package/src/og/control/ShowFps.js +13 -8
  34. package/src/og/control/SimpleNavigation.js +6 -8
  35. package/src/og/control/Sun.js +25 -15
  36. package/src/og/control/ToggleWireframe.js +4 -4
  37. package/src/og/control/TouchNavigation.js +44 -33
  38. package/src/og/control/ZoomControl.js +41 -25
  39. package/src/og/ellipsoid/Ellipsoid.js +162 -66
  40. package/src/og/ellipsoid/wgs84.js +4 -4
  41. package/src/og/entity/BaseBillboard.js +100 -56
  42. package/src/og/entity/Billboard.js +14 -10
  43. package/src/og/entity/BillboardHandler.js +317 -60
  44. package/src/og/entity/Entity.js +100 -68
  45. package/src/og/entity/EntityCollection.js +70 -47
  46. package/src/og/entity/GeoObject.js +228 -0
  47. package/src/og/entity/GeoObjectHandler.js +910 -0
  48. package/src/og/entity/Geometry.js +27 -24
  49. package/src/og/entity/GeometryHandler.js +596 -124
  50. package/src/og/entity/Label.js +80 -49
  51. package/src/og/entity/LabelHandler.js +45 -244
  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 +80 -32
  55. package/src/og/entity/PointCloudHandler.js +8 -8
  56. package/src/og/entity/Polyline.js +16 -16
  57. package/src/og/entity/Ray.js +60 -27
  58. package/src/og/entity/Strip.js +77 -48
  59. package/src/og/entity/StripHandler.js +26 -26
  60. package/src/og/entity/index.js +8 -16
  61. package/src/og/layer/BaseGeoImage.js +54 -23
  62. package/src/og/layer/CanvasTiles.js +24 -24
  63. package/src/og/layer/GeoImage.js +9 -9
  64. package/src/og/layer/GeoVideo.js +3 -3
  65. package/src/og/layer/KML.js +63 -37
  66. package/src/og/layer/Layer.js +44 -21
  67. package/src/og/layer/Material.js +23 -20
  68. package/src/og/layer/Vector.js +114 -68
  69. package/src/og/layer/WMS.js +34 -17
  70. package/src/og/layer/XYZ.js +48 -46
  71. package/src/og/light/LightSource.js +46 -39
  72. package/src/og/math/Mat3.js +34 -22
  73. package/src/og/math/Mat4.js +603 -459
  74. package/src/og/math/Plane.js +21 -20
  75. package/src/og/math/Quat.js +182 -139
  76. package/src/og/math/Ray.js +38 -33
  77. package/src/og/math/Vec2.js +85 -75
  78. package/src/og/math/Vec3.js +142 -112
  79. package/src/og/math/Vec4.js +27 -31
  80. package/src/og/math/coder.js +10 -10
  81. package/src/og/math.js +12 -12
  82. package/src/og/proj/EPSG3857.js +4 -4
  83. package/src/og/proj/EPSG4326.js +4 -4
  84. package/src/og/proj/Proj.js +4 -6
  85. package/src/og/quadTree/Node.js +8 -8
  86. package/src/og/renderer/Renderer.js +59 -52
  87. package/src/og/renderer/RendererEvents.js +50 -27
  88. package/src/og/scene/BaseNode.js +7 -8
  89. package/src/og/scene/Planet.js +102 -103
  90. package/src/og/scene/RenderNode.js +28 -21
  91. package/src/og/segment/Segment.js +26 -21
  92. package/src/og/segment/SegmentLonLat.js +5 -5
  93. package/src/og/shaders/drawnode.js +135 -142
  94. package/src/og/shaders/geoObject.js +211 -0
  95. package/src/og/shaders/pointCloud.js +41 -41
  96. package/src/og/shaders/shape.js +12 -18
  97. package/src/og/shaders/skybox.js +36 -36
  98. package/src/og/shaders/toneMapping.js +1 -0
  99. package/src/og/shapes/BaseShape.js +126 -54
  100. package/src/og/shapes/Icosphere.js +29 -14
  101. package/src/og/shapes/Sphere.js +12 -15
  102. package/src/og/terrain/BilTerrain.js +1 -0
  103. package/src/og/terrain/EmptyTerrain.js +2 -2
  104. package/src/og/terrain/GlobusTerrain.js +9 -9
  105. package/src/og/utils/FontAtlas.js +6 -2
  106. package/src/og/utils/TextureAtlas.js +22 -24
  107. package/src/og/utils/VectorTileCreator.js +1 -3
  108. package/src/og/utils/shared.js +16 -16
  109. package/src/og/webgl/Framebuffer.js +88 -40
  110. package/src/og/webgl/Handler.js +243 -169
  111. package/src/og/webgl/Multisample.js +47 -19
  112. package/src/og/webgl/Program.js +79 -34
  113. package/src/og/webgl/ProgramController.js +17 -13
  114. package/src/og/webgl/callbacks.js +8 -8
  115. package/src/og/inherits.js +0 -8
  116. package/src/og/utils/polylabel.js +0 -176
  117. package/types/Clock.d.ts +0 -90
  118. package/types/Deferred.d.ts +0 -6
  119. package/types/Events.d.ts +0 -73
  120. package/types/Extent.d.ts +0 -166
  121. package/types/Globe.d.ts +0 -75
  122. package/types/ImageCanvas.d.ts +0 -121
  123. package/types/Lock.d.ts +0 -12
  124. package/types/LonLat.d.ts +0 -108
  125. package/types/Popup.d.ts +0 -38
  126. package/types/QueueArray.d.ts +0 -15
  127. package/types/Rectangle.d.ts +0 -74
  128. package/types/Stack.d.ts +0 -15
  129. package/types/ajax.d.ts +0 -24
  130. package/types/arial.d.ts +0 -48
  131. package/types/astro/astro.d.ts +0 -38
  132. package/types/astro/earth.d.ts +0 -6
  133. package/types/astro/jd.d.ts +0 -254
  134. package/types/bv/Box.d.ts +0 -25
  135. package/types/bv/Sphere.d.ts +0 -38
  136. package/types/bv/index.d.ts +0 -3
  137. package/types/camera/Camera.d.ts +0 -303
  138. package/types/camera/Frustum.d.ts +0 -129
  139. package/types/camera/PlanetCamera.d.ts +0 -223
  140. package/types/camera/index.d.ts +0 -3
  141. package/types/cons.d.ts +0 -40
  142. package/types/control/CompassButton.d.ts +0 -18
  143. package/types/control/Control.d.ts +0 -101
  144. package/types/control/DebugInfo.d.ts +0 -16
  145. package/types/control/EarthCoordinates.d.ts +0 -47
  146. package/types/control/EarthNavigation.d.ts +0 -42
  147. package/types/control/GeoImageDragControl.d.ts +0 -6
  148. package/types/control/KeyboardNavigation.d.ts +0 -22
  149. package/types/control/LayerSwitcher.d.ts +0 -23
  150. package/types/control/Lighting.d.ts +0 -16
  151. package/types/control/MouseNavigation.d.ts +0 -51
  152. package/types/control/ScaleControl.d.ts +0 -22
  153. package/types/control/ShowFps.d.ts +0 -12
  154. package/types/control/SimpleNavigation.d.ts +0 -28
  155. package/types/control/Sun.d.ts +0 -52
  156. package/types/control/ToggleWireframe.d.ts +0 -12
  157. package/types/control/TouchNavigation.d.ts +0 -50
  158. package/types/control/ZoomControl.d.ts +0 -28
  159. package/types/control/index.d.ts +0 -17
  160. package/types/ellipsoid/Ellipsoid.d.ts +0 -142
  161. package/types/ellipsoid/index.d.ts +0 -3
  162. package/types/ellipsoid/wgs84.d.ts +0 -5
  163. package/types/entity/BaseBillboard.d.ts +0 -208
  164. package/types/entity/Billboard.d.ts +0 -94
  165. package/types/entity/BillboardHandler.d.ts +0 -74
  166. package/types/entity/Entity.d.ts +0 -331
  167. package/types/entity/EntityCollection.d.ts +0 -303
  168. package/types/entity/Geometry.d.ts +0 -73
  169. package/types/entity/GeometryHandler.d.ts +0 -76
  170. package/types/entity/Label.d.ts +0 -194
  171. package/types/entity/LabelHandler.d.ts +0 -24
  172. package/types/entity/PointCloud.d.ts +0 -174
  173. package/types/entity/PointCloudHandler.d.ts +0 -38
  174. package/types/entity/Polyline.d.ts +0 -304
  175. package/types/entity/PolylineHandler.d.ts +0 -18
  176. package/types/entity/Ray.d.ts +0 -123
  177. package/types/entity/RayHandler.d.ts +0 -67
  178. package/types/entity/ShapeHandler.d.ts +0 -22
  179. package/types/entity/Strip.d.ts +0 -118
  180. package/types/entity/StripHandler.d.ts +0 -38
  181. package/types/entity/index.d.ts +0 -8
  182. package/types/index.core.d.ts +0 -65
  183. package/types/index.d.ts +0 -45
  184. package/types/index.webgl.d.ts +0 -7
  185. package/types/inherits.d.ts +0 -4
  186. package/types/input/KeyboardHandler.d.ts +0 -10
  187. package/types/input/MouseHandler.d.ts +0 -5
  188. package/types/input/TouchHandler.d.ts +0 -5
  189. package/types/input/input.d.ts +0 -34
  190. package/types/layer/BaseGeoImage.d.ts +0 -107
  191. package/types/layer/CanvasTiles.d.ts +0 -75
  192. package/types/layer/GeoImage.d.ts +0 -65
  193. package/types/layer/GeoTexture2d.d.ts +0 -8
  194. package/types/layer/GeoVideo.d.ts +0 -80
  195. package/types/layer/KML.d.ts +0 -58
  196. package/types/layer/Layer.d.ts +0 -321
  197. package/types/layer/Material.d.ts +0 -48
  198. package/types/layer/Vector.d.ts +0 -228
  199. package/types/layer/WMS.d.ts +0 -66
  200. package/types/layer/XYZ.d.ts +0 -130
  201. package/types/layer/index.d.ts +0 -10
  202. package/types/light/LightSource.d.ts +0 -177
  203. package/types/math/Line2.d.ts +0 -11
  204. package/types/math/Line3.d.ts +0 -10
  205. package/types/math/Mat3.d.ts +0 -63
  206. package/types/math/Mat4.d.ts +0 -173
  207. package/types/math/Plane.d.ts +0 -17
  208. package/types/math/Quat.d.ts +0 -376
  209. package/types/math/Ray.d.ts +0 -81
  210. package/types/math/Vec2.d.ts +0 -308
  211. package/types/math/Vec3.d.ts +0 -459
  212. package/types/math/Vec4.d.ts +0 -161
  213. package/types/math/coder.d.ts +0 -42
  214. package/types/math/index.d.ts +0 -11
  215. package/types/math.d.ts +0 -261
  216. package/types/mercator.d.ts +0 -92
  217. package/types/proj/EPSG3857.d.ts +0 -5
  218. package/types/proj/EPSG4326.d.ts +0 -5
  219. package/types/proj/Proj.d.ts +0 -42
  220. package/types/quadTree/EntityCollectionNode.d.ts +0 -34
  221. package/types/quadTree/Node.d.ts +0 -61
  222. package/types/quadTree/quadTree.d.ts +0 -40
  223. package/types/renderer/Renderer.d.ts +0 -296
  224. package/types/renderer/RendererEvents.d.ts +0 -230
  225. package/types/res/images.d.ts +0 -3
  226. package/types/scene/Axes.d.ts +0 -11
  227. package/types/scene/BaseNode.d.ts +0 -60
  228. package/types/scene/Planet.d.ts +0 -574
  229. package/types/scene/RenderNode.d.ts +0 -143
  230. package/types/scene/SkyBox.d.ts +0 -10
  231. package/types/scene/index.d.ts +0 -4
  232. package/types/segment/Segment.d.ts +0 -271
  233. package/types/segment/SegmentLonLat.d.ts +0 -62
  234. package/types/segment/segmentHelper.d.ts +0 -13
  235. package/types/shaders/billboard.d.ts +0 -3
  236. package/types/shaders/depth.d.ts +0 -2
  237. package/types/shaders/drawnode.d.ts +0 -7
  238. package/types/shaders/label.d.ts +0 -4
  239. package/types/shaders/pointCloud.d.ts +0 -2
  240. package/types/shaders/polyline.d.ts +0 -3
  241. package/types/shaders/ray.d.ts +0 -2
  242. package/types/shaders/screenFrame.d.ts +0 -2
  243. package/types/shaders/shape.d.ts +0 -4
  244. package/types/shaders/skybox.d.ts +0 -2
  245. package/types/shaders/toneMapping.d.ts +0 -2
  246. package/types/shapes/BaseShape.d.ts +0 -247
  247. package/types/shapes/Sphere.d.ts +0 -41
  248. package/types/terrain/BilTerrain.d.ts +0 -8
  249. package/types/terrain/EmptyTerrain.d.ts +0 -72
  250. package/types/terrain/Geoid.d.ts +0 -26
  251. package/types/terrain/GlobusTerrain.d.ts +0 -153
  252. package/types/terrain/MapboxTerrain.d.ts +0 -8
  253. package/types/terrain/index.d.ts +0 -5
  254. package/types/utils/FontAtlas.d.ts +0 -14
  255. package/types/utils/GeoImageCreator.d.ts +0 -30
  256. package/types/utils/ImagesCacheManager.d.ts +0 -10
  257. package/types/utils/Loader.d.ts +0 -25
  258. package/types/utils/NormalMapCreator.d.ts +0 -39
  259. package/types/utils/PlainSegmentWorker.d.ts +0 -10
  260. package/types/utils/TerrainWorker.d.ts +0 -9
  261. package/types/utils/TextureAtlas.d.ts +0 -111
  262. package/types/utils/VectorTileCreator.d.ts +0 -16
  263. package/types/utils/colorTable.d.ts +0 -143
  264. package/types/utils/earcut.d.ts +0 -6
  265. package/types/utils/shared.d.ts +0 -230
  266. package/types/webgl/Framebuffer.d.ts +0 -135
  267. package/types/webgl/Handler.d.ts +0 -372
  268. package/types/webgl/Multisample.d.ts +0 -89
  269. package/types/webgl/Program.d.ts +0 -155
  270. package/types/webgl/ProgramController.d.ts +0 -84
  271. package/types/webgl/callbacks.d.ts +0 -1
  272. package/types/webgl/index.d.ts +0 -6
  273. package/types/webgl/types.d.ts +0 -2
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openglobus/og",
3
- "version": "0.11.2",
3
+ "version": "0.11.7",
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,8 +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
- "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/"
22
22
  },
23
23
  "repository": {
24
24
  "type": "git",
@@ -43,24 +43,24 @@
43
43
  "./css/og.css": "./css/og.css"
44
44
  },
45
45
  "devDependencies": {
46
- "@babel/preset-env": "^7.15.8",
46
+ "@babel/preset-env": "^7.16.4",
47
47
  "@rollup/plugin-json": "^4.1.0",
48
- "eslint": "^8.0.1",
49
- "husky": "^7.0.2",
48
+ "@types/jest": "^27.0.3",
49
+ "eslint": "^8.3.0",
50
50
  "jaguarjs-jsdoc": "^1.1.0",
51
- "jest": "^27.2.5",
51
+ "jest": "^27.3.1",
52
52
  "jest-canvas-mock": "^2.3.1",
53
53
  "jest-webgl-canvas-mock": "^0.2.3",
54
54
  "jsdoc": "^3.6.7",
55
- "lint-staged": "^11.2.3",
55
+ "lint-staged": "^12.1.2",
56
56
  "local-web-server": "^5.1.1",
57
57
  "msdf-bmfont-xml": "^2.5.4",
58
- "postcss": "^8.3.9",
59
- "prettier": "^2.4.1",
60
- "rollup": "^2.58.0",
61
- "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",
62
62
  "rollup-plugin-terser": "^7.0.2",
63
- "typescript": "^4.4.4"
63
+ "typescript": "^4.5.2"
64
64
  },
65
65
  "lint-staged": {
66
66
  "*.{js,ts}": [
package/src/og/Clock.js CHANGED
@@ -2,22 +2,21 @@
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.
12
12
  * @class
13
- * @param {Object} [params]: - Clock parameters:
13
+ * @param {Object} [params] - Clock parameters:
14
14
  * @param {number} [params.startDate=0.0] - Julian start date.
15
15
  * @param {number} [params.endDate=0.0] - Julian end date.
16
16
  * @param {number} [params.currentDate] - Julian current date. Default: current date.
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;
@@ -29,6 +28,10 @@ class Clock {
29
28
  this._counter = n;
30
29
  }
31
30
 
31
+ /**
32
+ *
33
+ * @param {Object} [params] - Clock parameters:
34
+ */
32
35
  constructor(params) {
33
36
  params = params || {};
34
37
 
@@ -46,10 +49,7 @@ class Clock {
46
49
  * @public
47
50
  * @type {Events}
48
51
  */
49
- this.events = new Events([
50
- "tick",
51
- "end"
52
- ], this);
52
+ this.events = new Events(["tick", "end"], this);
53
53
 
54
54
  /**
55
55
  * Start julian date clock loop.
@@ -191,4 +191,4 @@ class Clock {
191
191
  }
192
192
  }
193
193
 
194
- export { Clock };
194
+ export { Clock };
package/src/og/Events.js CHANGED
@@ -2,17 +2,20 @@
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
- * @param {Array.<string>} [eventNames] - Event names that could be dispatched.
13
12
  */
14
13
  class Events {
15
-
14
+ /**
15
+ *
16
+ * @param {Array.<string>} [eventNames] - Event names that could be dispatched.
17
+ * @param {*} [sender]
18
+ */
16
19
  constructor(eventNames, sender) {
17
20
  /**
18
21
  * Registered event names.
@@ -76,7 +79,6 @@ class Events {
76
79
  * @return {boolean} -
77
80
  */
78
81
  _stamp(name, obj) {
79
-
80
82
  var ogid = stamp(obj);
81
83
 
82
84
  var st = this._getStamp(name, this.__id, ogid);
@@ -183,4 +185,4 @@ class Events {
183
185
  }
184
186
  }
185
187
 
186
- 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,25 +34,31 @@ 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.
54
59
  * @static
55
60
  * @param {Array.<number>} arr - South west and north east longitude and latidudes packed in array. (exactly 4 entries)
56
- * @return {og.Extent} Extent object.
61
+ * @return {Extent} Extent object.
57
62
  */
58
63
  static createFromArray(arr) {
59
64
  return new Extent(new LonLat(arr[0], arr[1]), new LonLat(arr[2], arr[3]));
@@ -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;
@@ -82,11 +89,13 @@ export class Extent {
82
89
  * Creates bound extent instance by coordinate array.
83
90
  * @static
84
91
  * @param {Array.<Array<number>>} arr - Coordinate array. (exactly 2 entries)
85
- * @return {og.Extent} Extent object.
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];
@@ -105,7 +114,7 @@ export class Extent {
105
114
  * @param {number} z -
106
115
  * @param {number} width -
107
116
  * @param {number} height -
108
- * @returns {og.Extent} -
117
+ * @returns {Extent} -
109
118
  */
110
119
  static fromTile(x, y, z, width, height) {
111
120
  width = width || mercator.POLE_DOUBLE;
@@ -127,11 +136,13 @@ export class Extent {
127
136
  * Sets current bounding extent object by coordinate array.
128
137
  * @public
129
138
  * @param {Array.<LonLat>} arr - Coordinate array.
130
- * @return {og.Extent} Current extent.
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
  /**
@@ -193,7 +212,7 @@ export class Extent {
193
212
  /**
194
213
  * Creates clone instance of the current extent.
195
214
  * @public
196
- * @return {og.Extent} Extent clone.
215
+ * @return {Extent} Extent clone.
197
216
  */
198
217
  clone() {
199
218
  return new Extent(this.southWest.clone(), this.northEast.clone());
@@ -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
 
@@ -261,18 +281,22 @@ export class Extent {
261
281
 
262
282
  /**
263
283
  * Returns extents are equals.
264
- * @param {og.Extent} extent - Extent.
284
+ * @param {Extent} extent - 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
  /**
273
297
  * Converts extent coordinates to mercator projection coordinates.
274
298
  * @public
275
- * @return {og.Extent} New instance of the current extent.
299
+ * @return {Extent} New instance of the current extent.
276
300
  */
277
301
  forwardMercator() {
278
302
  return new Extent(this.southWest.forwardMercator(), this.northEast.forwardMercator());
@@ -281,7 +305,7 @@ export class Extent {
281
305
  /**
282
306
  * Converts extent coordinates from mercator projection to degrees.
283
307
  * @public
284
- * @return {og.Extent} New instance of the current extent.
308
+ * @return {Extent} New instance of the current extent.
285
309
  */
286
310
  inverseMercator() {
287
311
  return new Extent(this.southWest.inverseMercator(), this.northEast.inverseMercator());
@@ -290,21 +314,29 @@ export class Extent {
290
314
  /**
291
315
  * Gets cartesian bounding bounds of the current ellipsoid.
292
316
  * @public
293
- * @param {og.Ellipsoid} ellipsoid - Ellipsoid.
317
+ * @param {Ellipsoid} ellipsoid - Ellipsoid.
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_";
@@ -50,20 +50,28 @@ const PLANET_NAME_PREFIX = "globus_planet_";
50
50
  *
51
51
  * @param {object} options - Options:
52
52
  * @param {string} options.target - HTML element id where planet canvas have to be created.
53
- * @param {og.scene.RenderNode} [options.skybox] - Render skybox. null - default.
53
+ * @param {RenderNode} [options.skybox] - Render skybox. null - default.
54
54
  * @param {string} [options.name] - Planet name. Default is unic identifier.
55
- * @param {og.terrain.Terrain} [options.terrain] - Terrain provider. Default no terrain - og.terrain.EmptyTerrain.
56
- * @param {Array.<og.control.Control>} [options.controls] - Renderer controls array.
57
- * @param {Array.<og.Layer>} [options.layers] - Planet layers.
58
- * @param {og.Extent} [options.viewExtent] - Viewable starting extent.
55
+ * @param {Terrain} [options.terrain] - Terrain provider. Default no terrain - og.terrain.EmptyTerrain.
56
+ * @param {Array.<control.Control>} [options.controls] - Renderer controls array.
57
+ * @param {Array.<Layer>} [options.layers] - Planet layers.
58
+ * @param {Extent} [options.viewExtent] - Viewable starting extent.
59
59
  * @param {boolean} [options.autoActivate] - Globe rendering auto activation flag. True is default.
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
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
67
+ * @param {Number} [options.minEqualZoomAltitude=10000.0] - Minimal altitude since segments on the screen bacame the same zoom level
68
+ * @param {Number} [options.minEqualZoomCameraSlope=0.8] - Minimal camera slope above te globe where segments on the screen bacame the same zoom level
64
69
  */
65
70
 
66
71
  class Globe {
72
+ /**
73
+ * @param {*} options
74
+ */
67
75
  constructor(options) {
68
76
  // Canvas creation
69
77
  var _canvasId = CANVAS_ID_PREFIX + Globe._staticCounter++;
@@ -108,10 +116,11 @@ class Globe {
108
116
  /**
109
117
  * Interface for the renderer context(events, input states, renderer nodes etc.)
110
118
  * @public
111
- * @type {og.Renderer}
119
+ * @type {Renderer}
112
120
  */
113
121
  this.renderer = new Renderer(
114
- new Handler(_canvasId, {
122
+ new Handler(_canvasId, {
123
+ pixelRatio: window.devicePixelRatio,
115
124
  context: {
116
125
  alpha: false,
117
126
  antialias: false,
@@ -148,7 +157,7 @@ class Globe {
148
157
  /**
149
158
  * Render node renders a planet.
150
159
  * @public
151
- * @type {og.scene.Planet|og.scene.PlanetAtmosphere}
160
+ * @type {Planet|og.scene.PlanetAtmosphere}
152
161
  */
153
162
  // TODO:
154
163
  } else {
@@ -159,7 +168,10 @@ class Globe {
159
168
  useNightTexture: options.useNightTexture,
160
169
  useSpecularTexture: options.useSpecularTexture,
161
170
  minAltitude: options.minAltitude,
162
- maxAltitude: options.maxAltitude
171
+ maxAltitude: options.maxAltitude || 15000000,
172
+ maxEqualZoomAltitude: options.maxEqualZoomAltitude,
173
+ minEqualZoomAltitude: options.minEqualZoomAltitude,
174
+ minEqualZoomCameraSlope: options.minEqualZoomCameraSlope
163
175
  });
164
176
  }
165
177
 
@@ -181,8 +193,8 @@ class Globe {
181
193
  options.useEarthNavigation
182
194
  ? new EarthNavigation()
183
195
  : new MouseNavigation({
184
- minSlope: options.minSlope
185
- }),
196
+ minSlope: options.minSlope
197
+ }),
186
198
  new TouchNavigation(),
187
199
  new EarthCoordinates(),
188
200
  new ScaleControl(),
@@ -2,15 +2,17 @@
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
- * @param {number} [width] - Canvas width. Default 256.
11
- * @param {number} [height] - Canvas height. Default 256.
12
10
  */
13
11
  class ImageCanvas {
12
+ /**
13
+ * @param {number} [width] - Canvas width. Default 256.
14
+ * @param {number} [height] - Canvas height. Default 256.
15
+ */
14
16
  constructor(width, height) {
15
17
  /**
16
18
  * Canvas object.
@@ -26,7 +28,7 @@ class ImageCanvas {
26
28
  * @protected
27
29
  * @type {Object}
28
30
  */
29
- this._context = this._canvas.getContext('2d');
31
+ this._context = this._canvas.getContext("2d");
30
32
  }
31
33
 
32
34
  /**
@@ -100,7 +102,7 @@ class ImageCanvas {
100
102
  resize(width, height) {
101
103
  this._canvas.width = width;
102
104
  this._canvas.height = height;
103
- this._context = this._canvas.getContext('2d');
105
+ this._context = this._canvas.getContext("2d");
104
106
  }
105
107
 
106
108
  /**
@@ -113,7 +115,7 @@ class ImageCanvas {
113
115
  * @param {number} [height] - Image height slice. Image height is default.
114
116
  */
115
117
  drawImage(img, x, y, width, height) {
116
- this._context = this._canvas.getContext('2d');
118
+ this._context = this._canvas.getContext("2d");
117
119
  this._context.drawImage(img, x || 0, y || 0, width || img.width, height || img.height);
118
120
  }
119
121
 
@@ -151,8 +153,8 @@ class ImageCanvas {
151
153
  * @param {string} [color] - Css font color.
152
154
  */
153
155
  drawText(text, x, y, font, color) {
154
- this._context.fillStyle = color || 'black';
155
- this._context.font = font || 'normal 14px Verdana';
156
+ this._context.fillStyle = color || "black";
157
+ this._context.font = font || "normal 14px Verdana";
156
158
  this._context.fillText(text, x || 0, y || 14);
157
159
  }
158
160
 
@@ -198,14 +200,18 @@ class ImageCanvas {
198
200
  openImage() {
199
201
  var img = this.getImage();
200
202
  var dataUrl = img.src;
201
- var windowContent = '<!DOCTYPE html>';
202
- windowContent += '<html>';
203
- windowContent += '<head><title>Print</title></head>';
204
- windowContent += '<body>';
203
+ var windowContent = "<!DOCTYPE html>";
204
+ windowContent += "<html>";
205
+ windowContent += "<head><title>Print</title></head>";
206
+ windowContent += "<body>";
205
207
  windowContent += '<img src="' + dataUrl + '">';
206
- windowContent += '</body>';
207
- windowContent += '</html>';
208
- 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
+ );
209
215
  printWin.document.open();
210
216
  printWin.document.write(windowContent);
211
217
  printWin.document.close();
@@ -220,4 +226,4 @@ class ImageCanvas {
220
226
  }
221
227
  }
222
228
 
223
- 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
- * @param {number} [lon]
26
- * @param {number} [lat]
27
- * @param {number} [height]
24
+ * @param {number} [lon] - Longitude.
25
+ * @param {number} [lat] - Latitude.
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
+ }