[Mapbender-commits] r1431 - branches/mapbender_sld/http/javascripts

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Tue Jun 5 03:36:10 EDT 2007


Author: uli
Date: 2007-06-05 03:36:09 -0400 (Tue, 05 Jun 2007)
New Revision: 1431

Modified:
   branches/mapbender_sld/http/javascripts/map.js
Log:
merged with js part from map.php

Modified: branches/mapbender_sld/http/javascripts/map.js
===================================================================
--- branches/mapbender_sld/http/javascripts/map.js	2007-06-05 07:07:19 UTC (rev 1430)
+++ branches/mapbender_sld/http/javascripts/map.js	2007-06-05 07:36:09 UTC (rev 1431)
@@ -30,9 +30,6 @@
 function mb_registerVendorSpecific(stringFunction){
 	mb_vendorSpecific[mb_vendorSpecific.length] = stringFunction;
 }
-
-var mb_security_proxy = "http://wms1.ccgis.de/mapbender/tools/security_proxy.php?mb_ows_security_proxy=";
-
 var mb_trans = new Image; 
 mb_trans.src = "../img/transparent.gif";
 /*END OF GLOBALS*/
@@ -130,12 +127,117 @@
    this.epsg = wms[0].gui_wms_epsg;
    this.extent = setExtent(this.width,this.height,this.epsg);
    this.mapURL = [];
+   
+	/**
+	 * get the width of the mapObj
+	 *
+	 * @member mb_mapObj_const
+	 * @return width of the mapObj  
+	 * @type integer  
+	 */
+	this.getWidth = function(){
+		return this.width;
+	};
+	
+	/**
+	 * get the height of the mapObj
+	 *
+	 * @member mb_mapObj_const
+	 * @return width of the mapObj  
+	 * @type integer  
+	 */
+	this.getHeight = function(){
+		return this.height;
+	};
+	
+	/**
+	 * get the extent of the mapObj
+	 *
+	 * @member mb_mapObj_const
+	 * @return extent of the mapObj as commaseparated minx,minx,maxx,maxy  
+	 * @type string
+	 */
+	this.getExtent = function(){
+		return this.extent;
+	};
+	
+	/**
+	 * get the srs of the mapObj
+	 *
+	 * @member mb_mapObj_const
+	 * @return srs as epsg:number  
+	 * @type string
+	 */
+	this.getSRS = function(){
+		return this.epsg;
+	};
+	
+	/**
+	 * get all mapRequests 
+	 *
+	 * @member mb_mapObj_const
+	 * @return array of mapRequests of this map object  
+	 * @type string[]  
+	 */
+	this.getMapRequests = function(){
+		var allRequests = [];
+		//loop through all wms to get the mapRequests
+		for(var i=0; i<this.wms.length; i++){
+			var currentRequest = this.wms[i].getMapRequest(this);
+			if(currentRequest){ 
+				allRequests.push(currentRequest);
+			}
+		}
+		if(allRequests.length > 0){
+			return allRequests;
+		}
+		return false;
+	};
+	
+	
+	/**
+	 * get all featureInfoRequests 
+	 *
+	 * @member mb_mapObj_const
+	 * @param float x the x-value of the click position in pixel
+	 * @param float y the y-value of the click position in pixel
+	 * @return array of all featureInfoRequests of this map object  
+	 * @type string[]  
+	 */
+	this.getFeatureInfoRequests = function(clickPoint){
+		var allRequests = [];
+		//loop through all wms to get the FeatureInfoRequests
+		for(var i=0; i<this.wms.length; i++){
+			var currentRequest = this.wms[i].getFeatureInfoRequest(this, clickPoint);
+			if(currentRequest){ 
+				allRequests.push(currentRequest);
+			}
+		}
+		if(allRequests.length > 0){
+			return allRequests;
+		}
+		return false;
+	};
+	
+	/**
+	 * calculation of the mapscale 
+	 *
+	 * @member mb_mapObj_const
+	 * @return scale  
+	 * @type integer  
+	 */
+	this.getScale = function(){
+		var bbox = this.extent.split(",");
+		var xtenty =  parseFloat(bbox[3]) - parseFloat(bbox[1]);
+		var scale = (xtenty / this.height) * (mb_resolution * 100);
+		return Math.round(scale);
+	};
+	
    for(var i=0; i<mb_MapObjectSubFunctions.length; i++){
       eval(mb_MapObjectSubFunctions[i]);
    }  
 }
 
-
 function mb_getConjunctionCharacter(onlineresource){
 	if(onlineresource.indexOf("?") > -1){ 
 		if(onlineresource.charAt(onlineresource.length-1) == "?"){ 
@@ -386,6 +488,12 @@
 							var temp = "&SLD=" + tmp+ "&";
 							newMapURL += temp;
 						}
+						// add sld
+						if(mb_mapObj[i].wms[ii].gui_wms_sldurl != ""){
+							//alert(mb_mapObj[i].wms[ii].gui_wms_sldurl);
+							var temp = "&SLD=" + mb_mapObj[i].wms[ii].gui_wms_sldurl + "&";
+							newMapURL += temp;
+						}
 						if(mb_log){
 							var tmp = eval(mb_log + "('" + newMapURL + "','" + ts + "')");
 						}
@@ -469,6 +577,12 @@
 						var temp = "&SLD=" + tmp+ "&";
 						newMapURL += temp;
 					}
+					// add sld
+					if(mb_mapObj[i].wms[ii].gui_wms_sldurl != ""){
+						//alert(mb_mapObj[i].wms[ii].gui_wms_sldurl);
+						var temp = "&SLD=" + mb_mapObj[i].wms[ii].gui_wms_sldurl + "&";
+						newMapURL += temp;
+					}
 					//prompt("",newMapURL);
 					if(mb_mapObj[i].layers[ii] != "" && str_LayerStyles[0] != ""){
 						newMapRequest += newMapURL;
@@ -553,6 +667,10 @@
 					str_parent += mb_mapObj[mObj].wms[wmsObj].objLayer[i].layer_parent;
 					if(mb_mapObj[mObj].wms[wmsObj].objLayer[i].layer_style.length>0){
 					 	str_legendurls += mb_mapObj[mObj].wms[wmsObj].objLayer[i].layer_style[0]["legendurl"] ;
+					 	// add SLD-Url to Legend-Url
+					 	if (mb_mapObj[mObj].wms[wmsObj].gui_wms_sldurl != "") {
+					 		str_legendurls += "&SLD="+mb_mapObj[mObj].wms[wmsObj].gui_wms_sldurl;
+					 	}
 					}
 					cnt_layer++;
 				}
@@ -568,7 +686,6 @@
 	return str_layerstyles;
 }
 function setFeatureInfoRequest(fName,x,y, path) {
-	var functionName = 'setFeatureInfoRequest';
 	var ts = mb_timestamp();
 	for(var i=0; i<mb_FeatureInfoPreFunctions.length; i++){
 		eval(mb_FeatureInfoPreFunctions[i]);
@@ -891,6 +1008,14 @@
 		}
 	}   
 }
+function getMapObjByName(frameName){
+	for(var i=0; i<mb_mapObj.length; i++){
+		if(mb_mapObj[i].frameName == frameName){
+			return mb_mapObj[i];
+		}
+	}
+	return false;
+}
 function mb_getLayerTitleByName(map_index, wms_index, myLayer_name){
 	for(var i=0; i<mb_mapObj[map_index].wms[wms_index].objLayer.length; i++){
 		if(mb_mapObj[map_index].wms[wms_index].objLayer[i].layer_name == myLayer_name){
@@ -1281,13 +1406,13 @@
  *
  * @extends {@link Mb_log}
  * @param message the message that is being logged
- */
+ */	
 function Mb_warning(message) {
 	var level = "warning";
 	this.throwException(message, level);
 }
 Mb_warning.prototype = new Mb_log();
- 
+
 /**
  *  class for notice logging
  *



More information about the Mapbender_commits mailing list