Mercurial > dive4elements > river
comparison flys-artifacts/src/main/java/de/intevation/flys/exports/WDifferencesCurveGenerator.java @ 1684:bdb05dc9b763
Bugfix: #353 Enabled chart's to be drawn with proper axes set even if no data is contained.
flys-artifacts/trunk@2902 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Ingo Weinzierl <ingo.weinzierl@intevation.de> |
---|---|
date | Fri, 07 Oct 2011 10:51:09 +0000 |
parents | 03fbf1b30e72 |
children | 0c9f7cc2cc11 |
comparison
equal
deleted
inserted
replaced
1683:acb4d20b130e | 1684:bdb05dc9b763 |
---|---|
67 | 67 |
68 | 68 |
69 /** | 69 /** |
70 * Add (themed) data for chart generation. | 70 * Add (themed) data for chart generation. |
71 */ | 71 */ |
72 public void doOut(Artifact artifact, Facet facet, Document attr) { | 72 @Override |
73 public void doOut( | |
74 Artifact artifact, | |
75 Facet facet, | |
76 Document attr, | |
77 boolean visible | |
78 ) { | |
73 String name = facet.getName(); | 79 String name = facet.getName(); |
74 | 80 |
75 logger.debug("WDifferencesCurveGenerator.doOut: " + name); | 81 logger.debug("WDifferencesCurveGenerator.doOut: " + name); |
76 | 82 |
77 if (name == null) { | 83 if (name == null) { |
85 if (f == null) { | 91 if (f == null) { |
86 return; | 92 return; |
87 } | 93 } |
88 | 94 |
89 if (name.equals(W_DIFFERENCES)) { | 95 if (name.equals(W_DIFFERENCES)) { |
90 doWDifferencesOut((WKms) f.getData(artifact, context), f.getDescription(), attr); | 96 doWDifferencesOut( |
97 (WKms) f.getData(artifact, context), | |
98 f.getDescription(), | |
99 attr, | |
100 visible); | |
91 } | 101 } |
92 else if (name.equals(LONGITUDINAL_W)) { | 102 else if (name.equals(LONGITUDINAL_W)) { |
93 WINFOArtifact flysArtifact = (WINFOArtifact) artifact; | 103 WINFOArtifact flysArtifact = (WINFOArtifact) artifact; |
94 facet = flysArtifact.getNativeFacet(facet); | 104 facet = flysArtifact.getNativeFacet(facet); |
95 | 105 |
96 doWaterlevelOut((WQKms) facet.getData(artifact, context), f.getDescription(), attr, flysArtifact); | 106 doWaterlevelOut( |
107 (WQKms) facet.getData(artifact, context), | |
108 f.getDescription(), | |
109 attr, | |
110 flysArtifact, | |
111 visible); | |
97 | 112 |
98 } | 113 } |
99 else { | 114 else { |
100 logger.warn("Unknown facet name: " + name); | 115 logger.warn("Unknown facet name: " + name); |
101 return; | 116 return; |
107 * Add the waterlevel-curves (the "absolutes" from which | 122 * Add the waterlevel-curves (the "absolutes" from which |
108 * differences were calculated). | 123 * differences were calculated). |
109 * @param wqkms The wqkms to add to the diagram. | 124 * @param wqkms The wqkms to add to the diagram. |
110 */ | 125 */ |
111 public void doWaterlevelOut(WQKms wqkms, | 126 public void doWaterlevelOut(WQKms wqkms, |
112 String description, | 127 String description, |
113 Document theme, | 128 Document theme, |
114 WINFOArtifact flysArtifact) { | 129 WINFOArtifact flysArtifact, |
130 boolean visible | |
131 ) { | |
115 String wqkmsName = wqkms.getName(); | 132 String wqkmsName = wqkms.getName(); |
116 | 133 |
117 River river = FLYSUtils.getRiver(flysArtifact); | 134 River river = FLYSUtils.getRiver(flysArtifact); |
118 | 135 |
119 if (river == null) { | 136 if (river == null) { |
145 | 162 |
146 for (int i = 0; i < size; i++) { | 163 for (int i = 0; i < size; i++) { |
147 series.add(values[0][i], values[1][i]); | 164 series.add(values[0][i], values[1][i]); |
148 } | 165 } |
149 | 166 |
150 addSecondAxisSeries(series); | 167 addSecondAxisSeries(series, visible); |
151 } | 168 } |
152 | 169 |
153 /** | 170 /** |
154 * Add items to dataseries which describes the differences. | 171 * Add items to dataseries which describes the differences. |
155 */ | 172 */ |
156 protected void doWDifferencesOut(WKms wkms, String seriesName, Document theme) { | 173 protected void doWDifferencesOut( |
174 WKms wkms, | |
175 String seriesName, | |
176 Document theme, | |
177 boolean visible | |
178 ) { | |
157 logger.debug("WDifferencesCurveGenerator.doWDifferencesOut"); | 179 logger.debug("WDifferencesCurveGenerator.doWDifferencesOut"); |
158 if (wkms == null) { | 180 if (wkms == null) { |
159 logger.warn("No data to add to WDifferencesChart."); | 181 logger.warn("No data to add to WDifferencesChart."); |
160 return; | 182 return; |
161 } | 183 } |
174 | 196 |
175 for (int i = 0; i < size; i++) { | 197 for (int i = 0; i < size; i++) { |
176 series.add(wkms.getKm(i), wkms.getW(i)); | 198 series.add(wkms.getKm(i), wkms.getW(i)); |
177 } | 199 } |
178 | 200 |
179 addFirstAxisSeries(series); | 201 addFirstAxisSeries(series, visible); |
180 if (DataUtil.guessWaterIncreasing(wkms.allWs())) { | 202 if (DataUtil.guessWaterIncreasing(wkms.allWs())) { |
181 setInverted(true); | 203 setInverted(true); |
182 } | 204 } |
183 } | 205 } |
184 | 206 |