changeset 661:f99d8f92a640

Implemented Support of MultiPolygons. geo-backend/trunk@750 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Tim Englich <tim.englich@intevation.de>
date Mon, 08 Mar 2010 15:39:58 +0000
parents b4c7de93d5e8
children 755dd2fa4a0a 3d0c06f99686
files geo-backend/ChangeLog geo-backend/src/main/java/de/intevation/gnv/geobackend/sde/datasources/Row.java
diffstat 2 files changed, 30 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/geo-backend/ChangeLog	Mon Mar 08 14:06:50 2010 +0000
+++ b/geo-backend/ChangeLog	Mon Mar 08 15:39:58 2010 +0000
@@ -1,3 +1,13 @@
+2010-03-08  Tim Englich  <tim.englich@intevation.de>
+
+	* src/main/java/de/intevation/gnv/geobackend/sde/datasources/Row.java (getPosValue): 
+	  Implemented Support of MultiPolygons. The Points do not belong to one 
+	  Geometryelement. We have to Lookup ifthe Geometry is Multiparted.
+	  If it is we have to split the Points into several Polygons which belongs 
+	  to one Multipolygon.
+	  This Fix solve did not solve any Parsingerros. Some geometries are still 
+	  corrupt.
+	  
 2010-03-08  Tim Englich  <tim.englich@intevation.de>
 
 	* src/main/java/de/intevation/gnv/geobackend/sde/datasources/Row.java (getPosValue): 
--- a/geo-backend/src/main/java/de/intevation/gnv/geobackend/sde/datasources/Row.java	Mon Mar 08 14:06:50 2010 +0000
+++ b/geo-backend/src/main/java/de/intevation/gnv/geobackend/sde/datasources/Row.java	Mon Mar 08 15:39:58 2010 +0000
@@ -269,10 +269,25 @@
                     }
                     returnValue.append(")");
                 } else if (val.isPolygon()){
-                    returnValue.append("POLYGON((");
+                    int[] offsets = (int[])aList.get(1);
+                    int offsetPos = 1;
                     int length = mPoint.length;
+                    int nextOffset = length;
+                    
+                    if (val.isMultiPart()){
+                        returnValue.append("MULTIPOLYGON(((");
+                        nextOffset = offsets.length-1 >= offsetPos ? offsets[offsetPos++] : length;
+                    }else{
+                        returnValue.append("POLYGON((");
+                    }
+                    
                     for (int i = 0; i< length ;i++){
                        SDEPoint p = mPoint[i];
+                       
+                       if (i == nextOffset){
+                           returnValue.append(")),((");
+                           nextOffset = offsets.length-1 >= offsetPos ? offsets[offsetPos++] : length;
+                       }
                        returnValue.append(p.getX())
                                    .append(" ")
                                    .append(p.getY());
@@ -280,11 +295,14 @@
                            returnValue.append(" ")
                                       .append(p.getZ());
                        }
-                       if (i < length-1){
+                       if (i < length-1 && i < nextOffset -1 ){
                            returnValue.append(" , ");
                        }
                     }
                     returnValue.append(")");
+                    if (val.isMultiPart()){
+                        returnValue.append(")");
+                    }
                     // TODO How are Rings supported
 //                    for (int i =1 ; i < aList.size(); i++){
 //                        returnValue.append("(");

http://dive4elements.wald.intevation.org