1 |
mojays |
2 |
package skrueger; |
2 |
|
|
import java.util.Arrays; |
3 |
|
|
import java.util.HashMap; |
4 |
|
|
import java.util.LinkedList; |
5 |
|
|
import java.util.List; |
6 |
|
|
|
7 |
|
|
import org.apache.log4j.Logger; |
8 |
|
|
|
9 |
|
|
import skrueger.i8n.Translation; |
10 |
|
|
|
11 |
|
|
/** |
12 |
|
|
* Holds all the additional information needed to paint a Legend for a RasterLayer. |
13 |
|
|
* So far, only Legends for one-band raster layers are supported. |
14 |
|
|
* |
15 |
|
|
* @author <a href="mailto:[email protected]">Stefan Alfons Krüger</a> |
16 |
|
|
* |
17 |
|
|
*/ |
18 |
|
|
public class RasterLegendData extends HashMap<Double, Translation> { |
19 |
|
|
static private final Logger LOGGER = Logger.getLogger(RasterLegendData.class); |
20 |
|
|
private Boolean paintGaps = false; |
21 |
|
|
|
22 |
|
|
public Boolean isPaintGaps() { |
23 |
|
|
return paintGaps; |
24 |
|
|
} |
25 |
|
|
|
26 |
|
|
public void setPaintGaps(boolean paintPaps) { |
27 |
|
|
this.paintGaps = paintPaps; |
28 |
|
|
} |
29 |
|
|
|
30 |
|
|
/** |
31 |
|
|
* {@link #paintGaps} defines, if gaps should be painted between the legends colors, |
32 |
|
|
* indicating nominal values in the raster (e.g. classifications) |
33 |
|
|
*/ |
34 |
|
|
public RasterLegendData(boolean paintGaps) { |
35 |
|
|
super(); |
36 |
|
|
this.paintGaps = paintGaps; |
37 |
|
|
} |
38 |
|
|
|
39 |
|
|
public boolean getPaintGaps() { |
40 |
|
|
return paintGaps ; |
41 |
|
|
} |
42 |
|
|
|
43 |
|
|
public List<Double> getSortedKeys(){ |
44 |
|
|
Object[] array = keySet().toArray(); |
45 |
|
|
|
46 |
|
|
Arrays.sort(array); |
47 |
|
|
|
48 |
|
|
final LinkedList<Double> linkedList = new LinkedList<Double>(); |
49 |
|
|
for (Object o : array){ |
50 |
|
|
linkedList.add( (Double)o); |
51 |
|
|
} |
52 |
|
|
|
53 |
|
|
return linkedList; |
54 |
|
|
|
55 |
|
|
} |
56 |
|
|
} |