changeset 9461:da7b5f07303d

vergessen
author gernotbelger
date Wed, 29 Aug 2018 17:27:09 +0200
parents 8d6e56e57c4a
children e28303971812
files artifacts/src/main/java/org/dive4elements/river/artifacts/AbstractFixBunduArtifact.java artifacts/src/main/java/org/dive4elements/river/artifacts/CrossSectionArtifact.java
diffstat 2 files changed, 59 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/AbstractFixBunduArtifact.java	Wed Aug 29 17:27:09 2018 +0200
@@ -0,0 +1,59 @@
+/* Copyright (C) 2011, 2012, 2013 by Bundesanstalt für Gewässerkunde
+ * Software engineering by Intevation GmbH
+ *
+ * This file is Free Software under the GNU AGPL (>=v3)
+ * and comes with ABSOLUTELY NO WARRANTY! Check out the
+ * documentation coming with Dive4Elements River for details.
+ */
+
+package org.dive4elements.river.artifacts;
+
+import java.io.Serializable;
+
+import org.apache.log4j.Logger;
+import org.dive4elements.artifacts.CallContext;
+import org.dive4elements.river.artifacts.model.CalculationResult;
+import org.dive4elements.river.artifacts.model.WKms;
+import org.dive4elements.river.artifacts.model.fixings.FixRealizingResult;
+import org.dive4elements.river.artifacts.states.DefaultState.ComputeType;
+
+/**
+ * The default fixation analysis artifact.
+ *
+ * @author <a href="mailto:raimund.renkert@intevation.de">Raimund Renkert</a>
+ */
+public class AbstractFixBunduArtifact extends D4EArtifact implements WaterLineArtifact {
+
+    private static final long serialVersionUID = 1L;
+
+    /** The log for this class. */
+    private static Logger log = Logger.getLogger(AbstractFixBunduArtifact.class);
+
+    /**
+     * The default constructor.
+     */
+    public AbstractFixBunduArtifact() {
+        log.debug("ctor()");
+    }
+
+    /** Calculate waterlines against a cross section. */
+    @Override
+    public double getWaterLevel(final ComputeType type, final String hash, final String stateId, final double currentKm, final Serializable waterLineIndex,
+            final double nextKm, final double prevKm, final CallContext context) {
+        final FixRealizingResult result = (FixRealizingResult) ((CalculationResult) this.compute(context, ComputeType.ADVANCE, false)).getData();
+
+        final int wstIndex = (Integer) waterLineIndex;
+
+        final WKms wkms = result.getWQKms()[wstIndex];
+
+        // Find W at km.
+        final double wAtKm = StaticWKmsArtifact.getWAtKm(wkms, currentKm);
+
+        if (wAtKm == -1 || Double.isNaN(wAtKm)) {
+            log.warn("Waterlevel at km " + currentKm + " unknown.");
+            return Double.NaN;
+        }
+
+        return wAtKm;
+    }
+}
\ No newline at end of file
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/CrossSectionArtifact.java	Wed Aug 29 16:57:13 2018 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/CrossSectionArtifact.java	Wed Aug 29 17:27:09 2018 +0200
@@ -126,10 +126,7 @@
         addStringData(DATA_IS_MASTER, newString);
         final StringBuilder builder = new StringBuilder();
         builder.append("CrossSectionArtifact line 128 cross_section_id = ").append(cs.getId()).append(" IS_START? : ").append(String.valueOf(isNewest));
-        log.info(builder.toString()); // TODO: remove ALL
         log.debug(builder.toString());
-        log.warn(builder.toString());
-
         if (!fs.isEmpty()) {
             addFacets(getCurrentStateId(), fs);
         }

http://dive4elements.wald.intevation.org