comparison artifacts/src/main/java/org/dive4elements/river/artifacts/FixationArtifact.java @ 9460:8d6e56e57c4a

log-Ausgaben crossSection isStart
author gernotbelger
date Wed, 29 Aug 2018 16:57:13 +0200
parents 3f49835a00c3
children ce13a2f07290
comparison
equal deleted inserted replaced
9459:f06e3766997f 9460:8d6e56e57c4a
6 * documentation coming with Dive4Elements River for details. 6 * documentation coming with Dive4Elements River for details.
7 */ 7 */
8 8
9 package org.dive4elements.river.artifacts; 9 package org.dive4elements.river.artifacts;
10 10
11 import java.io.Serializable;
12
13 import org.apache.log4j.Logger; 11 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 12
20 /** 13 /**
21 * The default fixation analysis artifact. 14 * The default fixation analysis artifact.
22 * 15 *
23 * @author <a href="mailto:raimund.renkert@intevation.de">Raimund Renkert</a> 16 * @author <a href="mailto:raimund.renkert@intevation.de">Raimund Renkert</a>
24 */ 17 */
25 public class FixationArtifact extends D4EArtifact implements WaterLineArtifact { 18 public class FixationArtifact extends AbstractFixBunduArtifact {
26 19
27 private static final long serialVersionUID = 1L; 20 private static final long serialVersionUID = 1L;
28 21
29 /** The log for this class. */ 22 /** The log for this class. */
30 private static Logger log = Logger.getLogger(FixationArtifact.class); 23 private static Logger log = Logger.getLogger(FixationArtifact.class);
36 29
37 /** 30 /**
38 * The default constructor. 31 * The default constructor.
39 */ 32 */
40 public FixationArtifact() { 33 public FixationArtifact() {
41 log.debug("ctor()"); 34 super();
42 } 35 }
43 36
44 /** 37 /**
45 * Returns the name of the concrete artifact. 38 * Returns the name of the concrete artifact.
46 * 39 *
49 @Override 42 @Override
50 public String getName() { 43 public String getName() {
51 return ARTIFACT_NAME; 44 return ARTIFACT_NAME;
52 } 45 }
53 46
54 /** Calculate waterlines against a cross section. */
55 @Override
56 public double getWaterLevel(final ComputeType type, final String hash, final String stateId, final double currentKm, final Serializable waterLineIndex,
57 final double nextKm, final double prevKm, final CallContext context) {
58 final FixRealizingResult result = (FixRealizingResult) ((CalculationResult) this.compute(context, ComputeType.ADVANCE, false)).getData();
59
60 final int wstIndex = (Integer) waterLineIndex;
61
62 final WKms wkms = result.getWQKms()[wstIndex];
63
64 // Find W at km.
65 final double wAtKm = StaticWKmsArtifact.getWAtKm(wkms, currentKm);
66
67 if (wAtKm == -1 || Double.isNaN(wAtKm)) {
68 log.warn("Waterlevel at km " + currentKm + " unknown.");
69 return Double.NaN;
70 }
71
72 return wAtKm;
73 }
74 } 47 }

http://dive4elements.wald.intevation.org