Mercurial > dive4elements > river
comparison artifacts/src/main/java/org/dive4elements/river/exports/fixings/FixDeltaWtGenerator.java @ 6905:1b35b2ddfc28
Artifacts: Introduce ThemeDocument & make stuff compileable again. THIS BREAKS THE SYSTEM! TODO: Move ThemeUtils into ThemeDocument.
author | Sascha L. Teichmann <teichmann@intevation.de> |
---|---|
date | Thu, 22 Aug 2013 23:31:38 +0200 |
parents | d9dfa52f69eb |
children | 0a337f0005c2 |
comparison
equal
deleted
inserted
replaced
6904:d710bd3df387 | 6905:1b35b2ddfc28 |
---|---|
21 import org.dive4elements.river.jfree.CollisionFreeXYTextAnnotation; | 21 import org.dive4elements.river.jfree.CollisionFreeXYTextAnnotation; |
22 import org.dive4elements.river.jfree.RiverAnnotation; | 22 import org.dive4elements.river.jfree.RiverAnnotation; |
23 import org.dive4elements.river.jfree.StyledDomainMarker; | 23 import org.dive4elements.river.jfree.StyledDomainMarker; |
24 import org.dive4elements.river.jfree.StyledTimeSeries; | 24 import org.dive4elements.river.jfree.StyledTimeSeries; |
25 import org.dive4elements.river.jfree.StyledValueMarker; | 25 import org.dive4elements.river.jfree.StyledValueMarker; |
26 import org.dive4elements.river.utils.ThemeUtil; | 26 import org.dive4elements.river.themes.ThemeDocument; |
27 | 27 |
28 import java.io.OutputStream; | 28 import java.io.OutputStream; |
29 import java.text.NumberFormat; | 29 import java.text.NumberFormat; |
30 import java.util.ArrayList; | 30 import java.util.ArrayList; |
31 import java.util.HashMap; | 31 import java.util.HashMap; |
158 | 158 |
159 | 159 |
160 @Override | 160 @Override |
161 public void doOut( | 161 public void doOut( |
162 ArtifactAndFacet artifactFacet, | 162 ArtifactAndFacet artifactFacet, |
163 Document theme, | 163 ThemeDocument theme, |
164 boolean visible | 164 boolean visible |
165 ) { | 165 ) { |
166 String name = artifactFacet.getFacetName(); | 166 String name = artifactFacet.getFacetName(); |
167 logger.debug("FixDeltaWtGenerator.doOut: " + name); | 167 logger.debug("FixDeltaWtGenerator.doOut: " + name); |
168 logger.debug("Theme description is: " + artifactFacet.getFacetDescription()); | 168 logger.debug("Theme description is: " + artifactFacet.getFacetDescription()); |
228 } | 228 } |
229 } | 229 } |
230 | 230 |
231 | 231 |
232 protected void doReferencePeriodsOut( | 232 protected void doReferencePeriodsOut( |
233 D4EArtifact artifact, | 233 D4EArtifact artifact, |
234 Object data, | 234 Object data, |
235 String desc, | 235 String desc, |
236 Document theme, | 236 ThemeDocument theme, |
237 boolean visible) | 237 boolean visible) |
238 { | 238 { |
239 logger.debug("doReferencePeriodsOut()"); | 239 logger.debug("doReferencePeriodsOut()"); |
240 | 240 |
241 if (visible) { | 241 if (visible) { |
242 FixAnalysisAccess access = new FixAnalysisAccess(artifact); | 242 FixAnalysisAccess access = new FixAnalysisAccess(artifact); |
258 : uniqueDate(date+30L*1000L); // add 30secs. | 258 : uniqueDate(date+30L*1000L); // add 30secs. |
259 } | 259 } |
260 | 260 |
261 | 261 |
262 protected void doSectorAverageOut( | 262 protected void doSectorAverageOut( |
263 D4EArtifact artifact, | 263 D4EArtifact artifact, |
264 Object data, | 264 Object data, |
265 String desc, | 265 String desc, |
266 Document theme, | 266 ThemeDocument theme, |
267 boolean visible) | 267 boolean visible) |
268 { | 268 { |
269 logger.debug("doSectorAverageOut(): description = " + desc); | 269 logger.debug("doSectorAverageOut(): description = " + desc); |
270 | 270 |
271 QWDDateRange qwd = (QWDDateRange) data; | 271 QWDDateRange qwd = (QWDDateRange) data; |
272 TimeSeriesCollection tsc = new TimeSeriesCollection(); | 272 TimeSeriesCollection tsc = new TimeSeriesCollection(); |
287 | 287 |
288 tsc.addSeries(series); | 288 tsc.addSeries(series); |
289 | 289 |
290 addAxisDataset(tsc, 0, visible); | 290 addAxisDataset(tsc, 0, visible); |
291 | 291 |
292 if (visible && ThemeUtil.parseShowLineLabel(theme)) { | 292 if (visible && theme.parseShowLineLabel()) { |
293 List<XYTextAnnotation> textAnnos = new ArrayList<XYTextAnnotation>(); | 293 List<XYTextAnnotation> textAnnos = new ArrayList<XYTextAnnotation>(); |
294 XYTextAnnotation anno = new CollisionFreeXYTextAnnotation( | 294 XYTextAnnotation anno = new CollisionFreeXYTextAnnotation( |
295 "\u0394 W(t) [cm] " + (float)Math.round(qwd.qwd.getDeltaW() * 10000) / 10000, | 295 "\u0394 W(t) [cm] " + (float)Math.round(qwd.qwd.getDeltaW() * 10000) / 10000, |
296 tsc.getXValue(0, 0), | 296 tsc.getXValue(0, 0), |
297 qwd.qwd.getDeltaW()); | 297 qwd.qwd.getDeltaW()); |
306 | 306 |
307 protected void doAnalysisEventsOut( | 307 protected void doAnalysisEventsOut( |
308 D4EArtifact artifact, | 308 D4EArtifact artifact, |
309 Object data, | 309 Object data, |
310 String desc, | 310 String desc, |
311 Document theme, | 311 ThemeDocument theme, |
312 boolean visible | 312 boolean visible |
313 ) { | 313 ) { |
314 logger.debug("doAnalysisEventsOut: desc = " + desc); | 314 logger.debug("doAnalysisEventsOut: desc = " + desc); |
315 | 315 |
316 QWD qwd = (QWD) data; | 316 QWD qwd = (QWD) data; |
317 doQWDEventsOut(qwd, desc, theme, visible); | 317 doQWDEventsOut(qwd, desc, theme, visible); |
318 } | 318 } |
319 | 319 |
320 | 320 |
321 protected void doQWDEventsOut(QWD qwd, String desc, Document theme, boolean visible) | 321 protected void doQWDEventsOut(QWD qwd, String desc, ThemeDocument theme, boolean visible) |
322 { | 322 { |
323 TimeSeriesCollection tsc = new TimeSeriesCollection(); | 323 TimeSeriesCollection tsc = new TimeSeriesCollection(); |
324 | 324 |
325 TimeSeries series = new StyledTimeSeries(desc, theme); | 325 TimeSeries series = new StyledTimeSeries(desc, theme); |
326 TimeSeries interpol = new StyledTimeSeries(desc + "interpol", theme); | 326 TimeSeries interpol = new StyledTimeSeries(desc + "interpol", theme); |
367 | 367 |
368 /** | 368 /** |
369 * @param annoIdxMap map of index in qwds to series/data item indices in tsc. | 369 * @param annoIdxMap map of index in qwds to series/data item indices in tsc. |
370 */ | 370 */ |
371 protected void doQWDTextAnnotations(Map<Integer, int[]> annoIdxMap, | 371 protected void doQWDTextAnnotations(Map<Integer, int[]> annoIdxMap, |
372 TimeSeriesCollection tsc, QWD qwd, Document theme, | 372 TimeSeriesCollection tsc, QWD qwd, ThemeDocument theme, |
373 boolean visible) { | 373 boolean visible) { |
374 logger.debug("doQWDTextAnnotation()"); | 374 logger.debug("doQWDTextAnnotation()"); |
375 | 375 |
376 if (!visible || !ThemeUtil.parseShowPointLabel(theme)) { | 376 if (!visible || !theme.parseShowPointLabel()) { |
377 logger.debug("doQWDTextAnnotation: annotation not visible"); | 377 logger.debug("doQWDTextAnnotation: annotation not visible"); |
378 return; | 378 return; |
379 } | 379 } |
380 | 380 |
381 Locale locale = Resources.getLocale(context.getMeta()); | 381 Locale locale = Resources.getLocale(context.getMeta()); |
399 addAnnotations(flysAnno); | 399 addAnnotations(flysAnno); |
400 } | 400 } |
401 | 401 |
402 | 402 |
403 protected void doReferenceEventsOut( | 403 protected void doReferenceEventsOut( |
404 D4EArtifact artifact, | 404 D4EArtifact artifact, |
405 Object data, | 405 Object data, |
406 String desc, | 406 String desc, |
407 Document theme, | 407 ThemeDocument theme, |
408 boolean visible | 408 boolean visible |
409 ) { | 409 ) { |
410 logger.debug("doReferenceEventsOut: desc = " + desc); | 410 logger.debug("doReferenceEventsOut: desc = " + desc); |
411 | 411 |
412 QWD qwd = (QWD) data; | 412 QWD qwd = (QWD) data; |
413 doQWDEventsOut(qwd, desc, theme, visible); | 413 doQWDEventsOut(qwd, desc, theme, visible); |
414 } | 414 } |
415 | 415 |
416 | 416 |
417 protected void doDeviationOut( | 417 protected void doDeviationOut( |
418 D4EArtifact artifact, | 418 D4EArtifact artifact, |
419 Object data, | 419 Object data, |
420 String desc, | 420 String desc, |
421 Document theme, | 421 ThemeDocument theme, |
422 boolean visible | 422 boolean visible |
423 ) { | 423 ) { |
424 logger.debug("doDeviationOut: desc = " + desc); | 424 logger.debug("doDeviationOut: desc = " + desc); |
425 | 425 |
426 if (data == null || !visible) { | 426 if (data == null || !visible) { |
427 logger.debug("no standard deviation"); | 427 logger.debug("no standard deviation"); |
436 } | 436 } |
437 | 437 |
438 | 438 |
439 protected void doAnalysisPeriodsOut( | 439 protected void doAnalysisPeriodsOut( |
440 D4EArtifact artifact, | 440 D4EArtifact artifact, |
441 Object data, | 441 Object data, |
442 String desc, | 442 String desc, |
443 Document theme, | 443 ThemeDocument theme, |
444 boolean visible) | 444 boolean visible) |
445 { | 445 { |
446 DateRange[] ranges = (DateRange[]) data; | 446 DateRange[] ranges = (DateRange[]) data; |
447 if (ranges == null || !visible) { | 447 if (ranges == null || !visible) { |
448 return; | 448 return; |
449 } | 449 } |
471 logger.debug("currentKm = " + currentKm); | 471 logger.debug("currentKm = " + currentKm); |
472 } | 472 } |
473 | 473 |
474 context.putContextValue("currentKm", currentKm); | 474 context.putContextValue("currentKm", currentKm); |
475 | 475 |
476 StyledValueMarker marker = new StyledValueMarker(0, request); | 476 // XXX: This looks hackish! |
477 StyledValueMarker marker = | |
478 new StyledValueMarker(0, new ThemeDocument(request)); | |
477 valueMarker.add(marker); | 479 valueMarker.add(marker); |
478 } | 480 } |
479 } | 481 } |
480 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 : | 482 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 : |