Rename projection functions for a friendlier API
The following functions are renamed: getTransform -> getTransformForProjections getTransformFromCodes -> getTransform transform -> transformWithProjections transformWithCodes -> transform With this change, the faster functions that avoid projection look-up have longer names and are used internally, whereas the slower but friendlier short name functions are available for users.
This commit is contained in:
@@ -70,7 +70,7 @@ describe('ol.projection', function() {
|
||||
describe('transform 0,0 from 4326 to 3857', function() {
|
||||
|
||||
it('returns expected value', function() {
|
||||
var point = ol.projection.transformWithCodes(
|
||||
var point = ol.projection.transform(
|
||||
new ol.Coordinate(0, 0), 'EPSG:4326', 'EPSG:3857');
|
||||
expect(point).not.toBeUndefined();
|
||||
expect(point).not.toBeNull();
|
||||
@@ -81,7 +81,7 @@ describe('ol.projection', function() {
|
||||
describe('transform 0,0 from 3857 to 4326', function() {
|
||||
|
||||
it('returns expected value', function() {
|
||||
var point = ol.projection.transformWithCodes(
|
||||
var point = ol.projection.transform(
|
||||
new ol.Coordinate(0, 0), 'EPSG:3857', 'EPSG:4326');
|
||||
expect(point).not.toBeUndefined();
|
||||
expect(point).not.toBeNull();
|
||||
@@ -94,7 +94,7 @@ describe('ol.projection', function() {
|
||||
// http://alastaira.wordpress.com/2011/01/23/the-google-maps-bing-maps-spherical-mercator-projection/
|
||||
|
||||
it('returns expected value', function() {
|
||||
var point = ol.projection.transformWithCodes(
|
||||
var point = ol.projection.transform(
|
||||
new ol.Coordinate(-5.625, 52.4827802220782),
|
||||
'EPSG:4326',
|
||||
'EPSG:900913');
|
||||
@@ -109,7 +109,7 @@ describe('ol.projection', function() {
|
||||
// http://alastaira.wordpress.com/2011/01/23/the-google-maps-bing-maps-spherical-mercator-projection/
|
||||
|
||||
it('returns expected value', function() {
|
||||
var point = ol.projection.transformWithCodes(
|
||||
var point = ol.projection.transform(
|
||||
new ol.Coordinate(-626172.13571216376, 6887893.4928337997),
|
||||
'EPSG:900913',
|
||||
'EPSG:4326');
|
||||
@@ -123,7 +123,7 @@ describe('ol.projection', function() {
|
||||
describe('Proj4js integration', function() {
|
||||
|
||||
it('allows Proj4js projections to be used transparently', function() {
|
||||
var point = ol.projection.transformWithCodes(
|
||||
var point = ol.projection.transform(
|
||||
new ol.Coordinate(-626172.13571216376, 6887893.4928337997),
|
||||
'GOOGLE',
|
||||
'WGS84');
|
||||
@@ -136,7 +136,7 @@ describe('ol.projection', function() {
|
||||
'+proj=somerc +lat_0=46.95240555555556 +lon_0=7.439583333333333 ' +
|
||||
'+k_0=1 +x_0=600000 +y_0=200000 +ellps=bessel ' +
|
||||
'+towgs84=674.374,15.056,405.346,0,0,0,0 +units=m +no_defs';
|
||||
var point = ol.projection.transformWithCodes(
|
||||
var point = ol.projection.transform(
|
||||
new ol.Coordinate(7.439583333333333, 46.95240555555556),
|
||||
'EPSG:4326',
|
||||
'EPSG:21781');
|
||||
@@ -192,13 +192,13 @@ describe('ol.projection', function() {
|
||||
|
||||
});
|
||||
|
||||
describe('ol.projection.getTransform()', function() {
|
||||
describe('ol.projection.getTransformFromProjections()', function() {
|
||||
|
||||
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);
|
||||
var transform = ol.projection.getTransformFromProjections(sm, gg);
|
||||
expect(typeof transform).toBe('function');
|
||||
|
||||
var output = transform([-12000000, 5000000]);
|
||||
@@ -208,7 +208,7 @@ describe('ol.projection', function() {
|
||||
});
|
||||
|
||||
it('works for longer arrays', function() {
|
||||
var transform = ol.projection.getTransform(sm, gg);
|
||||
var transform = ol.projection.getTransformFromProjections(sm, gg);
|
||||
expect(typeof transform).toBe('function');
|
||||
|
||||
var output = transform([-12000000, 5000000, -12000000, 5000000]);
|
||||
@@ -221,17 +221,15 @@ describe('ol.projection', function() {
|
||||
|
||||
});
|
||||
|
||||
describe('ol.projection.getTransformFromCodes()', function() {
|
||||
describe('ol.projection.getTransform()', function() {
|
||||
|
||||
it('returns a function', function() {
|
||||
var transform = ol.projection.getTransformFromCodes(
|
||||
'GOOGLE', 'EPSG:4326');
|
||||
var transform = ol.projection.getTransform('GOOGLE', 'EPSG:4326');
|
||||
expect(typeof transform).toBe('function');
|
||||
});
|
||||
|
||||
it('returns a transform function', function() {
|
||||
var transform = ol.projection.getTransformFromCodes(
|
||||
'GOOGLE', 'EPSG:4326');
|
||||
var transform = ol.projection.getTransform('GOOGLE', 'EPSG:4326');
|
||||
expect(typeof transform).toBe('function');
|
||||
|
||||
var output = transform([-626172.13571216376, 6887893.4928337997]);
|
||||
@@ -242,8 +240,7 @@ describe('ol.projection', function() {
|
||||
});
|
||||
|
||||
it('works for longer arrays of coordinate values', function() {
|
||||
var transform = ol.projection.getTransformFromCodes(
|
||||
'GOOGLE', 'EPSG:4326');
|
||||
var transform = ol.projection.getTransform('GOOGLE', 'EPSG:4326');
|
||||
expect(typeof transform).toBe('function');
|
||||
|
||||
var output = transform([
|
||||
@@ -261,8 +258,7 @@ describe('ol.projection', function() {
|
||||
});
|
||||
|
||||
it('accepts an optional destination array', function() {
|
||||
var transform = ol.projection.getTransformFromCodes(
|
||||
'EPSG:3857', 'EPSG:4326');
|
||||
var transform = ol.projection.getTransform('EPSG:3857', 'EPSG:4326');
|
||||
var input = [-12000000, 5000000];
|
||||
var output = [];
|
||||
|
||||
@@ -276,8 +272,7 @@ describe('ol.projection', function() {
|
||||
});
|
||||
|
||||
it('accepts a dimension', function() {
|
||||
var transform = ol.projection.getTransformFromCodes(
|
||||
'GOOGLE', 'EPSG:4326');
|
||||
var transform = ol.projection.getTransform('GOOGLE', 'EPSG:4326');
|
||||
expect(typeof transform).toBe('function');
|
||||
|
||||
var dimension = 3;
|
||||
|
||||
Reference in New Issue
Block a user