[Mapbender-commits] r5421 - branches/2.6/http/javascripts

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Mon Jan 25 04:38:51 EST 2010


Author: christoph
Date: 2010-01-25 04:38:51 -0500 (Mon, 25 Jan 2010)
New Revision: 5421

Modified:
   branches/2.6/http/javascripts/wms.js
Log:


Modified: branches/2.6/http/javascripts/wms.js
===================================================================
--- branches/2.6/http/javascripts/wms.js	2010-01-25 09:37:30 UTC (rev 5420)
+++ branches/2.6/http/javascripts/wms.js	2010-01-25 09:38:51 UTC (rev 5421)
@@ -130,6 +130,7 @@
 	this.gui_wms_epsg = gui_wms_epsg;
 	this.gui_wms_visible = gui_wms_visible;
 	this.gui_epsg = [];
+	this.gui_epsg_supported = [];
 	this.gui_minx = [];
 	this.gui_miny = [];
 	this.gui_maxx = [];
@@ -138,9 +139,59 @@
 	// opacity version 
 	this.gui_wms_mapopacity = gui_wms_opacity/100;
 	// sld version
-	this.gui_wms_sldurl = gui_wms_sldurl;      
+	this.gui_wms_sldurl = gui_wms_sldurl;    
 }
 
+wms_const.prototype.getBoundingBoxBySrs = function (srs) {
+	for (var i = 0; i < this.gui_epsg.length; i++) {
+		if (srs == this.gui_epsg[i]) {
+			var bbox_minx = parseFloat(this.gui_minx[i]);
+			var bbox_miny = parseFloat(this.gui_miny[i]);
+			var bbox_maxx = parseFloat(this.gui_maxx[i]);
+			var bbox_maxy = parseFloat(this.gui_maxy[i]);
+			if (bbox_minx !== null && !isNaN(bbox_minx) &&
+				bbox_miny !== null && !isNaN(bbox_miny) &&
+				bbox_maxx !== null && !isNaN(bbox_maxx) &&
+				bbox_maxy !== null && !isNaN(bbox_maxy)
+			) {
+				return new Extent(bbox_minx, bbox_miny, bbox_maxx, bbox_maxy);
+			}
+		}
+	}
+	return null;
+};
+
+wms_const.prototype.setBoundingBoxBySrs = function (srs, ext) {
+	for (var j = 0; j < this.objLayer.length; j++) {
+		this.objLayer[j].setBoundingBoxBySrs(srs, ext);
+	}
+
+	// update existing values...
+	for (var i = 0; i < this.gui_epsg.length; i++) {
+		if (srs == this.gui_epsg[i]) {
+			if (typeof this.gui_minx[i] !== "number"
+			|| typeof this.gui_maxx[i] !== "number"
+			|| typeof this.gui_miny[i] !== "number"
+			|| typeof this.gui_maxy[i] !== "number"
+			) {
+				this.gui_minx[i] = parseFloat(ext.minx);
+				this.gui_miny[i] = parseFloat(ext.miny);
+				this.gui_maxx[i] = parseFloat(ext.maxx);
+				this.gui_maxy[i] = parseFloat(ext.maxy);
+			}
+			return i;
+		}
+	}
+	// ... or add new values
+	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);
+	return this.gui_epsg.length - 1;
+};
+
 /**
  * rephrases the mapRequest
  *
@@ -658,7 +709,15 @@
 	}
 }
 function wms_addSRS(epsg,minx,miny,maxx,maxy){
+	for (var i = 0; i < wms[wms.length-1].gui_epsg.length; i++) {
+		var currentEpsg = wms[wms.length-1].gui_epsg[i];
+		if (epsg === currentEpsg) {
+			return;
+		}
+	}
+	
 	wms[wms.length-1].gui_epsg[wms[wms.length-1].gui_epsg.length] = epsg;
+	wms[wms.length-1].gui_epsg_supported[wms[wms.length-1].gui_epsg_supported.length] = true;
 	wms[wms.length-1].gui_minx[wms[wms.length-1].gui_minx.length] = minx;
 	wms[wms.length-1].gui_miny[wms[wms.length-1].gui_miny.length] = miny;
 	wms[wms.length-1].gui_maxx[wms[wms.length-1].gui_maxx.length] = maxx;
@@ -818,3 +877,34 @@
 wms_layer.prototype.setQueryable = function(queryable){
 	this.gui_layer_querylayer = parseInt(queryable, 10);
 };
+
+
+
+wms_layer.prototype.setBoundingBoxBySrs = function (srs, ext) {
+	// update existing values...
+	for (var i = 0; i < this.layer_epsg.length; i++) {
+		if (srs == this.layer_epsg[i].epsg) {
+			var currentSrs = this.layer_epsg[i];
+			if (typeof currentSrs.minx !== "number"
+			|| typeof currentSrs.miny !== "number"
+			|| typeof currentSrs.maxx !== "number"
+			|| typeof currentSrs.maxy !== "number"
+			) {
+				currentSrs.minx = parseFloat(ext.minx);
+				currentSrs.miny = parseFloat(ext.miny);
+				currentSrs.maxx = parseFloat(ext.maxx);
+				currentSrs.maxy = parseFloat(ext.maxy);
+			}
+			return i;
+		}
+	}
+	// ... or add new values
+	this.layer_epsg.push({
+		epsg: srs,
+		minx:parseFloat(ext.minx),
+		miny:parseFloat(ext.miny),
+		maxx:parseFloat(ext.maxx),
+		maxy:parseFloat(ext.maxy)
+	});
+	return this.layer_epsg.length - 1;
+};



More information about the Mapbender_commits mailing list