@openglobus/og 0.16.3 → 0.17.0

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 (181) 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 +0 -4
  11. package/src/og/Extent.js +5 -9
  12. package/src/og/Globe.js +92 -55
  13. package/src/og/ImageCanvas.js +12 -5
  14. package/src/og/Lock.js +44 -48
  15. package/src/og/LonLat.js +0 -4
  16. package/src/og/Object3d.js +1 -1
  17. package/src/og/Stack.js +49 -53
  18. package/src/og/astro/earth.js +112 -116
  19. package/src/og/astro/jd.js +514 -518
  20. package/src/og/astro/orbit.js +119 -123
  21. package/src/og/astro/rotation.js +36 -40
  22. package/src/og/bv/Box.js +77 -81
  23. package/src/og/bv/Sphere.js +57 -61
  24. package/src/og/camera/Camera.js +20 -7
  25. package/src/og/camera/PlanetCamera.js +8 -15
  26. package/src/og/control/Atmosphere.js +0 -4
  27. package/src/og/control/Control.js +9 -8
  28. package/src/og/control/DebugInfo.js +0 -4
  29. package/src/og/control/DrawingSwitcher.js +117 -0
  30. package/src/og/control/EarthCoordinates.js +214 -214
  31. package/src/og/control/GeoImageDragControl.js +0 -4
  32. package/src/og/control/KeyboardNavigation.js +0 -4
  33. package/src/og/control/LayerAnimation.js +0 -4
  34. package/src/og/control/LayerSwitcher.js +2 -4
  35. package/src/og/control/Lighting.js +11 -15
  36. package/src/og/control/MouseNavigation.js +0 -4
  37. package/src/og/control/MouseWheelZoomControl.js +0 -4
  38. package/src/og/control/RulerSwitcher.js +0 -4
  39. package/src/og/control/ScaleControl.js +2 -6
  40. package/src/og/control/ShowFps.js +40 -44
  41. package/src/og/control/SimpleNavigation.js +10 -10
  42. package/src/og/control/SimpleSkyBackground.js +0 -4
  43. package/src/og/control/Sun.js +0 -4
  44. package/src/og/control/ToggleWireframe.js +35 -39
  45. package/src/og/control/ZoomControl.js +0 -4
  46. package/src/og/control/drawing/DrawingControl.js +51 -0
  47. package/src/og/control/drawing/LineStringDrawingScene.js +203 -0
  48. package/src/og/control/drawing/PolygonDrawingScene.js +785 -0
  49. package/src/og/control/elevationProfile/ElevationProfile.js +275 -0
  50. package/src/og/control/index.js +5 -1
  51. package/src/og/control/ruler/Ruler.js +0 -4
  52. package/src/og/control/ruler/RulerScene.js +3 -2
  53. package/src/og/control/selection/Selection.js +0 -4
  54. package/src/og/control/selection/SelectionScene.js +2 -4
  55. package/src/og/control/timeline/TimelineControl.js +4 -4
  56. package/src/og/control/timeline/TimelineModel.js +2 -2
  57. package/src/og/control/timeline/TimelineView.js +1 -0
  58. package/src/og/control/visibleExtent/Segment.js +5 -5
  59. package/src/og/control/visibleExtent/drawnode.js +0 -4
  60. package/src/og/ellipsoid/Ellipsoid.js +205 -275
  61. package/src/og/ellipsoid/wgs84.js +0 -4
  62. package/src/og/entity/BaseBillboard.js +375 -379
  63. package/src/og/entity/Billboard.js +0 -4
  64. package/src/og/entity/BillboardHandler.js +0 -4
  65. package/src/og/entity/Entity.js +22 -22
  66. package/src/og/entity/EntityCollection.js +7 -11
  67. package/src/og/entity/GeoObject.js +0 -4
  68. package/src/og/entity/GeoObjectHandler.js +0 -4
  69. package/src/og/entity/Geometry.js +5 -4
  70. package/src/og/entity/GeometryHandler.js +3 -4
  71. package/src/og/entity/Label.js +0 -4
  72. package/src/og/entity/LabelHandler.js +0 -4
  73. package/src/og/entity/PointCloud.js +0 -4
  74. package/src/og/entity/PointCloudHandler.js +122 -126
  75. package/src/og/entity/Polyline.js +4 -6
  76. package/src/og/entity/PolylineHandler.js +104 -108
  77. package/src/og/entity/Ray.js +29 -29
  78. package/src/og/entity/Strip.js +1 -1
  79. package/src/og/index.js +3 -1
  80. package/src/og/input/KeyboardHandler.js +128 -132
  81. package/src/og/input/MouseHandler.js +94 -98
  82. package/src/og/input/TouchHandler.js +59 -63
  83. package/src/og/input/input.js +44 -48
  84. package/src/og/layer/BaseGeoImage.js +5 -8
  85. package/src/og/layer/CanvasTiles.js +0 -4
  86. package/src/og/layer/GeoImage.js +0 -4
  87. package/src/og/layer/GeoTexture2d.js +0 -4
  88. package/src/og/layer/GeoVideo.js +0 -4
  89. package/src/og/layer/KML.js +1 -0
  90. package/src/og/layer/Layer.js +22 -26
  91. package/src/og/layer/Material.js +0 -4
  92. package/src/og/layer/Vector.js +23 -20
  93. package/src/og/layer/WMS.js +182 -186
  94. package/src/og/layer/XYZ.js +0 -4
  95. package/src/og/light/LightSource.js +0 -4
  96. package/src/og/math/Line2.js +28 -32
  97. package/src/og/math/Mat3.js +152 -156
  98. package/src/og/math/Ray.js +0 -4
  99. package/src/og/math/Vec2.js +0 -4
  100. package/src/og/math/Vec3.js +0 -4
  101. package/src/og/math/Vec4.js +0 -4
  102. package/src/og/math/coder.js +104 -104
  103. package/src/og/math.js +39 -7
  104. package/src/og/proj/EPSG3857.js +13 -13
  105. package/src/og/proj/Proj.js +59 -63
  106. package/src/og/quadTree/EPSG4326QuadTreeStrategy.js +1 -0
  107. package/src/og/quadTree/EarthQuadTreeStrategy.js +1 -0
  108. package/src/og/quadTree/EntityCollectionNode.js +12 -16
  109. package/src/og/quadTree/MarsQuadTreeStrategy.js +1 -0
  110. package/src/og/quadTree/QuadTreeStrategy.js +1 -0
  111. package/src/og/quadTree/Wgs84QuadTreeStrategy.js +1 -0
  112. package/src/og/renderer/Renderer.js +109 -22
  113. package/src/og/renderer/RendererEvents.js +0 -4
  114. package/src/og/scene/Axes.js +74 -78
  115. package/src/og/scene/BaseNode.js +0 -4
  116. package/src/og/scene/Planet.js +114 -112
  117. package/src/og/scene/RenderNode.js +11 -3
  118. package/src/og/scene/SkyBox.js +104 -108
  119. package/src/og/segment/Segment.js +8 -4
  120. package/src/og/segment/SegmentLonLat.js +2 -6
  121. package/src/og/segment/segmentHelper.js +229 -225
  122. package/src/og/shaders/billboard.js +0 -4
  123. package/src/og/shaders/drawnode.js +5 -9
  124. package/src/og/shaders/geoObject.js +0 -4
  125. package/src/og/shaders/label.js +0 -4
  126. package/src/og/shaders/pickingMask.js +0 -4
  127. package/src/og/shaders/pointCloud.js +0 -4
  128. package/src/og/shaders/polyline.js +0 -4
  129. package/src/og/shaders/ray.js +0 -4
  130. package/src/og/shaders/skybox.js +0 -4
  131. package/src/og/terrain/EmptyTerrain.js +0 -4
  132. package/src/og/utils/FontAtlas.js +0 -4
  133. package/src/og/utils/GeoImageCreator.js +1 -2
  134. package/src/og/utils/NormalMapCreator.js +8 -9
  135. package/src/og/utils/VectorTileCreator.js +3 -9
  136. package/src/og/utils/shared.js +20 -1
  137. package/src/og/webgl/Framebuffer.js +0 -4
  138. package/src/og/webgl/Handler.js +45 -19
  139. package/src/og/webgl/Multisample.js +0 -4
  140. package/src/og/webgl/Program.js +0 -4
  141. package/src/og/webgl/ProgramController.js +2 -2
  142. package/types/Clock.d.ts +1 -1
  143. package/types/Extent.d.ts +5 -5
  144. package/types/Globe.d.ts +15 -1
  145. package/types/ImageCanvas.d.ts +5 -0
  146. package/types/bv/Box.d.ts +1 -1
  147. package/types/bv/Sphere.d.ts +3 -3
  148. package/types/camera/Camera.d.ts +3 -2
  149. package/types/camera/PlanetCamera.d.ts +4 -4
  150. package/types/control/DrawingSwitcher.d.ts +13 -0
  151. package/types/control/EarthCoordinates.d.ts +1 -1
  152. package/types/control/Lighting.d.ts +8 -8
  153. package/types/control/drawing/DrawingControl.d.ts +14 -0
  154. package/types/control/drawing/LineStringDrawingScene.d.ts +5 -0
  155. package/types/control/drawing/PolygonDrawingScene.d.ts +99 -0
  156. package/types/control/index.d.ts +3 -1
  157. package/types/control/ruler/RulerScene.d.ts +0 -1
  158. package/types/control/selection/SelectionScene.d.ts +0 -1
  159. package/types/ellipsoid/Ellipsoid.d.ts +50 -63
  160. package/types/entity/Entity.d.ts +3 -2
  161. package/types/entity/Geometry.d.ts +5 -0
  162. package/types/entity/Polyline.d.ts +1 -1
  163. package/types/entity/Ray.d.ts +1 -0
  164. package/types/index.d.ts +1 -0
  165. package/types/layer/BaseGeoImage.d.ts +1 -1
  166. package/types/layer/CanvasTiles.d.ts +1 -1
  167. package/types/layer/Layer.d.ts +1 -1
  168. package/types/layer/Vector.d.ts +1 -0
  169. package/types/math.d.ts +7 -0
  170. package/types/renderer/Renderer.d.ts +7 -1
  171. package/types/scene/Axes.d.ts +0 -1
  172. package/types/scene/Planet.d.ts +26 -24
  173. package/types/scene/RenderNode.d.ts +2 -0
  174. package/types/scene/SkyBox.d.ts +0 -1
  175. package/types/segment/Segment.d.ts +3 -2
  176. package/types/segment/SegmentLonLat.d.ts +0 -1
  177. package/types/utils/GeoImageCreator.d.ts +1 -1
  178. package/types/utils/NormalMapCreator.d.ts +1 -1
  179. package/types/utils/VectorTileCreator.d.ts +2 -2
  180. package/types/utils/shared.d.ts +2 -0
  181. 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
+
@@ -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
 
@@ -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";
@@ -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 {
@@ -1,44 +1,40 @@
1
- /**
2
- * @module og/control/ShowFps
3
- */
4
-
5
- "use strict";
6
-
7
- import { print2d } from "../utils/shared.js";
8
- import { Control } from "./Control.js";
9
-
10
- /**
11
- * Frame per second(FPS) display control.
12
- * @class
13
- * @extends {Control}
14
- * @param {Object} [options] - Control options.
15
- */
16
- class ShowFps extends Control {
17
- constructor(options) {
18
- super(options);
19
- }
20
-
21
- oninit() {
22
- var d = document.createElement("div");
23
- d.className = "defaultText ";
24
- d.id = "ogShowFpsControl";
25
- document.body.appendChild(d);
26
- this.renderer.events.on("draw", this._draw, this);
27
- }
28
-
29
- _draw() {
30
- print2d(
31
- "ogShowFpsControl",
32
- (1000.0 / this.renderer.handler.deltaTime).toFixed(1),
33
- this.renderer.handler.canvas.clientWidth - 60,
34
- 0
35
- );
36
- }
37
- }
38
-
39
- export function showFps(options) {
40
- return new ShowFps(options);
41
- }
42
-
43
- export { ShowFps };
44
-
1
+ "use strict";
2
+
3
+ import { print2d } from "../utils/shared.js";
4
+ import { Control } from "./Control.js";
5
+
6
+ /**
7
+ * Frame per second(FPS) display control.
8
+ * @class
9
+ * @extends {Control}
10
+ * @param {Object} [options] - Control options.
11
+ */
12
+ class ShowFps extends Control {
13
+ constructor(options) {
14
+ super(options);
15
+ }
16
+
17
+ oninit() {
18
+ var d = document.createElement("div");
19
+ d.className = "defaultText ";
20
+ d.id = "ogShowFpsControl";
21
+ document.body.appendChild(d);
22
+ this.renderer.events.on("draw", this._draw, this);
23
+ }
24
+
25
+ _draw() {
26
+ print2d(
27
+ "ogShowFpsControl",
28
+ (1000.0 / this.renderer.handler.deltaTime).toFixed(1),
29
+ this.renderer.handler.canvas.clientWidth - 60,
30
+ 0
31
+ );
32
+ }
33
+ }
34
+
35
+ export function showFps(options) {
36
+ return new ShowFps(options);
37
+ }
38
+
39
+ export { ShowFps };
40
+