Mercurial > dive4elements > gnv-client
changeset 268:71b2f263f036
Add WKT-Syntaxt to Shape ReturnValue
geo-backend/trunk@218 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Tim Englich <tim.englich@intevation.de> |
---|---|
date | Wed, 14 Oct 2009 10:01:45 +0000 |
parents | 000e00592ba5 |
children | db8920c5346d |
files | geo-backend/ChangeLog geo-backend/src/main/java/de/intevation/gnv/geobackend/sde/datasources/Row.java |
diffstat | 2 files changed, 35 insertions(+), 20 deletions(-) [+] |
line wrap: on
line diff
--- a/geo-backend/ChangeLog Wed Oct 14 09:28:18 2009 +0000 +++ b/geo-backend/ChangeLog Wed Oct 14 10:01:45 2009 +0000 @@ -1,5 +1,7 @@ 2009-10-14 Tim Englich <tim.englich@intevation.de> + * src/main/java/de/intevation/gnv/geobackend/sde/datasources/Row.java (getPosValue): + Add WKT-Syntaxt to Shape ReturnValue * src/test/ressources/QueryExecutorTestCase.properties: Changed Test-Query-Statement for Spatial-Queries with INNERJOINS and ORDER BY * src/test/java/de/intevation/gnv/geobackend/base/query/QueryExecutorTestCase.java (testSpatialQueryWithoutIntersects):
--- a/geo-backend/src/main/java/de/intevation/gnv/geobackend/sde/datasources/Row.java Wed Oct 14 09:28:18 2009 +0000 +++ b/geo-backend/src/main/java/de/intevation/gnv/geobackend/sde/datasources/Row.java Wed Oct 14 10:01:45 2009 +0000 @@ -237,26 +237,39 @@ * @see #getValue(int) */ public String getPosValue(int pPos)throws TechnicalException{ - SeShape val; - ArrayList aList; - SDEPoint mPoint[]; - double lat,lon; - try { - val = (SeShape) this.mObjects[pPos]; - aList = val.getAllPoints(0,false); - mPoint = (SDEPoint[])aList.get(0); - lat = mPoint[0].getY(); - lon = mPoint[0].getX(); - 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()); + SeShape val; + ArrayList aList; + 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{ + returnValue.append("LINESTRING("); + for (int i = 0; i< mPoint.length;i++){ + returnValue.append(mPoint[0].getX()).append(" ").append(mPoint[0].getY()); + if (i < mPoint.length-1){ + 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()); + } } + return returnValue.toString(); } }