@openglobus/og 0.16.3 → 0.17.1

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 (197) hide show
  1. package/README.md +1 -1
  2. package/css/og.css +24 -2
  3. package/dist/@openglobus/og.css +1 -1
  4. package/dist/@openglobus/og.esm.js +2 -2
  5. package/dist/@openglobus/og.esm.js.map +1 -1
  6. package/dist/@openglobus/og.umd.js +2 -2
  7. package/dist/@openglobus/og.umd.js.map +1 -1
  8. package/package.json +1 -1
  9. package/src/og/Clock.js +1 -5
  10. package/src/og/Events.js +2 -6
  11. package/src/og/Extent.js +5 -9
  12. package/src/og/Globe.js +93 -56
  13. package/src/og/ImageCanvas.js +13 -6
  14. package/src/og/Lock.js +44 -48
  15. package/src/og/LonLat.js +1 -5
  16. package/src/og/Object3d.js +2 -2
  17. package/src/og/QueueArray.js +1 -1
  18. package/src/og/Stack.js +49 -53
  19. package/src/og/astro/earth.js +112 -116
  20. package/src/og/astro/jd.js +514 -518
  21. package/src/og/astro/orbit.js +119 -123
  22. package/src/og/astro/rotation.js +36 -40
  23. package/src/og/bv/Box.js +77 -81
  24. package/src/og/bv/Sphere.js +57 -61
  25. package/src/og/camera/Camera.js +20 -7
  26. package/src/og/camera/Frustum.js +4 -4
  27. package/src/og/camera/PlanetCamera.js +15 -22
  28. package/src/og/cons.js +1 -1
  29. package/src/og/control/Atmosphere.js +0 -4
  30. package/src/og/control/Control.js +9 -8
  31. package/src/og/control/DebugInfo.js +3 -7
  32. package/src/og/control/DrawingSwitcher.js +117 -0
  33. package/src/og/control/EarthCoordinates.js +214 -214
  34. package/src/og/control/EarthNavigation.js +6 -13
  35. package/src/og/control/GeoImageDragControl.js +0 -4
  36. package/src/og/control/KeyboardNavigation.js +0 -4
  37. package/src/og/control/LayerAnimation.js +0 -4
  38. package/src/og/control/LayerSwitcher.js +2 -4
  39. package/src/og/control/Lighting.js +12 -16
  40. package/src/og/control/MouseNavigation.js +1 -5
  41. package/src/og/control/MouseWheelZoomControl.js +0 -4
  42. package/src/og/control/RulerSwitcher.js +0 -4
  43. package/src/og/control/ScaleControl.js +2 -6
  44. package/src/og/control/ShowFps.js +40 -44
  45. package/src/og/control/SimpleNavigation.js +10 -10
  46. package/src/og/control/SimpleSkyBackground.js +0 -4
  47. package/src/og/control/Sun.js +0 -4
  48. package/src/og/control/ToggleWireframe.js +35 -39
  49. package/src/og/control/ZoomControl.js +0 -4
  50. package/src/og/control/drawing/DrawingControl.js +51 -0
  51. package/src/og/control/drawing/LineStringDrawingScene.js +203 -0
  52. package/src/og/control/drawing/PolygonDrawingScene.js +785 -0
  53. package/src/og/control/elevationProfile/ElevationProfile.js +275 -0
  54. package/src/og/control/index.js +5 -1
  55. package/src/og/control/ruler/Ruler.js +0 -4
  56. package/src/og/control/ruler/RulerScene.js +3 -2
  57. package/src/og/control/selection/Selection.js +0 -4
  58. package/src/og/control/selection/SelectionScene.js +2 -4
  59. package/src/og/control/timeline/TimelineControl.js +4 -4
  60. package/src/og/control/timeline/TimelineModel.js +2 -2
  61. package/src/og/control/timeline/TimelineView.js +1 -0
  62. package/src/og/control/visibleExtent/Segment.js +7 -7
  63. package/src/og/control/visibleExtent/drawnode.js +0 -4
  64. package/src/og/ellipsoid/Ellipsoid.js +236 -325
  65. package/src/og/ellipsoid/wgs84.js +0 -4
  66. package/src/og/entity/BaseBillboard.js +375 -379
  67. package/src/og/entity/Billboard.js +0 -4
  68. package/src/og/entity/BillboardHandler.js +3 -7
  69. package/src/og/entity/Entity.js +22 -22
  70. package/src/og/entity/EntityCollection.js +14 -18
  71. package/src/og/entity/GeoObject.js +6 -8
  72. package/src/og/entity/GeoObjectHandler.js +30 -24
  73. package/src/og/entity/Geometry.js +5 -4
  74. package/src/og/entity/GeometryHandler.js +18 -19
  75. package/src/og/entity/Label.js +0 -4
  76. package/src/og/entity/LabelHandler.js +10 -14
  77. package/src/og/entity/LabelWorker.js +1 -1
  78. package/src/og/entity/PointCloud.js +2 -6
  79. package/src/og/entity/PointCloudHandler.js +122 -126
  80. package/src/og/entity/Polyline.js +15 -17
  81. package/src/og/entity/PolylineHandler.js +104 -108
  82. package/src/og/entity/Ray.js +29 -29
  83. package/src/og/entity/RayHandler.js +2 -2
  84. package/src/og/entity/Strip.js +1 -1
  85. package/src/og/entity/StripHandler.js +2 -2
  86. package/src/og/index.js +3 -1
  87. package/src/og/input/KeyboardHandler.js +128 -132
  88. package/src/og/input/MouseHandler.js +94 -98
  89. package/src/og/input/TouchHandler.js +59 -63
  90. package/src/og/input/input.js +44 -48
  91. package/src/og/layer/BaseGeoImage.js +6 -9
  92. package/src/og/layer/CanvasTiles.js +1 -5
  93. package/src/og/layer/GeoImage.js +0 -4
  94. package/src/og/layer/GeoTexture2d.js +0 -4
  95. package/src/og/layer/GeoVideo.js +0 -4
  96. package/src/og/layer/KML.js +1 -0
  97. package/src/og/layer/Layer.js +22 -26
  98. package/src/og/layer/Material.js +0 -4
  99. package/src/og/layer/Vector.js +25 -22
  100. package/src/og/layer/WMS.js +182 -186
  101. package/src/og/layer/XYZ.js +0 -4
  102. package/src/og/light/LightSource.js +0 -4
  103. package/src/og/math/Line2.js +28 -32
  104. package/src/og/math/Mat3.js +152 -156
  105. package/src/og/math/Ray.js +0 -4
  106. package/src/og/math/Vec2.js +0 -4
  107. package/src/og/math/Vec3.js +5 -4
  108. package/src/og/math/Vec4.js +0 -4
  109. package/src/og/math/coder.js +104 -104
  110. package/src/og/math.js +42 -10
  111. package/src/og/mercator.js +1 -1
  112. package/src/og/proj/EPSG3857.js +13 -13
  113. package/src/og/proj/Proj.js +59 -63
  114. package/src/og/quadTree/EPSG4326QuadTreeStrategy.js +1 -0
  115. package/src/og/quadTree/EarthQuadTreeStrategy.js +1 -0
  116. package/src/og/quadTree/EntityCollectionNode.js +12 -16
  117. package/src/og/quadTree/MarsQuadTreeStrategy.js +1 -0
  118. package/src/og/quadTree/Node.js +15 -14
  119. package/src/og/quadTree/QuadTreeStrategy.js +1 -0
  120. package/src/og/quadTree/Wgs84QuadTreeStrategy.js +1 -0
  121. package/src/og/renderer/Renderer.js +114 -27
  122. package/src/og/renderer/RendererEvents.js +0 -4
  123. package/src/og/scene/Axes.js +74 -78
  124. package/src/og/scene/BaseNode.js +1 -5
  125. package/src/og/scene/Planet.js +127 -130
  126. package/src/og/scene/RenderNode.js +20 -12
  127. package/src/og/scene/SkyBox.js +104 -108
  128. package/src/og/segment/Segment.js +10 -6
  129. package/src/og/segment/SegmentLonLat.js +3 -7
  130. package/src/og/segment/segmentHelper.js +229 -225
  131. package/src/og/shaders/atmos.js +1 -1
  132. package/src/og/shaders/billboard.js +0 -4
  133. package/src/og/shaders/drawnode.js +5 -9
  134. package/src/og/shaders/geoObject.js +0 -4
  135. package/src/og/shaders/label.js +0 -4
  136. package/src/og/shaders/pickingMask.js +0 -4
  137. package/src/og/shaders/pointCloud.js +0 -4
  138. package/src/og/shaders/polyline.js +0 -4
  139. package/src/og/shaders/ray.js +0 -4
  140. package/src/og/shaders/skybox.js +0 -4
  141. package/src/og/terrain/EmptyTerrain.js +0 -4
  142. package/src/og/utils/FontAtlas.js +0 -4
  143. package/src/og/utils/GeoImageCreator.js +2 -3
  144. package/src/og/utils/NormalMapCreator.js +11 -12
  145. package/src/og/utils/PlainSegmentWorker.js +9 -9
  146. package/src/og/utils/TerrainWorker.js +2 -2
  147. package/src/og/utils/TextureAtlas.js +1 -1
  148. package/src/og/utils/VectorTileCreator.js +3 -9
  149. package/src/og/utils/earcut.js +8 -8
  150. package/src/og/utils/shared.js +30 -11
  151. package/src/og/webgl/Framebuffer.js +2 -6
  152. package/src/og/webgl/Handler.js +46 -20
  153. package/src/og/webgl/Multisample.js +2 -6
  154. package/src/og/webgl/Program.js +4 -8
  155. package/src/og/webgl/ProgramController.js +2 -2
  156. package/types/Clock.d.ts +1 -1
  157. package/types/Extent.d.ts +5 -5
  158. package/types/Globe.d.ts +15 -1
  159. package/types/ImageCanvas.d.ts +5 -0
  160. package/types/bv/Box.d.ts +1 -1
  161. package/types/bv/Sphere.d.ts +3 -3
  162. package/types/camera/Camera.d.ts +3 -2
  163. package/types/camera/PlanetCamera.d.ts +4 -4
  164. package/types/control/DrawingSwitcher.d.ts +13 -0
  165. package/types/control/EarthCoordinates.d.ts +1 -1
  166. package/types/control/Lighting.d.ts +8 -8
  167. package/types/control/drawing/DrawingControl.d.ts +14 -0
  168. package/types/control/drawing/LineStringDrawingScene.d.ts +5 -0
  169. package/types/control/drawing/PolygonDrawingScene.d.ts +99 -0
  170. package/types/control/index.d.ts +3 -1
  171. package/types/control/ruler/RulerScene.d.ts +0 -1
  172. package/types/control/selection/SelectionScene.d.ts +0 -1
  173. package/types/ellipsoid/Ellipsoid.d.ts +53 -64
  174. package/types/entity/Entity.d.ts +3 -2
  175. package/types/entity/GeoObject.d.ts +1 -2
  176. package/types/entity/Geometry.d.ts +5 -0
  177. package/types/entity/Polyline.d.ts +1 -1
  178. package/types/entity/Ray.d.ts +1 -0
  179. package/types/index.d.ts +1 -0
  180. package/types/layer/BaseGeoImage.d.ts +1 -1
  181. package/types/layer/CanvasTiles.d.ts +1 -1
  182. package/types/layer/Layer.d.ts +1 -1
  183. package/types/layer/Vector.d.ts +1 -0
  184. package/types/math/Vec3.d.ts +2 -0
  185. package/types/math.d.ts +7 -0
  186. package/types/renderer/Renderer.d.ts +7 -1
  187. package/types/scene/Axes.d.ts +0 -1
  188. package/types/scene/Planet.d.ts +27 -26
  189. package/types/scene/RenderNode.d.ts +2 -0
  190. package/types/scene/SkyBox.d.ts +0 -1
  191. package/types/segment/Segment.d.ts +3 -2
  192. package/types/segment/SegmentLonLat.d.ts +0 -1
  193. package/types/utils/GeoImageCreator.d.ts +1 -1
  194. package/types/utils/NormalMapCreator.d.ts +1 -1
  195. package/types/utils/VectorTileCreator.d.ts +2 -2
  196. package/types/utils/shared.d.ts +2 -0
  197. package/types/webgl/Handler.d.ts +6 -4
@@ -1,214 +1,214 @@
1
- 'use strict';
2
-
3
- import { LonLat } from '../LonLat.js';
4
- import { throttle } from '../utils/shared.js';
5
- import * as units from '../utils/units.js';
6
- import { heightMode } from '../utils/units.js';
7
- import { Control } from './Control.js';
8
-
9
- const DECIMAL_TEMPLATE =
10
- `<div class="og-lat-side"></div><div class="og-lat-val"></div>
11
- <div class="og-lon-side"></div><div class="og-lon-val"></div>
12
- <div class="og-height"></div>
13
- <div class="og-units-height"></div>`;
14
-
15
- const DEGREE_TEMPLATE =
16
- `<div class="og-lat-side"></div><div class="og-lat-val"></div>
17
- <div class="og-lon-side"></div><div class="og-lon-val"></div>
18
- <div class="og-height"></div>
19
- <div class="og-units-height"></div>`;
20
-
21
- const CENTER_SVG = '<svg width="12" height="12"><g><path stroke-width="1" stroke-opacity="1" d="M6 0L6 12M0 6L12 6" stroke="#337ab7"></path></g></svg>';
22
-
23
- const TYPE_HTML = [DECIMAL_TEMPLATE, DEGREE_TEMPLATE];
24
-
25
- /**
26
- * Control displays mouse or screen center Earth coordinates.
27
- * @class
28
- * @extends {og.control.Control}
29
- * @param {Object} [options] - Options:
30
- * @param {Boolean} [options.center] - Earth coordiantes by screen center otherwise mouse pointer. False is default.
31
- * @param {Boolean} [options.type] - Coordinates shown: 0 - is decimal degrees, 1 - degrees, 2 - mercator geodetic coordinates.
32
- */
33
- class EarthCoordinates extends Control {
34
- constructor(options) {
35
- super(options);
36
-
37
- options = options || {};
38
-
39
- /**
40
- * Display type.
41
- * @private
42
- * @type {Boolean}
43
- */
44
- this._type = options.type || 0;
45
-
46
- this._TYPE_FUNC = [this._SHOW_DECIMAL, this._SHOW_DEGREE];
47
-
48
- this._showFn = null;
49
-
50
- /**
51
- * Current position.
52
- * @public
53
- * @type {og.Vec3}
54
- */
55
- this._lonLat = new LonLat();
56
-
57
- this._latSideEl = null;
58
- this._lonSideEl = null;
59
- this._latValEl = null;
60
- this._lonValEl = null;
61
- this._heightEl = null;
62
-
63
- this._altUnitVal = options.altitudeUnit || "m";
64
- this._heightModeVal = options.heightMode || "ell";
65
-
66
- this._altUnit = units[this._altUnitVal];
67
- this._heightMode = heightMode[this._heightModeVal];
68
-
69
- this._centerMode = options.centerMode || false;
70
- }
71
-
72
- _SHOW_DECIMAL(ll) {
73
- if (ll) {
74
- let lat = ll.lat,
75
- lon = ll.lon;
76
-
77
- if (lat >= 0) {
78
- this._latSideEl.innerHTML = 'N';
79
- } else {
80
- this._latSideEl.innerHTML = 'S';
81
- }
82
-
83
- if (lon >= 0) {
84
- this._lonSideEl.innerHTML = 'E';
85
- } else {
86
- this._lonSideEl.innerHTML = 'W';
87
- }
88
-
89
- this._latValEl.innerHTML = Math.abs(lat).toFixed(5) + '°';
90
- this._lonValEl.innerHTML = Math.abs(lon).toFixed(5) + '°';
91
- }
92
- }
93
-
94
- _SHOW_DEGREE(ll) {
95
- if (ll) {
96
- let lat = ll.lat,
97
- lon = ll.lon;
98
-
99
- if (lat >= 0) {
100
- this._latSideEl.innerHTML = 'N';
101
- } else {
102
- this._latSideEl.innerHTML = 'S';
103
- }
104
-
105
- if (lon >= 0) {
106
- this._lonSideEl.innerHTML = 'E';
107
- } else {
108
- this._lonSideEl.innerHTML = 'W';
109
- }
110
-
111
- let t = 0;
112
-
113
- let deg = lat < 0 ? Math.ceil(lat) : Math.floor(lat);
114
- let min = Math.floor(t = Math.abs((lat - deg)) * 60);
115
- let sec = Math.floor((t - min) * 6000) / 100.0;
116
- this._latValEl.innerHTML = Math.abs(deg) + '°' + min + "'" + sec.toFixed(0) + '"';
117
-
118
- deg = lon < 0 ? Math.ceil(lon) : Math.floor(lon);
119
- min = Math.floor(t = Math.abs((lon - deg)) * 60);
120
- sec = Math.floor((t - min) * 6000) / 100.0;
121
- this._lonValEl.innerHTML = Math.abs(deg) + '°' + min + "'" + sec.toFixed(0) + '"';
122
- }
123
- }
124
-
125
- _createCenterEl() {
126
- let el = document.createElement('div');
127
- el.className = 'og-center-icon';
128
- el.innerHTML = CENTER_SVG;
129
- return el;
130
- }
131
-
132
- _updateUnits() {
133
- this._heightMode = heightMode[this._heightModeVal];
134
- this._altUnit = units[this._altUnitVal];
135
- this._el.querySelector(".og-units-height").innerHTML = units.toString(this._altUnit);
136
- this._showHeight();
137
- }
138
-
139
- _refreshCoordinates() {
140
-
141
- if (this._type >= this._TYPE_FUNC.length) {
142
- this._type = 0;
143
- }
144
-
145
- this._el.innerHTML = TYPE_HTML[this._type];
146
-
147
- this._latSideEl = this._el.querySelector(".og-lat-side");
148
- this._lonSideEl = this._el.querySelector(".og-lon-side");
149
- this._latValEl = this._el.querySelector(".og-lat-val");
150
- this._lonValEl = this._el.querySelector(".og-lon-val");
151
- this._heightEl = this._el.querySelector(".og-height");
152
-
153
- this._showFn = this._TYPE_FUNC[this._type];
154
- this._showFn(this._lonLat);
155
- }
156
-
157
- oninit() {
158
- this._el = document.createElement('div');
159
- this._el.classList.add("og-coordinates");
160
-
161
- this.renderer.div.appendChild(this._el);
162
-
163
- this._el.addEventListener("click", () => {
164
- this._type++;
165
- this._refreshCoordinates();
166
- this._updateUnits();
167
- this._showHeight();
168
- });
169
-
170
- if (this._centerMode) {
171
- this.renderer.div.appendChild(this._createCenterEl());
172
- this.renderer.activeCamera.events.on("moveend", this._grabCoordinates, this);
173
- this.renderer.activeCamera.events.on("moveend", throttle((e) => this._showHeight(), 400, true), this);
174
- } else {
175
- this.renderer.events.on("mousemove", this._grabCoordinates, this);
176
- this.renderer.events.on("mousestop", throttle((e) => this._showHeight(), 400, true), this);
177
- }
178
-
179
- this._refreshCoordinates();
180
-
181
- this._updateUnits();
182
- }
183
-
184
- _grabCoordinates(px) {
185
- let scrPx;
186
- let r = this.renderer;
187
- if (this._centerMode) {
188
- scrPx = r.handler.getCenter();
189
- } else {
190
- scrPx = px;
191
- }
192
- this._lonLat = this.planet.getLonLatFromPixelTerrain(scrPx);
193
- this._showFn(this._lonLat);
194
- }
195
-
196
- async _showHeight() {
197
- if (this._lonLat) {
198
- let alt = 0;
199
- this._heightEl.style.opacity = 0.7;
200
- if (this._heightMode === heightMode.ell) {
201
- alt = await this.planet.getHeightAboveELL(this._lonLat);
202
- alt = units.convertExt(true, units.m, this._altUnit, alt);
203
- } else if (this._heightMode === heightMode.msl) {
204
- alt = await this.planet.getHeightDefault(this._lonLat);
205
- alt = units.convertExt(true, units.m, this._altUnit, alt);
206
- }
207
- this._heightEl.style.opacity = 1.0;
208
- this._heightEl.innerHTML = alt.toString();
209
- }
210
- }
211
- }
212
-
213
- export { EarthCoordinates };
214
-
1
+ 'use strict';
2
+
3
+ import { LonLat } from '../LonLat.js';
4
+ import { throttle } from '../utils/shared.js';
5
+ import * as units from '../utils/units.js';
6
+ import { heightMode } from '../utils/units.js';
7
+ import { Control } from './Control.js';
8
+
9
+ const DECIMAL_TEMPLATE =
10
+ `<div class="og-lat-side"></div><div class="og-lat-val"></div>
11
+ <div class="og-lon-side"></div><div class="og-lon-val"></div>
12
+ <div class="og-height"></div>
13
+ <div class="og-units-height"></div>`;
14
+
15
+ const DEGREE_TEMPLATE =
16
+ `<div class="og-lat-side"></div><div class="og-lat-val"></div>
17
+ <div class="og-lon-side"></div><div class="og-lon-val"></div>
18
+ <div class="og-height"></div>
19
+ <div class="og-units-height"></div>`;
20
+
21
+ const CENTER_SVG = '<svg width="12" height="12"><g><path stroke-width="1" stroke-opacity="1" d="M6 0L6 12M0 6L12 6" stroke="#337ab7"></path></g></svg>';
22
+
23
+ const TYPE_HTML = [DECIMAL_TEMPLATE, DEGREE_TEMPLATE];
24
+
25
+ /**
26
+ * Control displays mouse or screen center Earth coordinates.
27
+ * @class
28
+ * @extends {og.control.Control}
29
+ * @param {Object} [options] - Options:
30
+ * @param {Boolean} [options.center] - Earth coordinates by screen center otherwise mouse pointer. False is default.
31
+ * @param {Boolean} [options.type] - Coordinates shown: 0 - is decimal degrees, 1 - degrees, 2 - mercator geodetic coordinates.
32
+ */
33
+ class EarthCoordinates extends Control {
34
+ constructor(options) {
35
+ super(options);
36
+
37
+ options = options || {};
38
+
39
+ /**
40
+ * Display type.
41
+ * @private
42
+ * @type {Boolean}
43
+ */
44
+ this._type = options.type || 0;
45
+
46
+ this._TYPE_FUNC = [this._SHOW_DECIMAL, this._SHOW_DEGREE];
47
+
48
+ this._showFn = null;
49
+
50
+ /**
51
+ * Current position.
52
+ * @public
53
+ * @type {og.Vec3}
54
+ */
55
+ this._lonLat = new LonLat();
56
+
57
+ this._latSideEl = null;
58
+ this._lonSideEl = null;
59
+ this._latValEl = null;
60
+ this._lonValEl = null;
61
+ this._heightEl = null;
62
+
63
+ this._altUnitVal = options.altitudeUnit || "m";
64
+ this._heightModeVal = options.heightMode || "ell";
65
+
66
+ this._altUnit = units[this._altUnitVal];
67
+ this._heightMode = heightMode[this._heightModeVal];
68
+
69
+ this._centerMode = options.centerMode != undefined ? options.centerMode : true;
70
+ }
71
+
72
+ _SHOW_DECIMAL(ll) {
73
+ if (ll) {
74
+ let lat = ll.lat,
75
+ lon = ll.lon;
76
+
77
+ if (lat >= 0) {
78
+ this._latSideEl.innerHTML = 'N';
79
+ } else {
80
+ this._latSideEl.innerHTML = 'S';
81
+ }
82
+
83
+ if (lon >= 0) {
84
+ this._lonSideEl.innerHTML = 'E';
85
+ } else {
86
+ this._lonSideEl.innerHTML = 'W';
87
+ }
88
+
89
+ this._latValEl.innerHTML = Math.abs(lat).toFixed(5) + '°';
90
+ this._lonValEl.innerHTML = Math.abs(lon).toFixed(5) + '°';
91
+ }
92
+ }
93
+
94
+ _SHOW_DEGREE(ll) {
95
+ if (ll) {
96
+ let lat = ll.lat,
97
+ lon = ll.lon;
98
+
99
+ if (lat >= 0) {
100
+ this._latSideEl.innerHTML = 'N';
101
+ } else {
102
+ this._latSideEl.innerHTML = 'S';
103
+ }
104
+
105
+ if (lon >= 0) {
106
+ this._lonSideEl.innerHTML = 'E';
107
+ } else {
108
+ this._lonSideEl.innerHTML = 'W';
109
+ }
110
+
111
+ let t = 0;
112
+
113
+ let deg = lat < 0 ? Math.ceil(lat) : Math.floor(lat);
114
+ let min = Math.floor(t = Math.abs((lat - deg)) * 60);
115
+ let sec = Math.floor((t - min) * 6000) / 100.0;
116
+ this._latValEl.innerHTML = Math.abs(deg) + '°' + min + "'" + sec.toFixed(0) + '"';
117
+
118
+ deg = lon < 0 ? Math.ceil(lon) : Math.floor(lon);
119
+ min = Math.floor(t = Math.abs((lon - deg)) * 60);
120
+ sec = Math.floor((t - min) * 6000) / 100.0;
121
+ this._lonValEl.innerHTML = Math.abs(deg) + '°' + min + "'" + sec.toFixed(0) + '"';
122
+ }
123
+ }
124
+
125
+ _createCenterEl() {
126
+ let el = document.createElement('div');
127
+ el.className = 'og-center-icon';
128
+ el.innerHTML = CENTER_SVG;
129
+ return el;
130
+ }
131
+
132
+ _updateUnits() {
133
+ this._heightMode = heightMode[this._heightModeVal];
134
+ this._altUnit = units[this._altUnitVal];
135
+ this._el.querySelector(".og-units-height").innerHTML = units.toString(this._altUnit);
136
+ this._showHeight();
137
+ }
138
+
139
+ _refreshCoordinates() {
140
+
141
+ if (this._type >= this._TYPE_FUNC.length) {
142
+ this._type = 0;
143
+ }
144
+
145
+ this._el.innerHTML = TYPE_HTML[this._type];
146
+
147
+ this._latSideEl = this._el.querySelector(".og-lat-side");
148
+ this._lonSideEl = this._el.querySelector(".og-lon-side");
149
+ this._latValEl = this._el.querySelector(".og-lat-val");
150
+ this._lonValEl = this._el.querySelector(".og-lon-val");
151
+ this._heightEl = this._el.querySelector(".og-height");
152
+
153
+ this._showFn = this._TYPE_FUNC[this._type];
154
+ this._showFn(this._lonLat);
155
+ }
156
+
157
+ oninit() {
158
+ this._el = document.createElement('div');
159
+ this._el.classList.add("og-coordinates");
160
+
161
+ this.renderer.div.appendChild(this._el);
162
+
163
+ this._el.addEventListener("click", () => {
164
+ this._type++;
165
+ this._refreshCoordinates();
166
+ this._updateUnits();
167
+ this._showHeight();
168
+ });
169
+
170
+ if (this._centerMode) {
171
+ this.renderer.div.appendChild(this._createCenterEl());
172
+ this.renderer.activeCamera.events.on("moveend", this._grabCoordinates, this);
173
+ this.renderer.activeCamera.events.on("moveend", throttle((e) => this._showHeight(), 400, true), this);
174
+ } else {
175
+ this.renderer.events.on("mousemove", this._grabCoordinates, this);
176
+ this.renderer.events.on("mousestop", throttle((e) => this._showHeight(), 400, true), this);
177
+ }
178
+
179
+ this._refreshCoordinates();
180
+
181
+ this._updateUnits();
182
+ }
183
+
184
+ _grabCoordinates(px) {
185
+ let scrPx;
186
+ let r = this.renderer;
187
+ if (this._centerMode) {
188
+ scrPx = r.handler.getCenter();
189
+ } else {
190
+ scrPx = px;
191
+ }
192
+ this._lonLat = this.planet.getLonLatFromPixelTerrain(scrPx);
193
+ this._showFn(this._lonLat);
194
+ }
195
+
196
+ async _showHeight() {
197
+ if (this._lonLat) {
198
+ let alt = 0;
199
+ this._heightEl.style.opacity = 0.7;
200
+ if (this._heightMode === heightMode.ell) {
201
+ alt = await this.planet.getHeightAboveELL(this._lonLat);
202
+ alt = units.convertExt(true, units.m, this._altUnit, alt);
203
+ } else if (this._heightMode === heightMode.msl) {
204
+ alt = await this.planet.getHeightDefault(this._lonLat);
205
+ alt = units.convertExt(true, units.m, this._altUnit, alt);
206
+ }
207
+ this._heightEl.style.opacity = 1.0;
208
+ this._heightEl.innerHTML = alt.toString();
209
+ }
210
+ }
211
+ }
212
+
213
+ export { EarthCoordinates };
214
+
@@ -153,12 +153,12 @@ class EarthNavigation extends Control {
153
153
  var rot = this._hRot.mul(this._vRot);
154
154
 
155
155
  var state = this.positionState[this.currState];
156
- var lim = rot.mulVec3(cam.eye).normal().dot(Vec3.UP);
156
+ var lim = rot.mulVec3(cam.eye).normal().dot(Vec3.NORTH);
157
157
  if (lim > state.max || lim < state.min) {
158
158
  rot = Quat.yRotation(rot.getYaw());
159
159
  }
160
160
 
161
- cam.set(rot.mulVec3(cam.eye), Vec3.ZERO, Vec3.UP);
161
+ cam.set(rot.mulVec3(cam.eye), Vec3.ZERO, Vec3.NORTH);
162
162
  cam.update();
163
163
  }
164
164
  }
@@ -204,7 +204,6 @@ class EarthNavigation extends Control {
204
204
  let rot = this._vRot = Quat.axisAngleToQuat(cam._u, this._a);
205
205
 
206
206
  cam.set(rot.mulVec3(cam.eye), Vec3.ZERO, rot.mulVec3(cam.getUp()));
207
- //cam.update();
208
207
 
209
208
  this._hRot = Quat.getRotationBetweenVectors(
210
209
  new Vec3(targetPoint.x, 0.0, targetPoint.z).normal(),
@@ -213,14 +212,8 @@ class EarthNavigation extends Control {
213
212
 
214
213
  rot = this._hRot;
215
214
 
216
- //var state = this.positionState[this.currState];
217
- //var lim = cam.eye.normal().dot(Vec3.UP);
218
-
219
- //if (lim > state.max || lim < state.min) {
220
- // rot = Quat.yRotation(rot.getYaw());
221
- cam.set(rot.mulVec3(cam.eye), Vec3.ZERO, rot.mulVec3(cam.getUp()));
222
- cam.update();
223
- //}
215
+ cam.set(rot.mulVec3(cam.eye), Vec3.ZERO, rot.mulVec3(cam.getUp()));
216
+ cam.update();
224
217
  }
225
218
  } else {
226
219
  this.scaleRot = 0;
@@ -240,7 +233,7 @@ class EarthNavigation extends Control {
240
233
  this._vRot = Quat.axisAngleToQuat(cam._u, this._a);
241
234
  var rot = this._vRot.mul(this._hRot);
242
235
 
243
- var lim = rot.mulVec3(cam.eye).normal().dot(Vec3.UP);
236
+ var lim = rot.mulVec3(cam.eye).normal().dot(Vec3.NORTH);
244
237
 
245
238
  var state = this.positionState[this.currState];
246
239
 
@@ -256,7 +249,7 @@ class EarthNavigation extends Control {
256
249
  this.scaleRot = 0;
257
250
  }
258
251
 
259
- cam.set(rot.mulVec3(cam.eye), Vec3.ZERO, Vec3.UP);
252
+ cam.set(rot.mulVec3(cam.eye), Vec3.ZERO, Vec3.NORTH);
260
253
  cam.update();
261
254
  }
262
255
  }
@@ -1,7 +1,3 @@
1
- /**
2
- * @module og/control/GeoImageDragControl
3
- */
4
-
5
1
  'use strict';
6
2
 
7
3
  import { BaseGeoImage } from '../layer/BaseGeoImage.js';
@@ -1,7 +1,3 @@
1
- /**
2
- * @module og/control/KeyboardNavigation
3
- */
4
-
5
1
  "use strict";
6
2
 
7
3
  import { input } from "../input/input.js";
@@ -1,7 +1,3 @@
1
- /**
2
- * @module og/control/LayerAnimation
3
- */
4
-
5
1
  "use strict";
6
2
 
7
3
  import { Events } from '../Events.js';
@@ -1,7 +1,3 @@
1
- /**
2
- * @module og/control/LayerSwitcher
3
- */
4
-
5
1
  "use strict";
6
2
 
7
3
  import { Dialog } from "../ui/Dialog.js";
@@ -283,6 +279,8 @@ class LayerSwitcher extends Control {
283
279
  let entities = object._entities
284
280
  let inputs = [...title.querySelectorAll('input')]
285
281
  entities ? object._entities.forEach((entity, index) => {
282
+ console.log("visibility ENTITY/INDEX/INPUTS/SIBLINGS/TITLE", entity, index, inputs, siblings, title);
283
+
286
284
  inputs[index].checked = entity.getVisibility()
287
285
  }) : null
288
286
  } else {
@@ -1,7 +1,3 @@
1
- /**
2
- * @module og/control/Lighting
3
- */
4
-
5
1
  "use strict";
6
2
 
7
3
  import { Dialog } from '../ui/Dialog.js';
@@ -243,14 +239,14 @@ class Lighting extends Control {
243
239
  this._dialog.appendTo(this.renderer.div);
244
240
  this._panel.appendTo(this._dialog.container);
245
241
 
246
- this.$atmosphereOpacity = document.querySelector(".og-atmosphere-opacity");
247
- this.$gamma = document.querySelector(".og-option.og-gamma");
248
- this.$exposure = document.querySelector(".og-option.og-exposure");
249
- this.$opacity = document.querySelector(".og-option.og-opacity");
250
- this.$diffuse = document.querySelector(".og-option.og-diffuse");
251
- this.$ambient = document.querySelector(".og-option.og-ambient");
252
- this.$specular = document.querySelector(".og-option.og-specular");
253
- this.$night = document.querySelector(".og-option.og-night");
242
+ this.$atmosphereOpacity = this._panel.el.querySelector(".og-atmosphere-opacity");
243
+ this.$gamma = this._panel.el.querySelector(".og-option.og-gamma");
244
+ this.$exposure = this._panel.el.querySelector(".og-option.og-exposure");
245
+ this.$opacity = this._panel.el.querySelector(".og-option.og-opacity");
246
+ this.$diffuse = this._panel.el.querySelector(".og-option.og-diffuse");
247
+ this.$ambient = this._panel.el.querySelector(".og-option.og-ambient");
248
+ this.$specular = this._panel.el.querySelector(".og-option.og-specular");
249
+ this.$night = this._panel.el.querySelector(".og-option.og-night");
254
250
 
255
251
  this._toggleBtn.on("change", (isActive) => {
256
252
  this._dialog.setVisibility(isActive);
@@ -357,7 +353,7 @@ class Lighting extends Control {
357
353
  });
358
354
 
359
355
 
360
- document.getElementById("layers").addEventListener("change", (e) => {
356
+ this._panel.el.querySelector("#layers").addEventListener("change", (e) => {
361
357
  this.bindLayer(this.planet.getLayerByName(e.target.value));
362
358
  });
363
359
 
@@ -469,7 +465,7 @@ class Lighting extends Control {
469
465
 
470
466
  _fetchLayers() {
471
467
  if (this.planet) {
472
- for (var i = 0; i < this.planet.layers.length; i++) {
468
+ for (let i = 0; i < this.planet.layers.length; i++) {
473
469
  this._onLayerAdd(this.planet.layers[i]);
474
470
  }
475
471
  }
@@ -480,8 +476,8 @@ class Lighting extends Control {
480
476
  let opt = document.createElement("option");
481
477
  opt.value = e.name;
482
478
  opt.innerText = e.name;
483
- document.getElementById("layers").appendChild(opt);
484
- document.getElementById("layers").value = e.name;
479
+ this._panel.el.querySelector("#layers").appendChild(opt);
480
+ this._panel.el.querySelector("#layers").value = e.name;
485
481
  }
486
482
 
487
483
  _onLayerRemove(e) {
@@ -1,7 +1,3 @@
1
- /**
2
- * @module og/control/MouseNavigation
3
- */
4
-
5
1
  "use strict";
6
2
 
7
3
  import { Sphere } from "../bv/Sphere.js";
@@ -92,7 +88,7 @@ class MouseNavigation extends Control {
92
88
  eyeArr = [];
93
89
 
94
90
  var breaked = false;
95
- for (var i = 0; i < stepsCount; i++) {
91
+ for (let i = 0; i < stepsCount; i++) {
96
92
  eye.addA(scaled_n);
97
93
  var b = new Ray(eye, dir).hitSphere(grabbedSpheroid);
98
94
  eyeArr[i] = eye.clone();
@@ -1,7 +1,3 @@
1
- /**
2
- * @module og/control/MouseWheelZoomControl
3
- */
4
-
5
1
  "use strict";
6
2
 
7
3
  import { Sphere } from "../bv/Sphere.js";
@@ -1,7 +1,3 @@
1
- /**
2
- * @module og/control/Ruler
3
- */
4
-
5
1
  "use strict";
6
2
 
7
3
  import { ToggleButton } from "../ui/ToggleButton.js";
@@ -1,7 +1,3 @@
1
- /**
2
- * @module og/control/ZoomControl
3
- */
4
-
5
1
  "use strict";
6
2
 
7
3
  import { RADIANS } from "../math.js";
@@ -40,7 +36,7 @@ class ScaleControl extends Control {
40
36
  this._minWidth = 100;
41
37
  this._maxWidth = 150;
42
38
 
43
- this._isCenter = options.isCenter || false;
39
+ this._isCenter = options.isCenter != undefined ? options.isCenter : true;
44
40
  }
45
41
 
46
42
  _renderTemplate() {
@@ -59,7 +55,7 @@ class ScaleControl extends Control {
59
55
  this._drawScreen(this.planet.renderer.handler.getCenter());
60
56
  });
61
57
 
62
- this.planet.terrain.events.on("loadend", (e) => {
58
+ !this.planet.terrain.isEmpty && this.planet.terrain.events.on("loadend", (e) => {
63
59
  this._drawScreen(this.planet.renderer.handler.getCenter());
64
60
  });
65
61
  } else {