changeset 2416:5144369d5961

Partial Fix flys/issue500: text-orientation for texts. flys-artifacts/trunk@4048 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Felix Wolfsteller <felix.wolfsteller@intevation.de>
date Tue, 14 Feb 2012 09:00:50 +0000
parents 64dd65aa620d
children e5fa3cbbe3ae
files flys-artifacts/doc/conf/themes.xml flys-artifacts/src/main/java/de/intevation/flys/exports/XYChartGenerator.java flys-artifacts/src/main/java/de/intevation/flys/themes/ThemeAccess.java
diffstat 3 files changed, 19 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/flys-artifacts/doc/conf/themes.xml	Mon Feb 13 17:49:04 2012 +0000
+++ b/flys-artifacts/doc/conf/themes.xml	Tue Feb 14 09:00:50 2012 +0000
@@ -558,6 +558,7 @@
         </inherits>
         <fields>
             <field name="linecolor" type="Color" display="Farbe" default="0, 215, 0"/>
+            <field name="textorientation"  type="boolean" display="Textausrichtung"      default="true"/>
         </fields>
     </theme>
 
@@ -738,7 +739,7 @@
             <field name="textstyle" type="Style" display="Schriftstil"     default="standard"/>
             <field name="pointsize"  type="int"     display="Punktdicke"           default="3"     hints="h"/>
             <field name="backgroundcolor"  type="Color"   display="Texthintergrund"      default="255, 255, 255"/>
-            <field name="textorientation"  type="boolean" display="Textausrichtung"      default="false"/>
+            <field name="textorientation"  type="boolean" display="Textausrichtung"      default="true"/>
             <field name="showbackground"   type="boolean" display="Hintergrund anzeigen" default="false"/>
         </fields>
     </theme>
--- a/flys-artifacts/src/main/java/de/intevation/flys/exports/XYChartGenerator.java	Mon Feb 13 17:49:04 2012 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/XYChartGenerator.java	Tue Feb 14 09:00:50 2012 +0000
@@ -695,15 +695,13 @@
                 lineAnnotation = new XYLineAnnotation(annotation.getPos(),
                     area.atGround(), annotation.getPos(), area.ofGround(LINE_OFF),
                     new BasicStroke(lineStyle.getWidth()),lineStyle.getColor());
-                textAnnotation.setRotationAnchor(TextAnchor.CENTER_LEFT);
-                textAnnotation.setTextAnchor(TextAnchor.CENTER_LEFT);
             }
             else {
                 lineAnnotation = new XYLineAnnotation(annotation.getPos(),
                     area.atGround(), annotation.getPos(), area.ofGround(LINE_OFF));
-                textAnnotation.setRotationAnchor(TextAnchor.CENTER_LEFT);
-                textAnnotation.setTextAnchor(TextAnchor.CENTER_LEFT);
             }
+            textAnnotation.setRotationAnchor(TextAnchor.CENTER_LEFT);
+            textAnnotation.setTextAnchor(TextAnchor.CENTER_LEFT);
         }
         else {
             // Do the more complicated case where we stick to the Y-Axis.
--- a/flys-artifacts/src/main/java/de/intevation/flys/themes/ThemeAccess.java	Mon Feb 13 17:49:04 2012 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/themes/ThemeAccess.java	Tue Feb 14 09:00:50 2012 +0000
@@ -126,7 +126,8 @@
 
     public TextStyle parseTextStyle() {
         return new TextStyle(parseTextColor(), parseTextFont(),
-            parseTextBackground(), parseShowTextBackground());
+            parseTextBackground(), parseShowTextBackground(),
+            !parseTextOrientation().equals("horizontal"));
     }
 
 
@@ -135,14 +136,16 @@
         protected Font    font;
         protected Color   bgColor;
         protected boolean showBg;
+        protected boolean isVertical;
 
         public TextStyle(Color fgColor, Font font, Color bgColor,
-            boolean showBg
+            boolean showBg, boolean isVertical
         ) {
-            this.textColor = fgColor;
-            this.font = font;
-            this.bgColor = bgColor;
-            this.showBg = showBg;
+            this.textColor  = fgColor;
+            this.font       = font;
+            this.bgColor    = bgColor;
+            this.showBg     = showBg;
+            this.isVertical = isVertical;
         }
 
         public void apply(XYTextAnnotation ta) {
@@ -151,6 +154,12 @@
             if (this.showBg) {
                 ta.setBackgroundPaint(bgColor);
             }
+            if (this.isVertical) {
+                ta.setRotationAngle(270f*Math.PI/180f);
+            }
+            else {
+                ta.setRotationAngle(0f*Math.PI/180f);
+            }
         }
     }
 }

http://dive4elements.wald.intevation.org