changeset 4482:b5624ef2808f

Merged
author Christian Lins <christian.lins@intevation.de>
date Tue, 13 Nov 2012 16:14:44 +0100
parents d9e3660fa462 (current diff) 14885031d974 (diff)
children cc6323401643
files
diffstat 7 files changed, 65 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/flys-artifacts/doc/conf/artifacts/winfo.xml	Tue Nov 13 16:13:41 2012 +0100
+++ b/flys-artifacts/doc/conf/artifacts/winfo.xml	Tue Nov 13 16:14:44 2012 +0100
@@ -632,6 +632,17 @@
                     <facet name="longitudinal_section.annotations" description="facet.longitudinal_section.annotations"/>
                   </facets>
                 </outputmode>
+                <outputmode name="cross_section" description="output.cross_section" mime-type="image/png" type="chart">
+                  <facets>
+                    <facet name="cross_section_water_line"   description="facet.cross_section_water_line"/>
+                    <facet name="cross_section"              description="facet.cross_section"/>
+                    <facet name="area"                       description="an area"/>
+                    <facet name="cross_section.area"         description="an area"/>
+                    <facet name="cross_section.manualpoints" description="points"/>
+                    <facet name="cross_section.manualline"   description="line"/>
+                    <facet name="hyk"                        description="hyks"/>
+                  </facets>
+                </outputmode>
                 <outputmode name="extreme_wq_curve" description="output.extreme_wq_curve" mine-type="image/png" type="chart">
                     <facets>
                         <facet name="extreme_wq_curve" description="Extreme WQ curve"/>
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/ManualPointsArtifact.java	Tue Nov 13 16:13:41 2012 +0100
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/ManualPointsArtifact.java	Tue Nov 13 16:14:44 2012 +0100
@@ -12,6 +12,7 @@
 import de.intevation.artifactdatabase.state.Facet;
 import de.intevation.artifacts.Artifact;
 import de.intevation.artifacts.ArtifactFactory;
+import de.intevation.artifacts.CallContext;
 import de.intevation.artifacts.CallMeta;
 import de.intevation.flys.artifacts.geom.Lines;
 import de.intevation.flys.artifacts.model.FacetTypes;
@@ -128,12 +129,14 @@
      * @param csl 'ground' against which to determine water surface.
      * @param a (ignored in this implementation).
      * @param b (ignored in this implementation).
+     * @param context (ignored in this implementation).
      */
     @Override
     public Lines.LineData getWaterLines(
             int                  index,
             FastCrossSectionLine csl,
-            double a, double b
+            double a, double b,
+            CallContext context
             ) {
         List<Point2D> points = csl.getPoints();
         return Lines.createWaterLines(points, getLine(index));
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/StaticWKmsArtifact.java	Tue Nov 13 16:13:41 2012 +0100
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/StaticWKmsArtifact.java	Tue Nov 13 16:14:44 2012 +0100
@@ -7,6 +7,7 @@
 
 import de.intevation.artifacts.Artifact;
 import de.intevation.artifacts.ArtifactFactory;
+import de.intevation.artifacts.CallContext;
 import de.intevation.artifacts.CallMeta;
 
 import de.intevation.artifacts.common.utils.XMLUtils;
@@ -386,13 +387,14 @@
      * @param csl FastCrossSectionLine to compute water surface agains.
      * @param next The km of the next crosssectionline.
      * @param prev The km of the previous crosssectionline.
+     * @param context Ignored in this implementation.
      *
      * @return an array holding coordinates of points of surface of water (
      *         in the form {{x1, x2}, {y1, y2}} ).
      */
     @Override
     public Lines.LineData getWaterLines(int idx, FastCrossSectionLine csl,
-        double next, double prev
+        double next, double prev, CallContext context
     ) {
         logger.debug("getWaterLines(" + idx + ")/" + identifier());
 
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/WINFOArtifact.java	Tue Nov 13 16:13:41 2012 +0100
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/WINFOArtifact.java	Tue Nov 13 16:14:44 2012 +0100
@@ -28,7 +28,9 @@
 import de.intevation.flys.artifacts.model.WW;
 import de.intevation.flys.artifacts.model.WstValueTable;
 import de.intevation.flys.artifacts.model.WstValueTableFactory;
+import de.intevation.flys.artifacts.model.extreme.ExtremeResult;
 
+import de.intevation.flys.artifacts.states.DefaultState.ComputeType;
 import de.intevation.flys.artifacts.states.LocationDistanceSelect;
 
 import de.intevation.flys.model.DischargeTable;
@@ -157,21 +159,34 @@
     //
     // METHODS FOR RETRIEVING COMPUTED DATA FOR DIFFERENT CHART TYPES
     //
+    //
+    /**
+     * Returns the data that is computed by a waterlevel computation.
+     *
+     * @return an array of data triples that consist of W, Q and Kms.
+     */
+    public CalculationResult getWaterlevelData() {
+        return this.getWaterlevelData(null);
+    }
 
     /**
      * Returns the data that is computed by a waterlevel computation.
      *
      * @return an array of data triples that consist of W, Q and Kms.
      */
-    public CalculationResult getWaterlevelData()
+    public CalculationResult getWaterlevelData(CallContext context)
     {
         logger.debug("WINFOArtifact.getWaterlevelData");
 
-        if (getDataAsString("calculation_mode")
-            .equals("calc.discharge.longitudinal.section")
+        String calculationMode = getDataAsString("calculation_mode");
+
+        if (calculationMode.equals("calc.discharge.longitudinal.section")
         ) {
             return getDischargeLongitudinalSectionData();
         }
+        else if (calculationMode.equals("calc.extreme.curve")) {
+            return (CalculationResult) this.compute(context, ComputeType.ADVANCE, false);
+        }
 
         River river = FLYSUtils.getRiver(this);
         if (river == null) {
@@ -625,13 +640,22 @@
      */
     @Override
     public Lines.LineData getWaterLines(int idx, FastCrossSectionLine csl,
-        double nextIgnored, double prevIgnored) {
+        double nextIgnored, double prevIgnored, CallContext context) {
         logger.debug("getWaterLines(" + idx + ")");
 
         List<Point2D> points = csl.getPoints();
 
         // Need W at km
-        WQKms [] wqkms = (WQKms[]) getWaterlevelData().getData();
+        Object waterlevelResult = getWaterlevelData(context).getData();
+        WQKms [] wqkms;
+
+        if (waterlevelResult instanceof ExtremeResult) {
+            wqkms = ((ExtremeResult) waterlevelResult).getWQKms();
+        }
+        else {
+            wqkms = (WQKms[]) waterlevelResult;
+        }
+
         if (wqkms.length == 0) {
             logger.error("No WQKms found.");
             return Lines.createWaterLines(points, 0.0f);
@@ -643,12 +667,12 @@
             return waterLineC(idx, csl);
         }
 
+        // Find W at km, linear naive approach.
+        WQKms triple = wqkms[idx];
+
         // Find index of km.
         double wishKM = csl.getKm();
 
-        // Find W at km, linear naive approach.
-        WQKms triple = wqkms[idx];
-
         if (triple.size() == 0) {
             logger.warn("Calculation of waterline is empty.");
             return Lines.createWaterLines(points, 0.0f);
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/WaterLineArtifact.java	Tue Nov 13 16:13:41 2012 +0100
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/WaterLineArtifact.java	Tue Nov 13 16:14:44 2012 +0100
@@ -1,7 +1,11 @@
 package de.intevation.flys.artifacts;
 
+import de.intevation.artifacts.CallContext;
+
 import de.intevation.flys.artifacts.geom.Lines;
 import de.intevation.flys.model.FastCrossSectionLine;
+
+
 /**
  * Interface, Artifact can create WaterLines (Water against Cross-Profile).
  */
@@ -9,6 +13,11 @@
 
     /** Get points that define a line of a (water)facet against a cross-
      * section. */
-    public Lines.LineData getWaterLines(int facetIdx, FastCrossSectionLine csl, double d, double w);
+    public Lines.LineData getWaterLines(
+        int                  facetIdx,
+        FastCrossSectionLine      csl,
+        double                      d,
+        double                      w,
+        CallContext           context);
 }
 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/CrossSectionWaterLineFacet.java	Tue Nov 13 16:13:41 2012 +0100
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/CrossSectionWaterLineFacet.java	Tue Nov 13 16:14:44 2012 +0100
@@ -75,7 +75,8 @@
 
         if (crossSection != null) {
             return lineArtifact.getWaterLines(this.getIndex(),
-                (FastCrossSectionLine) crossSection, (Double) nextKm, (Double) prevKm);
+                (FastCrossSectionLine) crossSection, (Double) nextKm,
+                (Double) prevKm, context);
         }
         else {
             return new Lines.LineData(new double[][] {}, 0d,0d);
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/extreme/ExtremeCompute.java	Tue Nov 13 16:13:41 2012 +0100
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/extreme/ExtremeCompute.java	Tue Nov 13 16:14:44 2012 +0100
@@ -9,6 +9,7 @@
 import de.intevation.flys.artifacts.access.ExtremeAccess;
 
 import de.intevation.flys.artifacts.model.CalculationResult;
+import de.intevation.flys.artifacts.model.CrossSectionWaterLineFacet;
 import de.intevation.flys.artifacts.model.DataFacet;
 import de.intevation.flys.artifacts.model.FacetTypes;
 import de.intevation.flys.artifacts.model.ReportFacet;
@@ -88,9 +89,11 @@
                 i, LONGITUDINAL_W, name, ComputeType.ADVANCE, id, hash);
             Facet q = new WaterlevelFacet(
                 i, LONGITUDINAL_Q, qname, ComputeType.ADVANCE, id, hash);
+            Facet csFacet = new CrossSectionWaterLineFacet(i, name);
 
             facets.add(w);
             facets.add(q);
+            facets.add(csFacet);
         }
 
 

http://dive4elements.wald.intevation.org