Mercurial > dive4elements > river
comparison artifacts/src/main/java/org/dive4elements/river/exports/process/FixWQProcessor.java @ 9123:1cc7653ca84f
Cleanup of ChartGenerator and ChartGenerator2 code. Put some of the copy/pasted code into a common abstraction.
author | gernotbelger |
---|---|
date | Tue, 05 Jun 2018 19:21:16 +0200 |
parents | a805211690f7 |
children | 094ed9d1f2ad |
comparison
equal
deleted
inserted
replaced
9122:b8e7f6becf78 | 9123:1cc7653ca84f |
---|---|
109 ThemeDocument theme, | 109 ThemeDocument theme, |
110 boolean visible | 110 boolean visible |
111 ) { | 111 ) { |
112 log.debug("doSectorAverageOut"); | 112 log.debug("doSectorAverageOut"); |
113 QWDDateRange qwdd = (QWDDateRange)bundle.getData( | 113 QWDDateRange qwdd = (QWDDateRange)bundle.getData( |
114 generator.getCallContext()); | 114 generator.getContext()); |
115 QWD qwd = qwdd != null ? qwdd.getQWD() : null; | 115 QWD qwd = qwdd != null ? qwdd.getQWD() : null; |
116 | 116 |
117 if(qwd != null) { | 117 if(qwd != null) { |
118 XYSeries series = new StyledXYSeries( | 118 XYSeries series = new StyledXYSeries( |
119 bundle.getFacetDescription(), | 119 bundle.getFacetDescription(), |
152 ThemeDocument theme, | 152 ThemeDocument theme, |
153 boolean visible | 153 boolean visible |
154 ) { | 154 ) { |
155 log.debug("doAnalysisEventsOut"); | 155 log.debug("doAnalysisEventsOut"); |
156 | 156 |
157 QWD qwd = (QWD)bundle.getData(generator.getCallContext()); | 157 QWD qwd = (QWD)bundle.getData(generator.getContext()); |
158 | 158 |
159 if (qwd == null) { | 159 if (qwd == null) { |
160 log.debug("doAnalysisEventsOut: qwd == null"); | 160 log.debug("doAnalysisEventsOut: qwd == null"); |
161 return; | 161 return; |
162 } | 162 } |
204 ArtifactAndFacet bundle, | 204 ArtifactAndFacet bundle, |
205 ThemeDocument theme, | 205 ThemeDocument theme, |
206 boolean visible) { | 206 boolean visible) { |
207 log.debug("doReferenceEventsOut"); | 207 log.debug("doReferenceEventsOut"); |
208 | 208 |
209 QWI qwd = (QWI)bundle.getData(generator.getCallContext()); | 209 QWI qwd = (QWI)bundle.getData(generator.getContext()); |
210 if (qwd == null) { | 210 if (qwd == null) { |
211 log.debug("doReferenceEventsOut: qwds == null in " | 211 log.debug("doReferenceEventsOut: qwds == null in " |
212 + bundle.getFacetDescription()); | 212 + bundle.getFacetDescription()); |
213 return; | 213 return; |
214 } | 214 } |
257 ) { | 257 ) { |
258 log.debug("doWQCurveOut"); | 258 log.debug("doWQCurveOut"); |
259 | 259 |
260 FixWQCurveFacet facet = (FixWQCurveFacet)bundle.getFacet(); | 260 FixWQCurveFacet facet = (FixWQCurveFacet)bundle.getFacet(); |
261 FixFunction func = (FixFunction)facet.getData( | 261 FixFunction func = (FixFunction)facet.getData( |
262 bundle.getArtifact(), generator.getCallContext()); | 262 bundle.getArtifact(), generator.getContext()); |
263 | 263 |
264 if (func == null) { | 264 if (func == null) { |
265 log.warn("doWQCurveOut: Facet does not contain FixFunction"); | 265 log.warn("doWQCurveOut: Facet does not contain FixFunction"); |
266 return; | 266 return; |
267 } | 267 } |
290 ThemeDocument theme, | 290 ThemeDocument theme, |
291 boolean visible | 291 boolean visible |
292 ) { | 292 ) { |
293 log.debug("doOutlierOut"); | 293 log.debug("doOutlierOut"); |
294 | 294 |
295 QWI[] qws = (QWI[])bundle.getData(generator.getCallContext()); | 295 QWI[] qws = (QWI[])bundle.getData(generator.getContext()); |
296 if(qws != null) { | 296 if(qws != null) { |
297 XYSeries series = new StyledXYSeries( | 297 XYSeries series = new StyledXYSeries( |
298 bundle.getFacetDescription(), | 298 bundle.getFacetDescription(), |
299 false, true, | 299 false, true, |
300 theme); | 300 theme); |
336 log.debug("doQSectorOut"); | 336 log.debug("doQSectorOut"); |
337 if (!visible) { | 337 if (!visible) { |
338 return; | 338 return; |
339 } | 339 } |
340 | 340 |
341 Object qsectorsObj = bundle.getData(generator.getCallContext()); | 341 Object qsectorsObj = bundle.getData(generator.getContext()); |
342 if (qsectorsObj == null || !(qsectorsObj instanceof List)) { | 342 if (qsectorsObj == null || !(qsectorsObj instanceof List)) { |
343 log.warn("No QSectors coming from data."); | 343 log.warn("No QSectors coming from data."); |
344 return; | 344 return; |
345 } | 345 } |
346 | 346 |
403 DiagramGenerator generator, | 403 DiagramGenerator generator, |
404 ArtifactAndFacet bundle, | 404 ArtifactAndFacet bundle, |
405 ThemeDocument theme, | 405 ThemeDocument theme, |
406 boolean visible | 406 boolean visible |
407 ) { | 407 ) { |
408 Object data = bundle.getData(generator.getCallContext()); | 408 Object data = bundle.getData(generator.getContext()); |
409 List<StickyAxisAnnotation> xy = new ArrayList<StickyAxisAnnotation>(); | 409 List<StickyAxisAnnotation> xy = new ArrayList<StickyAxisAnnotation>(); |
410 if (data instanceof double[][]) { | 410 if (data instanceof double[][]) { |
411 log.debug("Got double[][]"); | 411 log.debug("Got double[][]"); |
412 double [][] values = (double [][]) data; | 412 double [][] values = (double [][]) data; |
413 for (int i = 0; i< values[0].length; i++) { | 413 for (int i = 0; i< values[0].length; i++) { |
428 log.debug("Got WKms"); | 428 log.debug("Got WKms"); |
429 /* TODO | 429 /* TODO |
430 WKms wkms = (WKms) data; | 430 WKms wkms = (WKms) data; |
431 | 431 |
432 Double ckm = | 432 Double ckm = |
433 (Double)generator.getCallContext().getContextValue( | 433 (Double)generator.getContext().getContextValue( |
434 FixChartGenerator.CURRENT_KM); | 434 FixChartGenerator.CURRENT_KM); |
435 double location = (ckm != null) | 435 double location = (ckm != null) |
436 ? ckm.doubleValue() | 436 ? ckm.doubleValue() |
437 : getRange()[0]; | 437 : getRange()[0]; |
438 double w = StaticWKmsArtifact.getWAtKmLin(data, location); | 438 double w = StaticWKmsArtifact.getWAtKmLin(data, location); |
452 DiagramGenerator generator, | 452 DiagramGenerator generator, |
453 ArtifactAndFacet bundle, | 453 ArtifactAndFacet bundle, |
454 ThemeDocument theme, | 454 ThemeDocument theme, |
455 boolean visible | 455 boolean visible |
456 ) { | 456 ) { |
457 Object data = bundle.getData(generator.getCallContext()); | 457 Object data = bundle.getData(generator.getContext()); |
458 if (data instanceof WQKms) { | 458 if (data instanceof WQKms) { |
459 WQKms wqkms = (WQKms)data; | 459 WQKms wqkms = (WQKms)data; |
460 // TODO As in doEventsOut, the value-searching should | 460 // TODO As in doEventsOut, the value-searching should |
461 // be delivered by the facet already | 461 // be delivered by the facet already |
462 XYSeries series = new StyledXYSeries( | 462 XYSeries series = new StyledXYSeries( |
463 bundle.getFacetDescription(), theme); | 463 bundle.getFacetDescription(), theme); |
464 Double ckm = (Double) generator.getCallContext() | 464 Double ckm = (Double) generator.getContext() |
465 .getContextValue(CURRENT_KM); | 465 .getContextValue(CURRENT_KM); |
466 | 466 |
467 if (wqkms == null || wqkms.getKms().length == 0 || ckm == null) { | 467 if (wqkms == null || wqkms.getKms().length == 0 || ckm == null) { |
468 log.info("addPointFromWQKms: No event data to show."); | 468 log.info("addPointFromWQKms: No event data to show."); |
469 return; | 469 return; |
523 || FIX_WQ_LS.equals(facettype); | 523 || FIX_WQ_LS.equals(facettype); |
524 } | 524 } |
525 | 525 |
526 @Override | 526 @Override |
527 public String getAxisLabel(DiagramGenerator generator) { | 527 public String getAxisLabel(DiagramGenerator generator) { |
528 CallMeta meta = generator.getCallContext().getMeta(); | 528 CallMeta meta = generator.getContext().getMeta(); |
529 | 529 |
530 RiverAccess access = new RiverAccess((D4EArtifact)generator | 530 RiverAccess access = new RiverAccess((D4EArtifact)generator |
531 .getMaster()); | 531 .getMaster()); |
532 String unit = access.getRiver().getWstUnit().getName(); | 532 String unit = access.getRiver().getWstUnit().getName(); |
533 return Resources.getMsg( | 533 return Resources.getMsg( |