Rename ol.projection.getFromCode to ol.projection.get
This commit is contained in:
@@ -9,7 +9,7 @@ describe('ol.layer.Layer', function() {
|
||||
beforeEach(function() {
|
||||
layer = new ol.layer.Layer({
|
||||
source: new ol.source.Source({
|
||||
projection: ol.projection.getFromCode('EPSG:4326')
|
||||
projection: ol.projection.get('EPSG:4326')
|
||||
})
|
||||
});
|
||||
});
|
||||
@@ -53,7 +53,7 @@ describe('ol.layer.Layer', function() {
|
||||
it('accepts options', function() {
|
||||
var layer = new ol.layer.Layer({
|
||||
source: new ol.source.Source({
|
||||
projection: ol.projection.getFromCode('EPSG:4326')
|
||||
projection: ol.projection.get('EPSG:4326')
|
||||
}),
|
||||
brightness: 0.5,
|
||||
contrast: 10,
|
||||
@@ -82,7 +82,7 @@ describe('ol.layer.Layer', function() {
|
||||
beforeEach(function() {
|
||||
layer = new ol.layer.Layer({
|
||||
source: new ol.source.Source({
|
||||
projection: ol.projection.getFromCode('EPSG:4326')
|
||||
projection: ol.projection.get('EPSG:4326')
|
||||
})
|
||||
});
|
||||
});
|
||||
@@ -120,7 +120,7 @@ describe('ol.layer.Layer', function() {
|
||||
beforeEach(function() {
|
||||
layer = new ol.layer.Layer({
|
||||
source: new ol.source.Source({
|
||||
projection: ol.projection.getFromCode('EPSG:4326')
|
||||
projection: ol.projection.get('EPSG:4326')
|
||||
})
|
||||
});
|
||||
});
|
||||
@@ -154,7 +154,7 @@ describe('ol.layer.Layer', function() {
|
||||
beforeEach(function() {
|
||||
layer = new ol.layer.Layer({
|
||||
source: new ol.source.Source({
|
||||
projection: ol.projection.getFromCode('EPSG:4326')
|
||||
projection: ol.projection.get('EPSG:4326')
|
||||
})
|
||||
});
|
||||
});
|
||||
@@ -193,7 +193,7 @@ describe('ol.layer.Layer', function() {
|
||||
beforeEach(function() {
|
||||
layer = new ol.layer.Layer({
|
||||
source: new ol.source.Source({
|
||||
projection: ol.projection.getFromCode('EPSG:4326')
|
||||
projection: ol.projection.get('EPSG:4326')
|
||||
})
|
||||
});
|
||||
});
|
||||
@@ -227,7 +227,7 @@ describe('ol.layer.Layer', function() {
|
||||
beforeEach(function() {
|
||||
layer = new ol.layer.Layer({
|
||||
source: new ol.source.Source({
|
||||
projection: ol.projection.getFromCode('EPSG:4326')
|
||||
projection: ol.projection.get('EPSG:4326')
|
||||
})
|
||||
});
|
||||
});
|
||||
@@ -259,7 +259,7 @@ describe('ol.layer.Layer', function() {
|
||||
it('sets visible property', function() {
|
||||
var layer = new ol.layer.Layer({
|
||||
source: new ol.source.Source({
|
||||
projection: ol.projection.getFromCode('EPSG:4326')
|
||||
projection: ol.projection.get('EPSG:4326')
|
||||
})
|
||||
});
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ describe('ol.projection.EPSG3857', function() {
|
||||
|
||||
it('returns the correct point scale at the equator', function() {
|
||||
// @see http://msdn.microsoft.com/en-us/library/aa940990.aspx
|
||||
var epsg3857 = ol.projection.getFromCode('EPSG:3857');
|
||||
var epsg3857 = ol.projection.get('EPSG:3857');
|
||||
var resolution = 19.11;
|
||||
var point = new ol.Coordinate(0, 0);
|
||||
expect(epsg3857.getPointResolution(resolution, point)).
|
||||
@@ -17,8 +17,8 @@ describe('ol.projection.EPSG3857', function() {
|
||||
it('returns the correct point scale at the latitude of Toronto',
|
||||
function() {
|
||||
// @see http://msdn.microsoft.com/en-us/library/aa940990.aspx
|
||||
var epsg3857 = ol.projection.getFromCode('EPSG:3857');
|
||||
var epsg4326 = ol.projection.getFromCode('EPSG:4326');
|
||||
var epsg3857 = ol.projection.get('EPSG:3857');
|
||||
var epsg4326 = ol.projection.get('EPSG:4326');
|
||||
var resolution = 19.11;
|
||||
var point = ol.projection.transform(
|
||||
new ol.Coordinate(0, 43.65), epsg4326, epsg3857);
|
||||
@@ -28,8 +28,8 @@ describe('ol.projection.EPSG3857', function() {
|
||||
|
||||
it('returns the correct point scale at various latitudes', function() {
|
||||
// @see http://msdn.microsoft.com/en-us/library/aa940990.aspx
|
||||
var epsg3857 = ol.projection.getFromCode('EPSG:3857');
|
||||
var epsg4326 = ol.projection.getFromCode('EPSG:4326');
|
||||
var epsg3857 = ol.projection.get('EPSG:3857');
|
||||
var epsg4326 = ol.projection.get('EPSG:4326');
|
||||
var resolution = 19.11;
|
||||
var latitude;
|
||||
for (latitude = 0; latitude < 90; ++latitude) {
|
||||
|
||||
@@ -26,7 +26,7 @@ describe('ol.projection', function() {
|
||||
describe('projection equivalence', function() {
|
||||
|
||||
function _testAllEquivalent(codes) {
|
||||
var projections = goog.array.map(codes, ol.projection.getFromCode);
|
||||
var projections = goog.array.map(codes, ol.projection.get);
|
||||
goog.array.forEach(projections, function(source) {
|
||||
goog.array.forEach(projections, function(destination) {
|
||||
expect(ol.projection.equivalent(source, destination)).toBeTruthy();
|
||||
@@ -56,7 +56,7 @@ describe('ol.projection', function() {
|
||||
describe('identify transform', function() {
|
||||
|
||||
it('returns a new object, with same coord values', function() {
|
||||
var epsg4326 = ol.projection.getFromCode('EPSG:4326');
|
||||
var epsg4326 = ol.projection.get('EPSG:4326');
|
||||
var uniqueObject = {};
|
||||
var sourcePoint = new ol.Coordinate(uniqueObject, uniqueObject);
|
||||
var destinationPoint = ol.projection.transform(
|
||||
@@ -151,24 +151,24 @@ describe('ol.projection', function() {
|
||||
'+towgs84=674.374,15.056,405.346,0,0,0,0 +units=m +no_defs';
|
||||
var code = 'urn:ogc:def:crs:EPSG:21781';
|
||||
var srsCode = 'EPSG:21781';
|
||||
var proj = ol.projection.getFromCode(code);
|
||||
var proj = ol.projection.get(code);
|
||||
expect(ol.projection.proj4jsProjections_.hasOwnProperty(code))
|
||||
.toBeTruthy();
|
||||
expect(ol.projection.proj4jsProjections_.hasOwnProperty(srsCode))
|
||||
.toBeTruthy();
|
||||
var proj2 = ol.projection.getFromCode(srsCode);
|
||||
var proj2 = ol.projection.get(srsCode);
|
||||
expect(proj2).toBe(proj);
|
||||
});
|
||||
|
||||
it('numerically estimates point scale at the equator', function() {
|
||||
var googleProjection = ol.projection.getFromCode('GOOGLE');
|
||||
var googleProjection = ol.projection.get('GOOGLE');
|
||||
expect(googleProjection.getPointResolution(1, new ol.Coordinate(0, 0))).
|
||||
toRoughlyEqual(1, 1e-1);
|
||||
});
|
||||
|
||||
it('numerically estimates point scale at various latitudes', function() {
|
||||
var epsg3857Projection = ol.projection.getFromCode('EPSG:3857');
|
||||
var googleProjection = ol.projection.getFromCode('GOOGLE');
|
||||
var epsg3857Projection = ol.projection.get('EPSG:3857');
|
||||
var googleProjection = ol.projection.get('GOOGLE');
|
||||
var point, y;
|
||||
for (y = -20; y <= 20; ++y) {
|
||||
point = new ol.Coordinate(0, 1000000 * y);
|
||||
@@ -178,8 +178,8 @@ describe('ol.projection', function() {
|
||||
});
|
||||
|
||||
it('numerically estimates point scale at various points', function() {
|
||||
var epsg3857Projection = ol.projection.getFromCode('EPSG:3857');
|
||||
var googleProjection = ol.projection.getFromCode('GOOGLE');
|
||||
var epsg3857Projection = ol.projection.get('EPSG:3857');
|
||||
var googleProjection = ol.projection.get('GOOGLE');
|
||||
var point, x, y;
|
||||
for (x = -20; x <= 20; ++x) {
|
||||
for (y = -20; y <= 20; ++y) {
|
||||
@@ -194,8 +194,8 @@ describe('ol.projection', function() {
|
||||
|
||||
describe('ol.projection.getTransform()', function() {
|
||||
|
||||
var sm = ol.projection.getFromCode('GOOGLE');
|
||||
var gg = ol.projection.getFromCode('EPSG:4326');
|
||||
var sm = ol.projection.get('GOOGLE');
|
||||
var gg = ol.projection.get('EPSG:4326');
|
||||
|
||||
it('returns a transform function', function() {
|
||||
var transform = ol.projection.getTransform(sm, gg);
|
||||
@@ -331,7 +331,7 @@ describe('ol.projection', function() {
|
||||
describe('ol.Projection.prototype.getMetersPerUnit()', function() {
|
||||
|
||||
it('returns value in meters', function() {
|
||||
var epsg4326 = ol.projection.getFromCode('EPSG:4326');
|
||||
var epsg4326 = ol.projection.get('EPSG:4326');
|
||||
expect(epsg4326.getMetersPerUnit()).toEqual(111194.87428468118);
|
||||
});
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ describe('ol.source.TileSource', function() {
|
||||
describe('constructor', function() {
|
||||
it('returns a tile source', function() {
|
||||
var source = new ol.source.TileSource({
|
||||
projection: ol.projection.getFromCode('EPSG:4326')
|
||||
projection: ol.projection.get('EPSG:4326')
|
||||
});
|
||||
expect(source).toBeA(ol.source.Source);
|
||||
expect(source).toBeA(ol.source.TileSource);
|
||||
@@ -202,7 +202,7 @@ ol.test.source.MockTileSource = function(loaded) {
|
||||
|
||||
goog.base(this, {
|
||||
extent: extent,
|
||||
projection: ol.projection.getFromCode('EPSG:4326'),
|
||||
projection: ol.projection.get('EPSG:4326'),
|
||||
tileGrid: tileGrid
|
||||
});
|
||||
|
||||
|
||||
@@ -164,7 +164,7 @@ describe('ol.tilegrid.TileGrid', function() {
|
||||
describe('createForProjection', function() {
|
||||
|
||||
it('allows easier creation of a tile grid', function() {
|
||||
var projection = ol.projection.getFromCode('EPSG:3857');
|
||||
var projection = ol.projection.get('EPSG:3857');
|
||||
var grid = ol.tilegrid.createForProjection(projection);
|
||||
expect(grid).toBeA(ol.tilegrid.TileGrid);
|
||||
|
||||
@@ -173,7 +173,7 @@ describe('ol.tilegrid.TileGrid', function() {
|
||||
});
|
||||
|
||||
it('accepts a number of zoom levels', function() {
|
||||
var projection = ol.projection.getFromCode('EPSG:3857');
|
||||
var projection = ol.projection.get('EPSG:3857');
|
||||
var grid = ol.tilegrid.createForProjection(projection, 18);
|
||||
expect(grid).toBeA(ol.tilegrid.TileGrid);
|
||||
|
||||
@@ -182,7 +182,7 @@ describe('ol.tilegrid.TileGrid', function() {
|
||||
});
|
||||
|
||||
it('accepts a big number of zoom levels', function() {
|
||||
var projection = ol.projection.getFromCode('EPSG:3857');
|
||||
var projection = ol.projection.get('EPSG:3857');
|
||||
var grid = ol.tilegrid.createForProjection(projection, 23);
|
||||
expect(grid).toBeA(ol.tilegrid.TileGrid);
|
||||
|
||||
@@ -195,7 +195,7 @@ describe('ol.tilegrid.TileGrid', function() {
|
||||
describe('getForProjection', function() {
|
||||
|
||||
it('gets the default tile grid for a projection', function() {
|
||||
var projection = ol.projection.getFromCode('EPSG:3857');
|
||||
var projection = ol.projection.get('EPSG:3857');
|
||||
var grid = ol.tilegrid.getForProjection(projection);
|
||||
expect(grid).toBeA(ol.tilegrid.TileGrid);
|
||||
|
||||
@@ -205,7 +205,7 @@ describe('ol.tilegrid.TileGrid', function() {
|
||||
});
|
||||
|
||||
it('stores the default tile grid on a projection', function() {
|
||||
var projection = ol.projection.getFromCode('EPSG:3857');
|
||||
var projection = ol.projection.get('EPSG:3857');
|
||||
var grid = ol.tilegrid.getForProjection(projection);
|
||||
var gridAgain = ol.tilegrid.getForProjection(projection);
|
||||
|
||||
|
||||
@@ -69,7 +69,7 @@ describe('ol.TileUrlFunction', function() {
|
||||
});
|
||||
});
|
||||
it('creates expected URL', function() {
|
||||
var epsg3857 = ol.projection.getFromCode('EPSG:3857');
|
||||
var epsg3857 = ol.projection.get('EPSG:3857');
|
||||
var tileUrlFunction = ol.TileUrlFunction.createWMSParams(
|
||||
'http://wms?foo=bar', {});
|
||||
var tileCoord = new ol.TileCoord(1, 0, 0);
|
||||
@@ -81,7 +81,7 @@ describe('ol.TileUrlFunction', function() {
|
||||
expect(tileUrl).toEqual(expected);
|
||||
});
|
||||
it('creates expected URL respecting axis orientation', function() {
|
||||
var epsg4326 = ol.projection.getFromCode('EPSG:4326');
|
||||
var epsg4326 = ol.projection.get('EPSG:4326');
|
||||
var tileUrlFunction = ol.TileUrlFunction.createWMSParams(
|
||||
'http://wms?foo=bar', {});
|
||||
var tileCoord = new ol.TileCoord(1, 0, 0);
|
||||
|
||||
Reference in New Issue
Block a user