Update to use the documented Proj4js 2.2.x API
This commit is contained in:
@@ -44,7 +44,7 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script src="jquery.min.js" type="text/javascript"></script>
|
<script src="jquery.min.js" type="text/javascript"></script>
|
||||||
<script src="http://cdnjs.cloudflare.com/ajax/libs/proj4js/2.1.4/proj4.js" type="text/javascript"></script>
|
<script src="http://cdnjs.cloudflare.com/ajax/libs/proj4js/2.2.1/proj4.js" type="text/javascript"></script>
|
||||||
<script src="http://epsg.io/21781.js" type="text/javascript"></script>
|
<script src="http://epsg.io/21781.js" type="text/javascript"></script>
|
||||||
<script src="../resources/example-behaviour.js" type="text/javascript"></script>
|
<script src="../resources/example-behaviour.js" type="text/javascript"></script>
|
||||||
<script src="loader.js?id=wms-custom-proj" type="text/javascript"></script>
|
<script src="loader.js?id=wms-custom-proj" type="text/javascript"></script>
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ var projection = ol.proj.addProjection({
|
|||||||
// projection's validity extent can be found at http://epsg.io/.
|
// projection's validity extent can be found at http://epsg.io/.
|
||||||
extent: [485869.5728, 76443.1884, 837076.5648, 299941.7864],
|
extent: [485869.5728, 76443.1884, 837076.5648, 299941.7864],
|
||||||
// Use data from proj4js to configure the projection's units.
|
// Use data from proj4js to configure the projection's units.
|
||||||
units: proj4.defs['EPSG:21781'].units
|
units: proj4.defs('EPSG:21781').units
|
||||||
});
|
});
|
||||||
// Proj4js provides transform functions between its configured projections.
|
// Proj4js provides transform functions between its configured projections.
|
||||||
// The transform is needed for the ScaleLine control. Otherwise this example
|
// The transform is needed for the ScaleLine control. Otherwise this example
|
||||||
|
|||||||
@@ -45,7 +45,7 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script src="jquery.min.js" type="text/javascript"></script>
|
<script src="jquery.min.js" type="text/javascript"></script>
|
||||||
<script src="http://cdnjs.cloudflare.com/ajax/libs/proj4js/2.1.4/proj4.js" type="text/javascript"></script>
|
<script src="http://cdnjs.cloudflare.com/ajax/libs/proj4js/2.2.1/proj4.js" type="text/javascript"></script>
|
||||||
<script src="http://epsg.io/21781.js" type="text/javascript"></script>
|
<script src="http://epsg.io/21781.js" type="text/javascript"></script>
|
||||||
<script src="../resources/example-behaviour.js" type="text/javascript"></script>
|
<script src="../resources/example-behaviour.js" type="text/javascript"></script>
|
||||||
<script src="loader.js?id=wms-image-custom-proj" type="text/javascript"></script>
|
<script src="loader.js?id=wms-image-custom-proj" type="text/javascript"></script>
|
||||||
|
|||||||
@@ -11,8 +11,9 @@ var proj4 = function() {};
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @typedef {Object.<string, Object.<{axis: string,
|
* @param {string} name
|
||||||
* units: string,
|
* @param {(string|Object)=} opt_def
|
||||||
|
* @return {undefined|Object.<string, Object.<{axis: string, units: string,
|
||||||
* to_meter: number}>>}
|
* to_meter: number}>>}
|
||||||
*/
|
*/
|
||||||
proj4.defs;
|
proj4.defs = function(name, opt_def) {};
|
||||||
|
|||||||
@@ -31,7 +31,7 @@
|
|||||||
"mocha-phantomjs": "~3.5.0",
|
"mocha-phantomjs": "~3.5.0",
|
||||||
"nomnom": "~1.6.2",
|
"nomnom": "~1.6.2",
|
||||||
"phantomjs": "~1.9.7-5",
|
"phantomjs": "~1.9.7-5",
|
||||||
"proj4": "~2.1.4",
|
"proj4": "~2.2.1",
|
||||||
"sinon": "~1.10.2",
|
"sinon": "~1.10.2",
|
||||||
"temp": "~0.7.0",
|
"temp": "~0.7.0",
|
||||||
"walk": "~2.3.3"
|
"walk": "~2.3.3"
|
||||||
|
|||||||
@@ -479,7 +479,7 @@ ol.proj.get = function(projectionLike) {
|
|||||||
projection = projections[code];
|
projection = projections[code];
|
||||||
if (ol.ENABLE_PROJ4JS && !goog.isDef(projection) &&
|
if (ol.ENABLE_PROJ4JS && !goog.isDef(projection) &&
|
||||||
goog.isFunction(proj4)) {
|
goog.isFunction(proj4)) {
|
||||||
var def = proj4.defs[code];
|
var def = proj4.defs(code);
|
||||||
if (goog.isDef(def)) {
|
if (goog.isDef(def)) {
|
||||||
var units = def.units;
|
var units = def.units;
|
||||||
if (!goog.isDef(units)) {
|
if (!goog.isDef(units)) {
|
||||||
@@ -496,7 +496,7 @@ ol.proj.get = function(projectionLike) {
|
|||||||
ol.proj.addProjection(projection);
|
ol.proj.addProjection(projection);
|
||||||
var currentCode, currentDef, currentProj;
|
var currentCode, currentDef, currentProj;
|
||||||
for (currentCode in projections) {
|
for (currentCode in projections) {
|
||||||
currentDef = proj4.defs[currentCode];
|
currentDef = proj4.defs(currentCode);
|
||||||
if (goog.isDef(currentDef)) {
|
if (goog.isDef(currentDef)) {
|
||||||
currentProj = ol.proj.get(currentCode);
|
currentProj = ol.proj.get(currentCode);
|
||||||
if (currentDef === def) {
|
if (currentDef === def) {
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ describe('ol.format.WFS', function() {
|
|||||||
|
|
||||||
var features, feature;
|
var features, feature;
|
||||||
before(function(done) {
|
before(function(done) {
|
||||||
proj4.defs['urn:x-ogc:def:crs:EPSG:4326'] = proj4.defs['EPSG:4326'];
|
proj4.defs('urn:x-ogc:def:crs:EPSG:4326', proj4.defs('EPSG:4326'));
|
||||||
afterLoadText('spec/ol/format/wfs/topp-states-wfs.xml', function(xml) {
|
afterLoadText('spec/ol/format/wfs/topp-states-wfs.xml', function(xml) {
|
||||||
try {
|
try {
|
||||||
var config = {
|
var config = {
|
||||||
|
|||||||
@@ -141,7 +141,7 @@ describe('ol.proj', function() {
|
|||||||
it('caches the new Proj4js projections given their srsCode', function() {
|
it('caches the new Proj4js projections given their srsCode', function() {
|
||||||
var code = 'urn:ogc:def:crs:EPSG:21781';
|
var code = 'urn:ogc:def:crs:EPSG:21781';
|
||||||
var srsCode = 'EPSG:21781';
|
var srsCode = 'EPSG:21781';
|
||||||
proj4.defs[code] = proj4.defs[srsCode];
|
proj4.defs(code, proj4.defs(srsCode));
|
||||||
var proj = ol.proj.get(code);
|
var proj = ol.proj.get(code);
|
||||||
var proj2 = ol.proj.get(srsCode);
|
var proj2 = ol.proj.get(srsCode);
|
||||||
expect(ol.proj.equivalent(proj2, proj)).to.be(true);
|
expect(ol.proj.equivalent(proj2, proj)).to.be(true);
|
||||||
|
|||||||
Reference in New Issue
Block a user