[PATCH] More on flys/issue1585: Do not fill circle for interpolated W/Q points

Wald Commits scm-commit at wald.intevation.org
Fri Nov 8 16:15:41 CET 2013


# HG changeset patch
# User Sascha L. Teichmann <teichmann at intevation.de>
# Date 1383923738 -3600
# Node ID 4dbbdf0c8b2c6196adb3d2e7f1ebd54c899eb21b
# Parent  34faa9c55b4b326f5b59bd42e539cc863b636b1e
More on flys/issue1585: Do not fill circle for interpolated W/Q points.

diff -r 34faa9c55b4b -r 4dbbdf0c8b2c artifacts/src/main/java/org/dive4elements/river/exports/fixings/FixWQCurveGenerator.java
--- 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,
diff -r 34faa9c55b4b -r 4dbbdf0c8b2c artifacts/src/main/java/org/dive4elements/river/jfree/XYStyle.java
--- 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?");
-        }
     }
 
 
diff -r 34faa9c55b4b -r 4dbbdf0c8b2c artifacts/src/main/java/org/dive4elements/river/themes/ThemeDocument.java
--- 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) {


More information about the Dive4elements-commits mailing list