Mercurial > dive4elements > gnv-client
comparison gnv-artifacts/src/main/java/de/intevation/gnv/raster/PaletteManager.java @ 801:d766fe2d917a
More javadoc.
gnv-artifacts/trunk@883 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Sascha L. Teichmann <sascha.teichmann@intevation.de> |
---|---|
date | Tue, 06 Apr 2010 16:53:43 +0000 |
parents | 6cff63d0c434 |
children | f953c9a559d8 |
comparison
equal
deleted
inserted
replaced
800:db5b04ecb426 | 801:d766fe2d917a |
---|---|
3 import java.lang.ref.SoftReference; | 3 import java.lang.ref.SoftReference; |
4 | 4 |
5 import java.util.HashMap; | 5 import java.util.HashMap; |
6 | 6 |
7 /** | 7 /** |
8 * Manages palettes by their name. Provides different levels of | |
9 * subdivisions. | |
8 * @author <a href="mailto:sascha.teichmann@intevation.de">Sascha L. Teichmann</a> | 10 * @author <a href="mailto:sascha.teichmann@intevation.de">Sascha L. Teichmann</a> |
9 */ | 11 */ |
10 public class PaletteManager | 12 public class PaletteManager |
11 { | 13 { |
14 /** | |
15 * The base palette. | |
16 */ | |
12 protected Palette base; | 17 protected Palette base; |
13 | 18 |
19 /** | |
20 * The description of the palette. | |
21 */ | |
14 protected String description; | 22 protected String description; |
23 | |
24 /** | |
25 * The name of the palette. | |
26 */ | |
15 protected String name; | 27 protected String name; |
16 | 28 |
29 /** | |
30 * Already created subdivisions of the palette. | |
31 */ | |
17 protected HashMap<Integer, SoftReference<Palette>> levels; | 32 protected HashMap<Integer, SoftReference<Palette>> levels; |
18 | 33 |
34 /** | |
35 * Default constructor. | |
36 */ | |
19 public PaletteManager() { | 37 public PaletteManager() { |
20 } | 38 } |
21 | 39 |
40 /** | |
41 * Constructor to create a palette manager with a given name, | |
42 * description and base palette. | |
43 * @param name The name. | |
44 * @param description The description. | |
45 * @param base The base palette. | |
46 */ | |
22 public PaletteManager( | 47 public PaletteManager( |
23 String name, | 48 String name, |
24 String description, | 49 String description, |
25 Palette base | 50 Palette base |
26 ) { | 51 ) { |
28 this.description = description; | 53 this.description = description; |
29 this.base = base; | 54 this.base = base; |
30 levels = new HashMap<Integer, SoftReference<Palette>>(); | 55 levels = new HashMap<Integer, SoftReference<Palette>>(); |
31 } | 56 } |
32 | 57 |
58 /** | |
59 * Returns the description of the palette. | |
60 * @return The description. | |
61 */ | |
33 public String getDescription() { | 62 public String getDescription() { |
34 return description; | 63 return description; |
35 } | 64 } |
36 | 65 |
66 /** | |
67 * The name of the palette. | |
68 * @return The name. | |
69 */ | |
37 public String getName() { | 70 public String getName() { |
38 return name; | 71 return name; |
39 } | 72 } |
40 | 73 |
74 /** | |
75 * Returns the base palette. | |
76 * @return The base palette. | |
77 */ | |
41 public Palette getBase() { | 78 public Palette getBase() { |
42 return base; | 79 return base; |
43 } | 80 } |
44 | 81 |
82 /** | |
83 * Returns the subdivided palette of a given level. | |
84 * @param n The level of subdivision. | |
85 * @return The subdivided palette. | |
86 */ | |
45 public Palette getLevel(int n) { | 87 public Palette getLevel(int n) { |
46 if (n < 2) { | 88 if (n < 2) { |
47 return base; | 89 return base; |
48 } | 90 } |
49 | 91 |