[Mapbender-commits] r4548 - trunk/mapbender/http/javascripts

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Fri Aug 28 08:39:10 EDT 2009


Author: christoph
Date: 2009-08-28 08:39:09 -0400 (Fri, 28 Aug 2009)
New Revision: 4548

Modified:
   trunk/mapbender/http/javascripts/map_obj.js
Log:
minor bug fixes and modifictaions

Modified: trunk/mapbender/http/javascripts/map_obj.js
===================================================================
--- trunk/mapbender/http/javascripts/map_obj.js	2009-08-28 12:36:44 UTC (rev 4547)
+++ trunk/mapbender/http/javascripts/map_obj.js	2009-08-28 12:39:09 UTC (rev 4548)
@@ -196,7 +196,7 @@
 		this.setExtent(ext.minx, ext.miny, ext.maxx, ext.maxy);
 		return ext;
 	};
- 
+
 	var ignoredWms = [];
 
 	var undoIgnoreWms = function () {
@@ -204,12 +204,15 @@
 	};
 	
 	var ignoreWms = function (wms) {
-		ignoredWms.push(wms.wms_id);
+		ignoredWms.push({
+			id: wms.wms_id,
+			title: wms.wms_title
+		});
 	};
 	
 	var isIgnoredWms = function (wms) {
 		for (var j = 0; j < ignoredWms.length; j++) {
-			if (ignoredWms[j] === wms.wms_id) {
+			if (ignoredWms[j].id === wms.wms_id) {
 				return true;
 			}
 		}
@@ -235,7 +238,7 @@
 		for (var i = 0; i < this.wms.length; i++) {
 			var found = false;
 			for (var j = 0; j < this.wms[i].gui_epsg.length; j++) {
-				if (options.srs === this.wms[i].gui_epsg[j]) {
+				if (options.srs === this.wms[i].gui_epsg[j] && this.wms[i].gui_epsg_supported[j]) {
 					found = true;
 					break;
 				}
@@ -248,8 +251,12 @@
 
 		// ...and optionally display a message
 		if (options.displayWarning && ignoredWms.length > 0) {
-			var msg = "The following WMS do not support the current SRS: " + 
-				ignoredWms.join(",");
+		
+			var msg = "The following WMS do not support the current SRS: <br><br>";
+
+			for (var key in ignoredWms) {
+				msg += "<b>" + ignoredWms[key].title + "</b><br>";
+			}
 			try {
 				Mapbender.modules.dialogManager.openDialog({
 					content: msg,
@@ -258,7 +265,7 @@
 				});
 			}
 			catch (e) {
-				new Mb_warning(e.message + " " + msg);
+				new Mb_warning(e.message + ". " + msg);
 			}
 		}
 
@@ -672,6 +679,9 @@
 		if(validLayers.length === 0) {
 			return false;
 		}
+		for (var i = 0; i < validLayers.length; i++) {
+			validLayers[i] = encodeURIComponent(validLayers[i]);			
+		}		
 		var layerNames = validLayers.join(",");
 		
 		url = currentWms.wms_getmap;
@@ -869,11 +879,12 @@
 			var currentWms = this.wms[ii];
 
 			try {
-				if (!this.requestMapIfSrsNotSupported && isIgnoredWms(currentWms)) {
+				if (this.skipWmsIfSrsNotSupported && isIgnoredWms(currentWms)) {
 					continue;
 				};
 			}
 			catch (e) {
+				new Mb_warning(e.message);
 			}
 
 			if (currentWms.wms_id != wms_id) {
@@ -885,8 +896,14 @@
 				var tmp = eval(Mapbender.log + "('" + 
 					newMapURL + "','" + ts + "')");
 			}
-			var myDivId = this.elementName + "_div_" + ii;          
-			writeTag(this.frameName, myDivId, newMapRequest);
+			var myDivId = this.elementName + "_div_" + ii;  
+			var $wmsDiv = $("#" + myDivId);
+			if ($wmsDiv.size() > 0) {
+				$wmsDiv.remove();
+			}
+			var $newDiv = $(newMapRequest);
+			$("#" + this.elementName + "_maps").append($newDiv);
+
 			var myMapId = this.elementName + "_map_" + ii;
 			eventAfterMapRequest.trigger({
 				map: this, 
@@ -948,6 +965,7 @@
 				};
 			}
 			catch (e) {
+				new Mb_warning(e.message);
 			}
 			if (!(currentWms.gui_wms_visible > 0)) {
 				continue;
@@ -1042,6 +1060,15 @@
 		return null;
 	};
 
+	this.getWmsById = function (wms_id) {
+		for (var i=0; i< this.wms.length; i++){
+			if(this.wms[i].wms_id == wms_id){
+				return this.wms[i];
+			}
+		}
+		return null;
+	};
+
 	this.removeWms = function (wmsIndex) {
 		var wms_ID = null;
 		var i;



More information about the Mapbender_commits mailing list