Statistics
| Revision:

gvsig-raster / org.gvsig.raster / branches / org.gvsig.raster.2.4 / org.gvsig.raster.bingmaps / org.gvsig.raster.bingmaps.provider / src / main / java / org / gvsig / raster / bingmaps / provider / BingMapsRasterProviderParameters.java @ 8780

History | View | Annotate | Download (4.44 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.bingmaps.provider;
24

    
25
import org.slf4j.Logger;
26
import org.slf4j.LoggerFactory;
27

    
28
import org.gvsig.fmap.dal.FileHelper;
29
import org.gvsig.fmap.dal.raster.OpenRasterStoreParameters;
30
import org.gvsig.fmap.dal.spi.AbstractDataParameters;
31
import org.gvsig.fmap.dal.spi.DataStoreProviderServices;
32
import org.gvsig.tools.dynobject.DelegatedDynObject;
33

    
34
/**
35
 * Parameters to create a BingMaps Provider
36
 *
37
 * @author dmartinezizquierdo
38
 *
39
 */
40
public class BingMapsRasterProviderParameters extends AbstractDataParameters implements OpenRasterStoreParameters {
41

    
42
    private static final Logger logger = LoggerFactory.getLogger(BingMapsRasterProviderParameters.class);
43

    
44
    public static final String PARAMETERS_DEFINITION_NAME = "BingMapsRasterProviderParameters";
45

    
46
    public static final String BINGMAPS_MAPTYPE_PARAMTER_NAME = "mapType";
47
    public static final String BINGMAPS_HASAPIKEY_PARAMTER_NAME = "hasApiKey";
48
    public static final String BINGMAPS_APIKEY_PARAMTER_NAME = "apiKey";
49
    public static final String BINGMAPS_LANGUAGE_PARAMTER_NAME = "language";
50

    
51
    private DelegatedDynObject parameters;
52

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

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

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

    
76
    /**
77
     * @return map type parameter.
78
     */
79
    public String getMapType() {
80
        return (String) this.getDynValue(BINGMAPS_MAPTYPE_PARAMTER_NAME);
81
    }
82

    
83
    /**
84
     * @param mapType
85
     */
86
    public void setMapType(String mapType) {
87
        this.setDynValue(BINGMAPS_MAPTYPE_PARAMTER_NAME, mapType);
88
    }
89

    
90
    /**
91
     * @return if must use api key
92
     */
93
    public Boolean getHasApiKey() {
94
        return (Boolean) this.getDynValue(BINGMAPS_HASAPIKEY_PARAMTER_NAME);
95
    }
96

    
97
    /**
98
     * @param hasApiKey
99
     */
100
    public void setHasApiKey(boolean hasApiKey) {
101
        this.setDynValue(BINGMAPS_HASAPIKEY_PARAMTER_NAME, hasApiKey);
102
    }
103

    
104
    /**
105
     * @return api key
106
     */
107
    public String getApiKey() {
108
        return (String) this.getDynValue(BINGMAPS_APIKEY_PARAMTER_NAME);
109
    }
110

    
111
    /**
112
     * @param apiKey
113
     */
114
    public void setApiKey(String apiKey) {
115
        this.setDynValue(BINGMAPS_APIKEY_PARAMTER_NAME, apiKey);
116
    }
117

    
118
    /**
119
     * @return language
120
     */
121
    public String getLanguage() {
122
        return (String) this.getDynValue(BINGMAPS_LANGUAGE_PARAMTER_NAME);
123
    }
124

    
125
    /**
126
     * @param language
127
     */
128
    public void setLanguage(String language) {
129
        this.setDynValue(BINGMAPS_LANGUAGE_PARAMTER_NAME, language);
130
    }
131

    
132
    @Override
133
    protected DelegatedDynObject getDelegatedDynObject() {
134
        return parameters;
135
    }
136

    
137
    @Override
138
    public String getDataStoreName() {
139
        return (String) this.getDynValue(DataStoreProviderServices.PROVIDER_PARAMTER_NAME);
140
    }
141

    
142
    @Override
143
    public boolean isValid() {
144
        return (this.getMapType() != null && this.getHasApiKey() != null);
145
    }
146

    
147
    @Override
148
    public String getDescription() {
149
        return this.getDynClass().getDescription();
150
    }
151

    
152
}