changeset 179:f2c76f35da5a

Added missing Class Description Values to the Horizontal Profile Charts gnv-artifacts/trunk@223 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Tim Englich <tim.englich@intevation.de>
date Thu, 15 Oct 2009 15:38:15 +0000
parents 9bcf315f57e4
children 72bd41ba548d
files gnv-artifacts/ChangeLog gnv-artifacts/src/main/java/de/intevation/gnv/chart/HorizontalProfileChartFactory.java gnv-artifacts/src/main/java/de/intevation/gnv/chart/VerticalProfileChartFactory.java gnv-artifacts/src/main/java/de/intevation/gnv/transition/profile/horizontal/HorizontalProfileOutputTransition.java gnv-artifacts/src/main/java/de/intevation/gnv/transition/profile/vertical/VerticalProfileOutputTransition.java gnv-artifacts/src/main/java/de/intevation/gnv/transition/timeseries/TimeSeriesOutputTransition.java gnv-artifacts/src/test/ressources/conf.xml gnv-artifacts/src/test/ressources/queries.properties
diffstat 8 files changed, 86 insertions(+), 19 deletions(-) [+]
line wrap: on
line diff
--- 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  <tim.englich@intevation.de>
+
+	* 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  <tim.englich@intevation.de>
 
 	* src/main/java/de/intevation/gnv/transition/timeseries/TimeSeriesOutputTransition.java (getFisName): 
--- 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<KeyValueDescibeData> break1Candidates,
+                                    Collection<KeyValueDescibeData> break2Candidates,
+                                    Collection<KeyValueDescibeData> break3Candidates,
+                                    String break1, String break2, String break3) {
+        String seriesName = super.createSeriesName(break1Candidates,
+                                                   break2Candidates, 
+                                                   break3Candidates, 
+                                                   break1, 
+                                                   break2, 
+                                                   break3)
+                            +" "
+                            + findValueTitle(break3Candidates,
+                                    break3);
+        return seriesName.trim();
+    }
 }
--- 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<KeyValueDescibeData> parameters,
                                                 Collection<KeyValueDescibeData> measurements,
+                                                Collection<KeyValueDescibeData> dates,
                                                 OutputStream outputStream,
                                                 Collection<Result> 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<Result> resultSet,
                                     int lUpperCut, int lLowerCut,
                                     Collection<KeyValueDescibeData> parameters,
-                                    Collection<KeyValueDescibeData> measurements)
+                                    Collection<KeyValueDescibeData> measurements,
+                                    Collection<KeyValueDescibeData> 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<KeyValueDescibeData> break1Candidates,
+                                    Collection<KeyValueDescibeData> break2Candidates,
+                                    Collection<KeyValueDescibeData> 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<KeyValueDescibeData> values,
+    protected String findValueTitle(Collection<KeyValueDescibeData> values,
                                   String id) {
         if (values != null) {
             Iterator<KeyValueDescibeData> it = values.iterator();
@@ -336,6 +353,6 @@
                 }
             }
         }
-        return id;
+        return "";
     }
 }
--- 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<KeyValueDescibeData> parameters,
                                Collection<KeyValueDescibeData> measurements,
+                               Collection<KeyValueDescibeData> 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));
     }
 
     /**
--- 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<KeyValueDescibeData> parameters,
                                Collection<KeyValueDescibeData> measurements,
+                               Collection<KeyValueDescibeData> 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));
     }
 
     /**
--- 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<KeyValueDescibeData> measurements = this
                         .getMeasurements();
+                Collection<KeyValueDescibeData> 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<KeyValueDescibeData> parameters,
                                Collection<KeyValueDescibeData> measurements,
+                               Collection<KeyValueDescibeData> dates,
                                ChartStyle chartStyle, ChartLabels chartLables,
                                String uuid) throws IOException,
                                            TechnicalChartException {
@@ -300,6 +304,9 @@
     protected Collection<KeyValueDescibeData> getMeasurements() {
         return this.getCollection(measuremenValueName);
     }
+    protected Collection<KeyValueDescibeData> 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;
+        }
     }
 
     /**
--- 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 @@
                          <inputvalue name="fisname" type="String" multiselect="false" usedinquery="0"/>
                     </inputvalues>
                     <value-names>
-                        <value-name name="feature" value="cruiseid"></value-name>
+                        <value-name name="feature" value="trackid"></value-name>
                         <value-name name="parameter" value="parameterid"></value-name>
                         <value-name name="measurement" value="measurementid"></value-name>
                     </value-names>
@@ -841,7 +841,7 @@
                         <inputvalue name="fisname" type="String" multiselect="false" usedinquery="0"/>
                     </inputvalues>
                     <value-names>
-                        <value-name name="feature" value="meshid"></value-name>
+                        <value-name name="feature" value="mesh_point"></value-name>
                         <value-name name="parameter" value="parameterid"></value-name>
                         <value-name name="measurement" value="depthid"></value-name>
                     </value-names>
--- 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

http://dive4elements.wald.intevation.org