[Schmitzm-commits] r663 - branches/2.0-RC2/src/schmitzm/jfree/feature/style

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Wed Feb 3 18:34:44 CET 2010


Author: mojays
Date: 2010-02-03 18:34:30 +0100 (Wed, 03 Feb 2010)
New Revision: 663

Modified:
   branches/2.0-RC2/src/schmitzm/jfree/feature/style/FeatureBasicChartStyle.java
   branches/2.0-RC2/src/schmitzm/jfree/feature/style/FeatureChartStyle.java
   branches/2.0-RC2/src/schmitzm/jfree/feature/style/FeatureScatterChartStyle.java
Log:
New methods to maintain no data values in FeatureChartStyle.

Modified: branches/2.0-RC2/src/schmitzm/jfree/feature/style/FeatureBasicChartStyle.java
===================================================================
--- branches/2.0-RC2/src/schmitzm/jfree/feature/style/FeatureBasicChartStyle.java	2010-02-03 16:55:14 UTC (rev 662)
+++ branches/2.0-RC2/src/schmitzm/jfree/feature/style/FeatureBasicChartStyle.java	2010-02-03 17:34:30 UTC (rev 663)
@@ -29,6 +29,8 @@
  ******************************************************************************/
 package schmitzm.jfree.feature.style;
 
+import java.util.Set;
+
 import org.geotools.feature.FeatureCollection;
 import org.jfree.chart.JFreeChart;
 import org.jfree.data.category.CategoryDataset;
@@ -203,6 +205,43 @@
 	}
 
     /**
+     * Sets the values, which are interpreted as "No Data". 
+     * @param idx attribute index the "No Data" values are set for
+     * @param noDataValues the "No Data" values
+     */
+    public void setNoDataValues(int idx, Set<Object> noDataValues) {
+      dummyFeatureChartStyle.setNoDataValues(idx, noDataValues);
+    }
+    
+    /**
+     * Returns the values, which are interpreted as "No Data". 
+     * @param idx attribute index the "No Data" values are returned for
+     */
+    public Set<Object> getNoDataValues(int idx) {
+      return dummyFeatureChartStyle.getNoDataValues(idx);
+    }
+    
+    /**
+     * Sets a value, which is interpreted as "No Data". 
+     * @param idx attribute index the "No Data" value is set for
+     * @param noDataValue the "No Data" value
+     */
+    public void addNoDataValue(int idx, Object noDataValue) {
+      dummyFeatureChartStyle.addNoDataValue(idx, noDataValue);
+    }
+
+    /**
+     * Removes a "No Data" value for an attribute. 
+     * @param idx attribute index the "No Data" value is removed for
+     * @param noDataValue the "No Data" value to remove
+     * @return {@code false} if the value was not an "No Data" value 
+     */
+    public boolean removeNoDataValue(int idx, Object noDataValue) {
+      return dummyFeatureChartStyle.removeNoDataValue(idx, noDataValue);
+    }
+
+    
+    /**
      * Creates an appropriate {@link Dataset} for the attributes defined
      * by this style (according to the attributes types in the given
      * {@link FeatureCollection}) and calls {@link #applyToDataset(Dataset)}.

Modified: branches/2.0-RC2/src/schmitzm/jfree/feature/style/FeatureChartStyle.java
===================================================================
--- branches/2.0-RC2/src/schmitzm/jfree/feature/style/FeatureChartStyle.java	2010-02-03 16:55:14 UTC (rev 662)
+++ branches/2.0-RC2/src/schmitzm/jfree/feature/style/FeatureChartStyle.java	2010-02-03 17:34:30 UTC (rev 663)
@@ -30,7 +30,9 @@
 package schmitzm.jfree.feature.style;
 
 import java.util.HashMap;
+import java.util.HashSet;
 import java.util.Map;
+import java.util.Set;
 
 import org.geotools.feature.FeatureCollection;
 import org.jfree.chart.JFreeChart;
@@ -137,7 +139,35 @@
    * @return {@code false} as default
    */  
   public boolean isAttributeNormalized(int idx);
+  
+  /**
+   * Sets the values, which are interpreted as "No Data". 
+   * @param idx attribute index the "No Data" values are set for
+   * @param noDataValues the "No Data" values
+   */
+  public void setNoDataValues(int idx, Set<Object> noDataValues);
+  
+  /**
+   * Returns the values, which are interpreted as "No Data". 
+   * @param idx attribute index the "No Data" values are returned for
+   */
+  public Set<Object> getNoDataValues(int idx);
+  
+  /**
+   * Sets a value, which is interpreted as "No Data". 
+   * @param idx attribute index the "No Data" value is set for
+   * @param noDataValue the "No Data" value
+   */
+  public void addNoDataValue(int idx, Object noDataValue);
 
+  /**
+   * Removes a "No Data" value for an attribute. 
+   * @param idx attribute index the "No Data" value is removed for
+   * @param noDataValue the "No Data" value to remove
+   * @return {@code false} if the value was not an "No Data" value 
+   */
+  public boolean removeNoDataValue(int idx, Object noDataValue);
+  
 
   /**
    * This class defines a dummy implementation of {@link FeatureChartStyle} just
@@ -178,6 +208,9 @@
 
     /** Holds the number of attributes the style is defined for. */
     protected int maxAttrIdx = 0;
+    
+    /** Holds the "No Data" values for each attribute. */
+    protected Map<Integer,Set<Object>> noDataValues = new HashMap<Integer, Set<Object>>();
 
     /**
      * Creates a new dummy. This constructor is protected so that only derived
@@ -390,7 +423,50 @@
     public JFreeChart applyToFeatureCollection(FeatureCollection<SimpleFeatureType, SimpleFeature> fc) {
       throw new UnsupportedOperationException("FeatureChartStyle.Dummy does not implement applyToFeatureCollection(..)");
     }
+
+    /**
+     * Sets the values, which are interpreted as "No Data". 
+     * @param idx attribute index the "No Data" values are set for
+     * @param noDataValues the "No Data" values
+     */
+    public void setNoDataValues(int idx, Set<Object> noDataValues) {
+      this.noDataValues.put(idx, noDataValues);
+    }
     
+    /**
+     * Returns the values, which are interpreted as "No Data". 
+     * @param idx attribute index the "No Data" values are returned for
+     */
+    public Set<Object> getNoDataValues(int idx) {
+      return this.noDataValues.get(idx);
+    }
+    
+    /**
+     * Sets a value, which is interpreted as "No Data". 
+     * @param idx attribute index the "No Data" value is set for
+     * @param noDataValue the "No Data" value
+     */
+    public void addNoDataValue(int idx, Object noDataValue) {
+      Set<Object> noDataValues = getNoDataValues(idx);
+      if ( noDataValues == null ) {
+        noDataValues = new HashSet<Object>();
+        setNoDataValues(idx, noDataValues);
+      }
+      noDataValues.add(noDataValue);
+    }
+
+    /**
+     * Removes a "No Data" value for an attribute. 
+     * @param idx attribute index the "No Data" value is removed for
+     * @param noDataValue the "No Data" value to remove
+     * @return {@code false} if the value was not an "No Data" value 
+     */
+    public boolean removeNoDataValue(int idx, Object noDataValue) {
+      Set<Object> noDataValues = getNoDataValues(idx);
+      if ( noDataValues == null )
+        return false;
+      return noDataValues.remove(noDataValue);
+    }
   }
   
 }

Modified: branches/2.0-RC2/src/schmitzm/jfree/feature/style/FeatureScatterChartStyle.java
===================================================================
--- branches/2.0-RC2/src/schmitzm/jfree/feature/style/FeatureScatterChartStyle.java	2010-02-03 16:55:14 UTC (rev 662)
+++ branches/2.0-RC2/src/schmitzm/jfree/feature/style/FeatureScatterChartStyle.java	2010-02-03 17:34:30 UTC (rev 663)
@@ -29,6 +29,8 @@
  ******************************************************************************/
 package schmitzm.jfree.feature.style;
 
+import java.util.Set;
+
 import org.geotools.feature.FeatureCollection;
 import org.jfree.chart.JFreeChart;
 import org.jfree.data.category.CategoryDataset;
@@ -218,6 +220,42 @@
   }
 
   /**
+   * Sets the values, which are interpreted as "No Data". 
+   * @param idx attribute index the "No Data" values are set for
+   * @param noDataValues the "No Data" values
+   */
+  public void setNoDataValues(int idx, Set<Object> noDataValues) {
+    dummyFeatureChartStyle.setNoDataValues(idx, noDataValues);
+  }
+  
+  /**
+   * Returns the values, which are interpreted as "No Data". 
+   * @param idx attribute index the "No Data" values are returned for
+   */
+  public Set<Object> getNoDataValues(int idx) {
+    return dummyFeatureChartStyle.getNoDataValues(idx);
+  }
+  
+  /**
+   * Sets a value, which is interpreted as "No Data". 
+   * @param idx attribute index the "No Data" value is set for
+   * @param noDataValue the "No Data" value
+   */
+  public void addNoDataValue(int idx, Object noDataValue) {
+    dummyFeatureChartStyle.addNoDataValue(idx, noDataValue);
+  }
+
+  /**
+   * Removes a "No Data" value for an attribute. 
+   * @param idx attribute index the "No Data" value is removed for
+   * @param noDataValue the "No Data" value to remove
+   * @return {@code false} if the value was not an "No Data" value 
+   */
+  public boolean removeNoDataValue(int idx, Object noDataValue) {
+    return dummyFeatureChartStyle.removeNoDataValue(idx, noDataValue);
+  }
+
+  /**
    * Creates an appropriate {@link Dataset} for the attributes defined
    * by this style (according to the attributes types in the given
    * {@link FeatureCollection}) and calls {@link #applyToDataset(Dataset)}.



More information about the Schmitzm-commits mailing list