Rename _ol_source_Source_ to Source
This commit is contained in:
@@ -9,7 +9,7 @@ import Event from '../events/Event.js';
|
|||||||
import {equals} from '../extent.js';
|
import {equals} from '../extent.js';
|
||||||
import {equivalent} from '../proj.js';
|
import {equivalent} from '../proj.js';
|
||||||
import _ol_reproj_Image_ from '../reproj/Image.js';
|
import _ol_reproj_Image_ from '../reproj/Image.js';
|
||||||
import _ol_source_Source_ from '../source/Source.js';
|
import Source from '../source/Source.js';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @classdesc
|
* @classdesc
|
||||||
@@ -24,7 +24,7 @@ import _ol_source_Source_ from '../source/Source.js';
|
|||||||
* @api
|
* @api
|
||||||
*/
|
*/
|
||||||
var _ol_source_Image_ = function(options) {
|
var _ol_source_Image_ = function(options) {
|
||||||
_ol_source_Source_.call(this, {
|
Source.call(this, {
|
||||||
attributions: options.attributions,
|
attributions: options.attributions,
|
||||||
extent: options.extent,
|
extent: options.extent,
|
||||||
projection: options.projection,
|
projection: options.projection,
|
||||||
@@ -53,7 +53,7 @@ var _ol_source_Image_ = function(options) {
|
|||||||
this.reprojectedRevision_ = 0;
|
this.reprojectedRevision_ = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
inherits(_ol_source_Image_, _ol_source_Source_);
|
inherits(_ol_source_Image_, Source);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ import SourceState from '../source/State.js';
|
|||||||
* @param {ol.SourceSourceOptions} options Source options.
|
* @param {ol.SourceSourceOptions} options Source options.
|
||||||
* @api
|
* @api
|
||||||
*/
|
*/
|
||||||
var _ol_source_Source_ = function(options) {
|
var Source = function(options) {
|
||||||
|
|
||||||
_ol_Object_.call(this);
|
_ol_Object_.call(this);
|
||||||
|
|
||||||
@@ -52,14 +52,14 @@ var _ol_source_Source_ = function(options) {
|
|||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
inherits(_ol_source_Source_, _ol_Object_);
|
inherits(Source, _ol_Object_);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Turns the attributions option into an attributions function.
|
* Turns the attributions option into an attributions function.
|
||||||
* @param {ol.AttributionLike|undefined} attributionLike The attribution option.
|
* @param {ol.AttributionLike|undefined} attributionLike The attribution option.
|
||||||
* @return {?ol.Attribution} An attribution function (or null).
|
* @return {?ol.Attribution} An attribution function (or null).
|
||||||
*/
|
*/
|
||||||
_ol_source_Source_.prototype.adaptAttributions_ = function(attributionLike) {
|
Source.prototype.adaptAttributions_ = function(attributionLike) {
|
||||||
if (!attributionLike) {
|
if (!attributionLike) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@@ -89,14 +89,14 @@ _ol_source_Source_.prototype.adaptAttributions_ = function(attributionLike) {
|
|||||||
* @return {T|undefined} Callback result.
|
* @return {T|undefined} Callback result.
|
||||||
* @template T
|
* @template T
|
||||||
*/
|
*/
|
||||||
_ol_source_Source_.prototype.forEachFeatureAtCoordinate = nullFunction;
|
Source.prototype.forEachFeatureAtCoordinate = nullFunction;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the attribution function for the source.
|
* Get the attribution function for the source.
|
||||||
* @return {?ol.Attribution} Attribution function.
|
* @return {?ol.Attribution} Attribution function.
|
||||||
*/
|
*/
|
||||||
_ol_source_Source_.prototype.getAttributions = function() {
|
Source.prototype.getAttributions = function() {
|
||||||
return this.attributions_;
|
return this.attributions_;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -106,7 +106,7 @@ _ol_source_Source_.prototype.getAttributions = function() {
|
|||||||
* @return {ol.proj.Projection} Projection.
|
* @return {ol.proj.Projection} Projection.
|
||||||
* @api
|
* @api
|
||||||
*/
|
*/
|
||||||
_ol_source_Source_.prototype.getProjection = function() {
|
Source.prototype.getProjection = function() {
|
||||||
return this.projection_;
|
return this.projection_;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -115,7 +115,7 @@ _ol_source_Source_.prototype.getProjection = function() {
|
|||||||
* @abstract
|
* @abstract
|
||||||
* @return {Array.<number>|undefined} Resolutions.
|
* @return {Array.<number>|undefined} Resolutions.
|
||||||
*/
|
*/
|
||||||
_ol_source_Source_.prototype.getResolutions = function() {};
|
Source.prototype.getResolutions = function() {};
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -123,7 +123,7 @@ _ol_source_Source_.prototype.getResolutions = function() {};
|
|||||||
* @return {ol.source.State} State.
|
* @return {ol.source.State} State.
|
||||||
* @api
|
* @api
|
||||||
*/
|
*/
|
||||||
_ol_source_Source_.prototype.getState = function() {
|
Source.prototype.getState = function() {
|
||||||
return this.state_;
|
return this.state_;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -131,7 +131,7 @@ _ol_source_Source_.prototype.getState = function() {
|
|||||||
/**
|
/**
|
||||||
* @return {boolean|undefined} Wrap X.
|
* @return {boolean|undefined} Wrap X.
|
||||||
*/
|
*/
|
||||||
_ol_source_Source_.prototype.getWrapX = function() {
|
Source.prototype.getWrapX = function() {
|
||||||
return this.wrapX_;
|
return this.wrapX_;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -140,7 +140,7 @@ _ol_source_Source_.prototype.getWrapX = function() {
|
|||||||
* Refreshes the source and finally dispatches a 'change' event.
|
* Refreshes the source and finally dispatches a 'change' event.
|
||||||
* @api
|
* @api
|
||||||
*/
|
*/
|
||||||
_ol_source_Source_.prototype.refresh = function() {
|
Source.prototype.refresh = function() {
|
||||||
this.changed();
|
this.changed();
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -152,7 +152,7 @@ _ol_source_Source_.prototype.refresh = function() {
|
|||||||
* or `undefined`.
|
* or `undefined`.
|
||||||
* @api
|
* @api
|
||||||
*/
|
*/
|
||||||
_ol_source_Source_.prototype.setAttributions = function(attributions) {
|
Source.prototype.setAttributions = function(attributions) {
|
||||||
this.attributions_ = this.adaptAttributions_(attributions);
|
this.attributions_ = this.adaptAttributions_(attributions);
|
||||||
this.changed();
|
this.changed();
|
||||||
};
|
};
|
||||||
@@ -163,8 +163,8 @@ _ol_source_Source_.prototype.setAttributions = function(attributions) {
|
|||||||
* @param {ol.source.State} state State.
|
* @param {ol.source.State} state State.
|
||||||
* @protected
|
* @protected
|
||||||
*/
|
*/
|
||||||
_ol_source_Source_.prototype.setState = function(state) {
|
Source.prototype.setState = function(state) {
|
||||||
this.state_ = state;
|
this.state_ = state;
|
||||||
this.changed();
|
this.changed();
|
||||||
};
|
};
|
||||||
export default _ol_source_Source_;
|
export default Source;
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import _ol_TileState_ from '../TileState.js';
|
|||||||
import Event from '../events/Event.js';
|
import Event from '../events/Event.js';
|
||||||
import {equivalent} from '../proj.js';
|
import {equivalent} from '../proj.js';
|
||||||
import _ol_size_ from '../size.js';
|
import _ol_size_ from '../size.js';
|
||||||
import _ol_source_Source_ from '../source/Source.js';
|
import Source from '../source/Source.js';
|
||||||
import _ol_tilecoord_ from '../tilecoord.js';
|
import _ol_tilecoord_ from '../tilecoord.js';
|
||||||
import _ol_tilegrid_ from '../tilegrid.js';
|
import _ol_tilegrid_ from '../tilegrid.js';
|
||||||
|
|
||||||
@@ -25,7 +25,7 @@ import _ol_tilegrid_ from '../tilegrid.js';
|
|||||||
*/
|
*/
|
||||||
var _ol_source_Tile_ = function(options) {
|
var _ol_source_Tile_ = function(options) {
|
||||||
|
|
||||||
_ol_source_Source_.call(this, {
|
Source.call(this, {
|
||||||
attributions: options.attributions,
|
attributions: options.attributions,
|
||||||
extent: options.extent,
|
extent: options.extent,
|
||||||
projection: options.projection,
|
projection: options.projection,
|
||||||
@@ -78,7 +78,7 @@ var _ol_source_Tile_ = function(options) {
|
|||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
inherits(_ol_source_Tile_, _ol_source_Source_);
|
inherits(_ol_source_Tile_, Source);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ import {xhr} from '../featureloader.js';
|
|||||||
import {TRUE} from '../functions.js';
|
import {TRUE} from '../functions.js';
|
||||||
import _ol_loadingstrategy_ from '../loadingstrategy.js';
|
import _ol_loadingstrategy_ from '../loadingstrategy.js';
|
||||||
import _ol_obj_ from '../obj.js';
|
import _ol_obj_ from '../obj.js';
|
||||||
import _ol_source_Source_ from '../source/Source.js';
|
import Source from '../source/Source.js';
|
||||||
import SourceState from '../source/State.js';
|
import SourceState from '../source/State.js';
|
||||||
import VectorEventType from '../source/VectorEventType.js';
|
import VectorEventType from '../source/VectorEventType.js';
|
||||||
import RBush from '../structs/RBush.js';
|
import RBush from '../structs/RBush.js';
|
||||||
@@ -37,7 +37,7 @@ var _ol_source_Vector_ = function(opt_options) {
|
|||||||
|
|
||||||
var options = opt_options || {};
|
var options = opt_options || {};
|
||||||
|
|
||||||
_ol_source_Source_.call(this, {
|
Source.call(this, {
|
||||||
attributions: options.attributions,
|
attributions: options.attributions,
|
||||||
projection: undefined,
|
projection: undefined,
|
||||||
state: SourceState.READY,
|
state: SourceState.READY,
|
||||||
@@ -149,7 +149,7 @@ var _ol_source_Vector_ = function(opt_options) {
|
|||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
inherits(_ol_source_Vector_, _ol_source_Source_);
|
inherits(_ol_source_Vector_, Source);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import _ol_layer_Group_ from '../../../../src/ol/layer/Group.js';
|
|||||||
import _ol_layer_Layer_ from '../../../../src/ol/layer/Layer.js';
|
import _ol_layer_Layer_ from '../../../../src/ol/layer/Layer.js';
|
||||||
import _ol_obj_ from '../../../../src/ol/obj.js';
|
import _ol_obj_ from '../../../../src/ol/obj.js';
|
||||||
import _ol_renderer_Map_ from '../../../../src/ol/renderer/Map.js';
|
import _ol_renderer_Map_ from '../../../../src/ol/renderer/Map.js';
|
||||||
import _ol_source_Source_ from '../../../../src/ol/source/Source.js';
|
import Source from '../../../../src/ol/source/Source.js';
|
||||||
|
|
||||||
|
|
||||||
describe('ol.layer.Group', function() {
|
describe('ol.layer.Group', function() {
|
||||||
@@ -61,7 +61,7 @@ describe('ol.layer.Group', function() {
|
|||||||
var layer, group, listener;
|
var layer, group, listener;
|
||||||
beforeEach(function() {
|
beforeEach(function() {
|
||||||
layer = new _ol_layer_Layer_({
|
layer = new _ol_layer_Layer_({
|
||||||
source: new _ol_source_Source_({
|
source: new Source({
|
||||||
projection: 'EPSG:4326'
|
projection: 'EPSG:4326'
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
@@ -100,7 +100,7 @@ describe('ol.layer.Group', function() {
|
|||||||
var layer, group, listener;
|
var layer, group, listener;
|
||||||
beforeEach(function() {
|
beforeEach(function() {
|
||||||
layer = new _ol_layer_Layer_({
|
layer = new _ol_layer_Layer_({
|
||||||
source: new _ol_source_Source_({
|
source: new Source({
|
||||||
projection: 'EPSG:4326'
|
projection: 'EPSG:4326'
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
@@ -138,7 +138,7 @@ describe('ol.layer.Group', function() {
|
|||||||
|
|
||||||
it('accepts options', function() {
|
it('accepts options', function() {
|
||||||
var layer = new _ol_layer_Layer_({
|
var layer = new _ol_layer_Layer_({
|
||||||
source: new _ol_source_Source_({
|
source: new Source({
|
||||||
projection: 'EPSG:4326'
|
projection: 'EPSG:4326'
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
@@ -176,7 +176,7 @@ describe('ol.layer.Group', function() {
|
|||||||
|
|
||||||
it('accepts an extent option', function() {
|
it('accepts an extent option', function() {
|
||||||
var layer = new _ol_layer_Layer_({
|
var layer = new _ol_layer_Layer_({
|
||||||
source: new _ol_source_Source_({
|
source: new Source({
|
||||||
projection: 'EPSG:4326'
|
projection: 'EPSG:4326'
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
@@ -311,7 +311,7 @@ describe('ol.layer.Group', function() {
|
|||||||
|
|
||||||
it('sets layers property', function() {
|
it('sets layers property', function() {
|
||||||
var layer = new _ol_layer_Layer_({
|
var layer = new _ol_layer_Layer_({
|
||||||
source: new _ol_source_Source_({
|
source: new Source({
|
||||||
projection: 'EPSG:4326'
|
projection: 'EPSG:4326'
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
@@ -342,12 +342,12 @@ describe('ol.layer.Group', function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
var layer1 = new _ol_layer_Layer_({
|
var layer1 = new _ol_layer_Layer_({
|
||||||
source: new _ol_source_Source_({
|
source: new Source({
|
||||||
projection: 'EPSG:4326'
|
projection: 'EPSG:4326'
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
var layer2 = new _ol_layer_Layer_({
|
var layer2 = new _ol_layer_Layer_({
|
||||||
source: new _ol_source_Source_({
|
source: new Source({
|
||||||
projection: 'EPSG:4326'
|
projection: 'EPSG:4326'
|
||||||
}),
|
}),
|
||||||
opacity: 0.5,
|
opacity: 0.5,
|
||||||
@@ -356,7 +356,7 @@ describe('ol.layer.Group', function() {
|
|||||||
minResolution: 0.25
|
minResolution: 0.25
|
||||||
});
|
});
|
||||||
var layer3 = new _ol_layer_Layer_({
|
var layer3 = new _ol_layer_Layer_({
|
||||||
source: new _ol_source_Source_({
|
source: new Source({
|
||||||
projection: 'EPSG:4326'
|
projection: 'EPSG:4326'
|
||||||
}),
|
}),
|
||||||
extent: [-5, -2, 5, 2]
|
extent: [-5, -2, 5, 2]
|
||||||
@@ -461,14 +461,14 @@ describe('ol.layer.Group', function() {
|
|||||||
|
|
||||||
it('orders layer with higher Z-index on top', function() {
|
it('orders layer with higher Z-index on top', function() {
|
||||||
var layer10 = new _ol_layer_Layer_({
|
var layer10 = new _ol_layer_Layer_({
|
||||||
source: new _ol_source_Source_({
|
source: new Source({
|
||||||
projection: 'EPSG:4326'
|
projection: 'EPSG:4326'
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
layer10.setZIndex(10);
|
layer10.setZIndex(10);
|
||||||
|
|
||||||
var layerM1 = new _ol_layer_Layer_({
|
var layerM1 = new _ol_layer_Layer_({
|
||||||
source: new _ol_source_Source_({
|
source: new Source({
|
||||||
projection: 'EPSG:4326'
|
projection: 'EPSG:4326'
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import _ol_Map_ from '../../../../src/ol/Map.js';
|
|||||||
import _ol_layer_Layer_ from '../../../../src/ol/layer/Layer.js';
|
import _ol_layer_Layer_ from '../../../../src/ol/layer/Layer.js';
|
||||||
import {get as getProjection} from '../../../../src/ol/proj.js';
|
import {get as getProjection} from '../../../../src/ol/proj.js';
|
||||||
import _ol_render_Event_ from '../../../../src/ol/render/Event.js';
|
import _ol_render_Event_ from '../../../../src/ol/render/Event.js';
|
||||||
import _ol_source_Source_ from '../../../../src/ol/source/Source.js';
|
import Source from '../../../../src/ol/source/Source.js';
|
||||||
|
|
||||||
|
|
||||||
describe('ol.layer.Layer', function() {
|
describe('ol.layer.Layer', function() {
|
||||||
@@ -14,7 +14,7 @@ describe('ol.layer.Layer', function() {
|
|||||||
|
|
||||||
beforeEach(function() {
|
beforeEach(function() {
|
||||||
layer = new _ol_layer_Layer_({
|
layer = new _ol_layer_Layer_({
|
||||||
source: new _ol_source_Source_({
|
source: new Source({
|
||||||
projection: getProjection('EPSG:4326')
|
projection: getProjection('EPSG:4326')
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
@@ -64,7 +64,7 @@ describe('ol.layer.Layer', function() {
|
|||||||
|
|
||||||
it('accepts options', function() {
|
it('accepts options', function() {
|
||||||
var layer = new _ol_layer_Layer_({
|
var layer = new _ol_layer_Layer_({
|
||||||
source: new _ol_source_Source_({
|
source: new Source({
|
||||||
projection: getProjection('EPSG:4326')
|
projection: getProjection('EPSG:4326')
|
||||||
}),
|
}),
|
||||||
opacity: 0.5,
|
opacity: 0.5,
|
||||||
@@ -102,7 +102,7 @@ describe('ol.layer.Layer', function() {
|
|||||||
|
|
||||||
beforeEach(function() {
|
beforeEach(function() {
|
||||||
layer = new _ol_layer_Layer_({
|
layer = new _ol_layer_Layer_({
|
||||||
source: new _ol_source_Source_({
|
source: new Source({
|
||||||
projection: getProjection('EPSG:4326')
|
projection: getProjection('EPSG:4326')
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
@@ -152,7 +152,7 @@ describe('ol.layer.Layer', function() {
|
|||||||
|
|
||||||
beforeEach(function() {
|
beforeEach(function() {
|
||||||
layer = new _ol_layer_Layer_({
|
layer = new _ol_layer_Layer_({
|
||||||
source: new _ol_source_Source_({
|
source: new Source({
|
||||||
projection: getProjection('EPSG:4326')
|
projection: getProjection('EPSG:4326')
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
@@ -216,7 +216,7 @@ describe('ol.layer.Layer', function() {
|
|||||||
describe('#getSource', function() {
|
describe('#getSource', function() {
|
||||||
|
|
||||||
it('gets the layer source', function() {
|
it('gets the layer source', function() {
|
||||||
var source = new _ol_source_Source_({projection: getProjection('EPSG:4326')});
|
var source = new Source({projection: getProjection('EPSG:4326')});
|
||||||
var layer = new _ol_layer_Layer_({source: source});
|
var layer = new _ol_layer_Layer_({source: source});
|
||||||
expect(layer.getSource()).to.be(source);
|
expect(layer.getSource()).to.be(source);
|
||||||
});
|
});
|
||||||
@@ -228,21 +228,21 @@ describe('ol.layer.Layer', function() {
|
|||||||
|
|
||||||
it('sets the layer source', function() {
|
it('sets the layer source', function() {
|
||||||
var layer = new _ol_layer_Layer_({
|
var layer = new _ol_layer_Layer_({
|
||||||
source: new _ol_source_Source_({projection: projection})
|
source: new Source({projection: projection})
|
||||||
});
|
});
|
||||||
|
|
||||||
var source = new _ol_source_Source_({projection: projection});
|
var source = new Source({projection: projection});
|
||||||
layer.set('source', source);
|
layer.set('source', source);
|
||||||
expect(layer.getSource()).to.be(source);
|
expect(layer.getSource()).to.be(source);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('calls changed', function() {
|
it('calls changed', function() {
|
||||||
var layer = new _ol_layer_Layer_({
|
var layer = new _ol_layer_Layer_({
|
||||||
source: new _ol_source_Source_({projection: projection})
|
source: new Source({projection: projection})
|
||||||
});
|
});
|
||||||
sinon.spy(layer, 'changed');
|
sinon.spy(layer, 'changed');
|
||||||
|
|
||||||
var source = new _ol_source_Source_({projection: projection});
|
var source = new Source({projection: projection});
|
||||||
layer.set('source', source);
|
layer.set('source', source);
|
||||||
expect(layer.changed.calledOnce).to.be(true);
|
expect(layer.changed.calledOnce).to.be(true);
|
||||||
});
|
});
|
||||||
@@ -250,13 +250,13 @@ describe('ol.layer.Layer', function() {
|
|||||||
it('sets up event listeners', function() {
|
it('sets up event listeners', function() {
|
||||||
sinon.spy(_ol_layer_Layer_.prototype, 'handleSourceChange_');
|
sinon.spy(_ol_layer_Layer_.prototype, 'handleSourceChange_');
|
||||||
|
|
||||||
var first = new _ol_source_Source_({projection: projection});
|
var first = new Source({projection: projection});
|
||||||
var layer = new _ol_layer_Layer_({source: first});
|
var layer = new _ol_layer_Layer_({source: first});
|
||||||
|
|
||||||
first.setState('ready');
|
first.setState('ready');
|
||||||
expect(layer.handleSourceChange_.calledOnce).to.be(true);
|
expect(layer.handleSourceChange_.calledOnce).to.be(true);
|
||||||
|
|
||||||
var second = new _ol_source_Source_({projection: projection});
|
var second = new Source({projection: projection});
|
||||||
layer.set('source', second);
|
layer.set('source', second);
|
||||||
|
|
||||||
expect(layer.handleSourceChange_.calledOnce).to.be(true);
|
expect(layer.handleSourceChange_.calledOnce).to.be(true);
|
||||||
@@ -274,21 +274,21 @@ describe('ol.layer.Layer', function() {
|
|||||||
|
|
||||||
it('sets the layer source', function() {
|
it('sets the layer source', function() {
|
||||||
var layer = new _ol_layer_Layer_({
|
var layer = new _ol_layer_Layer_({
|
||||||
source: new _ol_source_Source_({projection: projection})
|
source: new Source({projection: projection})
|
||||||
});
|
});
|
||||||
|
|
||||||
var source = new _ol_source_Source_({projection: projection});
|
var source = new Source({projection: projection});
|
||||||
layer.setSource(source);
|
layer.setSource(source);
|
||||||
expect(layer.getSource()).to.be(source);
|
expect(layer.getSource()).to.be(source);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('calls changed', function() {
|
it('calls changed', function() {
|
||||||
var layer = new _ol_layer_Layer_({
|
var layer = new _ol_layer_Layer_({
|
||||||
source: new _ol_source_Source_({projection: projection})
|
source: new Source({projection: projection})
|
||||||
});
|
});
|
||||||
sinon.spy(layer, 'changed');
|
sinon.spy(layer, 'changed');
|
||||||
|
|
||||||
var source = new _ol_source_Source_({projection: projection});
|
var source = new Source({projection: projection});
|
||||||
layer.setSource(source);
|
layer.setSource(source);
|
||||||
expect(layer.changed.calledOnce).to.be(true);
|
expect(layer.changed.calledOnce).to.be(true);
|
||||||
});
|
});
|
||||||
@@ -296,13 +296,13 @@ describe('ol.layer.Layer', function() {
|
|||||||
it('sets up event listeners', function() {
|
it('sets up event listeners', function() {
|
||||||
sinon.spy(_ol_layer_Layer_.prototype, 'handleSourceChange_');
|
sinon.spy(_ol_layer_Layer_.prototype, 'handleSourceChange_');
|
||||||
|
|
||||||
var first = new _ol_source_Source_({projection: projection});
|
var first = new Source({projection: projection});
|
||||||
var layer = new _ol_layer_Layer_({source: first});
|
var layer = new _ol_layer_Layer_({source: first});
|
||||||
|
|
||||||
first.setState('ready');
|
first.setState('ready');
|
||||||
expect(layer.handleSourceChange_.calledOnce).to.be(true);
|
expect(layer.handleSourceChange_.calledOnce).to.be(true);
|
||||||
|
|
||||||
var second = new _ol_source_Source_({projection: projection});
|
var second = new Source({projection: projection});
|
||||||
layer.setSource(second);
|
layer.setSource(second);
|
||||||
|
|
||||||
expect(layer.handleSourceChange_.calledOnce).to.be(true);
|
expect(layer.handleSourceChange_.calledOnce).to.be(true);
|
||||||
@@ -322,7 +322,7 @@ describe('ol.layer.Layer', function() {
|
|||||||
|
|
||||||
beforeEach(function() {
|
beforeEach(function() {
|
||||||
layer = new _ol_layer_Layer_({
|
layer = new _ol_layer_Layer_({
|
||||||
source: new _ol_source_Source_({
|
source: new Source({
|
||||||
projection: getProjection('EPSG:4326')
|
projection: getProjection('EPSG:4326')
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
@@ -352,7 +352,7 @@ describe('ol.layer.Layer', function() {
|
|||||||
var layer;
|
var layer;
|
||||||
beforeEach(function() {
|
beforeEach(function() {
|
||||||
layer = new _ol_layer_Layer_({
|
layer = new _ol_layer_Layer_({
|
||||||
source: new _ol_source_Source_({
|
source: new Source({
|
||||||
projection: getProjection('EPSG:4326')
|
projection: getProjection('EPSG:4326')
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import Point from '../../../../src/ol/geom/Point.js';
|
|||||||
import Polygon from '../../../../src/ol/geom/Polygon.js';
|
import Polygon from '../../../../src/ol/geom/Polygon.js';
|
||||||
import {get as getProjection} from '../../../../src/ol/proj.js';
|
import {get as getProjection} from '../../../../src/ol/proj.js';
|
||||||
import _ol_source_Cluster_ from '../../../../src/ol/source/Cluster.js';
|
import _ol_source_Cluster_ from '../../../../src/ol/source/Cluster.js';
|
||||||
import _ol_source_Source_ from '../../../../src/ol/source/Source.js';
|
import Source from '../../../../src/ol/source/Source.js';
|
||||||
import _ol_source_Vector_ from '../../../../src/ol/source/Vector.js';
|
import _ol_source_Vector_ from '../../../../src/ol/source/Vector.js';
|
||||||
|
|
||||||
describe('ol.source.Cluster', function() {
|
describe('ol.source.Cluster', function() {
|
||||||
@@ -15,7 +15,7 @@ describe('ol.source.Cluster', function() {
|
|||||||
projection: getProjection('EPSG:4326'),
|
projection: getProjection('EPSG:4326'),
|
||||||
source: new _ol_source_Vector_()
|
source: new _ol_source_Vector_()
|
||||||
});
|
});
|
||||||
expect(source).to.be.a(_ol_source_Source_);
|
expect(source).to.be.a(Source);
|
||||||
expect(source).to.be.a(_ol_source_Cluster_);
|
expect(source).to.be.a(_ol_source_Cluster_);
|
||||||
expect(source.getDistance()).to.be(20);
|
expect(source.getDistance()).to.be(20);
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import _ol_layer_Image_ from '../../../../src/ol/layer/Image.js';
|
|||||||
import _ol_proj_Projection_ from '../../../../src/ol/proj/Projection.js';
|
import _ol_proj_Projection_ from '../../../../src/ol/proj/Projection.js';
|
||||||
import _ol_source_ImageStatic_ from '../../../../src/ol/source/ImageStatic.js';
|
import _ol_source_ImageStatic_ from '../../../../src/ol/source/ImageStatic.js';
|
||||||
import _ol_source_Raster_ from '../../../../src/ol/source/Raster.js';
|
import _ol_source_Raster_ from '../../../../src/ol/source/Raster.js';
|
||||||
import _ol_source_Source_ from '../../../../src/ol/source/Source.js';
|
import Source from '../../../../src/ol/source/Source.js';
|
||||||
import _ol_source_Tile_ from '../../../../src/ol/source/Tile.js';
|
import _ol_source_Tile_ from '../../../../src/ol/source/Tile.js';
|
||||||
import _ol_source_XYZ_ from '../../../../src/ol/source/XYZ.js';
|
import _ol_source_XYZ_ from '../../../../src/ol/source/XYZ.js';
|
||||||
|
|
||||||
@@ -94,7 +94,7 @@ where('Uint8ClampedArray').describe('ol.source.Raster', function() {
|
|||||||
threads: 0,
|
threads: 0,
|
||||||
sources: [new _ol_source_Tile_({})]
|
sources: [new _ol_source_Tile_({})]
|
||||||
});
|
});
|
||||||
expect(source).to.be.a(_ol_source_Source_);
|
expect(source).to.be.a(Source);
|
||||||
expect(source).to.be.a(_ol_source_Raster_);
|
expect(source).to.be.a(_ol_source_Raster_);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -1,27 +1,27 @@
|
|||||||
import {get as getProjection} from '../../../../src/ol/proj.js';
|
import {get as getProjection} from '../../../../src/ol/proj.js';
|
||||||
import _ol_source_Source_ from '../../../../src/ol/source/Source.js';
|
import Source from '../../../../src/ol/source/Source.js';
|
||||||
|
|
||||||
|
|
||||||
describe('ol.source.Source', function() {
|
describe('ol.source.Source', function() {
|
||||||
|
|
||||||
describe('constructor', function() {
|
describe('constructor', function() {
|
||||||
it('returns a source', function() {
|
it('returns a source', function() {
|
||||||
var source = new _ol_source_Source_({
|
var source = new Source({
|
||||||
projection: getProjection('EPSG:4326')
|
projection: getProjection('EPSG:4326')
|
||||||
});
|
});
|
||||||
expect(source).to.be.a(_ol_source_Source_);
|
expect(source).to.be.a(Source);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('config option `attributions`', function() {
|
describe('config option `attributions`', function() {
|
||||||
it('accepts undefined', function() {
|
it('accepts undefined', function() {
|
||||||
var source = new _ol_source_Source_({});
|
var source = new Source({});
|
||||||
var attributions = source.getAttributions();
|
var attributions = source.getAttributions();
|
||||||
expect(attributions).to.be(null);
|
expect(attributions).to.be(null);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('accepts a single string', function() {
|
it('accepts a single string', function() {
|
||||||
var source = new _ol_source_Source_({
|
var source = new Source({
|
||||||
attributions: 'Humpty'
|
attributions: 'Humpty'
|
||||||
});
|
});
|
||||||
var attributions = source.getAttributions();
|
var attributions = source.getAttributions();
|
||||||
@@ -31,7 +31,7 @@ describe('ol.source.Source', function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('accepts an array of strings', function() {
|
it('accepts an array of strings', function() {
|
||||||
var source = new _ol_source_Source_({
|
var source = new Source({
|
||||||
attributions: ['Humpty', 'Dumpty']
|
attributions: ['Humpty', 'Dumpty']
|
||||||
});
|
});
|
||||||
var attributions = source.getAttributions();
|
var attributions = source.getAttributions();
|
||||||
@@ -41,7 +41,7 @@ describe('ol.source.Source', function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('accepts a function that returns a string', function() {
|
it('accepts a function that returns a string', function() {
|
||||||
var source = new _ol_source_Source_({
|
var source = new Source({
|
||||||
attributions: function() {
|
attributions: function() {
|
||||||
return 'Humpty';
|
return 'Humpty';
|
||||||
}
|
}
|
||||||
@@ -53,7 +53,7 @@ describe('ol.source.Source', function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('accepts a function that returns an array of strings', function() {
|
it('accepts a function that returns an array of strings', function() {
|
||||||
var source = new _ol_source_Source_({
|
var source = new Source({
|
||||||
attributions: function() {
|
attributions: function() {
|
||||||
return ['Humpty', 'Dumpty'];
|
return ['Humpty', 'Dumpty'];
|
||||||
}
|
}
|
||||||
@@ -67,7 +67,7 @@ describe('ol.source.Source', function() {
|
|||||||
|
|
||||||
describe('#refresh()', function() {
|
describe('#refresh()', function() {
|
||||||
it('dispatches the change event', function() {
|
it('dispatches the change event', function() {
|
||||||
var source = new _ol_source_Source_({
|
var source = new Source({
|
||||||
projection: getProjection('EPSG:4326')
|
projection: getProjection('EPSG:4326')
|
||||||
});
|
});
|
||||||
var changedSpy = sinon.spy();
|
var changedSpy = sinon.spy();
|
||||||
@@ -81,7 +81,7 @@ describe('ol.source.Source', function() {
|
|||||||
var source = null;
|
var source = null;
|
||||||
|
|
||||||
beforeEach(function() {
|
beforeEach(function() {
|
||||||
source = new _ol_source_Source_({
|
source = new Source({
|
||||||
attributions: 'before'
|
attributions: 'before'
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import _ol_Tile_ from '../../../../src/ol/Tile.js';
|
|||||||
import TileRange from '../../../../src/ol/TileRange.js';
|
import TileRange from '../../../../src/ol/TileRange.js';
|
||||||
import {get as getProjection} from '../../../../src/ol/proj.js';
|
import {get as getProjection} from '../../../../src/ol/proj.js';
|
||||||
import _ol_proj_Projection_ from '../../../../src/ol/proj/Projection.js';
|
import _ol_proj_Projection_ from '../../../../src/ol/proj/Projection.js';
|
||||||
import _ol_source_Source_ from '../../../../src/ol/source/Source.js';
|
import Source from '../../../../src/ol/source/Source.js';
|
||||||
import _ol_source_Tile_ from '../../../../src/ol/source/Tile.js';
|
import _ol_source_Tile_ from '../../../../src/ol/source/Tile.js';
|
||||||
import _ol_tilecoord_ from '../../../../src/ol/tilecoord.js';
|
import _ol_tilecoord_ from '../../../../src/ol/tilecoord.js';
|
||||||
import _ol_tilegrid_TileGrid_ from '../../../../src/ol/tilegrid/TileGrid.js';
|
import _ol_tilegrid_TileGrid_ from '../../../../src/ol/tilegrid/TileGrid.js';
|
||||||
@@ -59,7 +59,7 @@ describe('ol.source.Tile', function() {
|
|||||||
var source = new _ol_source_Tile_({
|
var source = new _ol_source_Tile_({
|
||||||
projection: getProjection('EPSG:4326')
|
projection: getProjection('EPSG:4326')
|
||||||
});
|
});
|
||||||
expect(source).to.be.a(_ol_source_Source_);
|
expect(source).to.be.a(Source);
|
||||||
expect(source).to.be.a(_ol_source_Tile_);
|
expect(source).to.be.a(_ol_source_Tile_);
|
||||||
});
|
});
|
||||||
it('sets a custom cache size', function() {
|
it('sets a custom cache size', function() {
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import _ol_source_Source_ from '../../../../src/ol/source/Source.js';
|
import Source from '../../../../src/ol/source/Source.js';
|
||||||
import _ol_source_TileJSON_ from '../../../../src/ol/source/TileJSON.js';
|
import _ol_source_TileJSON_ from '../../../../src/ol/source/TileJSON.js';
|
||||||
import _ol_Observable_ from '../../../../src/ol/Observable.js';
|
import _ol_Observable_ from '../../../../src/ol/Observable.js';
|
||||||
|
|
||||||
@@ -11,7 +11,7 @@ describe('ol.source.TileJSON', function() {
|
|||||||
var source = new _ol_source_TileJSON_({
|
var source = new _ol_source_TileJSON_({
|
||||||
url: 'spec/ol/data/tilejson.json'
|
url: 'spec/ol/data/tilejson.json'
|
||||||
});
|
});
|
||||||
expect(source).to.be.a(_ol_source_Source_);
|
expect(source).to.be.a(Source);
|
||||||
expect(source).to.be.a(_ol_source_TileJSON_);
|
expect(source).to.be.a(_ol_source_TileJSON_);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user