Statistics
| Revision:

root / trunk / libraries / libCq CMS for java.old / src / org / cresques / io / GeoRasterFile.java @ 110

History | View | Annotate | Download (2.87 KB)

1
/*
2
 * Created on 26-abr-2004
3
 *
4
 * @author "Luis W. Sevilla" <sevilla_lui@gva.es>
5
 */
6
package org.cresques.io;
7

    
8
import java.awt.Image;
9

    
10
import org.cresques.cts.ICoordTrans;
11
import org.cresques.cts.IProjection;
12
import org.cresques.geo.Projection;
13
import org.cresques.geo.ReProjection;
14
import org.cresques.px.Extent;
15
import org.cresques.px.IObjList;
16
import org.cresques.px.PxContour;
17
import org.cresques.px.PxObjList;
18

    
19
import java.io.File;
20

    
21
/**
22
 * 
23
 * @author "Luis W. Sevilla" <sevilla_lui@gva.es>*
24
 */
25

    
26
public abstract class GeoRasterFile extends GeoFile {
27
        /**
28
         * Factoria para abrir distintos tipos de raster
29
         * @param fName
30
         * @return
31
         */
32
        public static GeoRasterFile openFile(IProjection proj, String fName) {
33
                String ext = fName.toLowerCase().substring(fName.lastIndexOf('.')+1);
34
                
35
                if (ext.compareTo("ecw") == 0) {
36
                        return new EcwFile(proj, fName);
37
                } else if (ext.compareTo("tif") == 0 || ext.compareTo("tiff") == 0 || ext.compareTo("jpg") == 0  || ext.compareTo("png") == 0 ) {
38
                        return new TifGeoRefFile(proj, fName);
39
                }
40
/*                // Copiado de WorldFile
41
                int lengthExtension = fName.length() - fName.lastIndexOf('.');
42
                int l = fName.length(), le = lengthExtension-1;
43
                String wfExt = "."+fName.substring(l-le,l-(le-1))+fName.substring(l-1)+"w"; // ".tfw"
44
                String wfName = fName.substring(0, fName.length()-lengthExtension) + wfExt;
45
                File file = new File(wfName);
46
                
47
                if (ext.compareTo("ecw") == 0) {
48
                        return new EcwFile(proj, fName);
49
                } else if (ext.compareTo("tif") == 0 || ext.compareTo("tiff") == 0 || ext.compareTo("jpg") == 0 || ext.compareTo("png") == 0) {
50
                        // Si la imagen TIFF no lleva un fichero TFW asociado, el programa
51
                        // entiende que se trata de una imagen en formato GeoTiff. La
52
                        // aproximacion es correcta siempre que manejemos informacion
53
                        // georeferenciada, puesto que cualquier TIFF Georeferenciado llevara
54
                        // su correspondiente fichero TFW y si no lo lleva no sera una imagen
55
                        // georeferenciada valida.
56
                        // Para no meter la pata al contemplar TIFFs sin georeferenciar
57
                        // debemos contemplar esta alternativa dentro de la categoria de los
58
                        // GeoTiffs.
59
                        if (!file.exists()) {
60
                                return new GeoTiffFile(proj, fName);
61
                        } else {
62
                                return new TifGeoRefFile(proj, fName);                                
63
                        }
64
                }*/
65

    
66
                return (GeoRasterFile) null;
67
        }
68
        public GeoRasterFile(IProjection proj, String name) {
69
                super(proj, name);
70
        }
71
        public static PxContour getContour(String fName, String name, Projection proj) {
72
                PxContour contour = null;
73
                return contour;
74
        }
75

    
76
        abstract public void reProject(ICoordTrans rp);
77

    
78
        abstract public GeoFile load();
79
        
80
        abstract public void setView(Extent e);
81
        abstract public Extent getView();
82
        
83
        abstract public void setTransparency(boolean t);
84
        
85
        abstract public Image updateImage(int width, int height, ICoordTrans rp);
86
        
87
        public IObjList getObjects() {
88
                // TODO hay que a?adir el raster a la lista de objetos
89
                IObjList oList = new PxObjList(proj);
90
                return oList;
91
        }
92
}