changeset 3889:940cd2ef149f

Area transparency fix flys-artifacts/trunk@5542 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Christian Lins <christian.lins@intevation.de>
date Thu, 20 Sep 2012 20:35:44 +0000
parents 44a071455709
children 2ca035dbc838
files flys-artifacts/ChangeLog flys-artifacts/doc/conf/default-themes.xml flys-artifacts/doc/conf/second-themes.xml flys-artifacts/src/main/java/de/intevation/flys/jfree/StyledAreaSeriesCollection.java flys-artifacts/src/main/java/de/intevation/flys/jfree/StyledDomainMarker.java flys-artifacts/src/main/java/de/intevation/flys/utils/ThemeUtil.java
diffstat 6 files changed, 39 insertions(+), 56 deletions(-) [+]
line wrap: on
line diff
--- a/flys-artifacts/ChangeLog	Thu Sep 20 09:35:31 2012 +0000
+++ b/flys-artifacts/ChangeLog	Thu Sep 20 20:35:44 2012 +0000
@@ -1,3 +1,12 @@
+2012-09-20	Christian Lins	<christian.lins@intevation.de>
+
+	* doc/conf/second-themes.xml,
+	  doc/conf/default-themes.xml,
+	  src/main/java/de/intevation/flys/utils/ThemeUtil.java,
+	  src/main/java/de/intevation/flys/jfree/StyledAreaSeriesCollection.java,
+	  src/main/java/de/intevation/flys/jfree/StyledDomainMarker.java:
+	  Theme area transparency fixed for longitudinal section chart (#879).
+
 2012-09-20	Felix Wolfsteller	<felix.wolfsteller@intevation.de>
 
 	Improvements for manual points in fixation diags.
--- a/flys-artifacts/doc/conf/default-themes.xml	Thu Sep 20 09:35:31 2012 +0000
+++ b/flys-artifacts/doc/conf/default-themes.xml	Thu Sep 20 20:35:44 2012 +0000
@@ -1456,10 +1456,8 @@
             <inherit from="Areas" />
         </inherits>
         <fields>
-            <field name="fillcolor" type="Color" display="Fuellfarbe"
+            <field name="backgroundcolor" type="Color" display="Fuellfarbe"
                 default="0, 128, 0" />
-            <field name="transparent" type="boolean" display="Transparenz"
-                default="true" />
         </fields>
     </theme>
     <theme name="FixingSectorDeviationLS1">
@@ -1467,10 +1465,8 @@
             <inherit from="Areas" />
         </inherits>
         <fields>
-            <field name="fillcolor" type="Color" display="Fuellfarbe"
+            <field name="backgroundcolor" type="Color" display="Fuellfarbe"
                 default="0, 0, 255" />
-            <field name="transparent" type="boolean" display="Transparenz"
-                default="true" />
         </fields>
     </theme>
     <theme name="FixingSectorDeviationLS2">
@@ -1478,10 +1474,8 @@
             <inherit from="Areas" />
         </inherits>
         <fields>
-            <field name="fillcolor" type="Color" display="Fuellfarbe"
+            <field name="backgroundcolor" type="Color" display="Fuellfarbe"
                 default="255, 0, 255" />
-            <field name="transparent" type="boolean" display="Transparenz"
-                default="true" />
         </fields>
     </theme>
     <theme name="FixingSectorDeviationLS3">
@@ -1489,10 +1483,8 @@
             <inherit from="Areas" />
         </inherits>
         <fields>
-            <field name="fillcolor" type="Color" display="Fuellfarbe"
+            <field name="backgroundcolor" type="Color" display="Fuellfarbe"
                 default="255, 0, 0" />
-            <field name="transparent" type="boolean" display="Transparenz"
-                default="true" />
         </fields>
     </theme>
     <theme name="FixLSDeviation">
@@ -1500,10 +1492,8 @@
             <inherit from="Areas" />
         </inherits>
         <fields>
-            <field name="fillcolor" type="Color" display="Fuellfarbe"
+            <field name="backgroundcolor" type="Color" display="Fuellfarbe"
                 default="100, 100, 100" />
-            <field name="transparent" type="boolean" display="Transparenz"
-                default="true" />
         </fields>
     </theme>
     <theme name="FixLSAnalysis">
--- a/flys-artifacts/doc/conf/second-themes.xml	Thu Sep 20 09:35:31 2012 +0000
+++ b/flys-artifacts/doc/conf/second-themes.xml	Thu Sep 20 20:35:44 2012 +0000
@@ -1467,10 +1467,8 @@
             <inherit from="Areas" />
         </inherits>
         <fields>
-            <field name="fillcolor" type="Color" display="Fuellfarbe"
+            <field name="backgroundcolor" type="Color" display="Fuellfarbe"
                 default="0, 128, 64" />
-            <field name="transparent" type="boolean" display="Transparenz"
-                default="true" />
         </fields>
     </theme>
     <theme name="FixingSectorDeviationLS1">
@@ -1478,10 +1476,8 @@
             <inherit from="Areas" />
         </inherits>
         <fields>
-            <field name="fillcolor" type="Color" display="Fuellfarbe"
+            <field name="backgroundcolor" type="Color" display="Fuellfarbe"
                 default="64, 0, 255" />
-            <field name="transparent" type="boolean" display="Transparenz"
-                default="true" />
         </fields>
     </theme>
     <theme name="FixingSectorDeviationLS2">
@@ -1489,10 +1485,8 @@
             <inherit from="Areas" />
         </inherits>
         <fields>
-            <field name="fillcolor" type="Color" display="Fuellfarbe"
+            <field name="backgroundcolor" type="Color" display="Fuellfarbe"
                 default="255, 64, 255" />
-            <field name="transparent" type="boolean" display="Transparenz"
-                default="true" />
         </fields>
     </theme>
     <theme name="FixingSectorDeviationLS3">
@@ -1500,10 +1494,8 @@
             <inherit from="Areas" />
         </inherits>
         <fields>
-            <field name="fillcolor" type="Color" display="Fuellfarbe"
+            <field name="backgroundcolor" type="Color" display="Fuellfarbe"
                 default="255, 64, 0" />
-            <field name="transparent" type="boolean" display="Transparenz"
-                default="true" />
         </fields>
     </theme>
     <theme name="FixLSDeviation">
--- a/flys-artifacts/src/main/java/de/intevation/flys/jfree/StyledAreaSeriesCollection.java	Thu Sep 20 09:35:31 2012 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/jfree/StyledAreaSeriesCollection.java	Thu Sep 20 20:35:44 2012 +0000
@@ -4,7 +4,6 @@
 import java.awt.Color;
 import java.awt.Stroke;
 
-import org.apache.log4j.Logger;
 import org.jfree.data.xy.XYSeriesCollection;
 import org.w3c.dom.Document;
 
@@ -20,6 +19,8 @@
  * dataset.
  */
 public class StyledAreaSeriesCollection extends XYSeriesCollection {
+    private static final long serialVersionUID = 5274940965666948237L;
+
     /** Mode, how to draw/which areas to fill. */
     public enum FILL_MODE {UNDER, ABOVE, BETWEEN};
 
@@ -29,10 +30,6 @@
     /** The theme-document with attributes about actual visual representation. */
     protected Document theme;
 
-    /** Own logger. */
-    private static final Logger logger =
-        Logger.getLogger(StyledAreaSeriesCollection.class);
-
 
     /**
      * @param theme the theme-document.
@@ -85,17 +82,19 @@
     }
 
 
-    /**
-     * Blindly (for now) apply the positivepaint of renderer.
-     */
     protected void applyFillColor(StableXYDifferenceRenderer renderer) {
-        // 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);
+        Color paint = ThemeUtil.parseColor(
+                ThemeUtil.getBackgroundColorString(theme));
+
+        int transparency = ThemeUtil.parseTransparency(theme);
+        if (transparency > 0) {
+            paint = new Color(
+                        paint.getRed(),
+                        paint.getGreen(),
+                        paint.getBlue(),
+                        (int)((100 - transparency) * 2.55f));
         }
+
         if (paint != null && this.getMode() == FILL_MODE.ABOVE) {
             renderer.setPositivePaint(paint);
             renderer.setNegativePaint(new Color(0,0,0,0));
@@ -105,15 +104,14 @@
             renderer.setPositivePaint(new Color(0,0,0,0));
         }
         else {
-            if (paint == null) paint = new Color(177, 117, 102);
+            if (paint == null)
+                paint = new Color(177, 117, 102);
             renderer.setPositivePaint(paint);
             renderer.setNegativePaint(paint);
         }
     }
 
-    /**
-     * Blindly (for now) apply the postiviepaint of renderer.
-     */
+
     protected void applyShowShape(StableXYDifferenceRenderer renderer) {
         boolean show = ThemeUtil.parseShowBorder(theme);
         renderer.setDrawOutline(show);
--- a/flys-artifacts/src/main/java/de/intevation/flys/jfree/StyledDomainMarker.java	Thu Sep 20 09:35:31 2012 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/jfree/StyledDomainMarker.java	Thu Sep 20 20:35:44 2012 +0000
@@ -9,6 +9,7 @@
 
 /**
  * Marker that represents a highlighted interval.
+ *
  * @author <a href="mailto:christian.lins@intevation.de">Christian Lins</a>
  */
 public class StyledDomainMarker extends IntervalMarker {
@@ -26,7 +27,8 @@
                 ThemeUtil.getFillColorString(theme));
         useSecondColor(false);
 
-        int alpha = 100 - ThemeUtil.parseInteger(ThemeUtil.getTransparency(theme), 50);
+        int alpha = 100 - ThemeUtil.parseInteger(
+                ThemeUtil.getTransparencyString(theme), 50);
         setAlpha(alpha / 100.0f);
     }
 
--- a/flys-artifacts/src/main/java/de/intevation/flys/utils/ThemeUtil.java	Thu Sep 20 09:35:31 2012 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/utils/ThemeUtil.java	Thu Sep 20 20:35:44 2012 +0000
@@ -72,9 +72,6 @@
     public final static String XPATH_SHOW_LEVEL =
             "/theme/field[@name='showlevel']/@default";
 
-    public final static String XPATH_TRANSPARENT =
-            "/theme/field[@name='transparent']/@default";
-
     public final static String XPATH_TRANSPARENCY =
             "/theme/field[@name='transparency']/@default";
 
@@ -556,11 +553,6 @@
     }
 
 
-    public static String getTransparency(Document theme) {
-        return XMLUtils.xpathString(theme, XPATH_TRANSPARENCY, null);
-    }
-
-
     public static String getShowMinimum(Document theme) {
         return XMLUtils.xpathString(theme, XPATH_SHOW_MINIMUM, null);
     }
@@ -586,8 +578,8 @@
     }
 
 
-    public static boolean parseTransparency(Document theme) {
-        return parseBoolean(getTransparencyString(theme), false);
+    public static int parseTransparency(Document theme) {
+        return parseInteger(getTransparencyString(theme), 50);
     }
 
 

http://dive4elements.wald.intevation.org