Previous typing was confusing the compiler. It could not figure out the
difference between the proj4 property and the constructor, which lead to
errors such as:
- ol.proj.setProj4(proj4)
ERR! compile /home/gberaudo/dev/ngeo/src/proj/epsg21781.js:8: ERROR - actual parameter 1 of ol.proj.setProj4 does not match formal parameter
ERR! compile found : function (new:proj4): ?
ERR! compile required: (null|proj4)
ERR! compile ol.proj.setProj4(proj4);
ERR! compile ^^^^^
- ol.proj.proj4.get().defs('EPSG:21781', epsg21781def)
ERR! compile /home/gberaudo/dev/ngeo/src/proj/epsg21781.js:26: ERROR - Property defs never defined on proj4
ERR! compile ol.proj.proj4.get().defs('EPSG:21781', epsg21781def);
ERR! compile ^^^^
27 lines
436 B
JavaScript
27 lines
436 B
JavaScript
goog.provide('ol.proj.proj4');
|
|
|
|
|
|
/**
|
|
* @private
|
|
* @type {Proj4}
|
|
*/
|
|
ol.proj.proj4.cache_ = null;
|
|
|
|
|
|
/**
|
|
* Store the proj4 function.
|
|
* @param {Proj4} proj4 The proj4 function.
|
|
*/
|
|
ol.proj.proj4.set = function(proj4) {
|
|
ol.proj.proj4.cache_ = proj4;
|
|
};
|
|
|
|
|
|
/**
|
|
* Get proj4.
|
|
* @return {Proj4} The proj4 function set above or available globally.
|
|
*/
|
|
ol.proj.proj4.get = function() {
|
|
return ol.proj.proj4.cache_ || window['proj4'];
|
|
};
|