Merge pull request #3575 from nd0ut/master

Check proj equivalence by code.
This commit is contained in:
Tim Schaub
2015-04-17 13:55:29 -06:00
2 changed files with 23 additions and 0 deletions

View File

@@ -656,6 +656,8 @@ ol.proj.get = function(projectionLike) {
ol.proj.equivalent = function(projection1, projection2) {
if (projection1 === projection2) {
return true;
} else if (projection1.getCode() === projection2.getCode()) {
return true;
} else if (projection1.getUnits() != projection2.getUnits()) {
return false;
} else {

View File

@@ -30,6 +30,27 @@ describe('ol.proj', function() {
]);
});
it('gives that custom 3413 is equivalent to self', function() {
var code = 'EPSG:3413';
var source = new ol.proj.Projection({
code: code
});
var destination = new ol.proj.Projection({
code: code
});
expect(ol.proj.equivalent(source, destination)).to.be.ok();
});
it('gives that default 3857 is equivalent to self', function() {
_testAllEquivalent([
'EPSG:3857',
'EPSG:3857'
]);
});
it('gives that CRS:84, urn:ogc:def:crs:EPSG:6.6:4326, EPSG:4326 are ' +
'equivalent', function() {
_testAllEquivalent([