# HG changeset patch # User Ingo Weinzierl # Date 1257761770 0 # Node ID c8ecc0c0bcb45671cdd4d6c38c1e48cacc9b7fe1 # Parent a7fa7b40489793f8d197f047e6d3bec13e8c6c22 Renaming HorizontalProfileDataCollector into ShapeDataCollector. gnv-artifacts/trunk@303 c6561f87-3c4e-4783-a992-168aeb5c3f6f diff -r a7fa7b404897 -r c8ecc0c0bcb4 gnv-artifacts/ChangeLog --- 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 + + * 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 * src/main/java/de/intevation/gnv/exports/HorizontalProfileDataCollector.java: diff -r a7fa7b404897 -r c8ecc0c0bcb4 gnv-artifacts/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."); - } - } -} diff -r a7fa7b404897 -r c8ecc0c0bcb4 gnv-artifacts/src/main/java/de/intevation/gnv/exports/ShapeDataCollector.java --- /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."); + } + } +} diff -r a7fa7b404897 -r c8ecc0c0bcb4 gnv-artifacts/src/main/java/de/intevation/gnv/transition/profile/horizontal/HorizontalProfileOutputTransition.java --- 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); - } - - - }