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

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Wed Aug 31 08:08:35 PDT 2016


Author: armin11
Date: 2016-08-31 08:08:30 -0700 (Wed, 31 Aug 2016)
New Revision: 9567

Modified:
   trunk/mapbender/http/classes/class_wmcToXml.php
   trunk/mapbender/http/classes/class_wms.php
Log:
Fix transformation of all wms dimension attributes

Modified: trunk/mapbender/http/classes/class_wmcToXml.php
===================================================================
--- trunk/mapbender/http/classes/class_wmcToXml.php	2016-08-31 15:06:23 UTC (rev 9566)
+++ trunk/mapbender/http/classes/class_wmcToXml.php	2016-08-31 15:08:30 UTC (rev 9567)
@@ -388,7 +388,7 @@
 	}
 
 	private function createLayerDimensionListNode ($currentWms, $currentLayer) {
-		//Debug
+		//For debug purposes
 		//$e = new mb_exception("class_wmcToXml.php: try to get dimension for layer from currentLayer");
 		//
 		if (count($currentLayer->layer_dimension) >= 1) {
@@ -399,7 +399,6 @@
 				$e_layer_dimension = $this->doc->createElement("Dimension");
 				foreach($currentLayer->layer_dimension as $dimension) {
 					foreach(get_object_vars($dimension) as $key=>$value) {
-						//$e = new mb_exception("class_wmcToXml.php: set attribute: ".$key."- to - ".$value);  		
 						$e_layer_dimension->setAttribute($key, $value);
 					}	
 				}
@@ -490,7 +489,6 @@
 
 		if (count($layerExtensionData) > 0) {
 			$e_extension = $this->doc->createElement("Extension");
-
 			foreach ($layerExtensionData as $keyExtensionData => $valueExtensionData) {
 				$e_currentExtensionTag = $this->addExtension($keyExtensionData, $valueExtensionData);
 				$e_extension->appendChild($e_currentExtensionTag);
@@ -558,9 +556,9 @@
 				$e_layer_style_legendurl = $this->doc->createElement("LegendURL");
 
 				//TODO: determine correct layer style entries
-				$layerStyle_legendUrl_width = ""; // To Do: add proper data
-				$layerStyle_legendUrl_height = ""; // To Do: add proper data
-				$layerStyle_legendUrl_format = ""; // To Do: add proper data
+				$layerStyle_legendUrl_width = ""; // TODO : add proper data
+				$layerStyle_legendUrl_height = ""; // TODO : add proper data
+				$layerStyle_legendUrl_format = ""; // TODO : add proper data
 				$e_layer_style_legendurl->setAttribute("width", $layerStyle_legendUrl_width);
 				$e_layer_style_legendurl->setAttribute("height", $layerStyle_legendUrl_height);
 				$e_layer_style_legendurl->setAttribute("format", $layerStyle_legendUrl_format);

Modified: trunk/mapbender/http/classes/class_wms.php
===================================================================
--- trunk/mapbender/http/classes/class_wms.php	2016-08-31 15:06:23 UTC (rev 9566)
+++ trunk/mapbender/http/classes/class_wms.php	2016-08-31 15:08:30 UTC (rev 9567)
@@ -1550,13 +1550,13 @@
 			$newLayer->layer_style[$i]["legendurl"] = $currentLayer["style"][$i]["legendurl"];
 			$newLayer->layer_style[$i]["legendurl_format"] = $currentLayer["style"][$i]["legendurl_type"];
 		}
-		//2016 add dimension
+		//2016-08-31 add dimension
+		$dimensionAttributes = array('name', 'units', 'unitSymbol', 'default', 'multipleValues', 'nearestValue', 'current', 'extent');
 		for ($i = 0; $i < count($currentLayer['dimension']); $i++) {
 			//$newLayer->layer_dimension[$i] = array();
-			//TODO - after holiday 2016
-			$newLayer->layer_dimension[$i]->name = $currentLayer['dimension'][$i]["name"];
-			$newLayer->layer_dimension[$i]->extent = $currentLayer['dimension'][$i]["extent"];
-			$newLayer->layer_dimension[$i]->unit = $currentLayer['dimension'][$i]["unit"];
+			foreach ($dimensionAttributes as $attributeName) {
+				$newLayer->layer_dimension[$i]->{$attributeName} = $currentLayer['dimension'][$i][$attributeName];
+			}
 		}
 	}
 	
@@ -3605,9 +3605,7 @@
 				$count_layer_style++;
 			}
 			//handle layer dimensions (first only time and elevation!)
-			//$e = new mb_exception("classes/class_wms.php - select dimension from database (createObjFromDB)for layer: ".$layer_id);
 			$sql = "SELECT * FROM layer_dimension WHERE fkey_layer_id = $1 AND ( name = 'time' OR name = 'elevation')";
-
 			$v = array($layer_id);
 			$t = array('i');
 			$res_dimension = db_prep_query($sql,$v,$t);
@@ -3615,19 +3613,9 @@
 			//test
 			$attributeNames = array('name', 'units', 'unitSymbol', 'default', 'multipleValues', 'nearestValue', 'current', 'extent');
 			while($row_dim = db_fetch_array($res_dimension)) {
-				//$attributeNames = array('name', 'units', 'unitSymbol', 'default', 'multipleValues', 'nearestValue', 'current', 'extent');
 				foreach($attributeNames as $attribute) {
-					//$e = new mb_exception("class_wms - pull dimension attribute: ".strtolower($attribute)." for layer: ".$layer_id);
-					//if () {
-						$this->objLayer[$layer_cnt]->layer_dimension[$count_layer_dimension]->{$attribute} = $row_dim[strtolower($attribute)];
-						//$e = new mb_exception("test 1");
-						//$e = new mb_exception("classes/class_wms.php - set dimension attribute ".$attribute." with ".$row_dim[strtolower($attribute)]." for dimension id ".$count_layer_dimension);
-						//$e = new mb_exception("test 2");
-						//$e = new mb_exception("classes/class_wms.php - attribute value for layer: ".$this->objLayer[$layer_cnt]->layer_dimension[$count_layer_dimension]->{$attribute});
-						//$e = new mb_exception("test 3");
-					//}
+					$this->objLayer[$layer_cnt]->layer_dimension[$count_layer_dimension]->{$attribute} = $row_dim[strtolower($attribute)];
 				}
-				//$e = new mb_exception("class_wms - pull dimension attribute - :".$row_dim['name'] - ;
 				$count_layer_dimension++;
 			}
 			$count++;



More information about the Mapbender_commits mailing list