Mercurial > dive4elements > river
annotate flys-artifacts/src/main/java/de/intevation/flys/artifacts/FixationArtifact.java @ 4708:45d05402b2a6
Importer: Emit log message when a dry run was run.
author | Felix Wolfsteller <felix.wolfsteller@intevation.de> |
---|---|
date | Wed, 19 Dec 2012 11:40:19 +0100 |
parents | 03b8d10a99c0 |
children | b195fede1c3b |
rev | line source |
---|---|
2651
9e9eb9d97548
Initial transition configuration and artifact/state stubs for fixation
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
1 package de.intevation.flys.artifacts; |
9e9eb9d97548
Initial transition configuration and artifact/state stubs for fixation
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
2 |
4508
03b8d10a99c0
FixationArtifact: implement WaterLineArtifact, deliver lines for cross-sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4418
diff
changeset
|
3 import de.intevation.artifacts.CallContext; |
03b8d10a99c0
FixationArtifact: implement WaterLineArtifact, deliver lines for cross-sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4418
diff
changeset
|
4 |
03b8d10a99c0
FixationArtifact: implement WaterLineArtifact, deliver lines for cross-sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4418
diff
changeset
|
5 import de.intevation.flys.artifacts.geom.Lines; |
03b8d10a99c0
FixationArtifact: implement WaterLineArtifact, deliver lines for cross-sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4418
diff
changeset
|
6 import de.intevation.flys.artifacts.StaticWKmsArtifact; |
03b8d10a99c0
FixationArtifact: implement WaterLineArtifact, deliver lines for cross-sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4418
diff
changeset
|
7 |
03b8d10a99c0
FixationArtifact: implement WaterLineArtifact, deliver lines for cross-sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4418
diff
changeset
|
8 import de.intevation.flys.artifacts.model.CalculationResult; |
03b8d10a99c0
FixationArtifact: implement WaterLineArtifact, deliver lines for cross-sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4418
diff
changeset
|
9 import de.intevation.flys.artifacts.model.WKms; |
03b8d10a99c0
FixationArtifact: implement WaterLineArtifact, deliver lines for cross-sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4418
diff
changeset
|
10 import de.intevation.flys.artifacts.model.fixings.FixRealizingResult; |
03b8d10a99c0
FixationArtifact: implement WaterLineArtifact, deliver lines for cross-sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4418
diff
changeset
|
11 |
03b8d10a99c0
FixationArtifact: implement WaterLineArtifact, deliver lines for cross-sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4418
diff
changeset
|
12 import de.intevation.flys.artifacts.states.DefaultState.ComputeType; |
03b8d10a99c0
FixationArtifact: implement WaterLineArtifact, deliver lines for cross-sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4418
diff
changeset
|
13 |
03b8d10a99c0
FixationArtifact: implement WaterLineArtifact, deliver lines for cross-sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4418
diff
changeset
|
14 import de.intevation.flys.model.FastCrossSectionLine; |
03b8d10a99c0
FixationArtifact: implement WaterLineArtifact, deliver lines for cross-sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4418
diff
changeset
|
15 |
2651
9e9eb9d97548
Initial transition configuration and artifact/state stubs for fixation
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
16 import org.apache.log4j.Logger; |
9e9eb9d97548
Initial transition configuration and artifact/state stubs for fixation
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
17 |
9e9eb9d97548
Initial transition configuration and artifact/state stubs for fixation
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
18 /** |
9e9eb9d97548
Initial transition configuration and artifact/state stubs for fixation
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
19 * The default fixation analysis artifact. |
9e9eb9d97548
Initial transition configuration and artifact/state stubs for fixation
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
20 * |
9e9eb9d97548
Initial transition configuration and artifact/state stubs for fixation
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
21 * @author <a href="mailto:raimund.renkert@intevation.de">Raimund Renkert</a> |
9e9eb9d97548
Initial transition configuration and artifact/state stubs for fixation
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
22 */ |
9e9eb9d97548
Initial transition configuration and artifact/state stubs for fixation
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
23 public class FixationArtifact |
9e9eb9d97548
Initial transition configuration and artifact/state stubs for fixation
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
24 extends FLYSArtifact |
4508
03b8d10a99c0
FixationArtifact: implement WaterLineArtifact, deliver lines for cross-sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4418
diff
changeset
|
25 implements WaterLineArtifact |
3774
a66df8e8d3df
flys-artifacts: Removed some superfluous implementations of FacetTypes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3193
diff
changeset
|
26 { |
2651
9e9eb9d97548
Initial transition configuration and artifact/state stubs for fixation
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
27 /** The logger for this class. */ |
9e9eb9d97548
Initial transition configuration and artifact/state stubs for fixation
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
28 private static Logger logger = Logger.getLogger(FixationArtifact.class); |
9e9eb9d97548
Initial transition configuration and artifact/state stubs for fixation
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
29 |
9e9eb9d97548
Initial transition configuration and artifact/state stubs for fixation
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
30 /** The name of the artifact. */ |
9e9eb9d97548
Initial transition configuration and artifact/state stubs for fixation
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
31 public static final String ARTIFACT_NAME = "fixanalysis"; |
9e9eb9d97548
Initial transition configuration and artifact/state stubs for fixation
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
32 |
4418
e0a355d0c771
FixationArtifact: In doc, mention where the FacetActivity is registered.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3917
diff
changeset
|
33 /* FacetActivity for this artifact is registered in FixAnalysisCompute . */ |
e0a355d0c771
FixationArtifact: In doc, mention where the FacetActivity is registered.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3917
diff
changeset
|
34 |
2651
9e9eb9d97548
Initial transition configuration and artifact/state stubs for fixation
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
35 /** |
9e9eb9d97548
Initial transition configuration and artifact/state stubs for fixation
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
36 * The default constructor. |
9e9eb9d97548
Initial transition configuration and artifact/state stubs for fixation
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
37 */ |
9e9eb9d97548
Initial transition configuration and artifact/state stubs for fixation
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
38 public FixationArtifact() { |
3917
1ff257ab38ca
Rename fix_derivate to fix_derivate_curve to enable manual points on it
Christian Lins <christian.lins@intevation.de>
parents:
3774
diff
changeset
|
39 logger.debug("ctor()"); |
2651
9e9eb9d97548
Initial transition configuration and artifact/state stubs for fixation
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
40 } |
9e9eb9d97548
Initial transition configuration and artifact/state stubs for fixation
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
41 |
9e9eb9d97548
Initial transition configuration and artifact/state stubs for fixation
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
42 /** |
9e9eb9d97548
Initial transition configuration and artifact/state stubs for fixation
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
43 * Returns the name of the concrete artifact. |
9e9eb9d97548
Initial transition configuration and artifact/state stubs for fixation
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
44 * |
9e9eb9d97548
Initial transition configuration and artifact/state stubs for fixation
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
45 * @return the name of the concrete artifact. |
9e9eb9d97548
Initial transition configuration and artifact/state stubs for fixation
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
46 */ |
3193
2f922be407ea
Moved common code of the *Artifacts into FLYSArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2728
diff
changeset
|
47 @Override |
2651
9e9eb9d97548
Initial transition configuration and artifact/state stubs for fixation
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
48 public String getName() { |
9e9eb9d97548
Initial transition configuration and artifact/state stubs for fixation
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
49 return ARTIFACT_NAME; |
9e9eb9d97548
Initial transition configuration and artifact/state stubs for fixation
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
50 } |
4508
03b8d10a99c0
FixationArtifact: implement WaterLineArtifact, deliver lines for cross-sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4418
diff
changeset
|
51 |
03b8d10a99c0
FixationArtifact: implement WaterLineArtifact, deliver lines for cross-sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4418
diff
changeset
|
52 @Override |
03b8d10a99c0
FixationArtifact: implement WaterLineArtifact, deliver lines for cross-sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4418
diff
changeset
|
53 public Lines.LineData getWaterLines( |
03b8d10a99c0
FixationArtifact: implement WaterLineArtifact, deliver lines for cross-sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4418
diff
changeset
|
54 int facetIdx, |
03b8d10a99c0
FixationArtifact: implement WaterLineArtifact, deliver lines for cross-sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4418
diff
changeset
|
55 FastCrossSectionLine csl, |
03b8d10a99c0
FixationArtifact: implement WaterLineArtifact, deliver lines for cross-sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4418
diff
changeset
|
56 double d, |
03b8d10a99c0
FixationArtifact: implement WaterLineArtifact, deliver lines for cross-sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4418
diff
changeset
|
57 double w, |
03b8d10a99c0
FixationArtifact: implement WaterLineArtifact, deliver lines for cross-sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4418
diff
changeset
|
58 CallContext context |
03b8d10a99c0
FixationArtifact: implement WaterLineArtifact, deliver lines for cross-sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4418
diff
changeset
|
59 ) { |
03b8d10a99c0
FixationArtifact: implement WaterLineArtifact, deliver lines for cross-sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4418
diff
changeset
|
60 FixRealizingResult result = (FixRealizingResult) |
03b8d10a99c0
FixationArtifact: implement WaterLineArtifact, deliver lines for cross-sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4418
diff
changeset
|
61 ((CalculationResult)this.compute(context, ComputeType.ADVANCE, false)).getData(); |
03b8d10a99c0
FixationArtifact: implement WaterLineArtifact, deliver lines for cross-sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4418
diff
changeset
|
62 |
03b8d10a99c0
FixationArtifact: implement WaterLineArtifact, deliver lines for cross-sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4418
diff
changeset
|
63 WKms wkms = result.getWQKms()[facetIdx]; |
03b8d10a99c0
FixationArtifact: implement WaterLineArtifact, deliver lines for cross-sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4418
diff
changeset
|
64 |
03b8d10a99c0
FixationArtifact: implement WaterLineArtifact, deliver lines for cross-sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4418
diff
changeset
|
65 double km = csl.getKm(); |
03b8d10a99c0
FixationArtifact: implement WaterLineArtifact, deliver lines for cross-sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4418
diff
changeset
|
66 |
03b8d10a99c0
FixationArtifact: implement WaterLineArtifact, deliver lines for cross-sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4418
diff
changeset
|
67 // Find W at km. |
03b8d10a99c0
FixationArtifact: implement WaterLineArtifact, deliver lines for cross-sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4418
diff
changeset
|
68 double wAtKm; |
03b8d10a99c0
FixationArtifact: implement WaterLineArtifact, deliver lines for cross-sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4418
diff
changeset
|
69 |
03b8d10a99c0
FixationArtifact: implement WaterLineArtifact, deliver lines for cross-sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4418
diff
changeset
|
70 wAtKm = StaticWKmsArtifact.getWAtKm(wkms, km); |
03b8d10a99c0
FixationArtifact: implement WaterLineArtifact, deliver lines for cross-sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4418
diff
changeset
|
71 |
03b8d10a99c0
FixationArtifact: implement WaterLineArtifact, deliver lines for cross-sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4418
diff
changeset
|
72 if (wAtKm == -1 || Double.isNaN(wAtKm)) { |
03b8d10a99c0
FixationArtifact: implement WaterLineArtifact, deliver lines for cross-sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4418
diff
changeset
|
73 logger.warn("Waterlevel at km " + km + " unknown."); |
03b8d10a99c0
FixationArtifact: implement WaterLineArtifact, deliver lines for cross-sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4418
diff
changeset
|
74 return new Lines.LineData(new double[][] {{}}, 0d, 0d); |
03b8d10a99c0
FixationArtifact: implement WaterLineArtifact, deliver lines for cross-sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4418
diff
changeset
|
75 } |
03b8d10a99c0
FixationArtifact: implement WaterLineArtifact, deliver lines for cross-sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4418
diff
changeset
|
76 |
03b8d10a99c0
FixationArtifact: implement WaterLineArtifact, deliver lines for cross-sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4418
diff
changeset
|
77 // This should be FixRealizationResult, which can be getWQKms()ed |
03b8d10a99c0
FixationArtifact: implement WaterLineArtifact, deliver lines for cross-sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4418
diff
changeset
|
78 return Lines.createWaterLines(csl.getPoints(), wAtKm); |
03b8d10a99c0
FixationArtifact: implement WaterLineArtifact, deliver lines for cross-sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4418
diff
changeset
|
79 } |
2651
9e9eb9d97548
Initial transition configuration and artifact/state stubs for fixation
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
80 } |
2728
306b9d0f0fb3
Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2699
diff
changeset
|
81 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |