changeset 4511:1983f5706578

Merged.
author Felix Wolfsteller <felix.wolfsteller@intevation.de>
date Wed, 14 Nov 2012 13:48:22 +0100
parents 3f08855e68bc (diff) d7e1aee9d51e (current diff)
children 6223e762886b
files
diffstat 6 files changed, 68 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/flys-artifacts/doc/conf/artifacts/fixanalysis.xml	Wed Nov 14 12:37:57 2012 +0100
+++ b/flys-artifacts/doc/conf/artifacts/fixanalysis.xml	Wed Nov 14 13:48:22 2012 +0100
@@ -278,6 +278,17 @@
                         <facet name="discharge_curve.curve" description="facet.discharge_curve.curve"/>
                     </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="fix_waterlevel_export" description="output.fix_waterlevel_export" mine-type="text/plain" type="export">
                     <facets>
                         <facet name="csv" description="facet.waterlevel_export.csv" />
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/FixationArtifact.java	Wed Nov 14 12:37:57 2012 +0100
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/FixationArtifact.java	Wed Nov 14 13:48:22 2012 +0100
@@ -1,5 +1,18 @@
 package de.intevation.flys.artifacts;
 
+import de.intevation.artifacts.CallContext;
+
+import de.intevation.flys.artifacts.geom.Lines;
+import de.intevation.flys.artifacts.StaticWKmsArtifact;
+
+import de.intevation.flys.artifacts.model.CalculationResult;
+import de.intevation.flys.artifacts.model.WKms;
+import de.intevation.flys.artifacts.model.fixings.FixRealizingResult;
+
+import de.intevation.flys.artifacts.states.DefaultState.ComputeType;
+
+import de.intevation.flys.model.FastCrossSectionLine;
+
 import org.apache.log4j.Logger;
 
 /**
@@ -9,6 +22,7 @@
  */
 public class FixationArtifact
 extends      FLYSArtifact
+implements   WaterLineArtifact
 {
     /** The logger for this class. */
     private static Logger logger = Logger.getLogger(FixationArtifact.class);
@@ -34,5 +48,34 @@
     public String getName() {
         return ARTIFACT_NAME;
     }
+
+    @Override
+    public Lines.LineData getWaterLines(
+        int                  facetIdx,
+        FastCrossSectionLine      csl,
+        double                      d,
+        double                      w,
+        CallContext           context
+    ) {
+        FixRealizingResult result = (FixRealizingResult)
+            ((CalculationResult)this.compute(context, ComputeType.ADVANCE, false)).getData();
+        
+        WKms wkms = result.getWQKms()[facetIdx];
+
+        double km = csl.getKm();
+
+        // Find W at km.
+        double wAtKm;
+
+        wAtKm = StaticWKmsArtifact.getWAtKm(wkms, km);
+
+        if (wAtKm == -1 || Double.isNaN(wAtKm)) {
+            logger.warn("Waterlevel at km " + km + " unknown.");
+            return new Lines.LineData(new double[][] {{}}, 0d, 0d);
+        }
+
+        // This should be FixRealizationResult, which can be getWQKms()ed
+        return Lines.createWaterLines(csl.getPoints(), wAtKm);
+    }
 }
 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/WINFOArtifact.java	Wed Nov 14 12:37:57 2012 +0100
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/WINFOArtifact.java	Wed Nov 14 13:48:22 2012 +0100
@@ -185,7 +185,8 @@
             return getDischargeLongitudinalSectionData();
         }
         else if (calculationMode.equals("calc.extreme.curve")) {
-            return (CalculationResult) this.compute(context, ComputeType.ADVANCE, false);
+            return (CalculationResult)
+                this.compute(context, ComputeType.ADVANCE, false);
         }
 
         River river = FLYSUtils.getRiver(this);
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/CrossSectionWaterLineFacet.java	Wed Nov 14 12:37:57 2012 +0100
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/CrossSectionWaterLineFacet.java	Wed Nov 14 13:48:22 2012 +0100
@@ -71,6 +71,10 @@
         if (nextKm == null)
             nextKm = new Double(-1d);
 
+        if (!(artifact instanceof WaterLineArtifact)) {
+            logger.error("CrossSectionWaterLineFacet needs WaterLineArtifact");
+            return new Lines.LineData(new double[][] {}, 0d,0d);
+        }
         WaterLineArtifact lineArtifact = (WaterLineArtifact) artifact;
 
         if (crossSection != null) {
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/QSectorFacet.java	Wed Nov 14 12:37:57 2012 +0100
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/QSectorFacet.java	Wed Nov 14 13:48:22 2012 +0100
@@ -49,6 +49,11 @@
     @Override
     public Object getData(Artifact artifact, CallContext context) {
         QSectorArtifact qsectorArtifact = (QSectorArtifact) artifact;
+        if (qsectorArtifact == null || context == null ||
+            context.getContextValue("currentKm") == null) {
+            logger.error("No artifact, context or currentKm in QSectorFacet");
+            return null;
+        }
         double currentKm =
             ((Double)context.getContextValue("currentKm")).doubleValue();
         return qsectorArtifact.getQSectors(currentKm, context);
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/fixation/FixRealizingCompute.java	Wed Nov 14 12:37:57 2012 +0100
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/fixation/FixRealizingCompute.java	Wed Nov 14 13:48:22 2012 +0100
@@ -10,6 +10,7 @@
 import de.intevation.flys.artifacts.FLYSArtifact;
 import de.intevation.flys.artifacts.access.FixRealizingAccess;
 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;
@@ -32,7 +33,6 @@
     /** The logger used in this class. */
     private static Logger logger = Logger.getLogger(FixRealizingCompute.class);
 
-
     public static final String I18N_WQ_CURVE = "fix.vollmer.wq.curve";
 
     public static final String I18N_WQ_OUTLIER = "fix.vollmer.wq.outliers";
@@ -101,9 +101,11 @@
 
             Facet q = new FixWaterlevelFacet(
                 i, LONGITUDINAL_Q, nameQ);
+            Facet csFacet = new CrossSectionWaterLineFacet(i, nameW);
 
             facets.add(w);
             facets.add(q);
+            facets.add(csFacet);
 
             if (wqkms[i] instanceof WQCKms) {
                 String nameC = nameW.replace(

http://dive4elements.wald.intevation.org