[Mapbender-commits] r10245 - in trunk/mapbender: http/css http/geoportal http/javascripts http/plugins lib resources/db/pgsql/UTF-8/update

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Fri Sep 13 03:26:42 PDT 2019


Author: armin11
Date: 2019-09-13 03:26:42 -0700 (Fri, 13 Sep 2019)
New Revision: 10245

Modified:
   trunk/mapbender/http/css/reset.css
   trunk/mapbender/http/geoportal/print_div.css
   trunk/mapbender/http/javascripts/mod_addWMS.php
   trunk/mapbender/http/javascripts/mod_coords_div.php
   trunk/mapbender/http/javascripts/mod_featureInfo.php
   trunk/mapbender/http/javascripts/mod_pan.js
   trunk/mapbender/http/javascripts/mod_savewmc.js
   trunk/mapbender/http/javascripts/mod_selArea.js
   trunk/mapbender/http/plugins/mb_button.js
   trunk/mapbender/http/plugins/mb_digitize_widget.php
   trunk/mapbender/http/plugins/mb_measure_widget.php
   trunk/mapbender/lib/button.js
   trunk/mapbender/lib/mb.ui.displayKmlFeatures.js
   trunk/mapbender/resources/db/pgsql/UTF-8/update/update_2.8_pgsql_UTF-8.sql
Log:
New options to build nicer guis ;-) - thanx to karl owesny

Modified: trunk/mapbender/http/css/reset.css
===================================================================
--- trunk/mapbender/http/css/reset.css	2019-09-12 15:43:37 UTC (rev 10244)
+++ trunk/mapbender/http/css/reset.css	2019-09-13 10:26:42 UTC (rev 10245)
@@ -3,8 +3,9 @@
     height: 100%;
     padding: 0;
     margin: 0;
+    overflow: hidden;
 } 
 
 .hide-during-splash {
-	display: none;
-}
\ No newline at end of file
+	display: none !important;
+}

Modified: trunk/mapbender/http/geoportal/print_div.css
===================================================================
--- trunk/mapbender/http/geoportal/print_div.css	2019-09-12 15:43:37 UTC (rev 10244)
+++ trunk/mapbender/http/geoportal/print_div.css	2019-09-13 10:26:42 UTC (rev 10245)
@@ -1,25 +1,28 @@
 @CHARSET "ISO-8859-1";
 
-#printPDF label, #printPDF input, #printPDF select, #printPDF textarea {
+#printPDF input, #printPDF select, #printPDF textarea {
 	display: block;
-	width: 150px;
+	width: 154px;
 	float: left;
 	margin-bottom: 2px;
 	margin-top: 2px;
 }
-
+#printPDF label {
+	display: block;
+        width: 100px;
+        float: left;
+        margin-bottom: 2px;
+        margin-top: 2px;
+}
 #printPDF input#submit {
 	display: block;
-	width: 80px;
+	width: 100px;
 	float: left;
 	margin-bottom: 2px;
 	margin-top: 2px;
-	margin-left: 50px;
+	margin-left: 0px;
 }
 
-#printPDF select {
-	width: 160px;
-}
 
 #printPDF label {
 	text-align: left;
@@ -49,4 +52,4 @@
 	opacity: 0.75;
 	width:100%;
 	height:100%;
-}
\ No newline at end of file
+}

Modified: trunk/mapbender/http/javascripts/mod_addWMS.php
===================================================================
--- trunk/mapbender/http/javascripts/mod_addWMS.php	2019-09-12 15:43:37 UTC (rev 10244)
+++ trunk/mapbender/http/javascripts/mod_addWMS.php	2019-09-13 10:26:42 UTC (rev 10245)
@@ -24,14 +24,18 @@
 
 $(this).click(function () {
 	mod_addWMS();
+	$(this).addClass('myOnClass');
+	$('#toolsContainer').hide() && $('a.toggleToolsContainer').removeClass('activeToggle');
 }).mouseover(function () {
 	if (options.src) {
 		this.src = options.src.replace(/_off/, "_over");
 	}
+	$(this).addClass('myOverClass');
 }).mouseout(function () {
 	if (options.src) {
 		this.src = options.src;
 	}
+	$(this).removeClass('myOverClass');
 });
 //var mod = new function(){
 //    var title = "URL:";
@@ -94,8 +98,10 @@
             title: "WebMapService hinzufügen",
             close: function () {
                 opened = false;
+				$("#addWMS").removeClass("myOnClass");
             }
-        });
+        }
+	);
     }
 }
 

Modified: trunk/mapbender/http/javascripts/mod_coords_div.php
===================================================================
--- trunk/mapbender/http/javascripts/mod_coords_div.php	2019-09-12 15:43:37 UTC (rev 10244)
+++ trunk/mapbender/http/javascripts/mod_coords_div.php	2019-09-13 10:26:42 UTC (rev 10245)
@@ -57,12 +57,15 @@
 }
 function mod_showCoords_div_run(){
 	var $map = $(mod_showCoords_div_mapObj.getDomElement());
+	$('#toolsContainer').hide() && $('a.toggleToolsContainer').removeClass('activeToggle');
 	$map.bind("mousemove", mod_showCoords_div_display);
+	$map.css("cursor", "crosshair");
 	$map.bind("click", mod_showCoords_div_click);
 }
 function mod_showCoords_div_disable(){
 	var $map = $(mod_showCoords_div_mapObj.getDomElement());
 	$map.unbind("mousemove", mod_showCoords_div_display);
+	$map.css("cursor", "default");
 	$map.unbind("click", mod_showCoords_div_click);
 	if(document.getElementById(displayTarget)){
 		writeTag("",displayTarget,"");
@@ -165,5 +168,14 @@
 		}
 		str +=  "</div>";
 		writeTag("",displayTarget, str);
+
+//erweiterung close-button
+		$(document.createElement('span')).attr({'id':'closeDivButton'}).appendTo(".actualcoords");
+		$("#closeDivButton").attr({'style':'position:absolute;top:1px;right:1px;border:1px solid transparent;cursor:pointer;'});
+		$("#closeDivButton").attr({'class':'ui-icon ui-icon-closethick'});
+		$("#closeDivButton").bind("click", mod_showCoords_div_disable) && $("#showCoords_div").removeClass('myOnClass');
+//		$("#closeDivButton").onclick = function(){
+ //       writeTag("",displayTarget, "")};
 	}
 }
+

Modified: trunk/mapbender/http/javascripts/mod_featureInfo.php
===================================================================
--- trunk/mapbender/http/javascripts/mod_featureInfo.php	2019-09-12 15:43:37 UTC (rev 10244)
+++ trunk/mapbender/http/javascripts/mod_featureInfo.php	2019-09-13 10:26:42 UTC (rev 10245)
@@ -21,6 +21,8 @@
 include '../include/dyn_js.php';
 //defaults for element vars
 ?>
+// <script>
+
 var ignoreWms = typeof ignoreWms === "undefined" ? [] : ignoreWms;
 
 if(typeof(featureInfoLayerPopup)==='undefined')
@@ -31,15 +33,18 @@
 	var featureInfoPopupWidth = '270';
 if(typeof(featureInfoPopupPosition)==='undefined')
 	var featureInfoPopupPosition = 'center';
-var reverseInfo = typeof reverseInfo === "undefined" ? "false" : reverseInfo;
-if(typeof(featureInfoLayerPreselect)==='undefined' || featureInfoLayerPreselect == 'false')
+if(typeof(reverseInfo)==='undefined' || reverseInfo === 'false')
+    var reverseInfo = false;
+if(typeof(featureInfoLayerPreselect)==='undefined' || featureInfoLayerPreselect === 'false')
 	var featureInfoLayerPreselect = false;
 if(typeof(featureInfoDrawClick)==='undefined')
 	var featureInfoDrawClick = false;
 if(typeof(featureInfoCircleColor)==='undefined')
 	var featureInfoCircleColor = '#ff0000';
-if(typeof(featureInfoCollectLayers)==='undefined' || featureInfoCollectLayers == 'false')
+if(typeof(featureInfoCollectLayers)==='undefined' || featureInfoCollectLayers === 'false')
 	var featureInfoCollectLayers = false;
+if (typeof(featureInfoShowKmlTreeInfo) === 'undefined' || featureInfoShowKmlTreeInfo === 'false')
+	var featureInfoShowKmlTreeInfo = false;
 
 var mod_featureInfo_elName = "<?php echo $e_id;?>";
 var mod_featureInfo_frameName = "";
@@ -124,10 +129,161 @@
 	if (el) {
 		$(el).unbind("click", mod_featureInfo_event)
 			.css("cursor", "default");
+		$("#featureInfo1").removeClass("myOnClass");
 	}
 }
+
+function makeDialog($content, title, dialogPosition, offset) {
+    dialogPosition = dialogPosition || featureInfoPopupPosition;
+    if(featureInfoPopupPosition.length === 2 && !isNaN(featureInfoPopupPosition[0]) && !isNaN(featureInfoPopupPosition[1])) {
+        offset = offset || 0;
+        var dialogPosition = [];
+        dialogPosition[0] = featureInfoPopupPosition[0] + offset;
+        dialogPosition[1] = featureInfoPopupPosition[1] + offset;
+    }
+    return $content.dialog({
+        bgiframe: true,
+        autoOpen: true,
+        modal: false,
+        title: title,
+        width: parseInt(featureInfoPopupWidth, 10),
+        height: parseInt(featureInfoPopupHeight, 10),
+        position: dialogPosition,
+        buttons: {
+            "Ok": function() {
+                if (standingHighlightFeatureInfo !== null) { 
+                    standingHighlightFeatureInfo.clean();
+                }
+                $(this).dialog('close').remove();
+            }
+        }
+    }).parent().css({ position:"fixed" });
+}
+
+function featureInfoDialog(request, dialogPosition, offset) {
+    var title = "<?php echo _mb("Information");?>";
+    var $iframe = $("<iframe>")
+            .attr("frameborder", 0)
+            .attr("height", "100%")
+            .attr("width", "100%")
+            .attr("id", "featureInfo")
+            .attr("title", title)
+            .attr("src", request)
+    return makeDialog($("<div>").append($iframe), title, dialogPosition, offset);
+}
+
+function ownDataDialog(ownData, dialogPosition, offset) {
+    var $box = $('<div>').html(ownData.content);
+    return makeDialog($box,
+            "<?php echo _mb("Information");?>", dialogPosition, offset);
+}
+
+function featureInfoWindow(request) {
+    return window.open(request, "" , "width="+featureInfoPopupWidth+",height="+featureInfoPopupHeight+",scrollbars=yes,resizable=yes");
+}
+
+function ownDataWindow(ownData) {
+    var w = featureInfoWindow("");
+    var $body = $(w.document.body);
+    $body.html(ownData.content);
+}
+
+function makeListLine(url, title, legendurls, onclick) {
+    var $row = $("<tr>");
+    var $title = $("<td>")
+        .attr("valign", "top")
+        .appendTo($row);
+    var $link = $("<a>")
+        .css("text-decoration", "underline")
+        .attr("href", url)
+        .attr("target", "_blank")
+        .html(title)
+        .appendTo($title);    
+    if (onclick) {
+        $link.bind('click', onclick);
+    }
+    var $legend = $("<td>")
+        .appendTo($row);
+    if (legendurls.length === 0) {
+        legendurls = [""];
+    }
+    legendurls.forEach(function (legendurl) {
+        $("<img>")
+            .attr("src", legendurl)
+            .attr("alt", "<?php echo _mb("No legend available");?>")
+            .appendTo($legend);
+        $("<br/>") 
+            .appendTo($legend);
+    });
+        
+    return $row;
+}
+
+function makeFeatureInfoListLine(url, title, legendurls) {
+    return makeListLine(url, title, legendurls)
+}
+
+function makeOwnDataListLine(ownData) {
+    return makeListLine("#", ownData.title, [], function (e) {
+        ownDataWindow(ownData)
+        e.preventDefault();
+    });
+}
+
+function featureInfoListDialog(urls, ownDataInfos) {
+    var $featureInfoList = $("<table>")
+            .attr("border", 1);
+    
+    if (reverseInfo) {
+        urls.reverse();
+        ownDataInfos.reverse();
+        
+        ownDataInfos.forEach(function (ownDataInfo) {
+            $featureInfoList.append(makeOwnDataListLine(ownDataInfo));
+        });
+    }
+    
+    for(var i=0; i < urls.length; i++){
+        var $line;
+        if (featureInfoCollectLayers) { 
+            $line = makeFeatureInfoListLine(urls[i].request, urls[i].title, urls[i].legendurl.split(","));
+        } else {
+            if (urls[i].inBbox) {
+                if (urls[i].legendurl !== "empty" ) {
+                    $line = makeFeatureInfoListLine(urls[i].request, urls[i].title, [urls[i].legendurl]);
+                } else {
+                    $line = makeFeatureInfoListLine(urls[i].request, urls[i].title, [""]);
+                }
+            }
+        }
+        if ($line) {
+            $featureInfoList.append($line);
+        }
+    }
+    
+    if (!reverseInfo) {
+        ownDataInfos.forEach(function (ownDataInfo) {
+            $featureInfoList.append(makeOwnDataListLine(ownDataInfo));
+        });
+    }
+
+    makeDialog($("<div id='featureInfo_preselect'></div>").append($featureInfoList),
+        "<?php echo _mb("Please choose a requestable Layer");?>");
+}
+
 function mod_featureInfo_event(e){
+    var urls;
 	var point = mod_featureInfo_mapObj.getMousePosition(e);
+    //calculate realworld position
+    var realWorldPoint = Mapbender.modules[options.target].convertPixelToReal(point);
+    var ownDataInfos = [];
+    if (featureInfoShowKmlTreeInfo) {
+        if (Mapbender.modules.kmlTree === undefined) {
+            console.error('kmltree module is needed if element_var \'featureInfoShowKmlTreeInfo\' is set to true')
+        }
+        var kmlTree = Mapbender.modules.kmlTree;
+        ownDataInfos = kmlTree.getFeatureInfos(e);
+    }
 	if (featureInfoDrawClick) {
 		var map = Mapbender.modules[options.target];
 		if(standingHighlightFeatureInfo !== null){ 
@@ -139,24 +295,24 @@
 				{"position":"absolute", "top":"0px", "left":"0px", "z-index":100}, 
 				2);
 		}
-		//calculate realworld position
-		realWorldPoint = Mapbender.modules[options.target].convertPixelToReal(point);
 		//get coordinates from point
 		var ga = new GeometryArray();
 		//TODO set current epsg!
 		ga.importPoint({
 			coordinates:[realWorldPoint.x,realWorldPoint.y,null]
-		},Mapbender.modules[options.target].getSRS())
+		}, Mapbender.modules[options.target].getSRS())
 		var m = ga.get(-1,-1);
 		standingHighlightFeatureInfo.add(m, featureInfoCircleColor);
 		standingHighlightFeatureInfo.paint();
 		map.setMapRequest();
 	}
-	eventBeforeFeatureInfo.trigger({"fName":mod_featureInfo_target});
-	//TODO that code should go to featureInfo Redirect module
+	eventBeforeFeatureInfo.trigger({ "fName": mod_featureInfo_target });
 	if(document.getElementById("FeatureInfoRedirect")){
+        //TODO this code should go to featureInfo Redirect module
+        //FIXME this does not work for multiple urls
+        //FIXME this does not work for kmlTree
 		//fill the frames
-		for(var i=0; i<mod_featureInfo_mapObj.wms.length; i++){
+		for(var i=0; i < mod_featureInfo_mapObj.wms.length; i++){
 			var req = mod_featureInfo_mapObj.wms[i].getFeatureInfoRequest(mod_featureInfo_mapObj, point);
 			if(req)
 				window.frames.FeatureInfoRedirect.document.getElementById(mod_featureInfo_mapObj.wms[i].wms_id).src = req;
@@ -167,139 +323,64 @@
 		if (featureInfoLayerPreselect) {
 			$("#featureInfo_preselect").remove();
 			//build list of possible featureInfo requests
-			urls = mod_featureInfo_mapObj.getFeatureInfoRequestsForLayers(point, ignoreWms, Mapbender.modules[options.target].getSRS(), realWorldPoint, featureInfoCollectLayers);
-			if (urls.length == 0 || typeof urls.length =='undefined') {
+			urls = mod_featureInfo_mapObj.getFeatureInfoRequestsForLayers(point, ignoreWms, Mapbender.modules[options.target].getSRS(), realWorldPoint, featureInfoCollectLayers) || [];
+            var length = urls.length + ownDataInfos.length;
+			if (length === 0) {
 				alert("<?php echo _mb("Please enable some layer to be requestable");?>!");
 				return false;
 			}
-			if (urls.length == 1) {
+			if (length === 1) {
 				//don't show interims window!
 				//open featureInfo directly
-				if(featureInfoLayerPopup == 'true'){
-					$("<div><iframe frameborder='0' height='100%' width='100%' id='featureInfo' title='<?php echo _mb("Information");?>' src='" + urls[0].request + "'></iframe></div>").dialog({
-						bgiframe: true,
-						autoOpen: true,
-						modal: false,
-						title: '<?php echo _mb("Information");?>',
-						width:parseInt(featureInfoPopupWidth, 10),
-						height:parseInt(featureInfoPopupHeight, 10),
-						position:dialogPosition,
-						buttons: {
-							"Ok": function(){
-								$(this).dialog('close').remove();
-							}
-						}
-					}).parent().css({position:"fixed"});
+				if (featureInfoLayerPopup){
+                    if (urls.length === 1) {
+                        featureInfoDialog(urls[0].request);
+                    } else {
+                        ownDataDialog(ownDataInfos[0]);
+                    }
 					return false;
 				} else {
-					window.open(urls[0].request, "" , "width="+featureInfoPopupWidth+",height="+featureInfoPopupHeight+",scrollbars=yes,resizable=yes");
+                    if (urls.length === 1) {
+                        featureInfoWindow(urls[0].request);
+                    } else {
+                        ownDataWindow(ownDataInfos[0]);
+                    }
 					return false;
 				}
 			}
-			featureInfoList = "<table border='1'>";
-			if (reverseInfo == "true") {
-				for(var i=0;i<urls.length;i++){
-					if (featureInfoCollectLayers) { 
-						featureInfoList += "<tr><td valign='top'><a style='text-decoration:  underline' href='"+urls[i].request+"' target='_blank'>"+urls[i].title+"</a></td><td>";
-						//get legend urls if available
-						var legend = urls[i].legendurl.split(",");
-						for(var k=0;k<legend.length;k++){
-							featureInfoList +="<img src='"+legend[k]+"' alt='<?php echo _mb("No legend available");?>!'/><br>";
-						}
-						featureInfoList += "</td></tr>";
-					} else {
-						if (urls[i].inBbox) {
-							if (urls[i].legendurl !== "empty" ) {
-								featureInfoList += "<tr><td valign='top'><a style='text-decoration:  underline' href='"+urls[i].request+"' target='_blank'>"+urls[i].title+"</a></td><td><img src='"+urls[i].legendurl+"' alt='<?php echo _mb("No legend available");?>!'/></td></tr>";
-							} else {
-								featureInfoList += "<tr><td valign='top'><a style='text-decoration:  underline' href='"+urls[i].request+"' target='_blank'>"+urls[i].title+"</a></td><td><img src='' alt='<?php echo _mb("No legend available");?>!'/></td></tr>";
-							}
-						}
-
-					}
-				}
-			} else {
-				for(var i=urls.length-1; i>=0; i--){
-					if (featureInfoCollectLayers) { 
-						featureInfoList += "<tr><td valign='top'><a style='text-decoration:  underline' href='"+urls[i].request+"' target='_blank'>"+urls[i].title+"</a></td><td>";
-						//get legend urls if available
-						var legend = urls[i].legendurl.split(",");
-						for(var k=0;k<legend.length;k++){
-							featureInfoList +="<img src='"+legend[k]+"' alt='<?php echo _mb("No legend available");?>!'/><br>";
-						}
-						featureInfoList += "</td></tr>";
-					} else {
-						if (urls[i].inBbox) {
-							if (urls[i].legendurl !== "empty" ) {
-								featureInfoList += "<tr><td valign='top'><a style='text-decoration:  underline' href='"+urls[i].request+"' target='_blank'>"+urls[i].title+"</a></td><td><img src='"+urls[i].legendurl+"' alt='<?php echo _mb("No legend available");?>!'/></td></tr>";
-							} else {
-								featureInfoList += "<tr><td valign='top'><a style='text-decoration:  underline' href='"+urls[i].request+"' target='_blank'>"+urls[i].title+"</a></td><td><img src='' alt='<?php echo _mb("No legend available");?>!'/></td></tr>";
-							}
-						}
-					}
-				}
-			}
-			featureInfoList += "</table>";
-			$("<div id='featureInfo_preselect'></div>").dialog({
-				bgiframe: true,
-				autoOpen: true,
-				modal: false,
-				title: '<?php echo _mb("Please choose a requestable Layer");?>',
-				width:parseInt(featureInfoPopupWidth, 10),
-				height:parseInt(featureInfoPopupHeight, 10),
-				position:dialogPosition,
-				buttons: {
-					"Close": function(){
-						if(standingHighlightFeatureInfo !== null){ 
-							standingHighlightFeatureInfo.clean();
-						}
-						$(this).dialog('close').remove();
-					}
-				}
-			}).parent().css({position:"fixed"});
-			$("#featureInfo_preselect").append(featureInfoList);
+			featureInfoListDialog(urls, ownDataInfos);
 		} else {
-			urls = mod_featureInfo_mapObj.getFeatureInfoRequests(point, ignoreWms);
-			if(urls){
-				for(var i=0;i<urls.length;i++){ //To change order : var i=urls.length-1; i>=0; i--
+			urls = mod_featureInfo_mapObj.getFeatureInfoRequests(point, ignoreWms) || [];
+            var length = urls.length + ownDataInfos.length;
+			if (length > 0){
+				for (var i=0; i < urls.length; i++){
 					//TODO: also rewind the LAYERS parameter for a single WMS FeatureInfo REQUEST if needed?
-					var cnt = i;
-					if (reverseInfo == 'true') {
+					if (reverseInfo) {
 						if (typeof(urls[i]) !== "undefined") {
 							urls[i] = changeURLValueOrder(urls[i], 'LAYERS');
 						}
 					}
-					if(featureInfoPopupPosition.length == 2 && !isNaN(featureInfoPopupPosition[0]) && !isNaN(featureInfoPopupPosition[1])) {
-						var dialogPosition = [];
-						dialogPosition[0] = featureInfoPopupPosition[0]+cnt*25;
-						dialogPosition[1] = featureInfoPopupPosition[1]+cnt*25;
+					if(featureInfoLayerPopup){
+                        featureInfoDialog(urls[i], dialogPosition, i * 25);
 					}
 					else {
-						var dialogPosition = featureInfoPopupPosition;
+                        featureInfoWindow(urls[i]);
+                    }
+				}
+                
+                for(var i=0; i < ownDataInfos.length; i++){
+					if(featureInfoLayerPopup === 'true'){
+                        ownDataDialog(ownDataInfos[i], dialogPosition, (urls.length + i) * 25);
 					}
-					if(featureInfoLayerPopup == 'true'){
-						$("<div><iframe frameborder='0' height='100%' width='100%' id='featureInfo_"+ i + "' title='<?php echo _mb("Information");?>' src='" + urls[i] + "'></iframe></div>").dialog({
-							bgiframe: true,
-							autoOpen: true,
-							modal: false,
-							title: '<?php echo _mb("Information");?>',
-							width:parseInt(featureInfoPopupWidth, 10),
-							height:parseInt(featureInfoPopupHeight, 10),
-							position:dialogPosition,
-							buttons: {
-								"Ok": function(){
-									$(this).dialog('close').remove();
-								}
-							}
-						}).parent().css({position:"fixed"});
-					}
-					else
-						window.open(urls[i], "" , "width="+featureInfoPopupWidth+",height="+featureInfoPopupHeight+",scrollbars=yes,resizable=yes");		
-				} //end for
-			} //end if urls
-			else
+					else {
+                        ownDataWindow(ownDataInfos[i]);
+                    }
+				}
+			}
+			else {
 				alert(unescape("Please select a layer! \n Bitte waehlen Sie eine Ebene zur Abfrage aus!"));
+            }
 		}
-		setFeatureInfoRequest(mod_featureInfo_target,point.x,point.y);
+		setFeatureInfoRequest(mod_featureInfo_target, point.x, point.y);
 	}
 }

Modified: trunk/mapbender/http/javascripts/mod_pan.js
===================================================================
--- trunk/mapbender/http/javascripts/mod_pan.js	2019-09-12 15:43:37 UTC (rev 10244)
+++ trunk/mapbender/http/javascripts/mod_pan.js	2019-09-13 10:26:42 UTC (rev 10245)
@@ -94,6 +94,7 @@
                 .mouseleave(moveend);
 		},
 		stop: function () {
+			$("#pan1").removeClass("myOnClass");
 			if (!map) {
 				return false;
 			}
@@ -108,7 +109,7 @@
 	});
     
     // deactivate if ui-dialog opens
-    $(document).bind('dialogopen', function () {
-        button.stop();
-    });
+    // $(document).bind('dialogopen', function () {
+    //    button.stop()
+    // });
 });

Modified: trunk/mapbender/http/javascripts/mod_savewmc.js
===================================================================
--- trunk/mapbender/http/javascripts/mod_savewmc.js	2019-09-12 15:43:37 UTC (rev 10244)
+++ trunk/mapbender/http/javascripts/mod_savewmc.js	2019-09-13 10:26:42 UTC (rev 10245)
@@ -361,11 +361,31 @@
 			attributes.keywords = $("#" + options.id + "_wmckeywords").val();
 			attributes.isoTopicCat = isoTopicCat;
 
-			if(!attributes.title.match(/^[a-zA-Z0-9]+$/) || !attributes.abstract.match(/^[a-zA-Z0-9]+$/) || !attributes.keywords.match(/^[a-zA-Z0-9]+$/)){
-                               alert("Allowed characters are: A-Z, a-z, 0-9, -, _");
-                               return;
-                        }
+			if(attributes.title != ""){
+				if(!attributes.title.match(/^[a-zA-Z0-9]+$/)){
+                               		alert("Allowed characters for title are: A-Z, a-z, 0-9, -, _");
+                               		return;
+                        	}
+			}else{
+				alert("Please fill out title!");
+				return;
+			}
 
+			if(attributes.abstract != ""){
+				if(!attributes.abstract.match(/^[a-zA-Z0-9]+$/)){
+                               		alert("Allowed characters for abstract are: A-Z, a-z, 0-9, -, _");
+                               		return;
+				}
+			}	
+
+
+			if(attributes.keywords != ""){
+				if(!attributes.keywords.match(/^[a-zA-Z0-9]+$/)){
+                               		alert("Allowed characters for keywords are: A-Z, a-z, 0-9, -, _");
+                               		return;
+				}
+			}
+
 			if (!!attributes.title) {
 				sendMapDataToServer(attributes, 0, (function(result, status, message) {
 					alert(message);
@@ -396,15 +416,20 @@
 	//
 
 	$this.click(function () {
+		$('#savewmc').toggleClass('myOnClass');
+		$('#toolsContainer').hide() && $('a.toggleToolsContainer').removeClass('activeToggle');
+		$('#tree2Container').hide('fast') && $('a.toggleLayerTree').removeClass('activeToggle');
 		mod_savewmc();
 	}).mouseover(function () {
 		if (options.src) {
 			this.src = options.src.replace(/_off/, "_over");
 		}
+		$('#savewmc').addClass('myOverClass');
 	}).mouseout(function () {
 		if (options.src) {
 			this.src = options.src;
 		}
+		$('#savewmc').removeClass('myOverClass');
 	});
 	Mapbender.events.afterInit.register(function(){
 		//check if wmc should be saved into session
@@ -486,7 +511,7 @@
 			bgiframe: true,
 			autoOpen: false,
 			height: 400,
-			width: 500,
+			width: 400,
 			modal: false,
 			beforeclose: function (event, ui) {
 				try {
@@ -498,6 +523,7 @@
 					new Mb_warning("jq_ui_effect is missing.");
 				}
 			},
+			close: function() {$('#savewmc').toggleClass('myOnClass')},
 			buttons: getButtons()
 		});
 		// set uuid

Modified: trunk/mapbender/http/javascripts/mod_selArea.js
===================================================================
--- trunk/mapbender/http/javascripts/mod_selArea.js	2019-09-12 15:43:37 UTC (rev 10244)
+++ trunk/mapbender/http/javascripts/mod_selArea.js	2019-09-13 10:26:42 UTC (rev 10245)
@@ -76,7 +76,8 @@
             .mouseup(mouseup);
         },
         stop: function () {
-            if (!map) {
+            $("#selArea1").removeClass("myOnClass");
+	    if (!map) {
                 return;
             }
             $(map.getDomElement())
@@ -86,4 +87,4 @@
             box = null;
         }
     });
-});
\ No newline at end of file
+});

Modified: trunk/mapbender/http/plugins/mb_button.js
===================================================================
--- trunk/mapbender/http/plugins/mb_button.js	2019-09-12 15:43:37 UTC (rev 10244)
+++ trunk/mapbender/http/plugins/mb_button.js	2019-09-13 10:26:42 UTC (rev 10245)
@@ -54,7 +54,7 @@
 var $button = $(this);
 
 var ButtonApi = function (o) {
-    o.position = o.position || 'center';
+	o.position = o.position || 'center';
 	var that = this;
 	var target = (o.$target && o.$target.jquery && o.$target.size() === 1) ?
 		o.$target : $([]);
@@ -64,16 +64,18 @@
 		left: "auto"
 	}).hide().dialog({
 		autoOpen: false,
-		position: o.position,
-                dialogClass: o.target + "-dialog"
+		 position: [o.$target.offset().left+20, o.$target.offset().top+80],
+                dialogClass: o.target + "-dialog",
+		close: function() {$button.removeClass("myOnClass");button.stop();}
         });
 
         var openDialog = function () {
-//alert("try to open dialog: o.target: "+JSON.stringify(o));
 		dialog.dialog("open");
 		dialog.dialog({ height: options.dialogHeight });
 		dialog.dialog({ width: options.dialogWidth });
-		button.stop();
+		$('#toolsContainer').hide('fast') && $('a.toggleToolsContainer').removeClass('activeToggle');
+		$('#tree2Container').hide('fast') && $('a.toggleLayerTree').removeClass('activeToggle');
+		$('.ui-dialog').css('top', '80px');$('.ui-dialog').css('left', '20px');;
 	};
 
 	var button = new Mapbender.Button({
@@ -83,6 +85,7 @@
 		off: o.src,
 		name: o.id,
 		go: openDialog
+		
 	});
 };
 

Modified: trunk/mapbender/http/plugins/mb_digitize_widget.php
===================================================================
--- trunk/mapbender/http/plugins/mb_digitize_widget.php	2019-09-12 15:43:37 UTC (rev 10244)
+++ trunk/mapbender/http/plugins/mb_digitize_widget.php	2019-09-13 10:26:42 UTC (rev 10245)
@@ -267,7 +267,7 @@
         digitizeDialog = $(digitizeHtml);
         digitizeDialog.dialog({
             autoOpen: false,
-            position: [o.$target.offset().left, o.$target.offset().top]
+            position: [o.$target.offset().left+20, o.$target.offset().top+80]
         }).bind("dialogclose", function () {
             button.stop();
             $(this).find('.digitize-image').unbind('click');
@@ -276,7 +276,7 @@
         editDialog = $(editHtml);
         editDialog.dialog({
             autoOpen: false,
-            position: [o.$target.offset().left, o.$target.offset().top]
+            position: [o.$target.offset().left+20, o.$target.offset().top+80]
         }).bind("dialogclose", function () {
             button.stop();
             $(this).find('.digitize-image').unbind('click');
@@ -288,7 +288,7 @@
         copyDialog = $(copyHtml);
         copyDialog.dialog({
             autoOpen: false,
-            position: [o.$target.offset().left, o.$target.offset().top]
+            position: [o.$target.offset().left+20, o.$target.offset().top+80]
         }).bind("dialogclose", function () {
             button.stop();
             that.destroy();
@@ -297,7 +297,7 @@
         labelDialog = $(labelHtml);
         labelDialog.dialog({
             autoOpen: false,
-            position: [o.$target.offset().left, o.$target.offset().top]
+            position: [o.$target.offset().left+20, o.$target.offset().top+80]
         }).bind("dialogclose", function () {
             button.stop();
             that.destroy();
@@ -307,7 +307,7 @@
         attributesDialog = $(editAttributesHtml);
         attributesDialog.dialog({
             autoOpen: false,
-            position: [o.$target.offset().left, o.$target.offset().top],
+            position: [o.$target.offset().left+20, o.$target.offset().top+80],
             width: 400
         }).bind("dialogclose", function () {
             button.stop();
@@ -326,7 +326,7 @@
         editStyleDialog = $(editStyleHtml);
         editStyleDialog.dialog({
             autoOpen: false,
-            position: [o.$target.offset().left, o.$target.offset().top],
+            position: [o.$target.offset().left+20, o.$target.offset().top+80],
             width: 400,
             height: 260
         }).bind('dialogclose', function() {

Modified: trunk/mapbender/http/plugins/mb_measure_widget.php
===================================================================
--- trunk/mapbender/http/plugins/mb_measure_widget.php	2019-09-12 15:43:37 UTC (rev 10244)
+++ trunk/mapbender/http/plugins/mb_measure_widget.php	2019-09-13 10:26:42 UTC (rev 10245)
@@ -122,8 +122,10 @@
 		//
 		measureDialog = $(defaultHtml);
 		measureDialog.dialog({
+			width: 350,
 			autoOpen: false,
-			position: [o.$target.offset().left, o.$target.offset().top]
+			position: [o.$target.offset().left+20, o.$target.offset().top+80],
+			close: function (){$('#measure_widget').removeClass('myOnClass')}
 		}).bind("dialogclose", function () {
 			button.stop();
 			that.destroy();
@@ -297,6 +299,7 @@
 		}
 
 		measureDialog.dialog("open");
+		$('#toolsContainer').hide() && $('a.toggleToolsContainer').removeClass('activeToggle');
 	};
 
 	this.destroy = function () {

Modified: trunk/mapbender/lib/button.js
===================================================================
--- trunk/mapbender/lib/button.js	2019-09-12 15:43:37 UTC (rev 10244)
+++ trunk/mapbender/lib/button.js	2019-09-13 10:26:42 UTC (rev 10245)
@@ -120,11 +120,13 @@
    if(mb_button[ind].status === 0){
       mb_button[ind].prev = mb_button[ind].src;
       mb_button[ind].src = mb_button[ind].img_over;
+	$(mb_button[ind]).addClass('myOverClass');
    }
 }
 function mb_button_out(ind){
    if(mb_button[ind].status === 0){
    		mb_button[ind].src = mb_button[ind].img_off;
+		$(mb_button[ind]).removeClass('myOverClass');
    }
 }
 function mb_button_click(ind){
@@ -134,6 +136,8 @@
       mb_button[ind].prev = mb_button[ind].img_on;
       mb_button[ind].src = mb_button[ind].img_on;
       mb_button[ind].status = 1;
+      $(mb_button[ind]).removeClass('myOverClass');
+      $(mb_button[ind]).addClass('myOnClass');
       if (mb_button[ind].frameName !== "") {
           window.frames[mb_button[ind].frameName].document.getElementById(mb_button[ind].elName).go();
       }
@@ -144,8 +148,10 @@
    else{
       mb_button[ind].prev = mb_button[ind].img_off;
       mb_button[ind].src = mb_button[ind].img_off;
-      mb_button[ind].status = 0;      
+      mb_button[ind].status = 0;
+      $(mb_button[ind]).removeClass('myOnClass');
       if (mb_button[ind].frameName !== "") {
+
           window.frames[mb_button[ind].frameName].document.getElementById(mb_button[ind].elName).stop();
       }
       else {

Modified: trunk/mapbender/lib/mb.ui.displayKmlFeatures.js
===================================================================
--- trunk/mapbender/lib/mb.ui.displayKmlFeatures.js	2019-09-12 15:43:37 UTC (rev 10244)
+++ trunk/mapbender/lib/mb.ui.displayKmlFeatures.js	2019-09-13 10:26:42 UTC (rev 10245)
@@ -57,54 +57,39 @@
             self.render();
         });
 
-        this.element.bind('click', function(e) {
-            if (self.lastWasBox) {
-                self.lastWasBox = false;
-                return;
-            }
-            var map = self.element.mapbender();
-            var pos = map.getMousePosition(e);
-            var clickPoint = map.convertPixelToReal(new Point(pos.x, pos.y));
-            var wgspt = Proj4js.transform(self.targetProj, self.wgs84, {
-                x: clickPoint.x,
-                y: clickPoint.y
-            });
-            var res = map.getScale() / mb_resolution / 100;
+        var delta = 2;
+        var lastX, lastY;
+        var box;
 
+        this.element.bind('mousedown', function(e) {
             if (!self.queriedLayer) return;
-            var matchedIds = self.findFeatures(pos);
-
-            self.updateSelectedFeatures(matchedIds, e.ctrlKey);
-        });
-
-        var boxfun;
-
-        this.element.bind('mousedown', boxfun = function(e) {
-            if (!self.queriedLayer) return;
-            var box = new Mapbender.Box({
+            lastX = e.clientX;
+            lastY = e.clientY;
+            box = new Mapbender.Box({
                 target: 'mapframe1'
             });
             box.start(e);
             $('#mapframe1').css("cursor", "crosshair")
-                .mouseup(function(e) {
-                    box.stop(e, function(extent) {
-                        if (typeof extent === "undefined") {
-                            return;
-                        }
+        });
+            
+        $('#mapframe1').mouseup(function(e) {
+            if (!self.queriedLayer) return;
+            var matchedIds;
+            var extent = box.stop(e);
+            $('#mapframe1').css("cursor", "default");
+            if (Math.abs(lastX - e.clientX) <= delta && Math.abs(lastY - e.clientY) <= delta) {
+                // click
+                matchedIds = self.findFeaturesAtClick(e);
+            } else {
+                // drag
+                if (typeof extent === "undefined") {
+                    return;
+                }
 
-                        var matchedIds = self.findFeatures(extent);
-                        self.updateSelectedFeatures(matchedIds, e.ctrlKey);
-                        self.lastWasBox = true;
-
-                        $('#mapframe1')
-                            .css("cursor", "default")
-                            .unbind("mousedown")
-                            .unbind("mouseup")
-                            .unbind("mousemove")
-                            .bind('mousedown', boxfun);
-                    });
-                    return false;
-                });
+                matchedIds = self.findFeaturesInExtent(extent);
+            }
+            self.updateSelectedFeatures(matchedIds, e.ctrlKey);
+            return false;
         });
 
         self.element.bind('kml:loaded', function(event, obj) {
@@ -149,95 +134,90 @@
             self._load(o.url);
         }
     },
-
-    findFeatures: function(posOrBox) {
-        var matchedIds = [];
-
-        var self = this;
-        var map = self.element.mapbender();
-        var ispoint;
-        var clickPoint, wgspt, clickBox, min, max;
-        if (posOrBox.x) {
-            clickPoint = map.convertPixelToReal(new Point(posOrBox.x, posOrBox.y));
-            wgspt = Proj4js.transform(self.targetProj, self.wgs84, {
-                x: clickPoint.x,
-                y: clickPoint.y
-            });
-            ispoint = true;
+    
+    /**
+     * Check if the point lies inside the box.
+     * @param {type} point
+     * @param {type} box
+     * @returns {Boolean}
+     */
+    pointInBox: function (point, box) {
+        if (point.x >= box.minx && point.x <= box.maxx 
+                && point.y >= box.miny && point.y <= box.maxy) {
+            return true;
         } else {
-            clickBox = posOrBox;
-            min = Proj4js.transform(self.targetProj, self.wgs84, {
-                x: clickBox.minx,
-                y: clickBox.miny
-            });
-            max = Proj4js.transform(self.targetProj, self.wgs84, {
-                x: clickBox.maxx,
-                y: clickBox.maxy
-            });
-            ispoint = false;
+            return false;
         }
-        var res = map.getScale() / mb_resolution / 100;
+    },
 
-        $.each(self._kmls, function(_, itm) {
-            $.each(itm.data.features, function(k, v) {
-                if (ispoint) {
-                    //console.log( "isPoint" );
-                    self.matchFeatureToPoint(v, clickPoint, matchedIds, res, itm, wgspt, k);
-                } else {
-                    self.matchFeatureToBox(v, {
-                        min: min,
-                        max: max
-                    }, matchedIds, itm, k);
-                }
-            });
-        });
-        return matchedIds;
+    /**
+     * Checks if value x is between y1 and y2. It works also if y2 < y1.
+     * @param {type} x
+     * @param {type} y1
+     * @param {type} y2
+     * @returns {Number}
+     */
+    valueIsBetween: function (x, y1, y2) {
+        return (y1 - x) * (y2 - x) <= 0;
     },
 
+    /**
+     * calculates the Y value of line for a given X.
+     * @param {type} line
+     * @param {type} y
+     * @returns {Number}
+     */
+    lineYAtX: function (line, x) {
+        return line.y2 + (x - line.x2) * (line.y1 - line.y2) / (line.x1 - line.x2) 
+    },
 
-    inBox: function(minx, miny, maxx, maxy, selectBoxMinx, selectBoxMaxx, selectBoxMiny, selectBoxMaxy) {
+    /**
+     * calculates the X value of line for a given Y.
+     * @param {type} line
+     * @param {type} y
+     * @returns {Number}
+     */
+    lineXAtY: function (line, y) {
+        return line.x2 + (y - line.y2) * (line.x1 - line.x2) / (line.y1 - line.y2) 
+    },
 
-        // ############## proof the min-point ##################
-        // proof hit on the x-axis
-        if ( ( minx >= selectBoxMinx && minx <= selectBoxMaxx ) ) {
-            // if x hit, proof y
-            if ( ( miny >= selectBoxMiny && miny <= selectBoxMaxy ) ) {
-                return true;
-            }
+    /**
+     * First checks if line is completely contained inside of the box. If not it checks
+     * if one of the sides of the box intersects with the line.
+     * @param {type} line
+     * @param {type} box
+     * @returns {Boolean}
+     */
+    lineIntersectsBox: function (line, box) {
+        if (this.pointInBox({ x: line.x1, y: line.y1 }, box)
+                || this.pointInBox({ x: line.x1, y: line.y1 }, box)) {
+            return true;
         }
-        // proof hit on the y-axis
-        if ( ( miny >= selectBoxMiny && miny <= selectBoxMaxy ) ) {
-            // if y hit, proof x
-            if ( ( minx >= selectBoxMinx && minx <= selectBoxMaxx ) ) {
+
+        if (this.valueIsBetween(box.minx, line.x1, line.x2)) {
+            var y = this.lineYAtX(line, box.minx);
+            if (y >= box.miny && y <= box.maxy) {
                 return true;
             }
         }
-        // ############## proof the max-point ##################
-        if ( ( maxx >= selectBoxMinx && maxx <= selectBoxMaxx ) ) {
-            // if x hit, proof y
-            if ( ( maxy >= selectBoxMiny && maxy <= selectBoxMaxy ) ) {
-                return true;
-            }
-        }
 
-        if ( ( maxy >= selectBoxMiny && maxy <= selectBoxMaxy ) ) {
-            // if y hit, proof x
-            if ( ( maxx >= selectBoxMinx && maxx <= selectBoxMaxx ) ) {
+        if (this.valueIsBetween(box.maxx, line.x1, line.x2)) {
+            var y = this.lineYAtX(line, box.maxx);
+            if (y >= box.miny && y <= box.maxy) {
                 return true;
             }
         }
-        // ############## proof if selectbox contains the feature geometry   ##################
-        // proof on x-axis
-        if (  minx >= selectBoxMinx && minx <= selectBoxMaxx  && maxx >= selectBoxMinx && maxx <= selectBoxMaxx ) {
 
-            if ( miny <= selectBoxMiny && maxy >= selectBoxMaxy ) {
+        if (this.valueIsBetween(box.miny, line.y1, line.y2)) {
+            var x = this.lineXAtY(line, box.miny);
+            if (x >= box.minx && x <= box.maxx) {
                 return true;
             }
         }
-        // proof on y-axis
-        if (  miny >= selectBoxMiny && miny <= selectBoxMaxy  && maxy >= selectBoxMiny && maxx <= selectBoxMaxy ) {
 
-            if ( minx <= selectBoxMinx && maxx >= selectBoxMaxx ) {
+        if (this.valueIsBetween(box.maxy, line.y1, line.y2)) {
+            var x = this.lineXAtY(line, box.maxy);
+            if (x >= box.minx && x <= box.maxx) {
                 return true;
             }
         }
@@ -244,92 +224,209 @@
 
         return false;
     },
+   
+    getLines: function (points, connect) {
+        lines = [];
+        for (var i = 0; i < points.length - 1; i ++) {
+            lines.push({
+                x1: points[i][0],
+                y1: points[i][1],
+                x2: points[i + 1][0],
+                y2: points[i + 1][1]
+            });
+        }
+        if (connect) {
+            lines.push({
+                x1: points[points.length - 1][0],
+                y1: points[points.length - 1][1],
+                x2: points[0][0],
+                y2: points[0][1]
+            })
+        }
+        return lines;
+    },
+   
+    lineStringIntersectsBox: function (lineStringPoints, box) {
+        var self = this;
+        return this.getLines(lineStringPoints).some(function (line) {
+            return self.lineIntersectsBox(line, box);
+        });
+    },
 
-    pointInBox: function(pointX, pointY, selectBoxMinx, selectBoxMaxx, selectBoxMiny, selectBoxMaxy) {
+    /**
+     * Checks whether a polygon intersects a box.
+     * On the one hand it checks if any of the lines on the polygon ring intersect
+     * with the box and on the other hand it checks how many times a ray cast outwards
+     * from the middle of the box intersects with one of the lines. If it intersects
+     * an odd number of times it lays inside the polygon.
+     * @param {type} polygon
+     * @param {type} box
+     * @returns {Boolean}
+     */
+    polygonIntersectsBox: function (polygonRings, box) {
+        var rayPoint = {
+            x: box.minx + (box.maxx - box.minx) / 2,
+            y: box.miny + (box.maxy - box.miny) / 2
+        };
+        var rayIntersections = 0;
 
-        if ( ( pointX >= selectBoxMinx && pointX <= selectBoxMaxx ) && ( pointY >= selectBoxMiny && pointY <= selectBoxMaxy )) {
+        var self = this;
+        var lines = polygonRings.reduce(function (lines, ring) {
+            Array.prototype.push.apply(lines, self.getLines(ring, true));
+            return lines;
+        }, [])
+
+        for (var i = 0; i < lines.length; i++) {
+            if (this.lineIntersectsBox(lines[i], box)) {
+                return true;
+            }
+            if (this.valueIsBetween(rayPoint.y, lines[i].y1, lines[i].y2)) {
+                var x = this.lineXAtY(lines[i], rayPoint.y);
+                if (x >= rayPoint.x) {
+                    rayIntersections++;
+                }
+            }
+        }
+
+        if (rayIntersections % 2 === 1) {
             return true;
+        } else {
+            return false;
         }
     },
-
-    matchFeatureToPoint: function(feat, clickPoint, matchedIds, res, itm, wgspt, idx) {
-        //console.log( "point" );
-        if (feat.geometry.type.match(/point/i)) {
-            var pt = Proj4js.transform(this.wgs84, this.targetProj, {
-                x: feat.geometry.coordinates[0],
-                y: feat.geometry.coordinates[1]
-            });
-            var minx = pt.x - 20 * res;
-            var miny = pt.y - 20 * res;
-            var maxx = minx + 40 * res;
-            var maxy = miny + 40 * res;
-            if (minx < clickPoint.x && maxx > clickPoint.x && miny < clickPoint.y && maxy > clickPoint.y) {
-                matchedIds.push({
-                    url: itm.url,
-                    id: idx
-                });
-            }
+   
+    boxInBox: function (boxA, boxB) {
+         return this.pointInBox({ x: boxA.minx, y: boxA.miny }, boxB) &&
+              this.pointInBox({ x: boxA.maxx, y: boxA.maxy }, boxB);
+    },
+    
+    
+    /**
+     * Checks whether the geometry of the feature intersects with the box
+     * @param {type} feature
+     * @param {type} box
+     * @returns {Boolean}
+     */
+    featureIntersectsBox: function (feature, box) {
+        var geometryType = feature.geometry.type.toLowerCase();
+        switch (geometryType) {
+            case 'point':
+                return this.pointInBox({
+                    x: feature.geometry.coordinates[0],
+                    y: feature.geometry.coordinates[1]
+                }, box);
+            case 'linestring':
+                return this.lineStringIntersectsBox(feature.geometry.coordinates, box);
+            case 'polygon':
+                return this.polygonIntersectsBox(feature.geometry.coordinates, box);
+            default:
+              throw new Error('feature geometry type not supported');  
+        }
+    },
+    
+    featureInBox: function (feature, box) {
+        if (feature.geometry.type.toLowerCase() === 'point') {
+            return this.pointInBox({
+                x: feature.geometry.coordinates[0],
+                y: feature.geometry.coordinates[1]
+            }, box);
         } else {
-            var box = this.getBbox(feat);
-            if (this.inBox(box[0], box[1], box[2], box[3], wgspt.x, wgspt.y)) {
-                matchedIds.push({
-                    url: itm.url,
-                    id: idx
-                });
+            var arrayBox = this.getBbox(feature);
+            return this.boxInBox({
+                minx: arrayBox[0],
+                miny: arrayBox[1],
+                maxx: arrayBox[2],
+                maxy: arrayBox[3]
+            }, box);
+        }
+    },
+    
+    
+    
+    /**
+     * Finds all features that intersect with a buffer around a point or a given box.
+     * @param {type} posOrBox
+     * @returns {Array|displayFeatures.findIntersectingFeatures.ids}
+     */
+    findFeaturesAtClick: function (e) {
+        var map = this.element.mapbender();
+        var pos = map.getMousePosition(e);
+        
+        var min = {
+            x: pos.x - 20,
+            y: pos.y + 20 // screen y is in opposite direction of map y
+        };
+        var max = {
+            x: pos.x + 20,
+            y: pos.y - 20
+        };
+        
+        min = map.convertPixelToReal(min);
+        max = map.convertPixelToReal(max);
+        
+        min = Proj4js.transform(this.targetProj, this.wgs84, min);
+        max = Proj4js.transform(this.targetProj, this.wgs84, max);
+        
+        var box = {
+            minx: min.x,
+            miny: min.y,
+            maxx: max.x,
+            maxy: max.y
+        };
+        
+        var self = this;
+        var matches = [];
+        for (var kmlId in this._kmls) {
+            if (this._kmls.hasOwnProperty(kmlId)) {
+                var kml = this._kmls[kmlId];
+                matches = kml.data.features.reduce(function (matches, feature, index) {
+                    if (self.featureIntersectsBox(feature, box)) {
+                        matches.push({
+                            url: kml.url,
+                            id: index
+                        });
+                    }
+                    return matches;
+                }, matches);
             }
         }
+        return matches;
     },
 
-    matchFeatureToBox: function(feat, wgsbox, matchedIds, itm, idx) {
-        if (feat.geometry.type.match(/point/i)) {
-            //console.log( feat.geometry );
-            if (this.pointInBox(feat.geometry.coordinates[0], feat.geometry.coordinates[1], wgsbox.min.x, wgsbox.max.x, wgsbox.min.y, wgsbox.max.y)) {
-                matchedIds.push({
-                    url: itm.url,
-                    id: idx
-                });
+    findFeaturesInExtent: function(extent) {
+        var min = Proj4js.transform(this.targetProj, this.wgs84, {
+            x: extent.minx,
+            y: extent.miny
+        });
+        var max = Proj4js.transform(this.targetProj, this.wgs84, {
+            x: extent.maxx,
+            y: extent.maxy
+        });
+        
+        var box = {
+            minx: min.x,
+            miny: min.y,
+            maxx: max.x,
+            maxy: max.y
+        };
+        
+        var matches = [];
+        var self = this;
+        for (var kmlId in this._kmls) {
+            if (this._kmls.hasOwnProperty(kmlId)) {
+                var kml = this._kmls[kmlId];
+                matches = kml.data.features.reduce(function (matches, feature, index) {
+                    if (self.featureInBox(feature, box)) {
+                        matches.push({
+                            url: kml.url,
+                            id: index
+                        });
+                    }
+                    return matches;
+                }, matches);
             }
-        } else {
-            var box = this.getBbox(feat);
-            if (this.inBox(box[0], box[1], box[2], box[3], wgsbox.min.x, wgsbox.max.x, wgsbox.min.y, wgsbox.max.y) ) {
-                matchedIds.push({
-                    url: itm.url,
-                    id: idx
-                });
-                return;
-            }
-            if ( this.inBox(box[0], box[1], box[2], box[3], wgsbox.min.x, wgsbox.max.x, wgsbox.min.x, wgsbox.max.x) ) {
-                matchedIds.push({
-                    url: itm.url,
-                    id: idx
-                });
-            }
-            // if (wgsbox.min.x < box[0] && wgsbox.max.x > box[2]) {
-            //     if (wgsbox.min.y > box[1] && wgsbox.min.y < box[3] || wgsbox.max.y > box[1] && wgsbox.max.y < box[3]) {
-            //         matchedIds.push({
-            //             url: itm.url,
-            //             id: idx
-            //         });
-            //         return;
-            //     }
-            // }
-            // if (wgsbox.min.y < box[1] && wgsbox.max.y > box[3]) {
-            //     if (wgsbox.min.x > box[0] && wgsbox.min.x < box[2] || wgsbox.max.x > box[0] && wgsbox.max.x < box[2]) {
-            //         matchedIds.push({
-            //             url: itm.url,
-            //             id: idx
-            //         });
-            //         return;
-            //     }
-            // }
-            // if (wgsbox.min.x < box[0] && wgsbox.max.x > box[2] && wgsbox.min.y > box[1] && wgsbox.max.y < box[3]) {
-            //     matchedIds.push({
-            //         url: itm.url,
-            //         id: idx
-            //     });
-            //     return;
-            // }
         }
+        return matches;
     },
 
     updateSelectedFeatures: function(ids, append) {
@@ -735,8 +832,6 @@
                 }
             },
             error: function(XMLHttpRequest, textStatus, errorThrown) {
-
-
                 self.element.trigger('kml:error', "Problem talking to server: " + errorThrown);
             }
         });
@@ -841,7 +936,6 @@
     getBbox: function(feature) {
         switch (feature.geometry.type.toLowerCase()) {
             case 'point':
-                var map = $(this.element).mapbender();
                 var minx = feature.geometry.coordinates[0] - 0.001;
                 var miny = feature.geometry.coordinates[1] - 0.001;
                 return [minx, miny, minx + 0.002, miny + 0.002];

Modified: trunk/mapbender/resources/db/pgsql/UTF-8/update/update_2.8_pgsql_UTF-8.sql
===================================================================
--- trunk/mapbender/resources/db/pgsql/UTF-8/update/update_2.8_pgsql_UTF-8.sql	2019-09-12 15:43:37 UTC (rev 10244)
+++ trunk/mapbender/resources/db/pgsql/UTF-8/update/update_2.8_pgsql_UTF-8.sql	2019-09-13 10:26:42 UTC (rev 10245)
@@ -132,4 +132,6 @@
 ALTER FUNCTION f_simple_alter_service_operation_url(character varying, character varying, character varying)
   OWNER TO postgres;
 
+-- 2019-09-13 - update css to have a nicer default gui!
+update gui_element set e_width=null, e_height=null where e_id = 'body' AND fkey_gui_id IN ( 'Administration_DE', 'PortalAdmin_DE', 'admin1');
 



More information about the Mapbender_commits mailing list