changeset 2032:5746c74c69cf

Added a transparency setting to area theme style. flys-artifacts/trunk@3497 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Felix Wolfsteller <felix.wolfsteller@intevation.de>
date Tue, 20 Dec 2011 15:06:41 +0000
parents 8e7e56db96a5
children 76cedac30d35
files flys-artifacts/ChangeLog flys-artifacts/doc/conf/themes.xml flys-artifacts/src/main/java/de/intevation/flys/exports/StyledAreaSeriesCollection.java flys-artifacts/src/main/java/de/intevation/flys/utils/ThemeUtil.java
diffstat 4 files changed, 40 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/flys-artifacts/ChangeLog	Tue Dec 20 12:06:35 2011 +0000
+++ b/flys-artifacts/ChangeLog	Tue Dec 20 15:06:41 2011 +0000
@@ -1,3 +1,13 @@
+2011-12-20	Felix Wolfsteller	<felix.wolfsteller@intevation.de>
+
+	* doc/conf/themes.xml: Add transparency setting to area theme style.
+
+	* src/main/java/de/intevation/flys/utils/ThemeUtil.java: Helper to
+	  access transparency setting in theme.
+	
+	* src/main/java/de/intevation/flys/exports/StyledAreaSeriesCollection.java:
+
+
 2011-12-20	Felix Wolfsteller	<felix.wolfsteller@intevation.de>
 
 	* src/main/java/de/intevation/flys/artifacts/model/WKmsFacet.java:
--- a/flys-artifacts/doc/conf/themes.xml	Tue Dec 20 12:06:35 2011 +0000
+++ b/flys-artifacts/doc/conf/themes.xml	Tue Dec 20 15:06:41 2011 +0000
@@ -732,6 +732,7 @@
             <field name="fillcolor" type="Color" display="Fuellfarbe" default="0, 100, 0"/>
             <field name="showarea" type="boolean" display="Flaeche beschriften" default="false"/>
             <field name="showborder" type="boolean" display="Flaechebegrenzungslinie anzeigen" default="false"/>
+            <field name="transparent" type="boolean" display="Transparenz" default="false"/>
         </fields>
     </theme>
 
--- a/flys-artifacts/src/main/java/de/intevation/flys/exports/StyledAreaSeriesCollection.java	Tue Dec 20 12:06:35 2011 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/StyledAreaSeriesCollection.java	Tue Dec 20 15:06:41 2011 +0000
@@ -1,5 +1,6 @@
 package de.intevation.flys.exports;
 
+import java.awt.Color;
 import java.awt.Paint;
 
 import org.apache.log4j.Logger;
@@ -73,10 +74,25 @@
      * Blindly (for now) apply the postiviepaint of renderer.
      */
     protected void applyFillColor(StableXYDifferenceRenderer renderer) {
-        Paint paint = ThemeUtil.parseFillColorField(theme);
-        if (paint != null)
+        // Get color.
+        Color paint = ThemeUtil.parseFillColorField(theme);
+        // Get half-transparency flag.
+        if (ThemeUtil.parseTransparency(theme)) {
+            paint = new Color(paint.getRed(), paint.getGreen(), paint.getBlue(),
+                128);
+        }
+        if (paint != null && this.getMode() == FILL_MODE.ABOVE) {
             renderer.setPositivePaint(paint);
-        // TODO set negativepaint? Dependend on the over/under/between settings
+            renderer.setNegativePaint(new Color(0,0,0,0));
+        }
+        else if (paint != null && this.getMode() == FILL_MODE.UNDER) {
+            renderer.setNegativePaint(paint);
+            renderer.setPositivePaint(new Color(0,0,0,0));
+        }
+        else {
+            renderer.setPositivePaint(paint);
+            renderer.setNegativePaint(paint);
+        }
     }
 
     /**
--- a/flys-artifacts/src/main/java/de/intevation/flys/utils/ThemeUtil.java	Tue Dec 20 12:06:35 2011 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/utils/ThemeUtil.java	Tue Dec 20 15:06:41 2011 +0000
@@ -44,6 +44,9 @@
     public final static String XPATH_SHOW_LINE =
         "/theme/field[@name='showlines']/@default";
 
+    public final static String XPATH_TRANSPARENCY =
+        "/theme/field[@name='transparent']/@default";
+
     public final static String XPATH_TEXT_COLOR =
         "/theme/field[@name='textcolor']/@default";
 
@@ -318,6 +321,10 @@
         return XMLUtils.xpathString(theme, XPATH_SYMBOL, null);
     }
 
+    public static String getTransparencyString(Document theme) {
+        return XMLUtils.xpathString(theme, XPATH_TRANSPARENCY, null);
+    }
+
 
     /**
      * Gets color from color field.
@@ -332,6 +339,9 @@
         return parseBoolean(getShowBorderString(theme), false);
     }
 
+    public static boolean parseTransparency(Document theme) {
+        return parseBoolean(getTransparencyString(theme), false);
+    }
 
     /**
      * Gets color from color field.

http://dive4elements.wald.intevation.org