Statistics
| Revision:

gvsig-raster / org.gvsig.raster.gdal / trunk / org.gvsig.raster.gdal / org.gvsig.raster.gdal.io / src / main / java / org / gvsig / jgdal / GdalWarp.java @ 4182

History | View | Annotate | Download (2.91 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
/**
27
 * Clase que recubre la funci?n de reproyecci?n de gdal.
28
 *
29
 * @author Miguel ?ngel Querol Carratal?
30
 */
31
public class GdalWarp {
32
        private int    porcentaje;
33

    
34
        /**
35
         * Par?metros de la operaci?n de reproyecci?n
36
         */
37
        private String s_srs = null;
38

    
39
        /**
40
         * M?todo nativo para el warp desde gdal.
41
         */
42
//        private native int warpDataset(String s_srs, String t_srs, String source, String dest, String format);
43

    
44
        /**
45
         * Constructor generico.
46
         */
47
        public GdalWarp() {}
48

    
49
        /**
50
         * Reproyecta una imagen raster, creando una imagen de salida
51
         * @param proj EPSG:code o proj4
52
         * @param source Ruta del fichero fuente
53
         * @param dest Ruta del fichero destino
54
         * @param format
55
         * @return 0 si ha ocurrido algun error o 1 si la ejecuci?n ha sido correcta.
56
         * @throws GdalException
57
         */
58
        public int warp(String t_srs, String source, String dest, String format) {
59

    
60
//                int stat = warpDataset(s_srs, t_srs, source, dest, format);
61
                int stat = 0;
62

    
63
                return stat;
64
        }
65

    
66
        /**
67
         * Indica la proyecci?n del dataset origen
68
         * @param s_srs
69
         */
70
        public void setSsrs(String s_srs) {
71
                this.s_srs = s_srs;
72
        }
73

    
74
        /**
75
         * Obtiene el porcentaje de proceso que se ha completado
76
         */
77
        public int getPercent() {
78
                return porcentaje;
79
        }
80

    
81
        /**
82
         * Devuelve la lista de drivers que usa GdalWarp para reproyectar
83
         * @return
84
         */
85
        static public ArrayList getDrivers() {
86
                ArrayList list = new ArrayList();
87
                list.add("GTiff");
88
                list.add("VRT");
89
                list.add("NITF");
90
                list.add("HFA");
91
                list.add("ELAS");
92
                list.add("MEM");
93
                list.add("BMP");
94
                list.add("PCIDSK");
95
                list.add("ILWIS");
96
                String os = System.getProperty("os.name");
97
                if (!os.toLowerCase().startsWith("windows"))
98
                        list.add("HDF4Image");
99
                list.add("PNM");
100
                list.add("ENVI");
101
                list.add("EHdr");
102
                list.add("PAux");
103
                list.add("MFF");
104
                list.add("MFF2");
105
                list.add("BT");
106
                list.add("IDA");
107
                list.add("RMF");
108
                list.add("RST");
109
                list.add("Leveller");
110
                list.add("Terragen");
111
                list.add("ERS");
112
                list.add("INGR");
113
                list.add("GSAG");
114
                list.add("GSBG");
115
                list.add("ADRG");
116
                return list;
117
        }
118
}