[Mapbender-commits] r9363 - in trunk/mapbender/http: javascripts plugins

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Thu Jan 14 02:35:34 PST 2016


Author: armin11
Date: 2016-01-14 02:35:34 -0800 (Thu, 14 Jan 2016)
New Revision: 9363

Modified:
   trunk/mapbender/http/javascripts/mb_downloadFeedClient.php
   trunk/mapbender/http/plugins/mb_downloadFeedClient.php
Log:
Enhancement of INSPIRE Atom Feed Client: integrate bootstrap-select, zoom to single dataset, clickable examples

Modified: trunk/mapbender/http/javascripts/mb_downloadFeedClient.php
===================================================================
--- trunk/mapbender/http/javascripts/mb_downloadFeedClient.php	2016-01-13 12:18:19 UTC (rev 9362)
+++ trunk/mapbender/http/javascripts/mb_downloadFeedClient.php	2016-01-14 10:35:34 UTC (rev 9363)
@@ -54,7 +54,6 @@
 }
 
 function init(){
-	//var form = document.getElementById("service_feed_form");
 	//generate 2 Mapframes	
 	//add active class to dataset info before showing map, afterwords remove it!
 	$('#dataset_info').toggleClass('active');
@@ -105,6 +104,14 @@
 			//call server by ajax function
 			callServer(data,method);
     		});
+		$('.example_service_feed').click(function() {
+			//alert('click');
+			resetForm();
+			method =  "getServiceFeedObjectFromUrl";
+        		data = $( this ).text();
+			//call server by ajax function
+			callServer(data,method);
+    		});
 		$('#stop_parsing').click(function () {
   			alert("test");
 		});
@@ -174,11 +181,11 @@
 	$("#download_link_list").remove();
 	$("#download_link").remove();
 	//$('#dataset_select').remove();
-	$('.selectpicker').remove();
-	$('.selectpicker').selectpicker('refresh');
 	$("#tab_header_number_datasets").text("");
 	$("#tab_header_number_representations").text("");
 	$("#number_of_tiles").text("");
+	$('.selectpicker').selectpicker('destroy');
+
 }
 
 function showDatasetList(featureCollection,id) {
@@ -223,6 +230,7 @@
 			identifierAnchor.attr({'id':'dataset_identifier_link'});
 			identifierAnchor.attr({'uuid':featureCollection.features[i].properties.code});
 			identifierAnchor.attr({'href':'../php/mod_iso19139ToHtml.php?url='+encodeURIComponent(featureCollection.features[i].properties.metadataLink)});
+			identifierAnchor.attr({'target':'_blank'});
 			identifierAnchor.text(featureCollection.features[i].properties.namespace+"#"+featureCollection.features[i].properties.code);
 		}
 		selectOptions = selectOptions+"<option value='"+featureCollection.features[i].properties.datasetFeedLink+"' url='"+featureCollection.features[i].properties.datasetFeedLink+"' optionid='"+i+"'>"+featureCollection.features[i].properties.title+"</option>";
@@ -231,10 +239,11 @@
 	//add number of datasets to tab header
 	$("#tab_header_number_datasets").text(" "+"("+featureCollection.features.length+")");
 	datasetSelect.append(selectOptions);
-	//datasetSelect.addClass('selectpicker');
-	//datasetSelect.attr({'data-style':'btn-primary'});
-	//datasetSelect.attr({'data-width':'auto'});
-	//$('.selectpicker').selectpicker('render');
+	//following has to be enabled for boootstrap selectboxes
+	datasetSelect.addClass('selectpicker');
+	datasetSelect.attr({'data-style':'btn-primary'});
+	datasetSelect.attr({'data-width':'100%'});
+	datasetSelect.attr({'data-live-search':'true'});
 	$("#dataset_information").css("display","block");
 	$("#label_dataset_select").css("display","block");
 	//preselect option
@@ -244,14 +253,18 @@
 		optionSelected = $(this).find('option:selected').attr('optionid');
 		//alert(optionSelected);	
 		showDatasetList(featureCollection,optionSelected);
+		//zoom viewer to extent and highlight vector of current extent
+		drawMetadataPolygon(featureCollection.features[optionSelected]);
 		method =  "getDatasetFeedObjectFromUrl";
         	data = $this.val();
 		//resetForm();
 		callServer(data,method);
+		
 	});
 	method =  "getDatasetFeedObjectFromUrl";
 	//call second feed with first entry for default
         data = featureCollection.features[0].properties.datasetFeedLink;
+	$('.selectpicker').selectpicker('refresh');
 	datasetFeedObject = callServer(data,method);	
 }
 
@@ -261,8 +274,8 @@
 		alert("No parseable content found");
 		return false;
 	}
-	//remove select element for the different possible representations (formats, crs, ...)
-	$('#dataset_representation_select').remove();
+	//remove old select element for the different possible representations (formats, crs, ...)
+	$('#dataset_representation_list').empty();
 	//generate new select element 
 	var datasetEntrySelect =  $(document.createElement('select')).appendTo('#dataset_representation_list');
 	datasetEntrySelect.attr({'id':'dataset_representation_select'});
@@ -274,10 +287,11 @@
 	}
 	$("#tab_header_number_representations").text(" "+"("+featureCollection.features.length+")");
 	datasetEntrySelect.append(selectROptions);
-	//datasetEntrySelect.addClass('selectpicker');
-	//datasetEntrySelect.attr({'data-style':'btn-primary'});
-	//datasetEntrySelect.attr({'data-width':'auto'});
-	//$('.selectpicker').selectpicker('render');
+	//following has to be enabled for boootstrap selectboxes
+	datasetEntrySelect.addClass('selectpicker');
+	datasetEntrySelect.attr({'data-style':'btn-primary'});
+	datasetEntrySelect.attr({'data-width':'100%'});
+	datasetEntrySelect.selectpicker('refresh');
 	fillSectionList(featureCollection, id);
 	$('#dataset_representation_select').bind('change', function() {
     		var $this = $(this);
@@ -338,7 +352,7 @@
 				
                	}
 		//set number of links:
-		$("#number_of_tiles").text(" "+"("+numberOfLinks+"<?php echo " single tiles"?>"+")");
+		$("#number_of_tiles").text(" "+"("+numberOfLinks+"<?php echo " tile(s)"?>"+")");
 
 		//count features of bboxFiles
 		//bboxFiles if not available show error message
@@ -418,6 +432,28 @@
 	}
 }
 
+function drawMetadataPolygon(feature) {
+	 var type = "geojson";
+         var features = formats['in'][type].read(feature);
+         var bounds;
+         if(features) {
+             if(features.constructor != Array) {
+                 features = [features];
+             }
+             for(var i=0; i<features.length; ++i) {
+                 if (!bounds) {
+                     bounds = features[i].geometry.getBounds();
+                 } else {
+                     bounds.extend(features[i].geometry.getBounds());
+                 }
+             }
+	     //delete old features:
+	     bboxDataset.removeAllFeatures();
+             bboxDataset.addFeatures(features);
+             mapframe_dataset_list.zoomToExtent(bounds);
+	}
+}
+
 function highlightFeatureIndexById(id, open) {
 	features = bboxFiles.features;
 	for(var i=0; i<features.length; ++i) {

Modified: trunk/mapbender/http/plugins/mb_downloadFeedClient.php
===================================================================
--- trunk/mapbender/http/plugins/mb_downloadFeedClient.php	2016-01-13 12:18:19 UTC (rev 9362)
+++ trunk/mapbender/http/plugins/mb_downloadFeedClient.php	2016-01-14 10:35:34 UTC (rev 9363)
@@ -60,6 +60,10 @@
   line-height: 16px;
   font-family: "Verdana","Arial",sans-serif;
   color: black;
+  margin-top: 10px;
+  margin-bottom: 10px;
+  margin-right: 10px;
+  margin-left: 10px;
 }
 .olControlPanPanel{margin-top:55px;}
 select, textarea {
@@ -74,6 +78,7 @@
 @-moz-keyframes spin { 100% { -moz-transform: rotate(360deg); } }
 @-webkit-keyframes spin { 100% { -webkit-transform: rotate(360deg); } }
 @keyframes spin { 100% { -webkit-transform: rotate(360deg); transform:rotate(360deg); } }
+select {max-width: 100%;}
 #mapframe_dataset_list {
   position: absolut;
   top: 0;
@@ -82,27 +87,17 @@
   height: 250px;
   border: 1px solid #ccc;
 }
+#mapframe {
+}
+
 #mapframe_file_list {
   width: 325px;
   height: 225px;
   border: 1px solid #ccc;
 }
-#section_list {
-  position: relative;
-  top: 0;
-  left: 0;
-  width: 325px;
-  height: 225px;	
+.bootstrap-select {
+  z-index: 1500;
 }
-#input {
-  width: 512px;
-}
-#text {
-  font-size: 0.85em;
-  margin: 1em 0 1em 0;
-  width: 100%;
-  height: 10em;
-}
 </style>
 <!--<script src="../extensions/OpenLayers-2.13.1/OpenLayers.mobile.js"></script>//TODO: bugs with control panels-->
 <script src="../extensions/OpenLayers-2.13.1/OpenLayers.js"></script>
@@ -173,22 +168,22 @@
 </button>
 	<p>
 		<label for="example_feeds"><?php echo _mb("Example feeds");?>:</label>
-		<ul id="example_feeds">
-			<li>http://www.geoportal.rlp.de/mapbender/php/mod_inspireDownloadFeed.php?id=2b009ae4-aa3e-ff21-870b-49846d9561b2&type=SERVICE&generateFrom=wmslayer&layerid=30694</li>
-			<li>http://www.geoportal.rlp.de/mapbender/php/mod_inspireDownloadFeed.php?id=c2019e4f-3a3b-1caf-5c61-98a4343bf249&type=SERVICE&generateFrom=wfs&wfsid=216</li>
-			<li>http://geo.noe.gv.at/inspire-download/download_service_feed.xml</li>
-			<li>http://ole.e-steiermark.com/inspire/DownloadServiceFeed.xml</li>
-			<li>https://www.geoportal.ie/geoportal/download/ProtectedSites_SPA/npws-inspire-protected-sites-special-protection-areas.atom.en.xml</li>
-			<li>http://catalogue.sigloire.fr/PRRA/atomfeed/topatom.php</li>
-			<li>https://www.regionalstatistik.de/genesisws/inspire/pd/03/feeds/sf_200-71-4-B.xml</li>
-			<li>http://sg.geodatenzentrum.de/web_download/downloadservice.atom.xml</li>
-			<li>http://www.lfu.bayern.de/gdi/dls/biotopkartierung.xml</li>
-			<li>http://www.geoportal.hessen.de/mapbender//php/mod_inspireDownloadFeed.php?id=5cf8456c-abf4-b593-0acc-0942341f0957&type=SERVICE&generateFrom=wfs&wfsid=264</li>
-			<li>http://rips-gdi.lubw.baden-wuerttemberg.de/Atom_feed/de-bw-lubw_inspire_downloadservice_rips_naturschutz/de-bw-lubw_inspire_downloadservice_rips_naturschutz.xml</li>
-			<li>http://maps.waterschapservices.nl/www/download/nl.xml</li>
-			<li>http://services.rce.geovoorziening.nl/www/download/nl.xml</li>
-			<li>http://mapy.geoportal.gov.pl/wss/service/ATOM/httpauth/atom/SR</li>
-			<li>http://sedsh127.sedsh.gov.uk/Atom_data/ScotGov/ProtectedSites/SG_ProtectedSites.atom.en.xml</li>
+		<ul class="list-group" id="example_feeds">
+			<li class="example_service_feed list-group-item-success">http://www.geoportal.rlp.de/mapbender/php/mod_inspireDownloadFeed.php?id=2b009ae4-aa3e-ff21-870b-49846d9561b2&type=SERVICE&generateFrom=wmslayer&layerid=30694</li>
+			<li class="example_service_feed list-group-item-info">http://www.geoportal.rlp.de/mapbender/php/mod_inspireDownloadFeed.php?id=c2019e4f-3a3b-1caf-5c61-98a4343bf249&type=SERVICE&generateFrom=wfs&wfsid=216</li>
+			<li class="example_service_feed list-group-item-warning">http://geo.noe.gv.at/inspire-download/download_service_feed.xml</li>
+			<li class="example_service_feed list-group-item-danger">http://ole.e-steiermark.com/inspire/DownloadServiceFeed.xml</li>
+			<li class="example_service_feed list-group-item-success">https://www.geoportal.ie/geoportal/download/ProtectedSites_SPA/npws-inspire-protected-sites-special-protection-areas.atom.en.xml</li>
+			<li class="example_service_feed list-group-item-info">http://catalogue.sigloire.fr/PRRA/atomfeed/topatom.php</li>
+			<li class="example_service_feed list-group-item-warning">https://www.regionalstatistik.de/genesisws/inspire/pd/03/feeds/sf_200-71-4-B.xml</li>
+			<li class="example_service_feed list-group-item-danger">http://sg.geodatenzentrum.de/web_download/downloadservice.atom.xml</li>
+			<li class="example_service_feed list-group-item-success">http://www.lfu.bayern.de/gdi/dls/biotopkartierung.xml</li>
+			<li class="example_service_feed list-group-item-info">http://www.geoportal.hessen.de/mapbender//php/mod_inspireDownloadFeed.php?id=5cf8456c-abf4-b593-0acc-0942341f0957&type=SERVICE&generateFrom=wfs&wfsid=264</li>
+			<li class="example_service_feed list-group-item-warning">http://rips-gdi.lubw.baden-wuerttemberg.de/Atom_feed/de-bw-lubw_inspire_downloadservice_rips_naturschutz/de-bw-lubw_inspire_downloadservice_rips_naturschutz.xml</li>
+			<li class="example_service_feed list-group-item-danger">http://maps.waterschapservices.nl/www/download/nl.xml</li>
+			<li class="example_service_feed list-group-item-success">http://services.rce.geovoorziening.nl/www/download/nl.xml</li>
+			<li class="example_service_feed list-group-item-info">http://mapy.geoportal.gov.pl/wss/service/ATOM/httpauth/atom/SR</li>
+			<li class="example_service_feed list-group-item-warning">http://sedsh127.sedsh.gov.uk/Atom_data/ScotGov/ProtectedSites/SG_ProtectedSites.atom.en.xml</li>
 		</ul>
 	</p>
 	<!--<input type="button" title="Get Feed" id="download_feed_button" value="<?php echo _mb("Get feed content");?>"/>-->
@@ -196,7 +191,7 @@
     </p>
   </div>
   <div role="tabpanel" class="tab-pane" id="dataset_info">
-    <div id="dataset_list">  
+    <div style="z-index: 1200;" id="dataset_list">  
       <p>      
         <label for="dataset_select" id="label_dataset_select"><?php echo _mb("Available datasets");?>:</label>
         <div id="dataset_select"></div>
@@ -235,7 +230,7 @@
     <div id="representation_select">
       <p>
         <label for="representations"><?php echo _mb("Available representations");?>:</label>
-        <div id="dataset_representation_list"></div>
+        <div style="z-index: 1000;" id="dataset_representation_list"></div>
       </p>
     </div>
     <br>



More information about the Mapbender_commits mailing list