[Mapbender-commits] r5411 - branches/2.6/http/classes

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Mon Jan 25 04:33:15 EST 2010


Author: christoph
Date: 2010-01-25 04:33:12 -0500 (Mon, 25 Jan 2010)
New Revision: 5411

Modified:
   branches/2.6/http/classes/class_map.php
   branches/2.6/http/classes/class_wmc.php
   branches/2.6/http/classes/class_wmcToXml.php
   branches/2.6/http/classes/class_wms.php
Log:


Modified: branches/2.6/http/classes/class_map.php
===================================================================
--- branches/2.6/http/classes/class_map.php	2010-01-25 09:21:09 UTC (rev 5410)
+++ branches/2.6/http/classes/class_map.php	2010-01-25 09:33:12 UTC (rev 5411)
@@ -396,6 +396,7 @@
 			$wms->wms_getfeatureinfo = $currentWms->wms_getfeatureinfo;
 			$wms->wms_getlegendurl = $currentWms->wms_getlegendurl;
 			$wms->wms_filter = $currentWms->wms_filter;
+			$wms->wms_srs = $currentWms->wms_srs;
 			$wms->gui_epsg = $currentWms->gui_epsg;
 			$wms->gui_minx = $currentWms->gui_minx;
 			$wms->gui_miny = $currentWms->gui_miny;

Modified: branches/2.6/http/classes/class_wmc.php
===================================================================
--- branches/2.6/http/classes/class_wmc.php	2010-01-25 09:21:09 UTC (rev 5410)
+++ branches/2.6/http/classes/class_wmc.php	2010-01-25 09:33:12 UTC (rev 5411)
@@ -820,7 +820,7 @@
 							$extension = false;
 						}
 						if ($extension == true){
-							if ($value !== "") {
+//							if ($value !== "") {
 								if (isset($currentLayer["extension"][$tag])) {
 									if (!is_array($currentLayer["extension"][$tag])) {
 										$firstValue = $currentLayer["extension"][$tag];
@@ -832,7 +832,7 @@
 								else {
 									$currentLayer["extension"][$tag] = $value;									
 								}
-							}
+//							}
 						}
 						if ($tag == "EXTENSION" && $type == "open") {
 							$currentLayer["extension"] = array();
@@ -862,21 +862,7 @@
 		for ($i = 0; $i < count($layerlistCompleteArray); $i++) {
 			$this->setLayerData($layerlistCompleteArray[$i]);
 		}
-
-		// set zoom full extent for root layer of first WMS
-		$firstWms = $this->mainMap->getWms(0);
-		$firstWms->objLayer[0]->layer_epsg = array();
-		$boxList = $this->mainMap->getZoomFullExtentArray();
-		for ($i = 0; $i < count($boxList); $i++) {
-			$currentBox = $boxList[$i];
-			array_push($firstWms->objLayer[0]->layer_epsg, array(
-				"epsg" => $currentBox->epsg,
-				"minx" => $currentBox->min->x,
-				"miny" => $currentBox->min->y,
-				"maxx" => $currentBox->max->x,
-				"maxy" => $currentBox->max->y
-			));
-		}
+		
 		return true;
 	}
 
@@ -994,7 +980,7 @@
 			$wms->gui_wms_visible = $currentLayer["extension"]["WMS_VISIBLE"];
 			$wms->gui_wms_opacity = 100; // TODO : Add correct data
 			$wms->gui_wms_sldurl = $currentLayer["style"][$styleIndex]["sld_url"];
-
+			$wms->wms_srs = $currentLayer["epsg"];
 			$wms->gui_epsg = $currentLayer["epsg"];
 			//
 			// set data formats
@@ -1047,10 +1033,24 @@
 				for ($i=0; $i < count($layerEpsgArray); $i++) {
 					$currentLayerEpsg = array();
 					$currentLayerEpsg["epsg"] = $layerEpsgArray[$i];
-					$currentLayerEpsg["minx"] = floatval($layerMinXArray[$i]);
-					$currentLayerEpsg["miny"] = floatval($layerMinYArray[$i]); 
-					$currentLayerEpsg["maxx"] = floatval($layerMaxXArray[$i]);
-					$currentLayerEpsg["maxy"] = floatval($layerMaxYArray[$i]);
+
+
+					if ($layerMinXArray[$i] == 0
+						&& $layerMinYArray[$i] == 0
+						&& $layerMaxXArray[$i] == 0
+						&& $layerMaxYArray[$i] == 0
+						) {
+						$currentLayerEpsg["minx"] = null;
+						$currentLayerEpsg["miny"] = null; 
+						$currentLayerEpsg["maxx"] = null;
+						$currentLayerEpsg["maxy"] = null;
+					}
+					else {
+						$currentLayerEpsg["minx"] = floatval($layerMinXArray[$i]);
+						$currentLayerEpsg["miny"] = floatval($layerMinYArray[$i]); 
+						$currentLayerEpsg["maxx"] = floatval($layerMaxXArray[$i]);
+						$currentLayerEpsg["maxy"] = floatval($layerMaxYArray[$i]);
+					}
 					array_push($wms->objLayer[0]->layer_epsg, $currentLayerEpsg);
 				}
 			}			

Modified: branches/2.6/http/classes/class_wmcToXml.php
===================================================================
--- branches/2.6/http/classes/class_wmcToXml.php	2010-01-25 09:21:09 UTC (rev 5410)
+++ branches/2.6/http/classes/class_wmcToXml.php	2010-01-25 09:33:12 UTC (rev 5411)
@@ -365,9 +365,9 @@
 			$wms_epsg[1] = $currentWms->gui_wms_epsg;
 		}
 
-		for ($j = 0; $j < count($currentWms->gui_wms_epsg); $j++) {
-			if (!in_array($currentWms->gui_wms_epsg[$j], $wms_epsg)){
-				array_push($wms_epsg, $currentWms->gui_wms_epsg[$j]);
+		for ($j = 0; $j < count($currentWms->gui_epsg); $j++) {
+			if (!in_array($currentWms->gui_epsg[$j], $wms_epsg)){
+				array_push($wms_epsg, $currentWms->gui_epsg[$j]);
 			}
 		}
 
@@ -420,6 +420,24 @@
 		$layerExtensionData["gui_queryable"] = $currentLayer->gui_layer_queryable;
 		$layerExtensionData["gui_status"] = $currentLayer->gui_layer_status;
 		$layerExtensionData["layer_epsg"] = $currentLayer->layer_epsg;
+		for ($i = 0; $i < count($currentWms->gui_epsg); $i++) {
+			$found = false;
+			for ($j = 0; $j < count($layerExtensionData["layer_epsg"]); $j++) {
+				if ($layerExtensionData["layer_epsg"][$j]["epsg"] == $currentWms->gui_epsg[$i]) {
+					$found = true;
+					break;
+				}
+			}
+			if (!$found) {
+				$layerExtensionData["layer_epsg"][]= array(
+					"epsg" => $currentWms->gui_epsg[$i],
+					"minx" => $currentWms->gui_minx[$i],
+					"miny" => $currentWms->gui_miny[$i],
+					"maxx" => $currentWms->gui_maxx[$i],
+					"maxy" => $currentWms->gui_maxy[$i]
+				);
+			}
+		}
 		
 		if ($currentOverviewLayer != null) {
 			$layerExtensionData["overviewData"] = array("overviewHidden" => ($currentOverviewLayer->gui_layer_visible ? 0 : 1));

Modified: branches/2.6/http/classes/class_wms.php
===================================================================
--- branches/2.6/http/classes/class_wms.php	2010-01-25 09:21:09 UTC (rev 5410)
+++ branches/2.6/http/classes/class_wms.php	2010-01-25 09:33:12 UTC (rev 5411)
@@ -908,6 +908,7 @@
 		//
 		// set layer epsg
 		//
+		$tmpEpsgArray= array();
 		$newLayer->layer_epsg = array();
 		if ($currentLayer["extension"]["EPSG"]) {
 			$layerEpsgArray = array();
@@ -933,15 +934,38 @@
 			for ($i=0; $i < count($layerEpsgArray); $i++) {
 				$currentLayerEpsg = array();
 				$currentLayerEpsg["epsg"] = $layerEpsgArray[$i];
-				$currentLayerEpsg["minx"] = floatval($layerMinXArray[$i]);
-				$currentLayerEpsg["miny"] = floatval($layerMinYArray[$i]); 
-				$currentLayerEpsg["maxx"] = floatval($layerMaxXArray[$i]);
-				$currentLayerEpsg["maxy"] = floatval($layerMaxYArray[$i]);
+				$tmpEpsgArray[]= $layerEpsgArray[$i];
+				if ($layerMinXArray[$i] == 0
+					&& $layerMinYArray[$i] == 0
+					&& $layerMaxXArray[$i] == 0
+					&& $layerMaxYArray[$i] == 0
+					) {
+					$currentLayerEpsg["minx"] = null;
+					$currentLayerEpsg["miny"] = null; 
+					$currentLayerEpsg["maxx"] = null;
+					$currentLayerEpsg["maxy"] = null;
+				}
+				else {
+					$currentLayerEpsg["minx"] = floatval($layerMinXArray[$i]);
+					$currentLayerEpsg["miny"] = floatval($layerMinYArray[$i]); 
+					$currentLayerEpsg["maxx"] = floatval($layerMaxXArray[$i]);
+					$currentLayerEpsg["maxy"] = floatval($layerMaxYArray[$i]);
+				}
 				array_push($newLayer->layer_epsg, $currentLayerEpsg);
 			}
 		}
+		for ($i = 0; $i < count($currentLayer["epsg"]); $i++) {
+			if (!in_array($currentLayer["epsg"][$i], $tmpEpsgArray)) {
+				$newLayer->layer_epsg[]= array(
+					"epsg" => $currentLayer["epsg"][$i],
+					"minx" => null,
+					"miny" => null,
+					"maxx" => null,
+					"maxy" => null
+				);
+			}
+		}
 
-
 		//
 		// set layer style
 		//
@@ -956,7 +980,8 @@
 	}
 	
 	  function createJsObjFromWMS_($parent=0){
-	  	$str = "";
+
+		$str = "";
 	  	if(!$this->wms_title || $this->wms_title == ""){
 			$str .= "alert('Error: no valid capabilities-document !!');";
 			die; exit;
@@ -1019,26 +1044,29 @@
 				$this->objLayer[$i]->gui_layer_wfs_featuretype ."');";
 				
 			for($j=0; $j<count($this->objLayer[$i]->layer_epsg);$j++){
+				$currentEpsg = $this->objLayer[$i]->layer_epsg[$j];
 				if($i==0){
 					if($parent){
 						$str .= "parent.";
 					}
 					$str .= "wms_addSRS('". 
-						$this->objLayer[$i]->layer_epsg[$j]["epsg"] ."',". 
-						$this->objLayer[$i]->layer_epsg[$j]["minx"] .",". 
-						$this->objLayer[$i]->layer_epsg[$j]["miny"] .",". 
-						$this->objLayer[$i]->layer_epsg[$j]["maxx"] .",". 
-						$this->objLayer[$i]->layer_epsg[$j]["maxy"] .");";
+						$currentEpsg["epsg"] ."',". 
+						(is_null($currentEpsg["minx"]) ? "null" : $currentEpsg["minx"]) .",". 
+						(is_null($currentEpsg["miny"]) ? "null" : $currentEpsg["miny"]) .",". 
+						(is_null($currentEpsg["maxx"]) ? "null" : $currentEpsg["maxx"]) .",". 
+						(is_null($currentEpsg["maxy"]) ? "null" : $currentEpsg["maxy"]) .");";
 				}
-				if($parent){
-					$str .=  "parent.";
+				if (!is_null($currentEpsg["epsg"])) {
+					if($parent){
+						$str .=  "parent.";
+					}
+					$str .= "layer_addEpsg('". 
+						$currentEpsg["epsg"] ."',". 
+						(is_null($currentEpsg["minx"]) ? "null" : $currentEpsg["minx"]) .",". 
+						(is_null($currentEpsg["miny"]) ? "null" : $currentEpsg["miny"]) .",". 
+						(is_null($currentEpsg["maxx"]) ? "null" : $currentEpsg["maxx"]) .",". 
+						(is_null($currentEpsg["maxy"]) ? "null" : $currentEpsg["maxy"]) .");";
 				}
-				$str .= "layer_addEpsg('". 
-					$this->objLayer[$i]->layer_epsg[$j]["epsg"] ."',". 
-					$this->objLayer[$i]->layer_epsg[$j]["minx"] .",". 
-					$this->objLayer[$i]->layer_epsg[$j]["miny"] .",". 
-					$this->objLayer[$i]->layer_epsg[$j]["maxx"] .",". 
-					$this->objLayer[$i]->layer_epsg[$j]["maxy"] .");";
 			}
 			for($j=0; $i==0 && $j<count($this->wms_srs);$j++){
 				$found = false;



More information about the Mapbender_commits mailing list