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

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Tue May 29 08:11:42 EDT 2007


Author: uli
Date: 2007-05-29 08:11:42 -0400 (Tue, 29 May 2007)
New Revision: 1372

Modified:
   branches/mapbender_sld/http/javascripts/map.php
Log:
some changes for the redesign
new function getmapObjByName
changes initialisation of arrays

Modified: branches/mapbender_sld/http/javascripts/map.php
===================================================================
--- branches/mapbender_sld/http/javascripts/map.php	2007-05-29 11:42:59 UTC (rev 1371)
+++ branches/mapbender_sld/http/javascripts/map.php	2007-05-29 12:11:42 UTC (rev 1372)
@@ -38,7 +38,7 @@
 var mb_feature_count = 100;
 
 var mb_resolution = 28.35;
-var mb_mapObj = new Array();
+var mb_mapObj = [];
 var mb_fiWin = null;
 var mb_panActive = false;
 var clickX;
@@ -53,19 +53,16 @@
 var mb_offset_left = 0;
 var mb_log = null;
 
-var mb_PanSubElements = new Array();
+var mb_PanSubElements = [];
 function mb_registerPanSubElement(elName){
 	var ind = mb_PanSubElements.length;
 	mb_PanSubElements[ind] = elName;
 }
 
-var mb_vendorSpecific = new Array();
+var mb_vendorSpecific = [];
 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*/
@@ -81,12 +78,12 @@
 }
 
 function deleteWmsObject() {
-	wms = new Array();
+	wms = [];
 	wms_layer_count = 0;
 }
 
 function deleteMapObj() {
-	mb_mapObj = new Array();
+	mb_mapObj = [];
 }
 
 function mb_registerMapObj(frameName, elementName,wms_index,width, height){
@@ -99,13 +96,13 @@
    this.height = height;
    this.frameName = frameName;
    this.elementName = elementName;
-   this.layers = new Array();
-   this.styles = new Array();
-   this.querylayers = new Array();
+   this.layers = [];
+   this.styles = [];
+   this.querylayers = [];
    this.geom = "";
    this.gml = ""; 
    if(wms_index != null){
-      this.wms = new Array();
+      this.wms = [];
       this.wms[0] = wms[wms_index];
       this.wms[0].mapURL = false;
       var cnt_layers = 0;
@@ -131,7 +128,7 @@
       this.querylayers[0] = querylayers;   
    }
    else{
-	this.wms = new Array();
+	this.wms = [];
 	for(i=0; i<wms.length; i++){
 		this.wms[i] = wms[i];
 		this.wms[i].mapURL = false;
@@ -162,13 +159,83 @@
    }
    this.epsg = wms[0].gui_wms_epsg;
    this.extent = setExtent(this.width,this.height,this.epsg);
-   this.mapURL = new Array();
+   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 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;
+	};
+	
+	
+	
    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) == "?"){ 
@@ -290,11 +357,11 @@
 function mb_mapObjremoveWMS(objind,wmsind){
 	var wms_ID = null;
 	
-	var new_wmsarray = new Array();
-	var new_layerarray = new Array();
-	var new_querylayerarray = new Array();
-	var new_stylesarray = new Array();
-	var new_mapURLarray = new Array();
+	var new_wmsarray = [];
+	var new_layerarray = [];
+	var new_querylayerarray = [];
+	var new_stylesarray = [];
+	var new_mapURLarray = [];
 	
 	for	(var i=0;i<mb_mapObj[objind].wms.length; i++){
 		if(i != wmsind){
@@ -314,7 +381,7 @@
 	mb_mapObj[objind].styles = new_stylesarray; 
 	mb_mapObj[objind].mapURL = new_mapURLarray;
 
-	var another_new_wmsarray = new Array();
+	var another_new_wmsarray = [];
 	for	(var i=0;i<wms.length; i++){
 		if(wms[i].wms_id != wms_ID){
 			another_new_wmsarray[another_new_wmsarray.length] = wms[i]; 
@@ -352,7 +419,7 @@
    }
 }
 function setMapRequest(frameName){
-
+//	console.log("setMapRequest: "+setMapRequest.caller);
 	var ts = mb_timestamp();
 
 	for(var i=0; i<mb_MapRequestPreFunctions.length; i++){
@@ -446,7 +513,7 @@
 	}
 }
 function setSingleMapRequest(frameName,wms_id){
-	
+//	console.log("setSingleMapRequest: "+setSingleMapRequest.caller);
 	var ts = mb_timestamp();	
 	
 	for(var i=0; i<mb_MapRequestPreFunctions.length; i++){
@@ -529,6 +596,7 @@
 	}  
 }
 function mb_restateLayers(frameName,wms_id){
+	console.log("mb_restateLayers: "+ mb_restateLayers.caller);
 	//alert(frameName + " / " + wms_id);
 	var ind = getMapObjIndexByName(frameName);	
 	for(var i=0; i<mb_mapObj[ind].wms.length; i++){
@@ -592,7 +660,7 @@
 			}
 		}
 	}
-	var str_layerstyles = new Array();
+	var str_layerstyles = [];
 	str_layerstyles[0] = str_layer;
 	str_layerstyles[1] = str_styles;
 	str_layerstyles[2] = str_titles;
@@ -923,6 +991,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){
@@ -1037,7 +1113,7 @@
 function mb_markResult(frameName,geom,col){
 	var x = "";
 	var y = "";
-	var tmp = new Array();
+	var tmp = [];
 	var ind = getMapObjIndexByName(frameName);
 	for(var i=0; i < geom.length; i++){
 		if(i > 0){
@@ -1093,10 +1169,10 @@
 function mb_getchildsbyname(objInd,wmsInd,lname){
 	var t = mb_mapObj[objInd].wms[wmsInd];
 	var pos = mb_getlayerposbyname(objInd, wmsInd,lname);
-	var l = new Array();
-	l["name"] = new Array();
-	l["title"] = new Array();
-	l["legendurl"] = new Array();
+	var l = [];
+	l["name"] = [];
+	l["title"] = [];
+	l["legendurl"] = [];
 	for(var i=0; i < t.objLayer.length; i++){
 		if(t.objLayer[i].layer_parent == pos){
 			l["name"][l["name"].length] = t.objLayer[i].layer_name;
@@ -1340,7 +1416,7 @@
  ***************************************************************************************
  */
  
-var mb_button = new Array();
+var mb_button = [];
 
 function mb_regButton_frame(wii, frameName, param){
 	var ind = mb_button.length;
@@ -1597,15 +1673,15 @@
  ***************************************************************************************
  */
 
-var mb_MapRequestSubFunctions = new Array();
-var mb_WfsReadSubFunctions = new Array();
-var mb_WfsWriteSubFunctions = new Array();
-var mb_MapRequestPreFunctions = new Array();
-var mb_FeatureInfoPreFunctions = new Array();
-var mb_InitFunctions = new Array();
-var mb_MapObjectSubFunctions = new Array();
-var mb_GetScalePreFunctions = new Array();
-var mb_loadWmsSubFunctions = new Array();
+var mb_MapRequestSubFunctions = [];
+var mb_WfsReadSubFunctions = [];
+var mb_WfsWriteSubFunctions = [];
+var mb_MapRequestPreFunctions = [];
+var mb_FeatureInfoPreFunctions = [];
+var mb_InitFunctions = [];
+var mb_MapObjectSubFunctions = [];
+var mb_GetScalePreFunctions = [];
+var mb_loadWmsSubFunctions = [];
 
 function mb_registerInitFunctions(stringFunction){
 	mb_InitFunctions[mb_InitFunctions.length] = stringFunction;



More information about the Mapbender_commits mailing list