@openglobus/og 0.11.5 → 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 (145) hide show
  1. package/package.json +5 -7
  2. package/src/og/Clock.js +6 -10
  3. package/src/og/Events.js +5 -7
  4. package/src/og/Extent.js +73 -32
  5. package/src/og/ImageCanvas.js +18 -15
  6. package/src/og/LonLat.js +13 -10
  7. package/src/og/Popup.js +18 -17
  8. package/src/og/QueueArray.js +3 -4
  9. package/src/og/Rectangle.js +4 -6
  10. package/src/og/Stack.js +2 -4
  11. package/src/og/ajax.js +20 -14
  12. package/src/og/astro/earth.js +21 -15
  13. package/src/og/bv/Box.js +2 -3
  14. package/src/og/bv/Sphere.js +10 -7
  15. package/src/og/camera/Frustum.js +19 -12
  16. package/src/og/camera/PlanetCamera.js +0 -1
  17. package/src/og/control/CompassButton.js +1 -2
  18. package/src/og/control/Control.js +7 -9
  19. package/src/og/control/DebugInfo.js +0 -1
  20. package/src/og/control/KeyboardNavigation.js +9 -9
  21. package/src/og/control/LayerSwitcher.js +21 -20
  22. package/src/og/control/SegmentBoundVisualization.js +5 -6
  23. package/src/og/control/ShowFps.js +12 -7
  24. package/src/og/control/SimpleNavigation.js +5 -7
  25. package/src/og/control/Sun.js +22 -12
  26. package/src/og/control/ToggleWireframe.js +3 -3
  27. package/src/og/control/TouchNavigation.js +43 -32
  28. package/src/og/control/ZoomControl.js +40 -24
  29. package/src/og/ellipsoid/Ellipsoid.js +148 -56
  30. package/src/og/ellipsoid/wgs84.js +3 -3
  31. package/src/og/entity/BaseBillboard.js +65 -14
  32. package/src/og/entity/Billboard.js +9 -5
  33. package/src/og/entity/BillboardHandler.js +310 -64
  34. package/src/og/entity/Entity.js +39 -1
  35. package/src/og/entity/EntityCollection.js +47 -24
  36. package/src/og/entity/GeoObject.js +228 -0
  37. package/src/og/entity/GeoObjectHandler.js +910 -0
  38. package/src/og/entity/GeometryHandler.js +595 -123
  39. package/src/og/entity/Label.js +53 -18
  40. package/src/og/entity/LabelHandler.js +42 -244
  41. package/src/og/entity/LabelWorker.js +213 -0
  42. package/src/og/entity/Object3d.js +504 -0
  43. package/src/og/entity/PointCloud.js +76 -28
  44. package/src/og/entity/PointCloudHandler.js +5 -5
  45. package/src/og/entity/Ray.js +49 -16
  46. package/src/og/entity/Strip.js +72 -43
  47. package/src/og/entity/StripHandler.js +23 -23
  48. package/src/og/layer/BaseGeoImage.js +50 -19
  49. package/src/og/layer/CanvasTiles.js +16 -16
  50. package/src/og/layer/GeoImage.js +6 -6
  51. package/src/og/layer/KML.js +55 -33
  52. package/src/og/layer/Layer.js +3 -3
  53. package/src/og/layer/Vector.js +94 -48
  54. package/src/og/layer/WMS.js +33 -16
  55. package/src/og/light/LightSource.js +19 -12
  56. package/src/og/math/Mat3.js +24 -12
  57. package/src/og/math/Mat4.js +603 -603
  58. package/src/og/math/Plane.js +19 -18
  59. package/src/og/math/Ray.js +17 -12
  60. package/src/og/math/Vec2.js +24 -14
  61. package/src/og/math/Vec3.js +60 -30
  62. package/src/og/math/coder.js +7 -7
  63. package/src/og/proj/EPSG3857.js +3 -3
  64. package/src/og/proj/EPSG4326.js +3 -3
  65. package/src/og/proj/Proj.js +2 -4
  66. package/src/og/quadTree/Node.js +31 -17
  67. package/src/og/renderer/Renderer.js +23 -6
  68. package/src/og/renderer/RendererEvents.js +1 -1
  69. package/src/og/scene/BaseNode.js +2 -3
  70. package/src/og/scene/Planet.js +2 -2
  71. package/src/og/scene/RenderNode.js +15 -8
  72. package/src/og/shaders/geoObject.js +211 -0
  73. package/src/og/shaders/pointCloud.js +41 -41
  74. package/src/og/shaders/shape.js +12 -18
  75. package/src/og/shaders/skybox.js +36 -36
  76. package/src/og/shapes/BaseShape.js +107 -35
  77. package/src/og/shapes/Icosphere.js +25 -10
  78. package/src/og/shapes/Sphere.js +8 -11
  79. package/src/og/utils/TextureAtlas.js +16 -18
  80. package/src/og/utils/shared.js +1 -1
  81. package/src/og/webgl/Handler.js +68 -49
  82. package/src/og/webgl/Multisample.js +44 -16
  83. package/src/og/webgl/Program.js +78 -33
  84. package/src/og/webgl/callbacks.js +3 -3
  85. package/types/Deferred.d.ts +1 -1
  86. package/types/Events.d.ts +2 -2
  87. package/types/Extent.d.ts +1 -1
  88. package/types/Rectangle.d.ts +1 -1
  89. package/types/ajax.d.ts +1 -1
  90. package/types/bv/Box.d.ts +1 -1
  91. package/types/bv/Sphere.d.ts +1 -1
  92. package/types/camera/Camera.d.ts +5 -5
  93. package/types/camera/Frustum.d.ts +6 -6
  94. package/types/camera/PlanetCamera.d.ts +8 -8
  95. package/types/control/Control.d.ts +1 -1
  96. package/types/control/EarthCoordinates.d.ts +1 -1
  97. package/types/control/Sun.d.ts +1 -1
  98. package/types/entity/BaseBillboard.d.ts +15 -8
  99. package/types/entity/Entity.d.ts +24 -9
  100. package/types/entity/EntityCollection.d.ts +15 -9
  101. package/types/entity/GeoObject.d.ts +111 -0
  102. package/types/entity/GeoObjectHandler.d.ts +77 -0
  103. package/types/entity/Geometry.d.ts +1 -1
  104. package/types/entity/GeometryHandler.d.ts +1 -1
  105. package/types/entity/Label.d.ts +3 -3
  106. package/types/entity/LabelHandler.d.ts +2 -0
  107. package/types/entity/LabelWorker.d.ts +9 -0
  108. package/types/entity/PointCloud.d.ts +1 -1
  109. package/types/entity/Polyline.d.ts +5 -5
  110. package/types/entity/Ray.d.ts +1 -1
  111. package/types/entity/Strip.d.ts +1 -1
  112. package/types/layer/BaseGeoImage.d.ts +3 -3
  113. package/types/layer/CanvasTiles.d.ts +5 -5
  114. package/types/layer/GeoImage.d.ts +1 -1
  115. package/types/layer/GeoVideo.d.ts +1 -1
  116. package/types/layer/Layer.d.ts +5 -5
  117. package/types/layer/Vector.d.ts +9 -9
  118. package/types/layer/XYZ.d.ts +3 -3
  119. package/types/light/LightSource.d.ts +7 -7
  120. package/types/math/Plane.d.ts +1 -1
  121. package/types/math/Ray.d.ts +1 -1
  122. package/types/math/Vec2.d.ts +34 -34
  123. package/types/math/Vec3.d.ts +1 -1
  124. package/types/math/Vec4.d.ts +1 -1
  125. package/types/math/coder.d.ts +1 -1
  126. package/types/math.d.ts +1 -1
  127. package/types/proj/Proj.d.ts +2 -2
  128. package/types/quadTree/Node.d.ts +1 -1
  129. package/types/renderer/Renderer.d.ts +12 -10
  130. package/types/renderer/RendererEvents.d.ts +1 -1
  131. package/types/scene/BaseNode.d.ts +4 -4
  132. package/types/scene/Planet.d.ts +40 -40
  133. package/types/scene/RenderNode.d.ts +9 -9
  134. package/types/segment/Segment.d.ts +9 -9
  135. package/types/shaders/geoObject.d.ts +3 -0
  136. package/types/shapes/BaseShape.d.ts +5 -5
  137. package/types/terrain/EmptyTerrain.d.ts +2 -2
  138. package/types/terrain/GlobusTerrain.d.ts +4 -4
  139. package/types/utils/TextureAtlas.d.ts +4 -4
  140. package/types/utils/shared.d.ts +9 -9
  141. package/types/webgl/Framebuffer.d.ts +1 -1
  142. package/types/webgl/Handler.d.ts +16 -7
  143. package/types/webgl/Multisample.d.ts +2 -2
  144. package/types/webgl/Program.d.ts +6 -0
  145. package/types/webgl/ProgramController.d.ts +1 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openglobus/og",
3
- "version": "0.11.5",
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"
@@ -18,8 +18,7 @@
18
18
  "test_watch": "jest --env=jsdom --watch",
19
19
  "lint": "eslint src/og",
20
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"
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,11 +43,10 @@
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.0",
48
47
  "@rollup/plugin-json": "^4.1.0",
49
48
  "@types/jest": "^27.0.2",
50
- "eslint": "^8.1.0",
51
- "husky": "^7.0.4",
49
+ "eslint": "^8.2.0",
52
50
  "jaguarjs-jsdoc": "^1.1.0",
53
51
  "jest": "^27.3.1",
54
52
  "jest-canvas-mock": "^2.3.1",
@@ -59,7 +57,7 @@
59
57
  "msdf-bmfont-xml": "^2.5.4",
60
58
  "postcss": "^8.3.11",
61
59
  "prettier": "^2.4.1",
62
- "rollup": "^2.58.3",
60
+ "rollup": "^2.60.0",
63
61
  "rollup-plugin-postcss": "^4.0.1",
64
62
  "rollup-plugin-terser": "^7.0.2",
65
63
  "typescript": "^4.4.4"
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
+ }
@@ -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
+ }
package/src/og/Popup.js CHANGED
@@ -1,11 +1,10 @@
1
- 'use strict';
1
+ "use strict";
2
2
 
3
- import { Events } from './Events.js';
4
- import { Vec3 } from './math/Vec3.js';
5
- import { getHTML, parseHTML, createLonLat } from './utils/shared.js';
3
+ import { Events } from "./Events.js";
4
+ import { Vec3 } from "./math/Vec3.js";
5
+ import { getHTML, parseHTML, createLonLat } from "./utils/shared.js";
6
6
 
7
- const TEMPLATE =
8
- `<div class="og-popup {className}">
7
+ const TEMPLATE = `<div class="og-popup {className}">
9
8
  <div class="og-popup-content-wrapper">
10
9
  <div class="og-popup-content"></div>
11
10
  </div>
@@ -20,13 +19,11 @@ const TEMPLATE =
20
19
  </div>`;
21
20
 
22
21
  class Popup {
23
-
24
22
  /**
25
- *
26
- * @param {*} options
23
+ *
24
+ * @param {*} options
27
25
  */
28
26
  constructor(options) {
29
-
30
27
  this._id = Popup._staticCounter++;
31
28
 
32
29
  this.events = new Events(["open", "close"]);
@@ -77,7 +74,12 @@ class Popup {
77
74
 
78
75
  setScreen(p) {
79
76
  if (this._planet) {
80
- this.el.style.transform = "translate(" + (p.x - this.clientWidth * 0.5) + "px, " + (p.y - this._planet.renderer.handler.canvas.height - this._tipEl.clientHeight) + "px)"
77
+ this.el.style.transform =
78
+ "translate(" +
79
+ (p.x - this.clientWidth * 0.5) +
80
+ "px, " +
81
+ (p.y - this._planet.renderer.handler.canvas.height - this._tipEl.clientHeight) +
82
+ "px)";
81
83
  }
82
84
  }
83
85
 
@@ -102,8 +104,8 @@ class Popup {
102
104
  render(params) {
103
105
  this.el = this._renderTemplate(params);
104
106
  this._contentEl = this.el.querySelector(".og-popup-content");
105
- this._titleEl = this.el.querySelector(".og-popup-title")
106
- this._tipEl = this.el.querySelector(".og-popup-tip-container")
107
+ this._titleEl = this.el.querySelector(".og-popup-title");
108
+ this._tipEl = this.el.querySelector(".og-popup-tip-container");
107
109
  this.setOffset(this._offset[0], this._offset[1]);
108
110
  this.setContent(this._content);
109
111
  this.setTitle(this._title);
@@ -153,7 +155,6 @@ class Popup {
153
155
  }
154
156
 
155
157
  setCartesian3v(cart, height = 0) {
156
-
157
158
  this._cartPos = cart;
158
159
 
159
160
  if (this._planet) {
@@ -192,10 +193,10 @@ class Popup {
192
193
  if (content) {
193
194
  this.clear();
194
195
  this._content = content;
195
- if (typeof content === 'string') {
196
+ if (typeof content === "string") {
196
197
  this._contentEl.innerHTML = content;
197
198
  } else {
198
- this._contentEl.appendChild(content)
199
+ this._contentEl.appendChild(content);
199
200
  }
200
201
  }
201
202
  return this;
@@ -207,4 +208,4 @@ class Popup {
207
208
  }
208
209
  }
209
210
 
210
- export { Popup };
211
+ export { Popup };
@@ -1,9 +1,8 @@
1
- 'use strict';
1
+ "use strict";
2
2
 
3
3
  class QueueArray {
4
-
5
4
  /**
6
- *
5
+ *
7
6
  * @param {number} [size]
8
7
  */
9
8
  constructor(size) {
@@ -73,4 +72,4 @@ class QueueArray {
73
72
  }
74
73
  }
75
74
 
76
- export { QueueArray };
75
+ export { QueueArray };
@@ -1,4 +1,4 @@
1
- 'use strict';
1
+ "use strict";
2
2
 
3
3
  /**
4
4
  * 2D Rectangle class.
@@ -7,9 +7,8 @@
7
7
  * @param {number} [top] - Top coordinate. 0 - default.
8
8
  * @param {number} [right] - Right coordinate. 0 - default.
9
9
  * @param {number} [bottom] - Bottom coordinate. 0 - default.
10
- */
10
+ */
11
11
  class Rectangle {
12
-
13
12
  /**
14
13
  * @param {number} [left] - Left coordinate. 0 - default.
15
14
  * @param {number} [top] - Top coordinate. 0 - default.
@@ -17,7 +16,6 @@ class Rectangle {
17
16
  * @param {number} [bottom] - Bottom coordinate. 0 - default.
18
17
  */
19
18
  constructor(left, top, right, bottom) {
20
-
21
19
  /**
22
20
  * Left coordinate.
23
21
  * @public
@@ -102,7 +100,7 @@ class Rectangle {
102
100
  * @type {boolean}
103
101
  */
104
102
  fit(width, height) {
105
- return (this.getWidth() == width && this.getHeight() == height);
103
+ return this.getWidth() == width && this.getHeight() == height;
106
104
  }
107
105
 
108
106
  isInside(x, y) {
@@ -110,4 +108,4 @@ class Rectangle {
110
108
  }
111
109
  }
112
110
 
113
- export { Rectangle };
111
+ export { Rectangle };
package/src/og/Stack.js CHANGED
@@ -2,7 +2,7 @@
2
2
  * @module og/Stack
3
3
  */
4
4
 
5
- 'use strict';
5
+ "use strict";
6
6
 
7
7
  class Node {
8
8
  constructor() {
@@ -13,13 +13,11 @@ class Node {
13
13
  }
14
14
 
15
15
  class Stack {
16
-
17
16
  /**
18
- *
17
+ *
19
18
  * @param {number} [size]
20
19
  */
21
20
  constructor(size = 256) {
22
-
23
21
  this._current = new Node();
24
22
  this._head = this._current;
25
23