Statistics
| Revision:

svn-gvsig-desktop / trunk / extensions / extRasterTools-SE / src-test / org / gvsig / rastertools / BaseTest.java @ 20628

History | View | Annotate | Download (2.95 KB)

1
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
2
 *
3
 * Copyright (C) 2007 IVER T.I. and Generalitat Valenciana.
4
 *
5
 * This program is free software; you can redistribute it and/or
6
 * modify it under the terms of the GNU General Public License
7
 * as published by the Free Software Foundation; either version 2
8
 * of the License, or (at your option) any later version.
9
 *
10
 * This program is distributed in the hope that it will be useful,
11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
 * GNU General Public License for more details.
14
 *
15
 * You should have received a copy of the GNU General Public License
16
 * along with this program; if not, write to the Free Software
17
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
18
 */
19
package org.gvsig.rastertools;
20

    
21
import org.gvsig.fmap.raster.layers.FLyrRasterSE;
22
import org.gvsig.raster.dataset.NotSupportedExtensionException;
23
import org.gvsig.raster.dataset.io.RasterDriverException;
24

    
25
import com.iver.cit.gvsig.exceptions.layers.LoadLayerException;
26
/**
27
 * Clase base para todos los tests. Contiene m?todos de uso com?n.
28
 * Los errores no se capturan. Se lanzan en una traza por consola.
29
 * 
30
 * 07/05/2008
31
 * @author Nacho Brodin nachobrodin@gmail.com
32
 */
33
public class BaseTest extends org.gvsig.raster.BaseTest {
34
        /**
35
         * Imagenes de test
36
         */
37
        protected String               band1         = baseDir + "band1-30x28byte.tif";
38
        protected String               band2         = baseDir + "band2-30x28byte.tif";
39
        protected String               band3         = baseDir + "band3-30x28byte.tif";
40
        protected String               ecw           = baseDir + "ecwtest.ecw";
41
        protected String               mrsid         = baseDir + "mrsidtest.sid";
42
        protected String               byteImg       = baseDir + "byte.tif";
43
        protected String               shortImg      = baseDir + "short.tif";
44
        protected String               intImg        = baseDir + "integer.tif";
45
        protected String               floatImg      = baseDir + "float.tif";
46
        protected String               doubleImg     = baseDir + "double.tif";
47
        
48
        public FLyrRasterSE            lyr           = null;
49
        
50
        /**
51
         * Carga una capa desde un fichero de disco.
52
         * @param s
53
         * @return
54
         */
55
        protected FLyrRasterSE openLayer(String s) {
56
                try {
57
                        lyr = FLyrRasterSE.createLayer("tempLayer", s, null);
58
                } catch (LoadLayerException e) {
59
                        e.printStackTrace();
60
                }
61
                return lyr;
62
        }
63
        
64
        /**
65
         * Carga una capa desde una lista de ficheros de disco.
66
         * @param s
67
         * @return
68
         */
69
        protected FLyrRasterSE openLayer(String[] s) {
70
                try {
71
                        if(s == null)
72
                                return null;
73
                        lyr = FLyrRasterSE.createLayer("tempLayer", s[0], null);
74
                        for (int i = 1; i < s.length; i++)
75
                                lyr.addFile(s[i]);
76
                } catch (LoadLayerException e) {
77
                        e.printStackTrace();
78
                } catch (NotSupportedExtensionException e) {
79
                        e.printStackTrace();
80
                } catch (RasterDriverException e) {
81
                        e.printStackTrace();
82
                }
83
                return lyr;
84
        }
85
}