[Mapbender-commits] r1709 - trunk/mapbender/http/javascripts

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Fri Oct 5 07:47:02 EDT 2007


Author: verenadiewald
Date: 2007-10-05 07:47:02 -0400 (Fri, 05 Oct 2007)
New Revision: 1709

Modified:
   trunk/mapbender/http/javascripts/map_obj.js
Log:
new functions for gui layer style handling

Modified: trunk/mapbender/http/javascripts/map_obj.js
===================================================================
--- trunk/mapbender/http/javascripts/map_obj.js	2007-10-05 11:44:22 UTC (rev 1708)
+++ trunk/mapbender/http/javascripts/map_obj.js	2007-10-05 11:47:02 UTC (rev 1709)
@@ -244,6 +244,7 @@
 	return visibleLayers;
 };
 
+
 /**
  * get the actual style of all visible layers
  *
@@ -256,7 +257,7 @@
 	var styles = [];
 	if(layers){
 		for(i = 0; i < layers.length; i++){
-			var style = this.getStyleByLayerName(layers[i]);
+			var style = this.getCurrentStyleByLayerName(layers[i]);
 			if(!style){
 				style = '';
 			}
@@ -268,6 +269,21 @@
 };
 
 /**
+ * check if layer is parentLayer
+ *
+ * @param layername
+ * @return the parent value of the given layer
+ * @type integer
+ */
+wms_const.prototype.checkLayerParentByLayerName = function(layername){
+	for(var i=0; i< this.objLayer.length; i++){
+		if(this.objLayer[i].layer_name == layername){
+			return this.objLayer[i].layer_parent;
+		}
+	}
+};
+
+/**
  * get the title of the current layer
  *
  * @param layername
@@ -283,7 +299,7 @@
 };
 
 /**
- * get the style of the layer
+ * get the current style of the layer
  *
  * @param layername
  * @return the stylename of the given layer
@@ -292,12 +308,44 @@
 wms_const.prototype.getCurrentStyleByLayerName = function(layername){
 	for(var i=0; i< this.objLayer.length; i++){
 		if(this.objLayer[i].layer_name == layername){
-			return this.objLayer[i].gui_layer_style;
+			if(this.objLayer[i].gui_layer_style==''){
+				return false;
+			}
+			else{
+				return this.objLayer[i].gui_layer_style;	
+			}
 		}
 	}
 };
 
 /**
+ * get the legendurl of the gui layer style
+ *
+ * @param stylename
+ * @return the legendurl of the given style
+ * @type string
+ */
+wms_const.prototype.getLegendUrlByGuiLayerStyle = function(layername,guiLayerStyle){
+	for(var i=0; i< this.objLayer.length; i++){
+		if(this.objLayer[i].layer_name == layername){
+			if(this.objLayer[i].layer_style.length==0){
+				return false;
+			}
+			for(var k=0; k< this.objLayer[i].layer_style.length; k++){
+				if(this.objLayer[i].layer_style[k]["name"]==guiLayerStyle){
+					if(this.objLayer[i].layer_style[k]["legendurl"]!=''){
+						return this.objLayer[i].layer_style[k]["legendurl"];
+					}
+					else {
+						return false;
+					}
+				}
+			}
+		}
+	}
+};
+
+/**
  * get all querylayers
  *
  * @return array of layernames



More information about the Mapbender_commits mailing list