Statistics
| Revision:

svn-gvsig-desktop / branches / org.gvsig.desktop-2018a / org.gvsig.desktop.compat.cdc / org.gvsig.fmap.dal / org.gvsig.fmap.dal.file / org.gvsig.fmap.dal.file.png / src / main / java / org / gvsig / fmap / dal / file / png / PngStoreProviderParameters.java @ 43803

History | View | Annotate | Download (3.5 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.png;
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
 * Parameters to create a Png Provider
39
 * @author fdiaz
40
 *
41
 */
42
public class PngStoreProviderParameters extends AbstractOpenRasterStoreParameters implements
43
OpenRasterStoreParameters, FilesystemStoreParameters{
44

    
45
    private static final Logger logger = LoggerFactory.getLogger(PngStoreProviderParameters.class);
46

    
47
    public static final String PARAMETERS_DEFINITION_NAME = "PngStoreProviderParameters";
48
    public static final String FILE_PARAMTER_NAME = "file";
49

    
50

    
51
    private DelegatedDynObject parameters;
52

    
53
    /**
54
     * Constructor
55
     */
56
    public PngStoreProviderParameters() {
57
        this(PARAMETERS_DEFINITION_NAME);
58
    }
59

    
60
    protected PngStoreProviderParameters(String parametersDefinitionName) {
61
        this(parametersDefinitionName, PngStoreProvider.NAME);
62
    }
63

    
64

    
65
    /**
66
     * Constructor
67
     * @param parametersDefinitionName
68
     * @param name
69
     */
70
    public PngStoreProviderParameters(String parametersDefinitionName, String name) {
71
        super();
72
        this.parameters = (DelegatedDynObject) FileHelper.newParameters(parametersDefinitionName);
73
        this.setDynValue(DataStoreProviderServices.PROVIDER_PARAMTER_NAME, name);
74
    }
75

    
76
    @Override
77
    public String getDataStoreName() {
78
        return (String) this.getDynValue(DataStoreProviderServices.PROVIDER_PARAMTER_NAME);
79
    }
80

    
81
    @Override
82
    public boolean isValid() {
83
        return (this.getFile() != null);
84
    }
85

    
86
    @Override
87
    public String getDescription() {
88
        return this.getDynClass().getDescription();
89
    }
90

    
91
    @Override
92
    public File getFile() {
93
        return (File) this.getDynValue(FILE_PARAMTER_NAME);
94
    }
95

    
96
    @Override
97
    public void setFile(File file) {
98
        this.setDynValue(FILE_PARAMTER_NAME, file);
99
        loadWLD(file);
100
        if (getCRS()==null){
101
            loadPRJ(file);
102
        }
103
    }
104

    
105
    @Override
106
    protected DelegatedDynObject getDelegatedDynObject() {
107
        return parameters;
108
    }
109

    
110
    @Override
111
    public void setDynValue(String name, Object value) {
112
        super.setDynValue(name, value);
113
        if(name.equals(FILE_PARAMTER_NAME)){
114
            loadWLD((File) value);
115
        }
116
    }
117

    
118

    
119
}