Statistics
| Revision:

svn-gvsig-desktop / trunk / applications / appgvSIG / src / com / iver / cit / gvsig / ShpFileExtension.java @ 312

History | View | Annotate | Download (1.21 KB)

1
package com.iver.cit.gvsig;
2

    
3
import java.io.File;
4

    
5
import org.cresques.cts.IProjection;
6
import org.cresques.cts.ProjectionPool;
7

    
8
import com.iver.cit.gvsig.fmap.drivers.shp.DemoSHPDriver;
9
import com.iver.cit.gvsig.fmap.layers.LayerFactory;
10
import com.iver.mdiApp.plugins.files.FileExtension;
11

    
12

    
13
/**
14
 * DOCUMENT ME!
15
 *
16
 * @author Fernando Gonz?lez Cort?s
17
 */
18
public class ShpFileExtension implements FileExtension {
19
    private String path;
20
    private String shapeName;
21
    
22
    /**
23
     * @see com.iver.mdiApp.plugins.FileProcessingExtension#readFile(java.io.File)
24
     */
25
    public Object read(File f) {
26
            // TODO LWS pasar la proyecci?n desde la llamada
27
            IProjection proj = ProjectionPool.get("ed50utm30");
28
        shapeName = f.getName();
29
        path = f.getAbsolutePath();
30
                if ((path == null) || (shapeName == null)) {
31
                        throw new IllegalArgumentException("Se debe abrir la capa antes");
32
                }
33

    
34
                return LayerFactory.createLayer(new DemoSHPDriver(), new File(path), proj);
35
    }
36
        public String getPath(){
37
                return path;
38
        }
39
        public String getName(){
40
                        return shapeName;
41
        }
42
    /**
43
     * @see com.iver.mdiApp.plugins.FileProcessingExtension#writeFile(java.io.File)
44
     */
45
    public void write(File f, Object object) {
46
    }
47
}