svn-gvsig-desktop / tags / v1_1_Build_1007 / libraries / libCq_CMS_praster / src-test / org / cresques / io / data / TestDataGrid.java @ 12478
History | View | Annotate | Download (3.54 KB)
1 |
/*
|
---|---|
2 |
* Created on 9-ago-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.cts.IProjection; |
30 |
import org.cresques.cts.ProjectionPool; |
31 |
import org.cresques.cts.gt2.CSDatum; |
32 |
import org.cresques.cts.gt2.CSUTM; |
33 |
import org.cresques.cts.gt2.CoordSys; |
34 |
import org.cresques.io.GeoRasterFile; |
35 |
|
36 |
/**
|
37 |
* Este test prueba el acceso a datos a traves de un grid
|
38 |
* @author Nacho Brodin (brodin_ign@gva.es)
|
39 |
*
|
40 |
*/
|
41 |
public class TestDataGrid extends TestCase{ |
42 |
|
43 |
private String path1 = "/home/imagenes/p198r033_7t20010601_z31_nn10.tif"; |
44 |
private String path2 = "/home/imagenes/p198r033_7t20010601_z31_nn20.tif"; |
45 |
private String path3 = "/home/imagenes/p198r033_7t20010601_z31_nn30.tif"; |
46 |
private String path4 = "/home/imagenes/03AUG23153350-M2AS-000000122423_01_P001-BROWSE.jpg"; |
47 |
private String path5 = "/home/imagenes/q101866.sid"; |
48 |
private String path6 = "/home/imagenes/CastilloEcwETRS89.ecw"; |
49 |
|
50 |
|
51 |
private GeoRasterFile f1 = null; |
52 |
private GeoRasterFile f2 = null; |
53 |
private GeoRasterFile f3 = null; |
54 |
private GeoRasterFile f4 = null; |
55 |
private GeoRasterFile f5 = null; |
56 |
private GeoRasterFile f6 = null; |
57 |
|
58 |
private Grid grid = null; |
59 |
|
60 |
public void setUp() { |
61 |
System.out.println("TestGridMultiFile running..."); |
62 |
//CoordSys cs = new CoordSys(CSDatum.ed50);
|
63 |
//f1 = GeoRasterFile.openFile(null, path1);
|
64 |
//f2 = GeoRasterFile.openFile(null, path2);
|
65 |
//f3 = GeoRasterFile.openFile(null, path3);
|
66 |
//f4 = GeoRasterFile.openFile(null, path4);
|
67 |
//f5 = GeoRasterFile.openFile(null, path5);
|
68 |
f6 = GeoRasterFile.openFile(null, path6);
|
69 |
|
70 |
/*grid = new Grid(f1);
|
71 |
grid.addFile(f2);
|
72 |
grid.addFile(f3);*/
|
73 |
//grid = new Grid(f4);
|
74 |
//grid = new Grid(f5);
|
75 |
grid = new Grid(f6);
|
76 |
} |
77 |
|
78 |
public void testStack(){ |
79 |
int[] drawableBands = {0, 1, 2}; |
80 |
int line = 40; |
81 |
int x = 0; |
82 |
int y = 0; |
83 |
int w = 350; |
84 |
int h = 350; |
85 |
|
86 |
grid.addDrawableBands(drawableBands); |
87 |
//f1, f2, f3
|
88 |
//grid.setAreaOfInterest(142671, 4423513.5, 85072, 76294.5);
|
89 |
|
90 |
//f4
|
91 |
//grid.setAreaOfInterest(644850.0, 4925250.0, 2088.0, 2088.0);
|
92 |
//grid.setAreaOfInterest(x, y, w, h);
|
93 |
|
94 |
//f5
|
95 |
//w = 1571;
|
96 |
//h = 1571;
|
97 |
//grid.setAreaOfInterest(0.0, 0.0, 1571.0, 1571.0);
|
98 |
//grid.setAreaOfInterest(x, y, w, h);
|
99 |
|
100 |
//f6
|
101 |
x = 400;
|
102 |
y = 300;
|
103 |
w = 400;
|
104 |
h = 300;
|
105 |
//grid.setAreaOfInterest(517000.0, 4743000.0, 7990.0, 5990.0);
|
106 |
grid.setAreaOfInterest(x, y, w, h); |
107 |
|
108 |
RasterBuf raster = grid.getRasterBuf(); |
109 |
for(int col = 0; col < h; col++){ |
110 |
System.out.print("("+raster.getElemByte(line, col, 0)+" "+raster.getElemByte(line, col, 1)+" "+raster.getElemByte(line, col, 2)+")"); |
111 |
if(col%100 == 0) |
112 |
System.out.println();
|
113 |
} |
114 |
} |
115 |
|
116 |
} |