Statistics
| Revision:

svn-gvsig-desktop / trunk / org.gvsig.desktop / org.gvsig.desktop.compat.cdc / org.gvsig.fmap.dal / org.gvsig.fmap.dal.file / org.gvsig.fmap.dal.file.imageio / src / main / java / org / gvsig / fmap / dal / file / imageio / ImageIOStoreProviderParameters.java @ 44831

History | View | Annotate | Download (2.89 KB)

1
/* gvSIG. Desktop Geographic Information System.
2
 *
3
 * Copyright ? 2007-2016 gvSIG Association
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., 51 Franklin Street, Fifth Floor, Boston,
18
 * MA  02110-1301, USA.
19
 *
20
 * For any additional information, do not hesitate to contact us
21
 * at info AT gvsig.com, or visit our website www.gvsig.com.
22
 */
23
package org.gvsig.fmap.dal.file.imageio;
24

    
25
import java.io.File;
26

    
27
import org.slf4j.Logger;
28
import org.slf4j.LoggerFactory;
29

    
30
import org.gvsig.fmap.dal.FileHelper;
31
import org.gvsig.fmap.dal.raster.OpenRasterStoreParameters;
32
import org.gvsig.fmap.dal.raster.spi.AbstractOpenRasterStoreParameters;
33
import org.gvsig.fmap.dal.serverexplorer.filesystem.FilesystemStoreParameters;
34
import org.gvsig.fmap.dal.spi.DataStoreProviderServices;
35
import org.gvsig.tools.dynobject.DelegatedDynObject;
36

    
37

    
38
public class ImageIOStoreProviderParameters 
39
        extends 
40
            AbstractOpenRasterStoreParameters 
41
        implements
42
            OpenRasterStoreParameters, 
43
            FilesystemStoreParameters
44
    {
45

    
46
    protected static final Logger logger = LoggerFactory.getLogger(ImageIOStoreProviderParameters.class);
47

    
48
    public static final String FILE_PARAMTER_NAME = "file";
49

    
50
    protected DelegatedDynObject parameters;
51

    
52
    /**
53
     * Constructor
54
     * @param name
55
     */
56
    @SuppressWarnings("OverridableMethodCallInConstructor")
57
    public ImageIOStoreProviderParameters(String name) {
58
        super();
59
        this.parameters = (DelegatedDynObject) FileHelper.newParameters(name+"StoreProviderParameters");
60
        this.setDynValue(DataStoreProviderServices.PROVIDER_PARAMTER_NAME, name);
61
    }
62

    
63
    @Override
64
    public boolean isValid() {
65
        return (this.getFile() != null);
66
    }
67

    
68
    @Override
69
    public File getFile() {
70
        return (File) this.getDynValue(FILE_PARAMTER_NAME);
71
    }
72

    
73
    @Override
74
    public void setFile(File file) {
75
        this.setDynValue(FILE_PARAMTER_NAME, file);
76
        loadWLD(file);
77
        if (getCRS()==null){
78
            loadPRJ(file);
79
        }
80
    }
81

    
82
    @Override
83
    protected DelegatedDynObject getDelegatedDynObject() {
84
        return parameters;
85
    }
86

    
87
    @Override
88
    public void setDynValue(String name, Object value) {
89
        super.setDynValue(name, value);
90
        if(name.equals(FILE_PARAMTER_NAME)){
91
            loadWLD((File) value);
92
        }
93
    }
94

    
95

    
96
}