Mercurial > dive4elements > river
comparison artifacts/src/main/java/org/dive4elements/river/exports/XYChartGenerator.java @ 8856:5e38e2924c07 3.2.x
Fix code style.
author | Tom Gottfried <tom@intevation.de> |
---|---|
date | Thu, 18 Jan 2018 20:12:01 +0100 |
parents | bbf6cf555e89 |
children | a7f1d4c9add4 0a5239a1e46e |
comparison
equal
deleted
inserted
replaced
8855:d7c005e12af0 | 8856:5e38e2924c07 |
---|---|
204 flys-artifacts/src/main/resources/images/ | 204 flys-artifacts/src/main/resources/images/ |
205 flys-client/src/main/webapp/images/ | 205 flys-client/src/main/webapp/images/ |
206 */ | 206 */ |
207 java.net.URL imageURL; | 207 java.net.URL imageURL; |
208 if (logo.equals("Intevation")) { | 208 if (logo.equals("Intevation")) { |
209 imageURL = XYChartGenerator.class.getResource("/images/intevation.png"); | 209 imageURL = XYChartGenerator.class.getResource( |
210 "/images/intevation.png"); | |
210 } | 211 } |
211 else { // TODO else if ... | 212 else { // TODO else if ... |
212 imageURL = XYChartGenerator.class.getResource("/images/bfg_logo.gif"); | 213 imageURL = XYChartGenerator.class.getResource( |
214 "/images/bfg_logo.gif"); | |
213 } | 215 } |
214 imageIcon = new ImageIcon(imageURL); | 216 imageIcon = new ImageIcon(imageURL); |
215 | 217 |
216 | 218 |
217 double xPos = 0d, yPos = 0d; | 219 double xPos = 0d, yPos = 0d; |
227 } | 229 } |
228 else if (placev.equals("bottom")) { | 230 else if (placev.equals("bottom")) { |
229 yPos = (Double)getYBounds(0).getLower(); | 231 yPos = (Double)getYBounds(0).getLower(); |
230 } | 232 } |
231 else if (placev.equals("center")) { | 233 else if (placev.equals("center")) { |
232 yPos = ((Double)getYBounds(0).getUpper() + (Double)getYBounds(0).getLower())/2d; | 234 yPos = ((Double)getYBounds(0).getUpper() |
235 + (Double)getYBounds(0).getLower())/2d; | |
233 } | 236 } |
234 else { | 237 else { |
235 log.debug("Unknown place-v value: " + placev); | 238 log.debug("Unknown place-v value: " + placev); |
236 } | 239 } |
237 | 240 |
243 } | 246 } |
244 else if (placeh.equals("right")) { | 247 else if (placeh.equals("right")) { |
245 xPos = getRightX(); | 248 xPos = getRightX(); |
246 } | 249 } |
247 else if (placeh.equals("center")) { | 250 else if (placeh.equals("center")) { |
248 xPos = ((Double)getXBounds(0).getUpper() + (Double)getXBounds(0).getLower())/2d; | 251 xPos = ((Double)getXBounds(0).getUpper() |
252 + (Double)getXBounds(0).getLower())/2d; | |
249 } | 253 } |
250 else { | 254 else { |
251 log.debug("Unknown place-h value: " + placeh); | 255 log.debug("Unknown place-h value: " + placeh); |
252 } | 256 } |
253 | 257 |
289 } | 293 } |
290 } | 294 } |
291 | 295 |
292 XYAnnotation xyannotation = | 296 XYAnnotation xyannotation = |
293 new XYImageAnnotation(xPos, yPos, imageIcon.getImage(), anchor); | 297 new XYImageAnnotation(xPos, yPos, imageIcon.getImage(), anchor); |
294 plot.getRenderer().addAnnotation(xyannotation, org.jfree.ui.Layer.BACKGROUND); | 298 plot.getRenderer().addAnnotation( |
299 xyannotation, org.jfree.ui.Layer.BACKGROUND); | |
295 } | 300 } |
296 | 301 |
297 | 302 |
298 protected NumberAxis createXAxis(String label) { | 303 protected NumberAxis createXAxis(String label) { |
299 return new NumberAxis(label); | 304 return new NumberAxis(label); |
364 | 369 |
365 /** | 370 /** |
366 * Registers an area to be drawn. | 371 * Registers an area to be drawn. |
367 * @param area Area to be drawn. | 372 * @param area Area to be drawn. |
368 * @param index 'axis index' | 373 * @param index 'axis index' |
369 * @param visible Whether or not to be visible (important for range calculations). | 374 * @param visible Whether or not to be visible |
370 */ | 375 * (important for range calculations). |
371 public void addAreaSeries(StyledAreaSeriesCollection area, int index, boolean visible) { | 376 */ |
377 public void addAreaSeries( | |
378 StyledAreaSeriesCollection area, | |
379 int index, | |
380 boolean visible | |
381 ) { | |
372 if (area == null) { | 382 if (area == null) { |
373 log.warn("Cannot yet render above/under curve."); | 383 log.warn("Cannot yet render above/under curve."); |
374 return; | 384 return; |
375 } | 385 } |
376 | 386 |
534 Integer key = Integer.valueOf(i); | 544 Integer key = Integer.valueOf(i); |
535 Bounds b = getXBounds(key); | 545 Bounds b = getXBounds(key); |
536 | 546 |
537 | 547 |
538 if (b != null && b.getLower().equals(b.getUpper())) { | 548 if (b != null && b.getLower().equals(b.getUpper())) { |
539 log.debug("Check whether to expand a x axis.i ("+b.getLower() + "-" + b.getUpper()+")"); | 549 log.debug("Check whether to expand a x axis.i (" |
550 + b.getLower() + "-" + b.getUpper() + ")"); | |
540 setXBounds(key, ChartHelper.expandBounds(b, 5)); | 551 setXBounds(key, ChartHelper.expandBounds(b, 5)); |
541 } | 552 } |
542 } | 553 } |
543 } | 554 } |
544 | 555 |
656 | 667 |
657 return null; | 668 return null; |
658 } | 669 } |
659 | 670 |
660 | 671 |
661 protected boolean zoomX(XYPlot plot, ValueAxis axis, Bounds bounds, Range x) { | 672 protected boolean zoomX( |
673 XYPlot plot, | |
674 ValueAxis axis, | |
675 Bounds bounds, | |
676 Range x | |
677 ) { | |
662 return zoom(plot, axis, bounds, x); | 678 return zoom(plot, axis, bounds, x); |
663 } | 679 } |
664 | 680 |
665 | 681 |
666 protected boolean zoomY(XYPlot plot, ValueAxis axis, Bounds bounds, Range x) { | 682 protected boolean zoomY( |
683 XYPlot plot, | |
684 ValueAxis axis, | |
685 Bounds bounds, | |
686 Range x | |
687 ) { | |
667 return zoom(plot, axis, bounds, x); | 688 return zoom(plot, axis, bounds, x); |
668 } | 689 } |
669 | 690 |
670 | 691 |
671 /** | 692 /** |
908 } | 929 } |
909 catch(JSONException e){ | 930 catch(JSONException e){ |
910 log.error("Could not decode json."); | 931 log.error("Could not decode json."); |
911 } | 932 } |
912 | 933 |
913 RiverAnnotation annotations = new RiverAnnotation(null, null, null, theme); | 934 RiverAnnotation annotations = |
935 new RiverAnnotation(null, null, null, theme); | |
914 annotations.setTextAnnotations(xy); | 936 annotations.setTextAnnotations(xy); |
915 | 937 |
916 // Do not generate second legend entry. (null was passed for the aand before). | 938 // Do not generate second legend entry. |
939 // (null was passed for the aand before). | |
917 doAnnotations(annotations, null, theme, visible); | 940 doAnnotations(annotations, null, theme, visible); |
918 addAxisSeries(series, axisIndex, visible); | 941 addAxisSeries(series, axisIndex, visible); |
919 } | 942 } |
920 | 943 |
921 | 944 |
923 * Create a hash from a legenditem. | 946 * Create a hash from a legenditem. |
924 * This hash can then be used to merge legend items labels. | 947 * This hash can then be used to merge legend items labels. |
925 * @return hash for given legenditem to identify mergeables. | 948 * @return hash for given legenditem to identify mergeables. |
926 */ | 949 */ |
927 public static String legendItemHash(LegendItem li) { | 950 public static String legendItemHash(LegendItem li) { |
928 // TODO Do proper implementation. Ensure that only mergable sets are created. | 951 // TODO Do proper implementation. |
952 // Ensure that only mergable sets are created. | |
929 // getFillPaint() | 953 // getFillPaint() |
930 // getFillPaintTransformer() | 954 // getFillPaintTransformer() |
931 // getLabel() | 955 // getLabel() |
932 // getLine() | 956 // getLine() |
933 // getLinePaint() | 957 // getLinePaint() |