comparison flys-artifacts/src/main/java/de/intevation/flys/themes/TextStyle.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
children
comparison
equal deleted inserted replaced
3463:7198f04e4221 3464:0b9b2a0c4e64
1 package de.intevation.flys.themes;
2
3 import de.intevation.flys.jfree.StableXYDifferenceRenderer;
4
5 import java.awt.Color;
6 import java.awt.Font;
7
8 import org.apache.log4j.Logger;
9 import org.jfree.chart.annotations.XYTextAnnotation;
10
11 public class TextStyle {
12 @SuppressWarnings("unused")
13 private static Logger log = Logger.getLogger(TextStyle.class);
14
15 protected Color textColor;
16 protected Font font;
17 protected Color bgColor;
18 protected boolean showBg;
19 protected boolean isVertical;
20
21 public TextStyle(Color fgColor, Font font, Color bgColor,
22 boolean showBg, boolean isVertical
23 ) {
24 this.textColor = fgColor;
25 this.font = font;
26 this.bgColor = bgColor;
27 this.showBg = showBg;
28 this.isVertical = isVertical;
29 }
30
31 public void apply(XYTextAnnotation ta) {
32 ta.setPaint(textColor);
33 ta.setFont(font);
34 if (this.showBg) {
35 ta.setBackgroundPaint(bgColor);
36 }
37 if (this.isVertical) {
38 ta.setRotationAngle(270f*Math.PI/180f);
39 }
40 else {
41 ta.setRotationAngle(0);
42 }
43 }
44
45 public void apply(StableXYDifferenceRenderer renderer) {
46 renderer.setLabelColor(textColor);
47 renderer.setLabelFont(font);
48 if (this.showBg) {
49 renderer.setLabelBGColor(bgColor);
50 }
51 }
52 }

http://dive4elements.wald.intevation.org