diff artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/flood_duration/FloodDurationMainValuesQFacet.java @ 9269:83ebeb620b5a

Station specific main value annotations in S-Info flood duration curve, corrected infrastructure flood duration calculation
author mschaefer
date Thu, 19 Jul 2018 08:07:03 +0200
parents 66b003701546
children f8308db94634
line wrap: on
line diff
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/flood_duration/FloodDurationMainValuesQFacet.java	Wed Jul 18 18:53:15 2018 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/flood_duration/FloodDurationMainValuesQFacet.java	Thu Jul 19 08:07:03 2018 +0200
@@ -1,5 +1,7 @@
-/* Copyright (C) 2011, 2012, 2013 by Bundesanstalt für Gewässerkunde
- * Software engineering by Intevation GmbH
+/** Copyright (C) 2017 by Bundesanstalt für Gewässerkunde
+ * Software engineering by
+ *  Björnsen Beratende Ingenieure GmbH
+ *  Dr. Schumacher Ingenieurbüro für Wasser und Umwelt
  *
  * This file is Free Software under the GNU AGPL (>=v3)
  * and comes with ABSOLUTELY NO WARRANTY! Check out the
@@ -8,14 +10,16 @@
 
 package org.dive4elements.river.artifacts.sinfo.flood_duration;
 
+import java.util.List;
+
 import org.apache.log4j.Logger;
 import org.dive4elements.artifactdatabase.state.DefaultFacet;
 import org.dive4elements.artifacts.Artifact;
 import org.dive4elements.artifacts.CallContext;
 import org.dive4elements.river.artifacts.D4EArtifact;
 import org.dive4elements.river.artifacts.model.CalculationResult;
-import org.dive4elements.river.artifacts.model.WQDay;
 import org.dive4elements.river.artifacts.states.DefaultState.ComputeType;
+import org.dive4elements.river.exports.fixings.FixChartGenerator;
 import org.dive4elements.river.jfree.RiverAnnotation;
 import org.dive4elements.river.jfree.StickyAxisAnnotation;
 
@@ -35,30 +39,9 @@
         this.index = 1;
     }
 
-    /**
-     * Set the hit-point in Q where a line drawn from the axis would hit the
-     * curve in WQDay (if hit).
-     * Employ linear interpolation.
-     */
-    public static void setHitPoint(final WQDay wqday, final StickyAxisAnnotation annotation) {
-
-        final float q = annotation.getPos();
-        final Double day = wqday.interpolateDayByQ(q);
-        if (day != null)
-            annotation.setHitPoint(day.floatValue());
-        else
-            log.debug("StickyAnnotation does not hit wqday curve: " + q);
-    }
-
 
     /**
      * Returns the data this facet requires.
-     *
-     * @param artifact the owner artifact.
-     * @param context  the CallContext (can be used to find out if in
-     *                 navigable fixation-setting, or durationcurve).
-     *
-     * @return the data.
      */
     @Override
     public Object getData(final Artifact artifact, final CallContext context) {
@@ -71,7 +54,12 @@
 
         final FloodDurationCalculationResults data = (FloodDurationCalculationResults) res.getData();
 
-        return new RiverAnnotation(this.description, data.getMainValueQAnnotations());
+        final double currentKm = FixChartGenerator.getCurrentKm(context);
+
+        final List<StickyAxisAnnotation> annotations = new FloodDurationCalculation(context).calcMainValueQAnnotations(currentKm,
+                data.getResults().get(0));
+
+        return new RiverAnnotation(this.description, annotations);
     }
 
 
@@ -86,4 +74,3 @@
         return copy;
     }
 }
-// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org