Mercurial > dive4elements > gnv-client
changeset 1076:dc9727a67d41
Added odv support for horizontal profiles using vector data.
gnv-artifacts/trunk@1177 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Ingo Weinzierl <ingo.weinzierl@intevation.de> |
---|---|
date | Tue, 08 Jun 2010 14:34:31 +0000 (2010-06-08) |
parents | 3cbb05c85541 |
children | 1728aac87717 |
files | gnv-artifacts/ChangeLog gnv-artifacts/src/main/java/de/intevation/gnv/state/profile/horizontal/HorizontalProfileMeshVectorOutputState.java |
diffstat | 2 files changed, 83 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/gnv-artifacts/ChangeLog Tue Jun 08 13:02:16 2010 +0000 +++ b/gnv-artifacts/ChangeLog Tue Jun 08 14:34:31 2010 +0000 @@ -1,3 +1,8 @@ +2010-06-08 Ingo Weinzierl <ingo.weinzierl@intevation.de> + + * src/main/java/de/intevation/gnv/state/profile/horizontal/HorizontalProfileMeshVectorOutputState.java: + Added odv support for horizontal profiles using vector data. + 2010-06-08 Ingo Weinzierl <ingo.weinzierl@intevation.de> * doc/conf/products/horizontalprofile/conf_mesh.xml: Added the transitions
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/state/profile/horizontal/HorizontalProfileMeshVectorOutputState.java Tue Jun 08 13:02:16 2010 +0000 +++ b/gnv-artifacts/src/main/java/de/intevation/gnv/state/profile/horizontal/HorizontalProfileMeshVectorOutputState.java Tue Jun 08 14:34:31 2010 +0000 @@ -1,5 +1,7 @@ package de.intevation.gnv.state.profile.horizontal; +import au.com.bytecode.opencsv.CSVWriter; + import de.intevation.artifacts.CallContext; import de.intevation.gnv.artifacts.cache.CacheFactory; @@ -8,10 +10,21 @@ import de.intevation.gnv.chart.ChartLabels; import de.intevation.gnv.chart.HorizontalProfileVectorChart; +import de.intevation.gnv.exports.DefaultExport; +import de.intevation.gnv.exports.DefaultProfile; +import de.intevation.gnv.exports.Export; +import de.intevation.gnv.exports.Export.Profile; +import de.intevation.gnv.exports.SimpleOdvDataCollector; + import de.intevation.gnv.geobackend.base.Result; import de.intevation.gnv.utils.VectorDataProcessor; +import de.intevation.gnv.state.exception.StateException; + +import java.io.IOException; +import java.io.OutputStream; + import java.util.Collection; import java.util.Locale; @@ -40,6 +53,50 @@ }; + public static final String[] ODV_COLUMN_HEADERS = { + "Cruise", + "Station", + "Type", + "yyyy-mm-dd hh:mm", + "Lon (°E)", + "Lat (°N)", + "Bot. Depth [m]", + "Depth [m]", + "QF", + "XComponent", + "QF", + "YComponent", + "QF", + "ZComponent", + "QF", + "Speed", + "QF", + "Direction", + "QF" + }; + + + public static final String[] ODV_PROFILE_NAMES = { + "CRUISE", + "STATION", + "TYPE", + "TIMEVALUE", + "SHAPE", + "BOTDEPTH", + "DEPTH", + "QF", + "XCOMPONENT", + "QF", + "YCOMPONENT", + "QF", + "ZCOMPONENT", + "QF", + "SPEED", + "QF", + "DIRECTION", + "QF"}; + + @Override protected Object getChartResult(String uuid, CallContext callContext) { logger.debug("Fetch data for horizontalprofile chart with vector data"); @@ -107,5 +164,26 @@ return chart; } + + + @Override + protected void createODV( + OutputStream outputStream, Collection result, String uuid) + throws IOException, StateException + { + logger.info("Start exporting " + result.size() + " items to odv."); + Export export = new DefaultExport( + new SimpleOdvDataCollector(ODV_PROFILE_NAMES)); + + Profile profile = new DefaultProfile( + ODV_COLUMN_HEADERS, + '\t', + CSVWriter.NO_QUOTE_CHARACTER, + CSVWriter.NO_ESCAPE_CHARACTER, + "ODV", + "ISO-8859-1"); + + export.create(profile, outputStream, result); + } } // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :