Revision 8682 org.gvsig.raster/branches/org.gvsig.raster.2.4/org.gvsig.raster/org.gvsig.raster.lib/org.gvsig.raster.lib.legend/org.gvsig.raster.lib.legend.impl/src/main/java/org/gvsig/raster/lib/legend/impl/operations/contrast/ContrastOperation.java
ContrastOperation.java | ||
---|---|---|
35 | 35 |
import org.gvsig.raster.lib.buffer.api.exceptions.BufferException; |
36 | 36 |
import org.gvsig.raster.lib.buffer.api.exceptions.BufferOperationException; |
37 | 37 |
import org.gvsig.raster.lib.buffer.api.operations.OperationFactory; |
38 |
import org.gvsig.raster.lib.buffer.impl.exceptions.ProcessingOperationException;
|
|
38 |
import org.gvsig.raster.lib.buffer.spi.exceptions.ProcessingOperationException;
|
|
39 | 39 |
import org.gvsig.raster.lib.buffer.spi.operations.AbstractOperation; |
40 | 40 |
import org.gvsig.raster.lib.legend.api.RasterLegendLocator; |
41 | 41 |
import org.gvsig.raster.lib.legend.api.RasterLegendManager; |
42 | 42 |
import org.gvsig.raster.lib.legend.api.colorinterpretation.ColorInterpretation; |
43 |
import org.gvsig.raster.lib.legend.spi.AbstractColoredOperation; |
|
43 | 44 |
import org.gvsig.tools.locator.LocatorException; |
44 | 45 |
|
45 | 46 |
|
... | ... | |
47 | 48 |
* @author fdiaz |
48 | 49 |
* |
49 | 50 |
*/ |
50 |
public class ContrastOperation extends AbstractOperation{ |
|
51 |
public class ContrastOperation extends AbstractColoredOperation{
|
|
51 | 52 |
|
52 |
static public String COLOR_INTERPRETATION_PARAM = "color_interpretation"; |
|
53 | 53 |
static public String CONTRAST_PARAM = "contrast"; |
54 |
static public String COPY_UNPROCESSED_BANDS_PARAM = "copy_unprocessed_bands"; |
|
55 |
static public String OUTPUT_COLOR_INTERPRETATION_PARAM = "output_color_interpretation"; |
|
56 | 54 |
|
57 |
private ColorInterpretation colorInterpretation; |
|
58 | 55 |
private int contrast; |
59 |
private boolean copyUnprocessedBands; |
|
60 | 56 |
private RowProcessor rowProcessor; |
61 |
private ColorInterpretation outputColorInterpretation; |
|
62 | 57 |
|
63 | 58 |
/** |
64 | 59 |
* @param factory |
... | ... | |
70 | 65 |
|
71 | 66 |
@Override |
72 | 67 |
public void preProcess() throws BufferOperationException { |
68 |
super.preProcess(); |
|
73 | 69 |
BufferManager manager = BufferLocator.getBufferManager(); |
74 | 70 |
RasterLegendManager legendManager = RasterLegendLocator.getRasterLegendManager(); |
75 | 71 |
|
76 |
colorInterpretation = (ColorInterpretation) this.parameters.getDynValue(COLOR_INTERPRETATION_PARAM); |
|
77 | 72 |
contrast = (Integer) this.parameters.getDynValue(CONTRAST_PARAM); |
78 |
if (this.parameters.hasDynValue(COPY_UNPROCESSED_BANDS_PARAM)) { |
|
79 |
copyUnprocessedBands = (Boolean) this.parameters.getDynValue(COPY_UNPROCESSED_BANDS_PARAM); |
|
80 |
} else { |
|
81 |
copyUnprocessedBands = true; |
|
82 |
} |
|
83 | 73 |
|
84 | 74 |
int bands = this.buffer.getBandCount(); |
85 | 75 |
NoData[] noData; |
... | ... | |
128 | 118 |
|
129 | 119 |
@Override |
130 | 120 |
public void process() throws ProcessingOperationException { |
121 |
super.process(); |
|
131 | 122 |
for (int band=0; band<this.buffer.getBandCount(); band++){ |
132 | 123 |
rowProcessor = new ByteRowProcessor(band); |
133 | 124 |
if (isProcessableBand(band)) { |
... | ... | |
179 | 170 |
|
180 | 171 |
@Override |
181 | 172 |
public void postProcess() throws BufferOperationException { |
182 |
// TODO Auto-generated method stub |
|
183 |
|
|
173 |
super.postProcess(); |
|
184 | 174 |
} |
185 | 175 |
|
186 |
|
|
187 |
|
|
188 | 176 |
interface RowProcessor { |
189 | 177 |
void processRow(Object inputRow, Object outputRow); |
190 | 178 |
byte processValue(Object value); |
Also available in: Unified diff