Mercurial > dive4elements > river
comparison flys-artifacts/src/main/java/de/intevation/flys/exports/XYChartGenerator.java @ 3212:abc2db630815
Work in generalized annotations for chart generators
flys-artifacts/trunk@4835 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Christian Lins <christian.lins@intevation.de> |
---|---|
date | Fri, 29 Jun 2012 12:35:06 +0000 |
parents | bbb488b145ce |
children | ed07dd55f487 |
comparison
equal
deleted
inserted
replaced
3211:a1a434c163a4 | 3212:abc2db630815 |
---|---|
186 public static final int AXIS_SPACE = 5; | 186 public static final int AXIS_SPACE = 5; |
187 | 187 |
188 /** The logger that is used in this generator. */ | 188 /** The logger that is used in this generator. */ |
189 private static Logger logger = Logger.getLogger(XYChartGenerator.class); | 189 private static Logger logger = Logger.getLogger(XYChartGenerator.class); |
190 | 190 |
191 /** List of annotations to insert in plot. */ | |
192 protected List<FLYSAnnotation> annotations; | |
193 | |
194 protected List<Marker> domainMarkers = new ArrayList<Marker>(); | 191 protected List<Marker> domainMarkers = new ArrayList<Marker>(); |
195 | 192 |
196 protected List<Marker> valueMarkers = new ArrayList<Marker>(); | 193 protected List<Marker> valueMarkers = new ArrayList<Marker>(); |
197 | 194 |
198 /** The max X range to include all X values of all series for each axis. */ | 195 /** The max X range to include all X values of all series for each axis. */ |
453 if (old != null) { | 450 if (old != null) { |
454 dBounds = (DoubleBounds) dBounds.combine(old); | 451 dBounds = (DoubleBounds) dBounds.combine(old); |
455 } | 452 } |
456 | 453 |
457 setYBounds(index, dBounds); | 454 setYBounds(index, dBounds); |
458 } | |
459 | |
460 | |
461 /** | |
462 * Adds annotations to list (if visible is true). | |
463 */ | |
464 public void addVisibleAnnotations(FLYSAnnotation annotation) { | |
465 if (annotations == null) { | |
466 annotations = new ArrayList<FLYSAnnotation>(); | |
467 } | |
468 | |
469 annotations.add(annotation); | |
470 } | 455 } |
471 | 456 |
472 | 457 |
473 /** | 458 /** |
474 * If no data is visible, draw at least empty axis. | 459 * If no data is visible, draw at least empty axis. |
1006 /** | 991 /** |
1007 * Add the annotations (Sticky, Text and hyk zones) stored | 992 * Add the annotations (Sticky, Text and hyk zones) stored |
1008 * in the annotations field. | 993 * in the annotations field. |
1009 */ | 994 */ |
1010 public void addAnnotationsToRenderer(XYPlot plot) { | 995 public void addAnnotationsToRenderer(XYPlot plot) { |
1011 logger.debug("XYChartGenerator.addAnnotationsToRenderer"); | 996 logger.debug("addAnnotationsToRenderer"); |
1012 | 997 |
1013 if (annotations == null) { | 998 if (annotations == null) { |
1014 logger.debug("XYChartGenerator.addAnnotationsToRenderer: no annotations."); | 999 logger.debug("addAnnotationsToRenderer: no annotations."); |
1015 return; | 1000 return; |
1016 } | 1001 } |
1017 | 1002 |
1018 // Paints for the boxes/lines. | 1003 // Paints for the boxes/lines. |
1019 Stroke basicStroke = new BasicStroke(1.0f); | 1004 Stroke basicStroke = new BasicStroke(1.0f); |
1081 zone.getTo(), area.ofGround(0.03f), basicStroke, tranPaint, fillPaint); | 1066 zone.getTo(), area.ofGround(0.03f), basicStroke, tranPaint, fillPaint); |
1082 XYBoxAnnotation boxB = new XYBoxAnnotation(zone.getFrom(), area.atGround(), | 1067 XYBoxAnnotation boxB = new XYBoxAnnotation(zone.getFrom(), area.atGround(), |
1083 zone.getTo(), area.atTop(), basicStroke, fillPaint, tranPaint); | 1068 zone.getTo(), area.atTop(), basicStroke, fillPaint, tranPaint); |
1084 | 1069 |
1085 XYTextAnnotation tex = new XYTextAnnotation(zone.getName(), | 1070 XYTextAnnotation tex = new XYTextAnnotation(zone.getName(), |
1086 zone.getFrom() + (zone.getTo() - zone.getFrom()) / 2.0d, | 1071 zone.getFrom() + (zone.getTo() - zone.getFrom()) / 1.0d, |
1087 area.ofGround(0.015f)); | 1072 area.ofGround(0.015f)); |
1088 if (textStyle != null) { | 1073 if (textStyle != null) { |
1089 textStyle.apply(tex); | 1074 textStyle.apply(tex); |
1090 } | 1075 } |
1091 | 1076 |
1205 "Art/Facet for Annotations is null. " + | 1190 "Art/Facet for Annotations is null. " + |
1206 "This should never happen!"); | 1191 "This should never happen!"); |
1207 } | 1192 } |
1208 | 1193 |
1209 if (visible) { | 1194 if (visible) { |
1210 addVisibleAnnotations(annotations); | 1195 addAnnotations(annotations); |
1211 } | 1196 } |
1212 } | 1197 } |
1213 | 1198 |
1214 | 1199 |
1215 /** | 1200 /** |