@google/earthengine 1.7.19 → 1.7.21
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/build/browser.js +80 -44
- package/build/ee_api_js.js +598 -595
- package/build/ee_api_js_debug.js +57 -21
- package/build/ee_api_js_npm.js +80 -44
- package/build/main.js +80 -44
- package/package.json +1 -1
- package/src/abstractoverlay.js +7 -7
- package/src/apiclient.js +11 -3
- package/src/apifunction.js +60 -5
- package/src/collection.js +23 -20
- package/src/computedobject.js +16 -12
- package/src/customfunction.js +17 -10
- package/src/date.js +8 -7
- package/src/deserializer.js +12 -2
- package/src/dictionary.js +9 -5
- package/src/ee.js +18 -16
- package/src/element.js +16 -13
- package/src/feature.js +10 -7
- package/src/featurecollection.js +18 -11
- package/src/filter.js +49 -46
- package/src/floattileoverlay.js +15 -15
- package/src/image.js +29 -25
- package/src/images.js +2 -2
- package/src/layers/abstractoverlay.js +31 -33
- package/src/list.js +4 -1
- package/src/maplayeroverlay.js +23 -23
- package/src/maptilemanager.js +39 -31
- package/src/number.js +4 -1
- package/src/profiler.js +4 -2
- package/src/string.js +10 -3
- package/src/types.js +5 -5
|
@@ -19,8 +19,6 @@ goog.require('goog.net.XhrIo');
|
|
|
19
19
|
goog.require('goog.object');
|
|
20
20
|
goog.require('goog.structs.Map');
|
|
21
21
|
goog.require('goog.style');
|
|
22
|
-
goog.requireType('ee.data.Profiler');
|
|
23
|
-
|
|
24
22
|
|
|
25
23
|
|
|
26
24
|
/**
|
|
@@ -36,7 +34,7 @@ ee.layers.AbstractOverlay = class extends goog.events.EventTarget {
|
|
|
36
34
|
/**
|
|
37
35
|
* @param {!ee.layers.AbstractTileSource} tileSource The source of tiles
|
|
38
36
|
* for this map layer.
|
|
39
|
-
* @param {Object=} opt_options Initialization options, of the same form as a
|
|
37
|
+
* @param {?Object=} opt_options Initialization options, of the same form as a
|
|
40
38
|
* google.maps.ImageMapTypeOptions object.
|
|
41
39
|
*/
|
|
42
40
|
constructor(tileSource, opt_options) {
|
|
@@ -44,7 +42,7 @@ ee.layers.AbstractOverlay = class extends goog.events.EventTarget {
|
|
|
44
42
|
|
|
45
43
|
// Public options required by the Maps API.
|
|
46
44
|
|
|
47
|
-
|
|
45
|
+
const options = opt_options || {};
|
|
48
46
|
this.minZoom = options.minZoom || 0;
|
|
49
47
|
this.maxZoom = options.maxZoom || 20;
|
|
50
48
|
if (!window['google'] || !window['google']['maps']) {
|
|
@@ -63,16 +61,16 @@ ee.layers.AbstractOverlay = class extends goog.events.EventTarget {
|
|
|
63
61
|
/** @protected {!ee.layers.AbstractOverlayStats} */
|
|
64
62
|
this.stats = new ee.layers.AbstractOverlayStats(tileSource.getUniqueId());
|
|
65
63
|
|
|
66
|
-
/** @protected {goog.structs.Map<string, ee.layers.AbstractTile>} */
|
|
64
|
+
/** @protected {?goog.structs.Map<string, ?ee.layers.AbstractTile>} */
|
|
67
65
|
this.tilesById = new goog.structs.Map();
|
|
68
66
|
|
|
69
67
|
/** @protected {number} The count of tiles that have been requested. */
|
|
70
68
|
this.tileCounter = 0;
|
|
71
69
|
|
|
72
|
-
/** @protected {ee.layers.AbstractTileSource} The overlay's tile source. */
|
|
70
|
+
/** @protected {?ee.layers.AbstractTileSource} The overlay's tile source. */
|
|
73
71
|
this.tileSource = tileSource;
|
|
74
72
|
|
|
75
|
-
/** @protected {goog.events.EventHandler} The overlay's event handler. */
|
|
73
|
+
/** @protected {?goog.events.EventHandler} The overlay's event handler. */
|
|
76
74
|
this.handler = new goog.events.EventHandler(this);
|
|
77
75
|
|
|
78
76
|
// MapType options required by the compiler but which we don't support.
|
|
@@ -86,7 +84,7 @@ ee.layers.AbstractOverlay = class extends goog.events.EventTarget {
|
|
|
86
84
|
|
|
87
85
|
/**
|
|
88
86
|
* Adds a callback to be fired each time a tile is loaded.
|
|
89
|
-
* @param {function(ee.layers.TileLoadEvent)} callback The function to call.
|
|
87
|
+
* @param {function(!ee.layers.TileLoadEvent)} callback The function to call.
|
|
90
88
|
* @return {!Object} An ID which can be passed to removeTileCallback().
|
|
91
89
|
* @export
|
|
92
90
|
*/
|
|
@@ -101,7 +99,7 @@ ee.layers.AbstractOverlay = class extends goog.events.EventTarget {
|
|
|
101
99
|
* @export
|
|
102
100
|
*/
|
|
103
101
|
removeTileCallback(callbackId) {
|
|
104
|
-
goog.events.unlistenByKey(/** @type {goog.events.Key} */ (callbackId));
|
|
102
|
+
goog.events.unlistenByKey(/** @type {!goog.events.Key} */ (callbackId));
|
|
105
103
|
}
|
|
106
104
|
|
|
107
105
|
/**
|
|
@@ -153,7 +151,7 @@ ee.layers.AbstractOverlay = class extends goog.events.EventTarget {
|
|
|
153
151
|
* @return {?Element} Element to be displayed as a map tile.
|
|
154
152
|
*/
|
|
155
153
|
getTile(coord, zoom, ownerDocument) {
|
|
156
|
-
|
|
154
|
+
const maxCoord = 1 << zoom;
|
|
157
155
|
|
|
158
156
|
// If the position is out of bounds, return an empty tile immediately.
|
|
159
157
|
if (zoom < this.minZoom || coord.y < 0 || coord.y >= maxCoord) {
|
|
@@ -161,15 +159,15 @@ ee.layers.AbstractOverlay = class extends goog.events.EventTarget {
|
|
|
161
159
|
}
|
|
162
160
|
|
|
163
161
|
// Wrap longitude around.
|
|
164
|
-
|
|
162
|
+
let x = coord.x % maxCoord;
|
|
165
163
|
if (x < 0) {
|
|
166
164
|
x += maxCoord;
|
|
167
165
|
}
|
|
168
|
-
|
|
166
|
+
const normalizedCoord = new google.maps.Point(x, coord.y);
|
|
169
167
|
|
|
170
168
|
// Create the tile.
|
|
171
|
-
|
|
172
|
-
|
|
169
|
+
const uniqueId = this.getUniqueTileId_(coord, zoom);
|
|
170
|
+
const tile = this.createTile(normalizedCoord, zoom, ownerDocument, uniqueId);
|
|
173
171
|
tile.tileSize = this.tileSize;
|
|
174
172
|
goog.style.setOpacity(tile.div, this.opacity);
|
|
175
173
|
this.tilesById.set(uniqueId, tile);
|
|
@@ -188,7 +186,7 @@ ee.layers.AbstractOverlay = class extends goog.events.EventTarget {
|
|
|
188
186
|
// Requests for tiles that are no longer visible won't clog the queue:
|
|
189
187
|
// if the map is moved around a lot, Maps API calls our releaseTile()
|
|
190
188
|
// method, and the obsolete requests will be removed from the queue.
|
|
191
|
-
|
|
189
|
+
const priority = new Date().getTime() / 1000;
|
|
192
190
|
|
|
193
191
|
this.tileSource.loadTile(tile, priority);
|
|
194
192
|
|
|
@@ -200,7 +198,7 @@ ee.layers.AbstractOverlay = class extends goog.events.EventTarget {
|
|
|
200
198
|
* Implements releaseTile() for the google.maps.MapType interface.
|
|
201
199
|
*/
|
|
202
200
|
releaseTile(tileDiv) {
|
|
203
|
-
|
|
201
|
+
const tile = this.tilesById.get(tileDiv.id);
|
|
204
202
|
this.tilesById.delete(tileDiv.id);
|
|
205
203
|
if (tile) {
|
|
206
204
|
tile.abort();
|
|
@@ -210,14 +208,14 @@ ee.layers.AbstractOverlay = class extends goog.events.EventTarget {
|
|
|
210
208
|
|
|
211
209
|
/**
|
|
212
210
|
* Listen for tile status changes and respond accordingly.
|
|
213
|
-
* @param {ee.layers.AbstractTile} tile
|
|
211
|
+
* @param {!ee.layers.AbstractTile} tile
|
|
214
212
|
* @private
|
|
215
213
|
*/
|
|
216
214
|
registerStatusChangeListener_(tile) {
|
|
217
215
|
// Notify listeners when the tile has loaded.
|
|
218
216
|
this.handler.listen(
|
|
219
217
|
tile, ee.layers.AbstractTile.EventType.STATUS_CHANGED, function() {
|
|
220
|
-
|
|
218
|
+
const Status = ee.layers.AbstractTile.Status;
|
|
221
219
|
|
|
222
220
|
switch (tile.getStatus()) {
|
|
223
221
|
case Status.LOADED:
|
|
@@ -260,8 +258,8 @@ ee.layers.AbstractOverlay = class extends goog.events.EventTarget {
|
|
|
260
258
|
* @private
|
|
261
259
|
*/
|
|
262
260
|
getUniqueTileId_(coord, z) {
|
|
263
|
-
|
|
264
|
-
|
|
261
|
+
const tileId = [coord.x, coord.y, z, this.tileCounter++].join('-');
|
|
262
|
+
const sourceId = this.tileSource.getUniqueId();
|
|
265
263
|
return [tileId, sourceId].join('-');
|
|
266
264
|
}
|
|
267
265
|
|
|
@@ -278,7 +276,7 @@ ee.layers.AbstractOverlay = class extends goog.events.EventTarget {
|
|
|
278
276
|
|
|
279
277
|
/**
|
|
280
278
|
* Returns the count of tiles with the provided status.
|
|
281
|
-
* @param {ee.layers.AbstractTile.Status} status The tile status.
|
|
279
|
+
* @param {!ee.layers.AbstractTile.Status} status The tile status.
|
|
282
280
|
* @return {number} The count of tiles with the provided status.
|
|
283
281
|
* @private
|
|
284
282
|
*/
|
|
@@ -320,9 +318,9 @@ ee.layers.AbstractOverlay.DEFAULT_TILE_EDGE_LENGTH = 256;
|
|
|
320
318
|
* Factory method to create a tile for this overlay.
|
|
321
319
|
* @param {!google.maps.Point} coord The position of the tile.
|
|
322
320
|
* @param {number} zoom The zoom level of the tile.
|
|
323
|
-
* @param {Node} ownerDocument The owner document.
|
|
321
|
+
* @param {?Node} ownerDocument The owner document.
|
|
324
322
|
* @param {string} uniqueId
|
|
325
|
-
* @return {ee.layers.AbstractTile}
|
|
323
|
+
* @return {!ee.layers.AbstractTile}
|
|
326
324
|
* @protected
|
|
327
325
|
*/
|
|
328
326
|
ee.layers.AbstractOverlay.prototype.createTile = goog.abstractMethod;
|
|
@@ -449,7 +447,7 @@ ee.layers.AbstractTile = class extends goog.events.EventTarget {
|
|
|
449
447
|
/**
|
|
450
448
|
* @param {!google.maps.Point} coord The position of the tile.
|
|
451
449
|
* @param {number} zoom The zoom level of the tile.
|
|
452
|
-
* @param {Node} ownerDocument The tile's owner document.
|
|
450
|
+
* @param {?Node} ownerDocument The tile's owner document.
|
|
453
451
|
* @param {string} uniqueId A unique ID for the tile.
|
|
454
452
|
*/
|
|
455
453
|
constructor(coord, zoom, ownerDocument, uniqueId) {
|
|
@@ -468,7 +466,7 @@ ee.layers.AbstractTile = class extends goog.events.EventTarget {
|
|
|
468
466
|
/** @package {number} The maximum number of tile load retries. */
|
|
469
467
|
this.maxRetries = ee.layers.AbstractTile.DEFAULT_MAX_LOAD_RETRIES_;
|
|
470
468
|
|
|
471
|
-
/** @package {google.maps.Size} The size of the tile. */
|
|
469
|
+
/** @package {!google.maps.Size} The size of the tile. */
|
|
472
470
|
this.tileSize;
|
|
473
471
|
|
|
474
472
|
/** @package {string} The URL of the tile's source data. */
|
|
@@ -477,7 +475,7 @@ ee.layers.AbstractTile = class extends goog.events.EventTarget {
|
|
|
477
475
|
/** @package {!Blob} The source data for the tile. */
|
|
478
476
|
this.sourceData;
|
|
479
477
|
|
|
480
|
-
/** @package {Object} The response headers from the source data request. */
|
|
478
|
+
/** @package {!Object} The response headers from the source data request. */
|
|
481
479
|
this.sourceResponseHeaders;
|
|
482
480
|
|
|
483
481
|
/**
|
|
@@ -486,10 +484,10 @@ ee.layers.AbstractTile = class extends goog.events.EventTarget {
|
|
|
486
484
|
*/
|
|
487
485
|
this.renderer = function() {}; // No-op by default.
|
|
488
486
|
|
|
489
|
-
/** @private {goog.net.XhrIo} The request for the tile's source data. */
|
|
487
|
+
/** @private {!goog.net.XhrIo} The request for the tile's source data. */
|
|
490
488
|
this.xhrIo_;
|
|
491
489
|
|
|
492
|
-
/** @private {ee.layers.AbstractTile.Status} The tile's current status. */
|
|
490
|
+
/** @private {!ee.layers.AbstractTile.Status} The tile's current status. */
|
|
493
491
|
this.status_ = ee.layers.AbstractTile.Status.NEW;
|
|
494
492
|
|
|
495
493
|
/** @private {number} The current load retry attempt. */
|
|
@@ -593,7 +591,7 @@ ee.layers.AbstractTile = class extends goog.events.EventTarget {
|
|
|
593
591
|
* @package
|
|
594
592
|
*/
|
|
595
593
|
retryLoad(opt_errorMessage) {
|
|
596
|
-
|
|
594
|
+
const parseError = function(error) {
|
|
597
595
|
try {
|
|
598
596
|
error = JSON.parse(error);
|
|
599
597
|
if (error['error'] && error['error']['message']) {
|
|
@@ -643,14 +641,14 @@ ee.layers.AbstractTile = class extends goog.events.EventTarget {
|
|
|
643
641
|
return this.status_ in ee.layers.AbstractTile.DONE_STATUS_SET_;
|
|
644
642
|
}
|
|
645
643
|
|
|
646
|
-
/** @package @return {ee.layers.AbstractTile.Status} The tile's status. */
|
|
644
|
+
/** @package @return {!ee.layers.AbstractTile.Status} The tile's status. */
|
|
647
645
|
getStatus() {
|
|
648
646
|
return this.status_;
|
|
649
647
|
}
|
|
650
648
|
|
|
651
649
|
/**
|
|
652
650
|
* Sets the tile's status.
|
|
653
|
-
* @param {ee.layers.AbstractTile.Status} status The new status.
|
|
651
|
+
* @param {!ee.layers.AbstractTile.Status} status The new status.
|
|
654
652
|
* @package
|
|
655
653
|
*/
|
|
656
654
|
setStatus(status) {
|
|
@@ -701,7 +699,7 @@ ee.layers.AbstractTile.Status = {
|
|
|
701
699
|
|
|
702
700
|
|
|
703
701
|
|
|
704
|
-
/** @private @const {!Object
|
|
702
|
+
/** @private @const {!Object<!ee.layers.AbstractTile.Status>} */
|
|
705
703
|
ee.layers.AbstractTile.DONE_STATUS_SET_ = goog.object.createSet(
|
|
706
704
|
ee.layers.AbstractTile.Status.ABORTED, ee.layers.AbstractTile.Status.FAILED,
|
|
707
705
|
ee.layers.AbstractTile.Status.LOADED,
|
|
@@ -709,5 +707,5 @@ ee.layers.AbstractTile.DONE_STATUS_SET_ = goog.object.createSet(
|
|
|
709
707
|
|
|
710
708
|
|
|
711
709
|
|
|
712
|
-
/** @private {number} The default number of maximum tile load attempts. */
|
|
710
|
+
/** @private @const {number} The default number of maximum tile load attempts. */
|
|
713
711
|
ee.layers.AbstractTile.DEFAULT_MAX_LOAD_RETRIES_ = 5;
|
package/src/list.js
CHANGED
|
@@ -43,7 +43,7 @@ ee.List = function(list) {
|
|
|
43
43
|
|
|
44
44
|
if (Array.isArray(list)) {
|
|
45
45
|
ee.List.base(this, 'constructor', null, null);
|
|
46
|
-
this.list_ = /** @type {IArrayLike} */ (list);
|
|
46
|
+
this.list_ = /** @type {!IArrayLike} */ (list);
|
|
47
47
|
} else if (list instanceof ee.ComputedObject) {
|
|
48
48
|
ee.List.base(this, 'constructor', list.func, list.args, list.varName);
|
|
49
49
|
this.list_ = null;
|
|
@@ -79,7 +79,9 @@ ee.List.reset = function() {
|
|
|
79
79
|
|
|
80
80
|
|
|
81
81
|
/**
|
|
82
|
+
* @param {function(*): *} encoder The function to encode inner objects.
|
|
82
83
|
* @override
|
|
84
|
+
* @return {*}
|
|
83
85
|
*/
|
|
84
86
|
ee.List.prototype.encode = function(encoder) {
|
|
85
87
|
if (Array.isArray(this.list_)) {
|
|
@@ -104,6 +106,7 @@ ee.List.prototype.encodeCloudValue = function(
|
|
|
104
106
|
|
|
105
107
|
/**
|
|
106
108
|
* @override
|
|
109
|
+
* @return {string}
|
|
107
110
|
*/
|
|
108
111
|
ee.List.prototype.name = function() {
|
|
109
112
|
return 'List';
|
package/src/maplayeroverlay.js
CHANGED
|
@@ -30,9 +30,9 @@ ee.MapLayerOverlay =
|
|
|
30
30
|
* @param {string} url The url for fetching this layer's tiles.
|
|
31
31
|
* @param {string} mapId The map ID for fetching this layer's tiles.
|
|
32
32
|
* @param {string} token The temporary token for fetching tiles.
|
|
33
|
-
* @param {Object} init Initialization options, of the same form as a
|
|
33
|
+
* @param {!Object} init Initialization options, of the same form as a
|
|
34
34
|
* google.maps.ImageMapTypeOptions object.
|
|
35
|
-
* @param {ee.data.Profiler=} opt_profiler Map tile calculation cost will be
|
|
35
|
+
* @param {!ee.data.Profiler=} opt_profiler Map tile calculation cost will be
|
|
36
36
|
* sent to this profiler, if its enabled flag is set.
|
|
37
37
|
*/
|
|
38
38
|
constructor(url, mapId, token, init, opt_profiler) {
|
|
@@ -48,19 +48,19 @@ ee.MapLayerOverlay =
|
|
|
48
48
|
this.isPng = (init.isPng !== undefined) ? init.isPng : true;
|
|
49
49
|
this.name = init.name;
|
|
50
50
|
|
|
51
|
-
/** @private {goog.structs.Set} The set of loaded tiles. */
|
|
51
|
+
/** @private @const {!goog.structs.Set} The set of loaded tiles. */
|
|
52
52
|
this.tiles_ = new goog.structs.Set();
|
|
53
53
|
|
|
54
54
|
/** @private {number} The layer's opacity. */
|
|
55
55
|
this.opacity_ = 1.0;
|
|
56
56
|
|
|
57
|
-
/** @private {boolean} Whether the layer is currently visible. */
|
|
57
|
+
/** @private @const {boolean} Whether the layer is currently visible. */
|
|
58
58
|
this.visible_ = true;
|
|
59
59
|
|
|
60
60
|
/**
|
|
61
61
|
* Map tile calculation cost will be sent to this profiler, if its enabled
|
|
62
62
|
* flag is set.
|
|
63
|
-
* @private {?ee.data.Profiler}
|
|
63
|
+
* @private @const {?ee.data.Profiler}
|
|
64
64
|
*/
|
|
65
65
|
this.profiler_ = opt_profiler || null;
|
|
66
66
|
}
|
|
@@ -88,7 +88,7 @@ ee.MapLayerOverlay =
|
|
|
88
88
|
* @export
|
|
89
89
|
*/
|
|
90
90
|
removeTileCallback(callbackId) {
|
|
91
|
-
goog.events.unlistenByKey(/** @type {goog.events.Key} */ (callbackId));
|
|
91
|
+
goog.events.unlistenByKey(/** @type {!goog.events.Key} */ (callbackId));
|
|
92
92
|
}
|
|
93
93
|
|
|
94
94
|
/**
|
|
@@ -105,23 +105,23 @@ ee.MapLayerOverlay =
|
|
|
105
105
|
* Implements getTile() for the google.maps.MapType interface.
|
|
106
106
|
* @param {!google.maps.Point} coord Position of tile.
|
|
107
107
|
* @param {number} zoom Zoom level.
|
|
108
|
-
* @param {Node} ownerDocument Parent document.
|
|
109
|
-
* @return {Node} Element to be displayed as a map tile.
|
|
108
|
+
* @param {!Node} ownerDocument Parent document.
|
|
109
|
+
* @return {!Node} Element to be displayed as a map tile.
|
|
110
110
|
* @override
|
|
111
111
|
*/
|
|
112
112
|
getTile(coord, zoom, ownerDocument) {
|
|
113
|
-
|
|
113
|
+
const maxCoord = 1 << zoom;
|
|
114
114
|
if (zoom < this.minZoom || coord.y < 0 || coord.y >= maxCoord) {
|
|
115
115
|
// Construct and return the tile immediately.
|
|
116
|
-
|
|
116
|
+
const img = ownerDocument.createElement('IMG');
|
|
117
117
|
img.style.width = '0px';
|
|
118
118
|
img.style.height = '0px';
|
|
119
119
|
return img;
|
|
120
120
|
}
|
|
121
121
|
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
122
|
+
const profiling = this.profiler_ && this.profiler_.isEnabled();
|
|
123
|
+
const tileId = this.getTileId(coord, zoom);
|
|
124
|
+
let src = [this.url, tileId].join('/') + '?token=' + this.token;
|
|
125
125
|
if (profiling) {
|
|
126
126
|
src += '&profiling=1';
|
|
127
127
|
}
|
|
@@ -132,11 +132,11 @@ ee.MapLayerOverlay =
|
|
|
132
132
|
// don't overwrite each other's state, and 2) the unique token for this
|
|
133
133
|
// layer to differentiate its tile requests from other tile requests
|
|
134
134
|
// for other layers with the same map ID.
|
|
135
|
-
|
|
135
|
+
const uniqueTileId = [tileId, this.tileCounter, this.token].join('/');
|
|
136
136
|
this.tileCounter += 1;
|
|
137
137
|
|
|
138
138
|
// Holds the <img> element created asynchronously.
|
|
139
|
-
|
|
139
|
+
const div = goog.dom.createDom(goog.dom.TagName.DIV, {'id': uniqueTileId});
|
|
140
140
|
|
|
141
141
|
// Use the current time in seconds as the priority for the tile
|
|
142
142
|
// loading queue. Smaller priorities move to the front of the queue,
|
|
@@ -145,7 +145,7 @@ ee.MapLayerOverlay =
|
|
|
145
145
|
// Requests for tiles that are no longer visible won't clog the queue:
|
|
146
146
|
// if the map is moved around a lot, Maps API calls our releaseTile()
|
|
147
147
|
// method, and the obsolete requests will be removed from the queue.
|
|
148
|
-
|
|
148
|
+
const priority = new Date().getTime() / 1000;
|
|
149
149
|
this.tilesLoading.push(uniqueTileId);
|
|
150
150
|
|
|
151
151
|
ee.MapTileManager.getInstance().send(
|
|
@@ -171,11 +171,11 @@ ee.MapLayerOverlay =
|
|
|
171
171
|
/**
|
|
172
172
|
* Implements releaseTile() for the google.maps.MapType
|
|
173
173
|
* interface.
|
|
174
|
-
* @param {Node} tileDiv The tile that has been released.
|
|
174
|
+
* @param {!Node} tileDiv The tile that has been released.
|
|
175
175
|
*/
|
|
176
176
|
releaseTile(tileDiv) {
|
|
177
177
|
ee.MapTileManager.getInstance().abort(tileDiv.id);
|
|
178
|
-
|
|
178
|
+
const tileImg = goog.dom.getFirstElementChild(tileDiv);
|
|
179
179
|
this.tiles_.remove(tileImg);
|
|
180
180
|
if (tileDiv.id !== '') { // Out-of-bounds tiles have no ID.
|
|
181
181
|
this.tilesFailed.remove(tileDiv.id);
|
|
@@ -191,7 +191,7 @@ ee.MapLayerOverlay =
|
|
|
191
191
|
*/
|
|
192
192
|
setOpacity(opacity) {
|
|
193
193
|
this.opacity_ = opacity;
|
|
194
|
-
|
|
194
|
+
const iter = this.tiles_.__iterator__();
|
|
195
195
|
goog.iter.forEach(iter, function(tile) {
|
|
196
196
|
goog.style.setOpacity(tile, opacity);
|
|
197
197
|
});
|
|
@@ -201,7 +201,7 @@ ee.MapLayerOverlay =
|
|
|
201
201
|
* Handle image 'load' and 'error' events. When the last one has
|
|
202
202
|
* finished, dispatch an ee.AbstractOverlay.EventType.TILE_LOADED event.
|
|
203
203
|
* Handle bookkeeping to keep the tilesLoading array accurate.
|
|
204
|
-
* @param {Node} div Tile div to which images should be appended.
|
|
204
|
+
* @param {!Node} div Tile div to which images should be appended.
|
|
205
205
|
* @param {string} tileId The id of the tile that was requested.
|
|
206
206
|
* @param {!goog.events.Event} e Image loading event.
|
|
207
207
|
* @param {?string} profileId If profiling, profile ID for the tile.
|
|
@@ -216,12 +216,12 @@ ee.MapLayerOverlay =
|
|
|
216
216
|
} else {
|
|
217
217
|
// Convert tile loading events to our own type.
|
|
218
218
|
goog.array.remove(this.tilesLoading, tileId);
|
|
219
|
-
|
|
219
|
+
let tile;
|
|
220
220
|
if (e.target && (e.type == goog.events.EventType.LOAD)) {
|
|
221
|
-
tile = /** @type {Node} */ (e.target);
|
|
221
|
+
tile = /** @type {!Node} */ (e.target);
|
|
222
222
|
this.tiles_.add(tile);
|
|
223
223
|
if (this.opacity_ != 1.0) {
|
|
224
|
-
goog.style.setOpacity(/** @type {Element} */ (tile), this.opacity_);
|
|
224
|
+
goog.style.setOpacity(/** @type {!Element} */ (tile), this.opacity_);
|
|
225
225
|
}
|
|
226
226
|
div.appendChild(tile);
|
|
227
227
|
}
|