[Mapbender-commits] r1313 - trunk/mapbender/http/html

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Wed May 9 09:44:54 EDT 2007


Author: christoph
Date: 2007-05-09 09:44:54 -0400 (Wed, 09 May 2007)
New Revision: 1313

Modified:
   trunk/mapbender/http/html/mod_treefolder2.php
Log:
bugfix; basic opacity handling

Modified: trunk/mapbender/http/html/mod_treefolder2.php
===================================================================
--- trunk/mapbender/http/html/mod_treefolder2.php	2007-05-09 13:03:19 UTC (rev 1312)
+++ trunk/mapbender/http/html/mod_treefolder2.php	2007-05-09 13:44:54 UTC (rev 1313)
@@ -56,7 +56,7 @@
 var jst_container = "document.getElementById('treeContainer')";
 var jst_image_folder = imagedir;
 var jst_display_root = false;
-var defaultTarget = 'examplemain';
+var defaultTarget = 'examplemain';
 var lock=false;
 var selectedMap=-1;
 var selectedWMS=-1;
@@ -65,10 +65,10 @@
 var errors = 0;
 var state=Array();
 var treeState = "";
-var arrNodes = 
-[
-	['root_id', ['Layer','javascript:_foo()']
-
+var arrNodes = 
+[
+	['root_id', ['Layer','javascript:_foo()']
+
 	]
 ];
 function _foo(){}
@@ -87,6 +87,8 @@
 var menu_move_up = ['menu_move_up', ['Move up ','javascript:var sd = "{@strData}";var ids=eval(sd.substr(0, sd.length-6))[1][7];move_up(ids[0],ids[1],ids[2]);',,'move_up.png']];
 var menu_move_down = ['menu_move_down', ['Move down ', 'javascript:var sd = "{@strData}";var ids=eval(sd.substr(0, sd.length-6))[1][7];move_down(ids[0],ids[1],ids[2]);',,'move_down.png']];
 var menu_delete = ['menu_delete', ['Remove ', 'javascript:var sd = "{@strData}";var ids=eval(sd.substr(0, sd.length-6))[1][7];remove_wms(ids[0],ids[1],ids[2]);',,'delete_wms.png']];
+var menu_opacity_up = ['menu_opacity_up', ['Opacity up ','javascript:var sd = "{@strData}";var ids=eval(sd.substr(0, sd.length-6))[1][7];opacity_up(ids[0],ids[1],ids[2]);',,'move_up.png']];
+var menu_opacity_down = ['menu_opacity_down', ['Opacity down ','javascript:var sd = "{@strData}";var ids=eval(sd.substr(0, sd.length-6))[1][7];opacity_down(ids[0],ids[1],ids[2]);',,'move_down.png']];
 var menu_metalink = ['menu_metalink', ['Information ', 'javascript:var sd = "{@strData}";var ids=eval(sd.substr(0, sd.length-6))[1][7];openwindow("../php/mod_layerMetadata.php?id="+parent.mb_mapObj[ids[0]].wms[ids[1]].objLayer[ids[2]].layer_uid);',,'info.png']];
 var menu_zoom = ['menu_zoom', ['Zoom ', 'javascript:var sd = "{@strData}";var ids=eval(sd.substr(0, sd.length-6))[1][7];zoomToLayer(ids[0],ids[1],ids[2]);',,'zoom.png']];
 var menu_hide = ['menu_hide', ['Hide menu ', 'javascript:hideMenu()',,'hide.png']];
@@ -224,9 +226,9 @@
 }
 
 function checkComplete(wms, map, img, first){
-	if(parent.frames[mod_treeGDE_map].document.getElementById(map).complete){
+	var ind=parent.getMapObjIndexByName(mod_treeGDE_map);
+	if(parent.mb_mapObj[ind].wms[wms].mapURL == false || parent.frames[mod_treeGDE_map].document.getElementById(map).complete){
 		if(state[wms]!=-1){
-			var ind=parent.getMapObjIndexByName(mod_treeGDE_map);
 			for(var i=1;i<parent.mb_mapObj[ind].wms[wms].objLayer.length;i++){
 				if(parent.mb_mapObj[ind].wms[wms].objLayer[i].gui_layer_visible==1){
 					state[wms]=1;
@@ -293,6 +295,57 @@
 	}
 }
 
+
+//---begin------------- opacity --------------------
+
+var opacityIncrement = 20;
+
+function opacity_up(j, k, l) {
+	handleOpacity(j, k, opacityIncrement);
+}
+
+function opacity_down(j, k, l) {
+	handleOpacity(j, k, -opacityIncrement);
+}
+
+function handleOpacity(mapObj_id, wms_id, increment) {
+
+	if (parent.mb_mapObj[mapObj_id].wms[wms_id].gui_wms_visible > 0) {
+		wmsImage = parent.mapframe1.document.getElementById('div_'+wms_id);
+		if (typeof(wmsImage) != 'undefined') {
+			opacity = wmsImage.style.opacity*100 - (-increment);
+			opacity = (opacity < 100)? ((opacity > 0)? opacity : 0) : 100;
+			parent.mb_mapObj[mapObj_id].wms[wms_id].gui_wms_mapopacity = (opacity / 100);
+			applyOpacity(wms_id, opacity);
+		}
+	}
+}
+
+function applyOpacity(wms_id, opacity) {
+	if (parent.mb_mapObj[mapObj_id].wms[wms_id].gui_wms_visible > 0) {
+		var divId = 'div_'+wms_id;
+		wmsImage = parent.mapframe1.document.getElementById(divId);
+		if (typeof(wmsImage) != 'undefined') {
+			wmsImage.style.opacity = (opacity / 100);
+			wmsImage.style.MozOpacity = (opacity / 100);
+			wmsImage.style.KhtmlOpacity = (opacity / 100);
+			wmsImage.style.filter = "alpha(opacity=" + opacity + ")";
+		}
+	}
+}
+
+function applyOpacityForAllWms (mapObj_name) {
+	mapObj_id = parent.getMapObjIndexByName(mapObj_name);
+	for (var i = 0; i < parent.mb_mapObj[mapObj_id].wms.length; i++) {
+		var opacity = parent.mb_mapObj[mapObj_id].wms[i].gui_wms_mapopacity * 100;
+		applyOpacity(i, opacity);
+	}
+}
+
+parent.mb_registerSubFunctions("window.frames['treeGDE'].applyOpacityForAllWms('mapframe1')");
+
+//---end------------- opacity --------------------
+
 function move_up(j,k,l){
 	if(!j&&!k&&!l){
 		j=selectedMap;
@@ -467,12 +520,16 @@
 								if(menu.indexOf("wms_down")!=-1 && ii!=parent.mb_mapObj[i].wms.length-1)c_menu+="menu_move_down,";
 								if(menu.indexOf("remove")!=-1)c_menu+="menu_delete,";
 //								if(menu.indexOf("wms_switch")!=-1)c_menu+="menu_wms_switch,";
-								if(menu.indexOf("hide")!=-1)c_menu+="menu_hide,";
+								if(menu.indexOf("opacity_up")!=-1)c_menu+="menu_opacity_up,";
+								if(menu.indexOf("opacity_down")!=-1)c_menu+="menu_opacity_down,";
+								if(menu.indexOf("hide")!=-1)c_menu+="menu_hide";
 								c_menu+="]";
-								if(switchwms=='true')
+								if(switchwms=='true') {
 									addNode(arrNodes[0][0],[parent.mb_mapObj[i].wms[ii].wms_id,[temp.layer_title,"javascript:select("+i+","+ii+","+iii+");",,,,eval(c_menu),'<INPUT type="checkbox" checked onclick="handleSelectedWMS(\''+arrNodes[0][0]+'|'+parent.mb_mapObj[i].wms[ii].wms_id+'\');" />',[i,ii,iii]]],false,false);
-								else
+								}
+								else {
 									addNode(arrNodes[0][0],[parent.mb_mapObj[i].wms[ii].wms_id,[temp.layer_title,"javascript:select("+i+","+ii+","+iii+");",,,,eval(c_menu),[i,ii,iii]]],false,false);
+								}
 								parentObj = arrNodes[0][0]+"|"+parent.mb_mapObj[i].wms[ii].wms_id;              
 							}
 							if(parent.mb_mapObj[i].wms[ii].objLayer[iii].layer_parent == "0"){
@@ -484,7 +541,7 @@
 									if(menu.indexOf("zoom")!=-1 && temp.layer_epsg.length>0)c_menu+="menu_zoom,";
 //									if(menu.indexOf("layer_switch")!=-1)c_menu+="menu_layer_switch,";
 //									if(menu.indexOf("info_switch")!=-1)c_menu+="menu_info_switch,";
-									if(menu.indexOf("hide")!=-1)c_menu+="menu_hide,";
+									if(menu.indexOf("hide")!=-1)c_menu+="menu_hide";
 									c_menu+="]";
 									
 									controls='<input type="checkbox" '+((temp.gui_layer_visible=='1')?'checked ':'')+(temp.gui_layer_selectable!='1'?'disabled ':'')+"onclick=\"handleSelectedLayer('"+mod_treeGDE_map+"','"+parent.mb_mapObj[i].wms[ii].wms_id+"','"+temp.layer_name+"','visible',this.checked?1:0);updateParent('"+parentObj+"');"+((ficheckbox == 'false')?"handleSelectedLayer('"+mod_treeGDE_map+"','"+parent.mb_mapObj[i].wms[ii].wms_id+"','"+temp.layer_name+"','querylayer',this.checked?1:0)":"")+"\" />";



More information about the Mapbender_commits mailing list