@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
@@ -1,15 +1,28 @@
1
1
  "use strict";
2
2
 
3
- import * as math from "../math.js";
4
- import { Control } from "./Control.js";
5
- import { input } from "../input/input.js";
6
- import { Key } from "../Lock.js";
3
+ import { Sphere } from "../bv/Sphere.js";
7
4
  import { LonLat } from "../LonLat.js";
8
- import { Mat4 } from "../math/Mat4.js";
9
5
  import { Quat } from "../math/Quat.js";
10
6
  import { Ray } from "../math/Ray.js";
11
- import { Sphere } from "../bv/Sphere.js";
12
7
  import { Vec3 } from "../math/Vec3.js";
8
+ import { Control } from "./Control.js";
9
+
10
+ class Touch {
11
+ constructor() {
12
+ this.x = 0;
13
+ this.y = 0;
14
+ this.prev_x = 0;
15
+ this.prev_y = 0;
16
+ this.grabbedPoint = new Vec3();
17
+ this.grabbedSpheroid = new Sphere();
18
+ this.dX = function () {
19
+ return this.x - this.prev_x;
20
+ };
21
+ this.dY = function () {
22
+ return this.y - this.prev_y;
23
+ };
24
+ }
25
+ }
13
26
 
14
27
  class EarthNavigation extends Control {
15
28
  constructor(options) {
@@ -33,21 +46,6 @@ class EarthNavigation extends Control {
33
46
  { h: 500000, max: 0.99, min: -0.99 }
34
47
  ];
35
48
 
36
- var Touch = function () {
37
- this.x = 0;
38
- this.y = 0;
39
- this.prev_x = 0;
40
- this.prev_y = 0;
41
- this.grabbedPoint = new Vec3();
42
- this.grabbedSpheroid = new Sphere();
43
- this.dX = function () {
44
- return this.x - this.prev_x;
45
- };
46
- this.dY = function () {
47
- return this.y - this.prev_y;
48
- };
49
- };
50
-
51
49
  this.touches = [new Touch(), new Touch()];
52
50
  }
53
51
 
@@ -70,7 +68,7 @@ class EarthNavigation extends Control {
70
68
 
71
69
  var ll = this.renderer.activeCamera._lonLat;
72
70
 
73
- globus.planet.flyLonLat(new LonLat(ll.lon, ll.lat, this.positionState[this.currState].h));
71
+ this.planet.flyLonLat(new LonLat(ll.lon, ll.lat, this.positionState[this.currState].h));
74
72
  }
75
73
 
76
74
  onMouseWheel(event) {
@@ -71,6 +71,6 @@ class GeoImageDragControl extends Control {
71
71
  }, this);
72
72
  }
73
73
  }
74
- };
74
+ }
75
75
 
76
76
  export { GeoImageDragControl };
@@ -2,17 +2,17 @@
2
2
  * @module og/control/KeyboardNavigation
3
3
  */
4
4
 
5
- 'use strict';
5
+ "use strict";
6
6
 
7
- import * as math from '../math.js';
8
- import { Control } from './Control.js';
9
- import { input } from '../input/input.js';
10
- import { Vec3 } from '../math/Vec3.js';
7
+ import * as math from "../math.js";
8
+ import { Control } from "./Control.js";
9
+ import { input } from "../input/input.js";
10
+ import { Vec3 } from "../math/Vec3.js";
11
11
 
12
12
  /**
13
13
  * Planet camera keyboard navigation. Use W,S,A,D and left shift key for fly around a planet.
14
14
  * @class
15
- * @extends {og.control.Control}
15
+ * @extends {Control}
16
16
  * @param {Object} [options] - Control options.
17
17
  */
18
18
 
@@ -69,7 +69,7 @@ class KeyboardNavigation extends Control {
69
69
  if (this.renderer.events.isKeyPressed(input.KEY_SHIFT)) {
70
70
  cam.pitch(15 / this.renderer.handler.deltaTime);
71
71
  } else {
72
- cam.rotateVertical(cam._lonLat.height / 3000000 * math.RADIANS, Vec3.ZERO);
72
+ cam.rotateVertical((cam._lonLat.height / 3000000) * math.RADIANS, Vec3.ZERO);
73
73
  }
74
74
  cam.update();
75
75
  }
@@ -79,7 +79,7 @@ class KeyboardNavigation extends Control {
79
79
  if (this.renderer.events.isKeyPressed(input.KEY_SHIFT)) {
80
80
  cam.pitch(-15 / this.renderer.handler.deltaTime);
81
81
  } else {
82
- cam.rotateVertical(-cam._lonLat.height / 3000000 * math.RADIANS, Vec3.ZERO);
82
+ cam.rotateVertical((-cam._lonLat.height / 3000000) * math.RADIANS, Vec3.ZERO);
83
83
  }
84
84
  cam.update();
85
85
  }
@@ -89,7 +89,7 @@ class KeyboardNavigation extends Control {
89
89
  if (this.renderer.events.isKeyPressed(input.KEY_SHIFT)) {
90
90
  cam.yaw(15 / this.renderer.handler.deltaTime);
91
91
  } else {
92
- cam.rotateHorizontal(cam._lonLat.height / 3000000 * math.RADIANS, false, Vec3.ZERO);
92
+ cam.rotateHorizontal((cam._lonLat.height / 3000000) * math.RADIANS, false, Vec3.ZERO);
93
93
  }
94
94
  cam.update();
95
95
  }
@@ -99,7 +99,7 @@ class KeyboardNavigation extends Control {
99
99
  if (this.renderer.events.isKeyPressed(input.KEY_SHIFT)) {
100
100
  cam.yaw(-15 / this.renderer.handler.deltaTime);
101
101
  } else {
102
- cam.rotateHorizontal(-cam._lonLat.height / 3000000 * math.RADIANS, false, Vec3.ZERO);
102
+ cam.rotateHorizontal((-cam._lonLat.height / 3000000) * math.RADIANS, false, Vec3.ZERO);
103
103
  }
104
104
  cam.update();
105
105
  }
@@ -113,10 +113,10 @@ class KeyboardNavigation extends Control {
113
113
  this.renderer.activeCamera.roll(15 / this.renderer.handler.deltaTime);
114
114
  this.renderer.activeCamera.update();
115
115
  }
116
- };
116
+ }
117
117
 
118
118
  export function keyboardNavigation(options) {
119
119
  return new KeyboardNavigation(options);
120
- };
120
+ }
121
121
 
122
122
  export { KeyboardNavigation };
@@ -2,14 +2,14 @@
2
2
  * @module og/control/LayerSwitcher
3
3
  */
4
4
 
5
- 'use strict';
5
+ "use strict";
6
6
 
7
- import { Control } from './Control.js';
7
+ import { Control } from "./Control.js";
8
8
 
9
9
  /**
10
10
  * Simple(OpenLayers like)layer switcher, includes base layers, overlays, geo images etc. groups.
11
11
  * @class
12
- * @extends {og.control.Control}
12
+ * @extends {Control}
13
13
  * @param {Object} [options] - Control options.
14
14
  */
15
15
  class LayerSwitcher extends Control {
@@ -48,7 +48,7 @@ class LayerSwitcher extends Control {
48
48
  this.addSwitcher("checkbox", layer, this.overlaysDiv, this._id);
49
49
  }
50
50
  }
51
- };
51
+ }
52
52
 
53
53
  onLayerRemoved(layer) {
54
54
  layer._removeCallback();
@@ -56,16 +56,16 @@ class LayerSwitcher extends Control {
56
56
  }
57
57
 
58
58
  addSwitcher(type, obj, container, id) {
59
- var lineDiv = document.createElement('div');
59
+ var lineDiv = document.createElement("div");
60
60
 
61
61
  var that = this;
62
- var center = document.createElement('div');
63
- center.classList.add('ogViewExtentBtn');
62
+ var center = document.createElement("div");
63
+ center.classList.add("ogViewExtentBtn");
64
64
  center.onclick = function () {
65
65
  that.planet.flyExtent(obj.getExtent());
66
66
  };
67
67
 
68
- var inp = document.createElement('input');
68
+ var inp = document.createElement("input");
69
69
  inp.type = type;
70
70
  inp.name = "ogBaseLayerRadiosId" + (id || "");
71
71
  inp.checked = obj.getVisibility();
@@ -74,11 +74,12 @@ class LayerSwitcher extends Control {
74
74
  obj.setVisibility(this.checked);
75
75
  };
76
76
 
77
- obj.events && obj.events.on("visibilitychange", function (e) {
78
- inp.checked = e.getVisibility();
79
- });
77
+ obj.events &&
78
+ obj.events.on("visibilitychange", function (e) {
79
+ inp.checked = e.getVisibility();
80
+ });
80
81
 
81
- var lbl = document.createElement('label');
82
+ var lbl = document.createElement("label");
82
83
  lbl.className = "ogLayerSwitcherLabel";
83
84
  lbl.innerHTML = (obj.name || obj.src || "noname") + "</br>";
84
85
 
@@ -94,35 +95,35 @@ class LayerSwitcher extends Control {
94
95
  }
95
96
 
96
97
  createBaseLayersContainer() {
97
- var layersDiv = document.createElement('div');
98
+ var layersDiv = document.createElement("div");
98
99
  layersDiv.className = "layersDiv";
99
100
  this.dialog.appendChild(layersDiv);
100
101
 
101
- var baseLayersLbl = document.createElement('div');
102
+ var baseLayersLbl = document.createElement("div");
102
103
  baseLayersLbl.className = "layersDiv";
103
104
  baseLayersLbl.innerHTML = "Base Layer";
104
105
  layersDiv.appendChild(baseLayersLbl);
105
106
 
106
- this.baseLayersDiv = document.createElement('div');
107
+ this.baseLayersDiv = document.createElement("div");
107
108
  layersDiv.appendChild(this.baseLayersDiv);
108
109
  }
109
110
 
110
111
  createOverlaysContainer() {
111
- var overlaysDiv = document.createElement('div');
112
+ var overlaysDiv = document.createElement("div");
112
113
  overlaysDiv.className = "layersDiv";
113
114
  this.dialog.appendChild(overlaysDiv);
114
115
 
115
- var overlaysLbl = document.createElement('div');
116
+ var overlaysLbl = document.createElement("div");
116
117
  overlaysLbl.className = "layersDiv";
117
118
  overlaysLbl.innerHTML = "Overlays";
118
119
  overlaysDiv.appendChild(overlaysLbl);
119
120
 
120
- this.overlaysDiv = document.createElement('div');
121
+ this.overlaysDiv = document.createElement("div");
121
122
  overlaysDiv.appendChild(this.overlaysDiv);
122
123
  }
123
124
 
124
125
  createDialog() {
125
- this.dialog = document.createElement('div');
126
+ this.dialog = document.createElement("div");
126
127
  this.dialog.id = "ogLayerSwitcherDialog";
127
128
  this.dialog.className = "displayNone";
128
129
  this.renderer.div.appendChild(this.dialog);
@@ -138,8 +139,8 @@ class LayerSwitcher extends Control {
138
139
  }
139
140
 
140
141
  createSwitcher() {
141
- var button = document.createElement('div');
142
- button.className = 'ogLayerSwitcherButton';
142
+ var button = document.createElement("div");
143
+ button.className = "ogLayerSwitcherButton";
143
144
  button.id = "ogLayerSwitcherButtonMaximize";
144
145
  var that = this;
145
146
  button.onclick = function (e) {
@@ -153,6 +154,6 @@ class LayerSwitcher extends Control {
153
154
  };
154
155
  this.renderer.div.appendChild(button);
155
156
  }
156
- };
157
+ }
157
158
 
158
- export { LayerSwitcher };
159
+ export { LayerSwitcher };
@@ -115,7 +115,7 @@ const TEMPLATE = `<div class="og-lighing">
115
115
  /**
116
116
  * Helps to setup lighting.
117
117
  * @class
118
- * @extends {og.control.Control}
118
+ * @extends {Control}
119
119
  * @param {Object} [options] -
120
120
  */
121
121
  class Lighting extends Control {
@@ -18,7 +18,7 @@ import { Vec3 } from "../math/Vec3.js";
18
18
  /**
19
19
  * Mouse planet camera dragging control.
20
20
  * @class
21
- * @extends {og.control.Control}
21
+ * @extends {Control}
22
22
  * @param {Object} [options] - Control options.
23
23
  */
24
24
  class MouseNavigation extends Control {
@@ -21,7 +21,7 @@ const TEMPLATE = `<div class="og-scale-container">
21
21
  /**
22
22
  * Planet zoom buttons control.
23
23
  * @class
24
- * @extends {og.control.Control}
24
+ * @extends {Control}
25
25
  * @params {Object} [options] - Control options.
26
26
  */
27
27
  class ScaleControl extends Control {
@@ -1,13 +1,13 @@
1
- 'use strict';
1
+ "use strict";
2
2
 
3
- import { Control } from './Control.js';
4
- import { EntityCollection } from '../entity/EntityCollection.js';
5
- import { Entity } from '../entity/Entity.js';
3
+ import { Control } from "./Control.js";
4
+ import { EntityCollection } from "../entity/EntityCollection.js";
5
+ import { Entity } from "../entity/Entity.js";
6
6
 
7
7
  /**
8
8
  * Frame per second(FPS) display control.
9
9
  * @class
10
- * @extends {og.control.Control}
10
+ * @extends {Control}
11
11
  * @param {Object} [options] - Control options.
12
12
  */
13
13
  class SegmentBoundVisualization extends Control {
@@ -18,7 +18,6 @@ class SegmentBoundVisualization extends Control {
18
18
  }
19
19
 
20
20
  oninit() {
21
-
22
21
  this.planet.addEntityCollection(this._boundingSphereCollection);
23
22
 
24
23
  this.renderer.events.on("draw", this._predraw, this);
@@ -28,7 +27,7 @@ class SegmentBoundVisualization extends Control {
28
27
  _predraw() {
29
28
  this._boundingSphereCollection.clear();
30
29
  }
31
-
30
+
32
31
  _draw() {
33
32
  for (let i = 0; i < this.planet._renderedNodes.length; i++) {
34
33
  let si = this.planet._renderedNodes[i].segment;
@@ -46,10 +45,10 @@ class SegmentBoundVisualization extends Control {
46
45
  this._boundingSphereCollection.add(si._sphereEntity);
47
46
  }
48
47
  }
49
- };
48
+ }
50
49
 
51
50
  export function segmentBoundVisualization(options) {
52
51
  return new SegmentBoundVisualization(options);
53
- };
52
+ }
54
53
 
55
54
  export { SegmentBoundVisualization };
@@ -2,15 +2,15 @@
2
2
  * @module og/control/ShowFps
3
3
  */
4
4
 
5
- 'use strict';
5
+ "use strict";
6
6
 
7
- import { Control } from './Control.js';
8
- import { print2d } from '../utils/shared.js';
7
+ import { Control } from "./Control.js";
8
+ import { print2d } from "../utils/shared.js";
9
9
 
10
10
  /**
11
11
  * Frame per second(FPS) display control.
12
12
  * @class
13
- * @extends {og.control.Control}
13
+ * @extends {Control}
14
14
  * @param {Object} [options] - Control options.
15
15
  */
16
16
  class ShowFps extends Control {
@@ -19,20 +19,25 @@ class ShowFps extends Control {
19
19
  }
20
20
 
21
21
  oninit() {
22
- var d = document.createElement('div');
23
- d.className = 'defaultText ';
22
+ var d = document.createElement("div");
23
+ d.className = "defaultText ";
24
24
  d.id = "ogShowFpsControl";
25
25
  document.body.appendChild(d);
26
26
  this.renderer.events.on("draw", this._draw, this);
27
27
  }
28
-
28
+
29
29
  _draw() {
30
- print2d("ogShowFpsControl", (1000.0 / this.renderer.handler.deltaTime).toFixed(1), this.renderer.handler.canvas.clientWidth - 60, 0);
30
+ print2d(
31
+ "ogShowFpsControl",
32
+ (1000.0 / this.renderer.handler.deltaTime).toFixed(1),
33
+ this.renderer.handler.canvas.clientWidth - 60,
34
+ 0
35
+ );
31
36
  }
32
- };
37
+ }
33
38
 
34
39
  export function showFps(options) {
35
40
  return new ShowFps(options);
36
- };
41
+ }
37
42
 
38
43
  export { ShowFps };
@@ -1,12 +1,12 @@
1
- 'use strict';
1
+ "use strict";
2
2
 
3
- import { Control } from './Control.js';
4
- import { input } from '../input/input.js';
3
+ import { Control } from "./Control.js";
4
+ import { input } from "../input/input.js";
5
5
 
6
6
  /**
7
7
  * Simple keyboard camera navigation with W,S,A,D and shift keys to fly around the scene.
8
8
  * @class
9
- * @extends {og.control.Control}
9
+ * @extends {Control}
10
10
  * @param {Object} [options] - Control options.
11
11
  */
12
12
  class SimpleNavigation extends Control {
@@ -18,11 +18,9 @@ class SimpleNavigation extends Control {
18
18
  this.speed = options.speed || 1.0;
19
19
  }
20
20
 
21
- onactivate() {
22
- }
21
+ onactivate() {}
23
22
 
24
- ondeactivate() {
25
- }
23
+ ondeactivate() {}
26
24
 
27
25
  oninit() {
28
26
  this.camera = this.renderer.activeCamera;
@@ -117,13 +115,13 @@ class SimpleNavigation extends Control {
117
115
  cam.update();
118
116
  }
119
117
  }
120
- };
118
+ }
121
119
 
122
120
  /**
123
121
  * Creates simple navigation control instance.
124
122
  */
125
123
  export function simpleNavigation(options) {
126
124
  return new SimpleNavigation(options);
127
- };
125
+ }
128
126
 
129
127
  export { SimpleNavigation };
@@ -2,19 +2,19 @@
2
2
  * @module og/control/Sun
3
3
  */
4
4
 
5
- 'use strict';
5
+ "use strict";
6
6
 
7
- import { Control } from './Control.js';
8
- import { getSunPosition } from '../astro/earth.js';
9
- import { LightSource } from '../light/LightSource.js';
10
- import { Quat } from '../math/Quat.js';
11
- import { Vec3 } from '../math/Vec3.js';
7
+ import { Control } from "./Control.js";
8
+ import { getSunPosition } from "../astro/earth.js";
9
+ import { LightSource } from "../light/LightSource.js";
10
+ import { Quat } from "../math/Quat.js";
11
+ import { Vec3 } from "../math/Vec3.js";
12
12
 
13
13
  const ACTIVATION_HEIGHT = 12079000.0;
14
14
  /**
15
15
  * Real Sun geocentric position control that place the Sun on the right place by the Earth.
16
16
  * @class
17
- * @extends {og.control.Control}
17
+ * @extends {Control}
18
18
  * @param {Object} [options] - Control options.
19
19
  */
20
20
  class Sun extends Control {
@@ -28,7 +28,7 @@ class Sun extends Control {
28
28
  /**
29
29
  * Earth planet node.
30
30
  * @public
31
- * @type {og.scene.Planet}
31
+ * @type {Planet}
32
32
  */
33
33
  this.planet = null;
34
34
 
@@ -46,7 +46,7 @@ class Sun extends Control {
46
46
  /**
47
47
  * Light source.
48
48
  * @public
49
- * @type {og.LightSource}
49
+ * @type {LightSource}
50
50
  */
51
51
  this.sunlight = null;
52
52
 
@@ -72,7 +72,6 @@ class Sun extends Control {
72
72
  }
73
73
 
74
74
  oninit() {
75
-
76
75
  this.planet.lightEnabled = true;
77
76
 
78
77
  // sunlight initialization
@@ -120,12 +119,17 @@ class Sun extends Control {
120
119
  }
121
120
 
122
121
  var tu = Vec3.proj_b_to_plane(u, n, u).normalize().scale(this.offsetVertical);
123
- var tr = Vec3.proj_b_to_plane(cam._u, n, cam._u).normalize().scale(this.offsetHorizontal); // right
122
+ var tr = Vec3.proj_b_to_plane(cam._u, n, cam._u)
123
+ .normalize()
124
+ .scale(this.offsetHorizontal); // right
124
125
  var d = tu.add(tr);
125
126
  var pos = cam.eye.add(d);
126
127
  if (this._k > 0) {
127
128
  this._k -= 0.01;
128
- let rot = Quat.getRotationBetweenVectors(this.sunlight._position.normal(), pos.normal());
129
+ let rot = Quat.getRotationBetweenVectors(
130
+ this.sunlight._position.normal(),
131
+ pos.normal()
132
+ );
129
133
  let r = rot.slerp(Quat.IDENTITY, this._k).normalize();
130
134
  this.sunlight.setPosition3v(r.mulVec3(this.sunlight._position));
131
135
  } else {
@@ -135,11 +139,17 @@ class Sun extends Control {
135
139
  this._k = 1;
136
140
  if (this._f > 0) {
137
141
  this._f -= 0.01;
138
- let rot = Quat.getRotationBetweenVectors(this.sunlight._position.normal(), getSunPosition(this._currDate).normal());
142
+ let rot = Quat.getRotationBetweenVectors(
143
+ this.sunlight._position.normal(),
144
+ getSunPosition(this._currDate).normal()
145
+ );
139
146
  let r = rot.slerp(Quat.IDENTITY, this._f).normalize();
140
147
  this.sunlight.setPosition3v(r.mulVec3(this.sunlight._position));
141
148
  } else {
142
- if ((Math.abs(this._currDate - this._prevDate) > 0.00034 && this._active) || this._lightOn) {
149
+ if (
150
+ (Math.abs(this._currDate - this._prevDate) > 0.00034 && this._active) ||
151
+ this._lightOn
152
+ ) {
143
153
  this._lightOn = false;
144
154
  this._prevDate = this._currDate;
145
155
  this.sunlight.setPosition3v(getSunPosition(this._currDate));
@@ -157,4 +167,4 @@ export function sun(options) {
157
167
  return Sun(options);
158
168
  }
159
169
 
160
- export { Sun };
170
+ export { Sun };
@@ -2,15 +2,15 @@
2
2
  * @module og/control/ToggleWireframe
3
3
  */
4
4
 
5
- 'use strict';
5
+ "use strict";
6
6
 
7
- import { Control } from './Control.js';
8
- import { input } from '../input/input.js';
7
+ import { Control } from "./Control.js";
8
+ import { input } from "../input/input.js";
9
9
 
10
10
  /**
11
11
  * Planet GL draw mode(TRIANGLE_STRIP/LINE_STRING) changer.
12
12
  * @class
13
- * @extends {og.control.Control}
13
+ * @extends {Control}
14
14
  * @param {Object} [options] - Control options.
15
15
  */
16
16
  class ToggleWireframe extends Control {
@@ -33,6 +33,6 @@ class ToggleWireframe extends Control {
33
33
  this.planet.setDrawMode(this.renderer.handler.gl.LINE_STRIP);
34
34
  }
35
35
  }
36
- };
36
+ }
37
37
 
38
38
  export { ToggleWireframe };