Add common transforms by default
This commit is contained in:
@@ -30,7 +30,6 @@ goog.require('ol.has');
|
||||
goog.require('ol.interaction');
|
||||
goog.require('ol.layer.Group');
|
||||
goog.require('ol.obj');
|
||||
goog.require('ol.proj.common');
|
||||
goog.require('ol.renderer.Map');
|
||||
goog.require('ol.renderer.Type');
|
||||
goog.require('ol.renderer.canvas.Map');
|
||||
@@ -1501,5 +1500,3 @@ ol.Map.createOptionsInternal = function(options) {
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
ol.proj.common.add();
|
||||
|
||||
@@ -2,6 +2,8 @@ goog.provide('ol.proj');
|
||||
|
||||
goog.require('ol');
|
||||
goog.require('ol.extent');
|
||||
goog.require('ol.proj.EPSG3857');
|
||||
goog.require('ol.proj.EPSG4326');
|
||||
goog.require('ol.proj.Projection');
|
||||
goog.require('ol.proj.Units');
|
||||
goog.require('ol.proj.proj4');
|
||||
@@ -467,3 +469,24 @@ ol.proj.transformWithProjections = function(point, sourceProjection, destination
|
||||
sourceProjection, destinationProjection);
|
||||
return transformFn(point);
|
||||
};
|
||||
|
||||
/**
|
||||
* Add transforms to and from EPSG:4326 and EPSG:3857. This function is called
|
||||
* by when this module is executed and should only need to be called again after
|
||||
* `ol.proj.clearAllProjections()` is called (e.g. in tests).
|
||||
*/
|
||||
ol.proj.addCommon = function() {
|
||||
// Add transformations that don't alter coordinates to convert within set of
|
||||
// projections with equal meaning.
|
||||
ol.proj.addEquivalentProjections(ol.proj.EPSG3857.PROJECTIONS);
|
||||
ol.proj.addEquivalentProjections(ol.proj.EPSG4326.PROJECTIONS);
|
||||
// Add transformations to convert EPSG:4326 like coordinates to EPSG:3857 like
|
||||
// coordinates and back.
|
||||
ol.proj.addEquivalentTransforms(
|
||||
ol.proj.EPSG4326.PROJECTIONS,
|
||||
ol.proj.EPSG3857.PROJECTIONS,
|
||||
ol.proj.EPSG3857.fromEPSG4326,
|
||||
ol.proj.EPSG3857.toEPSG4326);
|
||||
};
|
||||
|
||||
ol.proj.addCommon();
|
||||
|
||||
@@ -1,24 +1,13 @@
|
||||
goog.provide('ol.proj.common');
|
||||
|
||||
goog.require('ol.proj');
|
||||
goog.require('ol.proj.EPSG3857');
|
||||
goog.require('ol.proj.EPSG4326');
|
||||
|
||||
|
||||
/**
|
||||
* FIXME empty description for jsdoc
|
||||
* Deprecated. Transforms between EPSG:4326 and EPSG:3857 are now included by
|
||||
* default. There is no need to call this function in application code and it
|
||||
* will be removed in a future major release.
|
||||
* @deprecated This function is no longer necessary.
|
||||
* @api
|
||||
*/
|
||||
ol.proj.common.add = function() {
|
||||
// Add transformations that don't alter coordinates to convert within set of
|
||||
// projections with equal meaning.
|
||||
ol.proj.addEquivalentProjections(ol.proj.EPSG3857.PROJECTIONS);
|
||||
ol.proj.addEquivalentProjections(ol.proj.EPSG4326.PROJECTIONS);
|
||||
// Add transformations to convert EPSG:4326 like coordinates to EPSG:3857 like
|
||||
// coordinates and back.
|
||||
ol.proj.addEquivalentTransforms(
|
||||
ol.proj.EPSG4326.PROJECTIONS,
|
||||
ol.proj.EPSG3857.PROJECTIONS,
|
||||
ol.proj.EPSG3857.fromEPSG4326,
|
||||
ol.proj.EPSG3857.toEPSG4326);
|
||||
};
|
||||
ol.proj.common.add = ol.proj.addCommon;
|
||||
|
||||
Reference in New Issue
Block a user