Mercurial > dive4elements > river
comparison artifacts/src/main/java/org/dive4elements/river/artifacts/FixationArtifact.java @ 5838:5aa05a7a34b7
Rename modules to more fitting names.
author | Sascha L. Teichmann <teichmann@intevation.de> |
---|---|
date | Thu, 25 Apr 2013 15:23:37 +0200 |
parents | flys-artifacts/src/main/java/org/dive4elements/river/artifacts/FixationArtifact.java@bd047b71ab37 |
children | 4897a58c8746 |
comparison
equal
deleted
inserted
replaced
5837:d9901a08d0a6 | 5838:5aa05a7a34b7 |
---|---|
1 package org.dive4elements.river.artifacts; | |
2 | |
3 import org.dive4elements.artifacts.CallContext; | |
4 | |
5 import org.dive4elements.river.artifacts.geom.Lines; | |
6 import org.dive4elements.river.artifacts.StaticWKmsArtifact; | |
7 | |
8 import org.dive4elements.river.artifacts.model.CalculationResult; | |
9 import org.dive4elements.river.artifacts.model.WKms; | |
10 import org.dive4elements.river.artifacts.model.fixings.FixRealizingResult; | |
11 | |
12 import org.dive4elements.river.artifacts.states.DefaultState.ComputeType; | |
13 | |
14 import org.dive4elements.river.model.FastCrossSectionLine; | |
15 | |
16 import org.apache.log4j.Logger; | |
17 | |
18 /** | |
19 * The default fixation analysis artifact. | |
20 * | |
21 * @author <a href="mailto:raimund.renkert@intevation.de">Raimund Renkert</a> | |
22 */ | |
23 public class FixationArtifact | |
24 extends FLYSArtifact | |
25 implements WaterLineArtifact | |
26 { | |
27 /** The logger for this class. */ | |
28 private static Logger logger = Logger.getLogger(FixationArtifact.class); | |
29 | |
30 /** The name of the artifact. */ | |
31 public static final String ARTIFACT_NAME = "fixanalysis"; | |
32 | |
33 /* FacetActivity for this artifact is registered in FixAnalysisCompute . */ | |
34 | |
35 /** | |
36 * The default constructor. | |
37 */ | |
38 public FixationArtifact() { | |
39 logger.debug("ctor()"); | |
40 } | |
41 | |
42 /** | |
43 * Returns the name of the concrete artifact. | |
44 * | |
45 * @return the name of the concrete artifact. | |
46 */ | |
47 @Override | |
48 public String getName() { | |
49 return ARTIFACT_NAME; | |
50 } | |
51 | |
52 @Override | |
53 public Lines.LineData getWaterLines( | |
54 int facetIdx, | |
55 FastCrossSectionLine csl, | |
56 double d, | |
57 double w, | |
58 CallContext context | |
59 ) { | |
60 FixRealizingResult result = (FixRealizingResult) | |
61 ((CalculationResult)this.compute(context, ComputeType.ADVANCE, false)).getData(); | |
62 | |
63 WKms wkms = result.getWQKms()[facetIdx]; | |
64 | |
65 double km = csl.getKm(); | |
66 | |
67 // Find W at km. | |
68 double wAtKm; | |
69 | |
70 wAtKm = StaticWKmsArtifact.getWAtKm(wkms, km); | |
71 | |
72 if (wAtKm == -1 || Double.isNaN(wAtKm)) { | |
73 logger.warn("Waterlevel at km " + km + " unknown."); | |
74 return new Lines.LineData(new double[][] {{}}, 0d, 0d); | |
75 } | |
76 | |
77 // This should be FixRealizationResult, which can be getWQKms()ed | |
78 return Lines.createWaterLines(csl.getPoints(), wAtKm); | |
79 } | |
80 } | |
81 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |