[Mapbender-commits] r9573 - trunk/mapbender/http/html

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Fri Sep 2 05:36:44 PDT 2016


Author: armin11
Date: 2016-09-02 05:36:44 -0700 (Fri, 02 Sep 2016)
New Revision: 9573

Modified:
   trunk/mapbender/http/html/mod_treefolderPlain.php
Log:
New functions for support of wms dimension parameters

Modified: trunk/mapbender/http/html/mod_treefolderPlain.php
===================================================================
--- trunk/mapbender/http/html/mod_treefolderPlain.php	2016-09-02 12:36:00 UTC (rev 9572)
+++ trunk/mapbender/http/html/mod_treefolderPlain.php	2016-09-02 12:36:44 UTC (rev 9573)
@@ -793,48 +793,63 @@
 		k=selectedWMS;
 		l=selectedLayer;
 	}
-	var my= mb_mapObj[j].wms[k].objLayer[l];
+	var my = mb_mapObj[j].wms[k].objLayer[l];
+	var myWms = mb_mapObj[j].wms[k];
 	//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();
-					}
+	//alert(JSON.stringify(mb_mapObj[j].wms[k].objLayer[l].layer_dimension[dimensionIndex]));
+	//var userValue = encodeURI(mb_mapObj[j].wms[k].objLayer[l].layer_dimension[dimensionIndex].userValue); //not already defined in mapobj!!
+	var extent = encodeURI(mb_mapObj[j].wms[k].objLayer[l].layer_dimension[dimensionIndex].extent);
+	var dimdefault = encodeURI(mb_mapObj[j].wms[k].objLayer[l].layer_dimension[dimensionIndex].default);
+	//
+	var dialogHtml = "<div id='timeline'></div>";
+	$("<div id='selectDimensionDialog' title='<?php echo _mb('Select layer dimension');?>'><?php echo _mb('Please select an additional dimension value');?>: </div>").dialog(
+		{
+			bgiframe: true,
+			autoOpen: true,
+			modal: false,
+			closeOnEscape: false,
+			//open: function(event, ui) { $(".ui-dialog-titlebar-close").hide()}, //hide closing x - but only for element with special id!!!
+			buttons: {
+				"<?php echo _mb('Close');?>": function(){
+					$('selectDimensionDialog').remove();
+					$(this).dialog('close').remove();
+					//delete container, items, timeline
 				}
 			}
-		);
-		$(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.');?>");
-	}
+		}
+	);	
+	$(dialogHtml).appendTo("#selectDimensionDialog");
+	//fill timeline into div
+	  $.ajax({
+    		//url: '../php/mod_transformTimeDimension.php?extent='+extent+'&userValue='+userValue+'&default='+dimdefault,
+		url: '../php/mod_transformTimeDimension.php?extent='+extent+'&default='+dimdefault,
+    		success: function (data) {
+      			// hide the "loading..." message
+     			//document.getElementById('loading').style.display = 'none';
 
+      			// DOM element where the Timeline will be attached
+     			var container = document.getElementById('timeline');
+
+      			// Create a DataSet (allows two way data-binding)
+      			var items = new vis.DataSet(data.data);
+
+      			// Configuration for the Timeline
+      			//var options = {};
+      			var options = data.options;
+      			options.onMove = function (item,callback) {item.content = item.start.toISOString(); myWms.gui_wms_dimension_time = item.start.toISOString()+'Z'; Mapbender.modules[mod_treeGDE_map].setMapRequest();; callback(item);};
+      			// Create a Timeline
+      			var timeline = new vis.Timeline(container, items, options);
+    		},
+    		error: function (err) {
+      			console.log('Error', err);
+      			if (err.status === 0) {
+        			alert('Failed to load data/basic.json.\nPlease run this example on a server.');
+      			}
+      			else {
+        			alert('Failed to load data/basic.json.');
+      			}
+    		}
+  	});
 }
 
 function initArray(){



More information about the Mapbender_commits mailing list