xtorcga
Version:
Xtor Compute Geometry Algorithm Libary 计算几何算法库
86 lines (85 loc) • 3.02 kB
JavaScript
;
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
exports.ImageryLayerCollection = void 0;
var eventhandler_1 = require("../../src/render/eventhandler");
/**
* 图像层的有序集合。
*/
var ImageryLayerCollection = /** @class */ (function (_super) {
__extends(ImageryLayerCollection, _super);
function ImageryLayerCollection() {
var _this = _super.call(this) || this;
_this._layers = [];
return _this;
}
Object.defineProperty(ImageryLayerCollection.prototype, "length", {
get: function () {
return this._layers.length;
},
enumerable: false,
configurable: true
});
ImageryLayerCollection.prototype.add = function (layer, index) {
this._layers.push(layer);
this.fire('layerAdded');
};
ImageryLayerCollection.prototype.remove = function (layer, destroy) {
if (destroy === void 0) { destroy = true; }
var index = this._layers.indexOf(layer);
if (index !== -1) {
this._layers.splice(index, 1);
this._update();
this.fire("layerRemoved");
if (destroy) {
layer.destroy();
}
return true;
}
return false;
};
;
ImageryLayerCollection.prototype.removeAll = function (destroy) {
if (destroy === void 0) { destroy = true; }
var layers = this._layers;
for (var i = 0, len = layers.length; i < len; i++) {
var layer = layers[i];
this.fire('layerRemoved');
if (destroy) {
layer.destroy();
}
}
this._layers = [];
};
;
ImageryLayerCollection.prototype.contains = function (layer) {
return this.indexOf(layer) !== -1;
};
;
ImageryLayerCollection.prototype.indexOf = function (layer) {
return this._layers.indexOf(layer);
};
;
ImageryLayerCollection.prototype._update = function () {
};
ImageryLayerCollection.EventType = {
layerAdded: 'layerAdded',
layerRemoved: 'layerRemoved',
layerMoved: 'layerMoved',
layerShownOrHidden: 'layerShownOrHidden',
};
return ImageryLayerCollection;
}(eventhandler_1.EventHandler));
exports.ImageryLayerCollection = ImageryLayerCollection;