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

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Wed Feb 3 19:27:00 CET 2010


Author: mojays
Date: 2010-02-03 19:26:56 +0100 (Wed, 03 Feb 2010)
New Revision: 669

Modified:
   branches/2.0-RC2/src/schmitzm/jfree/feature/style/FeatureChartStyle.java
Log:
FeatureChartStyle.removeAttribute(..) implemented

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 18:24:13 UTC (rev 668)
+++ branches/2.0-RC2/src/schmitzm/jfree/feature/style/FeatureChartStyle.java	2010-02-03 18:26:56 UTC (rev 669)
@@ -282,18 +282,27 @@
      */
     @Override
     public void removeAttribute(int idx) {
-      this.attrNames.remove(idx);
-      this.normalizeAttr.remove(idx);
-      Set<Object> noDataValues = this.noDataValues.remove(idx);
+      // clear sets and maps of the removed attribute
+      Set<Object> noDataValues = getNoDataValues(idx);
       if ( noDataValues != null )
         noDataValues.clear();
       
-      // restructure -> move
-//      int oldCount = 
-//      for (int i=idx+1; i)
+      // 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));
+      }
       
+      // delete the last attribute, because now is is stored
+      // one position forward
+      this.attrNames.remove(maxIdx);
+      this.normalizeAttr.remove(maxIdx);
+      this.noDataValues.remove(maxIdx);
       
-      throw new UnsupportedOperationException("FeatureChartStyle.removeAttribute(..) not yet implemented!");
+      updateAttributeCount();
     }
     
     /**



More information about the Schmitzm-commits mailing list