Mercurial > dive4elements > gnv-client
changeset 218:926530bda1a7
Integrated the OutputTransition for Horizontal Cross-Sections
gnv-artifacts/trunk@278 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Tim Englich <tim.englich@intevation.de> |
---|---|
date | Fri, 30 Oct 2009 11:26:03 +0000 |
parents | 3dcd2b0b456e |
children | f8cb64d5fe4f |
files | gnv-artifacts/ChangeLog gnv-artifacts/doc/conf/products/horizontalcrosssection/conf_mesh.xml gnv-artifacts/doc/conf/queries.properties gnv-artifacts/src/main/java/de/intevation/gnv/chart/HorizontalCrossSectionChartFactory.java gnv-artifacts/src/main/java/de/intevation/gnv/statistics/HorizontalCrossSectionStatistics.java gnv-artifacts/src/main/java/de/intevation/gnv/transition/profile/horizontalcrosssection/HorizontalCrossSectionMeshOutputTransition.java |
diffstat | 6 files changed, 246 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/gnv-artifacts/ChangeLog Thu Oct 29 15:58:47 2009 +0000 +++ b/gnv-artifacts/ChangeLog Fri Oct 30 11:26:03 2009 +0000 @@ -1,3 +1,17 @@ +2009-10-30 Tim Englich <tim.englich@intevation.de> + + * doc/conf/queries.properties: + Added the Query for selecting the Data for generating Outputs of + HorizontalCrossSectionMeshOutputTransition + * doc/conf/products/horizontalcrosssection/conf_mesh.xml: + Added the configuration for the HorizontalCrossSectionMeshOutputTransition + * src/main/java/de/intevation/gnv/transition/profile/horizontalcrosssection/HorizontalCrossSectionMeshOutputTransition.java: + Added the OutputTransition for generating /HorizontalCrossSections. + * src/main/java/de/intevation/gnv/statistics/HorizontalCrossSectionStatistics.java: + The Class for generating the Statistics to HorizontalCrossSections + * src/main/java/de/intevation/gnv/chart/HorizontalCrossSectionChartFactory.java: + The Class Stub for generating HorizontalCrossSections Charts. + 2009-10-29 Tim Englich <tim.englich@intevation.de> * doc/conf/products/timeseries/timegap_definition.xml,
--- a/gnv-artifacts/doc/conf/products/horizontalcrosssection/conf_mesh.xml Thu Oct 29 15:58:47 2009 +0000 +++ b/gnv-artifacts/doc/conf/products/horizontalcrosssection/conf_mesh.xml Fri Oct 30 11:26:03 2009 +0000 @@ -44,7 +44,7 @@ <transition id="horizontalcrosssection_mesh_date" description="horizontalcrosssection_mesh_date" transition="de.intevation.gnv.transition.DefaultTransition"> <queryID>horizontalcrosssection_mesh_date</queryID> <dataname>dateid</dataname> - <data-multiselect>true</data-multiselect> + <data-multiselect>false</data-multiselect> <reachableTransitions> <transition>horizontalcrosssection_mesh_calculate_results</transition> </reachableTransitions> @@ -56,13 +56,13 @@ </inputvalues> </transition> - <transition id="horizontalcrosssection_mesh_calculate_results" description="horizontalcrosssection_mesh_calculate_results" transition="de.intevation.gnv.transition.timeseries.TimeSeriesOutputTransition"> + <transition id="horizontalcrosssection_mesh_calculate_results" description="horizontalcrosssection_mesh_calculate_results" transition="de.intevation.gnv.transition.profile.horizontalcrosssection.HorizontalCrossSectionMeshOutputTransition"> <queryID>horizontalcrosssection_mesh_data</queryID> <inputvalues> - <inputvalue name="meshid" type="Integer" multiselect="false" usedinquery="0"/> - <inputvalue name="depthid" type="Integer" multiselect="false" usedinquery="0"/> - <inputvalue name="parameterid" type="Integer" multiselect="false" usedinquery="0" /> - <inputvalue name="dateid" type="Date" multiselect="true" usedinquery="0" /> + <inputvalue name="parameterid" type="Integer" multiselect="false" usedinquery="1" /> + <inputvalue name="dateid" type="Date" multiselect="false" usedinquery="1" /> + <inputvalue name="meshid" type="Integer" multiselect="false" usedinquery="1"/> + <inputvalue name="depthid" type="Integer" multiselect="false" usedinquery="1"/> <inputvalue name="fisname" type="String" multiselect="false" usedinquery="0"/> </inputvalues> <value-names>
--- a/gnv-artifacts/doc/conf/queries.properties Thu Oct 29 15:58:47 2009 +0000 +++ b/gnv-artifacts/doc/conf/queries.properties Fri Oct 30 11:26:03 2009 +0000 @@ -619,4 +619,24 @@ msv.PARAMETERID = ? \ order by msv.TIMEVALUE -horizontalcrosssection_mesh_data = Select 1 from dual; \ No newline at end of file +horizontalcrosssection_mesh_data = SELECT ST_ASTEXT(SHAPE), \ + MSV.DATAVALUE YORDINATE, \ + MEDIAN.MESHFACE.JPOSITION, \ + MEDIAN.MESHFACE.IPOSITION, \ + MEDIAN.MESHFACE.KPOSITION \ + from MEDIAN.MESHLAYER ML, \ + MEDIAN.MESHFACE, \ + MEDIAN.MESH M, \ + MEDIAN.MESHSCALARVALUE MSV \ + where MSV.FEATUREID = MEDIAN.MESHFACE.FEATUREID AND \ + ML.KPOSITION = MEDIAN.MESHFACE.KPOSITION and \ + ML.MESHID = MEDIAN.MESHFACE.MESHID and \ + M.MESHID = MEDIAN.MESHFACE.MESHID AND \ + M.PARTIDMIN <= MSV.PARTID AND \ + M.PARTIDMAX >= MSV.PARTID AND \ + MSV.PARAMETERID = ? AND \ + MSV.TIMEVALUE = ? AND \ + M.OBJECTID = ? AND \ + MEDIAN.MESHFACE.KPOSITION = ? \ + order by MEDIAN.MESHFACE.JPOSITION , \ + MEDIAN.MESHFACE.IPOSITION \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gnv-artifacts/src/main/java/de/intevation/gnv/chart/HorizontalCrossSectionChartFactory.java Fri Oct 30 11:26:03 2009 +0000 @@ -0,0 +1,57 @@ +/** + * Title: ChartFactory, $Header: /share/gdi/SDI-Suite/Repository/projekte/BSH-GDI/genericViewer/src/main/java/de/conterra/bsh/gdi/gnviewer/output/chart/ChartFactory.java,v 1.8 2007/12/21 12:31:15 blume Exp $ + * Source: $Source: /share/gdi/SDI-Suite/Repository/projekte/BSH-GDI/genericViewer/src/main/java/de/conterra/bsh/gdi/gnviewer/output/chart/ChartFactory.java,v $ + * created by: Stefan Blume (blume) + * erstellt am: 06.12.2007 + * Copyright: con terra GmbH, 2005 + * + * modified by: $Author: blume $ + * modified on: $Date: 2007/12/21 12:31:15 $ + * Version: $Revision: 1.8 $ + * TAG: $Name: $ + * locked from: $Locker: $ + * CVS State: $State: Exp $ + * Project: $ProjectName$ + */ +package de.intevation.gnv.chart; + +import java.io.IOException; +import java.io.OutputStream; +import java.util.Collection; + +import org.apache.log4j.Logger; +import org.jfree.chart.plot.PlotOrientation; + +import de.intevation.gnv.chart.exception.TechnicalChartException; +import de.intevation.gnv.geobackend.base.Result; +import de.intevation.gnv.transition.describedata.KeyValueDescibeData; + +/** + * + * @author Tim Englich <tim.englich@intevation.de> + * + */ +public class HorizontalCrossSectionChartFactory { + + /** + * Default Logging instance + */ + private static Logger sLogger = Logger + .getLogger(HorizontalCrossSectionChartFactory.class); + private static boolean sDebug = sLogger.isDebugEnabled(); + protected PlotOrientation plotOrientation = PlotOrientation.HORIZONTAL; + + public synchronized void createProfileChart( + ChartLabels pLabels, + ChartStyle pStyle, + Collection<KeyValueDescibeData> parameters, + Collection<KeyValueDescibeData> measurements, + Collection<KeyValueDescibeData> dates, + OutputStream outputStream, + Collection<Result> resultSet) + throws IOException, + TechnicalChartException { + + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gnv-artifacts/src/main/java/de/intevation/gnv/statistics/HorizontalCrossSectionStatistics.java Fri Oct 30 11:26:03 2009 +0000 @@ -0,0 +1,27 @@ +/** + * + */ +package de.intevation.gnv.statistics; + +import java.sql.SQLException; + +import de.intevation.gnv.geobackend.base.Result; + +/** + * @author Tim Englich <tim.englich@intevation.de> + * + */ +public class HorizontalCrossSectionStatistics extends TimeseriesStatistics { + + /** + * Constructor + */ + public HorizontalCrossSectionStatistics() { + super(); + } + + @Override + protected double calculateXOrdinateValue(Result row) throws SQLException { + return 0; // TODO: Select propper Value + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gnv-artifacts/src/main/java/de/intevation/gnv/transition/profile/horizontalcrosssection/HorizontalCrossSectionMeshOutputTransition.java Fri Oct 30 11:26:03 2009 +0000 @@ -0,0 +1,121 @@ +/** + * + */ +package de.intevation.gnv.transition.profile.horizontalcrosssection; + +import java.io.IOException; +import java.io.OutputStream; +import java.io.OutputStreamWriter; +import java.io.UnsupportedEncodingException; +import java.util.Collection; +import java.util.Iterator; + +import org.apache.log4j.Logger; + +import au.com.bytecode.opencsv.CSVWriter; +import de.intevation.gnv.chart.ChartLabels; +import de.intevation.gnv.chart.ChartStyle; +import de.intevation.gnv.chart.HorizontalCrossSectionChartFactory; +import de.intevation.gnv.chart.exception.TechnicalChartException; +import de.intevation.gnv.geobackend.base.Result; +import de.intevation.gnv.statistics.HorizontalCrossSectionStatistics; +import de.intevation.gnv.statistics.Statistics; +import de.intevation.gnv.transition.describedata.KeyValueDescibeData; +import de.intevation.gnv.transition.exception.TransitionException; +import de.intevation.gnv.transition.timeseries.TimeSeriesOutputTransition; + +/** + * @author Tim Englich <tim.englich@intevation.de> + * + */ +public class HorizontalCrossSectionMeshOutputTransition + extends TimeSeriesOutputTransition { + + private static Logger log = Logger + .getLogger(HorizontalCrossSectionMeshOutputTransition.class); + + /** + * The UID of this Class + */ + private static final long serialVersionUID = 3233620652465061860L; + + /** + * Constructor + */ + public HorizontalCrossSectionMeshOutputTransition() { + super(); + super.domainLable = "Latitude [m]"; + } + + /** + * @see de.intevation.gnv.transition.timeseries.TimeSeriesOutputTransition#createChart(java.io.OutputStream, + * java.util.Collection, java.util.Collection, java.lang.String, + * de.intevation.gnv.chart.ChartStyle, + * de.intevation.gnv.chart.ChartLabels) + */ + @Override + protected void createChart(OutputStream outputStream, + Collection<KeyValueDescibeData> parameters, + Collection<KeyValueDescibeData> measurements, + Collection<KeyValueDescibeData> dates, + ChartStyle chartStyle, ChartLabels chartLables, + String uuid) throws IOException, + TechnicalChartException { + new HorizontalCrossSectionChartFactory(). + createProfileChart(chartLables, chartStyle, + parameters, measurements, + dates, outputStream, + this.getChartResult(uuid)); + } + + /** + * @see de.intevation.gnv.transition.timeseries.TimeSeriesOutputTransition#getStatisticsGenerator() + */ + @Override + protected Statistics getStatisticsGenerator() { + return new HorizontalCrossSectionStatistics(); + } + + /** + * @see de.intevation.gnv.transition.timeseries.TimeSeriesOutputTransition#createCSV(java.io.OutputStream, + * java.util.Collection) + */ + @Override + protected void createCSV(OutputStream outputStream, + Collection<Result> chartResult) + throws UnsupportedEncodingException, + IOException, + TransitionException { + if (chartResult != null) { + try { + CSVWriter writer = new CSVWriter(new OutputStreamWriter( + outputStream, "ISO-8859-1"), ','); + // USE THIS ENCODING BECAUSE OF + // PROBLEMS WITH EXCEL AND UTF-8 + Iterator<Result> it = chartResult.iterator(); + while (it.hasNext()) { + Result result = it.next(); + int i = 0; + // TODO implement me + String[] entries = new String[5]; + entries[i++] = result.getString("SHAPE"); + entries[i++] = result.getString("YORDINATE"); + entries[i++] = result.getString("IPOSITION"); + entries[i++] = result.getString("JPOSITION"); + entries[i++] = result.getString("KPOSITION"); + writer.writeNext(entries); + } + writer.close(); + } catch (Exception e) { + log.error(e,e); + throw new TransitionException( + "Exception occured while parsing an Point from WKT."); + } + } else { + log.error("No Data given for generating an CSV-File."); + throw new TransitionException( + "No Data given for generating an CSV-File."); + } + } + +}