Statistics
| Revision:

root / branches / v10 / libraries / libCq_CMS_praster / src-test / org / cresques / io / data / TestDataSourceWithNoDataAndSizeBuffer.java @ 10938

History | View | Annotate | Download (2.86 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
                g.setAreaOfInterest(645819.2583, 4923849.7, 25.584, 25.2); //ZOOM
61
                //g.setAreaOfInterest(645818.2583, 4923850.7, 34.584, 33.2);
62
                //g.setAreaOfInterest(645808.2583, 4923850.7, 44.584, 33.2); //NODATA IZDA
63
                //g.setAreaOfInterest(645818.2583, 4923860.7, 34.584, 43.2); //NODATA ARRIBA
64
                //g.setAreaOfInterest(645818.2583, 4923850.7, 34.584, 43.2); //NODATA ABAJO
65
                //g.setAreaOfInterest(645818.2583, 4923850.7, 44.584, 33.2); //NODATA DCHA
66
                //g.setAreaOfInterest(645808.2583, 4923860.7, 54.584, 53.2); //NODATA 4 LADOS
67
                
68
                RasterBuf raster = g.getRasterBuf();
69
                for(int line = 0; line < raster.getHeight(); line++){
70
                        for(int col = 0; col < raster.getWidth(); col++)
71
                                System.out.print("("+raster.getElemByte(line, col, 0)+" "+raster.getElemByte(line, col, 1)+" "+raster.getElemByte(line, col, 2)+")");
72
                        System.out.println();
73
                }
74
        }
75

    
76
}