[Mapbender-commits] r5189 - trunk/mapbender/http/javascripts

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Tue Dec 15 04:44:33 EST 2009


Author: verenadiewald
Date: 2009-12-15 04:44:30 -0500 (Tue, 15 Dec 2009)
New Revision: 5189

Modified:
   trunk/mapbender/http/javascripts/mod_ResultList.js
Log:


Modified: trunk/mapbender/http/javascripts/mod_ResultList.js
===================================================================
--- trunk/mapbender/http/javascripts/mod_ResultList.js	2009-12-15 09:36:07 UTC (rev 5188)
+++ trunk/mapbender/http/javascripts/mod_ResultList.js	2009-12-15 09:44:30 UTC (rev 5189)
@@ -73,7 +73,7 @@
 	/*
 	 * Method: getSelected
 	 * Description: gets all rows from the datatable which are selected
-	 * Restrurns: an an array of DOMTableRow
+	 * Returns: an an array of DOMTableRow
 	*/
 	this.getSelected = function() {
 		var selected = [];//new resultGeometryListModel();
@@ -89,6 +89,13 @@
 	}
 	
 	this.show = function(){
+	
+		var resultHighlight = new Highlight(
+			options.target, 
+			"resultListHighlight", 
+			{"position":"absolute", "top":"0px", "left":"0px", "z-index":options.resultHighlightZIndex}, 
+			options.resultHighlightLineWidth
+		);
 		if(display_popup){
 			$('#'+options.id).dialog("open");
 		}else{
@@ -98,15 +105,29 @@
 		$("tr td span.wfsFproperty",table).click(function(){
 			// go up to the row, which has the "modelindex" set
 			var i = $(this.parentNode.parentNode).data("modelindex");
-			var name = me.model.getFeatureProperty(i,"firstname");
 			var feature = me.model.getFeature(i);
 
+			var infoPopupHtml = "<table>";
+			for (index in me.detailColumns) {
+				infoPopupHtml += "<tr>";
+				infoPopupHtml += "<td>" + me.detailColumns[index].label + "</td>";
+				infoPopupHtml += "<td>" + me.model.getFeatureProperty(i, me.detailColumns[index].name)+ "</td>";
+				infoPopupHtml += "</tr>";
+			}
+			infoPopupHtml += "</table>";
+			
 			var infoPopup = $("<div> </div>");
-			infoPopup.append(name);
+			infoPopup.append(infoPopupHtml);
+			
 			buttonList = $("<ul></ul>").css("list-style-type","none");
 			for (c in popupButtons){
 				var callback = function() {
-					popupButtons[c].callback.call(this,feature);
+					var  args =  { 
+						WFSConf: me.WFSConf,
+						geoJSON: feature,
+						selectedRows: me.getSelected()
+					};
+					popupButtons[c].callback.call(this,args);
 				};
 				var button = $("<li><button type='button' class='ui-state-default ui-corner-all'>"+popupButtons[c].title+"</button></li>").click(callback);
 				button.css("display","inline");
@@ -116,9 +137,55 @@
 			infoPopup.dialog({
 				title : "Details", 
 				autoOpen : false, 
-				draggable : true
+				draggable : true,
+				width : options.infoPopupWidth,
+				height : options.infoPopupHeight
 			});
 			infoPopup.dialog("open");
+			
+			if (options.maxHighlightedPoints > 0 && feature.getTotalPointCount() > options.maxHighlightedPoints) {
+				feature = feature.getBBox4();
+			}
+			
+			resultHighlight.del(feature, options.resultHighlightColor);
+			var bbox = feature.getBBox();
+			var bufferFloat = parseFloat(me.WFSConf.g_buffer);
+			var buffer = new Point(bufferFloat,bufferFloat);
+			bbox[0] = bbox[0].minus(buffer);
+			bbox[1] = bbox[1].plus(buffer);
+			//mb_calculateExtent(targetArray[0], bbox[0].x, bbox[0].y, bbox[1].x, bbox[1].y);
+			//zoom(targetArray[0], 'true', 1.0);
+			var map = Mapbender.modules[options.target[0]];
+			map.calculateExtent(
+				new Mapbender.Extent(bbox[0], bbox[1])
+			);
+			map.setMapRequest();
+			
+			resultHighlight.add(feature, options.resultHighlightColor);
+			resultHighlight.paint();
+			
+		}).mouseover(function () {
+			// go up to the row, which has the "modelindex" set
+			var i = $(this.parentNode.parentNode).data("modelindex");
+			var feature = me.model.getFeature(i);
+			
+			if (options.maxHighlightedPoints > 0 && feature.getTotalPointCount() > options.maxHighlightedPoints) {
+				feature = feature.getBBox4();
+			}
+			
+			resultHighlight.add(feature, options.resultHighlightColor);
+			resultHighlight.paint();
+		}).mouseout(function () {
+			// go up to the row, which has the "modelindex" set
+			var i = $(this.parentNode.parentNode).data("modelindex");
+			var feature = me.model.getFeature(i);
+			
+			if (options.maxHighlightedPoints > 0 && feature.getTotalPointCount() > options.maxHighlightedPoints) {
+				feature = feature.getBBox4();
+			}
+			
+			resultHighlight.del(feature, options.resultHighlightColor);
+			resultHighlight.paint();
 		});
 		
 		// set style of cursor to pointer for the result table
@@ -128,7 +195,8 @@
 		$("tr",table).click(function () {
 			if($(this).hasClass('row_selected')){
 				$(this).removeClass('row_selected');
-			}else{
+			}
+			else{
 				$(this).addClass('row_selected');
 			}
 			return true;
@@ -156,7 +224,7 @@
 };
 
 
-var table = $('<table id="'+ options.id +'_table"><thead><tr></tr></thead><tbody></tbody></table>');
+var table = $('<table class="display" id="'+ options.id +'_table"><thead><tr></tr></thead><tbody></tbody></table>');
 $('#'+options.id).append(table);
 
 ResultGeometryList.prototype = new ResultGeometryListController(table);



More information about the Mapbender_commits mailing list