Revision 17035
trunk/libraries/libRaster/src/org/gvsig/raster/datastruct/ColorTable.java | ||
---|---|---|
198 | 198 |
} |
199 | 199 |
|
200 | 200 |
/** |
201 |
* Borra valores duplicados de la paleta, solo se fija en que un valor no este
|
|
202 |
* repetido, le da igual que sea distinto color, etc...
|
|
201 |
* Borra valores duplicados de la paleta. Solo aquellos que coincidan en valor
|
|
202 |
* y color.
|
|
203 | 203 |
*/ |
204 | 204 |
public void removeDuplicatedValues() { |
205 | 205 |
for (int i = colorItems.size() - 2 ; i >= 0; i--) { |
... | ... | |
209 | 209 |
ColorItem colorItem2 = (ColorItem) colorItems.get(i); |
210 | 210 |
// Si hay un valor duplicado, miramos si lo podemos borrar |
211 | 211 |
if (colorItem.getValue() == colorItem2.getValue()) { |
212 |
// Si el color es distinto no lo borramos |
|
213 |
if (!colorItem.getColor().equals(colorItem2.getColor())) |
|
214 |
continue; |
|
212 | 215 |
// Borraremos siempre el valor que no tenga nombre de clase, es un |
213 | 216 |
// dato importante |
214 | 217 |
if ((colorItem.getNameClass() == null) || (colorItem.getNameClass().length() == 0)) |
215 | 218 |
colorItems.remove(i + 1); |
216 |
else
|
|
219 |
else |
|
217 | 220 |
if ((colorItem2.getNameClass() == null) || (colorItem2.getNameClass().length() == 0)) |
218 | 221 |
colorItems.remove(i); |
219 | 222 |
} |
220 | 223 |
} |
221 | 224 |
} |
222 |
|
|
225 |
|
|
223 | 226 |
/** |
224 | 227 |
* Comprime la actual tabla de color |
225 | 228 |
*/ |
... | ... | |
231 | 234 |
* Informa de si una tabla de color se puede comprimir |
232 | 235 |
* @return |
233 | 236 |
*/ |
234 |
public boolean isCompressible() {
|
|
237 |
public boolean isCompressible() {
|
|
235 | 238 |
ArrayList cloneList = (ArrayList) getColorItems().clone(); |
236 | 239 |
compressPalette(cloneList); |
237 | 240 |
return (cloneList.size() != getColorItems().size()); |
... | ... | |
279 | 282 |
colorItems = new ArrayList(); |
280 | 283 |
for (int iEntry = 0; iEntry < table.getColorEntryCount(); iEntry++) { |
281 | 284 |
GdalColorEntry entry = table.getColorEntryAsRGB(iEntry); |
282 |
|
|
285 |
|
|
283 | 286 |
ColorItem colorItem = new ColorItem(); |
284 | 287 |
colorItem.setNameClass(""); |
285 | 288 |
colorItem.setValue(iEntry); |
... | ... | |
373 | 376 |
clone.colorItems.add((ColorItem) ((ColorItem) colorItems.get(i)).clone()); |
374 | 377 |
} |
375 | 378 |
} |
376 |
|
|
379 |
|
|
377 | 380 |
clone.interpolated = interpolated; |
378 | 381 |
|
379 | 382 |
if (filePath != null) |
... | ... | |
653 | 656 |
} |
654 | 657 |
return result; |
655 | 658 |
} |
656 |
|
|
659 |
|
|
657 | 660 |
/* |
658 | 661 |
* (non-Javadoc) |
659 | 662 |
* @see java.lang.Object#equals(java.lang.Object) |
Also available in: Unified diff