changeset 7545:4dbbdf0c8b2c

More on flys/issue1585: Do not fill circle for interpolated W/Q points.
author Sascha L. Teichmann <teichmann@intevation.de>
date Fri, 08 Nov 2013 16:15:38 +0100
parents 34faa9c55b4b
children b82750667e1a
files artifacts/src/main/java/org/dive4elements/river/exports/fixings/FixWQCurveGenerator.java artifacts/src/main/java/org/dive4elements/river/jfree/XYStyle.java artifacts/src/main/java/org/dive4elements/river/themes/ThemeDocument.java
diffstat 3 files changed, 37 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/artifacts/src/main/java/org/dive4elements/river/exports/fixings/FixWQCurveGenerator.java	Fri Nov 08 12:27:08 2013 +0100
+++ b/artifacts/src/main/java/org/dive4elements/river/exports/fixings/FixWQCurveGenerator.java	Fri Nov 08 16:15:38 2013 +0100
@@ -297,6 +297,12 @@
 
         double w = factor*(qwd.getW()-gaugeDatum);
 
+        // Force empty symbol.
+        if (qwd.getInterpolated()) {
+            doc = new ThemeDocument(doc); // prevent potential side effects.
+            doc.setValue(ThemeDocument.USE_FILL_PAINT, "true");
+        }
+
         XYSeries series = new StyledXYSeries(
             aaf.getFacetDescription(),
             doc,
@@ -337,6 +343,12 @@
             return;
         }
 
+        // Force empty symbol.
+        if (qwd.getInterpolated()) {
+            doc = new ThemeDocument(doc); // prevent potential side effects.
+            doc.setValue(ThemeDocument.USE_FILL_PAINT, "true");
+        }
+
         XYSeries series = new StyledXYSeries(
             aaf.getFacetDescription(),
             false, true, doc,
--- a/artifacts/src/main/java/org/dive4elements/river/jfree/XYStyle.java	Fri Nov 08 12:27:08 2013 +0100
+++ b/artifacts/src/main/java/org/dive4elements/river/jfree/XYStyle.java	Fri Nov 08 16:15:38 2013 +0100
@@ -58,6 +58,7 @@
             // Hurray we already applied nothing :)
             return r;
         }
+        applyUseFillPaint(r);
         applyLineColor(r, idx);
         applyLineSize(r, idx);
         applyLineType(r, idx);
@@ -86,17 +87,20 @@
         return r;
     }
 
+    protected void applyUseFillPaint(XYLineAndShapeRenderer r) {
+        Boolean use = theme.parseUseFillPaint();
+        if (use != null) {
+            r.setUseFillPaint(use);
+        }
+    }
+
 
     /** Set line color to renderer. */
     protected void applyLineColor(XYLineAndShapeRenderer r, int idx) {
         Color c = theme.parseLineColorField();
-        if(c != null) {
-            logger.debug("applyLineColor " + c.toString());
+        if (c != null) {
             r.setSeriesPaint(idx, c);
         }
-        else {
-            logger.warn("applyLineColor: color is null - malformed linecolor field?");
-        }
     }
 
 
--- a/artifacts/src/main/java/org/dive4elements/river/themes/ThemeDocument.java	Fri Nov 08 12:27:08 2013 +0100
+++ b/artifacts/src/main/java/org/dive4elements/river/themes/ThemeDocument.java	Fri Nov 08 16:15:38 2013 +0100
@@ -111,8 +111,7 @@
 
     public final static String SHOWEXTRAMARK = "showextramark";
 
-
-    private Document document;
+    public final static String USE_FILL_PAINT = "usefillpaint";
 
     private Map<String, String> values;
 
@@ -120,18 +119,22 @@
     }
 
     public ThemeDocument(Document document) {
-        this.document = document;
         values = extractValues(document);
     }
 
-    public Document getDocument() {
-        return document;
+    public ThemeDocument(ThemeDocument other) {
+        values = new HashMap<String, String>(other.values);
     }
 
-    private String getValue(String key) {
+
+    public String getValue(String key) {
         return values.get(key);
     }
 
+    public void setValue(String key, String value) {
+        values.put(key, value);
+    }
+
     private static Map<String, String> extractValues(Document document) {
         Map<String, String> values = new HashMap<String, String>();
         if (document == null) {
@@ -433,6 +436,13 @@
         return parseBoolean(show, false);
     }
 
+    public Boolean parseUseFillPaint() {
+        String use = getValue(USE_FILL_PAINT);
+        return use != null
+            ? parseBoolean(use, false)
+            : null;
+    }
+
     public int parseTextSize() {
         String size = getValue(LABEL_FONT_SIZE);
         if (size == null) {

http://dive4elements.wald.intevation.org