Mercurial > dive4elements > gnv-client
comparison geo-backend/src/main/java/de/intevation/gnv/geobackend/sde/datasources/Row.java @ 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 | 031ef9649cd1 |
children | 69ddef25e822 |
comparison
equal
deleted
inserted
replaced
267:000e00592ba5 | 268:71b2f263f036 |
---|---|
235 * @return a strongly typed Float | 235 * @return a strongly typed Float |
236 * @throws TechnicalException | 236 * @throws TechnicalException |
237 * @see #getValue(int) | 237 * @see #getValue(int) |
238 */ | 238 */ |
239 public String getPosValue(int pPos)throws TechnicalException{ | 239 public String getPosValue(int pPos)throws TechnicalException{ |
240 SeShape val; | 240 SeShape val; |
241 ArrayList aList; | 241 ArrayList aList; |
242 SDEPoint mPoint[]; | 242 SDEPoint mPoint[]; |
243 double lat,lon; | 243 StringBuffer returnValue = new StringBuffer(); |
244 try { | 244 synchronized (returnValue) { |
245 val = (SeShape) this.mObjects[pPos]; | 245 |
246 aList = val.getAllPoints(0,false); | 246 try { |
247 mPoint = (SDEPoint[])aList.get(0); | 247 val = (SeShape) this.mObjects[pPos]; |
248 lat = mPoint[0].getY(); | 248 aList = val.getAllPoints(0,false); |
249 lon = mPoint[0].getX(); | 249 mPoint = (SDEPoint[])aList.get(0); |
250 String nord="N"; | 250 |
251 String ost="E"; | 251 if (mPoint.length == 1){ // PUNKT |
252 if (lat <0 ){nord="S"; lat=-lat;} | 252 returnValue.append("POINT(").append(mPoint[0].getX()).append(" ").append(mPoint[0].getY()).append(")"); |
253 if (lon <0 ){ost="W"; lon=-lon;} | 253 }else{ |
254 return String.format("%1$02d°%2$1S %3$05.2f' %4$03d°%5$1S %6$05.2f'", | 254 returnValue.append("LINESTRING("); |
255 (int)lat, nord,60.*(lat-((int)lat)),(int)lon,ost,60.*(lon-((int)lon))); | 255 for (int i = 0; i< mPoint.length;i++){ |
256 | 256 returnValue.append(mPoint[0].getX()).append(" ").append(mPoint[0].getY()); |
257 | 257 if (i < mPoint.length-1){ |
258 } catch (SeException e) { | 258 returnValue.append(" , "); |
259 throw new TechnicalException("Could not cast this value to the Float Type. Object is of value type: " + getValue(pPos).getClass().getName()); | 259 } |
260 } | 260 } |
261 returnValue.append(")"); | |
262 } | |
263 // String nord="N"; | |
264 // String ost="E"; | |
265 // if (lat <0 ){nord="S"; lat=-lat;} | |
266 // if (lon <0 ){ost="W"; lon=-lon;} | |
267 // return String.format("%1$02d°%2$1S %3$05.2f' %4$03d°%5$1S %6$05.2f'", | |
268 // (int)lat, nord,60.*(lat-((int)lat)),(int)lon,ost,60.*(lon-((int)lon))); | |
269 } catch (SeException e) { | |
270 throw new TechnicalException("Could not cast this value to the Float Type. Object is of value type: " + getValue(pPos).getClass().getName()); | |
271 } | |
272 } | |
273 return returnValue.toString(); | |
261 } | 274 } |
262 } | 275 } |