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

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Thu Jan 17 08:46:07 PST 2019


Author: armin11
Date: 2019-01-17 08:46:07 -0800 (Thu, 17 Jan 2019)
New Revision: 10029

Modified:
   trunk/mapbender/http/classes/class_owsContext.php
Log:
Some more attributes for export handling of ows context documents

Modified: trunk/mapbender/http/classes/class_owsContext.php
===================================================================
--- trunk/mapbender/http/classes/class_owsContext.php	2019-01-17 16:45:21 UTC (rev 10028)
+++ trunk/mapbender/http/classes/class_owsContext.php	2019-01-17 16:46:07 UTC (rev 10029)
@@ -52,9 +52,10 @@
 		$this->language = "de";
 		$this->id = new uuid();
 		$this->title = "dummy title";
+		$this->abstract = "dummy abstract";
 		//arrays
-		$this->author = array();
-		$this->keyword = array();
+		$this->author = "";
+		$this->keyword = "";
 		$this->extensions = array();
 		//relations
 		$this->resource = array();
@@ -146,6 +147,12 @@
 		$feedIdText = $owsContextDoc->createTextNode($this->id);
 		$feedId->appendChild($feedIdText);
 		$atomFeed->appendChild($feedId);
+                //subtitle
+		$feedSubTitle = $owsContextDoc->createElement("subtitle");
+		$feedSubTitle->setAttribute("type", "html");
+		$feedSubTitleText = $owsContextDoc->createTextNode($this->abstract);
+		$feedSubTitle->appendChild($feedSubTitleText);
+		$atomFeed->appendChild($feedSubTitle);
 		//mandatory updateDate
 		$feedUpdated = $owsContextDoc->createElement("updated");
 		$feedUpdatedText = $owsContextDoc->createTextNode($this->updateDate);
@@ -162,6 +169,35 @@
 		$feedAuthor->appendChild($feedAuthorName);
 		$feedAuthor->appendChild($feedAuthorEmail);
 		$atomFeed->appendChild($feedAuthor);
+                //example from http://schemas.opengis.net/owc/1.0/examples/sea_ice_extent_01.atom
+                //dc:publisher
+                //generator
+		$feedGenerator = $owsContextDoc->createElement("generator");
+		$feedGenerator->setAttribute("uri", $this->creator->creatorApplication->uri);
+		$feedGenerator->setAttribute("version", $this->creator->creatorApplication->version);
+                $feedGeneratorText = $owsContextDoc->createTextNode($this->creator->creatorApplication->title);
+                $feedGenerator->appendChild($feedGeneratorText);
+                $atomFeed->appendChild($feedGenerator);
+		//owc:display
+		$feedOwcDisplay =  $owsContextDoc->createElement("owc:display");
+		//
+		$feedOwcDisplayPixelWidth =  $owsContextDoc->createElement("owc:pixelWidth");
+		$feedOwcDisplayPixelWidthText =  $owsContextDoc->createTextNode($this->creator->creatorDisplay->pixelWidth);
+		$feedOwcDisplayPixelWidth->appendChild($feedOwcDisplayPixelWidthText);
+		$feedOwcDisplay->appendChild($feedOwcDisplayPixelWidth);
+		//
+		$feedOwcDisplayPixelHeight =  $owsContextDoc->createElement("owc:pixelHeight");
+		$feedOwcDisplayPixelHeightText =  $owsContextDoc->createTextNode($this->creator->creatorDisplay->pixelHeight);
+		$feedOwcDisplayPixelHeight->appendChild($feedOwcDisplayPixelHeightText);
+		$feedOwcDisplay->appendChild($feedOwcDisplayPixelHeight);
+		//
+		$feedOwcDisplayMmPerPixel =  $owsContextDoc->createElement("owc:mmPerPixel");
+		$feedOwcDisplayMmPerPixelText =  $owsContextDoc->createTextNode($this->creator->creatorDisplay->mmPerPixel);
+		$feedOwcDisplayMmPerPixel->appendChild($feedOwcDisplayMmPerPixelText);
+		$feedOwcDisplay->appendChild($feedOwcDisplayMmPerPixel);
+                $atomFeed->appendChild($feedOwcDisplay);
+		//rights
+                //category
 		//optional areaOfInterest
 		if (isset($this->areaOfInterest) && $this->areaOfInterest !== "") {
 			$feedAreaOfInterest = $owsContextDoc->createElement("georss:where");
@@ -188,7 +224,7 @@
 			if (count($resource->preview) >= 1) {
 				$feedPreview = $owsContextDoc->createElement("link");
 				$feedPreview->setAttribute("rel", "icon");
-				$feedPreview->setAttribute("type", "image/png");
+				$feedPreview->setAttribute("type", "image/jpeg");
 				$feedPreview->setAttribute("length", "12345");
 				$feedPreview->setAttribute("title", "Preview for layer X");
 				$feedPreview->setAttribute("href", $resource->preview[0]);
@@ -240,10 +276,12 @@
   		$myWmc->createFromDb($wmcId);
 		//read title
 		$this->title = $myWmc->wmc_title;
+		$this->abstract = $myWmc->wmc_abstract;
 		$this->id = $myWmc->uuid;
 		$this->updateDate = date(DATE_ATOM,$myWmc->timestamp); 
 		$this->author[0]['name'] = $myWmc->wmc_contactperson;
 		$this->author[0]['email'] = $myWmc->wmc_contactemail;
+		//TODO build publisher either from owner or primary group if available for this user!
 		//build georss:where from extent given in special srs
 		//minx miny, maxx miny, maxx maxy, minx maxy, minx miny
 		$minx = $myWmc->wmc_extent->minx;
@@ -254,6 +292,20 @@
 		$res = db_query($sql);
 		$georssGmlPolygon = db_fetch_row($res);	
 		$this->areaOfInterest = $georssGmlPolygon[0];
+		//define creator
+		$creator = new OwsContextResourceCreator();
+		$creator->creatorApplication = new OwsContextResourceCreatorApplication();
+$creator->creatorApplication->title = "testgeoportal";
+$creator->creatorApplication->uri = "http://localhost/mapbender";
+$creator->creatorApplication->version = "2.8_trunk";
+                $creatorDisplay = new OwsContextResourceCreatorDisplay();
+                $creatorDisplay->pixelWidth = $myWmc->mainMap->getWidth();
+                $creatorDisplay->pixelHeight = $myWmc->mainMap->getHeight();
+                $creatorDisplay->mmPerPixel = 0.28;
+		$creator->creatorDisplay = $creatorDisplay;
+		//add creator to object
+		$this->setCreator($creator);
+
 		//get the layers as single resources
 		libxml_use_internal_errors(true);
 		try {
@@ -325,13 +377,13 @@
 }
 
 class OwsContextResource {
-	var $id; //mandatory
-	var $title; //mandatory
-	var $abstract; //[0..1]
+	var $id; //mandatory CharacterString
+	var $title; //mandatory CharacterString
+	var $abstract; //[0..1] CharacterString
 	var $updateDate; //[0..1] - TM_Date
-	var $author; //[0..*] ? - really *
-	var $publisher; //[0..1]
-	var $rights; //[0..1]
+	var $author; //[0..*] ? - really * CharacterString
+	var $publisher; //[0..1] CharacterString
+	var $rights; //[0..1] CharacterString
 	var $geospatialExtent; //[0..1] GM_Envelope
 	var $temporalExtent; //[0..1] TM_GeometricPrimitive
 	var $contentDescription; //[0..1] Any
@@ -356,7 +408,7 @@
 		$this->preview = array();
 		$this->contentByRef = array();
 		$this->offering = array();
-		$this->keyword = array();
+		$this->keyword = "";
 		$this->extension = array();
 		$this->resourceMetadata = array();
 	}	
@@ -421,6 +473,13 @@
 	public function addOperation($aOperation) {
 		array_push($this->operation, $aOperation);	
 	}
+
+	public function addStyleSet($aStyleSet) {
+		array_push($this->styleSet, $aStyleSet);	
+	}
+
+
+
 }
 
 class OwsContextResourceOfferingOperation {



More information about the Mapbender_commits mailing list