[Mapbender-commits] r8576 - branches/2.7/http/classes

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Wed Feb 27 05:19:09 PST 2013


Author: verenadiewald
Date: 2013-02-27 05:19:02 -0800 (Wed, 27 Feb 2013)
New Revision: 8576

Modified:
   branches/2.7/http/classes/class_gml_multipolygon.php
Log:
return correct bbox for multipolygons

Modified: branches/2.7/http/classes/class_gml_multipolygon.php
===================================================================
--- branches/2.7/http/classes/class_gml_multipolygon.php	2013-02-26 16:19:16 UTC (rev 8575)
+++ branches/2.7/http/classes/class_gml_multipolygon.php	2013-02-27 13:19:02 UTC (rev 8576)
@@ -182,20 +182,42 @@
 		return $str;
 	}
 	
-	public function getBbox () {
-		$bboxArray = array();
-        for ($i = 0; $i < count($this->polygonArray); $i++) {
-        	if($this->polygonArray[$i]["x"] && $this->polygonArray[$i]["y"]) {
-            	$p = new Mapbender_point(
-                	$this->polygonArray[$i]["x"],
-                    $this->polygonArray[$i]["y"],
-                    $this->srs
-                );
-                $bboxArray[]= new Mapbender_bbox($p, $p, $this->srs);
-           	}
-     	}
-        return Mapbender_bbox::union($bboxArray);
-   	}
+		public function getBbox () {
+                $bboxArray = array();
+                $numberPolygonArray = count($this->polygonArray);
+                if ($numberPolygonArray > 0) {
+                        for ($cnt =0; $cnt < $numberPolygonArray; $cnt++){
+                                for ($i=0; $i < count($this->polygonArray[$cnt]); $i++) {
+                                        if($this->polygonArray[$cnt][$i]["x"] && $this->polygonArray[$cnt][$i]["y"]) {
+                                                $p = new Mapbender_point(
+                                                                $this->polygonArray[$cnt][$i]["x"],
+                                                                $this->polygonArray[$cnt][$i]["y"],
+                                                                $this->srs
+                                                );
+                                                $bboxArray[]= new Mapbender_bbox($p, $p, $this->srs);
+                                        }       
+                                }
+                                
+                                for ($i=0; $i < count($this->innerRingArray[$cnt]); $i++) {
+                                        for ($j=0; $j < count($this->innerRingArray[$cnt][$i]); $j++) {
+                                                if($this->innerRingArray[$cnt][$i][$j]["x"] && $this->innerRingArray[$cnt][$i][$j]["y"]) {
+                                                        $p = new Mapbender_point(
+                                                                        $this->innerRingArray[$cnt][$i][$j]["x"],
+                                                                        $this->innerRingArray[$cnt][$i][$j]["y"],
+                                                                        $this->srs
+                                                        );
+                                                        $bboxArray[]= new Mapbender_bbox($p, $p, $this->srs);
+                                                }
+                                        }
+                                }
+                        }
+                        return Mapbender_bbox::union($bboxArray);
+                }
+                else {
+                        $e = new mb_exception("GMLMultiPolygon: getBbox: this multiPolygon is null.");
+                }
+        }
 	
+	
 }
 ?>



More information about the Mapbender_commits mailing list