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

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Sat Jul 3 13:31:27 EDT 2010


Author: christoph
Date: 2010-07-03 17:31:27 +0000 (Sat, 03 Jul 2010)
New Revision: 6542

Modified:
   branches/2.6/http/javascripts/map_obj.js
   branches/2.6/http/javascripts/mod_dragMapSize.php
   branches/2.6/http/javascripts/mod_wfs_gazetteer_client.php
   branches/2.6/http/javascripts/ovnf.php
Log:
http://trac.osgeo.org/mapbender/ticket/657

Modified: branches/2.6/http/javascripts/map_obj.js
===================================================================
--- branches/2.6/http/javascripts/map_obj.js	2010-07-03 17:14:14 UTC (rev 6541)
+++ branches/2.6/http/javascripts/map_obj.js	2010-07-03 17:31:27 UTC (rev 6542)
@@ -328,32 +328,43 @@
 		this.querylayers[i] = querylayers;
 	}
 	
+	var domElement = this.getDomElement();
+	domElement.style.width = this.width;
+	domElement.style.height = this.height;   
+
 	var bbox_minx, bbox_miny, bbox_maxx, bbox_maxy;
 	
-	for (var i = 0; i < wms[0].gui_epsg.length; i++) {
-		if (wms[0].gui_wms_epsg == wms[0].gui_epsg[i]) {
-			bbox_minx = parseFloat(wms[0].gui_minx[i]);
-			bbox_miny = parseFloat(wms[0].gui_miny[i]);
-			bbox_maxx = parseFloat(wms[0].gui_maxx[i]);
-			bbox_maxy = parseFloat(wms[0].gui_maxy[i]);
-			break;
+	if (typeof wms !== "object" || wms.length === 0) {
+		var errorMsg = "There are no WMS in map '" + this.elementName + "'";
+		new Mb_exception(errorMsg);
+		$(domElement).css({
+			"border": "1px solid red",
+			"color": "red"
+		}).text(errorMsg);
+	}
+	else {
+		for (var i = 0; i < wms[0].gui_epsg.length; i++) {
+			if (wms[0].gui_wms_epsg == wms[0].gui_epsg[i]) {
+				bbox_minx = parseFloat(wms[0].gui_minx[i]);
+				bbox_miny = parseFloat(wms[0].gui_miny[i]);
+				bbox_maxx = parseFloat(wms[0].gui_maxx[i]);
+				bbox_maxy = parseFloat(wms[0].gui_maxy[i]);
+				break;
+			}
 		}
+	
+		this.setSrs({
+			srs: wms[0].gui_wms_epsg,
+			extent: new Extent(
+				bbox_minx, 
+				bbox_miny, 
+				bbox_maxx, 
+				bbox_maxy
+			)
+		});
 	}
 
-	this.setSrs({
-		srs: wms[0].gui_wms_epsg,
-		extent: new Extent(
-			bbox_minx, 
-			bbox_miny, 
-			bbox_maxx, 
-			bbox_maxy
-		)
-	});
-
 	this.mapURL = [];
-	var domElement = this.getDomElement();
-	domElement.style.width = this.width;
-	domElement.style.height = this.height;   
    
 	
 	/**
@@ -374,7 +385,11 @@
 	 * @type Object
 	 */
 	this.getExtentInfos = function(){
-		var c = this.getExtent().split(",");
+		var c = this.getExtent();
+		if (typeof c !== "object" || c.length !== 4) {
+			return null;
+		}
+		c = c.split(",");
 		var ext = new Extent(c[0], c[1], c[2], c[3]);
 		return ext;
 	};
@@ -532,7 +547,11 @@
 	};
 	
 	this.convertPixelToReal = function (aPoint) {
-		var arrayBBox = this.extent.split(",");
+		var arrayBBox = this.extent;
+		if (typeof arrayBBox !== "object" || arrayBBox.length !== 4) {
+			return new Point(0,0);
+		}
+		arrayBBox = arrayBBox.split(",");
 		var minX = parseFloat(arrayBBox[0]);
 		var minY = parseFloat(arrayBBox[1]);
 		var maxX = parseFloat(arrayBBox[2]);
@@ -730,7 +749,11 @@
 	 */
 	this.getScale = function(skipEpsg4326){
 		var scale;
-		var bbox = this.extent.split(",");
+		var bbox = this.extent;
+		if (typeof bbox !== "object" || bbox.length !== 4) {
+			return null;
+		}
+		bbox = bbox.split(",");
 		var xtenty;
 				
 		if (this.epsg == "EPSG:4326" && !skipEpsg4326) {
@@ -879,6 +902,10 @@
 	};
 	
 	this.setMapRequest = function(){
+		if (!wms || wms.length === 0) {
+			return;
+		}
+		
 		var ret = eventBeforeMapRequest.trigger({
 				map: this
 			}, "AND");

Modified: branches/2.6/http/javascripts/mod_dragMapSize.php
===================================================================
--- branches/2.6/http/javascripts/mod_dragMapSize.php	2010-07-03 17:14:14 UTC (rev 6541)
+++ branches/2.6/http/javascripts/mod_dragMapSize.php	2010-07-03 17:31:27 UTC (rev 6542)
@@ -108,7 +108,11 @@
 	targetObject.setWidth(targetObject.getWidth() + parseFloat(dif_x));
 	targetObject.setHeight(targetObject.getHeight() + parseFloat(dif_y));
 
-	var mybbox = targetObject.extent.split(",");
+	var mybbox = targetObject.extent;
+	if (typeof mybbox !== "object" || mybbox.length !== 4) {
+		return;
+	}
+	mybbox = mybbox.split(",");
 	targetObject.setExtent(mybbox[0], pos[1], pos[0], mybbox[3]);
 	targetObject.setMapRequest();
 	eventResizeMap.trigger();

Modified: branches/2.6/http/javascripts/mod_wfs_gazetteer_client.php
===================================================================
--- branches/2.6/http/javascripts/mod_wfs_gazetteer_client.php	2010-07-03 17:14:14 UTC (rev 6541)
+++ branches/2.6/http/javascripts/mod_wfs_gazetteer_client.php	2010-07-03 17:31:27 UTC (rev 6542)
@@ -624,7 +624,9 @@
 	//check SRS
 	var ind = parent.getMapObjIndexByName("mapframe1");
 	var submit = document.getElementById("submitButton");
-	var patternString = parent.mb_mapObj[ind].getSRS().toUpperCase();
+	var patternString = parent.mb_mapObj[ind].getSRS();
+	patternString = typeof patternString === "string" ?
+		patternString.toUpperCase() : "undefined";
 	var pattern = new RegExp(patternString);
 
 if(global_wfsConfObj[global_selectedWfsConfId].featuretype_srs.match(pattern) == -1){

Modified: branches/2.6/http/javascripts/ovnf.php
===================================================================
--- branches/2.6/http/javascripts/ovnf.php	2010-07-03 17:14:14 UTC (rev 6541)
+++ branches/2.6/http/javascripts/ovnf.php	2010-07-03 17:31:27 UTC (rev 6542)
@@ -51,7 +51,11 @@
 		// if the setBackground module is active,
 	// the overview wms might be hidden.
 	// so we activate it here.
-	mb_mapObj[ind].wms[0].gui_wms_visible = 1;
+	var ovWmsArray = mb_mapObj[ind].wms;
+	if (typeof ovWmsArray !== "object" || ovWmsArray.length === 0) {
+		return;
+	}
+	ovWmsArray[0].gui_wms_visible = 1;
 
 	
 });



More information about the Mapbender_commits mailing list