[Mapbender-commits] r8004 - branches/2.7/http/javascripts

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Tue Jul 26 15:08:12 EDT 2011


Author: marc
Date: 2011-07-26 12:08:12 -0700 (Tue, 26 Jul 2011)
New Revision: 8004

Modified:
   branches/2.7/http/javascripts/geometry.js
Log:
#763

Modified: branches/2.7/http/javascripts/geometry.js
===================================================================
--- branches/2.7/http/javascripts/geometry.js	2011-07-26 10:03:31 UTC (rev 8003)
+++ branches/2.7/http/javascripts/geometry.js	2011-07-26 19:08:12 UTC (rev 8004)
@@ -487,14 +487,26 @@
 
 GeometryArray.prototype.importPolygon = function(currentGeometry, featureEpsg){
 	var coordinates = currentGeometry.coordinates;
-
+	
 	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);
 	}
@@ -503,7 +515,6 @@
 
 GeometryArray.prototype.importMultiPolygon = function(currentGeometry, featureEpsg){
 	var coordinates = currentGeometry.coordinates;
-	
 	this.addMember(geomType.polygon);
 	for (var m = 0; m < coordinates.length; m++) {
 		
@@ -527,7 +538,7 @@
 					ring.addPointByCoordinates(currentPoint[0], currentPoint[1], currentPoint[2]);
 				}
 				ring.close();
-				this.getGeometry(-1,-1).addInnerRing(ring);				
+				this.getGeometry(-1,-1).addInnerRing(ring);
 			}
 		}
 		this.getGeometry(-1,-1).setEpsg(featureEpsg);
@@ -1032,7 +1043,7 @@
 
 
 function InnerRings () {
-	this.list = [];	
+	this.list = [];
 };
 
 InnerRings.prototype = new List();



More information about the Mapbender_commits mailing list