@openglobus/og 0.13.8 → 0.13.10

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 (85) hide show
  1. package/README.md +1 -1
  2. package/css/og.css +388 -129
  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 +20 -19
  9. package/src/og/Globe.js +15 -16
  10. package/src/og/Object3d.js +33 -0
  11. package/src/og/control/GeoImageDragControl.js +102 -75
  12. package/src/og/control/LayerAnimation.js +306 -38
  13. package/src/og/control/LayerSwitcher.js +506 -159
  14. package/src/og/control/Lighting.js +27 -27
  15. package/src/og/control/RulerSwitcher.js +69 -0
  16. package/src/og/control/UIhelpers.js +146 -0
  17. package/src/og/control/index.js +3 -1
  18. package/src/og/control/ruler/RulerScene.js +6 -2
  19. package/src/og/control/visibleExtent/Segment.js +2 -1
  20. package/src/og/ellipsoid/wgs84.js +1 -1
  21. package/src/og/entity/LabelHandler.js +5 -2
  22. package/src/og/entity/LabelWorker.js +38 -53
  23. package/src/og/layer/BaseGeoImage.js +347 -312
  24. package/src/og/layer/CanvasTiles.js +312 -290
  25. package/src/og/layer/GeoImage.js +222 -214
  26. package/src/og/layer/GeoVideo.js +291 -291
  27. package/src/og/layer/Layer.js +71 -30
  28. package/src/og/layer/Material.js +109 -109
  29. package/src/og/layer/Vector.js +1 -0
  30. package/src/og/layer/XYZ.js +20 -12
  31. package/src/og/light/LightSource.js +364 -363
  32. package/src/og/math.js +2 -2
  33. package/src/og/quadTree/Node.js +7 -5
  34. package/src/og/renderer/Renderer.js +1 -1
  35. package/src/og/scene/Planet.js +103 -42
  36. package/src/og/segment/Segment.js +34 -56
  37. package/src/og/segment/Slice.js +1 -1
  38. package/src/og/shaders/drawnode.js +1 -1
  39. package/src/og/terrain/GlobusTerrain.js +31 -20
  40. package/src/og/terrain/MapboxTerrain.js +1 -1
  41. package/src/og/utils/BaseWorker.js +46 -0
  42. package/src/og/utils/GeoImageCreator.js +164 -161
  43. package/src/og/utils/Loader.js +60 -33
  44. package/src/og/utils/NormalMapCreator.js +403 -412
  45. package/src/og/utils/PlainSegmentWorker.js +29 -55
  46. package/src/og/utils/TerrainWorker.js +572 -589
  47. package/src/og/utils/functionComposition.js +13 -0
  48. package/src/og/webgl/Handler.js +42 -41
  49. package/types/Object3d.d.ts +1 -0
  50. package/types/camera/PlanetCamera.d.ts +4 -0
  51. package/types/control/GeoImageDragControl.d.ts +2 -0
  52. package/types/control/LayerAnimation.d.ts +73 -0
  53. package/types/control/LayerSwitcher.d.ts +55 -11
  54. package/types/control/MouseNavigation.d.ts +1 -0
  55. package/types/control/MouseWheelZoomControl.d.ts +1 -0
  56. package/types/control/Sun.d.ts +1 -0
  57. package/types/control/TouchNavigation.d.ts +1 -0
  58. package/types/control/UIhelpers.d.ts +13 -0
  59. package/types/control/index.d.ts +2 -1
  60. package/types/entity/LabelHandler.d.ts +2 -0
  61. package/types/entity/LabelWorker.d.ts +5 -7
  62. package/types/layer/BaseGeoImage.d.ts +9 -1
  63. package/types/layer/CanvasTiles.d.ts +5 -1
  64. package/types/layer/GeoImage.d.ts +1 -0
  65. package/types/layer/GeoTexture2d.d.ts +1 -0
  66. package/types/layer/Layer.d.ts +5 -1
  67. package/types/layer/Vector.d.ts +7 -0
  68. package/types/layer/WMS.d.ts +1 -0
  69. package/types/layer/XYZ.d.ts +8 -6
  70. package/types/math.d.ts +1 -1
  71. package/types/quadTree/EntityCollectionNode.d.ts +7 -0
  72. package/types/quadTree/Node.d.ts +1 -2
  73. package/types/renderer/Renderer.d.ts +1 -1
  74. package/types/renderer/RendererEvents.d.ts +16 -0
  75. package/types/scene/Planet.d.ts +19 -4
  76. package/types/segment/SegmentLonLat.d.ts +2 -0
  77. package/types/terrain/BilTerrain.d.ts +6 -0
  78. package/types/terrain/GlobusTerrain.d.ts +7 -0
  79. package/types/terrain/MapboxTerrain.d.ts +8 -0
  80. package/types/utils/BaseWorker.d.ts +14 -0
  81. package/types/utils/Loader.d.ts +3 -1
  82. package/types/utils/PlainSegmentWorker.d.ts +4 -6
  83. package/types/utils/TerrainWorker.d.ts +4 -6
  84. package/types/utils/functionComposition.d.ts +5 -0
  85. package/types/webgl/Handler.d.ts +4 -1
@@ -1,312 +1,347 @@
1
- /**
2
- * @module og/layer/BaseGeoImage
3
- */
4
-
5
- "use strict";
6
-
7
- import * as mercator from "../mercator.js";
8
- import { Extent } from "../Extent.js";
9
- import { Layer } from "./Layer.js";
10
- import { LonLat } from "../LonLat.js";
11
-
12
- /**
13
- * BaseGeoImage layer represents square imagery layer that could be an static image, or animated video or webgl buffer object displayed on the globe.
14
- * @class
15
- * @extends {Layer}
16
- */
17
- class BaseGeoImage extends Layer {
18
- constructor(name, options) {
19
- super(name, options);
20
-
21
- this._projType = 0;
22
-
23
- this._frameWidth = 256;
24
- this._frameHeight = 256;
25
-
26
- this._sourceReady = false;
27
- this._sourceTexture = null;
28
- this._materialTexture = null;
29
-
30
- this._gridBuffer = null;
31
- this._extentWgs84Params = null;
32
-
33
- this._refreshFrame = true;
34
- this._frameCreated = false;
35
- this._sourceCreated = false;
36
-
37
- this._animate = false;
38
- this._ready = false;
39
- this._creationProceeding = false;
40
- this._isRendering = false;
41
-
42
- this._extentWgs84 = new Extent();
43
- this._cornersWgs84 = null;
44
-
45
- this.rendering = null;
46
-
47
- options.corners && this.setCorners(options.corners);
48
- }
49
-
50
- get instanceName() {
51
- return "BaseGeoImage";
52
- }
53
-
54
- /**
55
- * Gets corners coordinates.
56
- * @public
57
- * @return {Array.<LonLat>} - (exactly 4 entries)
58
- */
59
- getCornersLonLat() {
60
- var c = this._cornersWgs84;
61
- return [
62
- new LonLat(c[0].lon, c[0].lat),
63
- new LonLat(c[1].lon, c[1].lat),
64
- new LonLat(c[2].lon, c[2].lat),
65
- new LonLat(c[3].lon, c[3].lat)
66
- ];
67
- }
68
-
69
- /**
70
- * Gets corners coordinates.
71
- * @public
72
- * @return {Array.<Array<number>>} - (exactly 3 entries)
73
- */
74
- getCorners() {
75
- var c = this._cornersWgs84;
76
- return [
77
- [c[0].lon, c[0].lat],
78
- [c[1].lon, c[1].lat],
79
- [c[2].lon, c[2].lat],
80
- [c[3].lon, c[3].lat]
81
- ];
82
- }
83
-
84
- /**
85
- * Sets geoImage geographical corners coordinates.
86
- * @public
87
- * @param {Array.<Array.<number>>} corners - GeoImage corners coordinates. Where first coordinate (exactly 3 entries)
88
- * coincedents to the left top image corner, secont to the right top image corner, third to the right bottom
89
- * and fourth - left bottom image corner.
90
- */
91
- setCorners(corners) {
92
- this.setCornersLonLat(LonLat.join(corners));
93
- }
94
-
95
- /**
96
- * Sets geoImage geographical corners coordinates.
97
- * @public
98
- * @param {Array.<LonLat>} corners - GeoImage corners coordinates. Where first coordinate
99
- * coincedents to the left top image corner, secont to the right top image corner, third to the right bottom
100
- * and fourth - left bottom image corner. (exactly 4 entries)
101
- */
102
- setCornersLonLat(corners) {
103
- this._refreshFrame = true;
104
- this._cornersWgs84 = [
105
- corners[0].clone(),
106
- corners[1].clone(),
107
- corners[2].clone(),
108
- corners[3].clone()
109
- ] || [0, 0, 0, 0];
110
-
111
- for (var i = 0; i < this._cornersWgs84.length; i++) {
112
- if (this._cornersWgs84[i].lat >= 89.9) {
113
- this._cornersWgs84[i].lat = 89.9;
114
- }
115
- if (this._cornersWgs84[i].lat <= -89.9) {
116
- this._cornersWgs84[i].lat = -89.9;
117
- }
118
- }
119
- this._extent.setByCoordinates(this._cornersWgs84);
120
-
121
- var me = this._extent;
122
- if (me.southWest.lat > mercator.MAX_LAT || me.northEast.lat < mercator.MIN_LAT) {
123
- this._projType = 0;
124
- this.rendering = this._renderingProjType0;
125
- } else {
126
- this._projType = 1;
127
- this.rendering = this._renderingProjType1;
128
- }
129
-
130
- if (this._ready && !this._creationProceeding) {
131
- this._planet._geoImageCreator.add(this);
132
- }
133
- }
134
-
135
- /**
136
- * Creates geoImage frame.
137
- * @protected
138
- */
139
- _createFrame() {
140
- this._extentWgs84 = this._extent.clone();
141
-
142
- this._cornersMerc = [
143
- this._cornersWgs84[0].forwardMercatorEPS01(),
144
- this._cornersWgs84[1].forwardMercatorEPS01(),
145
- this._cornersWgs84[2].forwardMercatorEPS01(),
146
- this._cornersWgs84[3].forwardMercatorEPS01()
147
- ];
148
-
149
- this._extentMerc = new Extent(
150
- this._extentWgs84.southWest.forwardMercatorEPS01(),
151
- this._extentWgs84.northEast.forwardMercatorEPS01()
152
- );
153
-
154
- if (this._projType === 0) {
155
- this._extentWgs84Params = [
156
- this._extentWgs84.southWest.lon,
157
- this._extentWgs84.southWest.lat,
158
- 2.0 / this._extentWgs84.getWidth(),
159
- 2.0 / this._extentWgs84.getHeight()
160
- ];
161
- } else {
162
- this._extentMercParams = [
163
- this._extentMerc.southWest.lon,
164
- this._extentMerc.southWest.lat,
165
- 2.0 / this._extentMerc.getWidth(),
166
- 2.0 / this._extentMerc.getHeight()
167
- ];
168
- }
169
-
170
- // creates material frame textures
171
- if (this._planet) {
172
- var p = this._planet,
173
- h = p.renderer.handler,
174
- gl = h.gl;
175
-
176
- gl.deleteTexture(this._materialTexture);
177
- this._materialTexture = h.createEmptyTexture_l(this._frameWidth, this._frameHeight);
178
-
179
- this._gridBuffer = this._planet._geoImageCreator.createGridBuffer(
180
- this._cornersWgs84,
181
- this._projType
182
- );
183
-
184
- this._refreshFrame = false;
185
- }
186
- }
187
-
188
- /**
189
- * @virtual
190
- * @param {Material} material - GeoImage material.
191
- */
192
- abortMaterialLoading(material) {
193
- this._creationProceeding = false;
194
- material.isLoading = false;
195
- material.isReady = false;
196
- }
197
-
198
- /**
199
- * Clear layer material.
200
- * @virtual
201
- */
202
- clear() {
203
- var p = this._planet;
204
-
205
- if (p) {
206
- var gl = p.renderer.handler.gl;
207
- this._creationProceeding && p._geoImageCreator.remove(this);
208
- p._clearLayerMaterial(this);
209
-
210
- gl.deleteBuffer(this._gridBuffer);
211
-
212
- gl.deleteTexture(this._sourceTexture);
213
- !this._materialTexture.default && gl.deleteTexture(this._materialTexture);
214
- }
215
-
216
- this._sourceTexture = null;
217
- this._materialTexture = null;
218
-
219
- this._gridBuffer = null;
220
-
221
- this._refreshFrame = true;
222
- this._sourceCreated = false;
223
-
224
- this._ready = false;
225
- this._creationProceeding = false;
226
- }
227
-
228
- /**
229
- * Sets layer visibility.
230
- * @public
231
- * @virtual
232
- * @param {boolean} visibility - GeoImage visibility.
233
- */
234
- setVisibility(visibility) {
235
- if (visibility !== this._visibility) {
236
- super.setVisibility(visibility);
237
-
238
- // remove from creator
239
- if (visibility) {
240
- this._sourceReady && this._planet._geoImageCreator.add(this);
241
- } else {
242
- this._sourceReady && this._planet._geoImageCreator.remove(this);
243
- }
244
- }
245
- }
246
-
247
- /**
248
- * @virtual
249
- * @protected
250
- * @param {Material} material - GeoImage material.
251
- */
252
- clearMaterial(material) {
253
- material.image = null;
254
- material.texture = null;
255
- material.isLoading = false;
256
- material.isReady = false;
257
- }
258
-
259
- /**
260
- * @virtual
261
- * @protected
262
- * @param {Material} material - GeoImage material.
263
- * @returns {Array<number> } -
264
- */
265
- applyMaterial(material) {
266
- var segment = material.segment;
267
-
268
- if (this._ready) {
269
- material.applyTexture(this._materialTexture);
270
- } else {
271
- material.texture = this._planet.transparentTexture;
272
- !this._creationProceeding && this.loadMaterial(material);
273
- }
274
-
275
- var v0s, v0t;
276
- if (this._projType === 0) {
277
- v0s = this._extentWgs84;
278
- v0t = segment._extent;
279
- } else {
280
- v0s = this._extentMerc;
281
- v0t = segment.getExtentMerc();
282
- }
283
-
284
- var sSize_x = v0s.northEast.lon - v0s.southWest.lon;
285
- var sSize_y = v0s.northEast.lat - v0s.southWest.lat;
286
- var dV0s_x = (v0t.southWest.lon - v0s.southWest.lon) / sSize_x;
287
- var dV0s_y = (v0s.northEast.lat - v0t.northEast.lat) / sSize_y;
288
- var dSize_x = (v0t.northEast.lon - v0t.southWest.lon) / sSize_x;
289
- var dSize_y = (v0t.northEast.lat - v0t.southWest.lat) / sSize_y;
290
- return [dV0s_x, dV0s_y, dSize_x, dSize_y];
291
- }
292
-
293
- /**
294
- * Gets frame width size in pixels.
295
- * @public
296
- * @returns {Number} Frame width.
297
- */
298
- get getFrameWidth() {
299
- return this._frameWidth;
300
- }
301
-
302
- /**
303
- * Gets frame height size in pixels.
304
- * @public
305
- * @returns {Number} Frame height.
306
- */
307
- get getFrameHeight() {
308
- return this._frameHeight;
309
- }
310
- }
311
-
312
- export { BaseGeoImage };
1
+ /**
2
+ * @module og/layer/BaseGeoImage
3
+ */
4
+
5
+ "use strict";
6
+
7
+ import * as mercator from "../mercator.js";
8
+ import { Extent } from "../Extent.js";
9
+ import { Layer } from "./Layer.js";
10
+ import { LonLat } from "../LonLat.js";
11
+
12
+ const EVENT_NAMES = [
13
+ /**
14
+ * Triggered when image data is loaded
15
+ * @event og.layer.BaseGeoImage#loadend
16
+ */
17
+ "loadend"
18
+ ];
19
+
20
+ /**
21
+ * BaseGeoImage layer represents square imagery layer that could be an static image, or animated video or webgl buffer object displayed on the globe.
22
+ * @class
23
+ * @extends {Layer}
24
+ */
25
+ class BaseGeoImage extends Layer {
26
+ constructor(name, options) {
27
+ super(name, { ...options, events: EVENT_NAMES });
28
+
29
+ this._projType = 0;
30
+
31
+ this._frameWidth = 256;
32
+ this._frameHeight = 256;
33
+
34
+ this._sourceReady = false;
35
+ this._sourceTexture = null;
36
+ this._materialTexture = null;
37
+
38
+ this._gridBuffer = null;
39
+ this._extentWgs84Params = null;
40
+
41
+ this._refreshFrame = true;
42
+ this._frameCreated = false;
43
+ this._sourceCreated = false;
44
+
45
+ this._animate = false;
46
+ this._ready = false;
47
+ this._creationProceeding = false;
48
+ this._isRendering = false;
49
+
50
+ this._extentWgs84 = new Extent();
51
+ this._cornersWgs84 = null;
52
+
53
+ this._isFullExtent = options.fullExtent || false;
54
+
55
+ /**
56
+ * rendering function pointer
57
+ */
58
+ this.rendering = null;
59
+
60
+ options.corners && this.setCorners(options.corners);
61
+ }
62
+
63
+ get isIdle() {
64
+ return super.isIdle && this._ready;
65
+ }
66
+
67
+ addTo(planet) {
68
+ this._onLoadend_ = this._onLoadend.bind(this);
69
+ this.events.on("loadend", this._onLoadend_, this);
70
+ return super.addTo(planet);
71
+ }
72
+
73
+ _onLoadend() {
74
+ if (this._planet) {
75
+ this._planet.events.dispatch(this._planet.events.layerloadend, this);
76
+ }
77
+ }
78
+
79
+ remove() {
80
+ this.events.off("loadend", this._onLoadend_);
81
+ this._onLoadend_ = null;
82
+ return super.remove();
83
+ }
84
+
85
+ get instanceName() {
86
+ return "BaseGeoImage";
87
+ }
88
+
89
+ /**
90
+ * Gets corners coordinates.
91
+ * @public
92
+ * @return {Array.<LonLat>} - (exactly 4 entries)
93
+ */
94
+ getCornersLonLat() {
95
+ var c = this._cornersWgs84;
96
+ return [
97
+ new LonLat(c[0].lon, c[0].lat),
98
+ new LonLat(c[1].lon, c[1].lat),
99
+ new LonLat(c[2].lon, c[2].lat),
100
+ new LonLat(c[3].lon, c[3].lat)
101
+ ];
102
+ }
103
+
104
+ /**
105
+ * Gets corners coordinates.
106
+ * @public
107
+ * @return {Array.<Array<number>>} - (exactly 3 entries)
108
+ */
109
+ getCorners() {
110
+ var c = this._cornersWgs84;
111
+ return [
112
+ [c[0].lon, c[0].lat],
113
+ [c[1].lon, c[1].lat],
114
+ [c[2].lon, c[2].lat],
115
+ [c[3].lon, c[3].lat]
116
+ ];
117
+ }
118
+
119
+ /**
120
+ * Sets geoImage geographical corners coordinates.
121
+ * @public
122
+ * @param {Array.<Array.<number>>} corners - GeoImage corners coordinates. Where first coordinate (exactly 3 entries)
123
+ * coincedents to the left top image corner, secont to the right top image corner, third to the right bottom
124
+ * and fourth - left bottom image corner.
125
+ */
126
+ setCorners(corners) {
127
+ this.setCornersLonLat(LonLat.join(corners));
128
+ }
129
+
130
+ /**
131
+ * Sets geoImage geographical corners coordinates.
132
+ * @public
133
+ * @param {Array.<LonLat>} corners - GeoImage corners coordinates. Where first coordinate
134
+ * coincedents to the left top image corner, secont to the right top image corner, third to the right bottom
135
+ * and fourth - left bottom image corner. (exactly 4 entries)
136
+ */
137
+ setCornersLonLat(corners) {
138
+ this._refreshFrame = true;
139
+ this._cornersWgs84 = [
140
+ corners[0].clone(),
141
+ corners[1].clone(),
142
+ corners[2].clone(),
143
+ corners[3].clone()
144
+ ] || [0, 0, 0, 0];
145
+
146
+ for (var i = 0; i < this._cornersWgs84.length; i++) {
147
+ if (this._cornersWgs84[i].lat >= 89.9) {
148
+ this._cornersWgs84[i].lat = 89.9;
149
+ }
150
+ if (this._cornersWgs84[i].lat <= -89.9) {
151
+ this._cornersWgs84[i].lat = -89.9;
152
+ }
153
+ }
154
+ this._extent.setByCoordinates(this._cornersWgs84);
155
+
156
+ var me = this._extent;
157
+ if (me.southWest.lat > mercator.MAX_LAT || me.northEast.lat < mercator.MIN_LAT) {
158
+ this._projType = 0;
159
+ this.rendering = this._renderingProjType0;
160
+ } else {
161
+ this._projType = 1;
162
+ this.rendering = this._renderingProjType1;
163
+ }
164
+
165
+ if (this._ready && !this._creationProceeding) {
166
+ this._planet._geoImageCreator.add(this);
167
+ }
168
+ }
169
+
170
+ /**
171
+ * Creates geoImage frame.
172
+ * @protected
173
+ */
174
+ _createFrame() {
175
+ this._extentWgs84 = this._extent.clone();
176
+
177
+ this._cornersMerc = [
178
+ this._cornersWgs84[0].forwardMercatorEPS01(),
179
+ this._cornersWgs84[1].forwardMercatorEPS01(),
180
+ this._cornersWgs84[2].forwardMercatorEPS01(),
181
+ this._cornersWgs84[3].forwardMercatorEPS01()
182
+ ];
183
+
184
+ this._extentMerc = new Extent(
185
+ this._extentWgs84.southWest.forwardMercatorEPS01(),
186
+ this._extentWgs84.northEast.forwardMercatorEPS01()
187
+ );
188
+
189
+ if (this._projType === 0) {
190
+ this._extentWgs84Params = [
191
+ this._extentWgs84.southWest.lon,
192
+ this._extentWgs84.southWest.lat,
193
+ 2.0 / this._extentWgs84.getWidth(),
194
+ 2.0 / this._extentWgs84.getHeight()
195
+ ];
196
+ } else {
197
+ this._extentMercParams = [
198
+ this._extentMerc.southWest.lon,
199
+ this._extentMerc.southWest.lat,
200
+ 2.0 / this._extentMerc.getWidth(),
201
+ 2.0 / this._extentMerc.getHeight()
202
+ ];
203
+ }
204
+
205
+ // creates material frame textures
206
+ if (this._planet) {
207
+ var p = this._planet,
208
+ h = p.renderer.handler,
209
+ gl = h.gl;
210
+
211
+ gl.deleteTexture(this._materialTexture);
212
+ this._materialTexture = h.createEmptyTexture_l(this._frameWidth, this._frameHeight);
213
+
214
+ this._gridBuffer = this._planet._geoImageCreator.createGridBuffer(
215
+ this._cornersWgs84,
216
+ this._projType
217
+ );
218
+
219
+ this._refreshFrame = false;
220
+ }
221
+ }
222
+
223
+ /**
224
+ * @virtual
225
+ * @param {Material} material - GeoImage material.
226
+ */
227
+ abortMaterialLoading(material) {
228
+ this._creationProceeding = false;
229
+ material.isLoading = false;
230
+ material.isReady = false;
231
+ }
232
+
233
+ /**
234
+ * Clear layer material.
235
+ * @virtual
236
+ */
237
+ clear() {
238
+ var p = this._planet;
239
+
240
+ if (p) {
241
+ var gl = p.renderer.handler.gl;
242
+ this._creationProceeding && p._geoImageCreator.remove(this);
243
+ p._clearLayerMaterial(this);
244
+
245
+ gl.deleteBuffer(this._gridBuffer);
246
+
247
+ gl.deleteTexture(this._sourceTexture);
248
+ !this._materialTexture.default && gl.deleteTexture(this._materialTexture);
249
+ }
250
+
251
+ this._sourceTexture = null;
252
+ this._materialTexture = null;
253
+
254
+ this._gridBuffer = null;
255
+
256
+ this._refreshFrame = true;
257
+ this._sourceCreated = false;
258
+
259
+ this._ready = false;
260
+ this._creationProceeding = false;
261
+ }
262
+
263
+ /**
264
+ * Sets layer visibility.
265
+ * @public
266
+ * @virtual
267
+ * @param {boolean} visibility - GeoImage visibility.
268
+ */
269
+ setVisibility(visibility) {
270
+ if (visibility !== this._visibility) {
271
+ super.setVisibility(visibility);
272
+
273
+ // remove from creator
274
+ if (visibility) {
275
+ this._sourceReady && this._planet._geoImageCreator.add(this);
276
+ } else {
277
+ this._sourceReady && this._planet._geoImageCreator.remove(this);
278
+ }
279
+ }
280
+ }
281
+
282
+ /**
283
+ * @virtual
284
+ * @protected
285
+ * @param {Material} material - GeoImage material.
286
+ */
287
+ clearMaterial(material) {
288
+ material.image = null;
289
+ material.texture = null;
290
+ material.isLoading = false;
291
+ material.isReady = false;
292
+ }
293
+
294
+ /**
295
+ * @virtual
296
+ * @protected
297
+ * @param {Material} material - GeoImage segment material.
298
+ * @returns {Array<number> } -
299
+ */
300
+ applyMaterial(material) {
301
+ var segment = material.segment;
302
+
303
+ if (this._ready) {
304
+ material.applyTexture(this._materialTexture);
305
+ } else {
306
+ material.texture = this._planet.transparentTexture;
307
+ !this._creationProceeding && this.loadMaterial(material);
308
+ }
309
+
310
+ var v0s, v0t;
311
+ if (this._projType === 0) {
312
+ v0s = this._extentWgs84;
313
+ v0t = segment._extent;
314
+ } else {
315
+ v0s = this._extentMerc;
316
+ v0t = segment.getExtentMerc();
317
+ }
318
+
319
+ var sSize_x = v0s.northEast.lon - v0s.southWest.lon;
320
+ var sSize_y = v0s.northEast.lat - v0s.southWest.lat;
321
+ var dV0s_x = (v0t.southWest.lon - v0s.southWest.lon) / sSize_x;
322
+ var dV0s_y = (v0s.northEast.lat - v0t.northEast.lat) / sSize_y;
323
+ var dSize_x = (v0t.northEast.lon - v0t.southWest.lon) / sSize_x;
324
+ var dSize_y = (v0t.northEast.lat - v0t.southWest.lat) / sSize_y;
325
+ return [dV0s_x, dV0s_y, dSize_x, dSize_y];
326
+ }
327
+
328
+ /**
329
+ * Gets frame width size in pixels.
330
+ * @public
331
+ * @returns {Number} Frame width.
332
+ */
333
+ get getFrameWidth() {
334
+ return this._frameWidth;
335
+ }
336
+
337
+ /**
338
+ * Gets frame height size in pixels.
339
+ * @public
340
+ * @returns {Number} Frame height.
341
+ */
342
+ get getFrameHeight() {
343
+ return this._frameHeight;
344
+ }
345
+ }
346
+
347
+ export { BaseGeoImage };