gvsig-raster / org.gvsig.raster.gdal / tags / pre-remove-jgdal / org.gvsig.raster.gdal / org.gvsig.raster.gdal.io / src / main / java / org / gvsig / jgdal / GdalWarp.java @ 3497
History | View | Annotate | Download (2.95 KB)
1 |
/* gvSIG. Geographic Information System of the Valencian Government
|
---|---|
2 |
*
|
3 |
* Copyright (C) 2007-2008 Infrastructures and Transports Department
|
4 |
* of the Valencian Government (CIT)
|
5 |
*
|
6 |
* This program is free software; you can redistribute it and/or
|
7 |
* modify it under the terms of the GNU General Public License
|
8 |
* as published by the Free Software Foundation; either version 2
|
9 |
* of the License, or (at your option) any later version.
|
10 |
*
|
11 |
* This program is distributed in the hope that it will be useful,
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
14 |
* GNU General Public License for more details.
|
15 |
*
|
16 |
* You should have received a copy of the GNU General Public License
|
17 |
* along with this program; if not, write to the Free Software
|
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
19 |
* MA 02110-1301, USA.
|
20 |
*
|
21 |
*/
|
22 |
package org.gvsig.jgdal; |
23 |
|
24 |
import java.util.ArrayList; |
25 |
|
26 |
import org.gdal.gdal.Dataset; |
27 |
|
28 |
/**
|
29 |
* Clase que recubre la funci?n de reproyecci?n de gdal.
|
30 |
*
|
31 |
* @author Miguel ?ngel Querol Carratal?
|
32 |
*/
|
33 |
public class GdalWarp extends JNIBase { |
34 |
private int porcentaje; |
35 |
|
36 |
/**
|
37 |
* Par?metros de la operaci?n de reproyecci?n
|
38 |
*/
|
39 |
private String s_srs = null; |
40 |
|
41 |
/**
|
42 |
* M?todo nativo para el warp desde gdal.
|
43 |
*/
|
44 |
// private native int warpDataset(String s_srs, String t_srs, String source, String dest, String format);
|
45 |
|
46 |
/**
|
47 |
* Constructor generico.
|
48 |
*/
|
49 |
public GdalWarp() {}
|
50 |
|
51 |
/**
|
52 |
* Reproyecta una imagen raster, creando una imagen de salida
|
53 |
* @param proj EPSG:code o proj4
|
54 |
* @param source Ruta del fichero fuente
|
55 |
* @param dest Ruta del fichero destino
|
56 |
* @param format
|
57 |
* @return 0 si ha ocurrido algun error o 1 si la ejecuci?n ha sido correcta.
|
58 |
* @throws GdalException
|
59 |
*/
|
60 |
public int warp(String t_srs, String source, String dest, String format) { |
61 |
|
62 |
int stat = warpDataset(s_srs, t_srs, source, dest, format);
|
63 |
|
64 |
return stat;
|
65 |
} |
66 |
|
67 |
/**
|
68 |
* Indica la proyecci?n del dataset origen
|
69 |
* @param s_srs
|
70 |
*/
|
71 |
public void setSsrs(String s_srs) { |
72 |
this.s_srs = s_srs;
|
73 |
} |
74 |
|
75 |
/**
|
76 |
* Obtiene el porcentaje de proceso que se ha completado
|
77 |
*/
|
78 |
public int getPercent() { |
79 |
return porcentaje;
|
80 |
} |
81 |
|
82 |
/**
|
83 |
* Devuelve la lista de drivers que usa GdalWarp para reproyectar
|
84 |
* @return
|
85 |
*/
|
86 |
static public ArrayList getDrivers() { |
87 |
ArrayList list = new ArrayList(); |
88 |
list.add("GTiff");
|
89 |
list.add("VRT");
|
90 |
list.add("NITF");
|
91 |
list.add("HFA");
|
92 |
list.add("ELAS");
|
93 |
list.add("MEM");
|
94 |
list.add("BMP");
|
95 |
list.add("PCIDSK");
|
96 |
list.add("ILWIS");
|
97 |
String os = System.getProperty("os.name"); |
98 |
if (!os.toLowerCase().startsWith("windows")) |
99 |
list.add("HDF4Image");
|
100 |
list.add("PNM");
|
101 |
list.add("ENVI");
|
102 |
list.add("EHdr");
|
103 |
list.add("PAux");
|
104 |
list.add("MFF");
|
105 |
list.add("MFF2");
|
106 |
list.add("BT");
|
107 |
list.add("IDA");
|
108 |
list.add("RMF");
|
109 |
list.add("RST");
|
110 |
list.add("Leveller");
|
111 |
list.add("Terragen");
|
112 |
list.add("ERS");
|
113 |
list.add("INGR");
|
114 |
list.add("GSAG");
|
115 |
list.add("GSBG");
|
116 |
list.add("ADRG");
|
117 |
return list;
|
118 |
} |
119 |
} |