[Mapbender-commits] r7462 - in trunk/mapbender: http/plugins lib

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Thu Jan 20 04:25:39 EST 2011


Author: verenadiewald
Date: 2011-01-20 01:25:38 -0800 (Thu, 20 Jan 2011)
New Revision: 7462

Modified:
   trunk/mapbender/http/plugins/mb_wfsGazetteer.js
   trunk/mapbender/lib/mb.ui.wfsGazetteer.js
Log:
add possibility to react to an element vars named activateWms which switches on the given WMS and switches off all other WMS

Modified: trunk/mapbender/http/plugins/mb_wfsGazetteer.js
===================================================================
--- trunk/mapbender/http/plugins/mb_wfsGazetteer.js	2011-01-20 08:06:02 UTC (rev 7461)
+++ trunk/mapbender/http/plugins/mb_wfsGazetteer.js	2011-01-20 09:25:38 UTC (rev 7462)
@@ -34,4 +34,33 @@
 			});
 		}
 	});
+	
+	$gazetteer.bind("receivefeaturecollection", function () {
+		if(options.activateWms) {
+			var activateWms = options.activateWms.split(",");
+			var map = $(this + ":maps").mapbender();
+			var wmsArray = map.wms;
+			for(var i = 0; i < activateWms.length; i++) {
+				activateWms[i] = $.trim(activateWms[i]);
+			}
+			
+			for (var i in wmsArray) {
+				var currentWms = wmsArray[i];
+				
+				if(currentWms.gui_wms_visible == 1) {
+					//first step: deactivate all WMS from tree
+					handleSelectedWms(map.elementName, currentWms.wms_id, "visible", 0);
+					handleSelectedWms(map.elementName, currentWms.wms_id, "querylayer", 0);
+				} 
+				
+				//second step: activate all WMS from element var activateWms
+				if($.inArray(currentWms.wms_title, activateWms) != -1) {
+					handleSelectedWms(map.elementName, currentWms.wms_id, "visible", 1);
+					handleSelectedWms(map.elementName, currentWms.wms_id, "querylayer", 1);
+				}
+			}
+			map.setMapRequest();
+			initWmsCheckboxen();
+		}
+	});
 });

Modified: trunk/mapbender/lib/mb.ui.wfsGazetteer.js
===================================================================
--- trunk/mapbender/lib/mb.ui.wfsGazetteer.js	2011-01-20 08:06:02 UTC (rev 7461)
+++ trunk/mapbender/lib/mb.ui.wfsGazetteer.js	2011-01-20 09:25:38 UTC (rev 7462)
@@ -253,6 +253,9 @@
 			that._trigger('receivefeaturecollection',null,{
 				featureCollection:json,
 				wfsConf: that.options.wfsConf});
+			$(that.element).trigger('receivefeaturecollection',null,{
+				featureCollection:json,
+				wfsConf: that.options.wfsConf});
 		});
 
 



More information about the Mapbender_commits mailing list