[Mapbender-commits] r6614 - trunk/mapbender/http/javascripts
svn_mapbender at osgeo.org
svn_mapbender at osgeo.org
Thu Jul 22 10:51:34 EDT 2010
Author: verenadiewald
Date: 2010-07-22 14:51:34 +0000 (Thu, 22 Jul 2010)
New Revision: 6614
Modified:
trunk/mapbender/http/javascripts/wms.js
Log:
new function setCrs
Modified: trunk/mapbender/http/javascripts/wms.js
===================================================================
--- trunk/mapbender/http/javascripts/wms.js 2010-07-22 14:48:58 UTC (rev 6613)
+++ trunk/mapbender/http/javascripts/wms.js 2010-07-22 14:51:34 UTC (rev 6614)
@@ -141,8 +141,34 @@
// sld version
this.gui_wms_sldurl = gui_wms_sldurl;
+ this.setCrs = function (options) {
+ var crsIndex = $.inArray(options.source.srsCode, this.gui_epsg);
+ if (crsIndex !== -1 &&
+ typeof this.gui_minx[crsIndex] === 'number' &&
+ typeof this.gui_miny[crsIndex] === 'number' &&
+ typeof this.gui_maxx[crsIndex] === 'number' &&
+ typeof this.gui_maxy[crsIndex] === 'number'
+ ) {
+ var sw = new Proj4js.Point(
+ this.gui_minx[crsIndex],
+ this.gui_miny[crsIndex]
+ );
+ var ne = new Proj4js.Point(
+ this.gui_maxx[crsIndex],
+ this.gui_maxy[crsIndex]
+ );
+ sw = Proj4js.transform(options.source, options.dest, sw);
+ ne = Proj4js.transform(options.source, options.dest, ne);
+ var extent = new Mapbender.Extent(sw.x, sw.y, ne.x, ne.y);
+ this.setBoundingBoxBySrs(options.dest.srsCode, extent);
+ }
+ else {
+ this.setBoundingBoxBySrs(options.dest.srsCode);
+ }
+ };
+
this.setBoundingBoxBySrs = function (srs, ext) {
- for (var i = 0; i < this.gui_epsg.length; i++) {
+ for (var i = 0; i < this.gui_epsg.length && ext !== undefined; i++) {
if (srs == this.gui_epsg[i]) {
this.gui_minx[i] = parseFloat(ext.minx);
this.gui_miny[i] = parseFloat(ext.miny);
@@ -153,10 +179,14 @@
}
this.gui_epsg.push(srs);
this.gui_epsg_supported.push(false);
- this.gui_minx.push(ext.minx);
- this.gui_miny.push(ext.miny);
- this.gui_maxx.push(ext.maxx);
- this.gui_maxy.push(ext.maxy);
+
+ if (ext !== undefined) {
+ this.gui_minx.push(ext.minx);
+ this.gui_miny.push(ext.miny);
+ this.gui_maxx.push(ext.maxx);
+ this.gui_maxy.push(ext.maxy);
+ }
+
return this.gui_epsg.length - 1;
};
}
More information about the Mapbender_commits
mailing list