Statistics
| Revision:

svn-gvsig-desktop / trunk / org.gvsig.desktop / org.gvsig.desktop.compat.cdc / org.gvsig.fmap.dal / org.gvsig.fmap.dal.tilecache / org.gvsig.fmap.dal.tilecache.raster / src / main / java / org / gvsig / raster / tilecache / provider / TileCacheStoreProviderParameters.java @ 44831

History | View | Annotate | Download (4.19 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.raster.tilecache.provider;
24

    
25
import java.io.File;
26
import java.util.List;
27

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

    
31
import org.gvsig.fmap.dal.FileHelper;
32
import org.gvsig.fmap.dal.raster.OpenRasterStoreParameters;
33
import org.gvsig.fmap.dal.spi.AbstractDataParameters;
34
import org.gvsig.fmap.dal.spi.DataStoreProviderServices;
35
import org.gvsig.tools.dynobject.DelegatedDynObject;
36

    
37
/**
38
 * Parameters to create a TileCache Provider
39
 * @author dmartinezizquierdo
40
 *
41
 */
42
public class TileCacheStoreProviderParameters extends AbstractDataParameters implements
43
OpenRasterStoreParameters{
44

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

    
47
    public static final String PARAMETERS_DEFINITION_NAME = "TileCacheStoreProviderParameters";
48
    public static final String TILECACHE_ROOTFOLDER_PARAMTER_NAME = "rootFolder";
49
    public static final String TILECACHE_FOLDER_PARAMTER_NAME = "folder";
50
    public static final String CRS_PARAMTER_NAME = "crs";
51
    public static final String WLD_PARAMS_NAME= "wldParams";
52

    
53

    
54
    private DelegatedDynObject parameters;
55

    
56
    /**
57
     * Constructor
58
     */
59
    public TileCacheStoreProviderParameters() {
60
        this(PARAMETERS_DEFINITION_NAME);
61
    }
62

    
63
    protected TileCacheStoreProviderParameters(String parametersDefinitionName) {
64
        this(parametersDefinitionName, TileCacheStoreProvider.NAME);
65
    }
66

    
67

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

    
79
    @Override
80
    public String getDataStoreName() {
81
        return (String) this.getDynValue(DataStoreProviderServices.PROVIDER_PARAMTER_NAME);
82
    }
83

    
84
    @Override
85
    public boolean isValid() {
86
        return (this.getRootFolder() != null);
87
    }
88

    
89
    @Override
90
    public String getDescription() {
91
        return this.getDynClass().getDescription();
92
    }
93

    
94
    /**
95
     * @return the root folder
96
     */
97
    public File getRootFolder() {
98
        return (File) this.getDynValue(TILECACHE_ROOTFOLDER_PARAMTER_NAME);
99
    }
100

    
101
    /**
102
     * @param rootFolder
103
     */
104
    public void setRootFolder(File rootFolder) {
105
        this.setDynValue(TILECACHE_ROOTFOLDER_PARAMTER_NAME, rootFolder);
106
    }
107

    
108
    /**
109
     * @return the alternative folder
110
     */
111
    public File getFolder() {
112
        return (File) this.getDynValue(TILECACHE_FOLDER_PARAMTER_NAME);
113
    }
114

    
115
    /**
116
     * @param folder
117
     */
118
    public void setFolder(File folder) {
119
        this.setDynValue(TILECACHE_FOLDER_PARAMTER_NAME, folder);
120
    }
121

    
122
    /**
123
     * Gets the 6 params of a WLD file as Strings.
124
     * @return Returns WLD parameters
125
     */
126
    public List<String> getWldParams(){
127
        return (List<String>) getDynValue(WLD_PARAMS_NAME);
128
    }
129

    
130
    /**
131
     * Sets the params of a wld file
132
     * @param wldParams
133
     */
134
    public void setWldParams(List<String> wldParams){
135
        setDynValue(WLD_PARAMS_NAME,wldParams);
136
    }
137

    
138
    @Override
139
    protected DelegatedDynObject getDelegatedDynObject() {
140
        return parameters;
141
    }
142

    
143
}