Mercurial > dive4elements > river
comparison flys-artifacts/src/main/java/org/dive4elements/river/exports/DischargeLongitudinalSectionGenerator.java @ 5831:bd047b71ab37
Repaired internal references
author | Sascha L. Teichmann <teichmann@intevation.de> |
---|---|
date | Thu, 25 Apr 2013 12:06:39 +0200 |
parents | flys-artifacts/src/main/java/de/intevation/flys/exports/DischargeLongitudinalSectionGenerator.java@fc0cdcae8f07 |
children |
comparison
equal
deleted
inserted
replaced
5830:160f53ee0870 | 5831:bd047b71ab37 |
---|---|
1 package org.dive4elements.river.exports; | |
2 | |
3 import org.apache.log4j.Logger; | |
4 | |
5 import org.jfree.data.xy.XYSeries; | |
6 | |
7 import org.w3c.dom.Document; | |
8 | |
9 import org.dive4elements.artifactdatabase.state.ArtifactAndFacet; | |
10 import org.dive4elements.artifactdatabase.state.Facet; | |
11 | |
12 import org.dive4elements.river.artifacts.model.FacetTypes; | |
13 import org.dive4elements.river.artifacts.model.WQCKms; | |
14 import org.dive4elements.river.artifacts.model.WQKms; | |
15 import org.dive4elements.river.exports.process.Processor; | |
16 import org.dive4elements.river.exports.process.WOutProcessor; | |
17 | |
18 import org.dive4elements.river.jfree.FLYSAnnotation; | |
19 import org.dive4elements.river.jfree.StyledXYSeries; | |
20 | |
21 | |
22 | |
23 /** | |
24 * An OutGenerator that generates discharge longitudinal section curves. | |
25 * | |
26 * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a> | |
27 */ | |
28 public class DischargeLongitudinalSectionGenerator | |
29 extends LongitudinalSectionGenerator | |
30 implements FacetTypes | |
31 { | |
32 private static Logger logger = | |
33 Logger.getLogger(DischargeLongitudinalSectionGenerator.class); | |
34 | |
35 | |
36 public DischargeLongitudinalSectionGenerator() { | |
37 super(); | |
38 } | |
39 | |
40 | |
41 @Override | |
42 public void doOut( | |
43 ArtifactAndFacet artifactFacet, | |
44 Document attr, | |
45 boolean visible | |
46 ) { | |
47 logger.debug("DischargeLongitudinalSectionGenerator.doOut"); | |
48 | |
49 String name = artifactFacet.getFacetName(); | |
50 | |
51 if (name == null) { | |
52 return; | |
53 } | |
54 | |
55 Facet facet = artifactFacet.getFacet(); | |
56 | |
57 if (name.contains(DISCHARGE_LONGITUDINAL_Q)) { | |
58 doQOut( | |
59 (WQKms) artifactFacet.getData(context), | |
60 artifactFacet, | |
61 attr, | |
62 visible); | |
63 } | |
64 else if (name.equals(DISCHARGE_LONGITUDINAL_C)) { | |
65 doCorrectedWOut( | |
66 (WQCKms) artifactFacet.getData(context), | |
67 facet, | |
68 attr, | |
69 visible); | |
70 } | |
71 else if (name.equals(LONGITUDINAL_ANNOTATION)) { | |
72 doAnnotations((FLYSAnnotation) artifactFacet.getData(context), | |
73 artifactFacet, attr, visible); | |
74 } | |
75 else if (FacetTypes.IS.MANUALPOINTS(name)) { | |
76 doPoints(artifactFacet.getData(context), | |
77 artifactFacet, | |
78 attr, visible, YAXIS.W.idx); | |
79 } | |
80 else { | |
81 Processor processor = new WOutProcessor(); | |
82 if (processor.canHandle(name)) { | |
83 processor.doOut(this, artifactFacet, attr, visible, YAXIS.W.idx); | |
84 } | |
85 else { | |
86 logger.warn("Unknown facet name: " + name); | |
87 } | |
88 } | |
89 } | |
90 | |
91 | |
92 /** | |
93 * Adds a new series for the corrected W curve. | |
94 * | |
95 * @param wqckms The object that contains the corrected W values. | |
96 * @param theme The theme that contains styling information. | |
97 */ | |
98 protected void doCorrectedWOut( | |
99 WQCKms wqckms, | |
100 Facet facet, | |
101 Document theme, | |
102 boolean visible | |
103 ) { | |
104 logger.debug("DischargeLongitudinalSectionGenerator.doCorrectedWOut"); | |
105 | |
106 int size = wqckms.size(); | |
107 | |
108 if (size > 0) { | |
109 XYSeries series = new StyledXYSeries( | |
110 facet.getDescription(), | |
111 theme); | |
112 | |
113 for (int i = 0; i < size; i++) { | |
114 series.add(wqckms.getKm(i), wqckms.getC(i)); | |
115 } | |
116 | |
117 addAxisSeries(series, YAXIS.W.idx, visible); | |
118 } | |
119 | |
120 if (wqckms.guessWaterIncreasing()) { | |
121 setInverted(true); | |
122 } | |
123 } | |
124 } | |
125 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |