comparison artifacts/src/main/java/org/dive4elements/river/exports/fixings/FixWQCurveGenerator.java @ 9325:094ed9d1f2ad

Fixed: change of point style of interpolated data did not change in WQ chart of fixanalysis Fixed: change of point style of interpolated data did not change in dWt chart of fixanalysis; also had duplicate legend entries
author gernotbelger
date Fri, 27 Jul 2018 14:33:41 +0200
parents 1cc7653ca84f
children a3f318347707
comparison
equal deleted inserted replaced
9324:058701d91552 9325:094ed9d1f2ad
320 320
321 double factor = atGauge ? 100d : 1d; 321 double factor = atGauge ? 100d : 1d;
322 322
323 double w = factor*(qwd.getW()-gaugeDatum); 323 double w = factor*(qwd.getW()-gaugeDatum);
324 324
325 // Force empty symbol. 325 final ThemeDocument theme = configureThemeInterpolated(doc, qwd);
326 if (qwd.getInterpolated()) {
327 doc = new ThemeDocument(doc); // prevent potential side effects.
328 doc.setValue(ThemeDocument.USE_FILL_PAINT, "true");
329 }
330 326
331 XYSeries series = new StyledXYSeries( 327 XYSeries series = new StyledXYSeries(
332 aaf.getFacetDescription(), 328 aaf.getFacetDescription(),
333 doc, 329 theme,
334 qwd.getInterpolated() 330 qwd.getInterpolated()
335 ? ShapeUtils.INTERPOLATED_SHAPE 331 ? ShapeUtils.INTERPOLATED_SHAPE
336 : ShapeUtils.MEASURED_SHAPE); 332 : ShapeUtils.MEASURED_SHAPE);
337 333
338 series.add(qwd.getQ(), w); 334 series.add(qwd.getQ(), w);
339 335
340 addAxisSeries(series, atGauge ? YAXIS.WCm.idx : YAXIS.W.idx, visible); 336 addAxisSeries(series, atGauge ? YAXIS.WCm.idx : YAXIS.W.idx, visible);
341 337
342 if (visible && doc.parseShowPointLabel()) { 338 if (visible && theme.parseShowPointLabel()) {
343 339
344 List<XYTextAnnotation> textAnnos = 340 List<XYTextAnnotation> textAnnos =
345 new ArrayList<XYTextAnnotation>(); 341 new ArrayList<XYTextAnnotation>();
346 342
347 DateFormat dateFormat = DateFormat.getDateInstance( 343 DateFormat dateFormat = DateFormat.getDateInstance(
351 qwd.getQ(), 347 qwd.getQ(),
352 w); 348 w);
353 textAnnos.add(anno); 349 textAnnos.add(anno);
354 350
355 RiverAnnotation flysAnno = 351 RiverAnnotation flysAnno =
356 new RiverAnnotation(null, null, null, doc); 352 new RiverAnnotation(null, null, null, theme);
357 flysAnno.setTextAnnotations(textAnnos); 353 flysAnno.setTextAnnotations(textAnnos);
358 addAnnotations(flysAnno); 354 addAnnotations(flysAnno);
359 } 355 }
360 } 356 }
361 357
373 log.debug("doReferenceEventsOut: qwds == null"); 369 log.debug("doReferenceEventsOut: qwds == null");
374 return; 370 return;
375 } 371 }
376 372
377 // Force empty symbol. 373 // Force empty symbol.
378 if (qwd.getInterpolated()) { 374 final ThemeDocument theme = configureThemeInterpolated(doc, qwd);
379 doc = new ThemeDocument(doc); // prevent potential side effects.
380 doc.setValue(ThemeDocument.USE_FILL_PAINT, "true");
381 }
382 375
383 XYSeries series = new StyledXYSeries( 376 XYSeries series = new StyledXYSeries(
384 aaf.getFacetDescription(), 377 aaf.getFacetDescription(),
385 false, true, doc, 378 false, true, theme,
386 qwd.getInterpolated() 379 qwd.getInterpolated()
387 ? ShapeUtils.INTERPOLATED_SHAPE 380 ? ShapeUtils.INTERPOLATED_SHAPE
388 : ShapeUtils.MEASURED_SHAPE); 381 : ShapeUtils.MEASURED_SHAPE);
389 382
390 double gaugeDatum = getCurrentGaugeDatum(); 383 double gaugeDatum = getCurrentGaugeDatum();
394 double factor = atGauge ? 100d : 1d; 387 double factor = atGauge ? 100d : 1d;
395 double w = factor*(qwd.getW()-gaugeDatum); 388 double w = factor*(qwd.getW()-gaugeDatum);
396 389
397 series.add(qwd.getQ(), w, false); 390 series.add(qwd.getQ(), w, false);
398 391
399 if (visible && doc.parseShowPointLabel()) { 392 if (visible && theme.parseShowPointLabel()) {
400 DateFormat dateFormat = DateFormat.getDateInstance( 393 DateFormat dateFormat = DateFormat.getDateInstance(
401 DateFormat.SHORT); 394 DateFormat.SHORT);
402 395
403 XYTextAnnotation anno = new CollisionFreeXYTextAnnotation( 396 XYTextAnnotation anno = new CollisionFreeXYTextAnnotation(
404 dateFormat.format(qwd.getDate()), 397 dateFormat.format(qwd.getDate()),
407 400
408 List<XYTextAnnotation> textAnnos = 401 List<XYTextAnnotation> textAnnos =
409 new ArrayList<XYTextAnnotation>(); 402 new ArrayList<XYTextAnnotation>();
410 textAnnos.add(anno); 403 textAnnos.add(anno);
411 RiverAnnotation flysAnno = 404 RiverAnnotation flysAnno =
412 new RiverAnnotation(null, null, null, doc); 405 new RiverAnnotation(null, null, null, theme);
413 flysAnno.setTextAnnotations(textAnnos); 406 flysAnno.setTextAnnotations(textAnnos);
414 addAnnotations(flysAnno); 407 addAnnotations(flysAnno);
415 } 408 }
416 409
417 addAxisSeries(series, atGauge ? YAXIS.WCm.idx : YAXIS.W.idx, visible); 410 addAxisSeries(series, atGauge ? YAXIS.WCm.idx : YAXIS.W.idx, visible);
418 } 411 }
419 412
413
414 public static final ThemeDocument configureThemeInterpolated(ThemeDocument theme, QWI qwd) {
415
416 // FIXME: it was like this before: points were always shown, flag had no effekt on this kind of theme, although the option is visible in the style editor
417 final boolean showPoints = true;
418 // final boolean showPoints = theme.parseShowPoints();
419
420 final boolean doFill = showPoints && !qwd.getInterpolated();
421 final boolean doOutline = showPoints && qwd.getInterpolated();
422
423 // prevent potential side effects by copying original theme
424 final ThemeDocument newTheme = new ThemeDocument(theme);
425
426 newTheme.setValue(ThemeDocument.SHOW_POINTS, Boolean.toString(doFill));
427 newTheme.setValue(ThemeDocument.SHOW_POINTS_OUTLINE, Boolean.toString(doOutline));
428
429 return newTheme;
430 }
420 431
421 private void addPointFromWQKms(WQKms wqkms, 432 private void addPointFromWQKms(WQKms wqkms,
422 String title, 433 String title,
423 ThemeDocument theme, 434 ThemeDocument theme,
424 boolean visible 435 boolean visible

http://dive4elements.wald.intevation.org