Revision 30754 branches/v2_0_0_prep/libraries/libRaster/src-test/org/gvsig/raster/buffer/TDSDoubleAdjustToExtentBufferEcw.java

View differences:

TDSDoubleAdjustToExtentBufferEcw.java
27 27
import org.gvsig.raster.dataset.RasterDriverException;
28 28
/**
29 29
 * Este test prueba el acceso a datos a traves de un DataSource sin resampleo
30
 * para un ECW con coordenadas reales. 
31
 * 
32
 * Lee el raster completo y comprueba que los datos leidos sean correctos 
30
 * para un ECW con coordenadas reales.
31
 *
32
 * Lee el raster completo y comprueba que los datos leidos sean correctos
33 33
 * comparando los valores de las cuatro esquinas y algunos valores dentro de la imagen.
34 34
 * Se lee un ?rea m?s grande que el extent completo del raster para comprobar que el ajuste
35 35
 * al extent lo hace correctamente.
36
 * 
36
 *
37 37
 * Despu?s hace selecciona un ?rea dentro de la imagen de 2x2 y compara que los valores
38 38
 * leidos sean correctos.
39
 * 
39
 *
40 40
 * @author Nacho Brodin (nachobrodin@gmail.com)
41 41
 */
42 42
public class TDSDoubleAdjustToExtentBufferEcw extends BaseTestCase {
43 43
	private String        baseDir = "./test-images/";
44 44
	private String        path    = baseDir + "miniraster30x30.jp2";
45 45

  
46
	public void start() {
46
	public void start() throws Exception {
47 47
		this.setUp();
48 48
		this.testStack();
49 49
	}
50 50

  
51
	public void setUp() {
51
	protected void doSetUp() throws Exception {
52
		super.doSetUp();
52 53
		System.err.println("TDSDoubleAdjustToExtentBufferEcw running...");
53 54
	}
54 55

  
......
69 70
		}
70 71
		BufferFactory ds = new BufferFactory(f);
71 72
		ds.setDrawableBands(drawableBands);
72
		//Se selecciona un ?rea mayor que el extent para probar que lo ajusta a este 
73
		//Se selecciona un ?rea mayor que el extent para probar que lo ajusta a este
73 74
		try {
74 75
			ds.setAreaOfInterest(645860.0, 4923870.0, 645986.0, 4923744.0, 10, 10);
75 76
		} catch (RasterDriverException e) {
......
81 82
		}
82 83
//		print(ds.getRasterBuf());
83 84
		dataTest1(ds.getRasterBuf());
84
				
85

  
85 86
		try {
86 87
			ds.setAreaOfInterest(645860.0, 4923870.0, 645986.0, 4923744.0, 2, 2);
87 88
		} catch (RasterDriverException e) {
......
111 112

  
112 113
	public void compareRaster(IBuffer raster, int band0[], int band1[], int band2[]) {
113 114
		int cont = 0;
114
		for (int line = 0; line < raster.getHeight(); line++) {
115
		for (int line = 0; line < raster.getHeight(); line++)
115 116
			for (int col = 0; col < raster.getWidth(); col++) {
116
				assertEquals((int) (raster.getElemByte(line, col, 0) & 0xff), band0[cont]);
117
				assertEquals((int) (raster.getElemByte(line, col, 1) & 0xff), band1[cont]);
118
				assertEquals((int) (raster.getElemByte(line, col, 2) & 0xff), band2[cont]);
117
				assertEquals((raster.getElemByte(line, col, 0) & 0xff), band0[cont]);
118
				assertEquals((raster.getElemByte(line, col, 1) & 0xff), band1[cont]);
119
				assertEquals((raster.getElemByte(line, col, 2) & 0xff), band2[cont]);
119 120
				cont++;
120 121
			}
121
		}
122 122
	}
123 123

  
124 124
	/**
......
129 129
		for (int band = 0; band < 3; band++) {
130 130
			System.out.print("int band" + band + "[] = { ");
131 131
			int cont = 0;
132
			for (int line = 0; line < raster.getHeight(); line++) {
132
			for (int line = 0; line < raster.getHeight(); line++)
133 133
				for (int col = 0; col < raster.getWidth(); col++) {
134 134
					if (cont != 0)
135 135
						System.out.print(", ");
136
					System.out.print(((int) (raster.getElemByte(line, col, band) & 0xff)));
136
					System.out.print(((raster.getElemByte(line, col, band) & 0xff)));
137 137
					cont++;
138 138
				}
139
			}
140 139
			System.out.println("};");
141 140
		}
142 141
	}

Also available in: Unified diff