/[schmitzm]/branches/2.0-RC2/src/skrueger/RasterLegendData.java
ViewVC logotype

Diff of /branches/2.0-RC2/src/skrueger/RasterLegendData.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 2 by mojays, Tue Feb 24 22:43:52 2009 UTC revision 244 by alfonx, Wed Jul 29 09:33:33 2009 UTC
# Line 1  Line 1 
1  package skrueger;  /*******************************************************************************
2  import java.util.Arrays;   * Copyright (c) 2009 Martin O. J. Schmitz.
3  import java.util.HashMap;   *
4  import java.util.LinkedList;   * This file is part of the SCHMITZM library - a collection of utility
5  import java.util.List;   * classes based on Java 1.6, focussing (not only) on Java Swing
6     * and the Geotools library.
7  import org.apache.log4j.Logger;   *
8     * The SCHMITZM project is hosted at:
9  import skrueger.i8n.Translation;   * http://wald.intevation.org/projects/schmitzm/
10     *
11  /**   * This program is free software; you can redistribute it and/or
12   * Holds all the additional information needed to paint a Legend for a RasterLayer.   * modify it under the terms of the GNU Lesser General Public License
13   * So far, only Legends for one-band raster layers are supported.   * as published by the Free Software Foundation; either version 3
14   *   * of the License, or (at your option) any later version.
15   * @author <a href="mailto:[email protected]">Stefan Alfons Kr&uuml;ger</a>   *
16   *   * This program is distributed in the hope that it will be useful,
17   */   * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  public class RasterLegendData extends HashMap<Double, Translation> {   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19          static private final Logger LOGGER = Logger.getLogger(RasterLegendData.class);   * GNU General Public License for more details.
20          private Boolean paintGaps = false;   *
21     * You should have received a copy of the GNU Lesser General Public License (license.txt)
22          public Boolean isPaintGaps() {   * along with this program; if not, write to the Free Software
23                  return paintGaps;   * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
24          }   * or try this link: http://www.gnu.org/licenses/lgpl.html
25     *
26          public void setPaintGaps(boolean paintPaps) {   * Contributors:
27                  this.paintGaps = paintPaps;   *     Martin O. J. Schmitz - initial API and implementation
28          }   *     Stefan A. Krüger - additional utility classes
29     ******************************************************************************/
30          /**  package skrueger;
31           * {@link #paintGaps} defines, if gaps should be painted between the legends colors,  import java.util.Arrays;
32           * indicating nominal values in the raster (e.g. classifications)  import java.util.HashMap;
33           */  import java.util.LinkedList;
34          public RasterLegendData(boolean paintGaps) {  import java.util.List;
35                  super();  
36                  this.paintGaps = paintGaps;  import org.apache.log4j.Logger;
37          }  
38    import skrueger.i8n.Translation;
39          public boolean getPaintGaps() {  
40                  return paintGaps ;  /**
41          }   * Holds all the additional information needed to paint a Legend for a RasterLayer.
42     * So far, only Legends for one-band raster layers are supported.
43          public List<Double> getSortedKeys(){   *
44                  Object[] array = keySet().toArray();   * @author <a href="mailto:[email protected]">Stefan Alfons Kr&uuml;ger</a>
45     *
46                  Arrays.sort(array);   */
47    public class RasterLegendData extends HashMap<Double, Translation> {
48                  final LinkedList<Double> linkedList = new LinkedList<Double>();          static private final Logger LOGGER = Logger.getLogger(RasterLegendData.class);
49                  for (Object o : array){          private Boolean paintGaps = false;
50                          linkedList.add( (Double)o);  
51                  }          public Boolean isPaintGaps() {
52                    return paintGaps;
53                  return linkedList;          }
54    
55          }          public void setPaintGaps(boolean paintPaps) {
56  }                  this.paintGaps = paintPaps;
57            }
58    
59            /**
60             * {@link #paintGaps} defines, if gaps should be painted between the legends colors,
61             * indicating nominal values in the raster (e.g. classifications)
62             */
63            public RasterLegendData(boolean paintGaps) {
64                    super();
65                    this.paintGaps = paintGaps;
66            }
67    
68            public boolean getPaintGaps() {
69                    return paintGaps ;
70            }
71    
72            public List<Double> getSortedKeys(){
73                    Object[] array = keySet().toArray();
74    
75                    Arrays.sort(array);
76    
77                    final LinkedList<Double> linkedList = new LinkedList<Double>();
78                    for (Object o : array){
79                            linkedList.add( (Double)o);
80                    }
81    
82                    return linkedList;
83    
84            }
85    }

Legend:
Removed from v.2  
changed lines
  Added in v.244

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26