[Mapbender-commits] r6928 - in trunk/mapbender/http: classes javascripts

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Wed Sep 22 07:06:38 EDT 2010


Author: christoph
Date: 2010-09-22 11:06:38 +0000 (Wed, 22 Sep 2010)
New Revision: 6928

Modified:
   trunk/mapbender/http/classes/class_map.php
   trunk/mapbender/http/classes/class_wms_1_1_1_factory.php
   trunk/mapbender/http/classes/class_wms_factory.php
   trunk/mapbender/http/javascripts/initWmcObj.php
Log:
http://trac.osgeo.org/mapbender/ticket/667

http://www.mapbender.org/index.php?title=GET-Parameter&oldid=16933

Modified: trunk/mapbender/http/classes/class_map.php
===================================================================
--- trunk/mapbender/http/classes/class_map.php	2010-09-22 09:48:46 UTC (rev 6927)
+++ trunk/mapbender/http/classes/class_map.php	2010-09-22 11:06:38 UTC (rev 6928)
@@ -346,14 +346,16 @@
 						$resMaxy = pg_query($con,$sqlMaxy);
 						$maxy = floatval(pg_fetch_result($resMaxy,0,"maxy"));
 					}
-					$bboxExists = true;
-					$this->calculateExtent(new Mapbender_bbox(
-						$minx, 
-						$miny, 
-						$maxx, 
-						$maxy, 
-						$srs
-					));
+					if ($minx && $miny && $maxx && $maxy) {
+						$bboxExists = true;
+						$this->calculateExtent(new Mapbender_bbox(
+							$minx,
+							$miny,
+							$maxx,
+							$maxy,
+							$srs
+						));
+					}
 				}
 				
 				if (!$bboxExists) {

Modified: trunk/mapbender/http/classes/class_wms_1_1_1_factory.php
===================================================================
--- trunk/mapbender/http/classes/class_wms_1_1_1_factory.php	2010-09-22 09:48:46 UTC (rev 6927)
+++ trunk/mapbender/http/classes/class_wms_1_1_1_factory.php	2010-09-22 11:06:38 UTC (rev 6928)
@@ -66,17 +66,25 @@
 		// Find layers that have both parents and children for testing:
 		// SELECT DISTINCT q.layer_id, q.layer_pos, q.layer_parent FROM layer q, layer r WHERE r.layer_parent <> '' AND q.layer_pos = CAST(r.layer_parent AS numeric) and q.layer_parent = '0' and q.fkey_wms_id = r.fkey_wms_id
 		$currentLayer = $myWms->getLayerById($id);
+
+		$keep = array($currentLayer->layer_uid);
+
 		$children = $currentLayer->getChildren();
+		foreach ($children as $child) {
+			$keep[]= $child->layer_uid;
+		}
 		$parents = $currentLayer->getParents();
-		$keep = array_merge(array($currentLayer), $children, $parents);
-		
+		foreach ($parents as $parent) {
+			$keep[]= $parent->layer_uid;
+		}
+
 		//
 		// 2. delete layers not for keeping
 		//
 		$i = 0;
 		while ($i < count($myWms->objLayer)) {
 			$l = $myWms->objLayer[$i];
-			if (in_array($l, $keep)) {
+			if (in_array($l->layer_uid, $keep)) {
 				$i++;
 				continue;
 			}

Modified: trunk/mapbender/http/classes/class_wms_factory.php
===================================================================
--- trunk/mapbender/http/classes/class_wms_factory.php	2010-09-22 09:48:46 UTC (rev 6927)
+++ trunk/mapbender/http/classes/class_wms_factory.php	2010-09-22 11:06:38 UTC (rev 6928)
@@ -26,7 +26,7 @@
 			func_get_arg(2) : null;
 
 		if (!is_null($appId)) {
-			$myWms->createObjFromDB($id, $appId);
+			$myWms->createObjFromDB($appId, $id);
 		}
 		else {
 			$myWms->createObjFromDBNoGui($id);

Modified: trunk/mapbender/http/javascripts/initWmcObj.php
===================================================================
--- trunk/mapbender/http/javascripts/initWmcObj.php	2010-09-22 09:48:46 UTC (rev 6927)
+++ trunk/mapbender/http/javascripts/initWmcObj.php	2010-09-22 11:06:38 UTC (rev 6928)
@@ -156,13 +156,21 @@
 	foreach ($inputLayerArray as $input) {
 		// just make it work for a single layer id
 		$wmsFactory = new UniversalWmsFactory();
-		$wms = $wmsFactory->createLayerFromDb($input["id"]);
+		if (isset($input["application"])) {
+			$wms = $wmsFactory->createLayerFromDb($input["id"], $input["application"]);
+		}
+		else {
+			$wms = $wmsFactory->createLayerFromDb($input["id"]);
+		}
 		$options = array();
 		if ($input["visible"]) {
 			// this is a hack for the time being:
 			// make WMS visible if it has less than 100000 layers
 			$options["show"] = 100000;
 		}
+		if ($input["zoom"]) {
+			$options["zoom"] = $input["zoom"];
+		}
 		$wmc->mergeWmsArray(array($wms), $options);
 	}
 }



More information about the Mapbender_commits mailing list