# HG changeset patch # User Tim Englich # Date 1256901115 0 # Node ID 69ddef25e822e11751c57a3844e378d3edd7765d # Parent 05912f0304acc150f5c0055007e39ab3eca3f968 Polygon and 3D Support was added to the WKT-Representation. geo-backend/trunk@277 c6561f87-3c4e-4783-a992-168aeb5c3f6f diff -r 05912f0304ac -r 69ddef25e822 geo-backend/ChangeLog --- a/geo-backend/ChangeLog Thu Oct 29 16:00:45 2009 +0000 +++ b/geo-backend/ChangeLog Fri Oct 30 11:11:55 2009 +0000 @@ -1,3 +1,10 @@ +2009-10-30 Tim Englich + + * src/main/java/de/intevation/gnv/geobackend/sde/datasources/Row.java (getPosValue): + Added Support for Polygons without interior Rings. This is required for generating + Horizontal Cross-Section Outputs. + The Z-Value of an Point was also added to the WKT-Represantation. + 2009-10-29 Tim Englich * src/main/java/de/intevation/gnv/geobackend/base/DefaultResult.java (getInteger): diff -r 05912f0304ac -r 69ddef25e822 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 Thu Oct 29 16:00:45 2009 +0000 +++ b/geo-backend/src/main/java/de/intevation/gnv/geobackend/sde/datasources/Row.java Fri Oct 30 11:11:55 2009 +0000 @@ -44,7 +44,6 @@ * Default Logging instance */ private static Logger sLogger = Logger.getLogger(Row.class); - private static boolean sDebug = sLogger.isDebugEnabled(); /** * Data container. @@ -69,8 +68,6 @@ this (ArrayStr.length); int nLength = ArrayStr.length; for (int i=0; i < nLength; i++){ - //if (sDebug) - // sLogger.debug(" ArrayStr["+i+" ]=" + ArrayStr[i]); addObject(ArrayStr[i], i); } @@ -242,30 +239,62 @@ SDEPoint mPoint[]; StringBuffer returnValue = new StringBuffer(); synchronized (returnValue) { - try { val = (SeShape) this.mObjects[pPos]; aList = val.getAllPoints(0,false); mPoint = (SDEPoint[])aList.get(0); - - if (mPoint.length == 1){ // PUNKT - returnValue.append("POINT(").append(mPoint[0].getX()).append(" ").append(mPoint[0].getY()).append(")"); - }else{ + if (val.isPoint()){ + returnValue.append("POINT(") + .append(mPoint[0].getX()) + .append(" ") + .append(mPoint[0].getY()) + .append(" ") + .append(mPoint[0].getZ()) + .append(")"); + }else if (val.isLine()){ returnValue.append("LINESTRING("); for (int i = 0; i< mPoint.length;i++){ - returnValue.append(mPoint[0].getX()).append(" ").append(mPoint[0].getY()); + returnValue.append(mPoint[i].getX()) + .append(" ") + .append(mPoint[i].getY()) + .append(" ") + .append(mPoint[i].getZ()); if (i < mPoint.length-1){ returnValue.append(" , "); } } returnValue.append(")"); + } else if (val.isPolygon()){ + returnValue.append("POLYGON(("); + for (int i = 0; i< mPoint.length;i++){ + returnValue.append(mPoint[i].getX()) + .append(" ") + .append(mPoint[i].getY()) + .append(" ") + .append(mPoint[i].getZ()); + if (i < mPoint.length-1){ + returnValue.append(" , "); + } + } + returnValue.append(")"); + // TODO Wie werden innere Ringe unterstützt. +// for (int i =1 ; i < aList.size(); i++){ +// returnValue.append("("); +// mPoint = (SDEPoint[])aList.get(i); +// for (int j = 0; j < mPoint.length;j++){ +// returnValue.append(mPoint[j].getX()) +// .append(" ") +// .append(mPoint[j].getY()) +// .append(" ") +// .append(mPoint[i].getZ()); +// if (i < mPoint.length-1){ +// returnValue.append(" , "); +// } +// } +// returnValue.append(")"); +// } + returnValue.append(")"); } - // String nord="N"; - // String ost="E"; - // if (lat <0 ){nord="S"; lat=-lat;} - // if (lon <0 ){ost="W"; lon=-lon;} - // return String.format("%1$02d°%2$1S %3$05.2f' %4$03d°%5$1S %6$05.2f'", - // (int)lat, nord,60.*(lat-((int)lat)),(int)lon,ost,60.*(lon-((int)lon))); } catch (SeException e) { throw new TechnicalException("Could not cast this value to the Float Type. Object is of value type: " + getValue(pPos).getClass().getName()); }