comparison gnv-artifacts/src/main/java/de/intevation/gnv/raster/Palette.java @ 438:7399bb8f83ea

Added manager to handle several levels of palette subdivsions. Added parameter ids to identify the palette associated with a parameter gnv-artifacts/trunk@486 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Mon, 28 Dec 2009 11:50:27 +0000
parents 67091b17462d
children 92b7ccbf6163
comparison
equal deleted inserted replaced
437:b624879d2902 438:7399bb8f83ea
108 } // class Entry 108 } // class Entry
109 109
110 protected Entry [] entries; 110 protected Entry [] entries;
111 protected Entry lookup; 111 protected Entry lookup;
112 protected Color [] rgbs; 112 protected Color [] rgbs;
113 protected String description;
114 113
115 private Entry buildLookup(Entry [] entries, int lo, int hi) { 114 private Entry buildLookup(Entry [] entries, int lo, int hi) {
116 if (lo > hi) { 115 if (lo > hi) {
117 return null; 116 return null;
118 } 117 }
125 124
126 public Palette() { 125 public Palette() {
127 } 126 }
128 127
129 public Palette(Document document) { 128 public Palette(Document document) {
130 this(document, null);
131 }
132
133 public Palette(Document document, String description) {
134
135 this.description = description;
136 129
137 NodeList rangeNodes = document.getElementsByTagName("range"); 130 NodeList rangeNodes = document.getElementsByTagName("range");
138 131
139 entries = new Entry[rangeNodes.getLength()]; 132 entries = new Entry[rangeNodes.getLength()];
140 rgbs = new Color[entries.length]; 133 rgbs = new Color[entries.length];
228 221
229 public Palette subdivide(int N) { 222 public Palette subdivide(int N) {
230 return new Palette(this, N); 223 return new Palette(this, N);
231 } 224 }
232 225
233 public String getDescription() {
234 return description;
235 }
236
237 public int getSize() { 226 public int getSize() {
238 return rgbs.length; 227 return rgbs.length;
239 } 228 }
240 229
241 public Color getColor(int index) { 230 public Color getColor(int index) {

http://dive4elements.wald.intevation.org