Mercurial > dive4elements > river
comparison flys-artifacts/src/main/java/de/intevation/flys/exports/WDifferencesCurveGenerator.java @ 1944:21a4d2c677a1
Changed doOut signature, side effect from blackboard feature (to come).
flys-artifacts/trunk@3334 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Felix Wolfsteller <felix.wolfsteller@intevation.de> |
---|---|
date | Wed, 30 Nov 2011 10:10:42 +0000 |
parents | 06d8d371d244 |
children | 65f9d707caff |
comparison
equal
deleted
inserted
replaced
1943:06d8d371d244 | 1944:21a4d2c677a1 |
---|---|
18 | 18 |
19 import de.intevation.flys.artifacts.FLYSArtifact; | 19 import de.intevation.flys.artifacts.FLYSArtifact; |
20 import de.intevation.flys.artifacts.model.FacetTypes; | 20 import de.intevation.flys.artifacts.model.FacetTypes; |
21 import de.intevation.flys.artifacts.model.WKms; | 21 import de.intevation.flys.artifacts.model.WKms; |
22 | 22 |
23 import de.intevation.artifactdatabase.state.ArtifactAndFacet; | |
24 | |
25 import de.intevation.flys.artifacts.model.WQKms; | |
23 import de.intevation.flys.utils.DataUtil; | 26 import de.intevation.flys.utils.DataUtil; |
24 | |
25 import de.intevation.flys.artifacts.model.WQKms; | |
26 import de.intevation.flys.utils.FLYSUtils; | 27 import de.intevation.flys.utils.FLYSUtils; |
27 | 28 |
28 import de.intevation.flys.jfree.FLYSAnnotation; | 29 import de.intevation.flys.jfree.FLYSAnnotation; |
29 | 30 |
30 /** | 31 /** |
131 /** | 132 /** |
132 * Add (themed) data for chart generation. | 133 * Add (themed) data for chart generation. |
133 */ | 134 */ |
134 @Override | 135 @Override |
135 public void doOut( | 136 public void doOut( |
136 Artifact artifact, | 137 ArtifactAndFacet artifactAndFacet, |
137 Facet facet, | 138 Document attr, |
138 Document attr, | 139 boolean visible |
139 boolean visible | |
140 ) { | 140 ) { |
141 String name = facet.getName(); | 141 String name = artifactAndFacet.getFacetName(); |
142 | 142 |
143 logger.debug("WDifferencesCurveGenerator.doOut: " + name); | 143 logger.debug("WDifferencesCurveGenerator.doOut: " + name); |
144 | 144 |
145 if (name == null) { | 145 if (name == null) { |
146 logger.error("No facet name for doOut(). No output generated!"); | 146 logger.error("No facet name for doOut(). No output generated!"); |
147 return; | 147 return; |
148 } | 148 } |
149 | 149 |
150 FLYSArtifact flys = (FLYSArtifact) artifact; | |
151 Facet f = flys.getNativeFacet(facet); | |
152 | |
153 if (f == null) { | |
154 return; | |
155 } | |
156 | |
157 if (name.equals(W_DIFFERENCES)) { | 150 if (name.equals(W_DIFFERENCES)) { |
158 doWDifferencesOut( | 151 doWDifferencesOut( |
159 (WKms) f.getData(artifact, context), | 152 (WKms) artifactAndFacet.getData(context), |
160 facet, | 153 artifactAndFacet.getFacetDescription(), |
161 attr, | 154 attr, |
162 visible); | 155 visible); |
163 } | 156 } |
164 else if (name.equals(LONGITUDINAL_W)) { | 157 else if (name.equals(LONGITUDINAL_W)) { |
165 doWOut((WQKms) f.getData(artifact, context), facet, attr, visible); | 158 doWOut((WQKms) artifactAndFacet.getData(context), |
159 artifactAndFacet.getFacetDescription(), attr, visible); | |
166 } | 160 } |
167 else if (name.equals(STATIC_WKMS) || name.equals(HEIGHTMARKS_POINTS)) { | 161 else if (name.equals(STATIC_WKMS) || name.equals(HEIGHTMARKS_POINTS)) { |
168 doWOut((WKms) f.getData(artifact, context), facet, attr, visible); | 162 doWOut((WKms) artifactAndFacet.getData(context), |
163 artifactAndFacet.getFacetDescription(), attr, visible); | |
169 } | 164 } |
170 else if (name.equals(LONGITUDINAL_ANNOTATION)) { | 165 else if (name.equals(LONGITUDINAL_ANNOTATION)) { |
171 doAnnotations((FLYSAnnotation) f.getData(artifact, context), | 166 doAnnotations((FLYSAnnotation) artifactAndFacet.getData(context), |
172 facet, attr, visible); | 167 artifactAndFacet.getFacet(), attr, visible); |
173 } | 168 } |
174 else { | 169 else { |
175 logger.warn("Unknown facet name: " + name); | 170 logger.warn("Unknown facet name: " + name); |
176 return; | 171 return; |
177 } | 172 } |
185 * @param wqkms The wqkms to add to the diagram. | 180 * @param wqkms The wqkms to add to the diagram. |
186 * @param theme The theme that contains styling information. | 181 * @param theme The theme that contains styling information. |
187 */ | 182 */ |
188 protected void doWOut( | 183 protected void doWOut( |
189 WKms wkms, | 184 WKms wkms, |
190 Facet facet, | 185 String description, |
191 Document theme, | 186 Document theme, |
192 boolean visible | 187 boolean visible |
193 ) { | 188 ) { |
194 logger.debug("WDifferencesCurveGenerator.doWOut"); | 189 logger.debug("WDifferencesCurveGenerator.doWOut"); |
195 | 190 |
196 XYSeries series = new StyledXYSeries(facet.getDescription(), theme); | 191 XYSeries series = new StyledXYSeries(description, theme); |
197 | 192 |
198 StyledSeriesBuilder.addPoints(series, wkms); | 193 StyledSeriesBuilder.addPoints(series, wkms); |
199 | 194 |
200 // Note: the only difference in the super-implementation | 195 // Note: the only difference in the super-implementation |
201 // (in LongitudinalSectionGenerator) is here (adds with | 196 // (in LongitudinalSectionGenerator) is here (adds with |
230 | 225 |
231 /** | 226 /** |
232 * Add items to dataseries which describes the differences. | 227 * Add items to dataseries which describes the differences. |
233 */ | 228 */ |
234 protected void doWDifferencesOut( | 229 protected void doWDifferencesOut( |
235 WKms wkms, | 230 WKms wkms, |
236 Facet facet, | 231 String description, |
237 Document theme, | 232 Document theme, |
238 boolean visible | 233 boolean visible |
239 ) { | 234 ) { |
240 logger.debug("WDifferencesCurveGenerator.doWDifferencesOut"); | 235 logger.debug("WDifferencesCurveGenerator.doWDifferencesOut"); |
241 if (wkms == null) { | 236 if (wkms == null) { |
242 logger.warn("No data to add to WDifferencesChart."); | 237 logger.warn("No data to add to WDifferencesChart."); |
243 return; | 238 return; |
244 } | 239 } |
245 | 240 |
246 XYSeries series = new StyledXYSeries(facet.getDescription(), theme); | 241 XYSeries series = new StyledXYSeries(description, theme); |
247 | 242 |
248 if (logger.isDebugEnabled()) { | 243 if (logger.isDebugEnabled()) { |
249 if (wkms.size() > 0) { | 244 if (wkms.size() > 0) { |
250 logger.debug("Generate series: " + series.getKey()); | 245 logger.debug("Generate series: " + series.getKey()); |
251 logger.debug("Start km: " + wkms.getKm(0)); | 246 logger.debug("Start km: " + wkms.getKm(0)); |