Mercurial > dive4elements > river
annotate artifacts/src/main/java/org/dive4elements/river/artifacts/AbstractFixBunduArtifact.java @ 9648:c5a496bf1b0b
Fixed: Duplizieren einer Fixierungsanalyse schlägt fehl.
author | Gernot Belger <g.belger@bjoernsen.de> |
---|---|
date | Wed, 04 Dec 2019 16:10:28 +0100 |
parents | ce13a2f07290 |
children |
rev | line source |
---|---|
9461 | 1 /* Copyright (C) 2011, 2012, 2013 by Bundesanstalt für Gewässerkunde |
2 * Software engineering by Intevation GmbH | |
3 * | |
4 * This file is Free Software under the GNU AGPL (>=v3) | |
5 * and comes with ABSOLUTELY NO WARRANTY! Check out the | |
6 * documentation coming with Dive4Elements River for details. | |
7 */ | |
8 | |
9 package org.dive4elements.river.artifacts; | |
10 | |
11 import java.io.Serializable; | |
12 | |
13 import org.apache.log4j.Logger; | |
14 import org.dive4elements.artifacts.CallContext; | |
15 import org.dive4elements.river.artifacts.model.CalculationResult; | |
16 import org.dive4elements.river.artifacts.model.WKms; | |
17 import org.dive4elements.river.artifacts.model.fixings.FixRealizingResult; | |
18 import org.dive4elements.river.artifacts.states.DefaultState.ComputeType; | |
19 | |
20 /** | |
21 * The default fixation analysis artifact. | |
22 * | |
23 * @author <a href="mailto:raimund.renkert@intevation.de">Raimund Renkert</a> | |
24 */ | |
25 public class AbstractFixBunduArtifact extends D4EArtifact implements WaterLineArtifact { | |
26 | |
27 private static final long serialVersionUID = 1L; | |
28 | |
29 /** The log for this class. */ | |
30 private static Logger log = Logger.getLogger(AbstractFixBunduArtifact.class); | |
31 | |
32 /** | |
33 * The default constructor. | |
34 */ | |
35 public AbstractFixBunduArtifact() { | |
36 log.debug("ctor()"); | |
37 } | |
38 | |
39 /** Calculate waterlines against a cross section. */ | |
40 @Override | |
41 public double getWaterLevel(final ComputeType type, final String hash, final String stateId, final double currentKm, final Serializable waterLineIndex, | |
42 final double nextKm, final double prevKm, final CallContext context) { | |
43 final FixRealizingResult result = (FixRealizingResult) ((CalculationResult) this.compute(context, ComputeType.ADVANCE, false)).getData(); | |
44 | |
45 final int wstIndex = (Integer) waterLineIndex; | |
46 | |
47 final WKms wkms = result.getWQKms()[wstIndex]; | |
48 | |
49 // Find W at km. | |
50 final double wAtKm = StaticWKmsArtifact.getWAtKm(wkms, currentKm); | |
51 | |
52 if (wAtKm == -1 || Double.isNaN(wAtKm)) { | |
53 log.warn("Waterlevel at km " + currentKm + " unknown."); | |
54 return Double.NaN; | |
55 } | |
56 | |
57 return wAtKm; | |
58 } | |
9486
ce13a2f07290
pdf exports added for fixation+bundu (waterlevel)
gernotbelger
parents:
9461
diff
changeset
|
59 |
ce13a2f07290
pdf exports added for fixation+bundu (waterlevel)
gernotbelger
parents:
9461
diff
changeset
|
60 public String getCalculationModeString() { |
ce13a2f07290
pdf exports added for fixation+bundu (waterlevel)
gernotbelger
parents:
9461
diff
changeset
|
61 return null; // must be implemented in inheriting classes. cannot declare this class abstract |
ce13a2f07290
pdf exports added for fixation+bundu (waterlevel)
gernotbelger
parents:
9461
diff
changeset
|
62 } |
ce13a2f07290
pdf exports added for fixation+bundu (waterlevel)
gernotbelger
parents:
9461
diff
changeset
|
63 |
9461 | 64 } |