# HG changeset patch # User Tim Englich # Date 1268062798 0 # Node ID f99d8f92a6407015dc3743356811b9413242340f # Parent b4c7de93d5e89e7d908be83e33316b576b0b3caa Implemented Support of MultiPolygons. geo-backend/trunk@750 c6561f87-3c4e-4783-a992-168aeb5c3f6f diff -r b4c7de93d5e8 -r f99d8f92a640 geo-backend/ChangeLog --- 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 + + * 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 * src/main/java/de/intevation/gnv/geobackend/sde/datasources/Row.java (getPosValue): diff -r b4c7de93d5e8 -r f99d8f92a640 geo-backend/src/main/java/de/intevation/gnv/geobackend/sde/datasources/Row.java --- 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("(");