# HG changeset patch # User Tim Englich # Date 1255621095 0 # Node ID f2c76f35da5aa1a27231f40f09e3e6fcfdf16c00 # Parent 9bcf315f57e40d2b0e1ad02b8c1f4ee1195e0394 Added missing Class Description Values to the Horizontal Profile Charts gnv-artifacts/trunk@223 c6561f87-3c4e-4783-a992-168aeb5c3f6f diff -r 9bcf315f57e4 -r f2c76f35da5a gnv-artifacts/ChangeLog --- a/gnv-artifacts/ChangeLog Thu Oct 15 14:19:40 2009 +0000 +++ b/gnv-artifacts/ChangeLog Thu Oct 15 15:38:15 2009 +0000 @@ -1,3 +1,14 @@ +2009-10-15 Tim Englich + + * src/main/java/de/intevation/gnv/chart/HorizontalProfileChartFactory.java, + * src/main/java/de/intevation/gnv/chart/VerticalProfileChartFactory.java, + * src/main/java/de/intevation/gnv/transition/profile/horizontal/HorizontalProfileOutputTransition.java, + * src/main/java/de/intevation/gnv/transition/profile/vertical/VerticalProfileOutputTransition.java, + * src/main/java/de/intevation/gnv/transition/timeseries/TimeSeriesOutputTransition.java, + * src/test/ressources/queries.properties, + src/test/ressources/conf.xml: + Added missing Class Description Values to the Horizontal Profile Charts + 2009-10-15 Tim Englich * src/main/java/de/intevation/gnv/transition/timeseries/TimeSeriesOutputTransition.java (getFisName): diff -r 9bcf315f57e4 -r f2c76f35da5a gnv-artifacts/src/main/java/de/intevation/gnv/chart/HorizontalProfileChartFactory.java --- a/gnv-artifacts/src/main/java/de/intevation/gnv/chart/HorizontalProfileChartFactory.java Thu Oct 15 14:19:40 2009 +0000 +++ b/gnv-artifacts/src/main/java/de/intevation/gnv/chart/HorizontalProfileChartFactory.java Thu Oct 15 15:38:15 2009 +0000 @@ -27,6 +27,7 @@ import de.intevation.gnv.chart.exception.TechnicalChartException; import de.intevation.gnv.geobackend.base.Result; +import de.intevation.gnv.transition.describedata.KeyValueDescibeData; /** * @@ -100,4 +101,27 @@ } return series; } + + + /** + * + * @see de.intevation.gnv.chart.VerticalProfileChartFactory#createSeriesName(java.util.Collection, java.util.Collection, java.util.Collection, java.lang.String, java.lang.String, java.lang.String) + */ + @Override + protected String createSeriesName( + Collection break1Candidates, + Collection break2Candidates, + Collection break3Candidates, + String break1, String break2, String break3) { + String seriesName = super.createSeriesName(break1Candidates, + break2Candidates, + break3Candidates, + break1, + break2, + break3) + +" " + + findValueTitle(break3Candidates, + break3); + return seriesName.trim(); + } } diff -r 9bcf315f57e4 -r f2c76f35da5a gnv-artifacts/src/main/java/de/intevation/gnv/chart/VerticalProfileChartFactory.java --- a/gnv-artifacts/src/main/java/de/intevation/gnv/chart/VerticalProfileChartFactory.java Thu Oct 15 14:19:40 2009 +0000 +++ b/gnv-artifacts/src/main/java/de/intevation/gnv/chart/VerticalProfileChartFactory.java Thu Oct 15 15:38:15 2009 +0000 @@ -63,6 +63,7 @@ ChartStyle pStyle, Collection parameters, Collection measurements, + Collection dates, OutputStream outputStream, Collection resultSet) throws IOException, @@ -82,7 +83,7 @@ if (sDebug) sLogger.debug(" vor createDataset()"); XYDataset lSet = this.createDataset(resultSet, lUpperLevel, - lLowerLevel, parameters, measurements); + lLowerLevel, parameters, measurements, dates); if (sDebug) sLogger.debug(" nach createDataset()"); final Color[] color = { Color.black, Color.red, Color.green, Color.blue }; @@ -249,7 +250,8 @@ private XYDataset createDataset(Collection resultSet, int lUpperCut, int lLowerCut, Collection parameters, - Collection measurements) + Collection measurements, + Collection dates) throws TechnicalChartException { XYSeriesCollection xyDataset = new XYSeriesCollection(); @@ -273,10 +275,7 @@ if (!break1.equals(row.getString("GROUP1")) || !break2.equals(row.getString("GROUP2")) || !break3.equals(row.getString("GROUP3"))) { - String seriesName = findValueTitle(parameters, break1) - + " " - + findValueTitle(measurements, - break2); + String seriesName = this.createSeriesName(parameters, measurements, dates, break1, break2, break3); sLogger.debug("Neuer Datensatz " + seriesName + "von Datensätzen " + mStart + " / " + mEnd); @@ -294,8 +293,7 @@ i = i + 1; } - String seriesName = findValueTitle(parameters, break1) + " " - + findValueTitle(measurements, break2); + String seriesName = this.createSeriesName(parameters, measurements, dates, break1, break2, break3); sLogger.debug("Neuer Datensatz " + seriesName + "von Datensätzen " + mStart + " / " + mEnd); xyDataset.addSeries(createXYSeries(seriesName, resultSet, @@ -308,6 +306,25 @@ return xyDataset; } + /** + * @param parameters + * @param measurements + * @param break1 + * @param break2 + * @return + */ + protected String createSeriesName( + Collection break1Candidates, + Collection break2Candidates, + Collection break3Candidates, + String break1, String break2, String break3) { + String seriesName = findValueTitle(break1Candidates, break1) + + " " + + findValueTitle(break2Candidates, + break2); + return seriesName.trim(); + } + private void encodeChart(JFreeChart pChart, ChartStyle pStyle, OutputStream outputStream) throws IOException { if (sDebug) @@ -325,7 +342,7 @@ } - private String findValueTitle(Collection values, + protected String findValueTitle(Collection values, String id) { if (values != null) { Iterator it = values.iterator(); @@ -336,6 +353,6 @@ } } } - return id; + return ""; } } diff -r 9bcf315f57e4 -r f2c76f35da5a 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 Thu Oct 15 14:19:40 2009 +0000 +++ b/gnv-artifacts/src/main/java/de/intevation/gnv/transition/profile/horizontal/HorizontalProfileOutputTransition.java Thu Oct 15 15:38:15 2009 +0000 @@ -60,12 +60,13 @@ protected void createChart(OutputStream outputStream, Collection parameters, Collection measurements, + Collection dates, ChartStyle chartStyle, ChartLabels chartLables, String uuid) throws IOException, TechnicalChartException { HorizontalProfileChartFactory chartFactory = new HorizontalProfileChartFactory(); chartFactory.createProfileChart(chartLables, chartStyle, parameters, - measurements, outputStream, this.getChartResult(uuid)); + measurements,dates, outputStream, this.getChartResult(uuid)); } /** diff -r 9bcf315f57e4 -r f2c76f35da5a gnv-artifacts/src/main/java/de/intevation/gnv/transition/profile/vertical/VerticalProfileOutputTransition.java --- a/gnv-artifacts/src/main/java/de/intevation/gnv/transition/profile/vertical/VerticalProfileOutputTransition.java Thu Oct 15 14:19:40 2009 +0000 +++ b/gnv-artifacts/src/main/java/de/intevation/gnv/transition/profile/vertical/VerticalProfileOutputTransition.java Thu Oct 15 15:38:15 2009 +0000 @@ -44,12 +44,13 @@ protected void createChart(OutputStream outputStream, Collection parameters, Collection measurements, + Collection dates, ChartStyle chartStyle, ChartLabels chartLables, String uuid) throws IOException, TechnicalChartException { VerticalProfileChartFactory chartFactory = new VerticalProfileChartFactory(); chartFactory.createProfileChart(chartLables, chartStyle, parameters, - measurements, outputStream, this.getChartResult(uuid)); + measurements,dates, outputStream, this.getChartResult(uuid)); } /** diff -r 9bcf315f57e4 -r f2c76f35da5a gnv-artifacts/src/main/java/de/intevation/gnv/transition/timeseries/TimeSeriesOutputTransition.java --- a/gnv-artifacts/src/main/java/de/intevation/gnv/transition/timeseries/TimeSeriesOutputTransition.java Thu Oct 15 14:19:40 2009 +0000 +++ b/gnv-artifacts/src/main/java/de/intevation/gnv/transition/timeseries/TimeSeriesOutputTransition.java Thu Oct 15 15:38:15 2009 +0000 @@ -69,6 +69,7 @@ protected String featureValuesName = "featureid"; protected String parameterValuesName = "parameterid"; protected String measuremenValueName = "measurementid"; + protected String dateValueName = "dateid"; /** * Constructor @@ -122,11 +123,13 @@ .getParameters(); Collection measurements = this .getMeasurements(); + Collection dates = this + .getDates(); ChartStyle chartStyle = this .creatStyle(chartWidth, chartHeight); ChartLabels chartLables = new ChartLabels(this.getFisName(callMeta.getLanguages())+" "+this .getSelectedFeatureName(), this.domainLable); - this.createChart(outputStream, parameters, measurements, + this.createChart(outputStream, parameters, measurements,dates, chartStyle, chartLables, uuid); } else if (outputMode.equalsIgnoreCase("csv")) { log.debug("CSV-File will be generated."); @@ -263,6 +266,7 @@ protected void createChart(OutputStream outputStream, Collection parameters, Collection measurements, + Collection dates, ChartStyle chartStyle, ChartLabels chartLables, String uuid) throws IOException, TechnicalChartException { @@ -300,6 +304,9 @@ protected Collection getMeasurements() { return this.getCollection(measuremenValueName); } + protected Collection getDates() { + return this.getCollection(dateValueName); + } @Override public void setup(Node configuration) { @@ -319,6 +326,12 @@ if (measurementNameValue != null) { this.measuremenValueName = measurementNameValue; } + + String dateNameValue = Config.getStringXPath(configuration, + "value-names/value-name[@name='date']/@value"); + if (dateNameValue != null) { + this.dateValueName = dateNameValue; + } } /** diff -r 9bcf315f57e4 -r f2c76f35da5a gnv-artifacts/src/test/ressources/conf.xml --- a/gnv-artifacts/src/test/ressources/conf.xml Thu Oct 15 14:19:40 2009 +0000 +++ b/gnv-artifacts/src/test/ressources/conf.xml Thu Oct 15 15:38:15 2009 +0000 @@ -711,7 +711,7 @@ - + @@ -841,7 +841,7 @@ - + diff -r 9bcf315f57e4 -r f2c76f35da5a gnv-artifacts/src/test/ressources/queries.properties --- a/gnv-artifacts/src/test/ressources/queries.properties Thu Oct 15 14:19:40 2009 +0000 +++ b/gnv-artifacts/src/test/ressources/queries.properties Thu Oct 15 15:38:15 2009 +0000 @@ -468,8 +468,8 @@ horizontalprofile_mesh_chart_data = SELECT ST_ASTEXT(SHAPE), \ msv.DATAVALUE YORDINATE, \ msv.PARAMETERID GROUP1, \ - msv.TIMEVALUE GROUP2, \ - MEDIAN.MESHPOINT.KPOSITION GROUP3, \ + MEDIAN.MESHPOINT.KPOSITION GROUP2, \ + msv.TIMEVALUE GROUP3, \ MEDIAN.MESHPOINT.JPOSITION , \ MEDIAN.MESHPOINT.IPOSITION \ from MEDIAN.MESHLAYER ml, \ @@ -493,8 +493,8 @@ mp.MESHID = m.MESHID AND \ KPOSITION in ( ? ) and \ ? = (select ? from MEDIAN.MESHPOINT where FEATUREID = ?)) \ - order by MEDIAN.MESHPOINT.KPOSITION, \ - msv.TIMEVALUE, \ + order by msv.TIMEVALUE, \ + MEDIAN.MESHPOINT.KPOSITION, \ msv.PARAMETERID, \ MEDIAN.MESHPOINT.JPOSITION , \ MEDIAN.MESHPOINT.IPOSITION