Mercurial > dive4elements > river
annotate flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/CrossSectionWaterLineFacet.java @ 2018:3f1a63da2cf4
Prepare ability to paint areas in longitudinal section diagrams, too (next to CrossSection diagrams).
flys-artifacts/trunk@3473 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Felix Wolfsteller <felix.wolfsteller@intevation.de> |
---|---|
date | Tue, 20 Dec 2011 06:37:41 +0000 |
parents | e384d78ff78b |
children | f834a6961bb7 |
rev | line source |
---|---|
1122
111794adf285
Get real (but yet not parameterized) data to display in CrossSection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
1 package de.intevation.flys.artifacts.model; |
111794adf285
Get real (but yet not parameterized) data to display in CrossSection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
2 |
111794adf285
Get real (but yet not parameterized) data to display in CrossSection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
3 import org.apache.log4j.Logger; |
111794adf285
Get real (but yet not parameterized) data to display in CrossSection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
4 |
2002
98f3ef8da857
Register under a key on blackboard to meet assumptions by areaartifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1981
diff
changeset
|
5 import java.util.ArrayList; |
1975
b30e1710df1d
Server-side of interactive cross-section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1802
diff
changeset
|
6 import java.util.List; |
b30e1710df1d
Server-side of interactive cross-section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1802
diff
changeset
|
7 |
b30e1710df1d
Server-side of interactive cross-section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1802
diff
changeset
|
8 import de.intevation.flys.model.CrossSectionLine; |
b30e1710df1d
Server-side of interactive cross-section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1802
diff
changeset
|
9 |
1122
111794adf285
Get real (but yet not parameterized) data to display in CrossSection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
10 import de.intevation.artifacts.Artifact; |
111794adf285
Get real (but yet not parameterized) data to display in CrossSection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
11 import de.intevation.artifacts.CallContext; |
111794adf285
Get real (but yet not parameterized) data to display in CrossSection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
12 |
111794adf285
Get real (but yet not parameterized) data to display in CrossSection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
13 import de.intevation.artifactdatabase.state.DefaultFacet; |
111794adf285
Get real (but yet not parameterized) data to display in CrossSection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
14 import de.intevation.artifactdatabase.state.Facet; |
1975
b30e1710df1d
Server-side of interactive cross-section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1802
diff
changeset
|
15 import de.intevation.artifacts.DataProvider; |
1122
111794adf285
Get real (but yet not parameterized) data to display in CrossSection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
16 |
1981
bf62cc7052d4
Implement and use WaterLineArtifact interface.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1975
diff
changeset
|
17 import de.intevation.flys.artifacts.WaterLineArtifact; |
1122
111794adf285
Get real (but yet not parameterized) data to display in CrossSection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
18 |
111794adf285
Get real (but yet not parameterized) data to display in CrossSection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
19 |
111794adf285
Get real (but yet not parameterized) data to display in CrossSection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
20 /** |
111794adf285
Get real (but yet not parameterized) data to display in CrossSection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
21 * Facet for Waterlines in Cross Sections. |
111794adf285
Get real (but yet not parameterized) data to display in CrossSection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
22 */ |
111794adf285
Get real (but yet not parameterized) data to display in CrossSection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
23 public class CrossSectionWaterLineFacet |
111794adf285
Get real (but yet not parameterized) data to display in CrossSection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
24 extends DefaultFacet |
111794adf285
Get real (but yet not parameterized) data to display in CrossSection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
25 implements FacetTypes { |
111794adf285
Get real (but yet not parameterized) data to display in CrossSection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
26 |
111794adf285
Get real (but yet not parameterized) data to display in CrossSection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
27 private static Logger logger = Logger.getLogger(CrossSectionWaterLineFacet.class); |
111794adf285
Get real (but yet not parameterized) data to display in CrossSection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
28 |
111794adf285
Get real (but yet not parameterized) data to display in CrossSection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
29 |
111794adf285
Get real (but yet not parameterized) data to display in CrossSection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
30 /** Trivial constructor, set (maybe localized) description. */ |
1802
26d7077e42d2
Corrected CrossSection diagram/out to include one facet per computed waterlevel.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1158
diff
changeset
|
31 public CrossSectionWaterLineFacet(int idx, String description) { |
26d7077e42d2
Corrected CrossSection diagram/out to include one facet per computed waterlevel.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1158
diff
changeset
|
32 super(idx, CROSS_SECTION_WATER_LINE, description); |
1122
111794adf285
Get real (but yet not parameterized) data to display in CrossSection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
33 } |
111794adf285
Get real (but yet not parameterized) data to display in CrossSection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
34 |
111794adf285
Get real (but yet not parameterized) data to display in CrossSection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
35 |
111794adf285
Get real (but yet not parameterized) data to display in CrossSection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
36 /** |
1975
b30e1710df1d
Server-side of interactive cross-section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1802
diff
changeset
|
37 * Gets waterline (crossed with cross section) of waterlevel. |
1122
111794adf285
Get real (but yet not parameterized) data to display in CrossSection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
38 */ |
111794adf285
Get real (but yet not parameterized) data to display in CrossSection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
39 public Object getData(Artifact artifact, CallContext context) { |
111794adf285
Get real (but yet not parameterized) data to display in CrossSection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
40 logger.debug("Get data for cross section water line"); |
111794adf285
Get real (but yet not parameterized) data to display in CrossSection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
41 |
1975
b30e1710df1d
Server-side of interactive cross-section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1802
diff
changeset
|
42 List<DataProvider> providers = context. |
b30e1710df1d
Server-side of interactive cross-section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1802
diff
changeset
|
43 getDataProvider(CrossSectionFacet.BLACKBOARD_CS_MASTER_DATA); |
b30e1710df1d
Server-side of interactive cross-section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1802
diff
changeset
|
44 if (providers.size() < 1) { |
b30e1710df1d
Server-side of interactive cross-section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1802
diff
changeset
|
45 logger.warn("Could not find Cross-Section data provider."); |
b30e1710df1d
Server-side of interactive cross-section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1802
diff
changeset
|
46 return new double[][] {}; |
b30e1710df1d
Server-side of interactive cross-section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1802
diff
changeset
|
47 } |
b30e1710df1d
Server-side of interactive cross-section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1802
diff
changeset
|
48 |
b30e1710df1d
Server-side of interactive cross-section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1802
diff
changeset
|
49 Object crossSection = providers.get(0) |
b30e1710df1d
Server-side of interactive cross-section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1802
diff
changeset
|
50 .provideData(CrossSectionFacet.BLACKBOARD_CS_MASTER_DATA, null, context); |
b30e1710df1d
Server-side of interactive cross-section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1802
diff
changeset
|
51 |
1981
bf62cc7052d4
Implement and use WaterLineArtifact interface.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1975
diff
changeset
|
52 WaterLineArtifact winfo = (WaterLineArtifact)artifact; |
1122
111794adf285
Get real (but yet not parameterized) data to display in CrossSection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
53 |
1975
b30e1710df1d
Server-side of interactive cross-section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1802
diff
changeset
|
54 return winfo.getWaterLines(this.getIndex(), (CrossSectionLine) crossSection); |
1122
111794adf285
Get real (but yet not parameterized) data to display in CrossSection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
55 } |
111794adf285
Get real (but yet not parameterized) data to display in CrossSection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
56 |
1136
8da5f5a9ed3c
Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1122
diff
changeset
|
57 |
2002
98f3ef8da857
Register under a key on blackboard to meet assumptions by areaartifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1981
diff
changeset
|
58 public List getDataProviderKeys(Artifact art) { |
98f3ef8da857
Register under a key on blackboard to meet assumptions by areaartifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1981
diff
changeset
|
59 List list = new ArrayList(); |
98f3ef8da857
Register under a key on blackboard to meet assumptions by areaartifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1981
diff
changeset
|
60 list.add(art.identifier() + getIndex()); |
98f3ef8da857
Register under a key on blackboard to meet assumptions by areaartifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1981
diff
changeset
|
61 return list; |
98f3ef8da857
Register under a key on blackboard to meet assumptions by areaartifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1981
diff
changeset
|
62 } |
98f3ef8da857
Register under a key on blackboard to meet assumptions by areaartifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1981
diff
changeset
|
63 |
98f3ef8da857
Register under a key on blackboard to meet assumptions by areaartifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1981
diff
changeset
|
64 |
98f3ef8da857
Register under a key on blackboard to meet assumptions by areaartifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1981
diff
changeset
|
65 /** |
2017
e384d78ff78b
Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2002
diff
changeset
|
66 * Can provide the curve/line drawn. |
e384d78ff78b
Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2002
diff
changeset
|
67 * @param key will respond on uuid+index |
2002
98f3ef8da857
Register under a key on blackboard to meet assumptions by areaartifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1981
diff
changeset
|
68 * @param param ignored |
98f3ef8da857
Register under a key on blackboard to meet assumptions by areaartifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1981
diff
changeset
|
69 * @param context ignored |
2017
e384d78ff78b
Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2002
diff
changeset
|
70 * @return data to draw "intersection" of master cross section and |
e384d78ff78b
Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2002
diff
changeset
|
71 * the waterlevel at that position. |
2002
98f3ef8da857
Register under a key on blackboard to meet assumptions by areaartifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1981
diff
changeset
|
72 */ |
98f3ef8da857
Register under a key on blackboard to meet assumptions by areaartifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1981
diff
changeset
|
73 public Object provideBlackboardData(Artifact artifact, |
98f3ef8da857
Register under a key on blackboard to meet assumptions by areaartifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1981
diff
changeset
|
74 Object key, |
98f3ef8da857
Register under a key on blackboard to meet assumptions by areaartifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1981
diff
changeset
|
75 Object param, |
98f3ef8da857
Register under a key on blackboard to meet assumptions by areaartifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1981
diff
changeset
|
76 CallContext context |
98f3ef8da857
Register under a key on blackboard to meet assumptions by areaartifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1981
diff
changeset
|
77 ) { |
98f3ef8da857
Register under a key on blackboard to meet assumptions by areaartifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1981
diff
changeset
|
78 if (key.equals(artifact.identifier() + getIndex())) { |
98f3ef8da857
Register under a key on blackboard to meet assumptions by areaartifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1981
diff
changeset
|
79 return getData(artifact, context); |
98f3ef8da857
Register under a key on blackboard to meet assumptions by areaartifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1981
diff
changeset
|
80 } |
98f3ef8da857
Register under a key on blackboard to meet assumptions by areaartifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1981
diff
changeset
|
81 else { |
98f3ef8da857
Register under a key on blackboard to meet assumptions by areaartifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1981
diff
changeset
|
82 logger.warn("Cannot provide data for key: " + key); |
98f3ef8da857
Register under a key on blackboard to meet assumptions by areaartifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1981
diff
changeset
|
83 return null; |
98f3ef8da857
Register under a key on blackboard to meet assumptions by areaartifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1981
diff
changeset
|
84 } |
98f3ef8da857
Register under a key on blackboard to meet assumptions by areaartifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1981
diff
changeset
|
85 } |
98f3ef8da857
Register under a key on blackboard to meet assumptions by areaartifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1981
diff
changeset
|
86 |
98f3ef8da857
Register under a key on blackboard to meet assumptions by areaartifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1981
diff
changeset
|
87 |
1136
8da5f5a9ed3c
Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1122
diff
changeset
|
88 /** Do a deep copy. */ |
1122
111794adf285
Get real (but yet not parameterized) data to display in CrossSection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
89 @Override |
111794adf285
Get real (but yet not parameterized) data to display in CrossSection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
90 public Facet deepCopy() { |
1975
b30e1710df1d
Server-side of interactive cross-section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1802
diff
changeset
|
91 CrossSectionWaterLineFacet copy = new CrossSectionWaterLineFacet( |
b30e1710df1d
Server-side of interactive cross-section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1802
diff
changeset
|
92 this.getIndex(), |
b30e1710df1d
Server-side of interactive cross-section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1802
diff
changeset
|
93 this.description); |
1122
111794adf285
Get real (but yet not parameterized) data to display in CrossSection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
94 copy.set(this); |
111794adf285
Get real (but yet not parameterized) data to display in CrossSection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
95 return copy; |
111794adf285
Get real (but yet not parameterized) data to display in CrossSection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
96 } |
111794adf285
Get real (but yet not parameterized) data to display in CrossSection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
97 } |
111794adf285
Get real (but yet not parameterized) data to display in CrossSection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
98 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |