changeset 150:c904d52cdfd0

Don't used interleaved x/y data. flys-artifacts/trunk@1574 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Fri, 25 Mar 2011 13:51:09 +0000
parents 5a7662bb948c
children 4eddbb219866
files flys-artifacts/ChangeLog flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/DischargeTables.java
diffstat 2 files changed, 14 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/flys-artifacts/ChangeLog	Fri Mar 25 11:03:51 2011 +0000
+++ b/flys-artifacts/ChangeLog	Fri Mar 25 13:51:09 2011 +0000
@@ -1,3 +1,9 @@
+2011-03-25	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
+
+	* src/main/java/de/intevation/flys/artifacts/model/DischargeTables.java:
+	  Store data in a double [][] instead of interleaved double []
+	  to be compatible with org.jfree.data.xy.DefaultXYDataset.
+
 2011-03-25  Ingo Weinzierl <ingo@intevation.de>
 
 	* TODO: Removed 'i18n' and 'step-back' TODOs and added an issue to remove
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/DischargeTables.java	Fri Mar 25 11:03:51 2011 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/DischargeTables.java	Fri Mar 25 13:51:09 2011 +0000
@@ -28,7 +28,7 @@
 
     protected String riverName;
 
-    protected Map<String, double []> values;
+    protected Map<String, double [][]> values;
 
     public DischargeTables() {
     }
@@ -42,15 +42,15 @@
         this.gaugeNames = gaugeNames;
     }
 
-    public Map<String, double []> getValues() {
+    public Map<String, double [][]> getValues() {
         if (values == null) {
             values = loadValues();
         }
         return values;
     }
 
-    protected Map<String, double []> loadValues() {
-        Map<String, double []> values = new HashMap<String, double []>();
+    protected Map<String, double [][]> loadValues() {
+        Map<String, double [][]> values = new HashMap<String, double [][]>();
 
         SessionFactory sf = SessionFactoryProvider.getSessionFactory();
         Session session = sf.openSession();
@@ -84,12 +84,13 @@
                 List<DischargeTableValue> dtvs =
                     table.getDischargeTableValues();
 
-                double [] vs = new double[dtvs.size() << 1];
+                double [][] vs = new double[2][dtvs.size()];
 
                 int idx = 0;
                 for (DischargeTableValue dtv: dtvs) {
-                    vs[idx++] = dtv.getW().doubleValue();
-                    vs[idx++] = dtv.getQ().doubleValue();
+                    vs[0][idx] = dtv.getW().doubleValue();
+                    vs[1][idx] = dtv.getQ().doubleValue();
+                    ++idx;
                 }
 
                 values.put(gaugeName, vs);

http://dive4elements.wald.intevation.org