[Mapbender-commits] r2569 - trunk/mapbender/http/classes

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Tue Jul 1 06:06:44 EDT 2008


Author: verenadiewald
Date: 2008-07-01 06:06:44 -0400 (Tue, 01 Jul 2008)
New Revision: 2569

Modified:
   trunk/mapbender/http/classes/class_wms.php
Log:
new function createObjFromDBNoGui creating WMS without connection to one special gui

Modified: trunk/mapbender/http/classes/class_wms.php
===================================================================
--- trunk/mapbender/http/classes/class_wms.php	2008-07-01 09:46:40 UTC (rev 2568)
+++ trunk/mapbender/http/classes/class_wms.php	2008-07-01 10:06:44 UTC (rev 2569)
@@ -1881,6 +1881,141 @@
 	/** end createObjfromDB **/
 	
 	  /**
+	* creatObjfromDBNoGui
+	*
+	*/ 
+	  function createObjFromDBNoGui($wms_id){
+		
+	   	$sql = "Select * from wms where wms_id = $1 ";
+		$v = array($wms_id);
+		$t = array('i');
+		$res_wms = db_prep_query($sql,$v,$t);
+		$count_wms=0;
+		while($row2 = db_fetch_array($res_wms)){
+			$this->wms_id = $row2["wms_id"];
+			$this->wms_version = $row2["wms_version"];
+			$this->wms_title = $this->stripEndlineAndCarriageReturn($row2["wms_title"]);
+			$this->wms_abstract = $this->stripEndlineAndCarriageReturn($row2["wms_abstract"]);
+			$wmsowsproxy = $row2["wms_owsproxy"];
+			#$wmsowsproxy = "test";
+			if($wmsowsproxy != ""){
+				$owsproxyurl = OWSPROXY."/".session_id()."/".$wmsowsproxy."?";
+				$this->wms_getmap = $owsproxyurl;
+				$this->wms_getcapabilities =  $owsproxyurl;
+				$this->wms_getfeatureinfo = $owsproxyurl;
+				$this->wms_getlegendurl = $owsproxyurl;
+			}
+			else{
+				$this->wms_getmap =  $row2["wms_getmap"];
+				$this->wms_getcapabilities =  $row2["wms_getcapabilities"];
+				$this->wms_getfeatureinfo = $row2["wms_getfeatureinfo"];
+				$this->wms_getlegendurl = $row2["wms_getlegendurl"];
+			}			
+			$this->wms_getcapabilities_doc = $row2["wms_getcapabilities_doc"];
+			$this->wms_filter = $row2["wms_filter"];
+			$this->wms_supportsld = $row2["wms_supportsld"];
+			$this->wms_userlayer = $row2["wms_userlayer"];
+			$this->wms_userstyle = $row2["wms_userstyle"];
+			$this->wms_remotewfs = $row2["wms_remotewfs"];
+			
+			#some default
+			$this->gui_wms_visible = 1;
+			$this->gui_wms_opacity = 100;
+			$this->gui_wms_epsg=$row["gui_wms_epsg"];
+			$this->gui_wms_sldurl = $row["gui_wms_sldurl"];
+			
+			$count_wms++;
+		}
+	
+		### formats
+		$sql = "SELECT * FROM wms_format WHERE fkey_wms_id = $1 ";
+		$v = array($wms_id);
+		$t = array('i'); 
+		$res_wms = db_prep_query($sql,$v,$t);
+		$count_format=0;		
+		while($row3 = db_fetch_array($res_wms)){		
+			$this->data_type[$count_format] = $row3["data_type"];
+			$this->data_format[$count_format] = $row3["data_format"];
+			$count_format++;
+		}
+
+			
+		$sql = "Select * from layer where fkey_wms_id = $1";
+		$v = array($wms_id);
+		$t = array('i');
+		$res_layer = db_prep_query($sql,$v,$t);
+		$count_layer=0;
+		while($row2 = db_fetch_array($res_layer)){
+			$this->addLayer($row2["layer_pos"],$row2["layer_parent"]);
+			$layer_cnt=count($this->objLayer)-1;
+			$this->objLayer[$layer_cnt]->layer_uid = $row2["layer_id"];
+			$this->objLayer[$layer_cnt]->layer_name =$row2["layer_name"];
+			$this->objLayer[$layer_cnt]->layer_title =$row2["layer_title"];			
+			$this->objLayer[$layer_cnt]->layer_dataurl_href =$row2["layer_dataurl"];
+			$this->objLayer[$layer_cnt]->layer_metadataurl =$row2["layer_metadataurl"];
+			$this->objLayer[$layer_cnt]->layer_pos =$row2["layer_pos"];						
+			$this->objLayer[$layer_cnt]->layer_queryable =$row2["layer_pos"];
+			$this->objLayer[$layer_cnt]->layer_queryable =$row2["layer_queryable"];
+			$this->objLayer[$layer_cnt]->layer_minscale =$row2["layer_minscale"];
+			$this->objLayer[$layer_cnt]->layer_maxscale = $row2["layer_maxscale"];
+			
+			if($this->objLayer[$layer_cnt]->layer_minscale == ""){
+				$this->objLayer[$layer_cnt]->layer_minscale = 0;
+			}
+			if($this->objLayer[$layer_cnt]->layer_maxscale == ""){
+				$this->objLayer[$layer_cnt]->layer_maxscale = 0;
+			}
+			$this->objLayer[$layer_cnt]->gui_layer_minscale = $this->objLayer[$layer_cnt]->layer_minscale;
+			$this->objLayer[$layer_cnt]->gui_layer_maxscale = $this->objLayer[$layer_cnt]->layer_maxscale;
+			
+			$sql = "Select * from layer_epsg where fkey_layer_id = $1 ORDER BY fkey_layer_id";
+			$v = array($this->objLayer[$layer_cnt]->layer_uid);
+			$t = array('i');
+			$res_layer_epsg = db_prep_query($sql,$v,$t);
+			
+			$count_layer_epsg=0;
+			while($row2 = db_fetch_array($res_layer_epsg)){
+				$this->objLayer[$layer_cnt]->layer_epsg[$count_layer_epsg]["epsg"]=$row2["epsg"];
+				$this->objLayer[$layer_cnt]->layer_epsg[$count_layer_epsg]["minx"]=$row2["minx"];
+				$this->objLayer[$layer_cnt]->layer_epsg[$count_layer_epsg]["miny"]=$row2["miny"];
+				$this->objLayer[$layer_cnt]->layer_epsg[$count_layer_epsg]["maxx"]=$row2["maxx"];
+				$this->objLayer[$layer_cnt]->layer_epsg[$count_layer_epsg]["maxy"]=$row2["maxy"];
+				$count_layer_epsg++;
+			}
+			
+			### handle styles
+			$sql = "SELECT * FROM layer_style WHERE fkey_layer_id = $1 ";
+			$v = array($this->objLayer[$layer_cnt]->layer_uid);
+			$t = array('i');
+			$res_style = db_prep_query($sql,$v,$t);
+			$count_layer_style = 0;
+			while($row2 = db_fetch_array($res_style)){
+				$this->objLayer[$layer_cnt]->layer_style[$count_layer_style]["name"]=$row2["name"];
+				$this->objLayer[$layer_cnt]->layer_style[$count_layer_style]["title"]=$row2["title"];
+				if($wmsowsproxy != ""){
+					if($row2["legendurl"]!=''){
+						$this->objLayer[$layer_cnt]->layer_style[$count_layer_style]["legendurl"]=$owsproxyurl.
+						"REQUEST=getlegendgraphic&VERSION=".$this->wms_version."&LAYER=".$this->objLayer[$layer_cnt]->layer_name."&FORMAT=".$row2["legendurlformat"].
+						"&STYLE=".$row2["name"];
+					}
+				}
+				else{
+					if($row2["legendurl"]!=''){
+						$this->objLayer[$layer_cnt]->layer_style[$count_layer_style]["legendurl"]=$row2["legendurl"];
+						#$e = new mb_exception("legendurl = ".$this->objLayer[$layer_cnt]->layer_style[$count_layer_style]["legendurl"]);
+					}
+				}
+				$this->objLayer[$layer_cnt]->layer_style[$count_layer_style]["legendurlformat"]=$row2["legendurlformat"];
+				$count_layer_style++;
+			}
+						
+			$count_layer++;
+		}
+	
+   }
+	/** end createObjfromDBNoGui **/
+	
+	  /**
 	* function checkObjExistsInDB()
 	*
 	* this function checks wether the onlineresource already exists in the database.



More information about the Mapbender_commits mailing list