[Mapbender-commits] r9568 - trunk/mapbender/http/html
svn_mapbender at osgeo.org
svn_mapbender at osgeo.org
Wed Aug 31 08:21:05 PDT 2016
Author: armin11
Date: 2016-08-31 08:21:04 -0700 (Wed, 31 Aug 2016)
New Revision: 9568
Modified:
trunk/mapbender/http/html/mod_treefolderPlain.php
Log:
First draft of new possibility to show clock at in layertree if layer support selection of time dimension
Modified: trunk/mapbender/http/html/mod_treefolderPlain.php
===================================================================
--- trunk/mapbender/http/html/mod_treefolderPlain.php 2016-08-31 15:08:30 UTC (rev 9567)
+++ trunk/mapbender/http/html/mod_treefolderPlain.php 2016-08-31 15:21:04 UTC (rev 9568)
@@ -200,6 +200,7 @@
}
if (typeof(datalink) === 'undefined')datalink = 'false';
+if (typeof(activatedimension) === 'undefined')datalink = 'false';
var defaultMetadataUrl = '../php/mod_showMetadata.php?resource=layer&layout=tabs&';
if (redirectToMetadataUrl) {
@@ -785,6 +786,57 @@
}
}
+
+function openDimensionSelectHtml(j,k,l,dimensionIndex) {
+ if(!j && !k&& !l){
+ j=selectedMap;
+ k=selectedWMS;
+ l=selectedLayer;
+ }
+ var my= mb_mapObj[j].wms[k].objLayer[l];
+ //extract/calculate discrete values for time!
+ //alert(JSON.stringify(mb_mapObj[j].wms[k].objLayer[l].layer_dimension[dimensionIndex].extent));
+ //extent - split first for , (discrete) then for / - interval
+ var jsExtent = mb_mapObj[j].wms[k].objLayer[l].layer_dimension[dimensionIndex].extent.split("/");
+ beginDate = jsExtent[0];
+ endDate = jsExtent[1];
+ interval = jsExtent[2];
+ alert(interval);
+ var dialogHtml = "<select id='dimensionSelect'>";
+ for (var i=0;i < my.layer_style.length;i++) {
+ dialogHtml += "<option value='" + my.layer_style[i].name + "'";
+ if(my.layer_style[i].name == my.gui_layer_style) {
+ dialogHtml += " selected";
+ }
+ dialogHtml += ">" + my.layer_style[i].title + "</option>";
+ }
+ dialogHtml += "</select>";
+
+ if(my.layer_style.length > 1) {
+ $("<div id='changeDimensionDialog' title='<?php echo _mb('Change layer dimension');?>'><?php echo _mb('Please select an additional dimension parameter');?>: </div>").dialog(
+ {
+ bgiframe: true,
+ autoOpen: true,
+ modal: false,
+ buttons: {
+ "<?php echo _mb('Close');?>": function(){
+ $(this).dialog('close').remove();
+ }
+ }
+ }
+ );
+ $(dialogHtml).appendTo("#changeDimensionDialog");
+ $("#dimensionSelect").change(function() {
+ my.gui_layer_style = this.options[this.selectedIndex].value;
+ Mapbender.modules[mod_treeGDE_map].setMapRequest();
+ });
+ }
+ else {
+ alert("<?php echo _mb('There are no different dimension values available for this layer.');?>");
+ }
+
+}
+
function initArray(){
var parentObj = "";
var controls="";
@@ -889,6 +941,30 @@
if(datalink == 'true' && mb_mapObj[i].wms[ii].objLayer[iii].layer_dataurl != ''){
controls.push('<a href="'+mb_mapObj[i].wms[ii].objLayer[iii].layer_dataurl+'"'+' target=\'_blank\' onclick="download_window = window.open(this.href,\'Download Data\',\'Width=450, Height=350,scrollbars=yes,menubar=yes,toolbar=yes\'); download_window.focus(); return false;"><img width="18" height="18" alt="'+msgObj.tooltipDownload+'" title="'+msgObj.tooltipDownload+'" src="'+imagedir+'/../gnome/document-save.png" /></a>');
}
+ //dimension buttons
+ if (activatedimension == 'true') {
+ timeDimensionAvailable = false;
+ timeDimensionIndex = false;
+ elevationDimensionAvailable = false;
+ elevationDimensionIndex = false;
+ //check for existence of time and/or elevation name attribute in dimension
+ for (dimensionIndex = 0; dimensionIndex < mb_mapObj[i].wms[ii].objLayer[iii].layer_dimension.length; ++dimensionIndex) {
+ switch (mb_mapObj[i].wms[ii].objLayer[iii].layer_dimension[dimensionIndex].name) {
+ case "time":
+ timeDimensionAvailable = true;
+ timeDimensionIndex = dimensionIndex;
+ break;
+ case "elevation":
+ elevationDimensionAvailable = true;
+ elevationDimensionIndex = dimensionIndex;
+ break;
+ }
+ }
+ if (timeDimensionAvailable === true) {
+ text = JSON.stringify(mb_mapObj[i].wms[ii].objLayer[iii].layer_dimension[timeDimensionIndex]);
+ controls.push('<img onclick="openDimensionSelectHtml('+i+','+ii+','+iii+','+timeDimensionIndex+');" width="18" height="18" alt="'+msgObj.tooltipTimeDimension+'" title="'+msgObj.tooltipTimeDimension+'" src="'+imagedir+'/../gnome/preferences-system-time.png" />');
+ }
+ }
var groupedImageStyle ='';
if (temp.has_childs == true){
groupedImageStyle ='closed_folder.png';
More information about the Mapbender_commits
mailing list