@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/src/og/Globe.js CHANGED
@@ -4,21 +4,19 @@
4
4
 
5
5
  "use strict";
6
6
 
7
- import { EmptyTerrain } from "./terrain/EmptyTerrain.js";
8
- import { Handler } from "./webgl/Handler.js";
9
- import { Planet } from "./scene/Planet.js";
10
- import { Renderer } from "./renderer/Renderer.js";
11
- import { wgs84 } from "./ellipsoid/wgs84.js";
12
- import { isEmpty } from "./utils/shared.js";
13
-
7
+ import { CompassButton } from "./control/CompassButton.js";
14
8
  import { EarthCoordinates } from "./control/EarthCoordinates.js";
15
- import { MouseNavigation } from "./control/MouseNavigation.js";
16
9
  import { EarthNavigation } from "./control/EarthNavigation.js";
17
- import { TouchNavigation } from "./control/TouchNavigation.js";
10
+ import { MouseNavigation } from "./control/MouseNavigation.js";
11
+ import { ScaleControl } from "./control/ScaleControl.js";
18
12
  import { Sun } from "./control/Sun.js";
13
+ import { TouchNavigation } from "./control/TouchNavigation.js";
19
14
  import { ZoomControl } from "./control/ZoomControl.js";
20
- import { ScaleControl } from "./control/ScaleControl.js";
21
- import { CompassButton } from "./control/CompassButton.js";
15
+ import { Renderer } from "./renderer/Renderer.js";
16
+ import { Planet } from "./scene/Planet.js";
17
+ import { EmptyTerrain } from "./terrain/EmptyTerrain.js";
18
+ import { isEmpty } from "./utils/shared.js";
19
+ import { Handler } from "./webgl/Handler.js";
22
20
 
23
21
  /** @const {string} */
24
22
  const CANVAS_ID_PREFIX = "globus_viewport_";
@@ -52,19 +50,26 @@ const PLANET_NAME_PREFIX = "globus_planet_";
52
50
  *
53
51
  * @param {object} options - Options:
54
52
  * @param {string} options.target - HTML element id where planet canvas have to be created.
55
- * @param {og.scene.RenderNode} [options.skybox] - Render skybox. null - default.
53
+ * @param {RenderNode} [options.skybox] - Render skybox. null - default.
56
54
  * @param {string} [options.name] - Planet name. Default is unic identifier.
57
- * @param {og.terrain.Terrain} [options.terrain] - Terrain provider. Default no terrain - og.terrain.EmptyTerrain.
58
- * @param {Array.<og.control.Control>} [options.controls] - Renderer controls array.
59
- * @param {Array.<og.Layer>} [options.layers] - Planet layers.
60
- * @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.
61
59
  * @param {boolean} [options.autoActivate] - Globe rendering auto activation flag. True is default.
62
60
  * @param {DOMElement} [options.attributionContainer] - Container for attribution list.
63
61
  * @param {Number} [options.maxGridSize] = Maximal segment grid size. 128 is default
64
62
  * @param {boolean} [options.useSpecularTexture] - use specular water mask
65
63
  * @param {boolean} [options.useNightTexture] - show night cities
64
+ * @param {Number} [options.maxEqualZoomAltitude=850000.0] - Maximal altitude since segments on the screen bacame the same zoom level
65
+ * @param {Number} [options.minEqualZoomAltitude=10000.0] - Minimal altitude since segments on the screen bacame the same zoom level
66
+ * @param {Number} [options.minEqualZoomCameraSlope=0.8] - Minimal camera slope above te globe where segments on the screen bacame the same zoom level
66
67
  */
68
+
67
69
  class Globe {
70
+ /**
71
+ * @param {*} options
72
+ */
68
73
  constructor(options) {
69
74
  // Canvas creation
70
75
  var _canvasId = CANVAS_ID_PREFIX + Globe._staticCounter++;
@@ -82,8 +87,13 @@ class Globe {
82
87
  * @public
83
88
  * @type {Element}
84
89
  */
85
- this.div =
86
- document.getElementById(options.target) || document.querySelector(options.target);
90
+ if (options.target instanceof HTMLElement) {
91
+ this.div = options.target;
92
+ } else {
93
+ this.div =
94
+ document.getElementById(options.target) || document.querySelector(options.target);
95
+ }
96
+
87
97
  this.div.appendChild(this._canvas);
88
98
  this.div.classList.add("ogViewport");
89
99
 
@@ -104,7 +114,7 @@ class Globe {
104
114
  /**
105
115
  * Interface for the renderer context(events, input states, renderer nodes etc.)
106
116
  * @public
107
- * @type {og.Renderer}
117
+ * @type {Renderer}
108
118
  */
109
119
  this.renderer = new Renderer(
110
120
  new Handler(_canvasId, {
@@ -144,7 +154,7 @@ class Globe {
144
154
  /**
145
155
  * Render node renders a planet.
146
156
  * @public
147
- * @type {og.scene.Planet|og.scene.PlanetAtmosphere}
157
+ * @type {Planet|og.scene.PlanetAtmosphere}
148
158
  */
149
159
  // TODO:
150
160
  } else {
@@ -155,7 +165,10 @@ class Globe {
155
165
  useNightTexture: options.useNightTexture,
156
166
  useSpecularTexture: options.useSpecularTexture,
157
167
  minAltitude: options.minAltitude,
158
- maxAltitude: options.maxAltitude
168
+ maxAltitude: options.maxAltitude,
169
+ maxEqualZoomAltitude: options.maxEqualZoomAltitude,
170
+ minEqualZoomAltitude: options.minEqualZoomAltitude,
171
+ minEqualZoomCameraSlope: options.minEqualZoomCameraSlope
159
172
  });
160
173
  }
161
174
 
@@ -182,7 +195,7 @@ class Globe {
182
195
  new TouchNavigation(),
183
196
  new EarthCoordinates(),
184
197
  new ScaleControl(),
185
- new CompassButton()
198
+ new CompassButton(options)
186
199
  ]);
187
200
  }
188
201
 
@@ -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
  /**
@@ -78,7 +80,7 @@ class ImageCanvas {
78
80
  fillColor(color) {
79
81
  this._context.fillStyle = color;
80
82
  this._context.fillRect(0, 0, this._canvas.width, this._canvas.height);
81
- };
83
+ }
82
84
 
83
85
  /**
84
86
  * Sets RGBA pixel data.
@@ -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();
@@ -218,6 +224,6 @@ class ImageCanvas {
218
224
  this._canvas = null;
219
225
  this._context = null;
220
226
  }
221
- };
227
+ }
222
228
 
223
- export { ImageCanvas };
229
+ export { ImageCanvas };
package/src/og/Lock.js CHANGED
@@ -25,7 +25,7 @@ class Lock {
25
25
  isLocked() {
26
26
  return this._lock !== 0;
27
27
  }
28
- };
28
+ }
29
29
 
30
30
  class Key {
31
31
 
@@ -43,6 +43,6 @@ class Key {
43
43
  constructor() {
44
44
  this._id = Key._staticCounter++;
45
45
  }
46
- };
46
+ }
47
47
 
48
48
  export { Lock, Key };
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
@@ -48,17 +46,17 @@ export class LonLat {
48
46
  * @type {number}
49
47
  */
50
48
  this.height = height || 0;
51
- };
49
+ }
52
50
 
53
51
  isZero() {
54
52
  return this.lon === 0.0 && this.lat === 0.0 && this.height === 0.0;
55
- };
53
+ }
56
54
 
57
55
  /**
58
56
  * Creates coordinates array.
59
57
  * @static
60
58
  * @param{Array.<Array<number>>} arr - Coordinates array data. (exactly 3 entries)
61
- * @return{Array.<og.LonLat>} the same coordinates array but each element is LonLat instance.
59
+ * @return{Array.<LonLat>} the same coordinates array but each element is LonLat instance.
62
60
  */
63
61
  static join(arr) {
64
62
  var res = [];
@@ -67,17 +65,17 @@ export class LonLat {
67
65
  res[i] = new LonLat(ai[0], ai[1], ai[2]);
68
66
  }
69
67
  return res;
70
- };
68
+ }
71
69
 
72
70
  /**
73
71
  * Creates an object by coordinate array.
74
72
  * @static
75
73
  * @param {Array.<number>} arr - Coordiante array, where first is longitude, second is latitude and third is a height. (exactly 3 entries)
76
- * @returns {og.LonLat} -
74
+ * @returns {LonLat} -
77
75
  */
78
76
  static createFromArray(arr) {
79
77
  return new LonLat(arr[0], arr[1], arr[2]);
80
- };
78
+ }
81
79
 
82
80
  /**
83
81
  * Converts degrees to mercator coordinates.
@@ -85,13 +83,15 @@ export class LonLat {
85
83
  * @param {number} lon - Degrees longitude.
86
84
  * @param {number} lat - Degrees latitude.
87
85
  * @param {number} [height] - Height.
88
- * @returns {og.LonLat} -
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);
94
- };
92
+ height
93
+ );
94
+ }
95
95
 
96
96
  /**
97
97
  * Converts mercator to degrees coordinates.
@@ -99,13 +99,15 @@ export class LonLat {
99
99
  * @param {number} x - Mercator longitude.
100
100
  * @param {number} y - Mercator latitude.
101
101
  * @param {number} [height] - Height.
102
- * @returns {og.LonLat} -
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
- };
108
+ height
109
+ );
110
+ }
109
111
 
110
112
  /**
111
113
  * Sets coordinates.
@@ -113,45 +115,45 @@ export class LonLat {
113
115
  * @param {number} [lon] - Longitude.
114
116
  * @param {number} [lat] - Latitude.
115
117
  * @param {number} [height] - Height.
116
- * @returns {og.LonLat} -
118
+ * @returns {LonLat} -
117
119
  */
118
120
  set(lon, lat, height) {
119
121
  this.lon = lon || 0;
120
122
  this.lat = lat || 0;
121
123
  this.height = height || 0;
122
124
  return this;
123
- };
125
+ }
124
126
 
125
127
  /**
126
128
  * Copy coordinates.
127
129
  * @public
128
- * @param {og.LonLat} [lonLat] - Coordinates to copy.
129
- * @returns {og.LonLat} -
130
+ * @param {LonLat} [lonLat] - Coordinates to copy.
131
+ * @returns {LonLat} -
130
132
  */
131
133
  copy(lonLat) {
132
134
  this.lon = lonLat.lon;
133
135
  this.lat = lonLat.lat;
134
136
  this.height = lonLat.height;
135
137
  return this;
136
- };
138
+ }
137
139
 
138
140
  /**
139
141
  * Clone the coordiante.
140
142
  * @public
141
- * @returns {og.LonLat} -
143
+ * @returns {LonLat} -
142
144
  */
143
145
  clone() {
144
146
  return new LonLat(this.lon, this.lat, this.height);
145
- };
147
+ }
146
148
 
147
149
  /**
148
150
  * Converts to mercator coordinates.
149
151
  * @public
150
- * @returns {og.LonLat} -
152
+ * @returns {LonLat} -
151
153
  */
152
154
  forwardMercator() {
153
155
  return LonLat.forwardMercator(this.lon, this.lat, this.height);
154
- };
156
+ }
155
157
 
156
158
  forwardMercatorEPS01() {
157
159
  var lat = this.lat;
@@ -162,22 +164,23 @@ 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);
166
- };
167
+ Math.log(Math.tan((90.0 + lat) * PI_BY_360)) * mercator.POLE_BY_PI
168
+ );
169
+ }
167
170
 
168
171
  /**
169
172
  * Converts from mercator coordinates.
170
173
  * @public
171
- * @returns {og.LonLat} -
174
+ * @returns {LonLat} -
172
175
  */
173
176
  inverseMercator() {
174
177
  return LonLat.inverseMercator(this.lon, this.lat, this.height);
175
- };
178
+ }
176
179
 
177
180
  /**
178
181
  * Compares coordinates.
179
182
  * @public
180
- * @param {og.LonLat} b - Coordinate to compare with.
183
+ * @param {LonLat} b - Coordinate to compare with.
181
184
  * @returns {boolean} -
182
185
  */
183
186
  equal(b) {
@@ -186,5 +189,5 @@ export class LonLat {
186
189
  } else {
187
190
  return this.lon === b.lon && this.lat === b.lat;
188
191
  }
189
- };
190
- }
192
+ }
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,8 +19,11 @@ const TEMPLATE =
20
19
  </div>`;
21
20
 
22
21
  class Popup {
22
+ /**
23
+ *
24
+ * @param {*} options
25
+ */
23
26
  constructor(options) {
24
-
25
27
  this._id = Popup._staticCounter++;
26
28
 
27
29
  this.events = new Events(["open", "close"]);
@@ -72,7 +74,12 @@ class Popup {
72
74
 
73
75
  setScreen(p) {
74
76
  if (this._planet) {
75
- 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)";
76
83
  }
77
84
  }
78
85
 
@@ -97,14 +104,14 @@ class Popup {
97
104
  render(params) {
98
105
  this.el = this._renderTemplate(params);
99
106
  this._contentEl = this.el.querySelector(".og-popup-content");
100
- this._titleEl = this.el.querySelector(".og-popup-title")
101
- 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");
102
109
  this.setOffset(this._offset[0], this._offset[1]);
103
110
  this.setContent(this._content);
104
111
  this.setTitle(this._title);
105
112
  this.setLonLat(this._lonLat);
106
113
  this.setVisibility(this._visibility);
107
- this.el.querySelector(".og-popup-close").addEventListener("click", (e) => {
114
+ this.el.querySelector(".og-popup-close").addEventListener("click", () => {
108
115
  this.hide();
109
116
  });
110
117
  return this;
@@ -148,7 +155,6 @@ class Popup {
148
155
  }
149
156
 
150
157
  setCartesian3v(cart, height = 0) {
151
-
152
158
  this._cartPos = cart;
153
159
 
154
160
  if (this._planet) {
@@ -187,10 +193,10 @@ class Popup {
187
193
  if (content) {
188
194
  this.clear();
189
195
  this._content = content;
190
- if (typeof content === 'string') {
196
+ if (typeof content === "string") {
191
197
  this._contentEl.innerHTML = content;
192
198
  } else {
193
- this._contentEl.appendChild(content)
199
+ this._contentEl.appendChild(content);
194
200
  }
195
201
  }
196
202
  return this;
@@ -202,4 +208,4 @@ class Popup {
202
208
  }
203
209
  }
204
210
 
205
- export { Popup };
211
+ export { Popup };
@@ -1,6 +1,10 @@
1
- 'use strict';
1
+ "use strict";
2
2
 
3
3
  class QueueArray {
4
+ /**
5
+ *
6
+ * @param {number} [size]
7
+ */
4
8
  constructor(size) {
5
9
  this._size = size || 2048;
6
10
  this._array = new Array(this._size);
@@ -66,6 +70,6 @@ class QueueArray {
66
70
  callback(this._array[i]);
67
71
  }
68
72
  }
69
- };
73
+ }
70
74
 
71
- 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,10 +7,15 @@
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
+ * @param {number} [left] - Left coordinate. 0 - default.
14
+ * @param {number} [top] - Top coordinate. 0 - default.
15
+ * @param {number} [right] - Right coordinate. 0 - default.
16
+ * @param {number} [bottom] - Bottom coordinate. 0 - default.
17
+ */
12
18
  constructor(left, top, right, bottom) {
13
-
14
19
  /**
15
20
  * Left coordinate.
16
21
  * @public
@@ -43,7 +48,7 @@ class Rectangle {
43
48
  /**
44
49
  * Clone rectangle object.
45
50
  * @public
46
- * @returns {og.Rectangle}
51
+ * @returns {Rectangle}
47
52
  */
48
53
  clone() {
49
54
  return new Rectangle(this.left, this.top, this.right, this.bottom);
@@ -95,7 +100,7 @@ class Rectangle {
95
100
  * @type {boolean}
96
101
  */
97
102
  fit(width, height) {
98
- return (this.getWidth() == width && this.getHeight() == height);
103
+ return this.getWidth() == width && this.getHeight() == height;
99
104
  }
100
105
 
101
106
  isInside(x, y) {
@@ -103,4 +108,4 @@ class Rectangle {
103
108
  }
104
109
  }
105
110
 
106
- 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() {
@@ -10,11 +10,14 @@ class Node {
10
10
  this.prev = null;
11
11
  this.data = null;
12
12
  }
13
- };
13
+ }
14
14
 
15
15
  class Stack {
16
+ /**
17
+ *
18
+ * @param {number} [size]
19
+ */
16
20
  constructor(size = 256) {
17
-
18
21
  this._current = new Node();
19
22
  this._head = this._current;
20
23
 
@@ -34,7 +37,7 @@ class Stack {
34
37
  push(data) {
35
38
  this._current = this._current.next;
36
39
  this._current.data = data;
37
- };
40
+ }
38
41
 
39
42
  pop(data) {
40
43
  this._current = this._current.prev;
@@ -45,6 +48,6 @@ class Stack {
45
48
  this._current = this._current.prev;
46
49
  return this._current.data;
47
50
  }
48
- };
51
+ }
49
52
 
50
53
  export { Stack };