@openglobus/og 0.11.1 → 0.11.6

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 (255) hide show
  1. package/package.json +18 -20
  2. package/src/og/Clock.js +11 -11
  3. package/src/og/Deferred.js +1 -1
  4. package/src/og/Events.js +9 -7
  5. package/src/og/Extent.js +117 -72
  6. package/src/og/Globe.js +35 -22
  7. package/src/og/ImageCanvas.js +24 -18
  8. package/src/og/Lock.js +2 -2
  9. package/src/og/LonLat.js +40 -37
  10. package/src/og/Popup.js +21 -15
  11. package/src/og/QueueArray.js +7 -3
  12. package/src/og/Rectangle.js +11 -6
  13. package/src/og/Stack.js +8 -5
  14. package/src/og/ajax.js +21 -33
  15. package/src/og/astro/astro.js +5 -5
  16. package/src/og/astro/earth.js +23 -17
  17. package/src/og/astro/jd.js +44 -39
  18. package/src/og/astro/orbit.js +20 -18
  19. package/src/og/astro/rotation.js +17 -8
  20. package/src/og/bv/Box.js +7 -3
  21. package/src/og/bv/Sphere.js +17 -9
  22. package/src/og/camera/Camera.js +137 -86
  23. package/src/og/camera/Frustum.js +30 -19
  24. package/src/og/camera/PlanetCamera.js +30 -26
  25. package/src/og/control/CompassButton.js +8 -2
  26. package/src/og/control/Control.js +13 -11
  27. package/src/og/control/DebugInfo.js +4 -1
  28. package/src/og/control/EarthCoordinates.js +62 -41
  29. package/src/og/control/EarthNavigation.js +20 -22
  30. package/src/og/control/GeoImageDragControl.js +1 -1
  31. package/src/og/control/KeyboardNavigation.js +12 -12
  32. package/src/og/control/LayerSwitcher.js +24 -23
  33. package/src/og/control/Lighting.js +1 -1
  34. package/src/og/control/MouseNavigation.js +1 -1
  35. package/src/og/control/ScaleControl.js +1 -1
  36. package/src/og/control/SegmentBoundVisualization.js +8 -9
  37. package/src/og/control/ShowFps.js +15 -10
  38. package/src/og/control/SimpleNavigation.js +8 -10
  39. package/src/og/control/Sun.js +25 -15
  40. package/src/og/control/ToggleWireframe.js +5 -5
  41. package/src/og/control/TouchNavigation.js +58 -45
  42. package/src/og/control/ZoomControl.js +41 -25
  43. package/src/og/control/index.js +4 -0
  44. package/src/og/ellipsoid/Ellipsoid.js +181 -85
  45. package/src/og/ellipsoid/wgs84.js +4 -4
  46. package/src/og/entity/BaseBillboard.js +97 -44
  47. package/src/og/entity/Billboard.js +15 -11
  48. package/src/og/entity/BillboardHandler.js +314 -64
  49. package/src/og/entity/Entity.js +106 -74
  50. package/src/og/entity/EntityCollection.js +72 -49
  51. package/src/og/entity/GeoObject.js +228 -0
  52. package/src/og/entity/GeoObjectHandler.js +910 -0
  53. package/src/og/entity/Geometry.js +29 -26
  54. package/src/og/entity/GeometryHandler.js +598 -126
  55. package/src/og/entity/Label.js +74 -40
  56. package/src/og/entity/LabelHandler.js +47 -246
  57. package/src/og/entity/LabelWorker.js +213 -0
  58. package/src/og/entity/Object3d.js +504 -0
  59. package/src/og/entity/PointCloud.js +81 -33
  60. package/src/og/entity/PointCloudHandler.js +9 -9
  61. package/src/og/entity/Polyline.js +39 -39
  62. package/src/og/entity/Ray.js +61 -28
  63. package/src/og/entity/ShapeHandler.js +1 -1
  64. package/src/og/entity/Strip.js +77 -48
  65. package/src/og/entity/StripHandler.js +27 -27
  66. package/src/og/entity/index.js +8 -16
  67. package/src/og/input/KeyboardHandler.js +107 -104
  68. package/src/og/input/MouseHandler.js +81 -78
  69. package/src/og/input/TouchHandler.js +55 -51
  70. package/src/og/layer/BaseGeoImage.js +61 -30
  71. package/src/og/layer/CanvasTiles.js +26 -24
  72. package/src/og/layer/GeoImage.js +10 -10
  73. package/src/og/layer/GeoTexture2d.js +1 -1
  74. package/src/og/layer/GeoVideo.js +3 -3
  75. package/src/og/layer/KML.js +66 -40
  76. package/src/og/layer/Layer.js +27 -17
  77. package/src/og/layer/Material.js +93 -61
  78. package/src/og/layer/Vector.js +118 -72
  79. package/src/og/layer/WMS.js +36 -19
  80. package/src/og/layer/XYZ.js +55 -48
  81. package/src/og/light/LightSource.js +47 -40
  82. package/src/og/math/Line2.js +24 -24
  83. package/src/og/math/Line3.js +103 -102
  84. package/src/og/math/Mat3.js +134 -121
  85. package/src/og/math/Mat4.js +603 -459
  86. package/src/og/math/Plane.js +21 -20
  87. package/src/og/math/Quat.js +980 -927
  88. package/src/og/math/Ray.js +195 -187
  89. package/src/og/math/Vec2.js +127 -117
  90. package/src/og/math/Vec3.js +206 -176
  91. package/src/og/math/Vec4.js +49 -53
  92. package/src/og/math/coder.js +18 -18
  93. package/src/og/math.js +12 -12
  94. package/src/og/mercator.js +11 -11
  95. package/src/og/proj/EPSG3857.js +4 -4
  96. package/src/og/proj/EPSG4326.js +4 -4
  97. package/src/og/proj/Proj.js +31 -31
  98. package/src/og/quadTree/EntityCollectionNode.js +310 -300
  99. package/src/og/quadTree/Node.js +1008 -993
  100. package/src/og/renderer/Renderer.js +768 -747
  101. package/src/og/renderer/RendererEvents.js +9 -6
  102. package/src/og/scene/Axes.js +1 -1
  103. package/src/og/scene/BaseNode.js +8 -9
  104. package/src/og/scene/Planet.js +115 -87
  105. package/src/og/scene/RenderNode.js +29 -22
  106. package/src/og/scene/SkyBox.js +1 -1
  107. package/src/og/segment/Segment.js +1886 -1878
  108. package/src/og/segment/SegmentLonLat.js +298 -268
  109. package/src/og/segment/segmentHelper.js +11 -11
  110. package/src/og/shaders/bloom.js +1 -1
  111. package/src/og/shaders/blur.js +2 -2
  112. package/src/og/shaders/depth.js +1 -1
  113. package/src/og/shaders/geoObject.js +211 -0
  114. package/src/og/shaders/label.js +1 -1
  115. package/src/og/shaders/lumFilter.js +1 -1
  116. package/src/og/shaders/pointCloud.js +42 -42
  117. package/src/og/shaders/screenFrame.js +1 -1
  118. package/src/og/shaders/shape.js +15 -21
  119. package/src/og/shaders/skybox.js +37 -37
  120. package/src/og/shaders/toneMapping.js +1 -1
  121. package/src/og/shapes/BaseShape.js +129 -57
  122. package/src/og/shapes/Icosphere.js +30 -15
  123. package/src/og/shapes/Sphere.js +13 -16
  124. package/src/og/terrain/BilTerrain.js +2 -1
  125. package/src/og/terrain/EmptyTerrain.js +2 -2
  126. package/src/og/terrain/Geoid.js +2 -2
  127. package/src/og/terrain/GlobusTerrain.js +10 -10
  128. package/src/og/terrain/MapboxTerrain.js +1 -1
  129. package/src/og/utils/GeoImageCreator.js +9 -9
  130. package/src/og/utils/Loader.js +6 -6
  131. package/src/og/utils/NormalMapCreator.js +13 -13
  132. package/src/og/utils/TerrainWorker.js +1 -1
  133. package/src/og/utils/TextureAtlas.js +20 -22
  134. package/src/og/utils/VectorTileCreator.js +5 -5
  135. package/src/og/utils/earcut.js +1 -1
  136. package/src/og/utils/shared.js +15 -15
  137. package/src/og/webgl/Framebuffer.js +101 -53
  138. package/src/og/webgl/Handler.js +125 -85
  139. package/src/og/webgl/Multisample.js +55 -27
  140. package/src/og/webgl/Program.js +80 -35
  141. package/src/og/webgl/ProgramController.js +27 -23
  142. package/src/og/webgl/callbacks.js +8 -8
  143. package/types/Clock.d.ts +6 -2
  144. package/types/Deferred.d.ts +1 -1
  145. package/types/Events.d.ts +8 -4
  146. package/types/Extent.d.ts +37 -33
  147. package/types/Globe.d.ts +15 -13
  148. package/types/ImageCanvas.d.ts +5 -3
  149. package/types/LonLat.d.ts +24 -24
  150. package/types/Popup.d.ts +4 -0
  151. package/types/QueueArray.d.ts +6 -2
  152. package/types/Rectangle.d.ts +10 -4
  153. package/types/Stack.d.ts +4 -0
  154. package/types/ajax.d.ts +1 -1
  155. package/types/astro/earth.d.ts +3 -2
  156. package/types/bv/Box.d.ts +10 -5
  157. package/types/bv/Sphere.d.ts +13 -7
  158. package/types/camera/Camera.d.ts +90 -81
  159. package/types/camera/Frustum.d.ts +26 -22
  160. package/types/camera/PlanetCamera.d.ts +49 -53
  161. package/types/control/CompassButton.d.ts +4 -4
  162. package/types/control/Control.d.ts +7 -4
  163. package/types/control/DebugInfo.d.ts +3 -4
  164. package/types/control/EarthCoordinates.d.ts +6 -6
  165. package/types/control/EarthNavigation.d.ts +42 -0
  166. package/types/control/KeyboardNavigation.d.ts +3 -4
  167. package/types/control/LayerSwitcher.d.ts +3 -5
  168. package/types/control/Lighting.d.ts +3 -3
  169. package/types/control/MouseNavigation.d.ts +47 -0
  170. package/types/control/ScaleControl.d.ts +3 -3
  171. package/types/control/ShowFps.d.ts +3 -4
  172. package/types/control/SimpleNavigation.d.ts +3 -6
  173. package/types/control/Sun.d.ts +8 -10
  174. package/types/control/ToggleWireframe.d.ts +3 -3
  175. package/types/control/TouchNavigation.d.ts +48 -0
  176. package/types/control/ZoomControl.d.ts +3 -4
  177. package/types/control/index.d.ts +3 -1
  178. package/types/ellipsoid/Ellipsoid.d.ts +47 -43
  179. package/types/ellipsoid/wgs84.d.ts +3 -2
  180. package/types/entity/BaseBillboard.d.ts +41 -34
  181. package/types/entity/Billboard.d.ts +7 -7
  182. package/types/entity/BillboardHandler.d.ts +4 -0
  183. package/types/entity/Entity.d.ts +101 -83
  184. package/types/entity/EntityCollection.d.ts +57 -43
  185. package/types/entity/GeoObject.d.ts +111 -0
  186. package/types/entity/GeoObjectHandler.d.ts +77 -0
  187. package/types/entity/Geometry.d.ts +9 -7
  188. package/types/entity/GeometryHandler.d.ts +2 -2
  189. package/types/entity/Label.d.ts +24 -29
  190. package/types/entity/LabelHandler.d.ts +9 -2
  191. package/types/entity/LabelWorker.d.ts +9 -0
  192. package/types/entity/PointCloud.d.ts +8 -8
  193. package/types/entity/PointCloudHandler.d.ts +3 -3
  194. package/types/entity/Polyline.d.ts +58 -55
  195. package/types/entity/Ray.d.ts +19 -18
  196. package/types/entity/Strip.d.ts +8 -7
  197. package/types/entity/StripHandler.d.ts +3 -3
  198. package/types/entity/index.d.ts +7 -7
  199. package/types/input/KeyboardHandler.d.ts +10 -0
  200. package/types/input/MouseHandler.d.ts +5 -0
  201. package/types/input/TouchHandler.d.ts +5 -0
  202. package/types/layer/BaseGeoImage.d.ts +23 -35
  203. package/types/layer/CanvasTiles.d.ts +15 -22
  204. package/types/layer/GeoImage.d.ts +5 -18
  205. package/types/layer/GeoVideo.d.ts +5 -30
  206. package/types/layer/KML.d.ts +20 -15
  207. package/types/layer/Layer.d.ts +326 -0
  208. package/types/layer/Material.d.ts +45 -0
  209. package/types/layer/Vector.d.ts +208 -0
  210. package/types/layer/WMS.d.ts +4 -7
  211. package/types/layer/XYZ.d.ts +19 -25
  212. package/types/light/LightSource.d.ts +54 -53
  213. package/types/math/Line2.d.ts +11 -0
  214. package/types/math/Line3.d.ts +10 -0
  215. package/types/math/Mat3.d.ts +30 -18
  216. package/types/math/Mat4.d.ts +71 -52
  217. package/types/math/Plane.d.ts +5 -4
  218. package/types/math/Quat.d.ts +379 -0
  219. package/types/math/Ray.d.ts +82 -0
  220. package/types/math/Vec2.d.ts +102 -101
  221. package/types/math/Vec3.d.ts +143 -142
  222. package/types/math/Vec4.d.ts +40 -39
  223. package/types/math/coder.d.ts +12 -11
  224. package/types/math.d.ts +8 -8
  225. package/types/mercator.d.ts +3 -3
  226. package/types/proj/EPSG3857.d.ts +3 -2
  227. package/types/proj/EPSG4326.d.ts +3 -2
  228. package/types/proj/Proj.d.ts +42 -0
  229. package/types/quadTree/EntityCollectionNode.d.ts +34 -0
  230. package/types/quadTree/Node.d.ts +61 -0
  231. package/types/renderer/Renderer.d.ts +300 -0
  232. package/types/renderer/RendererEvents.d.ts +10 -7
  233. package/types/scene/BaseNode.d.ts +9 -9
  234. package/types/scene/Planet.d.ts +131 -126
  235. package/types/scene/RenderNode.d.ts +22 -23
  236. package/types/segment/Segment.d.ts +279 -0
  237. package/types/segment/SegmentLonLat.d.ts +16 -0
  238. package/types/shaders/geoObject.d.ts +3 -0
  239. package/types/shapes/BaseShape.d.ts +43 -40
  240. package/types/shapes/Sphere.d.ts +7 -7
  241. package/types/terrain/BilTerrain.d.ts +0 -1
  242. package/types/terrain/EmptyTerrain.d.ts +4 -4
  243. package/types/terrain/GlobusTerrain.d.ts +17 -54
  244. package/types/terrain/MapboxTerrain.d.ts +0 -1
  245. package/types/utils/GeoImageCreator.d.ts +3 -2
  246. package/types/utils/TextureAtlas.d.ts +8 -8
  247. package/types/utils/shared.d.ts +25 -24
  248. package/types/webgl/Framebuffer.d.ts +5 -5
  249. package/types/webgl/Handler.d.ts +68 -43
  250. package/types/webgl/Multisample.d.ts +5 -5
  251. package/types/webgl/Program.d.ts +8 -2
  252. package/types/webgl/ProgramController.d.ts +18 -13
  253. package/src/og/inherits.js +0 -8
  254. package/src/og/utils/polylabel.js +0 -176
  255. package/types/inherits.d.ts +0 -4
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openglobus/og",
3
- "version": "0.11.1",
3
+ "version": "0.11.6",
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"
@@ -15,9 +15,10 @@
15
15
  "webgl": "rollup -c --environment entry:webgl",
16
16
  "core": "rollup -c --environment entry:core",
17
17
  "test": "jest --env=jsdom",
18
+ "test_watch": "jest --env=jsdom --watch",
18
19
  "lint": "eslint src/og",
19
20
  "generate_types": "rm -rf types; tsc src/**/*.js --declaration --allowJs --emitDeclarationOnly --outDir types; exit 0",
20
- "prepare": "husky install"
21
+ "compile_js_as_ts": "tsc src/og/index.js --AllowJs --checkJs --outDir dist/@openglobus/src/"
21
22
  },
22
23
  "repository": {
23
24
  "type": "git",
@@ -42,28 +43,24 @@
42
43
  "./css/og.css": "./css/og.css"
43
44
  },
44
45
  "devDependencies": {
45
- "@babel/preset-env": "^7.12.17",
46
+ "@babel/preset-env": "^7.16.0",
46
47
  "@rollup/plugin-json": "^4.1.0",
47
- "eslint": "^6.8.0",
48
- "eslint-config-defaults": "^9.0.0",
49
- "eslint-config-standard": "^14.1.1",
50
- "eslint-plugin-import": "^2.22.1",
51
- "eslint-plugin-node": "^11.1.0",
52
- "eslint-plugin-promise": "^4.3.1",
53
- "eslint-plugin-standard": "^4.1.0",
54
- "husky": "^6.0.0",
48
+ "@types/jest": "^27.0.2",
49
+ "eslint": "^8.2.0",
55
50
  "jaguarjs-jsdoc": "^1.1.0",
56
- "jest": "^27.2.3",
51
+ "jest": "^27.3.1",
52
+ "jest-canvas-mock": "^2.3.1",
53
+ "jest-webgl-canvas-mock": "^0.2.3",
57
54
  "jsdoc": "^3.6.7",
58
- "lint-staged": "^11.0.0",
55
+ "lint-staged": "^11.2.6",
59
56
  "local-web-server": "^5.1.1",
60
- "msdf-bmfont-xml": "^2.3.6",
61
- "postcss": "^8.3.0",
62
- "prettier": "^2.3.0",
63
- "rollup": "^1.32.1",
64
- "rollup-plugin-postcss": "^4.0.0",
65
- "rollup-plugin-terser": "^5.3.1",
66
- "typescript": "^4.4.3"
57
+ "msdf-bmfont-xml": "^2.5.4",
58
+ "postcss": "^8.3.11",
59
+ "prettier": "^2.4.1",
60
+ "rollup": "^2.60.0",
61
+ "rollup-plugin-postcss": "^4.0.1",
62
+ "rollup-plugin-terser": "^7.0.2",
63
+ "typescript": "^4.4.4"
67
64
  },
68
65
  "lint-staged": {
69
66
  "*.{js,ts}": [
@@ -72,6 +69,7 @@
72
69
  },
73
70
  "files": [
74
71
  "src/**/*",
72
+ "dist/**/*",
75
73
  "css/**/*",
76
74
  "types/**/*"
77
75
  ],
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.
@@ -189,6 +189,6 @@ class Clock {
189
189
  equal(clock) {
190
190
  return this._id === clock._id;
191
191
  }
192
- };
192
+ }
193
193
 
194
- export { Clock };
194
+ export { Clock };
@@ -8,4 +8,4 @@ export function Deferred() {
8
8
  this.reject = reject;
9
9
  }.bind(this));
10
10
  Object.freeze(this);
11
- };
11
+ }
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);
@@ -181,6 +183,6 @@ class Events {
181
183
  this._eventNames.length = 0;
182
184
  this._eventNames = [];
183
185
  }
184
- };
186
+ }
185
187
 
186
- export { Events };
188
+ export { Events };
package/src/og/Extent.js CHANGED
@@ -2,20 +2,23 @@
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.
13
13
  * @class
14
- * @param {og.LonLat} [sw] - South West extent corner coordiantes.
15
- * @param {og.LonLat} [ne] - North East extent corner coordiantes.
14
+ * @param {LonLat} [sw] - South West extent corner coordiantes.
15
+ * @param {LonLat} [ne] - North East extent corner coordiantes.
16
16
  */
17
17
  export class Extent {
18
-
18
+ /**
19
+ * @param {LonLat} [sw] - South West extent corner coordiantes.
20
+ * @param {LonLat} [ne] - North East extent corner coordiantes.
21
+ */
19
22
  constructor(sw, ne) {
20
23
  /**
21
24
  * @public
@@ -31,39 +34,47 @@ export class Extent {
31
34
  * Whole mercator extent.
32
35
  * @const
33
36
  */
34
- 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
+ }
35
40
 
36
41
  /**
37
42
  * Degrees extent from north mercator limit to north pole.
38
43
  * @const
39
44
  */
40
- 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
+ }
41
48
 
42
49
  /**
43
50
  * Degrees extent from south pole to south mercator limit.
44
51
  * @const
45
52
  */
46
- 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
+ }
47
56
 
48
57
  /**
49
58
  * Creates extent instance from values in array.
50
59
  * @static
51
60
  * @param {Array.<number>} arr - South west and north east longitude and latidudes packed in array. (exactly 4 entries)
52
- * @return {og.Extent} Extent object.
61
+ * @return {Extent} Extent object.
53
62
  */
54
63
  static createFromArray(arr) {
55
64
  return new Extent(new LonLat(arr[0], arr[1]), new LonLat(arr[2], arr[3]));
56
- };
65
+ }
57
66
 
58
67
  /**
59
68
  * Creates bound extent instance by coordinate array.
60
69
  * @static
61
- * @param {Array.<og.LonLat>} arr - Coordinate array.
62
- * @return {og.Extent} Extent object.
70
+ * @param {Array.<LonLat>} arr - Coordinate array.
71
+ * @return {Extent} Extent object.
63
72
  */
64
73
  static createByCoordinates(arr) {
65
- let lonmin = math.MAX, lonmax = math.MIN,
66
- latmin = math.MAX, latmax = math.MIN;
74
+ let lonmin = math.MAX,
75
+ lonmax = math.MIN,
76
+ latmin = math.MAX,
77
+ latmax = math.MIN;
67
78
  for (let i = 0; i < arr.length; i++) {
68
79
  const vi = arr[i];
69
80
  if (vi.lon < lonmin) lonmin = vi.lon;
@@ -72,17 +83,19 @@ export class Extent {
72
83
  if (vi.lat > latmax) latmax = vi.lat;
73
84
  }
74
85
  return new Extent(new LonLat(lonmin, latmin), new LonLat(lonmax, latmax));
75
- };
86
+ }
76
87
 
77
88
  /**
78
89
  * Creates bound extent instance by coordinate array.
79
90
  * @static
80
- * @param {Array.<Array<number,number>>} arr - Coordinate array.
81
- * @return {og.Extent} Extent object.
91
+ * @param {Array.<Array<number>>} arr - Coordinate array. (exactly 2 entries)
92
+ * @return {Extent} Extent object.
82
93
  */
83
94
  static createByCoordinatesArr(arr) {
84
- let lonmin = math.MAX, lonmax = math.MIN,
85
- latmin = math.MAX, latmax = math.MIN;
95
+ let lonmin = math.MAX,
96
+ lonmax = math.MIN,
97
+ latmin = math.MAX,
98
+ latmax = math.MIN;
86
99
  for (let i = 0; i < arr.length; i++) {
87
100
  const vi = arr[i];
88
101
  if (vi[0] < lonmin) lonmin = vi[0];
@@ -91,7 +104,7 @@ export class Extent {
91
104
  if (vi[1] > latmax) latmax = vi[1];
92
105
  }
93
106
  return new Extent(new LonLat(lonmin, latmin), new LonLat(lonmax, latmax));
94
- };
107
+ }
95
108
 
96
109
  /**
97
110
  * Creates extent by meractor grid tile coordinates.
@@ -101,7 +114,7 @@ export class Extent {
101
114
  * @param {number} z -
102
115
  * @param {number} width -
103
116
  * @param {number} height -
104
- * @returns {og.Extent} -
117
+ * @returns {Extent} -
105
118
  */
106
119
  static fromTile(x, y, z, width, height) {
107
120
  width = width || mercator.POLE_DOUBLE;
@@ -117,17 +130,19 @@ export class Extent {
117
130
  right = left + lnSize;
118
131
 
119
132
  return new Extent(new LonLat(left, bottom), new LonLat(right, top));
120
- };
133
+ }
121
134
 
122
135
  /**
123
136
  * Sets current bounding extent object by coordinate array.
124
137
  * @public
125
- * @param {Array.<og.LonLat>} arr - Coordinate array.
126
- * @return {og.Extent} Current extent.
138
+ * @param {Array.<LonLat>} arr - Coordinate array.
139
+ * @return {Extent} Current extent.
127
140
  */
128
141
  setByCoordinates(arr) {
129
- let lonmin = math.MAX, lonmax = math.MIN,
130
- latmin = math.MAX, latmax = math.MIN;
142
+ let lonmin = math.MAX,
143
+ lonmax = math.MIN,
144
+ latmin = math.MAX,
145
+ latmax = math.MIN;
131
146
  for (let i = 0; i < arr.length; i++) {
132
147
  const vi = arr[i];
133
148
  if (vi.lon < lonmin) lonmin = vi.lon;
@@ -140,7 +155,7 @@ export class Extent {
140
155
  this.northEast.lon = lonmax;
141
156
  this.northEast.lat = latmax;
142
157
  return this;
143
- };
158
+ }
144
159
 
145
160
  /**
146
161
  * Determines if point inside extent.
@@ -151,9 +166,13 @@ export class Extent {
151
166
  isInside(lonlat) {
152
167
  const sw = this.southWest,
153
168
  ne = this.northEast;
154
- return lonlat.lon >= sw.lon && lonlat.lon <= ne.lon &&
155
- lonlat.lat >= sw.lat && lonlat.lat <= ne.lat;
156
- };
169
+ return (
170
+ lonlat.lon >= sw.lon &&
171
+ lonlat.lon <= ne.lon &&
172
+ lonlat.lat >= sw.lat &&
173
+ lonlat.lat <= ne.lat
174
+ );
175
+ }
157
176
 
158
177
  /**
159
178
  * Returns true if two extent overlap each other.
@@ -164,9 +183,13 @@ export class Extent {
164
183
  overlaps(e) {
165
184
  const sw = this.southWest,
166
185
  ne = this.northEast;
167
- return sw.lon <= e.northEast.lon && ne.lon >= e.southWest.lon &&
168
- sw.lat <= e.northEast.lat && ne.lat >= e.southWest.lat;
169
- };
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
+ );
192
+ }
170
193
 
171
194
  /**
172
195
  * Gets extent width.
@@ -175,7 +198,7 @@ export class Extent {
175
198
  */
176
199
  getWidth() {
177
200
  return this.northEast.lon - this.southWest.lon;
178
- };
201
+ }
179
202
 
180
203
  /**
181
204
  * Gets extent height.
@@ -184,16 +207,16 @@ export class Extent {
184
207
  */
185
208
  getHeight() {
186
209
  return this.northEast.lat - this.southWest.lat;
187
- };
210
+ }
188
211
 
189
212
  /**
190
213
  * Creates clone instance of the current extent.
191
214
  * @public
192
- * @return {og.Extent} Extent clone.
215
+ * @return {Extent} Extent clone.
193
216
  */
194
217
  clone() {
195
218
  return new Extent(this.southWest.clone(), this.northEast.clone());
196
- };
219
+ }
197
220
 
198
221
  /**
199
222
  * Gets the center coordinate of the extent.
@@ -201,106 +224,119 @@ export class Extent {
201
224
  * @return {number} Center coordinate.
202
225
  */
203
226
  getCenter() {
204
- const sw = this.southWest, ne = this.northEast;
227
+ const sw = this.southWest,
228
+ ne = this.northEast;
205
229
  return new LonLat(sw.lon + (ne.lon - sw.lon) * 0.5, sw.lat + (ne.lat - sw.lat) * 0.5);
206
- };
230
+ }
207
231
 
208
232
  /**
209
233
  * @public
210
234
  */
211
235
  getNorthWest() {
212
236
  return new LonLat(this.southWest.lon, this.northEast.lat);
213
- };
237
+ }
214
238
 
215
239
  /**
216
240
  * @public
217
241
  */
218
242
  getNorthEast() {
219
243
  return new LonLat(this.northEast.lon, this.northEast.lat);
220
- };
244
+ }
221
245
 
222
246
  getSouthWest() {
223
247
  return new LonLat(this.southWest.lon, this.southWest.lat);
224
- };
248
+ }
225
249
 
226
250
  /**
227
251
  * @public
228
252
  */
229
253
  getSouthEast() {
230
254
  return new LonLat(this.northEast.lon, this.southWest.lat);
231
- };
255
+ }
232
256
 
233
257
  /**
234
258
  * @public
235
259
  */
236
260
  getNorth() {
237
261
  return this.northEast.lat;
238
- };
262
+ }
239
263
 
240
264
  getEast() {
241
265
  return this.northEast.lon;
242
- };
266
+ }
243
267
 
244
268
  /**
245
269
  * @public
246
270
  */
247
271
  getWest() {
248
272
  return this.southWest.lon;
249
- };
273
+ }
250
274
 
251
275
  /**
252
276
  * @public
253
277
  */
254
278
  getSouth() {
255
279
  return this.southWest.lat;
256
- };
280
+ }
257
281
 
258
282
  /**
259
283
  * Returns extents are equals.
260
- * @param {og.Extent} extent - Extent.
284
+ * @param {Extent} extent - Extent.
261
285
  * @returns {boolean} -
262
286
  */
263
287
  equals(extent) {
264
- return this.southWest.lon === extent.southWest.lon && this.southWest.lat === extent.southWest.lat &&
265
- this.northEast.lon === extent.northEast.lon && this.northEast.lat === extent.northEast.lat;
266
- };
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
+ );
294
+ }
267
295
 
268
296
  /**
269
297
  * Converts extent coordinates to mercator projection coordinates.
270
298
  * @public
271
- * @return {og.Extent} New instance of the current extent.
299
+ * @return {Extent} New instance of the current extent.
272
300
  */
273
301
  forwardMercator() {
274
302
  return new Extent(this.southWest.forwardMercator(), this.northEast.forwardMercator());
275
- };
303
+ }
276
304
 
277
305
  /**
278
306
  * Converts extent coordinates from mercator projection to degrees.
279
307
  * @public
280
- * @return {og.Extent} New instance of the current extent.
308
+ * @return {Extent} New instance of the current extent.
281
309
  */
282
310
  inverseMercator() {
283
311
  return new Extent(this.southWest.inverseMercator(), this.northEast.inverseMercator());
284
- };
312
+ }
285
313
 
286
314
  /**
287
315
  * Gets cartesian bounding bounds of the current ellipsoid.
288
316
  * @public
289
- * @param {og.Ellipsoid} ellipsoid - Ellipsoid.
290
- * @return {Array.<number,number,number,number,number,number>} Cartesian 3d coordinate array.
317
+ * @param {Ellipsoid} ellipsoid - Ellipsoid.
318
+ * @return {Array.<number>} Cartesian 3d coordinate array. (exactly 6 entries)
291
319
  */
292
320
  getCartesianBounds(ellipsoid) {
293
- let xmin = math.MAX, xmax = math.MIN, ymin = math.MAX,
294
- ymax = math.MIN, zmin = math.MAX, zmax = math.MIN;
295
-
296
- const v = [new LonLat(this.southWest.lon, this.southWest.lat),
297
- new LonLat(this.southWest.lon, this.northEast.lat),
298
- new LonLat(this.northEast.lon, this.northEast.lat),
299
- 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
+ ];
300
334
 
301
335
  for (let i = 0; i < v.length; i++) {
302
336
  const coord = ellipsoid.lonLatToCartesian(v[i]);
303
- const x = coord.x, y = coord.y, z = coord.z;
337
+ const x = coord.x,
338
+ y = coord.y,
339
+ z = coord.z;
304
340
  if (x < xmin) xmin = x;
305
341
  if (x > xmax) xmax = x;
306
342
  if (y < ymin) ymin = y;
@@ -310,10 +346,19 @@ export class Extent {
310
346
  }
311
347
 
312
348
  return [xmin, ymin, zmin, xmax, ymax, zmax];
313
- };
349
+ }
314
350
 
315
351
  toString() {
316
- return "[" + this.southWest.lon + ", " + this.southWest.lat + ", " + this.northEast.lon + ", " + this.northEast.lat + "]";
317
- };
318
-
319
- }
352
+ return (
353
+ "[" +
354
+ this.southWest.lon +
355
+ ", " +
356
+ this.southWest.lat +
357
+ ", " +
358
+ this.northEast.lon +
359
+ ", " +
360
+ this.northEast.lat +
361
+ "]"
362
+ );
363
+ }
364
+ }