Revision 2370 org.gvsig.raster.multifile/branches/org.gvsig.raster.multifile_dataaccess_refactoring/org.gvsig.raster.multifile.app.multifileclient/src/main/java/org/gvsig/raster/multifile/app/panel/BandSelectorPropertiesListener.java
BandSelectorPropertiesListener.java | ||
---|---|---|
30 | 30 |
import org.gvsig.andami.PluginServices; |
31 | 31 |
import org.gvsig.andami.ui.mdiManager.WindowInfo; |
32 | 32 |
import org.gvsig.fmap.dal.DALLocator; |
33 |
import org.gvsig.fmap.dal.coverage.RasterLibrary; |
|
33 | 34 |
import org.gvsig.fmap.dal.coverage.RasterLocator; |
34 | 35 |
import org.gvsig.fmap.dal.coverage.exception.InvalidSourceException; |
35 | 36 |
import org.gvsig.fmap.dal.coverage.exception.RmfSerializerException; |
... | ... | |
111 | 112 |
} |
112 | 113 |
|
113 | 114 |
if (e.getSource().equals(bandSetupPanel.getSaveButton())) { |
114 |
int rBand = bandSetupPanel.getColorInterpretationByColorBandBand(RasterDataStore.RED_BAND);
|
|
115 |
int gBand = bandSetupPanel.getColorInterpretationByColorBandBand(RasterDataStore.GREEN_BAND);
|
|
116 |
int bBand = bandSetupPanel.getColorInterpretationByColorBandBand(RasterDataStore.BLUE_BAND);
|
|
117 |
int aBand = bandSetupPanel.getColorInterpretationByColorBandBand(RasterDataStore.ALPHA_BAND);
|
|
115 |
int numBandToRed = bandSetupPanel.getColorInterpretationByColorBandBand(RasterDataStore.RED_BAND);
|
|
116 |
int numBandToGreen = bandSetupPanel.getColorInterpretationByColorBandBand(RasterDataStore.GREEN_BAND);
|
|
117 |
int numBandToBlue = bandSetupPanel.getColorInterpretationByColorBandBand(RasterDataStore.BLUE_BAND);
|
|
118 |
int numBandToAlpha = bandSetupPanel.getColorInterpretationByColorBandBand(RasterDataStore.ALPHA_BAND);
|
|
118 | 119 |
|
119 |
if (!isCorrectAssignedBand(rBand, gBand, bBand, aBand)) {
|
|
120 |
if (!isCorrectAssignedBand(numBandToRed, numBandToGreen, numBandToBlue, numBandToAlpha)) {
|
|
120 | 121 |
RasterSwingLibrary.messageBoxError(Messages.getText("combinacion_no_asignable"), bandSetupPanel); |
121 | 122 |
return; |
122 | 123 |
} |
... | ... | |
128 | 129 |
return; |
129 | 130 |
} |
130 | 131 |
|
131 |
ColorInterpretation ci = dataSource.getColorInterpretation(); |
|
132 |
//ColorInterpretation ci = dataSource.getColorInterpretation();
|
|
132 | 133 |
try { |
134 |
String[] bands = new String[bandSetupPanel.getARGBTable().getRowCount()]; |
|
135 |
ColorInterpretation ci = RasterLocator.getManager().getDataStructFactory().createColorInterpretation(bands); |
|
136 |
|
|
133 | 137 |
// Combinaci?n GRAY |
134 |
if ((rBand == gBand) && (rBand == bBand) && (rBand >= 0)) {
|
|
138 |
if ((numBandToRed == numBandToGreen) && (numBandToRed == numBandToBlue) && (numBandToRed >= 0)) {
|
|
135 | 139 |
for (int iBand = 0; iBand < bandSetupPanel.getARGBTable().getRowCount(); iBand++) { |
136 | 140 |
ci.setColorInterpValue(iBand, ColorInterpretation.UNDEF_BAND); |
137 | 141 |
} |
138 |
ci.setColorInterpValue(rBand, ColorInterpretation.GRAY_BAND);
|
|
139 |
ci.setColorInterpValue(aBand, ColorInterpretation.ALPHA_BAND);
|
|
142 |
ci.setColorInterpValue(0, ColorInterpretation.GRAY_BAND);
|
|
143 |
ci.setColorInterpValue(numBandToAlpha, ColorInterpretation.ALPHA_BAND);
|
|
140 | 144 |
} else { |
141 | 145 |
// Combinaci?n RGB |
142 | 146 |
for (int iBand = 0; iBand < bandSetupPanel.getARGBTable().getRowCount(); iBand++) |
143 | 147 |
ci.setColorInterpValue(iBand, bandSetupPanel.getColorInterpretationByBand(iBand)); |
144 | 148 |
} |
145 | 149 |
String fileName = fLayer.getDataStore().getName(); |
150 |
dataSource.setColorInterpretation(ci); |
|
146 | 151 |
RasterLocator.getManager().getProviderServices().saveObjectToRmfFile(fileName, ci); |
147 | 152 |
} catch (RmfSerializerException exc) { |
148 | 153 |
RasterSwingLibrary.messageBoxError(Messages.getText("error_salvando_rmf"), bandSetupPanel, exc); |
Also available in: Unified diff