changeset 878:203f95af5b2c

Added support for MultiLineString-Geometries. geo-backend/trunk@762 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Tim Englich <tim.englich@intevation.de>
date Fri, 12 Mar 2010 10:58:24 +0000
parents 485566786089
children 9bcc423d8d76
files geo-backend/ChangeLog geo-backend/src/main/java/de/intevation/gnv/geobackend/sde/datasources/Row.java
diffstat 2 files changed, 37 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/geo-backend/ChangeLog	Fri Mar 12 10:29:02 2010 +0000
+++ b/geo-backend/ChangeLog	Fri Mar 12 10:58:24 2010 +0000
@@ -1,5 +1,12 @@
 2010-03-12  Tim Englich  <tim.englich@intevation.de>
 
+	* src/main/java/de/intevation/gnv/geobackend/sde/datasources/Row.java (getPosValue):
+	  Added support for MultiLineString-Geometries. The Points do not belong to one 
+	  Geometryelement. We have to lookup if the Geometry is Multiparted.
+	  If it is we have to split the Points into several LineStrings which belongs 
+	  to one MultiLineString.
+
+2010-03-12  Tim Englich  <tim.englich@intevation.de>
 	* src/main/java/de/intevation/gnv/geobackend/sde/datasources/ArcSDEResultSetMetaData.java (getColumnClassName): 
 	  Added more ClassName identificaton for the different datatypes of the ArcSDE.
 	  Now it is possible to distinguish between Integer, Long, String, Date, 
--- a/geo-backend/src/main/java/de/intevation/gnv/geobackend/sde/datasources/Row.java	Fri Mar 12 10:29:02 2010 +0000
+++ b/geo-backend/src/main/java/de/intevation/gnv/geobackend/sde/datasources/Row.java	Fri Mar 12 10:58:24 2010 +0000
@@ -255,19 +255,45 @@
                     // generated WKT is invalid.
                     ArrayList aList = val.getAllPoints(0,false);
                     SDEPoint[] mPoint = (SDEPoint[])aList.get(0);
-                    returnValue.append("LINESTRING(");
-                    for (int i = 0; i< mPoint.length;i++){
+                    boolean isMultiLineString = val.isMultiPart();
+                    int length = mPoint.length;
+                    int nextOffset = length;
+                    int[] offsets = (int[])aList.get(1);
+                    int offsetPos = 1;
+                    
+                    if(isMultiLineString){
+                        returnValue.append("MULTILINESTRING((");
+                        nextOffset = offsets.length-1 >= offsetPos ? offsets[offsetPos++] : length;
+                    }else{
+                        returnValue.append("LINESTRING(");
+                    }
+                    
+                    
+
+                    for (int i = 0; i< length;i++){
+                        
+                        if (i == nextOffset){
+                            returnValue.append("),(");
+                            nextOffset = offsets.length-1 >= offsetPos ? offsets[offsetPos++] : length;
+                        }
+                        
                         returnValue.append(mPoint[i].getX())
                                    .append(" ")
                                    .append(mPoint[i].getY());
                         if (mPoint[i].is3D()){
                             returnValue.append(" ").append(mPoint[i].getZ());
                         }
-                        if (i < mPoint.length-1){
+                        if (i < length-1 && i < nextOffset -1){
                             returnValue.append(" , ");
                         }
                     }
-                    returnValue.append(")");
+                    
+                    if(isMultiLineString){
+                        returnValue.append("))");
+                    }else{
+                        returnValue.append(")");
+                    }
+                    
                 } else{
                     returnValue.append(val.asText(val.getTextSize()));
                 }

http://dive4elements.wald.intevation.org