[Schmitzm-commits] r745 - trunk/src/schmitzm/jfree/feature/style

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Wed Mar 3 13:14:48 CET 2010


Author: mojays
Date: 2010-03-03 13:14:47 +0100 (Wed, 03 Mar 2010)
New Revision: 745

Modified:
   trunk/src/schmitzm/jfree/feature/style/FeatureBasicChartStyle.java
   trunk/src/schmitzm/jfree/feature/style/FeatureChartStyle.java
   trunk/src/schmitzm/jfree/feature/style/FeatureChartUtil.java
   trunk/src/schmitzm/jfree/feature/style/FeatureScatterChartStyle.java
Log:
Implementation of weight attribute methods in FeatureChartStyle

Modified: trunk/src/schmitzm/jfree/feature/style/FeatureBasicChartStyle.java
===================================================================
--- trunk/src/schmitzm/jfree/feature/style/FeatureBasicChartStyle.java	2010-03-03 11:45:15 UTC (rev 744)
+++ trunk/src/schmitzm/jfree/feature/style/FeatureBasicChartStyle.java	2010-03-03 12:14:47 UTC (rev 745)
@@ -29,6 +29,7 @@
  ******************************************************************************/
 package schmitzm.jfree.feature.style;
 
+import java.util.HashSet;
 import java.util.Set;
 
 import org.geotools.feature.FeatureCollection;
@@ -313,38 +314,116 @@
     }
 
     /**
-     * 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)}.
-     */
+     * Sets the feature attribute the i-th chart attribute is weighted with.<br>
+     * <b>Note:</b>
+     * <ul>
+     * <li>The weight attribute can not be set for the domain attribute 0.</li>
+     * <li>Do not forget to set the NULL values for the weight attributes, too!</li>
+     * </ul>
+     * @param idx the feature attribute
+     * @param weightAttrName name of the weight attribute
+     * @see #setWeightAttributeNoDataValues(idx, Set) to set NoDataValues for this
+     *      attribute.<br/>
+     * @exception IllegalArgumentException if weight attribute is set for
+     *              attribute 0
+     **/
     @Override
-    public JFreeChart applyToFeatureCollection(FeatureCollection<SimpleFeatureType, SimpleFeature> fc) {
-      Dataset    dataset = FeatureChartUtil.createDataset(fc,this);
-      return applyToDataset(dataset);
+    public void setAttributeAggregationWeightAttributeName(int idx,
+        String weightAttrName) {
+      dummyFeatureChartStyle.setAttributeAggregationWeightAttributeName(idx, weightAttrName);
     }
 
+    /**
+     * Returns the feature attribute the i-th chart attribute is weighted with.
+     * <b>Note:</b><br>
+     * This method returns {@code null} unless a
+     * {@linkplain AggregationFunction#isWeighted() weighted} aggregation
+     * function is set for the i-th attribute.
+     * @param idx the feature attribute
+     * @see #setAttributeAggregationWeightAttributeName(int, String)
+     **/
     @Override
     public String getAttributeAggregationWeightAttributeName(int idx) {
-      // TODO Auto-generated method stub
-      return null;
+      return dummyFeatureChartStyle.getAttributeAggregationWeightAttributeName(idx);
     }
 
+    /**
+     * Sets the values, which are interpreted as "No Data" for the optional weight
+     * attribute.
+     * @param idx weight attribute index the "No Data" values are set for
+     * @param noDataValues the "No Data" values
+     */
     @Override
-    public boolean isNoDataWeightValue(int idx, Object value) {
-      // TODO Auto-generated method stub
-      return false;
+    public void setWeightAttributeNoDataValues(int idx, Set<Object> noDataValues) {
+      dummyFeatureChartStyle.setWeightAttributeNoDataValues(idx, noDataValues);
     }
 
+    /**
+     * Returns the values, which are interpreted as "No Data" for the
+     * weight attribute.
+     * @param idx weight attribute index the "No Data" values are returned for
+     */
     @Override
-    public void setAttributeAggregationWeightAttributeName(int idx,
-        String weightAttribName) {
-      // TODO Auto-generated method stub
-      
+    public Set<Object> getWeightAttributeNoDataValues(int idx) {
+      return dummyFeatureChartStyle.getWeightAttributeNoDataValues(idx);
     }
 
+    /**
+     * Sets a value, which is interpreted as "No Data" for the weight
+     * attribute.
+     * @param idx attribute index the "No Data" value is set for
+     * @param noDataValue the "No Data" value
+     */
     @Override
-    public void setNoDataWeightValues(int idx, Set<Object> noDataValues) {
-      // TODO Auto-generated method stub
-      
+    public void addWeightAttributeNoDataValue(int idx, Object noDataValue) {
+      dummyFeatureChartStyle.addWeightAttributeNoDataValue(idx, noDataValue);
     }
+
+    /**
+     * Removes a "No Data" value for a weight 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
+     */
+    @Override
+    public boolean removeWeightAttributeNoDataValue(int idx, Object noDataValue) {
+      return dummyFeatureChartStyle.removeWeightAttributeNoDataValue(idx, noDataValue);
+    }
+
+    /**
+     * Checks whether the given value is one of the "No data" values for the
+     * weight attribute.
+     * @param idx weight attribute index the "No Data" value is checked for
+     * @param value an attribute value
+     * @return {@code false} is not weight attribute is set for attribute i
+     * @see #setAttributeAggregationWeightAttributeName(int, String)
+     */
+    @Override
+    public boolean isWeightAttributeNoDataValue(int idx, Object value) {
+      return dummyFeatureChartStyle.isWeightAttributeNoDataValue(idx, value);
+    }
+
+    /**
+     * Checks whether the given value is one of the "No data" values for the
+     * attribute. In this case this method returns {@code null}, otherwise the
+     * value itself.
+     * @param idx attribute index the "No Data" value is checked for
+     * @param value an attribute value
+     * @return {@code null} if the given value is one of the "No data" values
+     */
+    @Override
+    public <T> T filterWeightAttributeNoDataValue(int idx, T value) {
+      return dummyFeatureChartStyle.filterWeightAttributeNoDataValue(idx, value);
+    }
+
+    /**
+     * 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)}.
+     */
+    @Override
+    public JFreeChart applyToFeatureCollection(FeatureCollection<SimpleFeatureType, SimpleFeature> fc) {
+      Dataset    dataset = FeatureChartUtil.createDataset(fc,this);
+      return applyToDataset(dataset);
+    }
 }

Modified: trunk/src/schmitzm/jfree/feature/style/FeatureChartStyle.java
===================================================================
--- trunk/src/schmitzm/jfree/feature/style/FeatureChartStyle.java	2010-03-03 11:45:15 UTC (rev 744)
+++ trunk/src/schmitzm/jfree/feature/style/FeatureChartStyle.java	2010-03-03 12:14:47 UTC (rev 745)
@@ -50,745 +50,802 @@
 /**
  * This interface extends the chart style with several functionalities used to
  * define a chart on a {@link FeatureCollection}.
- * 
  * @author <a href="mailto:Martin.Schmitz at koeln.de">Martin Schmitz</a>
  * @version 1.0
  */
 public interface FeatureChartStyle extends ChartStyle {
 
-	/**
-	 * Returns the maximum number of feature attributes that can be specified by
-	 * this style.
-	 * 
-	 * @return -1 if there is no limit for range attributes
-	 */
-	public int getMaxAttributeCount();
+  /**
+   * Returns the maximum number of feature attributes that can be specified by
+   * this style.
+   * @return -1 if there is no limit for range attributes
+   */
+  public int getMaxAttributeCount();
 
-	/**
-	 * Returns the number of feature attributes defined in this style.
-	 */
-	public int getAttributeCount();
+  /**
+   * Returns the number of feature attributes defined in this style.
+   */
+  public int getAttributeCount();
 
-	/**
-	 * Removes all style informations about an attribute and reorganizes the
-	 * attribute indexes so there is an continuous order.
-	 * 
-	 * @param idx
-	 *            an attribute index
-	 */
-	public void removeAttribute(int idx);
+  /**
+   * Removes all style informations about an attribute and reorganizes the
+   * attribute indexes so there is an continuous order.
+   * @param idx an attribute index
+   */
+  public void removeAttribute(int idx);
 
-	/**
-	 * Returns the name of a feature attribute needed to create a chart for this
-	 * style.
-	 * 
-	 * @param idx
-	 *            attribute index (0=domain; 1=1st range series; 2=2nd range
-	 *            series; ...)
-	 */
-	public String getAttributeName(int idx);
+  /**
+   * Returns the name of a feature attribute needed to create a chart for this
+   * style.
+   * @param idx attribute index (0=domain; 1=1st range series; 2=2nd range
+   *          series; ...)
+   */
+  public String getAttributeName(int idx);
 
-	/**
-	 * Sets the name of a feature attribute needed to create a chart for this
-	 * style.<br/>
-	 * @see #setNoDataValues(idx, Set) to set NoDataValues for this attribute.<br/>
-	 * 
-	 * @param idx
-	 *            attribute index (0=domain; 1=1st range series; 2=2nd range
-	 *            series; ...)
-	 * @param attrName
-	 *            feature attribute name
-	 */
-	public void setAttributeName(int idx, String attrName);
+  /**
+   * Sets the name of a feature attribute needed to create a chart for this
+   * style.
+   * @see #setNoDataValues(idx, Set) to set NoDataValues for this attribute.
+   * @param idx attribute index (0=domain; 1=1st range series; 2=2nd range
+   *          series; ...)
+   * @param attrName feature attribute name
+   */
+  public void setAttributeName(int idx, String attrName);
 
-	/**
-	 * Creates a chart according to the given
-	 * 
-	 * @param fc
-	 *            a feature collection
-	 * @exception UnsupportedOperationException
-	 *                if the style can not be applied to the
-	 *                {@link FeatureCollection} (e.g. the
-	 *                {@link FeatureCollection} does not provide the required
-	 *                attributes)
-	 */
-	public JFreeChart applyToFeatureCollection(
-			FeatureCollection<SimpleFeatureType, SimpleFeature> fc);
+  /**
+   * Sets whether the features are sorted according to the domain attribute
+   * (before creating a {@link Dataset}).
+   */
+  public void setSortDomainAxis(boolean sort);
 
-	/**
-	 * Sets whether the features are sorted according to the domain attribute
-	 * (before creating a {@link Dataset}).
-	 */
-	public void setSortDomainAxis(boolean sort);
+  /**
+   * Returns whether the features are sorted according to the domain attribute
+   * (before creating a {@link Dataset}).
+   * @return {@code false} as default
+   */
+  public boolean isSortDomainAxis();
 
-	/**
-	 * Returns whether the features are sorted according to the domain attribute
-	 * (before creating a {@link Dataset}).
-	 * 
-	 * @return {@code false} as default
-	 */
-	public boolean isSortDomainAxis();
+  /**
+   * Sets whether a {@link CategoryDataset} is forced for a numeric domain
+   * attribute. The default is to create {@link XYDataset} for a numeric and
+   * {@link CategoryDataset} for a non-numeric domain attribute.
+   */
+  public void setForceCategories(boolean forceCategories);
 
-	/**
-	 * Sets whether a {@link CategoryDataset} is forced for a numeric domain
-	 * attribute. The default is to create {@link XYDataset} for a numeric and
-	 * {@link CategoryDataset} for a non-numeric domain attribute.
-	 */
-	public void setForceCategories(boolean forceCategories);
+  /**
+   * Returns whether a {@link CategoryDataset} is forced for a numeric domain
+   * attribute. The default is to create {@link XYDataset} for a numeric and
+   * {@link CategoryDataset} for a non-numeric domain attribute.
+   * @return {@code false} as default
+   */
+  public boolean isForceCategories();
 
-	/**
-	 * Returns whether a {@link CategoryDataset} is forced for a numeric domain
-	 * attribute. The default is to create {@link XYDataset} for a numeric and
-	 * {@link CategoryDataset} for a non-numeric domain attribute.
-	 * 
-	 * @return {@code false} as default
-	 */
-	public boolean isForceCategories();
+  /**
+   * Sets whether the attribute data is normalized for an attribute (before
+   * creating a {@link Dataset}).
+   * @param idx attribute index (0=domain; 1=1st range series; 2=2nd range
+   *          series; ...)
+   * @param normalize indicates the normalize property
+   */
+  public void setAttributeNormalized(int idx, Boolean normalize);
 
-	/**
-	 * Sets whether the attribute data is normalized for an attribute (before
-	 * creating a {@link Dataset}).
-	 * 
-	 * @param idx
-	 *            attribute index (0=domain; 1=1st range series; 2=2nd range
-	 *            series; ...)
-	 * @param normalize
-	 *            indicates the normalize property
-	 */
-	public void setAttributeNormalized(int idx, Boolean normalize);
+  /**
+   * Returns whether the attribute data is normalized for an attribute (before
+   * creating a {@link Dataset}).
+   * @param idx attribute index (0=domain; 1=1st range series; 2=2nd range
+   *          series; ...)
+   * @return {@code false} as default
+   */
+  public boolean isAttributeNormalized(int idx);
 
-	/**
-	 * Returns whether the attribute data is normalized for an attribute (before
-	 * creating a {@link Dataset}).
-	 * 
-	 * @param idx
-	 *            attribute index (0=domain; 1=1st range series; 2=2nd range
-	 *            series; ...)
-	 * @return {@code false} as default
-	 */
-	public boolean isAttributeNormalized(int idx);
+  /**
+   * Sets an arithmetical function which is calculated on the attribute values
+   * (when creating a {@link Dataset} from Features). The function is calculated
+   * on all values with the same domain value (X/category). If no function is
+   * set, duplicate domain values are ignored (only the "last" value is shown,
+   * because of replacement behavior).
+   * @param idx attribute index (1=1st range series; 2=2nd range series; ...)
+   * @param func defines the calculated function
+   * @exception IllegalArgumentException if function is set on domain attribute
+   *              (0)
+   */
+  public void setAttributeAggregation(int idx, AggregationFunction func);
 
-	/**
-	 * Sets an arithmetical function which is calculated on the attribute values
-	 * (when creating a {@link Dataset} from Features). The function is
-	 * calculated on all values with the same domain value (X/category). If no
-	 * function is set, duplicate domain values are ignored (only the "last"
-	 * value is shown, because of replacement behavior).
-	 * 
-	 * @param idx
-	 *            attribute index (1=1st range series; 2=2nd range series; ...)
-	 * @param func
-	 *            defines the calculated function
-	 * @exception IllegalArgumentException
-	 *                if function is set on domain attribute (0)
-	 */
-	public void setAttributeAggregation(int idx, AggregationFunction func);
+  /**
+   * Returns an arithmetical function which is calculated on the attribute
+   * values (when creating a {@link Dataset} from Features). The function is
+   * calculated on all values with the same domain value (X/category). If no
+   * function is set, duplicate domain values are ignored (only the "last" value
+   * is shown, because of replacement behavior).
+   * @param idx attribute index (1=1st range series; 2=2nd range series; ...)
+   * @return {@code null} for index 0 (domain axis)
+   */
+  public AggregationFunction getAttributeAggregation(int idx);
 
-	/**
-	 * Returns an arithmetical function which is calculated on the attribute
-	 * values (when creating a {@link Dataset} from Features). The function is
-	 * calculated on all values with the same domain value (X/category). If no
-	 * function is set, duplicate domain values are ignored (only the "last"
-	 * value is shown, because of replacement behavior).
-	 * 
-	 * @param idx
-	 *            attribute index (1=1st range series; 2=2nd range series; ...)
-	 * @return {@code null} for index 0 (domain axis)
-	 */
-	public AggregationFunction getAttributeAggregation(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);
 
-	/**
-	 * 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);
 
-	/**
-	 * 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);
 
-	/**
-	 * 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);
 
-	/**
-	 * 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);
+  /**
+   * Checks whether the given value is one of the "No data" values for the
+   * attribute.
+   * @param idx attribute index the "No Data" value is checked for
+   * @param value an attribute value
+   */
+  public boolean isNoDataValue(int idx, Object value);
 
-	/**
-	 * Checks whether the given value is one of the "No data" values for the
-	 * attribute.
-	 * 
-	 * @param idx
-	 *            attribute index the "No Data" value is checked for
-	 * @param value
-	 *            an attribute value
-	 */
-	public boolean isNoDataValue(int idx, Object value);
+  /**
+   * Checks whether the given value is one of the "No data" values for the
+   * attribute. In this case this method returns {@code null}, otherwise the
+   * value itself.
+   * @param idx attribute index the "No Data" value is checked for
+   * @param value an attribute value
+   * @return {@code null} if the given value is one of the "No data" values
+   */
+  public <T> T filterNoDataValue(int idx, T value);
 
-	/**
-	 * Checks whether the given value is one of the "No data" values for the
-	 * attribute. In this case this method returns {@code null}, otherwise the
-	 * value itself.
-	 * 
-	 * @param idx
-	 *            attribute index the "No Data" value is checked for
-	 * @param value
-	 *            an attribute value
-	 * @return {@code null} if the given value is one of the "No data" values
-	 */
-	public <T> T filterNoDataValue(int idx, T value);
+  /**
+   * Sets the feature attribute the i-th chart attribute is weighted with.<br>
+   * <b>Note:</b>
+   * <ul>
+   * <li>The weight attribute can not be set for the domain attribute 0.</li>
+   * <li>Do not forget to set the NULL values for the weight attributes, too!</li>
+   * </ul>
+   * @param idx the feature attribute
+   * @param weightAttribName name of the weight attribute
+   * @see #setWeightAttributeNoDataValues(idx, Set) to set NoDataValues for this
+   *      attribute.<br/>
+   * @exception IllegalArgumentException if weight attribute is set for
+   *              attribute 0
+   **/
+  public void setAttributeAggregationWeightAttributeName(int idx,
+      String weightAttribName);
 
-	/**
-	 * This class defines a dummy implementation of {@link FeatureChartStyle}
-	 * just to maintain the properties of the interface
-	 * {@link FeatureChartStyle}, so sub classes of {@link FeatureChartStyle}
-	 * which usually are derived from a normal {@link ChartStyle} implementation
-	 * must not implement the {@link FeatureChartStyle} maintenance each.
-	 * Instead they can create an instance of this dummy an pipe their method
-	 * implementations to the dummy!<br>
-	 * <br>
-	 * The {@link #applyToFeatureCollection(FeatureCollection)} and
-	 * {@link #applyToDataset(Dataset)} methods are not implemented by the
-	 * dummy, but throw an exception instead!!
-	 * 
-	 * @author <a href="mailto:martin.schmitz at koeln.de">Martin Schmitz</a>
-	 */
-	public static class Dummy extends AbstractChartStyle implements
-			FeatureChartStyle {
-		/**
-		 * Indicates whether the features are sorted according to the domain
-		 * attribute (before creating a {@link Dataset}).
-		 */
-		protected boolean sortDomainAxis;
-		/**
-		 * Indicates whether a {@link CategoryDataset} is forced for a numeric
-		 * domain attribute. The default is to create {@link XYDataset} for a
-		 * numeric and {@link CategoryDataset} for a non-numeric domain
-		 * attribute.
-		 */
-		protected boolean forceCategories;
+  /**
+   * Returns the feature attribute the i-th chart attribute is weighted with.
+   * <b>Note:</b><br>
+   * This method returns {@code null} unless a
+   * {@linkplain AggregationFunction#isWeighted() weighted} aggregation function
+   * is set for the i-th attribute.
+   * @param idx the feature attribute
+   * @see #setAttributeAggregationWeightAttributeName(int, String)
+   **/
+  public String getAttributeAggregationWeightAttributeName(int idx);
 
-		/**
-		 * Holds the attributes needed to specify the chart data from feature
-		 * collection (0 = attribute for domain axis; others assigned to the
-		 * range axis as series).
-		 */
-		protected Map<Integer, String> attrNames = new HashMap<Integer, String>();
+  /**
+   * Sets the values, which are interpreted as "No Data" for the optional weight
+   * attribute.
+   * @param idx weight attribute index the "No Data" values are set for
+   * @param noDataValues the "No Data" values
+   */
+  public void setWeightAttributeNoDataValues(int idx, Set<Object> noDataValues);
 
-		/**
-		 * Indicates for each attribute whether the attribute data is normalized
-		 * (before creating a {@link Dataset}).
-		 */
-		protected Map<Integer, Boolean> normalizeAttr = new HashMap<Integer, Boolean>();
+  /**
+   * Returns the values, which are interpreted as "No Data" for the
+   * weight attribute.
+   * @param idx weight attribute index the "No Data" values are returned for
+   */
+  public Set<Object> getWeightAttributeNoDataValues(int idx);
 
-		/**
-		 * Holds the maximum number of attributes the style can be defined
-		 * defined for (-1 = no limit).
-		 */
-		protected int maxAttrCount = -1;
+  /**
+   * Sets a value, which is interpreted as "No Data" for the weight
+   * attribute.
+   * @param idx attribute index the "No Data" value is set for
+   * @param noDataValue the "No Data" value
+   */
+  public void addWeightAttributeNoDataValue(int idx, Object noDataValue);
 
-		/** Holds the number of attributes the style is defined for. */
-		protected int maxAttrIdx = 0;
+  /**
+   * Removes a "No Data" value for a weight 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 removeWeightAttributeNoDataValue(int idx, Object noDataValue);
 
-		/** Holds the "No Data" values for each attribute. */
-		protected Map<Integer, Set<Object>> noDataValues = new HashMap<Integer, Set<Object>>();
+  /**
+   * Checks whether the given value is one of the "No data" values for the
+   * weight attribute.
+   * @param idx weight attribute index the "No Data" value is checked for
+   * @param value an attribute value
+   * @return {@code false} is not weight attribute is set for attribute i
+   * @see #setAttributeAggregationWeightAttributeName(int, String)
+   */
+  public boolean isWeightAttributeNoDataValue(int idx, Object value);
 
-		/** Holds the aggregation function for each attribute. */
-		protected Map<Integer, AggregationFunction> aggrFuncs = new HashMap<Integer, AggregationFunction>();
 
-		/**
-		 * Creates a new dummy. This constructor is protected so that only
-		 * derived classes can instantiate a dummy! There is no limit for the
-		 * number of attributes which can be defined by the style.
-		 * 
-		 * @param id
-		 *            a (unique) ID for the style
-		 */
-		protected Dummy(String id) {
-			this(id, -1);
-		}
+  /**
+   * Checks whether the given value is one of the "No data" values for the
+   * attribute. In this case this method returns {@code null}, otherwise the
+   * value itself.
+   * @param idx attribute index the "No Data" value is checked for
+   * @param value an attribute value
+   * @return {@code null} if the given value is one of the "No data" values
+   */
+  public <T> T filterWeightAttributeNoDataValue(int idx, T value);
 
-		/**
-		 * Creates a new dummy. This constructor is protected so that only
-		 * derived classes can instantiate a dummy!
-		 * 
-		 * @param id
-		 *            a (unique) ID for the style
-		 * @param maxAttrCount
-		 *            attribute count needed to specify the chart data from
-		 *            feature collection
-		 */
-		protected Dummy(String id, int maxAttrCount) {
-			super(id);
-			this.maxAttrCount = maxAttrCount;
-		}
+  /**
+   * Creates a chart according to the given
+   * @param fc a feature collection
+   * @exception UnsupportedOperationException if the style can not be applied to
+   *              the {@link FeatureCollection} (e.g. the
+   *              {@link FeatureCollection} does not provide the required
+   *              attributes)
+   */
+  public JFreeChart applyToFeatureCollection(
+      FeatureCollection<SimpleFeatureType, SimpleFeature> fc);
 
-		/**
-		 * Updates the local variable for the number of attributes the maximum
-		 * index (key) of the several hash maps.
-		 */
-		private void updateAttributeCount() {
-			// attribute names define the number of attributes, also
-			// if there are "more" normalize constraints specified
-			maxAttrIdx = LangUtil.max(attrNames.keySet(), normalizeAttr
-					.keySet(), noDataValues.keySet());
+  /**
+   * This class defines a dummy implementation of {@link FeatureChartStyle} just
+   * to maintain the properties of the interface {@link FeatureChartStyle}, so
+   * sub classes of {@link FeatureChartStyle} which usually are derived from a
+   * normal {@link ChartStyle} implementation must not implement the
+   * {@link FeatureChartStyle} maintenance each. Instead they can create an
+   * instance of this dummy an pipe their method implementations to the dummy!<br>
+   * <br>
+   * The {@link #applyToFeatureCollection(FeatureCollection)} and
+   * {@link #applyToDataset(Dataset)} methods are not implemented by the dummy,
+   * but throw an exception instead!!
+   * @author <a href="mailto:martin.schmitz at koeln.de">Martin Schmitz</a>
+   */
+  public static class Dummy extends AbstractChartStyle implements
+      FeatureChartStyle {
+    /**
+     * Indicates whether the features are sorted according to the domain
+     * attribute (before creating a {@link Dataset}).
+     */
+    protected boolean sortDomainAxis;
+    /**
+     * Indicates whether a {@link CategoryDataset} is forced for a numeric
+     * domain attribute. The default is to create {@link XYDataset} for a
+     * numeric and {@link CategoryDataset} for a non-numeric domain attribute.
+     */
+    protected boolean forceCategories;
 
-			if (maxAttrCount > 0 && maxAttrIdx >= maxAttrCount)
-				throw new IllegalArgumentException("Only " + maxAttrCount
-						+ " attributes can be specified for "
-						+ LangUtil.getSimpleClassName(this));
-		}
+    /**
+     * Holds the attributes needed to specify the chart data from feature
+     * collection (0 = attribute for domain axis; others assigned to the range
+     * axis as series).
+     */
+    protected Map<Integer, String> attrNames = new HashMap<Integer, String>();
 
-		/**
-		 * Removes all style informations about an attribute and reorganizes the
-		 * attribute indexes so there is an continuous order.
-		 * 
-		 * @param idx
-		 *            an attribute
-		 */
-		@Override
-		public void removeAttribute(int idx) {
-			// clear sets and maps of the removed attribute
-			Set<Object> noDataValues = getNoDataValues(idx);
-			if (noDataValues != null)
-				noDataValues.clear();
+    /**
+     * Indicates for each attribute whether the attribute data is normalized
+     * (before creating a {@link Dataset}).
+     */
+    protected Map<Integer, Boolean> normalizeAttr = new HashMap<Integer, Boolean>();
 
-			// remove the attribute by move the "greater" attributes
-			// one position "forward"
-			int maxIdx = getAttributeCount() - 1;
-			for (int i = idx; i < maxIdx; i++) {
-				this.attrNames.put(i, this.attrNames.get(i + 1));
-				this.normalizeAttr.put(i, this.normalizeAttr.get(i + 1));
-				this.noDataValues.put(i, this.noDataValues.get(i + 1));
-			}
+    /**
+     * Holds the maximum number of attributes the style can be defined defined
+     * for (-1 = no limit).
+     */
+    protected int maxAttrCount = -1;
 
-			// delete the last attribute, because now is is stored
-			// one position forward
-			this.attrNames.remove(maxIdx);
-			this.normalizeAttr.remove(maxIdx);
-			this.noDataValues.remove(maxIdx);
+    /** Holds the number of attributes the style is defined for. */
+    protected int maxAttrIdx = 0;
 
-			updateAttributeCount();
-		}
+    /** Holds the "No Data" values for each attribute. */
+    protected Map<Integer, Set<Object>> noDataValues = new HashMap<Integer, Set<Object>>();
 
-		/**
-		 * Creates a (deep) clone of this style. The properties of the super
-		 * class ({@link AbstractChartStyle}) are <b>ignored</b> because they
-		 * are unused for the dummy.
-		 */
-		@Override
-		public AbstractChartStyle copy() {
-			return (AbstractChartStyle) copyTo((FeatureChartStyle) new Dummy(""));
-		}
+    /** Holds the aggregation function for each attribute. */
+    protected Map<Integer, AggregationFunction> aggrFuncs = new HashMap<Integer, AggregationFunction>();
 
-		/**
-		 * Copies all properties of this style to another one. The properties of
-		 * the super class ({@link AbstractChartStyle}) are <b>ignored</b>
-		 * because they are unused for the dummy.
-		 * 
-		 * @param dest
-		 *            destination object (if {@code null} the copy is created by
-		 *            {@link #copy()})
-		 * @return {@code dest} or the new instance
-		 */
-		@Override
-		public ChartStyle copyTo(ChartStyle dest) {
-			// !! do NOT copy the super class properties !!
-			// !! copy only this classes properties !!
-			// !! Reason: the dummy does not maintain the !!
-			// !! super class properties and we !!
-			// !! do not want to overwrite them !!
-			if (dest instanceof FeatureChartStyle) {
-				FeatureChartStyle destFCS = (FeatureChartStyle) dest;
-				destFCS.setSortDomainAxis(isSortDomainAxis());
-				destFCS.setForceCategories(isForceCategories());
+    /**
+     * Holds the weight attributes needed to weight the attribute values of
+     * {@link #attrNames} if a {@linkplain AggregationFunction#isWeighted()
+     * weighted} aggregation function is set.
+     */
+    protected Map<Integer, String> weightAttrNames = new HashMap<Integer, String>();
 
-				// Clear the attribute names and attribute normalization
-				int max = destFCS.getMaxAttributeCount();
-				for (int i = 0; i < max; i++) {
-					destFCS.setAttributeName(i, null);
-					destFCS.setAttributeNormalized(i, null);
-					// Added by SK. In this special case we don't
-					destFCS.setNoDataValues(i, getNoDataValues(i));
-					
-				}
-				// Copy attribute names and normalization
-				for (Integer idx : attrNames.keySet())
-					if (getAttributeName(idx) != null)
-						destFCS.setAttributeName(idx, getAttributeName(idx));
-				for (Integer idx : normalizeAttr.keySet())
-					if (isAttributeNormalized(idx))
-						destFCS.setAttributeNormalized(idx,
-								isAttributeNormalized(idx));
-				for (Integer idx : aggrFuncs.keySet())
-				    destFCS.setAttributeAggregation(idx, getAttributeAggregation(idx));
+    /** Holds the "No Data" values for each weight attribute. */
+    protected Map<Integer, Set<Object>> weightAttrNoDataValues = new HashMap<Integer, Set<Object>>();
 
-			}
+    /**
+     * Creates a new dummy. This constructor is protected so that only derived
+     * classes can instantiate a dummy! There is no limit for the number of
+     * attributes which can be defined by the style.
+     * @param id a (unique) ID for the style
+     */
+    protected Dummy(String id) {
+      this(id, -1);
+    }
 
-			return dest;
-		}
+    /**
+     * Creates a new dummy. This constructor is protected so that only derived
+     * classes can instantiate a dummy!
+     * @param id a (unique) ID for the style
+     * @param maxAttrCount attribute count needed to specify the chart data from
+     *          feature collection
+     */
+    protected Dummy(String id, int maxAttrCount) {
+      super(id);
+      this.maxAttrCount = maxAttrCount;
+    }
 
-		/**
-		 * Returns the maximum number of feature attributes that can be
-		 * specified by this style.
-		 * 
-		 * @return -1 if there is no limit for range attributes
-		 */
-		@Override
-		public int getMaxAttributeCount() {
-			return maxAttrCount;
-		}
+    /**
+     * Updates the local variable for the number of attributes the maximum index
+     * (key) of the several hash maps.
+     */
+    private void updateAttributeCount() {
+      // attribute names define the number of attributes, also
+      // if there are "more" normalize constraints specified
+      maxAttrIdx = LangUtil.max(attrNames.keySet(), normalizeAttr.keySet(),
+                                noDataValues.keySet());
 
-		/**
-		 * Returns the number of feature attributes defined in this style.
-		 */
-		@Override
-		public int getAttributeCount() {
-			return maxAttrIdx + 1;
-		}
+      if (maxAttrCount > 0 && maxAttrIdx >= maxAttrCount)
+        throw new IllegalArgumentException("Only " + maxAttrCount +
+                                           " attributes can be specified for " +
+                                           LangUtil.getSimpleClassName(this));
+    }
 
-		/**
-		 * Returns the name of a feature attribute needed to create a chart for
-		 * this style.
-		 * 
-		 * @param idx
-		 *            attribute index (0=domain; 1=1st range series; 2=2nd range
-		 *            series; ...)
-		 */
-		@Override
-		public String getAttributeName(int idx) {
-			return attrNames.get(idx);
-		}
+    /**
+     * Removes all style informations about an attribute and reorganizes the
+     * attribute indexes so there is an continuous order.
+     * @param idx an attribute
+     */
+    @Override
+    public void removeAttribute(int idx) {
+      // clear sets and maps of the removed attribute
+      Set<Object> noDataValues = getNoDataValues(idx);
+      if (noDataValues != null)
+        noDataValues.clear();
 
-		/**
-		 * Sets the name of a feature attribute needed to create a chart for
-		 * this style.
-		 * 
-		 * @param idx
-		 *            attribute index (0=domain; 1=1st range series; 2=2nd range
-		 *            series; ...)
-		 * @param attrName
-		 *            feature attribute name
-		 */
-		@Override
-		public void setAttributeName(int idx, String attrName) {
-			attrNames.put(idx, attrName);
-			updateAttributeCount();
-		}
+      // remove the attribute by move the "greater" attributes
+      // one position "forward"
+      int maxIdx = getAttributeCount() - 1;
+      for (int i = idx; i < maxIdx; i++) {
+        this.attrNames.put(i, this.attrNames.get(i + 1));
+        this.normalizeAttr.put(i, this.normalizeAttr.get(i + 1));
+        this.noDataValues.put(i, this.noDataValues.get(i + 1));
+      }
 
-		/**
-		 * Sets whether the features are sorted according to the domain
-		 * attribute (before creating a {@link Dataset}).
-		 */
-		@Override
-		public void setSortDomainAxis(boolean sortDomainAxis) {
-			this.sortDomainAxis = sortDomainAxis;
-		}
+      // delete the last attribute, because now is is stored
+      // one position forward
+      this.attrNames.remove(maxIdx);
+      this.normalizeAttr.remove(maxIdx);
+      this.noDataValues.remove(maxIdx);
 
-		/**
-		 * Returns whether the features are sorted according to the domain
-		 * attribute (before creating a {@link Dataset}).
-		 * 
-		 * @return {@code false} as default
-		 */
-		@Override
-		public boolean isSortDomainAxis() {
-			return sortDomainAxis;
-		}
+      updateAttributeCount();
+    }
 
-		/**
-		 * Sets whether a {@link CategoryDataset} is forced for a numeric domain
-		 * attribute. The default is to create {@link XYDataset} for a numeric
-		 * and {@link CategoryDataset} for a non-numeric domain attribute.
-		 */
-		@Override
-		public void setForceCategories(boolean forceCategories) {
-			this.forceCategories = forceCategories;
-		}
+    /**
+     * Creates a (deep) clone of this style. The properties of the super class (
+     * {@link AbstractChartStyle}) are <b>ignored</b> because they are unused
+     * for the dummy.
+     */
+    @Override
+    public AbstractChartStyle copy() {
+      return (AbstractChartStyle) copyTo((FeatureChartStyle) new Dummy(""));
+    }
 
-		/**
-		 * Returns whether a {@link CategoryDataset} is forced for a numeric
-		 * domain attribute. The default is to create {@link XYDataset} for a
-		 * numeric and {@link CategoryDataset} for a non-numeric domain
-		 * attribute.
-		 * 
-		 * @return {@code false} as default
-		 */
-		@Override
-		public boolean isForceCategories() {
-			return forceCategories;
-		}
+    /**
+     * Copies all properties of this style to another one. The properties of the
+     * super class ({@link AbstractChartStyle}) are <b>ignored</b> because they
+     * are unused for the dummy.
+     * @param dest destination object (if {@code null} the copy is created by
+     *          {@link #copy()})
+     * @return {@code dest} or the new instance
+     */
+    @Override
+    public ChartStyle copyTo(ChartStyle dest) {
+      // !! do NOT copy the super class properties !!
+      // !! copy only this classes properties !!
+      // !! Reason: the dummy does not maintain the !!
+      // !! super class properties and we !!
+      // !! do not want to overwrite them !!
+      if (dest instanceof FeatureChartStyle) {
+        FeatureChartStyle destFCS = (FeatureChartStyle) dest;
+        destFCS.setSortDomainAxis(isSortDomainAxis());
+        destFCS.setForceCategories(isForceCategories());
 
-		/**
-		 * Sets whether the attribute data is normalized for an attribute
-		 * (before creating a {@link Dataset}).
-		 * 
-		 * @param idx
-		 *            attribute index (0=domain; 1=1st range series; 2=2nd range
-		 *            series; ...)
-		 * @param normalize
-		 *            indicates the normalize property
-		 */
-		@Override
-		public void setAttributeNormalized(int idx, Boolean normalize) {
-			normalizeAttr.put(idx, normalize);
-			updateAttributeCount();
-		}
+        // Clear the attribute names and attribute normalization
+        int max = destFCS.getMaxAttributeCount();
+        for (int i = 0; i < max; i++) {
+          destFCS.setAttributeName(i, null);
+          destFCS.setAttributeNormalized(i, null);
+          // Added by SK. In this special case we don't
+          destFCS.setNoDataValues(i, getNoDataValues(i));
 
-		/**
-		 * Returns whether the attribute data is normalized for an attribute
-		 * (before creating a {@link Dataset}).
-		 * 
-		 * @param idx
-		 *            attribute index (0=domain; 1=1st range series; 2=2nd range
-		 *            series; ...)
-		 * @return {@code false} as default
-		 */
-		@Override
-		public boolean isAttributeNormalized(int idx) {
-			Boolean normalize = normalizeAttr.get(idx);
-			return normalize != null && normalize;
-		}
+        }
+        // Copy attribute names and normalization
+        for (Integer idx : attrNames.keySet())
+          if (getAttributeName(idx) != null)
+            destFCS.setAttributeName(idx, getAttributeName(idx));
+        for (Integer idx : normalizeAttr.keySet())
+          if (isAttributeNormalized(idx))
+            destFCS.setAttributeNormalized(idx, isAttributeNormalized(idx));
+        for (Integer idx : aggrFuncs.keySet())
+          destFCS.setAttributeAggregation(idx, getAttributeAggregation(idx));
 
-		/**
-		 * Sets an arithmetical function which is calculated on the attribute
-		 * values (when creating a {@link Dataset} from Features). The function
-		 * is calculated on all values with the same domain value (X/category).
-		 * If no function is set, duplicate domain values are ignored (only the
-		 * "last" value is shown, because of replacement behavior).
-		 * 
-		 * @param idx
-		 *            attribute index (1=1st range series; 2=2nd range series;
-		 *            ...)
-		 * @param func
-		 *            defines the calculated function
-		 * @exception IllegalArgumentException
-		 *                if function is set on domain attribute (0)
-		 */
-		@Override
-		public void setAttributeAggregation(int idx, AggregationFunction func) {
-			if (idx == 0)
-				throw new IllegalArgumentException(
-						"Aggregation function not allowed for attribute 0 (domain attribute)!");
-			aggrFuncs.put(idx, func);
-		}
+      }
 
-		/**
-		 * Returns an arithmetical function which is calculated on the attribute
-		 * values (when creating a {@link Dataset} from Features). The function
-		 * is calculated on all values with the same domain value (X/category).
-		 * If no function is set, duplicate domain values are ignored (only the
-		 * "last" value is shown, because of replacement behavior).
-		 * 
-		 * @param idx
-		 *            attribute index (1=1st range series; 2=2nd range series;
-		 *            ...)
-		 * @return {@code null} for index 0 (domain axis)
-		 */
-		@Override
-		public AggregationFunction getAttributeAggregation(int idx) {
-			if (idx == 0)
-				return null;
-			return aggrFuncs.get(idx);
-		}
+      return dest;
+    }
 
-		/**
-		 * 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);
-			updateAttributeCount();
-		}
+    /**
+     * Returns the maximum number of feature attributes that can be specified by
+     * this style.
+     * @return -1 if there is no limit for range attributes
+     */
+    @Override
+    public int getMaxAttributeCount() {
+      return maxAttrCount;
+    }
 
-		/**
-		 * 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);
-		}
+    /**
+     * Returns the number of feature attributes defined in this style.
+     */
+    @Override
+    public int getAttributeCount() {
+      return maxAttrIdx + 1;
+    }
 
-		/**
-		 * 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);
-		}
+    /**
+     * Returns the name of a feature attribute needed to create a chart for this
+     * style.
+     * @param idx attribute index (0=domain; 1=1st range series; 2=2nd range
+     *          series; ...)
+     */
+    @Override
+    public String getAttributeName(int idx) {
+      return attrNames.get(idx);
+    }
 
-		/**
-		 * 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);
-		}
+    /**
+     * Sets the name of a feature attribute needed to create a chart for this
+     * style.
+     * @param idx attribute index (0=domain; 1=1st range series; 2=2nd range
+     *          series; ...)
+     * @param attrName feature attribute name
+     */
+    @Override
+    public void setAttributeName(int idx, String attrName) {
+      attrNames.put(idx, attrName);
+      updateAttributeCount();
+    }
 
-		/**
-		 * Checks whether the given value is one of the "No data" values for the
-		 * attribute.
-		 * 
-		 * @param idx
-		 *            attribute index the "No Data" value is checked for
-		 * @param value
-		 *            an attribute value
-		 */
-		public boolean isNoDataValue(int idx, Object value) {
-			Set<Object> noDataValues = getNoDataValues(idx);
-			if (noDataValues == null)
-				return false;
-			return noDataValues.contains(value);
-		}
+    /**
+     * Sets whether the features are sorted according to the domain attribute
+     * (before creating a {@link Dataset}).
+     */
+    @Override
+    public void setSortDomainAxis(boolean sortDomainAxis) {
+      this.sortDomainAxis = sortDomainAxis;
+    }
 
-		/**
-		 * Checks whether the given value is one of the "No data" values for the
-		 * attribute. In this case this method returns {@code null}, otherwise
-		 * the value itself.
-		 * 
-		 * @param idx
-		 *            attribute index the "No Data" value is checked for
-		 * @param value
-		 *            an attribute value
-		 * @return {@code null} if the given value is one of the "No data"
-		 *         values
-		 */
-		public <T> T filterNoDataValue(int idx, T value) {
-			if (isNoDataValue(idx, value))
-				return null;
-			return value;
-		}
+    /**
+     * Returns whether the features are sorted according to the domain attribute
+     * (before creating a {@link Dataset}).
+     * @return {@code false} as default
+     */
+    @Override
+    public boolean isSortDomainAxis() {
+      return sortDomainAxis;
+    }
 
-		/**
-		 * Does nothing, but always throws a
-		 * {@link UnsupportedOperationException}, because the dummy can not
-		 * provide this functionality.
-		 */
-		@Override
-		public JFreeChart applyToDataset(Dataset dataset) {
-			throw new UnsupportedOperationException(
-					"FeatureChartStyle.Dummy does not implement applyToDataset(..)");
-		}
+    /**
+     * Sets whether a {@link CategoryDataset} is forced for a numeric domain
+     * attribute. The default is to create {@link XYDataset} for a numeric and
+     * {@link CategoryDataset} for a non-numeric domain attribute.
+     */
+    @Override
+    public void setForceCategories(boolean forceCategories) {
+      this.forceCategories = forceCategories;
+    }
 
-		/**
-		 * Does nothing, but always throws a
-		 * {@link UnsupportedOperationException}, because the dummy can not
-		 * provide this functionality.
-		 */
-		@Override
-		public JFreeChart applyToFeatureCollection(
-				FeatureCollection<SimpleFeatureType, SimpleFeature> fc) {
-			throw new UnsupportedOperationException(
-					"FeatureChartStyle.Dummy does not implement applyToFeatureCollection(..)");
-		}
+    /**
+     * Returns whether a {@link CategoryDataset} is forced for a numeric domain
+     * attribute. The default is to create {@link XYDataset} for a numeric and
+     * {@link CategoryDataset} for a non-numeric domain attribute.
+     * @return {@code false} as default
+     */
+    @Override
+    public boolean isForceCategories() {
+      return forceCategories;
+    }
 
+    /**
+     * Sets whether the attribute data is normalized for an attribute (before
+     * creating a {@link Dataset}).
+     * @param idx attribute index (0=domain; 1=1st range series; 2=2nd range
+     *          series; ...)
+     * @param normalize indicates the normalize property
+     */
     @Override
-    public String getAttributeAggregationWeightAttributeName(int idx) {
-      // TODO Auto-generated method stub
-      return null;
+    public void setAttributeNormalized(int idx, Boolean normalize) {
+      normalizeAttr.put(idx, normalize);
+      updateAttributeCount();
     }
 
+    /**
+     * Returns whether the attribute data is normalized for an attribute (before
+     * creating a {@link Dataset}).
+     * @param idx attribute index (0=domain; 1=1st range series; 2=2nd range
+     *          series; ...)
+     * @return {@code false} as default
+     */
     @Override
-    public boolean isNoDataWeightValue(int idx, Object value) {
-      // TODO Auto-generated method stub
-      return false;
+    public boolean isAttributeNormalized(int idx) {
+      Boolean normalize = normalizeAttr.get(idx);
+      return normalize != null && normalize;
     }
 
+    /**
+     * Sets an arithmetical function which is calculated on the attribute values
+     * (when creating a {@link Dataset} from Features). The function is
+     * calculated on all values with the same domain value (X/category). If no
+     * function is set, duplicate domain values are ignored (only the "last"
+     * value is shown, because of replacement behavior).
+     * @param idx attribute index (1=1st range series; 2=2nd range series; ...)
+     * @param func defines the calculated function
+     * @exception IllegalArgumentException if function is set on domain
+     *              attribute (0)
+     */
     @Override
+    public void setAttributeAggregation(int idx, AggregationFunction func) {
+      if (idx == 0)
+        throw new IllegalArgumentException(
+            "Aggregation function not allowed for attribute 0 (domain attribute)!");
+      aggrFuncs.put(idx, func);
+    }
+
+    /**
+     * Returns an arithmetical function which is calculated on the attribute
+     * values (when creating a {@link Dataset} from Features). The function is
+     * calculated on all values with the same domain value (X/category). If no
+     * function is set, duplicate domain values are ignored (only the "last"
+     * value is shown, because of replacement behavior).
+     * @param idx attribute index (1=1st range series; 2=2nd range series; ...)
+     * @return {@code null} for index 0 (domain axis)
+     */
+    @Override
+    public AggregationFunction getAttributeAggregation(int idx) {
+      if (idx == 0)
+        return null;
+      return aggrFuncs.get(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) {
+      this.noDataValues.put(idx, noDataValues);
+      updateAttributeCount();
+    }
+
+    /**
+     * 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);
+    }
+
+    /**
+     * Checks whether the given value is one of the "No data" values for the
+     * attribute.
+     * @param idx attribute index the "No Data" value is checked for
+     * @param value an attribute value
+     */
+    public boolean isNoDataValue(int idx, Object value) {
+      Set<Object> noDataValues = getNoDataValues(idx);
+      if (noDataValues == null)
+        return false;
+      return noDataValues.contains(value);
+    }
+
+    /**
+     * Checks whether the given value is one of the "No data" values for the
+     * attribute. In this case this method returns {@code null}, otherwise the
+     * value itself.
+     * @param idx attribute index the "No Data" value is checked for
+     * @param value an attribute value
+     * @return {@code null} if the given value is one of the "No data" values
+     */
+    public <T> T filterNoDataValue(int idx, T value) {
+      if (isNoDataValue(idx, value))
+        return null;
+      return value;
+    }
+
+    /**
+     * Sets the feature attribute the i-th chart attribute is weighted with.<br>
+     * <b>Note:</b>
+     * <ul>
+     * <li>The weight attribute can not be set for the domain attribute 0.</li>
+     * <li>Do not forget to set the NULL values for the weight attributes, too!</li>
+     * </ul>
+     * @param idx the feature attribute
+     * @param weightAttrName name of the weight attribute
+     * @see #setWeightAttributeNoDataValues(idx, Set) to set NoDataValues for this
+     *      attribute.<br/>
+     * @exception IllegalArgumentException if weight attribute is set for
+     *              attribute 0
+     **/
+    @Override
     public void setAttributeAggregationWeightAttributeName(int idx,
-        String weightAttribName) {
-      // TODO Auto-generated method stub
+        String weightAttrName) {
+      if (idx == 0)
+        throw new IllegalArgumentException(
+            "Weight attribute not allowed for attribute 0 because aggregation function not allowed for domain attribute!");
+      weightAttrNames.put(idx, weightAttrName);
     }
 
+    /**
+     * Returns the feature attribute the i-th chart attribute is weighted with.
+     * <b>Note:</b><br>
+     * This method returns {@code null} unless a
+     * {@linkplain AggregationFunction#isWeighted() weighted} aggregation
+     * function is set for the i-th attribute.
+     * @param idx the feature attribute
+     * @see #setAttributeAggregationWeightAttributeName(int, String)
+     **/
     @Override
-    public void setNoDataWeightValues(int idx, Set<Object> noDataValues) {
-      // TODO Auto-generated method stub
-      
+    public String getAttributeAggregationWeightAttributeName(int idx) {
+      AggregationFunction af = getAttributeAggregation(idx);
+      if (af == null || !af.isWeighted() || idx == 0)
+        return null;
+      return weightAttrNames.get(idx);
     }
-	}
 
-	/**
-	 * TODO Martin! ;-) Wenn attIdx == 0 return. Sonst soll der Name eines
-	 * Attributs zurückgegeben werden oder null! Dieses Attributfeld wird nur
-	 * benutzt, wenn die aggregationsmethode für dieses attribut .isWeighted ==
-	 * true hat
-	 **/
-	public String getAttributeAggregationWeightAttributeName(int idx);
-	
-	/**
-	 * TODO Martin! ;-) Wenn attIdx == 0 thorws exception. Sonst soll der Name eines
-	 * Attributs übergeben werden (oder vielleicht auch mal null)! Dieses Attributfeld wird nur
-	 * benutzt, wenn die aggregationsmethode für dieses attribut .isWeighted ==
-	 * true hat
-	 * @see #setNoDataWeightValues(idx, Set) to set NoDataValues for this attribute.<br/>
-	 **/
-	public void setAttributeAggregationWeightAttributeName(int idx, String weightAttribName);
+    /**
+     * Sets the values, which are interpreted as "No Data" for the optional weight
+     * attribute.
+     * @param idx weight attribute index the "No Data" values are set for
+     * @param noDataValues the "No Data" values
+     */
+    @Override
+    public void setWeightAttributeNoDataValues(int idx, Set<Object> noDataValues) {
+      if (idx == 0)
+        throw new IllegalArgumentException(
+            "Weight attribute not allowed for attribute 0 because aggregation function not allowed for domain attribute!");
+      weightAttrNoDataValues.put(idx, noDataValues);
+    }
 
-	/**
-	 * Checks whether the given value is one of the "No data" values for the
-	 * weight attribute.
-	 * 
-	 * @param idx
-	 *            attribute index the "No Data" value is checked for
-	 * @param value
-	 *            an attribute value
-	 */
-	public boolean isNoDataWeightValue(int idx, Object value);
+    /**
+     * Returns the values, which are interpreted as "No Data" for the
+     * weight attribute.
+     * @param idx weight attribute index the "No Data" values are returned for
+     */
+    @Override
+    public Set<Object> getWeightAttributeNoDataValues(int idx) {
+      return weightAttrNoDataValues.get(idx);
+    }
 
+    /**
+     * Sets a value, which is interpreted as "No Data" for the weight
+     * attribute.
+     * @param idx attribute index the "No Data" value is set for
+     * @param noDataValue the "No Data" value
+     */
+    @Override
+    public void addWeightAttributeNoDataValue(int idx, Object noDataValue) {
+      Set<Object> noDataValues = getWeightAttributeNoDataValues(idx);
+      if (noDataValues == null) {
+        noDataValues = new HashSet<Object>();
+        setWeightAttributeNoDataValues(idx, noDataValues);
+      }
+      noDataValues.add(noDataValue);
+    }
 
-	/**
-	 * Sets the values, which are interpreted as "No Data" for the optional weight attribute of this attribute 
-	 * 
-	 * @param idx
-	 *            attribute index the "No Data" values are set for
-	 * @param noDataValues
-	 *            the "No Data" values
-	 */
-	public void setNoDataWeightValues(int idx, Set<Object> noDataValues);
+    /**
+     * Removes a "No Data" value for a weight 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
+     */
+    @Override
+    public boolean removeWeightAttributeNoDataValue(int idx, Object noDataValue) {
+      Set<Object> noDataValues = getWeightAttributeNoDataValues(idx);
+      if (noDataValues == null)
+        return false;
+      return noDataValues.remove(noDataValue);
+    }
 
+    /**
+     * Checks whether the given value is one of the "No data" values for the
+     * weight attribute.
+     * @param idx weight attribute index the "No Data" value is checked for
+     * @param value an attribute value
+     * @return {@code false} is not weight attribute is set for attribute i
+     * @see #setAttributeAggregationWeightAttributeName(int, String)
+     */
+    @Override
+    public boolean isWeightAttributeNoDataValue(int idx, Object value) {
+      Set<Object> noDataValues = getWeightAttributeNoDataValues(idx);
+      if (noDataValues == null)
+        return false;
+      return noDataValues.contains(value);
+    }
+
+    /**
+     * Checks whether the given value is one of the "No data" values for the
+     * attribute. In this case this method returns {@code null}, otherwise the
+     * value itself.
+     * @param idx attribute index the "No Data" value is checked for
+     * @param value an attribute value
+     * @return {@code null} if the given value is one of the "No data" values
+     */
+    @Override
+    public <T> T filterWeightAttributeNoDataValue(int idx, T value) {
+      if (isWeightAttributeNoDataValue(idx, value))
+        return null;
+      return value;
+    }
+
+    /**
+     * Does nothing, but always throws a {@link UnsupportedOperationException},
+     * because the dummy can not provide this functionality.
+     */
+    @Override
+    public JFreeChart applyToDataset(Dataset dataset) {
+      throw new UnsupportedOperationException(
+          "FeatureChartStyle.Dummy does not implement applyToDataset(..)");
+    }
+
+    /**
+     * Does nothing, but always throws a {@link UnsupportedOperationException},
+     * because the dummy can not provide this functionality.
+     */
+    @Override
+    public JFreeChart applyToFeatureCollection(
+        FeatureCollection<SimpleFeatureType, SimpleFeature> fc) {
+      throw new UnsupportedOperationException(
+          "FeatureChartStyle.Dummy does not implement applyToFeatureCollection(..)");
+    }
+
+  }
 }

Modified: trunk/src/schmitzm/jfree/feature/style/FeatureChartUtil.java
===================================================================
--- trunk/src/schmitzm/jfree/feature/style/FeatureChartUtil.java	2010-03-03 11:45:15 UTC (rev 744)
+++ trunk/src/schmitzm/jfree/feature/style/FeatureChartUtil.java	2010-03-03 12:14:47 UTC (rev 745)
@@ -583,7 +583,7 @@
 						Number weight = (Number) next
 								.getAttribute(chartStyle
 										.getAttributeAggregationWeightAttributeName(attrIdx));
-						if (chartStyle.isNoDataWeightValue(attrIdx, weight))
+						if (chartStyle.isWeightAttributeNoDataValue(attrIdx, weight))
 							continue;
 
 						// NODATA Check Domain attribute
@@ -680,7 +680,7 @@
 									.getAttribute(chartStyle
 											.getAttributeAggregationWeightAttributeName(attrIdx));
 
-							if (!chartStyle.isNoDataWeightValue(attrIdx,
+							if (!chartStyle.isWeightAttributeNoDataValue(attrIdx,
 									weightObj)) {
 								Number weight = (Number) weightObj;
 								aggrStat.add(yValue.doubleValue()
@@ -831,7 +831,7 @@
 				AttributeMetadata weightAttributeMetadata = attributeMetaDataMap
 						.get(attributeName);
 				if (weightAttributeMetadata != null) {
-					featureChartStyle.setNoDataWeightValues(idx,
+					featureChartStyle.setWeightAttributeNoDataValues(idx,
 							weightAttributeMetadata.getNodataValues());
 				}
 			}

Modified: trunk/src/schmitzm/jfree/feature/style/FeatureScatterChartStyle.java
===================================================================
--- trunk/src/schmitzm/jfree/feature/style/FeatureScatterChartStyle.java	2010-03-03 11:45:15 UTC (rev 744)
+++ trunk/src/schmitzm/jfree/feature/style/FeatureScatterChartStyle.java	2010-03-03 12:14:47 UTC (rev 745)
@@ -326,38 +326,116 @@
   }
 
   /**
-   * 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)}.
-   */
+   * Sets the feature attribute the i-th chart attribute is weighted with.<br>
+   * <b>Note:</b>
+   * <ul>
+   * <li>The weight attribute can not be set for the domain attribute 0.</li>
+   * <li>Do not forget to set the NULL values for the weight attributes, too!</li>
+   * </ul>
+   * @param idx the feature attribute
+   * @param weightAttrName name of the weight attribute
+   * @see #setWeightAttributeNoDataValues(idx, Set) to set NoDataValues for this
+   *      attribute.<br/>
+   * @exception IllegalArgumentException if weight attribute is set for
+   *              attribute 0
+   **/
   @Override
-  public JFreeChart applyToFeatureCollection(FeatureCollection<SimpleFeatureType, SimpleFeature> fc) {
-    Dataset dataset = FeatureChartUtil.createDataset(fc,this);
-    return applyToDataset(dataset);
+  public void setAttributeAggregationWeightAttributeName(int idx,
+      String weightAttrName) {
+    dummyFeatureChartStyle.setAttributeAggregationWeightAttributeName(idx, weightAttrName);
   }
 
+  /**
+   * Returns the feature attribute the i-th chart attribute is weighted with.
+   * <b>Note:</b><br>
+   * This method returns {@code null} unless a
+   * {@linkplain AggregationFunction#isWeighted() weighted} aggregation
+   * function is set for the i-th attribute.
+   * @param idx the feature attribute
+   * @see #setAttributeAggregationWeightAttributeName(int, String)
+   **/
   @Override
   public String getAttributeAggregationWeightAttributeName(int idx) {
-    // TODO Auto-generated method stub
-    return null;
+    return dummyFeatureChartStyle.getAttributeAggregationWeightAttributeName(idx);
   }
 
+  /**
+   * Sets the values, which are interpreted as "No Data" for the optional weight
+   * attribute.
+   * @param idx weight attribute index the "No Data" values are set for
+   * @param noDataValues the "No Data" values
+   */
   @Override
-  public boolean isNoDataWeightValue(int idx, Object value) {
-    // TODO Auto-generated method stub
-    return false;
+  public void setWeightAttributeNoDataValues(int idx, Set<Object> noDataValues) {
+    dummyFeatureChartStyle.setWeightAttributeNoDataValues(idx, noDataValues);
   }
 
+  /**
+   * Returns the values, which are interpreted as "No Data" for the
+   * weight attribute.
+   * @param idx weight attribute index the "No Data" values are returned for
+   */
   @Override
-  public void setAttributeAggregationWeightAttributeName(int idx,
-      String weightAttribName) {
-    // TODO Auto-generated method stub
-    
+  public Set<Object> getWeightAttributeNoDataValues(int idx) {
+    return dummyFeatureChartStyle.getWeightAttributeNoDataValues(idx);
   }
 
+  /**
+   * Sets a value, which is interpreted as "No Data" for the weight
+   * attribute.
+   * @param idx attribute index the "No Data" value is set for
+   * @param noDataValue the "No Data" value
+   */
   @Override
-  public void setNoDataWeightValues(int idx, Set<Object> noDataValues) {
-    // TODO Auto-generated method stub
-    
+  public void addWeightAttributeNoDataValue(int idx, Object noDataValue) {
+    dummyFeatureChartStyle.addWeightAttributeNoDataValue(idx, noDataValue);
   }
+
+  /**
+   * Removes a "No Data" value for a weight 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
+   */
+  @Override
+  public boolean removeWeightAttributeNoDataValue(int idx, Object noDataValue) {
+    return dummyFeatureChartStyle.removeWeightAttributeNoDataValue(idx, noDataValue);
+  }
+
+  /**
+   * Checks whether the given value is one of the "No data" values for the
+   * weight attribute.
+   * @param idx weight attribute index the "No Data" value is checked for
+   * @param value an attribute value
+   * @return {@code false} is not weight attribute is set for attribute i
+   * @see #setAttributeAggregationWeightAttributeName(int, String)
+   */
+  @Override
+  public boolean isWeightAttributeNoDataValue(int idx, Object value) {
+    return dummyFeatureChartStyle.isWeightAttributeNoDataValue(idx, value);
+  }
+
+  /**
+   * Checks whether the given value is one of the "No data" values for the
+   * attribute. In this case this method returns {@code null}, otherwise the
+   * value itself.
+   * @param idx attribute index the "No Data" value is checked for
+   * @param value an attribute value
+   * @return {@code null} if the given value is one of the "No data" values
+   */
+  @Override
+  public <T> T filterWeightAttributeNoDataValue(int idx, T value) {
+    return dummyFeatureChartStyle.filterWeightAttributeNoDataValue(idx, value);
+  }
+
+  /**
+   * 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)}.
+   */
+  @Override
+  public JFreeChart applyToFeatureCollection(FeatureCollection<SimpleFeatureType, SimpleFeature> fc) {
+    Dataset dataset = FeatureChartUtil.createDataset(fc,this);
+    return applyToDataset(dataset);
+  }
 }



More information about the Schmitzm-commits mailing list