annotate flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/CrossSectionWaterLineFacet.java @ 4255:670e98f5a441

Fixed leak while merging facets. The ThemeList that is used by OutputHelper to sort the Facets for an Output now uses a list to store the ManagedFacets. The correct order is made up by sorting the List using Collections.sort() function of the Java JDK. Therfore, the ManagedFacet class implements the Comparable interface. The return value of its compareTo(other) method depends on the value of the 'position' field.
author Ingo Weinzierl <weinzierl.ingo@googlemail.com>
date Thu, 25 Oct 2012 14:01:46 +0200
parents 31168ac9c7e7
children 6153c50f78cf
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
1975
b30e1710df1d Server-side of interactive cross-section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1802
diff changeset
5 import java.util.List;
b30e1710df1d Server-side of interactive cross-section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1802
diff changeset
6
1122
111794adf285 Get real (but yet not parameterized) data to display in CrossSection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
7 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
8 import de.intevation.artifacts.CallContext;
2141
79a94c4171cb Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2126
diff changeset
9 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
10
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.artifactdatabase.state.Facet;
111794adf285 Get real (but yet not parameterized) data to display in CrossSection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
12
1981
bf62cc7052d4 Implement and use WaterLineArtifact interface.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1975
diff changeset
13 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
14
2126
d626ae185305 Use the fast cross section lines from backend now.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2120
diff changeset
15 import de.intevation.flys.model.FastCrossSectionLine;
1122
111794adf285 Get real (but yet not parameterized) data to display in CrossSection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
16
3227
ed07dd55f487 Fixed various bugs (package declarations, moved classes to correct places).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3225
diff changeset
17 import de.intevation.flys.artifacts.geom.Lines;
2652
9d2a06c3a134 Added DataType for lines that also stores width, use it. Added HasLabel interface for some series.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2141
diff changeset
18
3225
049ccd2c5935 Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3198
diff changeset
19
1122
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
2028
f834a6961bb7 Refactored, make usage of blackboarddatafacet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2017
diff changeset
24 extends BlackboardDataFacet
1122
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
3272
31168ac9c7e7 Partial fix for issue694 (heightmarks snap to nearest cross section).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3227
diff changeset
27 /** Private logger to use. */
31168ac9c7e7 Partial fix for issue694 (heightmarks snap to nearest cross section).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3227
diff changeset
28 private static Logger logger =
31168ac9c7e7 Partial fix for issue694 (heightmarks snap to nearest cross section).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3227
diff changeset
29 Logger.getLogger(CrossSectionWaterLineFacet.class);
1122
111794adf285 Get real (but yet not parameterized) data to display in CrossSection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
30
111794adf285 Get real (but yet not parameterized) data to display in CrossSection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
31
111794adf285 Get real (but yet not parameterized) data to display in CrossSection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
32 /** 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
33 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
34 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
35 }
111794adf285 Get real (but yet not parameterized) data to display in CrossSection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
36
111794adf285 Get real (but yet not parameterized) data to display in CrossSection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
37
3272
31168ac9c7e7 Partial fix for issue694 (heightmarks snap to nearest cross section).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3227
diff changeset
38 /**
31168ac9c7e7 Partial fix for issue694 (heightmarks snap to nearest cross section).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3227
diff changeset
39 * Trivial constructor, set (maybe localized) description.
31168ac9c7e7 Partial fix for issue694 (heightmarks snap to nearest cross section).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3227
diff changeset
40 * @param idx Index of this facet.
31168ac9c7e7 Partial fix for issue694 (heightmarks snap to nearest cross section).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3227
diff changeset
41 * @param name 'type' of this facet.
31168ac9c7e7 Partial fix for issue694 (heightmarks snap to nearest cross section).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3227
diff changeset
42 * @param description (maybe) localized user-visible description.
31168ac9c7e7 Partial fix for issue694 (heightmarks snap to nearest cross section).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3227
diff changeset
43 */
3198
d35f28655fa6 Create and handle new manual line type facets.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3076
diff changeset
44 public CrossSectionWaterLineFacet(int idx, String name, String description) {
d35f28655fa6 Create and handle new manual line type facets.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3076
diff changeset
45 super(idx, name, description);
d35f28655fa6 Create and handle new manual line type facets.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3076
diff changeset
46 }
d35f28655fa6 Create and handle new manual line type facets.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3076
diff changeset
47
d35f28655fa6 Create and handle new manual line type facets.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3076
diff changeset
48
1122
111794adf285 Get real (but yet not parameterized) data to display in CrossSection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
49 /**
1975
b30e1710df1d Server-side of interactive cross-section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1802
diff changeset
50 * 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
51 */
111794adf285 Get real (but yet not parameterized) data to display in CrossSection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
52 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
53 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
54
1975
b30e1710df1d Server-side of interactive cross-section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1802
diff changeset
55 List<DataProvider> providers = context.
b30e1710df1d Server-side of interactive cross-section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1802
diff changeset
56 getDataProvider(CrossSectionFacet.BLACKBOARD_CS_MASTER_DATA);
b30e1710df1d Server-side of interactive cross-section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1802
diff changeset
57 if (providers.size() < 1) {
b30e1710df1d Server-side of interactive cross-section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1802
diff changeset
58 logger.warn("Could not find Cross-Section data provider.");
2673
0143b44631cc Beginnings of mittlere hoehe calculation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2652
diff changeset
59 return new Lines.LineData(new double[][] {}, 0d, 0d);
1975
b30e1710df1d Server-side of interactive cross-section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1802
diff changeset
60 }
3076
5642a83420f2 FLYS artifacts: Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2676
diff changeset
61
1975
b30e1710df1d Server-side of interactive cross-section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1802
diff changeset
62 Object crossSection = providers.get(0)
3272
31168ac9c7e7 Partial fix for issue694 (heightmarks snap to nearest cross section).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3227
diff changeset
63 .provideData(CrossSectionFacet.BLACKBOARD_CS_MASTER_DATA,
31168ac9c7e7 Partial fix for issue694 (heightmarks snap to nearest cross section).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3227
diff changeset
64 null, context);
31168ac9c7e7 Partial fix for issue694 (heightmarks snap to nearest cross section).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3227
diff changeset
65 Object nextKm = providers.get(0).
31168ac9c7e7 Partial fix for issue694 (heightmarks snap to nearest cross section).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3227
diff changeset
66 provideData(CrossSectionFacet.BLACKBOARD_CS_NEXT_KM, null, context);
31168ac9c7e7 Partial fix for issue694 (heightmarks snap to nearest cross section).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3227
diff changeset
67 Object prevKm = providers.get(0).
31168ac9c7e7 Partial fix for issue694 (heightmarks snap to nearest cross section).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3227
diff changeset
68 provideData(CrossSectionFacet.BLACKBOARD_CS_PREV_KM, null, context);
31168ac9c7e7 Partial fix for issue694 (heightmarks snap to nearest cross section).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3227
diff changeset
69 if (prevKm == null)
31168ac9c7e7 Partial fix for issue694 (heightmarks snap to nearest cross section).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3227
diff changeset
70 prevKm = new Double(-1d);
31168ac9c7e7 Partial fix for issue694 (heightmarks snap to nearest cross section).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3227
diff changeset
71 if (nextKm == null)
31168ac9c7e7 Partial fix for issue694 (heightmarks snap to nearest cross section).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3227
diff changeset
72 nextKm = new Double(-1d);
1975
b30e1710df1d Server-side of interactive cross-section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1802
diff changeset
73
3272
31168ac9c7e7 Partial fix for issue694 (heightmarks snap to nearest cross section).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3227
diff changeset
74 WaterLineArtifact lineArtifact = (WaterLineArtifact) artifact;
1122
111794adf285 Get real (but yet not parameterized) data to display in CrossSection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
75
2676
6af95cecdd03 More stable waterlinefacet, in prep for fix issue620.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2673
diff changeset
76 if (crossSection != null) {
3272
31168ac9c7e7 Partial fix for issue694 (heightmarks snap to nearest cross section).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3227
diff changeset
77 return lineArtifact.getWaterLines(this.getIndex(),
31168ac9c7e7 Partial fix for issue694 (heightmarks snap to nearest cross section).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3227
diff changeset
78 (FastCrossSectionLine) crossSection, (Double) nextKm, (Double) prevKm);
2676
6af95cecdd03 More stable waterlinefacet, in prep for fix issue620.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2673
diff changeset
79 }
6af95cecdd03 More stable waterlinefacet, in prep for fix issue620.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2673
diff changeset
80 else {
6af95cecdd03 More stable waterlinefacet, in prep for fix issue620.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2673
diff changeset
81 return new Lines.LineData(new double[][] {}, 0d,0d);
6af95cecdd03 More stable waterlinefacet, in prep for fix issue620.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2673
diff changeset
82 }
1122
111794adf285 Get real (but yet not parameterized) data to display in CrossSection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
83 }
111794adf285 Get real (but yet not parameterized) data to display in CrossSection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
84
1136
8da5f5a9ed3c Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1122
diff changeset
85
8da5f5a9ed3c Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1122
diff changeset
86 /** Do a deep copy. */
3076
5642a83420f2 FLYS artifacts: Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2676
diff changeset
87 @Override
1122
111794adf285 Get real (but yet not parameterized) data to display in CrossSection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
88 public Facet deepCopy() {
1975
b30e1710df1d Server-side of interactive cross-section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1802
diff changeset
89 CrossSectionWaterLineFacet copy = new CrossSectionWaterLineFacet(
b30e1710df1d Server-side of interactive cross-section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1802
diff changeset
90 this.getIndex(),
b30e1710df1d Server-side of interactive cross-section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1802
diff changeset
91 this.description);
1122
111794adf285 Get real (but yet not parameterized) data to display in CrossSection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
92 copy.set(this);
111794adf285 Get real (but yet not parameterized) data to display in CrossSection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
93 return copy;
111794adf285 Get real (but yet not parameterized) data to display in CrossSection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
94 }
111794adf285 Get real (but yet not parameterized) data to display in CrossSection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
95 }
111794adf285 Get real (but yet not parameterized) data to display in CrossSection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
96 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org