svn-gvsig-desktop / tags / v1_1_Build_1009 / libraries / libCq_CMS_praster / src-test / org / cresques / io / data / TestDataSourceWithNoDataAndSizeBuffer.java @ 12649
History | View | Annotate | Download (3.35 KB)
1 |
/*
|
---|---|
2 |
* Created on 19-jul-2006
|
3 |
*
|
4 |
* To change the template for this generated file go to
|
5 |
* Window>Preferences>Java>Code Generation>Code and Comments
|
6 |
*/
|
7 |
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
|
8 |
*
|
9 |
* Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
|
10 |
*
|
11 |
* This program is free software; you can redistribute it and/or
|
12 |
* modify it under the terms of the GNU General Public License
|
13 |
* as published by the Free Software Foundation; either version 2
|
14 |
* of the License, or (at your option) any later version.
|
15 |
*
|
16 |
* This program is distributed in the hope that it will be useful,
|
17 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
18 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
19 |
* GNU General Public License for more details.
|
20 |
*
|
21 |
* You should have received a copy of the GNU General Public License
|
22 |
* along with this program; if not, write to the Free Software
|
23 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA.
|
24 |
*/
|
25 |
package org.cresques.io.data; |
26 |
|
27 |
import junit.framework.TestCase; |
28 |
|
29 |
import org.cresques.io.GeoRasterFile; |
30 |
|
31 |
/**
|
32 |
* Este test prueba la gesti?n de multifichero de la clase GeoRasterMultiFile
|
33 |
* y que incorpora un Grid, as? como la gesti?n de bandas que tiene BandList
|
34 |
* y que incorpora GeoRasterMultiFile.
|
35 |
* @author Nacho Brodin (nachobrodin@gmail.com)
|
36 |
*
|
37 |
*/
|
38 |
public class TestDataSourceWithNoDataAndSizeBuffer extends TestCase{ |
39 |
|
40 |
private String baseDir = "/home/nacho/images/"; |
41 |
private String path1 = baseDir + "miniRaster25x24.tif"; |
42 |
|
43 |
private GeoRasterFile f1 = null; |
44 |
|
45 |
private Grid g = null; |
46 |
|
47 |
public void setUp() { |
48 |
System.out.println("TestDataSourceWithNoDataAndSizeBuffer running..."); |
49 |
f1 = GeoRasterFile.openFile(null, path1);
|
50 |
|
51 |
} |
52 |
|
53 |
public void testStack(){ |
54 |
int[] drawableBands = {0, 1, 2}; |
55 |
g = new Grid(f1);
|
56 |
g.addDrawableBands(drawableBands); |
57 |
//El par?metro false indica que no se ajuste el extent al raster sino que se rellene con NoData los huecos
|
58 |
|
59 |
//TODO: Hacer las llamadas para probar setAreaOfInterest con tama?o de buffer
|
60 |
|
61 |
g.setAreaOfInterest(645818.258, 4923850.7, 645852.841, 4923817.5, 4, 4);//EXTENT COMPLETO |
62 |
//g.setAreaOfInterest(645835.550, 4923850.7, 645852.841, 4923817.5, 4, 4);//MEDIO EXTENT DCHA
|
63 |
//g.setAreaOfInterest(645818.258, 4923850.7, 645835.550, 4923817.5, 4, 4);//MEDIO EXTENT IZDA
|
64 |
//g.setAreaOfInterest(645818.258, 4923850.7, 645852.841, 4923834.1, 4, 4);//MEDIO EXTENT ARRIBA
|
65 |
//g.setAreaOfInterest(645818.258, 4923834.1, 645852.841, 4923817.5, 4, 4);//MEDIO EXTENT ABAJO
|
66 |
//g.setAreaOfInterest(645828.258, 4923840.7, 645842.841, 4923827.5, 4, 4);//VISTA INTERIOR
|
67 |
|
68 |
//g.setAreaOfInterest(645808.258, 4923850.7, 645852.841, 4923817.5, 4, 4);//NODATA IZDA
|
69 |
//g.setAreaOfInterest(645818.258, 4923850.7, 645862.841, 4923817.5, 4, 4);//NODATA DCHA
|
70 |
//g.setAreaOfInterest(645818.258, 4923860.7, 645852.841, 4923817.5, 4, 4);//NODATA ARRIBA
|
71 |
//g.setAreaOfInterest(645818.258, 4923850.7, 645852.841, 4923807.5, 4, 4);//NODATA ABAJO
|
72 |
//g.setAreaOfInterest(645808.258, 4923860.7, 645862.841, 4923807.5, 5, 5);//4 LADOS
|
73 |
|
74 |
RasterBuf raster = g.getRasterBuf(); |
75 |
for(int line = 0; line < raster.getHeight(); line++){ |
76 |
for(int col = 0; col < raster.getWidth(); col++) |
77 |
System.out.print("("+raster.getElemByte(line, col, 0)+" "+raster.getElemByte(line, col, 1)+" "+raster.getElemByte(line, col, 2)+")"); |
78 |
System.out.println();
|
79 |
} |
80 |
} |
81 |
|
82 |
} |