[Schmitzm-commits] r749 - in trunk/src/schmitzm/jfree/feature: . style

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


Author: mojays
Date: 2010-03-03 13:48:11 +0100 (Wed, 03 Mar 2010)
New Revision: 749

Modified:
   trunk/src/schmitzm/jfree/feature/AggregationFunction.java
   trunk/src/schmitzm/jfree/feature/style/FeatureChartStyle.java
Log:
FeatureChartStyle.Dummy.copyTo(.) extended with aggregation functions and weight attributes

Modified: trunk/src/schmitzm/jfree/feature/AggregationFunction.java
===================================================================
--- trunk/src/schmitzm/jfree/feature/AggregationFunction.java	2010-03-03 12:41:17 UTC (rev 748)
+++ trunk/src/schmitzm/jfree/feature/AggregationFunction.java	2010-03-03 12:48:11 UTC (rev 749)
@@ -53,7 +53,7 @@
 	 * Constructed for this {@link Enum}, defining whether it uses a weight. 
 	 * @param weighted
 	 */
-	AggregationFunction(boolean weighted) {
+	private AggregationFunction(boolean weighted) {
 		this.weighted = weighted;
 	}
 

Modified: trunk/src/schmitzm/jfree/feature/style/FeatureChartStyle.java
===================================================================
--- trunk/src/schmitzm/jfree/feature/style/FeatureChartStyle.java	2010-03-03 12:41:17 UTC (rev 748)
+++ trunk/src/schmitzm/jfree/feature/style/FeatureChartStyle.java	2010-03-03 12:48:11 UTC (rev 749)
@@ -391,10 +391,13 @@
      * (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());
+      maxAttrIdx = LangUtil.max(attrNames.keySet(),
+                                normalizeAttr.keySet(),
+                                noDataValues.keySet(),
+                                aggrFuncs.keySet(),
+                                weightAttrNames.keySet(),
+                                weightAttrNoDataValues.keySet()
+      );
 
       if (maxAttrCount > 0 && maxAttrIdx >= maxAttrCount)
         throw new IllegalArgumentException("Only " + maxAttrCount +
@@ -462,16 +465,22 @@
         destFCS.setSortDomainAxis(isSortDomainAxis());
         destFCS.setForceCategories(isForceCategories());
 
-        // Clear the attribute names and attribute normalization
+        // Clear the attribute names, normalization, aggregation,
+        // etc.
+        // NOTE: The no data value set must NOT be cleared deep,
+        //       because these sets may originate from somewhere else!
+        //       So only the hash entry is set to NULL.
         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));
-
+          destFCS.setAttributeAggregation(i, null);
+          destFCS.setAttributeAggregationWeightAttributeName(i, null);
+          destFCS.setNoDataValues(i, null);
+          destFCS.setWeightAttributeNoDataValues(i, null);
         }
-        // Copy attribute names and normalization
+        
+        // Copy attribute names, normalization, aggregation, etc.
         for (Integer idx : attrNames.keySet())
           if (getAttributeName(idx) != null)
             destFCS.setAttributeName(idx, getAttributeName(idx));
@@ -480,7 +489,16 @@
             destFCS.setAttributeNormalized(idx, isAttributeNormalized(idx));
         for (Integer idx : aggrFuncs.keySet())
           destFCS.setAttributeAggregation(idx, getAttributeAggregation(idx));
-
+        for (Integer idx : weightAttrNames.keySet())
+          destFCS.setAttributeAggregationWeightAttributeName(idx, getAttributeAggregationWeightAttributeName(idx));
+        
+        // The nodata value set are not copies deep, because these
+        // sets may originate from somewhere else, so the only
+        // are "redirected".
+        for (Integer idx : noDataValues.keySet())
+          destFCS.setNoDataValues(idx, getNoDataValues(idx));
+        for (Integer idx : weightAttrNoDataValues.keySet())
+          destFCS.setNoDataValues(idx, getWeightAttributeNoDataValues(idx));
       }
 
       return dest;



More information about the Schmitzm-commits mailing list