[Mapbender-commits] r2915 - in branches/nimix_dev: . conf http/classes http/extensions http/img/button_digitize http/javascripts http/php http/print lib resources/db/mysql resources/db/pgsql

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Fri Sep 5 04:16:08 EDT 2008


Author: nimix
Date: 2008-09-05 04:16:07 -0400 (Fri, 05 Sep 2008)
New Revision: 2915

Added:
   branches/nimix_dev/http/img/button_digitize/mergePolygons_off.png
   branches/nimix_dev/http/img/button_digitize/mergePolygons_on.png
   branches/nimix_dev/http/img/button_digitize/mergePolygons_over.png
   branches/nimix_dev/http/img/button_digitize/splitPolygon_off.png
   branches/nimix_dev/http/img/button_digitize/splitPolygon_on.png
   branches/nimix_dev/http/img/button_digitize/splitPolygon_over.png
   branches/nimix_dev/http/php/mod_digitize_mergePolygon.php
   branches/nimix_dev/http/php/mod_digitize_splitPolygon.php
Modified:
   branches/nimix_dev/conf/digitize_default.conf
   branches/nimix_dev/http/classes/class_gml2.php
   branches/nimix_dev/http/extensions/ext_featureInfoTunnel.php
   branches/nimix_dev/http/javascripts/geometry.js
   branches/nimix_dev/http/javascripts/map.js
   branches/nimix_dev/http/javascripts/mod_digitize_tab.php
   branches/nimix_dev/http/javascripts/mod_dragMapSize.php
   branches/nimix_dev/http/javascripts/mod_sandclock.php
   branches/nimix_dev/http/javascripts/mod_tab.js
   branches/nimix_dev/http/javascripts/mod_wfs_SpatialRequest.php
   branches/nimix_dev/http/javascripts/mod_wfs_gazetteer_client.php
   branches/nimix_dev/http/javascripts/popup.js
   branches/nimix_dev/http/php/mod_digitize_messages.php
   branches/nimix_dev/http/print/mod_printPDF.php
   branches/nimix_dev/http/print/mod_printPDF_pdf.php
   branches/nimix_dev/last_merged.txt
   branches/nimix_dev/lib/database-mysql.php
   branches/nimix_dev/lib/style.js
   branches/nimix_dev/resources/db/mysql/mysql_schema.sql
   branches/nimix_dev/resources/db/pgsql/pgsql_schema.sql
Log:
merge with trunk

Modified: branches/nimix_dev/conf/digitize_default.conf
===================================================================
--- branches/nimix_dev/conf/digitize_default.conf	2008-09-04 12:45:12 UTC (rev 2914)
+++ branches/nimix_dev/conf/digitize_default.conf	2008-09-05 08:16:07 UTC (rev 2915)
@@ -10,6 +10,8 @@
 addButtonDig("setBasePoint", 1, "new_node_off.png", "", "", 100, 0);
 addButtonDig("delBasePoint", 1, "delete_node_off.png", "", "", 125, 0);
 addButtonDig("clear", 1, "del_off.png", "", "", 150, 0);
+addButtonDig("digitizeSplit", 1, "splitPolygon_off.png", "", "", 175, 0);
+addButtonDig("digitizeMerge", 1, "mergePolygons_off.png", "", "", 200, 0);
 
 //definition of directory of digitize buttons
 buttonDig_imgdir = "../img/button_digitize/";

Modified: branches/nimix_dev/http/classes/class_gml2.php
===================================================================
--- branches/nimix_dev/http/classes/class_gml2.php	2008-09-04 12:45:12 UTC (rev 2914)
+++ branches/nimix_dev/http/classes/class_gml2.php	2008-09-05 08:16:07 UTC (rev 2915)
@@ -359,7 +359,10 @@
 		elseif ($this->getGeometryTypeFromMember($i) == $this->geomtype_polygon || $this->getGeometryTypeFromMember($i) == $this->geomtype_multipolygon) {
 			$js .= "var current_geomtype = ".$prefix."geomType.polygon;\n";
 		}
-		else die("unknown geometry type: '".$this->getGeometryTypeFromMember($i)."'");
+		else{
+			$e = new mb_notice("unknown geometry type: '".$this->getGeometryTypeFromMember($i)."' or no geometry existing");
+			return "";
+		}	
 		
 		$js .= "var q = new ".$prefix."MultiGeometry(current_geomtype);\n";
 		

Modified: branches/nimix_dev/http/extensions/ext_featureInfoTunnel.php
===================================================================
--- branches/nimix_dev/http/extensions/ext_featureInfoTunnel.php	2008-09-04 12:45:12 UTC (rev 2914)
+++ branches/nimix_dev/http/extensions/ext_featureInfoTunnel.php	2008-09-05 08:16:07 UTC (rev 2915)
@@ -29,7 +29,8 @@
 	$x = new connector($nmr);
 	if (empty($x->file)) {
 		//close window if featureInfo has no result
-		echo "<body onLoad=\"javascript:window.close()\">";
+		//echo "<body onLoad=\"javascript:window.close()\">";
+		echo "";
 	} 
 	else {
 		echo $x->file;

Copied: branches/nimix_dev/http/img/button_digitize/mergePolygons_off.png (from rev 2914, trunk/mapbender/http/img/button_digitize/mergePolygons_off.png)
===================================================================
(Binary files differ)

Copied: branches/nimix_dev/http/img/button_digitize/mergePolygons_on.png (from rev 2914, trunk/mapbender/http/img/button_digitize/mergePolygons_on.png)
===================================================================
(Binary files differ)

Copied: branches/nimix_dev/http/img/button_digitize/mergePolygons_over.png (from rev 2914, trunk/mapbender/http/img/button_digitize/mergePolygons_over.png)
===================================================================
(Binary files differ)

Copied: branches/nimix_dev/http/img/button_digitize/splitPolygon_off.png (from rev 2914, trunk/mapbender/http/img/button_digitize/splitPolygon_off.png)
===================================================================
(Binary files differ)

Copied: branches/nimix_dev/http/img/button_digitize/splitPolygon_on.png (from rev 2914, trunk/mapbender/http/img/button_digitize/splitPolygon_on.png)
===================================================================
(Binary files differ)

Copied: branches/nimix_dev/http/img/button_digitize/splitPolygon_over.png (from rev 2914, trunk/mapbender/http/img/button_digitize/splitPolygon_over.png)
===================================================================
(Binary files differ)

Modified: branches/nimix_dev/http/javascripts/geometry.js
===================================================================
--- branches/nimix_dev/http/javascripts/geometry.js	2008-09-04 12:45:12 UTC (rev 2914)
+++ branches/nimix_dev/http/javascripts/geometry.js	2008-09-05 08:16:07 UTC (rev 2915)
@@ -241,7 +241,46 @@
 	return [min, max];
 };
 
+GeometryArray.prototype.importGeometryFromText = function (text) {
 
+	var tmpArray = text.split("(");
+	var geometryType = tmpArray[0];
+
+	switch (geometryType) {
+		case "POLYGON":
+			var text = text.replace(/\)/, "");
+			text = text.replace(/\(\(/, "(");
+			var tmpArray = text.split("(");
+
+			var coordinatesArray = tmpArray[1].split(",");
+
+			this.addMember(geomType.polygon);
+			this.get(-1).addGeometry();
+			for (var m = 0; m < -1 + coordinatesArray.length; m++) {
+				var currentPoint = coordinatesArray[m].split(" ");
+				this.getGeometry(-1, -1).addPointByCoordinates(parseFloat(currentPoint[0]), parseFloat(currentPoint[1]));
+			}
+			this.close();
+			break;
+		case "MULTIPOLYGON":
+			var text = text.replace(/\)/, "");
+			text = text.replace(/\(\(\(/, "(");
+
+			var tmpArray = text.split("(");
+
+			var coordinatesArray = tmpArray[1].split(",");
+
+			this.addMember(geomType.polygon);
+			this.get(-1).addGeometry();
+			for (var m = 0; m < -1 + coordinatesArray.length; m++) {
+				var currentPoint = coordinatesArray[m].split(" ");
+				this.getGeometry(-1, -1).addPointByCoordinates(parseFloat(currentPoint[0]), parseFloat(currentPoint[1]));
+			}
+			this.close();
+			break;
+	}
+};
+
 GeometryArray.prototype.importGeoJSON = function (geoJSON) {
 	var isFeatureCollection = false;
 	var featureCollectionEpsg = 4326;
@@ -635,6 +674,53 @@
 	return false;
 };
 
+MultiGeometry.prototype.toText = function () {
+	var text = "";
+	var numOfGeom = this.count();
+	if (numOfGeom >= 1) {
+		if (this.geomType == geomType.polygon) {
+			text += "POLYGON (";
+
+			for (var i = 0; i < this.count(); i++) {
+				if (i > 0) {
+					text += ", ";
+				}
+				text += "(";
+
+				var currentPolygon = this.get(i);
+				for (var j = 0; j < currentPolygon.count(); j++) {
+					if (j > 0) {
+						text += ", ";
+					}
+	
+					var currentPoint = currentPolygon.get(j);
+					text += currentPoint.x + " " + currentPoint.y
+				}
+
+				text += ")";
+			}
+			text += ")";
+		}
+		else if (this.geomType == geomType.line) {
+			text += "LINESTRING (";
+
+			var currentLine = this.get(0);
+			for (var j = 0; j < currentLine.count(); j++) {
+				if (j > 0) {
+					text += ", ";
+				}
+
+				var currentPoint = currentLine.get(j);
+				text += currentPoint.x + " " + currentPoint.y
+			}
+
+			text += ")";
+		}
+		
+	}
+	return text;		
+};
+
 MultiGeometry.prototype.toString = function () {
 	var str = this.toStringWithoutProperties();
 	

Modified: branches/nimix_dev/http/javascripts/map.js
===================================================================
--- branches/nimix_dev/http/javascripts/map.js	2008-09-04 12:45:12 UTC (rev 2914)
+++ branches/nimix_dev/http/javascripts/map.js	2008-09-05 08:16:07 UTC (rev 2915)
@@ -176,7 +176,7 @@
 	}
 
 	var ts = mb_timestamp();
-	var myMapIds = [];
+	var myMapId = [];
 	for (var i=0; i < mb_mapObj.length; i++){
 		var currentMapObject = mb_mapObj[i];
 		if (currentMapObject.frameName != frameName) {
@@ -189,7 +189,7 @@
 			if (!(currentWms.gui_wms_visible > 0)) {
 				continue;
 			}
-			myMapIds.push("map_"+ii);
+			myMapId.push("map_"+ii);
 			
 			newMapRequest += getLayerHtmlCode(frameName, i, ii);
 			
@@ -198,7 +198,7 @@
 	}
 	eventAfterMapRequest.trigger({
 		"frameName": frameName,
-		"myMapIds": myMapIds.join(",")
+		"myMapId": myMapId.join(",")
 	});
 /*
 	for(var i=0; i<mb_MapRequestSubFunctions.length; i++){
@@ -411,37 +411,57 @@
             	}
 				else if(path && validation){
 					newfeatureInfoRequest += requestParams;
-					try{
-						var p = new mb_popup({
-							title:"Feature Info",
-							url:path + "?url=" + escape(newfeatureInfoRequest)+"&"+mb_nr,
-							width:600,
-							height:500,
-							top:200,
-							left:600
+					(function () {
+						var currentRequest = newfeatureInfoRequest;
+						mb_ajax_post(path, {'url':currentRequest},function(js_code,status){
+							if(js_code){
+								try{
+									var p = new mb_popup({
+										title:"Feature Info",
+										url:path + "?url=" + escape(currentRequest)+"&"+mb_nr,
+										width:600,
+										height:500,
+										top:200,
+										left:600
+									});
+									p.show();
+								}catch(e){
+									window.open(path + "?url=" + escape(currentRequest)+"&"+mb_nr, "" , "width=300,height=400,scrollbars=yes,resizable=yes");
+								}
+							}
+							else{
+								var e = new Mb_exception("No featureInfo results.");
+							}
 						});
-						p.show();
-					}catch(e){
-						window.open(path + "?url=" + escape(newfeatureInfoRequest)+"&"+mb_nr, "" , "width=300,height=400,scrollbars=yes,resizable=yes");
-					}
+					}());
 					cnt_fi++;
 				}
 				else if(validation){
 					newfeatureInfoRequest += requestParams;
-					try{
-						var p = new mb_popup({
-							title:"Feature Info",
-							url:newfeatureInfoRequest,
-							width:600,
-							height:500,
-							top:200,
-							left:600
+					(function () {
+						var currentRequest = newfeatureInfoRequest;
+						mb_ajax_post(path,{url:currentRequest},function(js_code,status){
+							if(js_code){
+								try{
+									var p = new mb_popup({
+										title:"Feature Info",
+										url:currentRequest,
+										width:600,
+										height:500,
+										top:200,
+										left:600
+									});
+									p.show();
+								}
+								catch(e){
+									window.open(currentRequest, "" , "width=300,height=400,scrollbars=yes,resizable=yes");					
+								}		
+							}
+							else{
+								var e = new Mb_exception("No featureInfo results.");					
+							}
 						});
-						p.show();
-					}
-					catch(e){
-						window.open(newfeatureInfoRequest, "" , "width=300,height=400,scrollbars=yes,resizable=yes");					
-					}
+					}());
 					cnt_fi++;
 				}    
 			}

Modified: branches/nimix_dev/http/javascripts/mod_digitize_tab.php
===================================================================
--- branches/nimix_dev/http/javascripts/mod_digitize_tab.php	2008-09-04 12:45:12 UTC (rev 2914)
+++ branches/nimix_dev/http/javascripts/mod_digitize_tab.php	2008-09-05 08:16:07 UTC (rev 2915)
@@ -84,7 +84,8 @@
 var button_insert = "setBasePoint";
 var button_delete = "delBasePoint";
 var button_clear = "clear";
-var button_combine = "combine";
+var button_split = "digitizeSplit";
+var button_merge = "digitizeMerge";
 
 var digitizeDivTag;
 
@@ -583,7 +584,10 @@
 		mod_digitizeEvent = obj.id;
 		executeDigitizePreFunctions();
 	}
-	else if (obj.id == button_point || obj.id == button_line || obj.id == button_polygon || obj.id == button_clear || obj.id == button_combine){
+	else if (obj.id == button_point || obj.id == button_line || 
+				obj.id == button_polygon || obj.id == button_clear || 
+				obj.id == button_split || obj.id == button_merge){
+					
 		var el = parent.frames[mod_digitize_target].document;
 		el.onmousemove = mod_digitize_go;
 
@@ -695,14 +699,54 @@
 				parent.mb_disableThisButton(button_clear);
 			}
 		}
-		else if (obj.id == button_combine) {
-//			d.combineToMultiGeometry();
-//			prompt('', d.toJSONString());
-//			parent.mb_ajax_post("../php/jsonTest.php", {json:d.toJSONString()}, function(test, status) {
-//				alert(test);
-//			});
-			parent.mb_disableThisButton(button_combine);
+		else if (obj.id == button_merge) {
+			var applicable = (d.count() > 1);
+
+			var polygonTextArray = [];
+			for (var i = 0; i < d.count(); i++) {
+				if (d.get(i).geomType != parent.geomType.polygon) {
+					applicable = false;
+					polygonTextArray = [];
+					break;
+				}
+				polygonTextArray.push(d.get(i).toText());
+			}
+
+			if (!applicable) {
+				alert(msgObj.messageErrorMergeNotApplicable);
+				parent.mb_disableThisButton(button_merge);
+				return false;
+			}
+			
+			parent.mb_ajax_post("../php/mod_digitize_mergePolygon.php", {polygons: polygonTextArray.join(";")}, function(json, status) {
+				var response = eval('(' + json + ')');
+				var polygon = response.polygon;
+				d.importGeometryFromText(polygon);
+				parent.mb_disableThisButton(button_merge);
+			});
 		}
+		else if (obj.id == button_split) {
+			var applicable = (d.count() == 2) && 
+							(d.get(0).geomType == parent.geomType.polygon) &&
+							(d.get(1).geomType == parent.geomType.line);
+			if (!applicable) {
+				alert(msgObj.messageErrorSplitNotApplicable);
+				parent.mb_disableThisButton(button_split);
+				return false;
+			}
+			
+			var polygonText = d.get(0).toText();
+			var lineText = d.get(1).toText();
+			
+			parent.mb_ajax_post("../php/mod_digitize_splitPolygon.php", {polygon: polygonText, line: lineText}, function(json, status) {
+				var response = eval('(' + json + ')');
+				var polygonArray = response.polygons;
+				for (var i in polygonArray) {
+					d.importGeometryFromText(polygonArray[i]);
+				}
+				parent.mb_disableThisButton(button_split);
+			});
+		}
 	}
 }
 
@@ -719,6 +763,14 @@
 		mod_digitize_timeout();
 		executeDigitizeSubFunctions();
 	}
+	else if (obj.id == button_merge) {
+		mod_digitize_timeout();
+		executeDigitizeSubFunctions();
+	}
+	else if (obj.id == button_split) {
+		mod_digitize_timeout();
+		executeDigitizeSubFunctions();
+	}
 	mod_digitizeEvent = false;
 }
 // --- button handling (end) ----------------------------------------------------------------------------------------------

Modified: branches/nimix_dev/http/javascripts/mod_dragMapSize.php
===================================================================
--- branches/nimix_dev/http/javascripts/mod_dragMapSize.php	2008-09-04 12:45:12 UTC (rev 2914)
+++ branches/nimix_dev/http/javascripts/mod_dragMapSize.php	2008-09-05 08:16:07 UTC (rev 2915)
@@ -58,7 +58,7 @@
 		mouseCatcher.style.width = 500;
 		mouseCatcher.style.height = 500;
 		mouseCatcher.style.zIndex = 160;
-		if(top.ie)
+		if($.browser.msie)
 			mouseCatcher.style.background = "url(../img/transparent.gif)"; 
 		mouseCatcher.style.left=clickX-250;
 		mouseCatcher.style.top=clickY-250;

Modified: branches/nimix_dev/http/javascripts/mod_sandclock.php
===================================================================
--- branches/nimix_dev/http/javascripts/mod_sandclock.php	2008-09-04 12:45:12 UTC (rev 2914)
+++ branches/nimix_dev/http/javascripts/mod_sandclock.php	2008-09-05 08:16:07 UTC (rev 2915)
@@ -31,17 +31,17 @@
 var mod_sandclock_img = new Image();
 mod_sandclock_img.src = mod_sandclock_image;
 
-mb_registerSubFunctions("mod_sandclock(true,myMapIds)");
+mb_registerSubFunctions("mod_sandclock(true,myMapId)");
 
-function mod_sandclock(start,myMapIds){
+function mod_sandclock(start,myMapId){
 	var ind = getMapObjIndexByName(mod_sandclock_target);
 	if(start){
 		var temp = "<img src='"+mod_sandclock_img.src+"'>";
 		writeTag(mod_sandclock_target, "sandclock", temp);
 		mb_arrangeElement(mod_sandclock_target, "sandclock", (mb_mapObj[ind].width/2 - 16), (mb_mapObj[ind].height/2 - 16));
 	}
-	aktiv = setTimeout("mod_sandclock('','"+myMapIds+"')",10);
-	var myMapIdArray = myMapIds.split(",");
+	aktiv = setTimeout("mod_sandclock('','"+myMapId+"')",10);
+	var myMapIdArray = myMapId.split(",");
 	var complete = true;
 	var myMapId;
 	for (var i = 0; i < myMapIdArray.length && complete; i++) {

Modified: branches/nimix_dev/http/javascripts/mod_tab.js
===================================================================
--- branches/nimix_dev/http/javascripts/mod_tab.js	2008-09-04 12:45:12 UTC (rev 2914)
+++ branches/nimix_dev/http/javascripts/mod_tab.js	2008-09-05 08:16:07 UTC (rev 2915)
@@ -94,7 +94,7 @@
 		
 		// open or close on click
 		// see http://www.mapbender.org/index.php/Add_events_via_DOM_in_IE_and_FF
-		if (top.ie) {
+		if ($.browser.msie) {
 		
 		   node.onclick = function() {
 		      tabs.toggleTab(that.module);

Modified: branches/nimix_dev/http/javascripts/mod_wfs_SpatialRequest.php
===================================================================
--- branches/nimix_dev/http/javascripts/mod_wfs_SpatialRequest.php	2008-09-04 12:45:12 UTC (rev 2914)
+++ branches/nimix_dev/http/javascripts/mod_wfs_SpatialRequest.php	2008-09-05 08:16:07 UTC (rev 2915)
@@ -576,7 +576,7 @@
 		var mapPosYRemovePix = mapPos[1] - buffer;
 		var realWorld1 = makeClickPos2RealWorldPos("mapframe1",mapPosXRemovePix,mapPosYRemovePix);
 		var realWorld2 = makeClickPos2RealWorldPos("mapframe1",mapPosXAddPix,mapPosYRemovePix);
-		var realWorld3 = makeClickPos2RealWorldPos("mapframe1",mapPosXAddPix,mapPosYRemovePix);
+		var realWorld3 = makeClickPos2RealWorldPos("mapframe1",mapPosXAddPix,mapPosYAddPix);
 		var realWorld4 = makeClickPos2RealWorldPos("mapframe1",mapPosXRemovePix,mapPosYAddPix);
 		for(var i=0; i<js_wfs_conf_id.length; i++){
 			var srs = wfs_config[js_wfs_conf_id[i]]['featuretype_srs'];

Modified: branches/nimix_dev/http/javascripts/mod_wfs_gazetteer_client.php
===================================================================
--- branches/nimix_dev/http/javascripts/mod_wfs_gazetteer_client.php	2008-09-04 12:45:12 UTC (rev 2914)
+++ branches/nimix_dev/http/javascripts/mod_wfs_gazetteer_client.php	2008-09-05 08:16:07 UTC (rev 2915)
@@ -961,7 +961,7 @@
 					var mapPosYRemovePix = mapPos[1] - buffer;
 					var realWorld1 = parent.makeClickPos2RealWorldPos("mapframe1",mapPosXRemovePix,mapPosYRemovePix);
 					var realWorld2 = parent.makeClickPos2RealWorldPos("mapframe1",mapPosXAddPix,mapPosYRemovePix);
-					var realWorld3 = parent.makeClickPos2RealWorldPos("mapframe1",mapPosXAddPix,mapPosYRemovePix);
+					var realWorld3 = parent.makeClickPos2RealWorldPos("mapframe1",mapPosXAddPix,mapPosYAddPix);
 					var realWorld4 = parent.makeClickPos2RealWorldPos("mapframe1",mapPosXRemovePix,mapPosYAddPix);
 					andConditions += "<Intersects><ogc:PropertyName>";
 					for (var j=0; j < el.length; j++) {

Modified: branches/nimix_dev/http/javascripts/popup.js
===================================================================
--- branches/nimix_dev/http/javascripts/popup.js	2008-09-04 12:45:12 UTC (rev 2914)
+++ branches/nimix_dev/http/javascripts/popup.js	2008-09-05 08:16:07 UTC (rev 2915)
@@ -4,7 +4,7 @@
 * License (>=v2). Read the file gpl.txt that comes with Mapbender for details. 
 */
 //http://www.mapbender.org/index.php/popup
-var popup_count = 0;
+var popup_count = 1;
 var popup_top = 150;
 
 /**

Copied: branches/nimix_dev/http/php/mod_digitize_mergePolygon.php (from rev 2914, trunk/mapbender/http/php/mod_digitize_mergePolygon.php)
===================================================================
--- branches/nimix_dev/http/php/mod_digitize_mergePolygon.php	                        (rev 0)
+++ branches/nimix_dev/http/php/mod_digitize_mergePolygon.php	2008-09-05 08:16:07 UTC (rev 2915)
@@ -0,0 +1,60 @@
+<?php
+# $Id$
+# http://www.mapbender.org/index.php/DeleteWMS
+# Copyright (C) 2002 CCGIS 
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+require_once(dirname(__FILE__) . "/../../core/globalSettings.php");
+require_once(dirname(__FILE__) . "/../classes/class_json.php");
+
+$json = new Mapbender_JSON();
+
+$polygonList = stripslashes($_REQUEST["polygons"]);
+
+$floatPattern = "-?\d+(\.\d+)?";
+$pointPattern = $floatPattern . " " . $floatPattern;
+$polygonPattern = "POLYGON \(\(" . $pointPattern . "(, " . $pointPattern . ")*\)\)";
+$pattern = "/" . $polygonPattern . "(;" . $polygonPattern . ")+/";
+if (!preg_match($pattern, $polygonList)) {
+	echo "not a polygon.";
+	die();
+}
+
+$polygonArray = explode(";", $polygonList);
+
+$sql = "SELECT astext(multi(geomunion(geom))) FROM (";
+
+for ($i = 0; $i < count($polygonArray); $i++) {
+	if ($i > 0) {
+		$sql .= " UNION ";
+	}
+	$sql .= "(SELECT '" . $polygonArray[$i] . "'::geometry AS geom) ";
+}
+	
+$sql .= ") as a";
+
+$res = db_query($sql);    
+
+$polygonArray = array();
+$row = db_fetch_array($res);
+
+$data = array("polygon" => $row[0]);
+
+$output = $json->encode($data);
+
+header("Content-type:application/x-json; charset=utf-8");
+echo $output;
+?>
\ No newline at end of file

Modified: branches/nimix_dev/http/php/mod_digitize_messages.php
===================================================================
--- branches/nimix_dev/http/php/mod_digitize_messages.php	2008-09-04 12:45:12 UTC (rev 2914)
+++ branches/nimix_dev/http/php/mod_digitize_messages.php	2008-09-05 08:16:07 UTC (rev 2915)
@@ -35,6 +35,8 @@
 $msg_obj["messageErrorFieldIsEmpty"] = _mb("This field may not be empty.");
 $msg_obj["messageErrorFormEvaluation"] = _mb("Failure during form evaluation.");
 $msg_obj["messageErrorWfsWrite"] = _mb("An error occured.");
+$msg_obj["messageErrorMergeNotApplicable"] = _mb("At least two geometries must be available. Only polygons are allowed in the geometry list.");
+$msg_obj["messageErrorSplitNotApplicable"] = _mb("Exactly two geometries must be available. The first geometry shall be a polygon, the second geometry shall be a line.");
 $msg_obj["messageSuccessWfsWrite"] = _mb("Success.");
 $msg_obj["messageConfirmDeleteGeomFromDb"] = _mb("Delete geometry from database?");
 $msg_obj["messageConfirmDeleteAllGeomFromList"] = _mb("Clear list of geometries?");
@@ -59,6 +61,10 @@
 $msg_obj["buttonLabelDeleteBasepointOn"] = _mb("Delete basepoint");
 $msg_obj["buttonLabelClearListOff"] = _mb("clear list of geometries");
 $msg_obj["buttonLabelClearListOn"] = _mb("clear list of geometries");
+$msg_obj["buttonLabelMergeOff"] = _mb("Merge geometries");
+$msg_obj["buttonLabelMergeOn"] = _mb("Merge geometries");
+$msg_obj["buttonLabelSplitOff"] = _mb("Split geometries");
+$msg_obj["buttonLabelSplitOn"] = _mb("Split geometries");
 $msg_obj["buttonDig_wfs_title"] = _mb("save / update / delete");
 $msg_obj["buttonDig_remove_title"] = _mb("remove from workspace");
 $msg_obj["buttonDig_removeDb_title"] = _mb("remove from database");

Copied: branches/nimix_dev/http/php/mod_digitize_splitPolygon.php (from rev 2914, trunk/mapbender/http/php/mod_digitize_splitPolygon.php)
===================================================================
--- branches/nimix_dev/http/php/mod_digitize_splitPolygon.php	                        (rev 0)
+++ branches/nimix_dev/http/php/mod_digitize_splitPolygon.php	2008-09-05 08:16:07 UTC (rev 2915)
@@ -0,0 +1,69 @@
+<?php
+# $Id$
+# http://www.mapbender.org/index.php/DeleteWMS
+# Copyright (C) 2002 CCGIS 
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+require_once(dirname(__FILE__) . "/../../core/globalSettings.php");
+require_once(dirname(__FILE__) . "/../classes/class_json.php");
+
+$json = new Mapbender_JSON();
+
+$lineText = $_REQUEST["line"];
+$polygonText = $_REQUEST["polygon"];
+
+
+$floatPattern = "-?\d+(\.\d+)?";
+$pointPattern = $floatPattern . " " . $floatPattern;
+$polygonPattern = "POLYGON \(\(" . $pointPattern . "(, " . $pointPattern . ")*\)\)";
+$linePattern = "LINESTRING \(" . $pointPattern . ", " . $pointPattern . "\)";
+
+$pattern = "/" . $polygonPattern . "/";
+if (!preg_match($pattern, $polygonText)) {
+	echo "not a polygon.";
+	die();
+}
+
+$pattern = "/" . $linePattern . "/";
+if (!preg_match($pattern, $lineText)) {
+	echo "not a line.";
+	die();
+}
+
+
+$sql = "SELECT astext(geom) FROM dump ((" . 
+	"SELECT polygonize(geomunion(boundary('" . 
+	$polygonText . "'::geometry),'" . 
+	$lineText . "'::geometry))" . 
+	"))" . 
+	"WHERE contains('" . 
+	$polygonText . "'::geometry, pointonsurface(geom)" . 
+	")";
+
+$res = db_query($sql);    
+
+$polygonArray = array();
+while ($row = db_fetch_array($res)) {
+	array_push($polygonArray, $row[0]);
+}
+
+$data = array("polygons" => $polygonArray);
+
+$output = $json->encode($data);
+
+header("Content-type:application/x-json; charset=utf-8");
+echo $output;
+?>
\ No newline at end of file

Modified: branches/nimix_dev/http/print/mod_printPDF.php
===================================================================
--- branches/nimix_dev/http/print/mod_printPDF.php	2008-09-04 12:45:12 UTC (rev 2914)
+++ branches/nimix_dev/http/print/mod_printPDF.php	2008-09-05 08:16:07 UTC (rev 2915)
@@ -232,23 +232,55 @@
 	}
 }
 function refreshParams(){
-	var ind = pt.getMapObjIndexByName(target);
-	var f = document.form1;
-	f.map_url.value = "";
-	for(var i=0; i<pt.mb_mapObj[ind].wms.length; i++){
-		if(pt.mb_mapObj[ind].wms[i].gui_wms_visible > 0){
-			if(pt.mb_mapObj[ind].wms[i].mapURL != false && pt.mb_mapObj[ind].wms[i].mapURL != 'false' && pt.mb_mapObj[ind].wms[i].mapURL != ''){
-				if(f.map_url.value != ""){
-					f.map_url.value += "___";
-				}      
-				f.map_url.value += pt.mb_mapObj[ind].wms[i].mapURL;
+	var f = document.forms[0];
+	size = document.getElementById('size').options[document.getElementById('size').selectedIndex].value;
+	format = document.getElementById('format').options[document.getElementById('format').selectedIndex].value;
+	
+	if(size != "" && format != ""){
+		var ind = pt.getMapObjIndexByName(target);
+		var coord = pt.mb_mapObj[ind].extent.split(",");
+		var centerX = parseFloat(coord[0]) + (parseFloat(coord[2]) - parseFloat(coord[0]))/2
+		var centerY = parseFloat(coord[1]) + (parseFloat(coord[3]) - parseFloat(coord[1]))/2
+		
+		var pos = pt.makeClickPos2RealWorldPos(target, map_width , map_height);
+		pt.mb_mapObj[ind].extent = coord[0] + "," + pos[1] + "," + pos[0] + "," +  coord[3];
+
+		pt.mb_mapObj[ind].width = Math.round(map_width);
+		pt.mb_mapObj[ind].height = Math.round(map_height);
+		pt.document.getElementById(target).style.width = Math.round(map_width);
+		pt.document.getElementById(target).style.height = Math.round(map_height);
+		pt.window.frames[target].document.getElementById("maps").style.width = Math.round(map_width);
+		pt.window.frames[target].document.getElementById("maps").style.height = Math.round(map_height);
+
+		//pt.setMapRequest(target);		
+		pt.mb_repaintScale(target, null, null, pt.mb_getScale(target));
+		f.map_url.value = '';
+		for(var i=0; i<pt.mb_mapObj[ind].wms.length; i++){
+			if(pt.mb_mapObj[ind].wms[i].gui_wms_visible > 0){
+				if(pt.mb_mapObj[ind].wms[i].mapURL != false && pt.mb_mapObj[ind].wms[i].mapURL != 'false' && pt.mb_mapObj[ind].wms[i].mapURL != ''){   
+					if(f.map_url.value != ""){
+						f.map_url.value += "___";
+					}         
+					f.map_url.value += pt.mb_mapObj[ind].wms[i].mapURL;
+				}
 			}
 		}
+		
+		//overview_url
+		var ind_overview = pt.getMapObjIndexByName('overview');
+
+		//alert ("l�nge: " + length+ " - " + ind_overview + name + pt.mb_mapObj[ind_overview].wms.length);
+		if(pt.mb_mapObj[ind_overview].mapURL != false ){
+			f.overview_url.value = pt.mb_mapObj[ind_overview].mapURL;
+		}
 	}
+
 	f.map_scale.value = pt.mb_getScale(target);
 	f.epsg.value = pt.mb_mapObj[ind].epsg;
+	
 	mod_legend_print();
 }
+	
 function printMap(){
 	if(size != "" && (format == "portrait" || format == "landscape")){
 		refreshParams();

Modified: branches/nimix_dev/http/print/mod_printPDF_pdf.php
===================================================================
--- branches/nimix_dev/http/print/mod_printPDF_pdf.php	2008-09-04 12:45:12 UTC (rev 2914)
+++ branches/nimix_dev/http/print/mod_printPDF_pdf.php	2008-09-05 08:16:07 UTC (rev 2915)
@@ -61,7 +61,7 @@
 function setscalebar($scale){
     	$mb_resolution = 28.35;
         
-		if($scale < 16){
+		if($scale < 16 && $scale > 0){
 	      $value = "10";
 	      $unit = "cm";
 	      $scalefactor = 10/$scale;

Modified: branches/nimix_dev/last_merged.txt
===================================================================
--- branches/nimix_dev/last_merged.txt	2008-09-04 12:45:12 UTC (rev 2914)
+++ branches/nimix_dev/last_merged.txt	2008-09-05 08:16:07 UTC (rev 2915)
@@ -1 +1 @@
-trunk: 2864
\ No newline at end of file
+trunk: 2914
\ No newline at end of file

Modified: branches/nimix_dev/lib/database-mysql.php
===================================================================
--- branches/nimix_dev/lib/database-mysql.php	2008-09-04 12:45:12 UTC (rev 2914)
+++ branches/nimix_dev/lib/database-mysql.php	2008-09-05 08:16:07 UTC (rev 2915)
@@ -53,8 +53,8 @@
  *  Notice the global vars $sys_dbhost,$sys_dbuser,$sys_dbpasswd,$sys_dbname that must be set up 
  *  in other functions in this library
  */
-include_once(dirname(__FILE__)."/../../http/classes/class_mb_exception.php");
-include_once(dirname(__FILE__)."/../../http/classes/class_checkInput.php");
+include_once(dirname(__FILE__)."/../http/classes/class_mb_exception.php");
+include_once(dirname(__FILE__)."/../http/classes/class_checkInput.php");
 function db_escapestring($unescaped_string){
 	return @mysql_escape_string($unescaped_string);
 }

Modified: branches/nimix_dev/lib/style.js
===================================================================
--- branches/nimix_dev/lib/style.js	2008-09-04 12:45:12 UTC (rev 2914)
+++ branches/nimix_dev/lib/style.js	2008-09-05 08:16:07 UTC (rev 2915)
@@ -10,7 +10,7 @@
 	 */
 	var createStyleTag = function() {
 		// TODO: Internet Explorer routine seems a little buggy
-		if (top.ie) {
+		if ($.browser.msie) {
 			// create a Style Sheet object (IE only)
 			//styleSheetObj=document.createStyleSheet();
 			// get the DOM node of the style sheet object, set the type
@@ -34,7 +34,7 @@
 	 */
 	this.addClass = function(className,cssString) {
 		// TODO: Internet Explorer routine seems a little buggy
-		if (top.ie) {
+		if ($.browser.msie) {
 			//add new style declaration to chosen styleSheet 
 			var cssRules = cssString.split(";");
 			for (i=0; i<cssRules.length-1; i++){
@@ -51,4 +51,4 @@
 	var styleSheetObj; //IE only...
 	
 	createStyleTag();
-};
\ No newline at end of file
+};

Modified: branches/nimix_dev/resources/db/mysql/mysql_schema.sql
===================================================================
--- branches/nimix_dev/resources/db/mysql/mysql_schema.sql	2008-09-04 12:45:12 UTC (rev 2914)
+++ branches/nimix_dev/resources/db/mysql/mysql_schema.sql	2008-09-05 08:16:07 UTC (rev 2915)
@@ -722,7 +722,7 @@
 ALTER TABLE wms ADD contactvoicetelephone varchar(255) NULL;
 ALTER TABLE wms ADD contactfacsimiletelephone varchar(255) NULL;
 ALTER TABLE wms ADD contactelectronicmailaddress varchar(255) NULL;
-ALTER TABLE wms ADD wms_mb_getcapabilies_doc text NULL;
+ALTER TABLE wms ADD wms_mb_getcapabilities_doc text NULL;
 ALTER TABLE wms ADD wms_owner int(11) NULL;
 ALTER TABLE wms ADD wms_timestamp int(11) NULL;
 ALTER TABLE wms ADD wms_supportsld boolean NULL;

Modified: branches/nimix_dev/resources/db/pgsql/pgsql_schema.sql
===================================================================
--- branches/nimix_dev/resources/db/pgsql/pgsql_schema.sql	2008-09-04 12:45:12 UTC (rev 2914)
+++ branches/nimix_dev/resources/db/pgsql/pgsql_schema.sql	2008-09-05 08:16:07 UTC (rev 2915)
@@ -653,7 +653,7 @@
     contactvoicetelephone character varying(255),
     contactfacsimiletelephone character varying(255),
     contactelectronicmailaddress character varying(255),
-    wms_mb_getcapabilies_doc text,
+    wms_mb_getcapabilities_doc text,
     wms_owner integer,
     wms_timestamp integer,
     wms_supportsld boolean,



More information about the Mapbender_commits mailing list