Revision 859 org.gvsig.raster/trunk/org.gvsig.raster/org.gvsig.raster.lib/org.gvsig.raster.lib.impl/src/main/java/org/gvsig/raster/impl/store/properties/DataStoreTransparency.java
DataStoreTransparency.java | ||
---|---|---|
24 | 24 |
import java.util.ArrayList; |
25 | 25 |
import java.util.List; |
26 | 26 |
|
27 |
import org.gvsig.fmap.dal.coverage.RasterLibrary;
|
|
27 |
import org.gvsig.fmap.dal.coverage.RasterLocator;
|
|
28 | 28 |
import org.gvsig.fmap.dal.coverage.dataset.Buffer; |
29 |
import org.gvsig.fmap.dal.coverage.datastruct.NoData; |
|
29 | 30 |
import org.gvsig.fmap.dal.coverage.datastruct.TransparencyRange; |
30 | 31 |
import org.gvsig.fmap.dal.coverage.store.props.Transparency; |
31 | 32 |
import org.gvsig.fmap.dal.coverage.util.PropertyEvent; |
... | ... | |
93 | 94 |
* Valor de dato transparente. Todos los p?xeles de originalData que correspondan con este |
94 | 95 |
* valor se pondr?n 100% transparentes. |
95 | 96 |
*/ |
96 |
protected double noData = RasterLibrary.defaultNoDataValue;
|
|
97 |
protected NoData noData = null;
|
|
97 | 98 |
/** |
98 | 99 |
* Flag que indica que el uso de noData para transparencia est? activo |
99 | 100 |
*/ |
... | ... | |
226 | 227 |
* Obtiene el valor noData |
227 | 228 |
* @return |
228 | 229 |
*/ |
229 |
public double getNoData() {
|
|
230 |
public NoData getNoData() {
|
|
230 | 231 |
return noData; |
231 | 232 |
} |
232 | 233 |
|
... | ... | |
234 | 235 |
* (non-Javadoc) |
235 | 236 |
* @see org.gvsig.fmap.dal.coverage.store.props.Transparency#setNoData(double) |
236 | 237 |
*/ |
237 |
public void setNoData(double noData) {
|
|
238 |
public void setNoData(NoData noData) {
|
|
238 | 239 |
this.noDataActive = true; |
239 | 240 |
if(this.noData != noData) |
240 | 241 |
callPropertyChanged(this); |
... | ... | |
404 | 405 |
* @return |
405 | 406 |
*/ |
406 | 407 |
protected boolean isNoData(int line, int col) { |
408 |
if(noData == null) |
|
409 |
return false; |
|
410 |
|
|
407 | 411 |
switch (originalData.getDataType()) { |
408 | 412 |
case Buffer.TYPE_BYTE: |
409 |
if((originalData.getElemByte(line, col, 0)) == noData) |
|
413 |
if(noData.isDefined() && |
|
414 |
originalData.getElemByte(line, col, 0) == noData.getValue().byteValue()) |
|
410 | 415 |
return true; |
411 | 416 |
break; |
412 | 417 |
case Buffer.TYPE_SHORT: |
413 |
if((originalData.getElemShort(line, col, 0)) == noData) |
|
418 |
if(noData.isDefined() && |
|
419 |
originalData.getElemShort(line, col, 0) == noData.getValue().shortValue()) |
|
414 | 420 |
return true; |
415 | 421 |
break; |
416 | 422 |
case Buffer.TYPE_INT: |
417 |
if((originalData.getElemInt(line, col, 0)) == noData) |
|
423 |
if(noData.isDefined() && |
|
424 |
originalData.getElemInt(line, col, 0) == noData.getValue().intValue()) |
|
418 | 425 |
return true; |
419 | 426 |
break; |
420 | 427 |
case Buffer.TYPE_FLOAT: |
421 |
if((originalData.getElemFloat(line, col, 0)) == noData) |
|
428 |
if(noData.isDefined() && |
|
429 |
originalData.getElemFloat(line, col, 0) == noData.getValue().floatValue()) |
|
422 | 430 |
return true; |
423 | 431 |
break; |
424 | 432 |
case Buffer.TYPE_DOUBLE: |
425 |
if((originalData.getElemDouble(line, col, 0)) == noData) |
|
433 |
if(noData.isDefined() && |
|
434 |
originalData.getElemDouble(line, col, 0) == noData.getValue().doubleValue()) |
|
426 | 435 |
return true; |
427 | 436 |
break; |
428 | 437 |
} |
... | ... | |
596 | 605 |
|
597 | 606 |
this.transparencyActive = state.getBoolean("transparencyActive"); |
598 | 607 |
this.noDataActive = state.getBoolean("noDataActive"); |
599 |
this.noData = state.getDouble("noData"); |
|
608 |
//this.noData = state.getDouble("noData");
|
|
600 | 609 |
} |
601 | 610 |
|
602 | 611 |
/* |
... | ... | |
617 | 626 |
|
618 | 627 |
state.set("transparencyActive", transparencyActive); |
619 | 628 |
state.set("noDataActive", noDataActive); |
620 |
state.set("noData", noData); |
|
629 |
//state.set("noData", noData);
|
|
621 | 630 |
} |
622 | 631 |
|
623 | 632 |
public static void registerPersistence() { |
... | ... | |
634 | 643 |
definition.addDynFieldList("transparencyRange").setClassOfItems(TransparencyRange.class).setMandatory(false); |
635 | 644 |
definition.addDynFieldBoolean("transparencyActive").setMandatory(false); |
636 | 645 |
definition.addDynFieldBoolean("noDataActive").setMandatory(false); |
637 |
definition.addDynFieldDouble("noData").setMandatory(false); |
|
646 |
//definition.addDynFieldDouble("noData").setMandatory(false);
|
|
638 | 647 |
} |
639 | 648 |
|
640 | 649 |
} |
Also available in: Unified diff