Rename _ol_source_ImageStatic_ to Static
This commit is contained in:
@@ -4,7 +4,7 @@ import {getCenter} from '../src/ol/extent.js';
|
|||||||
import ImageLayer from '../src/ol/layer/Image.js';
|
import ImageLayer from '../src/ol/layer/Image.js';
|
||||||
import TileLayer from '../src/ol/layer/Tile.js';
|
import TileLayer from '../src/ol/layer/Tile.js';
|
||||||
import {transform} from '../src/ol/proj.js';
|
import {transform} from '../src/ol/proj.js';
|
||||||
import _ol_source_ImageStatic_ from '../src/ol/source/ImageStatic.js';
|
import Static from '../src/ol/source/ImageStatic.js';
|
||||||
import _ol_source_OSM_ from '../src/ol/source/OSM.js';
|
import _ol_source_OSM_ from '../src/ol/source/OSM.js';
|
||||||
import {register} from '../src/ol/proj/proj4.js';
|
import {register} from '../src/ol/proj/proj4.js';
|
||||||
import proj4 from 'proj4';
|
import proj4 from 'proj4';
|
||||||
@@ -23,7 +23,7 @@ var map = new Map({
|
|||||||
source: new _ol_source_OSM_()
|
source: new _ol_source_OSM_()
|
||||||
}),
|
}),
|
||||||
new ImageLayer({
|
new ImageLayer({
|
||||||
source: new _ol_source_ImageStatic_({
|
source: new Static({
|
||||||
url: 'https://upload.wikimedia.org/wikipedia/commons/thumb/1/18/' +
|
url: 'https://upload.wikimedia.org/wikipedia/commons/thumb/1/18/' +
|
||||||
'British_National_Grid.svg/2000px-British_National_Grid.svg.png',
|
'British_National_Grid.svg/2000px-British_National_Grid.svg.png',
|
||||||
crossOrigin: '',
|
crossOrigin: '',
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import View from '../src/ol/View.js';
|
|||||||
import * as _ol_extent_ from '../src/ol/extent.js';
|
import * as _ol_extent_ from '../src/ol/extent.js';
|
||||||
import ImageLayer from '../src/ol/layer/Image.js';
|
import ImageLayer 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 Static from '../src/ol/source/ImageStatic.js';
|
||||||
|
|
||||||
|
|
||||||
// Map views always need a projection. Here we just want to map image
|
// Map views always need a projection. Here we just want to map image
|
||||||
@@ -19,7 +19,7 @@ var projection = new _ol_proj_Projection_({
|
|||||||
var map = new Map({
|
var map = new Map({
|
||||||
layers: [
|
layers: [
|
||||||
new ImageLayer({
|
new ImageLayer({
|
||||||
source: new _ol_source_ImageStatic_({
|
source: new Static({
|
||||||
attributions: '© <a href="http://xkcd.com/license.html">xkcd</a>',
|
attributions: '© <a href="http://xkcd.com/license.html">xkcd</a>',
|
||||||
url: 'https://imgs.xkcd.com/comics/online_communities.png',
|
url: 'https://imgs.xkcd.com/comics/online_communities.png',
|
||||||
projection: projection,
|
projection: projection,
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ import ImageSource from '../source/Image.js';
|
|||||||
* @param {olx.source.ImageStaticOptions} options Options.
|
* @param {olx.source.ImageStaticOptions} options Options.
|
||||||
* @api
|
* @api
|
||||||
*/
|
*/
|
||||||
var _ol_source_ImageStatic_ = function(options) {
|
var Static = function(options) {
|
||||||
var imageExtent = options.imageExtent;
|
var imageExtent = options.imageExtent;
|
||||||
|
|
||||||
var crossOrigin = options.crossOrigin !== undefined ?
|
var crossOrigin = options.crossOrigin !== undefined ?
|
||||||
@@ -52,13 +52,13 @@ var _ol_source_ImageStatic_ = function(options) {
|
|||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
inherits(_ol_source_ImageStatic_, ImageSource);
|
inherits(Static, ImageSource);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* @inheritDoc
|
||||||
*/
|
*/
|
||||||
_ol_source_ImageStatic_.prototype.getImageInternal = function(extent, resolution, pixelRatio, projection) {
|
Static.prototype.getImageInternal = function(extent, resolution, pixelRatio, projection) {
|
||||||
if (intersects(extent, this.image_.getExtent())) {
|
if (intersects(extent, this.image_.getExtent())) {
|
||||||
return this.image_;
|
return this.image_;
|
||||||
}
|
}
|
||||||
@@ -69,7 +69,7 @@ _ol_source_ImageStatic_.prototype.getImageInternal = function(extent, resolution
|
|||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* @inheritDoc
|
||||||
*/
|
*/
|
||||||
_ol_source_ImageStatic_.prototype.handleImageChange = function(evt) {
|
Static.prototype.handleImageChange = function(evt) {
|
||||||
if (this.image_.getState() == ImageState.LOADED) {
|
if (this.image_.getState() == ImageState.LOADED) {
|
||||||
var imageExtent = this.image_.getExtent();
|
var imageExtent = this.image_.getExtent();
|
||||||
var image = this.image_.getImage();
|
var image = this.image_.getImage();
|
||||||
@@ -93,4 +93,4 @@ _ol_source_ImageStatic_.prototype.handleImageChange = function(evt) {
|
|||||||
}
|
}
|
||||||
ImageSource.prototype.handleImageChange.call(this, evt);
|
ImageSource.prototype.handleImageChange.call(this, evt);
|
||||||
};
|
};
|
||||||
export default _ol_source_ImageStatic_;
|
export default Static;
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import View from '../../../../src/ol/View.js';
|
|||||||
import ImageLayer from '../../../../src/ol/layer/Image.js';
|
import ImageLayer from '../../../../src/ol/layer/Image.js';
|
||||||
import _ol_obj_ from '../../../../src/ol/obj.js';
|
import _ol_obj_ from '../../../../src/ol/obj.js';
|
||||||
import {get as getProjection, transform, transformExtent} from '../../../../src/ol/proj.js';
|
import {get as getProjection, transform, transformExtent} from '../../../../src/ol/proj.js';
|
||||||
import _ol_source_ImageStatic_ from '../../../../src/ol/source/ImageStatic.js';
|
import Static from '../../../../src/ol/source/ImageStatic.js';
|
||||||
import _ol_tilegrid_ from '../../../../src/ol/tilegrid.js';
|
import _ol_tilegrid_ from '../../../../src/ol/tilegrid.js';
|
||||||
|
|
||||||
|
|
||||||
@@ -65,7 +65,7 @@ describe('ol.rendering.layer.Image', function() {
|
|||||||
var source;
|
var source;
|
||||||
|
|
||||||
beforeEach(function() {
|
beforeEach(function() {
|
||||||
source = new _ol_source_ImageStatic_({
|
source = new Static({
|
||||||
url: 'rendering/ol/data/tiles/osm/5/5/12.png',
|
url: 'rendering/ol/data/tiles/osm/5/5/12.png',
|
||||||
imageExtent: _ol_tilegrid_.createXYZ().getTileCoordExtent(
|
imageExtent: _ol_tilegrid_.createXYZ().getTileCoordExtent(
|
||||||
[5, 5, -12 - 1]),
|
[5, 5, -12 - 1]),
|
||||||
@@ -95,7 +95,7 @@ describe('ol.rendering.layer.Image', function() {
|
|||||||
var source;
|
var source;
|
||||||
|
|
||||||
beforeEach(function() {
|
beforeEach(function() {
|
||||||
source = new _ol_source_ImageStatic_({
|
source = new Static({
|
||||||
url: 'rendering/ol/data/tiles/osm/5/5/12.png',
|
url: 'rendering/ol/data/tiles/osm/5/5/12.png',
|
||||||
imageExtent: transformExtent(
|
imageExtent: transformExtent(
|
||||||
[-123, 37, -122, 38], 'EPSG:4326', 'EPSG:3857')
|
[-123, 37, -122, 38], 'EPSG:4326', 'EPSG:3857')
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import _ol_events_ from '../../../../src/ol/events.js';
|
|||||||
import {get as getProjection} from '../../../../src/ol/proj.js';
|
import {get as getProjection} from '../../../../src/ol/proj.js';
|
||||||
import _ol_proj_EPSG3857_ from '../../../../src/ol/proj/EPSG3857.js';
|
import _ol_proj_EPSG3857_ from '../../../../src/ol/proj/EPSG3857.js';
|
||||||
import _ol_reproj_Image_ from '../../../../src/ol/reproj/Image.js';
|
import _ol_reproj_Image_ from '../../../../src/ol/reproj/Image.js';
|
||||||
import _ol_source_ImageStatic_ from '../../../../src/ol/source/ImageStatic.js';
|
import Static from '../../../../src/ol/source/ImageStatic.js';
|
||||||
import _ol_tilegrid_ from '../../../../src/ol/tilegrid.js';
|
import _ol_tilegrid_ from '../../../../src/ol/tilegrid.js';
|
||||||
|
|
||||||
|
|
||||||
@@ -35,7 +35,7 @@ describe('ol.rendering.reproj.Image', function() {
|
|||||||
|
|
||||||
describe('image reprojections from EPSG:3857', function() {
|
describe('image reprojections from EPSG:3857', function() {
|
||||||
beforeEach(function() {
|
beforeEach(function() {
|
||||||
source = new _ol_source_ImageStatic_({
|
source = new Static({
|
||||||
url: 'rendering/ol/data/tiles/osm/5/5/12.png',
|
url: 'rendering/ol/data/tiles/osm/5/5/12.png',
|
||||||
imageExtent: _ol_tilegrid_.createXYZ().getTileCoordExtent([5, 5, -13]),
|
imageExtent: _ol_tilegrid_.createXYZ().getTileCoordExtent([5, 5, -13]),
|
||||||
projection: getProjection('EPSG:3857')
|
projection: getProjection('EPSG:3857')
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import Map from '../../../../../src/ol/Map.js';
|
|||||||
import View from '../../../../../src/ol/View.js';
|
import View from '../../../../../src/ol/View.js';
|
||||||
import ImageLayer from '../../../../../src/ol/layer/Image.js';
|
import ImageLayer 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 Static from '../../../../../src/ol/source/ImageStatic.js';
|
||||||
|
|
||||||
|
|
||||||
describe('ol.renderer.canvas.ImageLayer', function() {
|
describe('ol.renderer.canvas.ImageLayer', function() {
|
||||||
@@ -20,7 +20,7 @@ describe('ol.renderer.canvas.ImageLayer', function() {
|
|||||||
target.style.width = '100px';
|
target.style.width = '100px';
|
||||||
target.style.height = '100px';
|
target.style.height = '100px';
|
||||||
document.body.appendChild(target);
|
document.body.appendChild(target);
|
||||||
source = new _ol_source_ImageStatic_({
|
source = new Static({
|
||||||
url: 'spec/ol/data/dot.png',
|
url: 'spec/ol/data/dot.png',
|
||||||
projection: projection,
|
projection: projection,
|
||||||
imageExtent: [0, 0, 20, 20]
|
imageExtent: [0, 0, 20, 20]
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import _ol_source_ImageStatic_ from '../../../../src/ol/source/ImageStatic.js';
|
import Static from '../../../../src/ol/source/ImageStatic.js';
|
||||||
import {get as getProjection} from '../../../../src/ol/proj.js';
|
import {get as getProjection} from '../../../../src/ol/proj.js';
|
||||||
|
|
||||||
|
|
||||||
@@ -17,7 +17,7 @@ describe('ol.source.ImageStatic', function() {
|
|||||||
describe('#getImage', function() {
|
describe('#getImage', function() {
|
||||||
|
|
||||||
it('scales image to fit imageExtent', function(done) {
|
it('scales image to fit imageExtent', function(done) {
|
||||||
var source = new _ol_source_ImageStatic_({
|
var source = new Static({
|
||||||
url: 'spec/ol/source/images/12-655-1583.png',
|
url: 'spec/ol/source/images/12-655-1583.png',
|
||||||
imageExtent: [
|
imageExtent: [
|
||||||
-13629027.891360067, 4539747.983913189,
|
-13629027.891360067, 4539747.983913189,
|
||||||
@@ -37,7 +37,7 @@ describe('ol.source.ImageStatic', function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('respects imageSize', function(done) {
|
it('respects imageSize', function(done) {
|
||||||
var source = new _ol_source_ImageStatic_({
|
var source = new Static({
|
||||||
url: 'spec/ol/source/images/12-655-1583.png',
|
url: 'spec/ol/source/images/12-655-1583.png',
|
||||||
imageExtent: [
|
imageExtent: [
|
||||||
-13629027.891360067, 4539747.983913189,
|
-13629027.891360067, 4539747.983913189,
|
||||||
@@ -58,7 +58,7 @@ describe('ol.source.ImageStatic', function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('triggers image load events', function(done) {
|
it('triggers image load events', function(done) {
|
||||||
var source = new _ol_source_ImageStatic_({
|
var source = new Static({
|
||||||
url: 'spec/ol/source/images/12-655-1583.png',
|
url: 'spec/ol/source/images/12-655-1583.png',
|
||||||
imageExtent: [
|
imageExtent: [
|
||||||
-13629027.891360067, 4539747.983913189,
|
-13629027.891360067, 4539747.983913189,
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import TileState from '../../../../src/ol/TileState.js';
|
|||||||
import View from '../../../../src/ol/View.js';
|
import View from '../../../../src/ol/View.js';
|
||||||
import ImageLayer from '../../../../src/ol/layer/Image.js';
|
import ImageLayer 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 Static from '../../../../src/ol/source/ImageStatic.js';
|
||||||
import RasterSource from '../../../../src/ol/source/Raster.js';
|
import RasterSource from '../../../../src/ol/source/Raster.js';
|
||||||
import Source from '../../../../src/ol/source/Source.js';
|
import Source from '../../../../src/ol/source/Source.js';
|
||||||
import TileSource from '../../../../src/ol/source/Tile.js';
|
import TileSource from '../../../../src/ol/source/Tile.js';
|
||||||
@@ -35,17 +35,17 @@ where('Uint8ClampedArray').describe('ol.source.Raster', function() {
|
|||||||
|
|
||||||
var extent = [-1, -1, 1, 1];
|
var extent = [-1, -1, 1, 1];
|
||||||
|
|
||||||
redSource = new _ol_source_ImageStatic_({
|
redSource = new Static({
|
||||||
url: red,
|
url: red,
|
||||||
imageExtent: extent
|
imageExtent: extent
|
||||||
});
|
});
|
||||||
|
|
||||||
greenSource = new _ol_source_ImageStatic_({
|
greenSource = new Static({
|
||||||
url: green,
|
url: green,
|
||||||
imageExtent: extent
|
imageExtent: extent
|
||||||
});
|
});
|
||||||
|
|
||||||
blueSource = new _ol_source_ImageStatic_({
|
blueSource = new Static({
|
||||||
url: blue,
|
url: blue,
|
||||||
imageExtent: extent
|
imageExtent: extent
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user