Revision 20751 trunk/extensions/extRemoteSensing/src/org/gvsig/remotesensing/mosaic/process/MosaicProcess.java
MosaicProcess.java | ||
---|---|---|
69 | 69 |
import com.iver.cit.gvsig.fmap.layers.FLayer; |
70 | 70 |
import com.iver.cit.gvsig.fmap.layers.FLayers; |
71 | 71 |
|
72 |
|
|
73 | 72 |
/** |
74 |
* Clase que implementa el de construccion de un mosaico. |
|
73 |
* Clase que implementa el proceso de construccion de un mosaico.
|
|
75 | 74 |
* |
76 | 75 |
* @author aMu?oz (alejandro.mu?oz@uclm.es) |
77 | 76 |
* @version 30/4/2008 |
... | ... | |
95 | 94 |
int codOp= 0; |
96 | 95 |
|
97 | 96 |
// indicador de proceso |
98 |
int percent=0;
|
|
97 |
int percent=0; |
|
99 | 98 |
|
100 | 99 |
// PROVISIONAL -para cargar capa en vista- |
101 |
private MapContext mapContext = null;
|
|
100 |
private MapContext mapContext = null; |
|
102 | 101 |
|
103 | 102 |
// writer para escritura en fichero |
104 |
WriterBufferServer writerBufferServer =null; |
|
103 |
private WriterBufferServer writerBufferServer =null; |
|
104 |
|
|
105 |
// Numero de bandas 3 o 1 dependiendo de si es RGB o Nivel de gris |
|
106 |
int numbands=0; |
|
105 | 107 |
|
106 | 108 |
|
109 |
|
|
107 | 110 |
/** Inicializaci?n de los par?metros |
108 | 111 |
* layers - FLayers con los layers seleccionados para el mosaico. |
109 | 112 |
* |
110 | 113 |
* En la inicializacion se calcula el grid resultante. |
111 | 114 |
* */ |
112 |
|
|
113 | 115 |
public void init() { |
116 |
|
|
114 | 117 |
layers= (FLayers)getParam("layers"); |
115 | 118 |
codOp= getIntParam("codOp"); |
119 |
numbands= getIntParam("numbands"); |
|
116 | 120 |
// PROVISIONAL |
117 |
mapContext = (MapContext)getParam("contexto"); |
|
121 |
mapContext = (MapContext)getParam("contexto"); |
|
122 |
// Calculo del extend resultante |
|
123 |
fullExtend= calculateExtend(layers); |
|
118 | 124 |
|
119 |
// Calculo del extend resultante |
|
120 |
fullExtend= calculateExtend(layers); |
|
125 |
int bands[]= new int[numbands]; |
|
126 |
for(int i=0; i<numbands;i++) |
|
127 |
bands[i]=i; |
|
121 | 128 |
try { |
122 |
mosaicGrid= new Grid(fullExtend,fullExtend,IBuffer.TYPE_BYTE,new int[]{0,1,2});
|
|
129 |
mosaicGrid= new Grid(fullExtend,fullExtend,IBuffer.TYPE_BYTE,bands);
|
|
123 | 130 |
} catch (RasterBufferInvalidException e) { |
124 | 131 |
RasterToolsUtil.messageBoxError("buffer_incorrecto", this, e); |
125 | 132 |
} |
... | ... | |
166 | 173 |
// Construccion del mosaico: Operaci?n M?ximo |
167 | 174 |
if(codOp==0){ |
168 | 175 |
int progress = 0; |
169 |
for(int band=0; band<3; band++){
|
|
176 |
for(int band=0; band<numbands; band++){
|
|
170 | 177 |
mosaicGrid.setBandToOperate(band); |
171 | 178 |
for(int col=0; col<mosaicGrid.getLayerNY(); col++){ |
172 | 179 |
progress++; |
... | ... | |
178 | 185 |
} |
179 | 186 |
} |
180 | 187 |
|
181 |
// Construccion del mosaico: Operaci?n M?nimo
|
|
188 |
// Construccion del mosaico: Operaci?n M?nimo |
|
182 | 189 |
if(codOp==1){ |
183 | 190 |
for(int col=0; col<mosaicGrid.getLayerNY(); col++){ |
184 | 191 |
for(int row=0; row<mosaicGrid.getLayerNX();row++){ |
... | ... | |
191 | 198 |
// Construccion del mosaico: Operaci?n Media |
192 | 199 |
if(codOp==2){ |
193 | 200 |
int progress = 0; |
194 |
for(int band=0; band<3; band++){
|
|
201 |
for(int band=0; band<numbands; band++){
|
|
195 | 202 |
mosaicGrid.setBandToOperate(band); |
196 | 203 |
for(int col=0; col<mosaicGrid.getLayerNY(); col++){ |
197 | 204 |
progress++; |
198 | 205 |
for(int row=0; row<mosaicGrid.getLayerNX();row++){ |
199 | 206 |
setValueMean(row,col,band); |
200 | 207 |
} |
201 |
percent=(int)( progress*100/(mosaicGrid.getLayerNY()*3.));
|
|
208 |
percent=(int)( progress*100/(mosaicGrid.getLayerNY()*numbands));
|
|
202 | 209 |
} |
203 | 210 |
} |
204 | 211 |
} |
205 | 212 |
|
206 |
// Construccion del mosaico: Operaci?n Superior
|
|
213 |
// Construccion del mosaico: Operaci?n Superior |
|
207 | 214 |
if(codOp==3){ |
208 | 215 |
for(int col=0; col<mosaicGrid.getLayerNY(); col++){ |
209 | 216 |
for(int row=0; row<mosaicGrid.getLayerNX();row++){ |
... | ... | |
304 | 311 |
} |
305 | 312 |
|
306 | 313 |
|
307 |
|
|
308 |
|
|
309 |
|
|
310 |
|
|
311 |
|
|
312 |
|
|
314 |
|
|
313 | 315 |
/** |
314 | 316 |
* M?todo que calcula el extend resultante para la operaci?n de mosaico |
315 | 317 |
* |
... | ... | |
472 | 474 |
}*/ |
473 | 475 |
|
474 | 476 |
|
475 |
|
|
476 | 477 |
} |
Also available in: Unified diff