svn commit: r527 - trunk/mapbender/http/classes/class_wmc.php

christoph at osgeo.org christoph at osgeo.org
Mon Jun 19 11:06:07 EDT 2006


Author: christoph
Date: 2006-06-19 15:06:07+0000
New Revision: 527

Modified:
   trunk/mapbender/http/classes/class_wmc.php

Log:
improvement: wmc loading now rebuilds the map obj

Modified: trunk/mapbender/http/classes/class_wmc.php
Url: https://mapbender.osgeo.org/source/browse/mapbender/trunk/mapbender/http/classes/class_wmc.php?view=diff&rev=527&p1=trunk/mapbender/http/classes/class_wmc.php&p2=trunk/mapbender/http/classes/class_wmc.php&r1=526&r2=527
==============================================================================
--- trunk/mapbender/http/classes/class_wmc.php	(original)
+++ trunk/mapbender/http/classes/class_wmc.php	2006-06-19 15:06:07+0000
@@ -560,6 +560,8 @@
 				$layerlist = "";
 				//gathers all the querylayers of the current wms (seperated by ,)
 				$querylayerlist = "";
+				
+				$srs_array = array();
 	
 				// BEGIN: add this wms as it has not been added before
 				$mywms = new wms();
@@ -660,13 +662,16 @@
 						
 						// BEGIN: Add epsg to layer  
 						for($j=0; $j<count($this->wmc_layer_srs[$ii]);$j++){
-							$wmc_string .= $target . "wms_addSRS('". 
-								$this->wmc_layer_srs[$ii][$j] ."','". 
-								$this->wmc_bBox_minx ."','". 
-								$this->wmc_bBox_miny ."','". 
-								$this->wmc_bBox_maxx ."','". 
-								$this->wmc_bBox_maxy ."','". 
-								"');\n";
+							if (!in_array($this->wmc_layer_srs[$ii][$j], $srs_array)) {
+								$srs_array[count($srs_array)] = $this->wmc_layer_srs[$ii][$j]; 
+								$wmc_string .= $target . "wms_addSRS('". 
+									$this->wmc_layer_srs[$ii][$j] ."','". 
+									$this->wmc_bBox_minx ."','". 
+									$this->wmc_bBox_miny ."','". 
+									$this->wmc_bBox_maxx ."','". 
+									$this->wmc_bBox_maxy ."','". 
+									"');\n";
+							}
 						}
 						// END: Add epsg to layer 
 
@@ -681,17 +686,31 @@
 				//END : gather all layers of this wms
 				
 				// add wms to mapObj with all layers and querylayers
-				$wmc_string .= $target;
-				$wmc_string .= "mb_mapObjaddWMSwithLayers('" . $mapObj . "', '" . $layerlist . "', '" . $querylayerlist . "');\n";
+//				$wmc_string .= $target;
+//				$wmc_string .= "mb_mapObjaddWMSwithLayers('" . $mapObj . "', '" . $layerlist . "', '" . $querylayerlist . "');\n";
 				
 			}
 			//END : check if wms has not been added before
 		}
-		$wmc_string .= "var ind = " . $target . "getMapObjIndexByName('" . $mapObj . "');\n";
-		$wmc_string .= $target . "mb_mapObj[ind].width = " . $this->wmc_windowWidth . ";\n";
-		$wmc_string .= $target . "mb_mapObj[ind].height = " . $this->wmc_windowHeight . ";\n";
-		$wmc_string .= $target . "mb_mapObj[ind].epsg = '" . $this->wmc_bBox_SRS . "';\n";
-		$wmc_string .= $target . "mb_calculateExtent('" . $mapObj . "', " . $this->wmc_bBox_minx . ", " . $this->wmc_bBox_miny . ", " . $this->wmc_bBox_maxx . ", " . $this->wmc_bBox_maxy . ");\n";
+//		$wmc_string .= "var ind = " . $target . "getMapObjIndexByName('" . $mapObj . "');\n";
+//		$wmc_string .= $target . "mb_mapObj[ind].width = " . $this->wmc_windowWidth . ";\n";
+//		$wmc_string .= $target . "mb_mapObj[ind].height = " . $this->wmc_windowHeight . ";\n";
+//		$wmc_string .= $target . "mb_mapObj[ind].epsg = '" . $this->wmc_bBox_SRS . "';\n";
+//		$wmc_string .= $target . "mb_calculateExtent('" . $mapObj . "', " . $this->wmc_bBox_minx . ", " . $this->wmc_bBox_miny . ", " . $this->wmc_bBox_maxx . ", " . $this->wmc_bBox_maxy . ");\n";
+		
+		
+		$wmc_string .= "var old_mapObj = ".$target."cloneObject(".$target."mb_mapObj);\n";
+		$wmc_string .= $target . "mb_mapObj = new Array();\n";
+		$wmc_string .= "for (var i=0; i<old_mapObj.length; i++) {\n";
+		$wmc_string .= "\tif (old_mapObj[i].frameName != 'overview') {\n";
+		$wmc_string .= "\t\t" . $target . "mb_registerMapObj(old_mapObj[i].frameName, old_mapObj[i].elementName, null, " . $this->wmc_windowWidth . ", " . $this->wmc_windowHeight . ");\n"; 
+		$wmc_string .= $target . "document.getElementById(old_mapObj[i].frameName).style.width = " . $this->wmc_windowWidth . ";\n";
+		$wmc_string .= $target . "document.getElementById(old_mapObj[i].frameName).style.height = " . $this->wmc_windowHeight . ";\n";
+		$wmc_string .= "\t}\n";
+		$wmc_string .= "\telse {\n";
+		$wmc_string .= "\t\t" . $target . "mb_registerMapObj(old_mapObj[i].frameName, old_mapObj[i].elementName, 0, old_mapObj[i].width,  old_mapObj[i].width);\n"; 
+		$wmc_string .= "\t}\n";
+		$wmc_string .= "}\n";
 
 		return $wmc_string;
 	}




More information about the Mapbender_commits mailing list