@openglobus/og 0.13.8 → 0.13.12
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.
- package/README.md +1 -1
- package/css/og.css +388 -129
- package/dist/@openglobus/og.css +1 -1
- package/dist/@openglobus/og.esm.js +2 -2
- package/dist/@openglobus/og.esm.js.map +1 -1
- package/dist/@openglobus/og.umd.js +2 -2
- package/dist/@openglobus/og.umd.js.map +1 -1
- package/package.json +20 -19
- package/src/og/Globe.js +15 -16
- package/src/og/Object3d.js +33 -0
- package/src/og/control/GeoImageDragControl.js +102 -75
- package/src/og/control/LayerAnimation.js +306 -38
- package/src/og/control/LayerSwitcher.js +506 -159
- package/src/og/control/Lighting.js +27 -27
- package/src/og/control/RulerSwitcher.js +69 -0
- package/src/og/control/UIhelpers.js +146 -0
- package/src/og/control/index.js +3 -1
- package/src/og/control/ruler/RulerScene.js +6 -2
- package/src/og/control/visibleExtent/Segment.js +2 -1
- package/src/og/ellipsoid/wgs84.js +1 -1
- package/src/og/entity/LabelHandler.js +2 -2
- package/src/og/entity/LabelWorker.js +36 -54
- package/src/og/layer/BaseGeoImage.js +347 -312
- package/src/og/layer/CanvasTiles.js +312 -290
- package/src/og/layer/GeoImage.js +222 -214
- package/src/og/layer/GeoVideo.js +291 -291
- package/src/og/layer/Layer.js +71 -30
- package/src/og/layer/Material.js +109 -109
- package/src/og/layer/Vector.js +1 -0
- package/src/og/layer/XYZ.js +20 -12
- package/src/og/light/LightSource.js +364 -363
- package/src/og/math.js +2 -2
- package/src/og/quadTree/Node.js +7 -5
- package/src/og/renderer/Renderer.js +1 -1
- package/src/og/scene/Planet.js +103 -42
- package/src/og/segment/Segment.js +34 -56
- package/src/og/segment/Slice.js +1 -1
- package/src/og/shaders/drawnode.js +1 -1
- package/src/og/terrain/GlobusTerrain.js +31 -20
- package/src/og/terrain/MapboxTerrain.js +1 -1
- package/src/og/utils/BaseWorker.js +46 -0
- package/src/og/utils/GeoImageCreator.js +164 -161
- package/src/og/utils/Loader.js +60 -33
- package/src/og/utils/NormalMapCreator.js +403 -412
- package/src/og/utils/PlainSegmentWorker.js +29 -55
- package/src/og/utils/TerrainWorker.js +572 -589
- package/src/og/utils/functionComposition.js +13 -0
- package/src/og/webgl/Handler.js +42 -41
- package/types/Object3d.d.ts +1 -0
- package/types/camera/PlanetCamera.d.ts +4 -0
- package/types/control/GeoImageDragControl.d.ts +2 -0
- package/types/control/LayerAnimation.d.ts +73 -0
- package/types/control/LayerSwitcher.d.ts +55 -11
- package/types/control/MouseNavigation.d.ts +1 -0
- package/types/control/MouseWheelZoomControl.d.ts +1 -0
- package/types/control/Sun.d.ts +1 -0
- package/types/control/TouchNavigation.d.ts +1 -0
- package/types/control/UIhelpers.d.ts +13 -0
- package/types/control/index.d.ts +2 -1
- package/types/entity/LabelHandler.d.ts +2 -0
- package/types/entity/LabelWorker.d.ts +5 -7
- package/types/layer/BaseGeoImage.d.ts +9 -1
- package/types/layer/CanvasTiles.d.ts +5 -1
- package/types/layer/GeoImage.d.ts +1 -0
- package/types/layer/GeoTexture2d.d.ts +1 -0
- package/types/layer/Layer.d.ts +5 -1
- package/types/layer/Vector.d.ts +7 -0
- package/types/layer/WMS.d.ts +1 -0
- package/types/layer/XYZ.d.ts +8 -6
- package/types/math.d.ts +1 -1
- package/types/quadTree/EntityCollectionNode.d.ts +7 -0
- package/types/quadTree/Node.d.ts +1 -2
- package/types/renderer/Renderer.d.ts +1 -1
- package/types/renderer/RendererEvents.d.ts +16 -0
- package/types/scene/Planet.d.ts +19 -4
- package/types/segment/SegmentLonLat.d.ts +2 -0
- package/types/terrain/BilTerrain.d.ts +6 -0
- package/types/terrain/GlobusTerrain.d.ts +7 -0
- package/types/terrain/MapboxTerrain.d.ts +8 -0
- package/types/utils/BaseWorker.d.ts +14 -0
- package/types/utils/Loader.d.ts +3 -1
- package/types/utils/PlainSegmentWorker.d.ts +4 -6
- package/types/utils/TerrainWorker.d.ts +4 -6
- package/types/utils/functionComposition.d.ts +5 -0
- 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
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
this.
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
this.
|
|
35
|
-
this.
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
this.
|
|
39
|
-
this.
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
this.
|
|
43
|
-
this.
|
|
44
|
-
|
|
45
|
-
this.
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
this.
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
this.
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
this.
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
}
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
* @
|
|
296
|
-
* @
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
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 };
|