Rename _ol_layer_Group_ to LayerGroup

This commit is contained in:
Tim Schaub
2018-01-11 10:22:19 -07:00
parent ba206c9683
commit c6646b1cda
4 changed files with 35 additions and 35 deletions

View File

@@ -1,6 +1,6 @@
import Map from '../src/ol/Map.js';
import View from '../src/ol/View.js';
import _ol_layer_Group_ from '../src/ol/layer/Group.js';
import LayerGroup from '../src/ol/layer/Group.js';
import TileLayer from '../src/ol/layer/Tile.js';
import {fromLonLat} from '../src/ol/proj.js';
import OSM from '../src/ol/source/OSM.js';
@@ -10,7 +10,7 @@ var map = new Map({
layers: [
new TileLayer({
source: new OSM()
}), new _ol_layer_Group_({
}), new LayerGroup({
layers: [
new TileLayer({
source: new TileJSON({
@@ -49,7 +49,7 @@ function bindInputs(layerid, layer) {
}
map.getLayers().forEach(function(layer, i) {
bindInputs('#layer' + i, layer);
if (layer instanceof _ol_layer_Group_) {
if (layer instanceof LayerGroup) {
layer.getLayers().forEach(function(sublayer, j) {
bindInputs('#layer' + i + j, sublayer);
});

View File

@@ -23,7 +23,7 @@ import EventType from './events/EventType.js';
import {createEmpty, clone, createOrUpdateEmpty, equals, getForViewAndSize, isEmpty} from './extent.js';
import {TRUE} from './functions.js';
import _ol_has_ from './has.js';
import _ol_layer_Group_ from './layer/Group.js';
import LayerGroup from './layer/Group.js';
import {getMapRendererPlugins} from './plugins.js';
import RendererType from './renderer/Type.js';
import _ol_size_ from './size.js';
@@ -1404,8 +1404,8 @@ function createOptionsInternal(options) {
*/
var values = {};
var layerGroup = (options.layers instanceof _ol_layer_Group_) ?
options.layers : new _ol_layer_Group_({layers: options.layers});
var layerGroup = (options.layers instanceof LayerGroup) ?
options.layers : new LayerGroup({layers: options.layers});
values[MapProperty.LAYERGROUP] = layerGroup;
values[MapProperty.TARGET] = options.target;

View File

@@ -35,7 +35,7 @@ var Property = {
* @param {olx.layer.GroupOptions=} opt_options Layer options.
* @api
*/
var _ol_layer_Group_ = function(opt_options) {
var LayerGroup = function(opt_options) {
var options = opt_options || {};
var baseOptions = /** @type {olx.layer.GroupOptions} */
@@ -78,13 +78,13 @@ var _ol_layer_Group_ = function(opt_options) {
};
inherits(_ol_layer_Group_, BaseLayer);
inherits(LayerGroup, BaseLayer);
/**
* @private
*/
_ol_layer_Group_.prototype.handleLayerChange_ = function() {
LayerGroup.prototype.handleLayerChange_ = function() {
this.changed();
};
@@ -93,7 +93,7 @@ _ol_layer_Group_.prototype.handleLayerChange_ = function() {
* @param {ol.events.Event} event Event.
* @private
*/
_ol_layer_Group_.prototype.handleLayersChanged_ = function(event) {
LayerGroup.prototype.handleLayersChanged_ = function(event) {
this.layersListenerKeys_.forEach(_ol_events_.unlistenByKey);
this.layersListenerKeys_.length = 0;
@@ -129,7 +129,7 @@ _ol_layer_Group_.prototype.handleLayersChanged_ = function(event) {
* @param {ol.Collection.Event} collectionEvent Collection event.
* @private
*/
_ol_layer_Group_.prototype.handleLayersAdd_ = function(collectionEvent) {
LayerGroup.prototype.handleLayersAdd_ = function(collectionEvent) {
var layer = /** @type {ol.layer.Base} */ (collectionEvent.element);
var key = getUid(layer).toString();
this.listenerKeys_[key] = [
@@ -146,7 +146,7 @@ _ol_layer_Group_.prototype.handleLayersAdd_ = function(collectionEvent) {
* @param {ol.Collection.Event} collectionEvent Collection event.
* @private
*/
_ol_layer_Group_.prototype.handleLayersRemove_ = function(collectionEvent) {
LayerGroup.prototype.handleLayersRemove_ = function(collectionEvent) {
var layer = /** @type {ol.layer.Base} */ (collectionEvent.element);
var key = getUid(layer).toString();
this.listenerKeys_[key].forEach(_ol_events_.unlistenByKey);
@@ -163,7 +163,7 @@ _ol_layer_Group_.prototype.handleLayersRemove_ = function(collectionEvent) {
* @observable
* @api
*/
_ol_layer_Group_.prototype.getLayers = function() {
LayerGroup.prototype.getLayers = function() {
return (/** @type {!ol.Collection.<ol.layer.Base>} */ this.get(Property.LAYERS));
};
@@ -176,7 +176,7 @@ _ol_layer_Group_.prototype.getLayers = function() {
* @observable
* @api
*/
_ol_layer_Group_.prototype.setLayers = function(layers) {
LayerGroup.prototype.setLayers = function(layers) {
this.set(Property.LAYERS, layers);
};
@@ -184,7 +184,7 @@ _ol_layer_Group_.prototype.setLayers = function(layers) {
/**
* @inheritDoc
*/
_ol_layer_Group_.prototype.getLayersArray = function(opt_array) {
LayerGroup.prototype.getLayersArray = function(opt_array) {
var array = opt_array !== undefined ? opt_array : [];
this.getLayers().forEach(function(layer) {
layer.getLayersArray(array);
@@ -196,7 +196,7 @@ _ol_layer_Group_.prototype.getLayersArray = function(opt_array) {
/**
* @inheritDoc
*/
_ol_layer_Group_.prototype.getLayerStatesArray = function(opt_states) {
LayerGroup.prototype.getLayerStatesArray = function(opt_states) {
var states = opt_states !== undefined ? opt_states : [];
var pos = states.length;
@@ -231,8 +231,8 @@ _ol_layer_Group_.prototype.getLayerStatesArray = function(opt_states) {
/**
* @inheritDoc
*/
_ol_layer_Group_.prototype.getSourceState = function() {
LayerGroup.prototype.getSourceState = function() {
return SourceState.READY;
};
export default _ol_layer_Group_;
export default LayerGroup;

View File

@@ -2,7 +2,7 @@ import {getUid} from '../../../../src/ol/index.js';
import {stableSort} from '../../../../src/ol/array.js';
import _ol_Collection_ from '../../../../src/ol/Collection.js';
import * as _ol_extent_ from '../../../../src/ol/extent.js';
import _ol_layer_Group_ from '../../../../src/ol/layer/Group.js';
import LayerGroup from '../../../../src/ol/layer/Group.js';
import _ol_layer_Layer_ from '../../../../src/ol/layer/Layer.js';
import _ol_obj_ from '../../../../src/ol/obj.js';
import MapRenderer from '../../../../src/ol/renderer/Map.js';
@@ -16,7 +16,7 @@ describe('ol.layer.Group', function() {
var layerGroup;
beforeEach(function() {
layerGroup = new _ol_layer_Group_();
layerGroup = new LayerGroup();
});
afterEach(function() {
@@ -24,7 +24,7 @@ describe('ol.layer.Group', function() {
});
it('creates an instance', function() {
expect(layerGroup).to.be.a(_ol_layer_Group_);
expect(layerGroup).to.be.a(LayerGroup);
});
it('provides default opacity', function() {
@@ -65,7 +65,7 @@ describe('ol.layer.Group', function() {
projection: 'EPSG:4326'
})
});
group = new _ol_layer_Group_({
group = new LayerGroup({
layers: [layer]
});
listener = sinon.spy();
@@ -104,7 +104,7 @@ describe('ol.layer.Group', function() {
projection: 'EPSG:4326'
})
});
group = new _ol_layer_Group_({
group = new LayerGroup({
layers: [layer]
});
listener = sinon.spy();
@@ -142,7 +142,7 @@ describe('ol.layer.Group', function() {
projection: 'EPSG:4326'
})
});
var layerGroup = new _ol_layer_Group_({
var layerGroup = new LayerGroup({
layers: [layer],
opacity: 0.5,
visible: false,
@@ -182,7 +182,7 @@ describe('ol.layer.Group', function() {
});
var groupExtent = [-10, -5, 10, 5];
var layerGroup = new _ol_layer_Group_({
var layerGroup = new LayerGroup({
layers: [layer],
opacity: 0.5,
visible: false,
@@ -221,7 +221,7 @@ describe('ol.layer.Group', function() {
var layerGroup;
beforeEach(function() {
layerGroup = new _ol_layer_Group_();
layerGroup = new LayerGroup();
});
afterEach(function() {
@@ -285,7 +285,7 @@ describe('ol.layer.Group', function() {
it('listen / unlisten for layers added to the collection', function() {
var layers = new _ol_Collection_();
var layerGroup = new _ol_layer_Group_({
var layerGroup = new LayerGroup({
layers: layers
});
expect(Object.keys(layerGroup.listenerKeys_).length).to.eql(0);
@@ -316,7 +316,7 @@ describe('ol.layer.Group', function() {
})
});
var layers = new _ol_Collection_([layer]);
var layerGroup = new _ol_layer_Group_();
var layerGroup = new LayerGroup();
layerGroup.setLayers(layers);
expect(layerGroup.getLayers()).to.be(layers);
@@ -332,7 +332,7 @@ describe('ol.layer.Group', function() {
describe('#getLayerStatesArray', function() {
it('returns an empty array if no layer', function() {
var layerGroup = new _ol_layer_Group_();
var layerGroup = new LayerGroup();
var layerStatesArray = layerGroup.getLayerStatesArray();
expect(layerStatesArray).to.be.a(Array);
@@ -363,7 +363,7 @@ describe('ol.layer.Group', function() {
});
it('does not transform layerStates by default', function() {
var layerGroup = new _ol_layer_Group_({
var layerGroup = new LayerGroup({
layers: [layer1, layer2]
});
@@ -386,7 +386,7 @@ describe('ol.layer.Group', function() {
it('uses the layer group extent if layer has no extent', function() {
var groupExtent = [-10, -5, 10, 5];
var layerGroup = new _ol_layer_Group_({
var layerGroup = new LayerGroup({
extent: groupExtent,
layers: [layer1]
});
@@ -397,7 +397,7 @@ describe('ol.layer.Group', function() {
it('uses the intersection of group and child extent', function() {
var groupExtent = [-10, -5, 10, 5];
var layerGroup = new _ol_layer_Group_({
var layerGroup = new LayerGroup({
extent: groupExtent,
layers: [layer3]
});
@@ -408,7 +408,7 @@ describe('ol.layer.Group', function() {
});
it('transforms layerStates correctly', function() {
var layerGroup = new _ol_layer_Group_({
var layerGroup = new LayerGroup({
layers: [layer1, layer2],
opacity: 0.5,
visible: false,
@@ -446,7 +446,7 @@ describe('ol.layer.Group', function() {
});
it('let order of layers without Z-index unchanged', function() {
var layerGroup = new _ol_layer_Group_({
var layerGroup = new LayerGroup({
layers: [layer1, layer2]
});
@@ -474,7 +474,7 @@ describe('ol.layer.Group', function() {
});
layerM1.setZIndex(-1);
var layerGroup = new _ol_layer_Group_({
var layerGroup = new LayerGroup({
layers: [layer1, layer10, layer2, layerM1]
});