Revision 20780 trunk/extensions/extRemoteSensing/src/org/gvsig/remotesensing/mosaic/process/MosaicProcess.java

View differences:

MosaicProcess.java
217 217
		
218 218
//		Construccion del mosaico: Operaci?n Superior
219 219
		if(codOp==3){
220
			for(int col=0; col<mosaicGrid.getLayerNY(); col++){
221
				for(int row=0; row<mosaicGrid.getLayerNX();row++){
222
					//setValueMax(row,col);
223
					percent= col*100/mosaicGrid.getLayerNY();
220
			int progress = 0;
221
			for(int band=0; band<numbands; band++){
222
				mosaicGrid.setBandToOperate(band);
223
				for(int col=0; col<mosaicGrid.getLayerNY(); col++){
224
					progress++;
225
					for(int row=0; row<mosaicGrid.getLayerNX();row++){
226
						setValueFront(row,col,band);
227
					}
228
					percent=(int)( progress*100/(mosaicGrid.getLayerNY()*numbands));
224 229
				}
225 230
			}
226 231
		}
227 232
		
228 233
		// Escritura en fichero
229 234
		writeToFile((RasterBuffer)mosaicGrid.getRasterBuf(),0);
230
		writeToFile((RasterBuffer)buffers[0],1);
231
		writeToFile((RasterBuffer)buffers[1],2);
235
	//	writeToFile((RasterBuffer)buffers[0],1);
236
	//	writeToFile((RasterBuffer)buffers[1],2);
232 237
	}
233 238

  
234 239
	
......
292 297
		int result=0;
293 298
		int buffTotales= buffers.length;
294 299
		for(int buf=0;buf<buffers.length;buf++){
295
			int data = (int)((byte)(buffers[buf].getElemByte(y,x,band)&0xff)+127);
300
			int data = (int)((byte)(buffers[buf].getElemByte(y,x,band)));
296 301
//			TO DO: TENER EN CUENTA NODATA REAL DEL BUFER
297
			if(data==97+127){
302
			if(data==97){
298 303
				buffTotales--;
299 304
				data =0;
300 305
			}
......
302 307
		}
303 308
		if(buffTotales==0)
304 309
			buffTotales=1;
305
		result=(int)((result/buffTotales));
310
		result=(byte)((result/buffTotales));
306 311
		try {
307
				mosaicGrid.setCellValue(x,y,(byte)(result-127));
312
				mosaicGrid.setCellValue(x,y,(byte)(result));
308 313
		} catch (OutOfGridException e) {
309 314
				e.printStackTrace();
310 315
		}
311 316
	}
312 317
	
313 318
	
319
	/**
320
	 *  M?todo que establece para la coordenada x,y el valor de la capa superior 
321
	 *  en caso de solape. Se parte de un array de buffer ordenados, de tal manera que
322
	 *  el primer elemento corresponde a la capa situada mas al frente. El ?ltimo por 
323
	 *  contra es el situado al fondo.
324
	 
325
	 *  @param cordenada x 
326
	 *  @param coordenada y  
327
	 * */
328
	public void setValueFront(int x, int y, int band){
329
		byte result=0;
330
		for(int buf=0;buf<buffers.length;buf++){
331
			result = (byte)(buffers[buf].getElemByte(y,x,band));
332
			// TO DO : Valor no data del buffer
333
			if(result!=97)
334
					break;
335
		}
336
		
337
		try {
338
				mosaicGrid.setCellValue(x,y,(byte)result);
339
		} catch (OutOfGridException e) {
340
				e.printStackTrace();
341
		}
342
	}
343
	
344
	
345
	
346
	
347
	
314 348

  
315 349
	/**
316 350
	 * M?todo que calcula el extend resultante para la operaci?n de mosaico

Also available in: Unified diff