changeset 2731:55a3b575f644

Handle 'classical' discharges, theoretically. flys-artifacts/trunk@4464 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Felix Wolfsteller <felix.wolfsteller@intevation.de>
date Tue, 22 May 2012 18:50:57 +0000
parents 0657e7966c87
children 7311d0336600
files flys-artifacts/ChangeLog flys-artifacts/src/main/java/de/intevation/flys/exports/ComputedDischargeCurveGenerator.java
diffstat 2 files changed, 40 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/flys-artifacts/ChangeLog	Tue May 22 18:23:32 2012 +0000
+++ b/flys-artifacts/ChangeLog	Tue May 22 18:50:57 2012 +0000
@@ -1,3 +1,8 @@
+2012-05-22  Felix Wolfsteller <felix.wolfsteller@intevation.de>
+
+	* src/main/java/de/intevation/flys/exports/ComputedDischargeCurveGenerator.java:
+	  Render discharge outs (was own out once).
+
 2012-05-22  Felix Wolfsteller <felix.wolfsteller@intevation.de>
 
 	* doc/conf/artifacts/winfo.xml: Allow cross-section stuff in
--- a/flys-artifacts/src/main/java/de/intevation/flys/exports/ComputedDischargeCurveGenerator.java	Tue May 22 18:23:32 2012 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/ComputedDischargeCurveGenerator.java	Tue May 22 18:50:57 2012 +0000
@@ -14,8 +14,11 @@
 import de.intevation.artifactdatabase.state.ArtifactAndFacet;
 import de.intevation.artifactdatabase.state.Facet;
 
+import de.intevation.flys.artifacts.WINFOArtifact;
+
 import de.intevation.flys.artifacts.model.FacetTypes;
 import de.intevation.flys.artifacts.model.WQKms;
+import de.intevation.flys.artifacts.model.WKms;
 
 import de.intevation.flys.jfree.FLYSAnnotation;
 import de.intevation.flys.jfree.StickyAxisAnnotation;
@@ -91,6 +94,9 @@
     }
 
 
+    /**
+     * Process data, build up plot.
+     */
     @Override
     public void doOut(
         ArtifactAndFacet artifactFacet,
@@ -129,7 +135,7 @@
             doAnnotations((FLYSAnnotation)
                 artifactFacet.getData(context), artifactFacet, attr, visible);
         }
-        else if (name.equals(STATIC_WKMS_INTERPOL)) {
+        else if (name.equals(STATIC_WKMS_INTERPOL) || name.equals(HEIGHTMARKS_POINTS)) {
             doWAnnotations(
                 artifactFacet.getData(context),
                 artifactFacet,
@@ -141,6 +147,14 @@
                 artifactFacet,
                 attr, visible, YAXIS.W.idx);
         }
+        else if (name.equals(DISCHARGE_CURVE)) {
+            doDischargeOut(
+                (WINFOArtifact) artifactFacet.getArtifact(),
+                artifactFacet.getData(context),
+                artifactFacet.getFacetDescription(),
+                attr,
+                visible);
+        }
         else {
             logger.warn("Unknown facet type for computed discharge: " + name);
             return;
@@ -224,14 +238,28 @@
         Facet facet = aandf.getFacet();
 
         List<StickyAxisAnnotation> xy = new ArrayList<StickyAxisAnnotation>();
-        double [][] data = (double [][]) wqkms;
-        for (int i = 0; i< data[0].length; i++) {
+        // Try to find them as WKms as well...
+        if (wqkms instanceof double[][]) {
+            double [][] data = (double [][]) wqkms;
+            for (int i = 0; i< data[0].length; i++) {
+                xy.add(new StickyAxisAnnotation(aandf.getFacetDescription(),
+                    (float) data[1][i], StickyAxisAnnotation.SimpleAxis.Y_AXIS));
+            }
+
+            doAnnotations(new FLYSAnnotation(facet.getDescription(), xy),
+                aandf, theme, visible);
+        }
+        else {
+            WKms data = (WKms) wqkms;
+            // assume its WKms
             xy.add(new StickyAxisAnnotation(aandf.getFacetDescription(),
-                (float) data[1][i], StickyAxisAnnotation.SimpleAxis.Y_AXIS));
+              (float) data.getW(0), StickyAxisAnnotation.SimpleAxis.Y_AXIS));
+            xy.add(new StickyAxisAnnotation(aandf.getFacetDescription(),
+              (float) 180f, StickyAxisAnnotation.SimpleAxis.Y_AXIS));
+
+            doAnnotations(new FLYSAnnotation(facet.getDescription(), xy),
+                aandf, theme, visible);
         }
-
-        doAnnotations(new FLYSAnnotation(facet.getDescription(), xy),
-            aandf, theme, visible);
     }
 }
 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org