comparison flys-artifacts/src/main/java/de/intevation/flys/exports/ChartGenerator.java @ 3464:0b9b2a0c4e64

Point labels can have a background color now. flys-artifacts/trunk@5132 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Christian Lins <christian.lins@intevation.de>
date Thu, 26 Jul 2012 10:02:07 +0000
parents 118fe1cc8cc8
children b1912514e0f5
comparison
equal deleted inserted replaced
3463:7198f04e4221 3464:0b9b2a0c4e64
20 import de.intevation.flys.jfree.StickyAxisAnnotation; 20 import de.intevation.flys.jfree.StickyAxisAnnotation;
21 import de.intevation.flys.jfree.Style; 21 import de.intevation.flys.jfree.Style;
22 import de.intevation.flys.jfree.StyledAreaSeriesCollection; 22 import de.intevation.flys.jfree.StyledAreaSeriesCollection;
23 import de.intevation.flys.jfree.StyledSeries; 23 import de.intevation.flys.jfree.StyledSeries;
24 import de.intevation.flys.model.River; 24 import de.intevation.flys.model.River;
25 import de.intevation.flys.themes.LineStyle;
26 import de.intevation.flys.themes.TextStyle;
25 import de.intevation.flys.themes.ThemeAccess; 27 import de.intevation.flys.themes.ThemeAccess;
26 import de.intevation.flys.utils.FLYSUtils; 28 import de.intevation.flys.utils.FLYSUtils;
27 import de.intevation.flys.utils.ThemeUtil; 29 import de.intevation.flys.utils.ThemeUtil;
28 30
29 import java.awt.BasicStroke; 31 import java.awt.BasicStroke;
177 */ 179 */
178 protected void addStickyAnnotation( 180 protected void addStickyAnnotation(
179 StickyAxisAnnotation annotation, 181 StickyAxisAnnotation annotation,
180 XYPlot plot, 182 XYPlot plot,
181 ChartArea area, 183 ChartArea area,
182 ThemeAccess.LineStyle lineStyle, 184 LineStyle lineStyle,
183 ThemeAccess.TextStyle textStyle, 185 TextStyle textStyle,
184 Document theme 186 Document theme
185 ) { 187 ) {
186 // OPTIMIZE pre-calculate area-related values 188 // OPTIMIZE pre-calculate area-related values
187 final float TEXT_OFF = 0.03f; 189 final float TEXT_OFF = 0.03f;
188 190
299 * @param area helper to calculate coordinates 301 * @param area helper to calculate coordinates
300 * @param pos one-dimensional position (distance from axis) 302 * @param pos one-dimensional position (distance from axis)
301 * @param lineStyle the line style to use for the line. 303 * @param lineStyle the line style to use for the line.
302 */ 304 */
303 protected static XYLineAnnotation createGroundStickAnnotation( 305 protected static XYLineAnnotation createGroundStickAnnotation(
304 ChartArea area, float pos, ThemeAccess.LineStyle lineStyle 306 ChartArea area, float pos, LineStyle lineStyle
305 ) { 307 ) {
306 // Style the line. 308 // Style the line.
307 if (lineStyle != null) { 309 if (lineStyle != null) {
308 return new XYLineAnnotation( 310 return new XYLineAnnotation(
309 pos, area.atGround(), 311 pos, area.atGround(),
323 * @param area helper to calculate coordinates 325 * @param area helper to calculate coordinates
324 * @param pos one-dimensional position (distance from axis) 326 * @param pos one-dimensional position (distance from axis)
325 * @param lineStyle the line style to use for the line. 327 * @param lineStyle the line style to use for the line.
326 */ 328 */
327 protected static XYLineAnnotation createRightStickAnnotation( 329 protected static XYLineAnnotation createRightStickAnnotation(
328 ChartArea area, float pos, ThemeAccess.LineStyle lineStyle 330 ChartArea area, float pos, LineStyle lineStyle
329 ) { 331 ) {
330 // Style the line. 332 // Style the line.
331 if (lineStyle != null) { 333 if (lineStyle != null) {
332 return new XYLineAnnotation( 334 return new XYLineAnnotation(
333 area.ofRight(ANNOTATIONS_AXIS_OFFSET), pos, 335 area.ofRight(ANNOTATIONS_AXIS_OFFSET), pos,
347 * @param area helper to calculate coordinates 349 * @param area helper to calculate coordinates
348 * @param pos one-dimensional position (distance from axis) 350 * @param pos one-dimensional position (distance from axis)
349 * @param lineStyle the line style to use for the line. 351 * @param lineStyle the line style to use for the line.
350 */ 352 */
351 protected static XYLineAnnotation createLeftStickAnnotation( 353 protected static XYLineAnnotation createLeftStickAnnotation(
352 ChartArea area, float pos, ThemeAccess.LineStyle lineStyle 354 ChartArea area, float pos, LineStyle lineStyle
353 ) { 355 ) {
354 // Style the line. 356 // Style the line.
355 if (lineStyle != null) { 357 if (lineStyle != null) {
356 return new XYLineAnnotation( 358 return new XYLineAnnotation(
357 area.atLeft(), pos, 359 area.atLeft(), pos,
374 * @param area helper to calculate offsets. 376 * @param area helper to calculate offsets.
375 * @param lineStyle optional line style. 377 * @param lineStyle optional line style.
376 */ 378 */
377 protected static XYLineAnnotation createStickyLineAnnotation( 379 protected static XYLineAnnotation createStickyLineAnnotation(
378 StickyAxisAnnotation.SimpleAxis axis, float fromD1, float toD2, 380 StickyAxisAnnotation.SimpleAxis axis, float fromD1, float toD2,
379 ChartArea area, ThemeAccess.LineStyle lineStyle 381 ChartArea area, LineStyle lineStyle
380 ) { 382 ) {
381 double anchorX1 = 0d, anchorX2 = 0d, anchorY1 = 0d, anchorY2 = 0d; 383 double anchorX1 = 0d, anchorX2 = 0d, anchorY1 = 0d, anchorY2 = 0d;
382 switch(axis) { 384 switch(axis) {
383 case X_AXIS: 385 case X_AXIS:
384 anchorX1 = fromD1; 386 anchorX1 = fromD1;
434 // Walk over all Annotation sets. 436 // Walk over all Annotation sets.
435 for (FLYSAnnotation fa: annotations) { 437 for (FLYSAnnotation fa: annotations) {
436 438
437 // Access text styling, if any. 439 // Access text styling, if any.
438 Document theme = fa.getTheme(); 440 Document theme = fa.getTheme();
439 ThemeAccess.TextStyle textStyle = null; 441 TextStyle textStyle = null;
440 ThemeAccess.LineStyle lineStyle = null; 442 LineStyle lineStyle = null;
441 443
442 // Get Themeing information and add legend item. 444 // Get Themeing information and add legend item.
443 if (theme != null) { 445 if (theme != null) {
444 ThemeAccess themeAccess = new ThemeAccess(theme); 446 ThemeAccess themeAccess = new ThemeAccess(theme);
445 textStyle = themeAccess.parseTextStyle(); 447 textStyle = themeAccess.parseTextStyle();

http://dive4elements.wald.intevation.org