Mercurial > dive4elements > gnv-client
changeset 235:c8ecc0c0bcb4
Renaming HorizontalProfileDataCollector into ShapeDataCollector.
gnv-artifacts/trunk@303 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Ingo Weinzierl <ingo.weinzierl@intevation.de> |
---|---|
date | Mon, 09 Nov 2009 10:16:10 +0000 |
parents | a7fa7b404897 |
children | 993fd465c904 |
files | gnv-artifacts/ChangeLog gnv-artifacts/src/main/java/de/intevation/gnv/exports/HorizontalProfileDataCollector.java gnv-artifacts/src/main/java/de/intevation/gnv/exports/ShapeDataCollector.java gnv-artifacts/src/main/java/de/intevation/gnv/transition/profile/horizontal/HorizontalProfileOutputTransition.java |
diffstat | 4 files changed, 72 insertions(+), 66 deletions(-) [+] |
line wrap: on
line diff
--- a/gnv-artifacts/ChangeLog Mon Nov 09 09:52:18 2009 +0000 +++ b/gnv-artifacts/ChangeLog Mon Nov 09 10:16:10 2009 +0000 @@ -1,3 +1,13 @@ +2009-11-09 Ingo Weinzierl <ingo.weinzierl@intevation.de> + + * src/main/java/de/intevation/gnv/exports/ShapeDataCollector.java, + src/main/java/de/intevation/gnv/exports/HorizontalProfileDataCollector.java: + Renamed HorizontalProfileDataCollector into ShapeDataCollector, because it + will be used by other transitions as well. + + * src/main/java/de/intevation/gnv/transition/profile/horizontal/HorizontalProfileOutputTransition.java: + Adjusted class name of DataCollector after renaming. + 2009-11-09 Ingo Weinzierl <ingo.weinzierl@intevation.de> * src/main/java/de/intevation/gnv/exports/HorizontalProfileDataCollector.java:
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/exports/HorizontalProfileDataCollector.java Mon Nov 09 09:52:18 2009 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,60 +0,0 @@ -package de.intevation.gnv.exports; - -import java.util.List; -import java.util.ArrayList; - -import org.apache.log4j.Logger; - -import com.vividsolutions.jts.io.WKTReader; -import com.vividsolutions.jts.io.ParseException; -import com.vividsolutions.jts.geom.Point; - -import de.intevation.gnv.geobackend.base.Result; -import de.intevation.gnv.transition.exception.TransitionException; - - -/** - * @author Ingo Weinzierl (ingo.weinzierl@intevation.de) - */ -public class HorizontalProfileDataCollector -extends DefaultDataCollector -{ - private Logger log = Logger.getLogger(HorizontalProfileDataCollector.class); - - protected WKTReader wktReader = new WKTReader(); - - public HorizontalProfileDataCollector(String[] names) { - super(names); - } - - public String[] getData(Result result) - throws TransitionException { - - if (rd == null) - init(result); - - try { - String [] entries = new String[names.length+1]; - int j = 0; - for (int i = 0; i < names.length; i++) { - - if (names[i].equals("SHAPE")) { - Point p = (Point)wktReader.read(result.getString("SHAPE")); - - entries[j++] = ""+p.getX(); - entries[j++] = ""+p.getY(); - } - else { - entries[j++] = result.getString(names[i]); - } - } - - return entries; - } - catch (ParseException pe) { - log.error(pe, pe); - throw new TransitionException( - "Error occured while parsing a Point from WKT."); - } - } -}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gnv-artifacts/src/main/java/de/intevation/gnv/exports/ShapeDataCollector.java Mon Nov 09 10:16:10 2009 +0000 @@ -0,0 +1,60 @@ +package de.intevation.gnv.exports; + +import java.util.List; +import java.util.ArrayList; + +import org.apache.log4j.Logger; + +import com.vividsolutions.jts.io.WKTReader; +import com.vividsolutions.jts.io.ParseException; +import com.vividsolutions.jts.geom.Point; + +import de.intevation.gnv.geobackend.base.Result; +import de.intevation.gnv.transition.exception.TransitionException; + + +/** + * @author Ingo Weinzierl (ingo.weinzierl@intevation.de) + */ +public class ShapeDataCollector +extends DefaultDataCollector +{ + private Logger log = Logger.getLogger(ShapeDataCollector.class); + + protected WKTReader wktReader = new WKTReader(); + + public ShapeDataCollector(String[] names) { + super(names); + } + + public String[] getData(Result result) + throws TransitionException { + + if (rd == null) + init(result); + + try { + String [] entries = new String[names.length+1]; + int j = 0; + for (int i = 0; i < names.length; i++) { + + if (names[i].equals("SHAPE")) { + Point p = (Point)wktReader.read(result.getString("SHAPE")); + + entries[j++] = ""+p.getX(); + entries[j++] = ""+p.getY(); + } + else { + entries[j++] = result.getString(names[i]); + } + } + + return entries; + } + catch (ParseException pe) { + log.error(pe, pe); + throw new TransitionException( + "Error occured while parsing a Point from WKT."); + } + } +}
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/transition/profile/horizontal/HorizontalProfileOutputTransition.java Mon Nov 09 09:52:18 2009 +0000 +++ b/gnv-artifacts/src/main/java/de/intevation/gnv/transition/profile/horizontal/HorizontalProfileOutputTransition.java Mon Nov 09 10:16:10 2009 +0000 @@ -30,7 +30,7 @@ import de.intevation.gnv.transition.timeseries.TimeSeriesOutputTransition; import de.intevation.gnv.exports.DefaultExport; -import de.intevation.gnv.exports.HorizontalProfileDataCollector; +import de.intevation.gnv.exports.ShapeDataCollector; import de.intevation.gnv.exports.DefaultProfile; import de.intevation.gnv.exports.Export.Profile; @@ -108,12 +108,8 @@ log.debug("createCSV for HorizontalProfileOutputTransition."); DefaultExport export = new DefaultExport( - new HorizontalProfileDataCollector(TIMESERIES_CSV_PROFILE_NAMES)); + new ShapeDataCollector(TIMESERIES_CSV_PROFILE_NAMES)); export.create(TIMESERIES_CSV_PROFILE, outputStream, chartResult); - } - - - }