[Mapbender-commits] r3540 - branches/2.5/http/classes

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Thu Feb 12 05:33:48 EST 2009


Author: christoph
Date: 2009-02-12 05:33:48 -0500 (Thu, 12 Feb 2009)
New Revision: 3540

Modified:
   branches/2.5/http/classes/class_wms.php
Log:
http://trac.osgeo.org/mapbender/ticket/377

Modified: branches/2.5/http/classes/class_wms.php
===================================================================
--- branches/2.5/http/classes/class_wms.php	2009-02-11 13:59:32 UTC (rev 3539)
+++ branches/2.5/http/classes/class_wms.php	2009-02-12 10:33:48 UTC (rev 3540)
@@ -225,6 +225,16 @@
 //		$e = new mb_notice("after: " . implode(", ", array_reverse($newWmsArray)));
 		return array_reverse($newWmsArray);
 	}
+
+	private function formatExists ($type, $format) {
+		for ($i = 0; $i < count($this->data_type); $i++) {
+			if ($type == $this->data_type[$i] && $format == $this->data_format[$i]) {
+				$e = new mb_warning("WMS format already exists ($type, $format). Violation of WMS spec. Ignoring this WMS format.");
+				return true;
+			}
+		}
+		return false;
+	}
 	
 	public function __toString () {
 		return $this->wms_title;
@@ -339,9 +349,11 @@
 					$format = "map";
 				}
 				if(mb_strtoupper($element[tag]) != "FORMAT" && $section == "map" && $format == "map"){
-					$this->data_type[$cnt_format] = "map";
-					$this->data_format[$cnt_format] = trim($element[tag]);
-					$cnt_format++;
+					if (!$this->formatExists("map", trim($element[tag]))) {
+						$this->data_type[$cnt_format] = "map";
+						$this->data_format[$cnt_format] = trim($element[tag]);
+						$cnt_format++;
+					}
 				}
 				if(mb_strtoupper($element[tag]) == "FORMAT" && $element[type] == "close"){
 					$format = "";
@@ -361,9 +373,11 @@
 					$this->wms_getmap = $element[attributes]["xlink:href"];
 				}
 				if($section == "map" && mb_strtoupper($element[tag]) == "FORMAT"){
-					$this->data_type[$cnt_format] = "map";
-					$this->data_format[$cnt_format] = trim($element[value]);
-					$cnt_format++;
+					if (!$this->formatExists("map", trim($element[value]))) {
+						$this->data_type[$cnt_format] = "map";
+						$this->data_format[$cnt_format] = trim($element[value]);
+						$cnt_format++;
+					}
 				}
 				if($section == "map" && mb_strtoupper($element[tag]) == "GET" && $element[type] == "close"){
 					$request = "";
@@ -413,9 +427,11 @@
 					$format = "featureinfo";
 				}
 				if(mb_strtoupper($element[tag]) != "FORMAT" && $section == "featureinfo" && $format == "featureinfo"){
-					$this->data_type[$cnt_format] = "featureinfo";
-					$this->data_format[$cnt_format] = trim($element[tag]);
-					$cnt_format++;
+					if (!$this->formatExists("featureinfo", trim($element[tag]))) {
+						$this->data_type[$cnt_format] = "featureinfo";
+						$this->data_format[$cnt_format] = trim($element[tag]);
+						$cnt_format++;
+					}
 				}
 				if(mb_strtoupper($element[tag]) == "FORMAT" && $element[type] == "close"){
 					$format = "";
@@ -435,9 +451,11 @@
 					$this->wms_getfeatureinfo = $element[attributes]["xlink:href"];
 				}
 				if($section == "featureinfo" && mb_strtoupper($element[tag]) == "FORMAT"){
-					$this->data_type[$cnt_format] = "featureinfo";
-					$this->data_format[$cnt_format] = trim($element[value]);
-					$cnt_format++;
+					if (!$this->formatExists("featureinfo", trim($element[value]))) {
+						$this->data_type[$cnt_format] = "featureinfo";
+						$this->data_format[$cnt_format] = trim($element[value]);
+						$cnt_format++;
+					}
 				}
 				if($section == "featureinfo" && mb_strtoupper($element[tag]) == "GET" && $element[type] == "close"){
 					$request = "";



More information about the Mapbender_commits mailing list