[Schmitzm-commits] r398 - branches/1.0-gt2-2.6/src/skrueger

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Mon Sep 14 13:42:49 CEST 2009


Author: mojays
Date: 2009-09-14 13:42:49 +0200 (Mon, 14 Sep 2009)
New Revision: 398

Modified:
   branches/1.0-gt2-2.6/src/skrueger/RasterLegendData.java
Log:
RasterLegendData converted to TreeMap

Modified: branches/1.0-gt2-2.6/src/skrueger/RasterLegendData.java
===================================================================
--- branches/1.0-gt2-2.6/src/skrueger/RasterLegendData.java	2009-09-14 11:40:17 UTC (rev 397)
+++ branches/1.0-gt2-2.6/src/skrueger/RasterLegendData.java	2009-09-14 11:42:49 UTC (rev 398)
@@ -33,6 +33,8 @@
 import java.util.LinkedList;
 import java.util.List;
 import java.util.Map;
+import java.util.SortedMap;
+import java.util.TreeMap;
 
 import org.apache.log4j.Logger;
 import org.geotools.coverage.grid.GridCoverage2D;
@@ -50,7 +52,7 @@
  * @author <a href="mailto:skpublic at wikisquare.de">Stefan Alfons Kr&uuml;ger</a>
  *
  */
-public class RasterLegendData extends HashMap<Double, Translation> {
+public class RasterLegendData extends TreeMap<Double, Translation> {
 	static private final Logger LOGGER = Logger.getLogger(RasterLegendData.class);
 	private Boolean paintGaps = false;
 
@@ -74,27 +76,27 @@
 		return paintGaps ;
 	}
 
-	public List<Double> getSortedKeys(){
-		Object[] array = keySet().toArray();
+//	public List<Double> getSortedKeys(){
+//		Object[] array = keySet().toArray();
+//
+//		Arrays.sort(array);
+//
+//		final LinkedList<Double> linkedList = new LinkedList<Double>();
+//		for (Object o : array){
+//			linkedList.add( (Double)o);
+//		}
+//
+//		return linkedList;
+//
+//	}
 
-		Arrays.sort(array);
-
-		final LinkedList<Double> linkedList = new LinkedList<Double>();
-		for (Object o : array){
-			linkedList.add( (Double)o);
-		}
-
-		return linkedList;
-
-	}
-
     /**
      * Creates a sample {@link GridCoverage2D} (size 1x1, WGS84) for each
      * legend value.  These rasters can be used to do visualize the
      * legend item in the corresponding color via {@link GridCoverageRenderer}.
      */
-    public Map<Double, GridCoverage2D> createSampleRasters() {
-      Map<Double, GridCoverage2D> sampleRaster = new HashMap<Double, GridCoverage2D>();
+    public SortedMap<Double, GridCoverage2D> createSampleRasters() {
+      SortedMap<Double, GridCoverage2D> sampleRaster = new TreeMap<Double, GridCoverage2D>();
       
       for (Double rasterValue : keySet()) {
         GridCoverage2D grid = GridUtil.GRID_FAC.create(



More information about the Schmitzm-commits mailing list