[Mapbender-commits] r2134 - in trunk/mapbender: http/classes http/javascripts http/php resources/db/update

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Wed Feb 20 11:10:29 EST 2008


Author: nimix
Date: 2008-02-20 11:10:29 -0500 (Wed, 20 Feb 2008)
New Revision: 2134

Modified:
   trunk/mapbender/http/classes/class_wmc.php
   trunk/mapbender/http/classes/class_wms.php
   trunk/mapbender/http/javascripts/map_obj.js
   trunk/mapbender/http/php/mod_editGuiWms.php
   trunk/mapbender/resources/db/update/update_mysql_db.sql
   trunk/mapbender/resources/db/update/update_postgresql_db.sql
Log:
add proper opacity handeling with startopacity

Modified: trunk/mapbender/http/classes/class_wmc.php
===================================================================
--- trunk/mapbender/http/classes/class_wmc.php	2008-02-20 16:07:05 UTC (rev 2133)
+++ trunk/mapbender/http/classes/class_wmc.php	2008-02-20 16:10:29 UTC (rev 2134)
@@ -1106,7 +1106,7 @@
 						$this->wmc_wms_serviceURL[$i] ."','" .
 						$this->wmc_layer_style_legendurl[$i][0] ."','','". 
 						$wms_data_format ."','text/html','application/vnd.ogc.se_xml','". 
-						$this->wmc_bBox_SRS ."','1');\n";
+						$this->wmc_bBox_SRS ."','1','100');\n";
 		
 					$added_wms[count($added_wms)] = $current_wms;
 					$cnt_wms++;

Modified: trunk/mapbender/http/classes/class_wms.php
===================================================================
--- trunk/mapbender/http/classes/class_wms.php	2008-02-20 16:07:05 UTC (rev 2133)
+++ trunk/mapbender/http/classes/class_wms.php	2008-02-20 16:10:29 UTC (rev 2134)
@@ -504,6 +504,7 @@
 		}
 		#some default
 		$this->gui_wms_visible = 1;
+		$this->gui_wms_opacity = 100;
 		/*if the rootlayer has no epsg...*/
 		if($this->objLayer[0]->layer_epsg[0]["epsg"] == ""){
 			$this->objLayer[0]->layer_epsg = $this->objLayer[1]->layer_epsg;
@@ -614,6 +615,7 @@
 		echo "gui_wms_epsg: " . $this->gui_wms_epsg . " <br>";
 		echo "wms_srs: " . $this->objLayer[0]->wms_srs1 . " <br>";		
 		echo "gui_wms_visible: " . $this->gui_wms_visible . " <br>";
+		echo "gui_wms_opacity: " . $this->gui_wms_opacity . " <br>";
 		
 		for($i=0; $i<count($this->data_type);$i++){
 			echo $this->data_type[$i]. " -> ".$this->data_format[$i]. "<br>";
@@ -675,7 +677,8 @@
 					"'" . $this->gui_wms_featureinfoformat . "'," .
 					"'" . $this->gui_wms_exceptionformat . "'," .
 					"'" . $this->gui_wms_epsg ."'," .
-					"'" . $this->gui_wms_visible ."" .
+					"'" . $this->gui_wms_visible ."'," .
+					"'" . $this->gui_wms_opacity ."" .
 					"');";
 			echo $add_wms_string;
 			
@@ -765,7 +768,8 @@
 			$this->gui_wms_featureinfoformat ."','". 
 			$this->gui_wms_exceptionformat . "','". 
 			$this->gui_wms_epsg ."','". 
-			$this->gui_wms_visible ."');\n");
+			$this->gui_wms_visible ."','".
+			$this->gui_wms_opacity ."');\n");
 			
 		for($i=0;$i<count($this->data_format);$i++){
 			if($parent){
@@ -1476,6 +1480,8 @@
 			$this->gui_wms_exceptionformat=$row["gui_wms_exceptionformat"];
 			$this->gui_wms_epsg=$row["gui_wms_epsg"];
 			$this->gui_wms_visible = $row["gui_wms_visible"];
+			$this->gui_wms_opacity = $row["gui_wms_opacity"];
+			
 	  
 			$sql = "Select * from wms where wms_id = $1 ";
 			$v = array($wms_id);

Modified: trunk/mapbender/http/javascripts/map_obj.js
===================================================================
--- trunk/mapbender/http/javascripts/map_obj.js	2008-02-20 16:07:05 UTC (rev 2133)
+++ trunk/mapbender/http/javascripts/map_obj.js	2008-02-20 16:10:29 UTC (rev 2134)
@@ -24,6 +24,7 @@
  * @param {String} gui_wms_exceptionformat the exceptionformat for map requests
  * @param {String} gui_wms_epsg the current srs
  * @param {Integer} gui_wms_visible the visibility of this service
+ * @param {Integer} gui_wms_opacity the initial display opacity in percent
  * @param {String} gui_wms_sldurl url to an actual sld
  */
 function add_wms(
@@ -40,6 +41,7 @@
 			gui_wms_exceptionformat,
 			gui_wms_epsg,
 			gui_wms_visible,
+			gui_wms_opacity,
 			gui_wms_sldurl){
 					wms[wms.length] = new wms_const( 
 					wms_id,
@@ -55,6 +57,7 @@
 					gui_wms_exceptionformat,
 					gui_wms_epsg,
 					parseInt(gui_wms_visible),
+					parseInt(gui_wms_opacity),
 					gui_wms_sldurl);
 					wms_layer[wms.length - 1] = [];
 }
@@ -75,6 +78,7 @@
  * @param {String} gui_wms_exceptionformat the exceptionformat for map requests
  * @param {String} gui_wms_epsg the current srs
  * @param {String} gui_wms_visible the visibility of this service
+ * @param {Integer} gui_wms_opacity the initial display opacity in percent
  * @param {String} gui_wms_sldurl url to an actual sld
  * 
  */
@@ -92,6 +96,7 @@
 			gui_wms_exceptionformat,
 			gui_wms_epsg,
 			gui_wms_visible,
+			gui_wms_opacity,
 			gui_wms_sldurl){
    
 	if (!wms_id) {
@@ -130,7 +135,7 @@
 	this.gui_maxy = [];
 
 	// opacity version 
-	this.gui_wms_mapopacity = 1;
+	this.gui_wms_mapopacity = gui_wms_opacity/100;
 	// sld version
 	this.gui_wms_sldurl = gui_wms_sldurl;      
 }

Modified: trunk/mapbender/http/php/mod_editGuiWms.php
===================================================================
--- trunk/mapbender/http/php/mod_editGuiWms.php	2008-02-20 16:07:05 UTC (rev 2133)
+++ trunk/mapbender/http/php/mod_editGuiWms.php	2008-02-20 16:10:29 UTC (rev 2134)
@@ -258,19 +258,19 @@
    if(isset($this_gui_wms_epsg)){
       $sql = "UPDATE gui_wms set gui_wms_epsg = $1, gui_wms_mapformat = $2, ";
       $sql .= "gui_wms_featureinfoformat = $3, gui_wms_exceptionformat = $4, ";
-      $sql .= "gui_wms_visible = $5 ";
-      $sql .= "WHERE fkey_gui_id = $6 AND fkey_wms_id = $7";
-		$v = array($this_gui_wms_epsg,$this_gui_wms_mapformat,$this_gui_wms_featureinfoformat,$this_gui_wms_exceptionformat,$this_gui_wms_visible,$this_gui,$this_wms);
-		$t = array('s','s','s','s','i','s','i');
+      $sql .= "gui_wms_visible = $5, gui_wms_opacity = $6 ";
+      $sql .= "WHERE fkey_gui_id = $7 AND fkey_wms_id = $8";
+		$v = array($this_gui_wms_epsg,$this_gui_wms_mapformat,$this_gui_wms_featureinfoformat,$this_gui_wms_exceptionformat,$this_gui_wms_visible,$this_gui_wms_opacity,$this_gui,$this_wms);
+		$t = array('s','s','s','s','i','i','s','i');
 		$res = db_prep_query($sql,$v,$t);
    }
    else{
 		$sql = "UPDATE gui_wms set gui_wms_mapformat = $1, ";
 		$sql .= "gui_wms_featureinfoformat = $2, gui_wms_exceptionformat = $3, ";
-		$sql .= "gui_wms_visible = $4 ";
-		$sql .= "WHERE fkey_gui_id = $5 AND fkey_wms_id = $6";
-		$v = array($this_gui_wms_mapformat,$this_gui_wms_featureinfoformat,$this_gui_wms_exceptionformat,$this_gui_wms_visible,$this_gui,$this_wms);
-		$t = array('s','s','s','i','s','i');
+		$sql .= "gui_wms_visible = $4 , gui_wms_opacity = $5 ";
+		$sql .= "WHERE fkey_gui_id = $6 AND fkey_wms_id = $7";
+		$v = array($this_gui_wms_mapformat,$this_gui_wms_featureinfoformat,$this_gui_wms_exceptionformat,$this_gui_wms_visible,$this_gui_wms_opacity,$this_gui,$this_wms);
+		$t = array('s','s','s','i','i','s','i');
 		$res = db_prep_query($sql,$v,$t);
    }
 
@@ -392,6 +392,7 @@
    $gui_wms_exceptionformat[$cnt_gw] = $row["gui_wms_exceptionformat"];
    $gui_wms_epsg[$cnt_gw] = $row["gui_wms_epsg"];
    $gui_wms_visible[$cnt_gw] = $row["gui_wms_visible"];
+   $gui_wms_opacity[$cnt_gw] = $row["gui_wms_opacity"];
    $cnt_gw++;
 }
 #wms
@@ -564,6 +565,22 @@
 	
 echo "</tr>";
 
+# opacity
+echo "<tr>";
+	echo "<td>Opacity: </td><td>";
+	echo "<select class='mySelect' name='this_gui_wms_opacity'>";
+	for($i=0; $i<=100; $i+=10){
+		echo "<option value='".$i."' ";
+		if($i - $gui_wms_opacity[0]<=5&&$i - $gui_wms_opacity[0]>=-4){ echo "selected";}
+		echo ">";
+		echo $i."%";
+		echo "</option>";           
+	}
+	echo "</select>";
+	echo "</td>";
+	
+echo "</tr>";
+
 echo "</table><br>";
 
 echo "<table border='1' cellpadding='1'>";
@@ -639,7 +656,7 @@
   if($gui_layer_querylayer[$i] == 1){ echo "checked";}
   if($layer_queryable[$i] == 0){ echo "disabled";}
   echo "></td>";
-
+  
   echo "<td><input name='L_".$layer_id[$i]."___gui_layer_minscale' type='text' size='5' value='".$gui_layer_minscale[$i]."'></td>";
   echo "<td style='background:lightgrey'><input name='L_".$layer_id[$i]."___gui_layer_maxscale' type='text' size='5' value='".$gui_layer_maxscale[$i]."'></td>";
   

Modified: trunk/mapbender/resources/db/update/update_mysql_db.sql
===================================================================
--- trunk/mapbender/resources/db/update/update_mysql_db.sql	2008-02-20 16:07:05 UTC (rev 2133)
+++ trunk/mapbender/resources/db/update/update_mysql_db.sql	2008-02-20 16:10:29 UTC (rev 2134)
@@ -79,3 +79,7 @@
  
 
 
+--
+-- opacity handeling
+--
+ALTER TABLE gui_wms ADD COLUMN gui_wms_opacity INT DEFAULT 100;
\ No newline at end of file

Modified: trunk/mapbender/resources/db/update/update_postgresql_db.sql
===================================================================
--- trunk/mapbender/resources/db/update/update_postgresql_db.sql	2008-02-20 16:07:05 UTC (rev 2133)
+++ trunk/mapbender/resources/db/update/update_postgresql_db.sql	2008-02-20 16:10:29 UTC (rev 2134)
@@ -241,3 +241,7 @@
 ALTER TABLE ONLY gui_kml
     ADD CONSTRAINT gui_kml_id_fkey_gui_id  FOREIGN KEY (fkey_gui_id) REFERENCES gui(gui_id) ON UPDATE CASCADE ON DELETE CASCADE;
 
+--
+-- opacity handeling
+--
+ALTER TABLE gui_wms ADD COLUMN gui_wms_opacity INT DEFAULT 100;



More information about the Mapbender_commits mailing list