[Mapbender-commits] r6545 - branches/2.6/http/javascripts

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Sat Jul 3 14:56:49 EDT 2010


Author: marc
Date: 2010-07-03 18:56:49 +0000 (Sat, 03 Jul 2010)
New Revision: 6545

Modified:
   branches/2.6/http/javascripts/geometry.js
Log:
http://trac.osgeo.org/mapbender/ticket/650

Modified: branches/2.6/http/javascripts/geometry.js
===================================================================
--- branches/2.6/http/javascripts/geometry.js	2010-07-03 17:47:32 UTC (rev 6544)
+++ branches/2.6/http/javascripts/geometry.js	2010-07-03 18:56:49 UTC (rev 6545)
@@ -416,12 +416,23 @@
 
 	this.addMember(geomType.polygon);
 	for (var m = 0; m < coordinates.length; m++) {
-		this.get(-1).addGeometry();
-		var currentPolygon = coordinates[m];
-		for (var n = 0; n < currentPolygon.length; n++) {
-			var currentPoint = currentPolygon[n];
-			this.getGeometry(-1,-1).addPointByCoordinates(currentPoint[0], currentPoint[1], currentPoint[2]);
+		var currentRing = coordinates[m];
+		if (m == 0) {
+			this.get(-1).addGeometry();
+			for (var p = 0; p < currentRing.length; p++) {
+				var currentPoint = currentRing[p];
+				this.getGeometry(-1, -1).addPointByCoordinates(currentPoint[0], currentPoint[1], currentPoint[2]);
+			}
 		}
+		else {
+			var ring = new Geometry(geomType.polygon);
+			for (var p = 0; p < currentRing.length; p++) {
+				var currentPoint = currentRing[p];
+				ring.addPointByCoordinates(currentPoint[0], currentPoint[1], currentPoint[2]);
+			}
+			ring.close();
+			this.getGeometry(-1,-1).addInnerRing(ring);				
+		}
 		this.getGeometry(-1,-1).setEpsg(featureEpsg);
 	}
 	this.close();
@@ -429,7 +440,6 @@
 
 GeometryArray.prototype.importMultiPolygon = function(currentGeometry, featureEpsg){
 	var coordinates = currentGeometry.coordinates;
-
 	this.addMember(geomType.polygon);
 	for (var m = 0; m < coordinates.length; m++) {
 		this.get(-1).addGeometry();



More information about the Mapbender_commits mailing list