[Mapbender-commits] r8039 - branches/mobile/http/javascripts

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Tue Aug 2 05:02:29 EDT 2011


Author: pschmidt
Date: 2011-08-02 02:02:29 -0700 (Tue, 02 Aug 2011)
New Revision: 8039

Modified:
   branches/mobile/http/javascripts/mod_wfs_SpatialRequest.php
Log:
Fehlerbeseitigung: Abfrage, ob requestGeo!=null

Modified: branches/mobile/http/javascripts/mod_wfs_SpatialRequest.php
===================================================================
--- branches/mobile/http/javascripts/mod_wfs_SpatialRequest.php	2011-07-29 14:08:33 UTC (rev 8038)
+++ branches/mobile/http/javascripts/mod_wfs_SpatialRequest.php	2011-08-02 09:02:29 UTC (rev 8039)
@@ -253,25 +253,26 @@
 		var multiGeom;
 		// a line represents a bbox...but highlight must be a polyon
 		// (extent or box selection)
-		if (requestGeom.geomType == geomType.line) {
-			multiGeom = new MultiGeometry(geomType.polygon);
-			newGeom = new Geometry(geomType.polygon);
-			var p1 = requestGeom.get(0);
-			var p2 = requestGeom.get(1);
-			newGeom.addPoint(p1);
-			newGeom.addPointByCoordinates(p1.x, p2.y);
-			newGeom.addPoint(p2);
-			newGeom.addPointByCoordinates(p2.x, p1.y);
-			newGeom.close();
-			multiGeom.add(newGeom);
+                if (requestGeom != null){
+                    if (requestGeom.geomType == geomType.line) {
+                            multiGeom = new MultiGeometry(geomType.polygon);
+                            newGeom = new Geometry(geomType.polygon);
+                            var p1 = requestGeom.get(0);
+                            var p2 = requestGeom.get(1);
+                            newGeom.addPoint(p1);
+                            newGeom.addPointByCoordinates(p1.x, p2.y);
+                            newGeom.addPoint(p2);
+                            newGeom.addPointByCoordinates(p2.x, p1.y);
+                            newGeom.close();
+                            multiGeom.add(newGeom);
+                    }
+                    // standard case
+                    // (polygon and point selection)
+                    else {
+                            multiGeom = new MultiGeometry(requestGeom.geomType);
+                            multiGeom.add(requestGeom);
+                    }
 		}
-		// standard case
-		// (polygon and point selection)
-		else {
-			multiGeom = new MultiGeometry(requestGeom.geomType);
-			multiGeom.add(requestGeom);
-		}
-		
 		// add highlight of geometry
 		//requestGeometryHighlight.add(multiGeom);
 		//requestGeometryHighlight.paint();
@@ -393,7 +394,7 @@
 
 	numberOfAjaxCalls =  js_wfs_conf_id.length;
 
-	if(requestGeom.geomType==geomType.polygon){
+	if(requestGeom != null && requestGeom.geomType==geomType.polygon){
 		for(var i=0; i<js_wfs_conf_id.length; i++){
 // I guess we should use the SRS of the map client, not the WFS? 
 // The coordinates come from the current client (?)
@@ -444,7 +445,7 @@
 			mb_get_geom(filter, i, wfs_config[js_wfs_conf_id[i]]['featuretype_name'], js_wfs_conf_id[i], db_wfs_conf_id[i]);
 		}
 	}
-	else if(requestGeom.geomType==geomType.line){
+	else if(requestGeom != null && requestGeom.geomType==geomType.line){
 		var rectangle = requestGeom.getBBox();
 		for(var i=0; i<js_wfs_conf_id.length; i++){
 // I guess we should use the SRS of the map client, not the WFS? 
@@ -507,7 +508,7 @@
 			mb_get_geom(filter, i, wfs_config[js_wfs_conf_id[i]]['featuretype_name'], js_wfs_conf_id[i], db_wfs_conf_id[i]);
 		}
 	}
-	else if(requestGeom.geomType == geomType.point){
+	else if(requestGeom != null && requestGeom.geomType == geomType.point){
 		var tmp = requestGeom.get(0);
 		var mapPos = makeRealWorld2mapPos("mapframe1",tmp.x, tmp.y);
 		var buffer = mb_wfs_tolerance/2;
@@ -547,6 +548,7 @@
 			mb_get_geom(filter, i, wfs_config[js_wfs_conf_id[i]]['featuretype_name'], js_wfs_conf_id[i], db_wfs_conf_id[i]);
 		}
 	}
+        requestGeom = null;
 //	highlight = new Highlight(mb_wfs_targets, highlight_tag_id, {"position":"absolute", "top":"0px", "left":"0px", "z-index":generalHighlightZIndex}, generalHighlightLineWidth);
 	return true;
 }



More information about the Mapbender_commits mailing list