[Mapbender-commits] r4687 - trunk/mapbender/http/classes

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Fri Sep 25 06:29:18 EDT 2009


Author: christoph
Date: 2009-09-25 06:29:18 -0400 (Fri, 25 Sep 2009)
New Revision: 4687

Added:
   trunk/mapbender/http/classes/class_gml_multipoint.php
Modified:
   trunk/mapbender/http/classes/class_connector.php
   trunk/mapbender/http/classes/class_gml_3_factory.php
   trunk/mapbender/http/classes/class_gml_factory.php
   trunk/mapbender/http/classes/class_gml_feature.php
   trunk/mapbender/http/classes/class_gml_geometry.php
   trunk/mapbender/http/classes/class_gml_line.php
   trunk/mapbender/http/classes/class_gml_multiline.php
   trunk/mapbender/http/classes/class_gml_multipolygon.php
   trunk/mapbender/http/classes/class_gml_point.php
   trunk/mapbender/http/classes/class_gml_polygon.php
   trunk/mapbender/http/classes/class_map.php
   trunk/mapbender/http/classes/class_universal_gml_factory.php
   trunk/mapbender/http/classes/class_user.php
   trunk/mapbender/http/classes/class_wfs_1_1.php
   trunk/mapbender/http/classes/class_wms.php
Log:


Modified: trunk/mapbender/http/classes/class_connector.php
===================================================================
--- trunk/mapbender/http/classes/class_connector.php	2009-09-25 10:26:52 UTC (rev 4686)
+++ trunk/mapbender/http/classes/class_connector.php	2009-09-25 10:29:18 UTC (rev 4687)
@@ -18,7 +18,7 @@
 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 
 require_once(dirname(__FILE__)."/../../core/globalSettings.php");
-
+session_write_close();
 /**
  * Establishes a connection to a given URL (and loads the content).
  * Supports HTTP (GET and POST), cURL and socket connections.

Modified: trunk/mapbender/http/classes/class_gml_3_factory.php
===================================================================
--- trunk/mapbender/http/classes/class_gml_3_factory.php	2009-09-25 10:26:52 UTC (rev 4686)
+++ trunk/mapbender/http/classes/class_gml_3_factory.php	2009-09-25 10:29:18 UTC (rev 4687)
@@ -151,7 +151,7 @@
 
 		$simpleXMLNode->registerXPathNamespace('gml', 'http://www.opengis.net/gml');
 		
-		$allCoords = $simpleXMLNode->xpath("gml:curveMember/gml:LineString/gml:posList");
+		$allCoords = $simpleXMLNode->xpath("gml:lineStringMember/gml:LineString/gml:posList");
 			
 		$cnt=0;
 		foreach ($allCoords as $Coords) {
@@ -159,12 +159,65 @@
 			$gmlMultiLine->lineArray[$cnt] = array();
 			
 			$coordsDom = dom_import_simplexml($Coords);
+				
+			$dim = self::getDimensionFromNode($coordsDom);
+			$coordArray = explode(' ', trim($coordsDom->nodeValue));
+			for ($i = 0; $i < count($coordArray); $i += $dim) {
+				$x = $coordArray[$i];
+				$y = $coordArray[$i+1];
+				$gmlMultiLine->addPoint($x, $y, $cnt);
+			}			
+			$cnt++;
+		}
+		return $gmlMultiLine;
+	}	
+	
+	public static function parseMultiPoint ($domNode) {
+		$gmlMultiPoint = new GmlMultiPoint();
+		
+		$simpleXMLNode = simplexml_import_dom($domNode);
 
+		$simpleXMLNode->registerXPathNamespace('gml', 'http://www.opengis.net/gml');
+		
+		$allCoords = $simpleXMLNode->xpath("gml:pointMember/gml:Point/gml:pos");
+			
+		foreach ($allCoords as $Coords) {
+			
+			$coordsDom = dom_import_simplexml($Coords);
+				
 			$dim = self::getDimensionFromNode($coordsDom);
 			$coordArray = explode(' ', trim($coordsDom->nodeValue));
 			for ($i = 0; $i < count($coordArray); $i += $dim) {
 				$x = $coordArray[$i];
 				$y = $coordArray[$i+1];
+				$gmlMultiPoint->addPoint($x, $y);
+				break;
+			}			
+		}
+		return $gmlMultiPoint;
+	}		
+
+	public static function parseMultiCurve ($domNode) {
+		$gmlMultiLine = new GmlMultiLine();
+		
+		$simpleXMLNode = simplexml_import_dom($domNode);
+
+		$simpleXMLNode->registerXPathNamespace('gml', 'http://www.opengis.net/gml');
+		
+		$allCoords = $simpleXMLNode->xpath("gml:curveMembers/gml:LineString/gml:posList");
+			
+		$cnt=0;
+		foreach ($allCoords as $Coords) {
+			
+			$gmlMultiLine->lineArray[$cnt] = array();
+			
+			$coordsDom = dom_import_simplexml($Coords);
+
+			$dim = self::getDimensionFromNode($coordsDom);
+			$coordArray = explode(' ', trim($coordsDom->nodeValue));
+			for ($i = 0; $i < count($coordArray); $i += $dim) {
+				$x = $coordArray[$i];
+				$y = $coordArray[$i+1];
 				$gmlMultiLine->addPoint($x, $y, $cnt);
 			}
 			$cnt++;
@@ -327,13 +380,28 @@
 						}
 						$feature->geometry->srs = $srs;
 						break;
-					case "gml:MultiCurve" :
+					case "gml:MultiPoint" :
+						$feature->geometry = self::parseMultiPoint($geomNode);
+						if ($feature->geometry->isEmpty()) {
+							$feature->geometry = Gml_2_Factory::parseMultiPoint($geomNode);
+						}
+						$feature->geometry->srs = $srs;
+						break;
+					case "gml:MultiLineString" :
+						new mb_exception("found multilinestring");
 						$feature->geometry = self::parseMultiLine($geomNode);
 						if ($feature->geometry->isEmpty()) {
 							$feature->geometry = Gml_2_Factory::parseMultiLine($geomNode);
 						}
 						$feature->geometry->srs = $srs;
 						break;
+					case "gml:MultiCurve" :
+						$feature->geometry = self::parseMultiCurve($geomNode);
+						if ($feature->geometry->isEmpty()) {
+							$feature->geometry = Gml_2_Factory::parseMultiLine($geomNode);
+						}
+						$feature->geometry->srs = $srs;
+						break;
 					case "gml:MultiSurface" : 
 						$feature->geometry = self::parseMultiPolygon($geomNode);
 						if ($feature->geometry->isEmpty()) {
@@ -358,4 +426,4 @@
 	
 	
 }
-?>
\ No newline at end of file
+?>

Modified: trunk/mapbender/http/classes/class_gml_factory.php
===================================================================
--- trunk/mapbender/http/classes/class_gml_factory.php	2009-09-25 10:26:52 UTC (rev 4686)
+++ trunk/mapbender/http/classes/class_gml_factory.php	2009-09-25 10:29:18 UTC (rev 4687)
@@ -68,7 +68,12 @@
 							$currentRing = $currentGeometry->coordinates[$i];
 							
 							foreach ($currentRing as $coords) {
-								list($x, $y) = $coords;
+								if (in_array($srs, $geometry->latLonSrs)) {
+									list($y, $x) = $coords;
+								}
+								else {
+									list($x, $y) = $coords;
+								}
 	
 								// exterior ring							
 								if (0 == $i) {
@@ -83,14 +88,38 @@
 						break;
 					case "POINT":
 						$geometry = new GMLPoint();
-						list($x, $y) = $currentGeometry->coordinates;
+						if (in_array($srs, $geometry->latLonSrs)) {
+							list($y, $x) = $currentGeometry->coordinates;
+						}
+						else {
+							list($x, $y) = $currentGeometry->coordinates;
+						}
+
 						$geometry->setPoint($x, $y);
 						break;
+					case "MULTIPOINT":
+						$geometry = new GMLMultiPoint();
+						for ($i = 0; $i < count($currentGeometry->coordinates); $i++) {
+							$currentPoint = $currentGeometry->coordinates[$i];
+							if (in_array($srs, $geometry->latLonSrs)) {
+								list($y, $x) = $currentPoint;
+							}
+							else {
+								list($x, $y) = $currentPoint;
+							}
+							$geometry->addPoint($x, $y);
+						}
+						break;
 					case "LINESTRING":
 						$geometry = new GMLLine();
 						for ($i = 0; $i < count($currentGeometry->coordinates); $i++) {
 							$currentLinePoint = $currentGeometry->coordinates[$i];
-							list($x, $y) = $currentLinePoint;
+							if (in_array($srs, $geometry->latLonSrs)) {
+								list($y, $x) = $currentLinePoint;
+							}
+							else {
+								list($x, $y) = $currentLinePoint;
+							}
 							$geometry->addPoint($x, $y);
 						}
 						break;
@@ -103,7 +132,12 @@
 								$currentRing = $currentPolygon[$j];
 								
 								foreach ($currentRing as $coords) {
-									list($x, $y) = $coords;
+									if (in_array($srs, $geometry->latLonSrs)) {
+										list($y, $x) = $coords;
+									}
+									else {
+										list($x, $y) = $coords;
+									}
 		
 									// exterior ring							
 									if (0 == $j) {
@@ -117,16 +151,17 @@
 							}
 						}
 						break;
-					case "MULTIPOINT":
-						$e = new mb_exception($currentGeometry->type . " are not supported!");
-						return null;
-						break;
 					case "MULTILINESTRING": // not tested!
 						$geometry = new GMLMultiLine();
 						for ($i = 0; $i < count($currentGeometry->coordinates); $i++) {
 							$currentLine = $currentGeometry->coordinates[$i];
 							foreach ($currentLine as $currentLinePoint) {
-								list($x, $y) = $currentLinePoint;
+								if (in_array($srs, $geometry->latLonSrs)) {
+									list($y, $x) = $currentLinePoint;
+								}
+								else {
+									list($x, $y) = $currentLinePoint;
+								}
 								$geometry->addPoint($x, $y, $i);
 							}
 						}
@@ -183,6 +218,7 @@
 			$wfsFactory = new UniversalWfsFactory();
 			$myWfs = $wfsFactory->createFromDb($wfsConf->wfsId);
 			if (is_null($myWfs)) {
+				new mb_exception("class_gml_factory.php: createFromXml: WFS not found! ID: " . $wfsConf->wfsId);
 				return null;
 			}
 			$featureType = $myWfs->findFeatureTypeById($wfsConf->featureTypeId);
@@ -203,21 +239,35 @@
 			$gml->featureCollection = new FeatureCollection();
 			
 			// segments of the featureCollection
-			$gmlFeatureMembers = $gmlDoc->xpath("//" . $featureType->name);
-			
+			//
+			// for *non* Mapserver WFS
+			$gmlFeatureMembers = $gmlDoc->xpath("//gml:featureMember");
 			if (count($gmlFeatureMembers) > 0) {
 				foreach ($gmlFeatureMembers as $gmlFeatureMember) {
-					
-//					$e = new mb_exception($gmlFeatureMember->asXML());
-					$featureMember_dom = dom_import_simplexml($gmlFeatureMember);
-					
+					$gmlfeatureMember_dom = dom_import_simplexml($gmlFeatureMember);
 					$feature = new Feature();
-					$this->parseFeature($featureMember_dom, $feature, $wfsConf);
+					$this->parseFeature($gmlfeatureMember_dom->firstChild, $feature, $wfsConf);
 					if (isset($feature->geometry)) {
 						$gml->featureCollection->addFeature($feature);
 					}
 				}
 			}
+			// for Mapserver WFS
+			else {
+				// segments of the featureCollection
+				$gmlFeatureMembers = $gmlDoc->xpath("//" . $featureType->name);
+	
+				if (count($gmlFeatureMembers) > 0) {
+					foreach ($gmlFeatureMembers as $gmlFeatureMember) {
+						$gmlfeatureMember_dom = dom_import_simplexml($gmlFeatureMember);
+						$feature = new Feature();
+						$this->parseFeature($gmlfeatureMember_dom, $feature, $wfsConf);
+						if (isset($feature->geometry)) {
+							$gml->featureCollection->addFeature($feature);
+						}
+					}
+				}			
+			}
 			return $gml;
 		}
 		catch (Exception $e) {
@@ -226,4 +276,4 @@
 		}
 	}	
 }
-?>
\ No newline at end of file
+?>

Modified: trunk/mapbender/http/classes/class_gml_feature.php
===================================================================
--- trunk/mapbender/http/classes/class_gml_feature.php	2009-09-25 10:26:52 UTC (rev 4686)
+++ trunk/mapbender/http/classes/class_gml_feature.php	2009-09-25 10:29:18 UTC (rev 4687)
@@ -20,6 +20,7 @@
 require_once(dirname(__FILE__)."/../../core/globalSettings.php");
 require_once(dirname(__FILE__)."/../classes/class_json.php");
 require_once(dirname(__FILE__)."/../classes/class_gml_point.php");
+require_once(dirname(__FILE__)."/../classes/class_gml_multipoint.php");
 require_once(dirname(__FILE__)."/../classes/class_gml_line.php");
 require_once(dirname(__FILE__)."/../classes/class_gml_multiline.php");
 require_once(dirname(__FILE__)."/../classes/class_gml_polygon.php");
@@ -74,4 +75,4 @@
 	}
 }
 
-?>
\ No newline at end of file
+?>

Modified: trunk/mapbender/http/classes/class_gml_geometry.php
===================================================================
--- trunk/mapbender/http/classes/class_gml_geometry.php	2009-09-25 10:26:52 UTC (rev 4686)
+++ trunk/mapbender/http/classes/class_gml_geometry.php	2009-09-25 10:29:18 UTC (rev 4687)
@@ -31,5 +31,9 @@
 	abstract public function toGeoJSON ();
 	
 	public $srs;
+	
+	public $latLonSrs = array(
+		"urn:x-ogc:def:crs:EPSG:4326"
+	);
 }
-?>
\ No newline at end of file
+?>

Modified: trunk/mapbender/http/classes/class_gml_line.php
===================================================================
--- trunk/mapbender/http/classes/class_gml_line.php	2009-09-25 10:26:52 UTC (rev 4686)
+++ trunk/mapbender/http/classes/class_gml_line.php	2009-09-25 10:29:18 UTC (rev 4687)
@@ -77,7 +77,12 @@
 				if ($i > 0) {
 					$str .= ",";
 				}
-				$str .= "[".$this->pointArray[$i]["x"].",".$this->pointArray[$i]["y"]."]";
+				if (in_array($this->srs, $this->latLonSrs)) {
+					$str .= "[".$this->pointArray[$i]["y"].",".$this->pointArray[$i]["x"]."]";
+				}
+				else {
+					$str .= "[".$this->pointArray[$i]["x"].",".$this->pointArray[$i]["y"]."]";
+				}
 			}
 			$str .= "]}";
 		}
@@ -87,4 +92,4 @@
 		return $str;
 	}
 }
-?>
\ No newline at end of file
+?>

Modified: trunk/mapbender/http/classes/class_gml_multiline.php
===================================================================
--- trunk/mapbender/http/classes/class_gml_multiline.php	2009-09-25 10:26:52 UTC (rev 4686)
+++ trunk/mapbender/http/classes/class_gml_multiline.php	2009-09-25 10:29:18 UTC (rev 4687)
@@ -85,7 +85,12 @@
 					if ($i > 0) {
 						$str .= ",";
 					}
-					$str .= "[".$this->lineArray[$cnt][$i]["x"].",".$this->lineArray[$cnt][$i]["y"]."]";
+					if (in_array($this->srs, $this->latLonSrs)) {
+						$str .= "[".$this->lineArray[$cnt][$i]["y"].",".$this->lineArray[$cnt][$i]["x"]."]";
+					}
+					else {
+						$str .= "[".$this->lineArray[$cnt][$i]["x"].",".$this->lineArray[$cnt][$i]["y"]."]";
+					}
 				}
 				$str .="]";
 			}
@@ -98,4 +103,4 @@
 		return $str;
 	}
 }
-?>
\ No newline at end of file
+?>

Added: trunk/mapbender/http/classes/class_gml_multipoint.php
===================================================================
--- trunk/mapbender/http/classes/class_gml_multipoint.php	                        (rev 0)
+++ trunk/mapbender/http/classes/class_gml_multipoint.php	2009-09-25 10:29:18 UTC (rev 4687)
@@ -0,0 +1,93 @@
+<?php
+# $Id: class_gml2.php 3099 2008-10-02 15:29:23Z nimix $
+# http://www.mapbender.org/index.php/class_gml2.php
+# Copyright (C) 2002 CCGIS 
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+require_once(dirname(__FILE__)."/../../core/globalSettings.php");
+require_once(dirname(__FILE__)."/../classes/class_json.php");
+require_once(dirname(__FILE__)."/../classes/class_gml_geometry.php");
+
+
+class GMLMultiPoint extends GmlGeometry {
+
+	var $pointArray = array();
+
+	public function __construct() {
+		
+	}
+	
+	public function addPoint ($x, $y) {
+		array_push($this->pointArray, array("x" => $x, "y" => $y));
+	}
+	
+	public function toGml2 () {
+		$str = "<gml:MultiPoint srsName='$srsName'>";
+		foreach ($this->pointArray as $point) {
+			$str .=	"<gml:pointMember><gml:Point><gml:coordinates>";
+			$str .= $point["x"] . "," . $point["y"];
+			$str .= "</gml:coordinates></gml:Point>";
+		}
+		$str .=	"<gml:pointMember><gml:MultiPoint>";
+		return $str;		
+	}
+	
+	public function toGml3 () {
+		
+		$str = "<gml:MultiPoint srsName='$srsName'>";
+		foreach ($this->pointArray as $point) {
+			$str .=	"<gml:pointMember><gml:Point>";
+			$str .= "<gml:pos>" . $point["x"] . " " . $point["y"] . "</gml:pos>";
+			$str .= "</gml:Point><gml:pointMember>";
+		}
+		$str .=	"<gml:MultiPoint>";
+		return $str;		
+		
+	}
+
+	public function isEmpty () {
+		return !(count($this->pointArray) > 0);
+	}
+	
+	public function toGeoJSON () {
+		$numberlineArray = count($this->pointArray);
+		$str = "";
+		if ($numberlineArray > 0) {
+			$str .= "{\"type\": \"MultiPoint\", \"coordinates\":[";
+			
+			for ($cnt =0; $cnt < $numberlineArray; $cnt++){
+				if ($cnt > 0) {
+					$str .= ",";
+				}
+				if (in_array($this->srs, $this->latLonSrs)) {
+					$str .= "[" . $this->pointArray[$cnt]["y"] . "," . 
+						$this->pointArray[$cnt]["x"]."]";
+				}
+				else {
+					$str .= "[" . $this->pointArray[$cnt]["x"] . "," . 
+						$this->pointArray[$cnt]["y"]."]";
+				}
+			}
+			$str .= "]}";
+			
+		}
+		else {
+			$e = new mb_exception("GMLMultiPoint: toGeoJSON: this multiPoint is null.");
+		}
+		return $str;
+	}
+}
+?>
\ No newline at end of file

Modified: trunk/mapbender/http/classes/class_gml_multipolygon.php
===================================================================
--- trunk/mapbender/http/classes/class_gml_multipolygon.php	2009-09-25 10:26:52 UTC (rev 4686)
+++ trunk/mapbender/http/classes/class_gml_multipolygon.php	2009-09-25 10:29:18 UTC (rev 4687)
@@ -147,7 +147,12 @@
 					if ($i > 0) {
 						$str .= ",";
 					}
-					$str .= "[".$this->polygonArray[$cnt][$i]["x"].",".$this->polygonArray[$cnt][$i]["y"]."]";
+					if (in_array($this->srs, $this->latLonSrs)) {
+						$str .= "[".$this->polygonArray[$cnt][$i]["y"].",".$this->polygonArray[$cnt][$i]["x"]."]";
+					}
+					else {
+						$str .= "[".$this->polygonArray[$cnt][$i]["x"].",".$this->polygonArray[$cnt][$i]["y"]."]";
+					}
 				}
 				$str .= "]";
 				
@@ -157,7 +162,12 @@
 						if ($j > 0) {
 							$str .= ",";
 						}
-						$str .= "[".$this->innerRingArray[$cnt][$i][$j]["x"].",".$this->innerRingArray[$cnt][$i][$j]["y"]."]";
+						if (in_array($this->srs, $this->latLonSrs)) {
+							$str .= "[".$this->innerRingArray[$cnt][$i][$j]["y"].",".$this->innerRingArray[$cnt][$i][$j]["x"]."]";
+						}
+						else {
+							$str .= "[".$this->innerRingArray[$cnt][$i][$j]["x"].",".$this->innerRingArray[$cnt][$i][$j]["y"]."]";
+						}
 					}
 					$str .= "]";
 				}

Modified: trunk/mapbender/http/classes/class_gml_point.php
===================================================================
--- trunk/mapbender/http/classes/class_gml_point.php	2009-09-25 10:26:52 UTC (rev 4686)
+++ trunk/mapbender/http/classes/class_gml_point.php	2009-09-25 10:29:18 UTC (rev 4687)
@@ -56,7 +56,12 @@
 		$str = "";
 		if ($this->point) {
 			$str .= "{\"type\": \"Point\", \"coordinates\":";
-			$str .= "[".$this->point["x"].",".$this->point["y"]."]";
+			if (in_array($this->srs, $this->latLonSrs)) {
+				$str .= "[".$this->point["y"].",".$this->point["x"]."]";
+			}
+			else {
+				$str .= "[".$this->point["x"].",".$this->point["y"]."]";
+			}
 			$str .= "}";
 		}
 		else {
@@ -65,4 +70,4 @@
 		return $str;
 	}
 }
-?>
\ No newline at end of file
+?>

Modified: trunk/mapbender/http/classes/class_gml_polygon.php
===================================================================
--- trunk/mapbender/http/classes/class_gml_polygon.php	2009-09-25 10:26:52 UTC (rev 4686)
+++ trunk/mapbender/http/classes/class_gml_polygon.php	2009-09-25 10:29:18 UTC (rev 4687)
@@ -112,7 +112,12 @@
 				if ($i > 0) {
 					$str .= ",";
 				}
-				$str .= "[".$this->pointArray[$i]["x"].",".$this->pointArray[$i]["y"]."]";
+				if (in_array($this->srs, $this->latLonSrs)) {
+					$str .= "[".$this->pointArray[$i]["y"].",".$this->pointArray[$i]["x"]."]";
+				}
+				else {
+					$str .= "[".$this->pointArray[$i]["x"].",".$this->pointArray[$i]["y"]."]";
+				}
 			}
 			$str .= "]";
 			
@@ -122,7 +127,12 @@
 					if ($j > 0) {
 						$str .= ",";
 					}
-					$str .= "[".$this->innerRingArray[$i][$j]["x"].",".$this->innerRingArray[$i][$j]["y"]."]";
+					if (in_array($this->srs, $this->latLonSrs)) {
+						$str .= "[".$this->innerRingArray[$i][$j]["y"].",".$this->innerRingArray[$i][$j]["x"]."]";
+					}
+					else {
+						$str .= "[".$this->innerRingArray[$i][$j]["x"].",".$this->innerRingArray[$i][$j]["y"]."]";
+					}
 				}
 				$str .= "]";
 			}
@@ -134,4 +144,4 @@
 		return $str;
 	}
 }
-?>
\ No newline at end of file
+?>

Modified: trunk/mapbender/http/classes/class_map.php
===================================================================
--- trunk/mapbender/http/classes/class_map.php	2009-09-25 10:26:52 UTC (rev 4686)
+++ trunk/mapbender/http/classes/class_map.php	2009-09-25 10:29:18 UTC (rev 4687)
@@ -362,12 +362,16 @@
 	 * @param $jsMapObject Object
 	 */
 	public function createFromJs ($jsMapObject) {
-		$minx = $jsMapObject->extent->min->x;
-		$miny = $jsMapObject->extent->min->y;
-		$maxx = $jsMapObject->extent->max->x;
-		$maxy = $jsMapObject->extent->max->y;
+		$b = $jsMapObject->extent;
+
 		$srs = $jsMapObject->epsg;
-		$bbox = new Mapbender_bbox($minx, $miny, $maxx, $maxy, $srs);
+		$bbox = new Mapbender_bbox(
+			$b->min->x, 
+			$b->min->y, 
+			$b->max->x, 
+			$b->max->y, 
+			$srs
+		);
 
 		$this->width = $jsMapObject->width;
 		$this->height = $jsMapObject->height;

Modified: trunk/mapbender/http/classes/class_universal_gml_factory.php
===================================================================
--- trunk/mapbender/http/classes/class_universal_gml_factory.php	2009-09-25 10:26:52 UTC (rev 4686)
+++ trunk/mapbender/http/classes/class_universal_gml_factory.php	2009-09-25 10:29:18 UTC (rev 4687)
@@ -39,6 +39,9 @@
 	 */
 	private function getVersionFromXml ($xml) {
 		$simpleXml = simplexml_load_string($xml);
+		if ($simpleXml === false) {
+			return null;
+		}
 		$simpleXml->registerXPathNamespace('gml', 'http://www.opengis.net/gml');
 		
 		$nodeArray = $simpleXml->xpath("//gml:posList");
@@ -100,4 +103,4 @@
 		}
 	}
 }
-?>
\ No newline at end of file
+?>

Modified: trunk/mapbender/http/classes/class_user.php
===================================================================
--- trunk/mapbender/http/classes/class_user.php	2009-09-25 10:26:52 UTC (rev 4686)
+++ trunk/mapbender/http/classes/class_user.php	2009-09-25 10:29:18 UTC (rev 4687)
@@ -109,7 +109,7 @@
 	}
 
 	public function isPublic () {
-		if ($this->id == PUBLIC_USER) {
+		if ($this->id === PUBLIC_USER) {
 			return true;
 		}
 		return false;

Modified: trunk/mapbender/http/classes/class_wfs_1_1.php
===================================================================
--- trunk/mapbender/http/classes/class_wfs_1_1.php	2009-09-25 10:26:52 UTC (rev 4686)
+++ trunk/mapbender/http/classes/class_wfs_1_1.php	2009-09-25 10:29:18 UTC (rev 4687)
@@ -18,7 +18,7 @@
 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 
 require_once(dirname(__FILE__)."/../../core/globalSettings.php");
-require_once(dirname(__FILE__)."/class_connector.php");
+require_once(dirname(__FILE__)."/class_connector.php");
 require_once(dirname(__FILE__)."/class_administration.php");
 require_once(dirname(__FILE__)."/class_wfs.php");
 
@@ -51,11 +51,13 @@
 		//
 		$nodeArray = $simpleXml->xpath("//wfs:TransactionResults/wfs:Action/wfs:Message");
 		$messageArray = array();
-		foreach ($nodeArray as $node) {
-			$domNode = dom_import_simplexml($node);
-			
-			$result->success = false;
-			$messageArray[] = $domNode->nodeValue;
+		if ($nodeArray !== false) {
+			foreach ($nodeArray as $node) {
+				$domNode = dom_import_simplexml($node);
+				
+				$result->success = false;
+				$messageArray[] = $domNode->nodeValue;
+			}
 		}
 		if (count($messageArray) > 0) {
 			$result->message = implode(". ", $messageArray);
@@ -67,22 +69,26 @@
 		//
 		$nodeArray = $simpleXml->xpath("//wfs:TransactionSummary/*");
 		$messageArray = array();
-		foreach ($nodeArray as $node) {
-			$domNode = dom_import_simplexml($node);
-			$tagName = $this->sepNameSpace($domNode->nodeName);
-			$result->success = true;
-			$messageArray[] = $tagName . ": " . $domNode->nodeValue;
-		}		
+		if ($nodeArray !== false) {
+			foreach ($nodeArray as $node) {
+				$domNode = dom_import_simplexml($node);
+				$tagName = $this->sepNameSpace($domNode->nodeName);
+				$result->success = true;
+				$messageArray[] = $tagName . ": " . $domNode->nodeValue;
+			}		
+		}
 		if (count($messageArray) > 0) {
 			$result->message = implode(". ", $messageArray);
 
 			// get fid
 			$nodeArray = $simpleXml->xpath("//wfs:InsertResults/wfs:Feature/ogc:FeatureId");
 			$e = new mb_exception(print_r($nodeArray, true));
-			foreach ($nodeArray as $node) {
-				$domNode = dom_import_simplexml($node);
-				if ($domNode->hasAttribute("fid")) {
-					$result->fid = $domNode->getAttribute("fid");
+			if ($nodeArray !== false) {
+				foreach ($nodeArray as $node) {
+					$domNode = dom_import_simplexml($node);
+					if ($domNode->hasAttribute("fid")) {
+						$result->fid = $domNode->getAttribute("fid");
+					}
 				}
 			}
 			return $result;		
@@ -100,4 +106,4 @@
 	}
 	
 }
-?>
\ No newline at end of file
+?>

Modified: trunk/mapbender/http/classes/class_wms.php
===================================================================
--- trunk/mapbender/http/classes/class_wms.php	2009-09-25 10:26:52 UTC (rev 4686)
+++ trunk/mapbender/http/classes/class_wms.php	2009-09-25 10:29:18 UTC (rev 4687)
@@ -859,7 +859,6 @@
 			}
 			if($this->objLayer[$i]->layer_name == ""){
 				$this->objLayer[$i]->layer_name = $this->objLayer[$i]->layer_title;
-#$this->objLayer[$i]->layer_name = "";
 			}
 			if($this->objLayer[$i]->layer_minscale == ""){
 				$this->objLayer[$i]->layer_minscale = 0;



More information about the Mapbender_commits mailing list