Statistics
| Revision:

gvsig-raster / org.gvsig.raster / branches / org.gvsig.raster.2.4 / org.gvsig.raster.googlemaps / org.gvsig.raster.googlemaps.provider / src / main / java / org / gvsig / raster / googlemaps / provider / GoogleMapsRasterProviderParameters.java @ 8804

History | View | Annotate | Download (5.17 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.googlemaps.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

    
36
/**
37
 * Parameters to create a GoogleMaps Provider
38
 * @author dmartinezizquierdo
39
 *
40
 */
41
public class GoogleMapsRasterProviderParameters extends AbstractDataParameters implements OpenRasterStoreParameters{
42

    
43
    private static final Logger logger = LoggerFactory.getLogger(GoogleMapsRasterProviderParameters.class);
44

    
45
    public static final String PARAMETERS_DEFINITION_NAME = "GoogleMaps";
46

    
47
    public static final String GOOGLEMAPS_MAPTYPE_PARAMTER_NAME = "mapType";
48
    public static final String GOOGLEMAPS_HASAPIKEY_PARAMTER_NAME = "hasApiKey";
49
    public static final String GOOGLEMAPS_APIKEY_PARAMTER_NAME = "apiKey";
50
    public static final String GOOGLEMAPS_LANGUAGE_PARAMTER_NAME = "language";
51
    public static final String GOOGLEMAPS_REGION_PARAMTER_NAME = "region";
52
    public static final String GOOGLEMAPS_FORMAT_PARAMTER_NAME = "format";
53

    
54
    private DelegatedDynObject parameters;
55

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

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

    
67

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

    
79
    /**
80
     * @return map type parameter.
81
     */
82
    public String getMapType() {
83
        return (String) this.getDynValue(GOOGLEMAPS_MAPTYPE_PARAMTER_NAME);
84
    }
85

    
86
    /**
87
     * @param mapType
88
     */
89
    public void setMapType(String mapType) {
90
        this.setDynValue(GOOGLEMAPS_MAPTYPE_PARAMTER_NAME, mapType);
91
    }
92

    
93
    /**
94
     * @return if must use api key
95
     */
96
    public Boolean getHasApiKey() {
97
        return (Boolean) this.getDynValue(GOOGLEMAPS_HASAPIKEY_PARAMTER_NAME);
98
    }
99

    
100
    /**
101
     * @param hasApiKey
102
     */
103
    public void setHasApiKey(boolean hasApiKey) {
104
        this.setDynValue(GOOGLEMAPS_HASAPIKEY_PARAMTER_NAME, hasApiKey);
105
    }
106

    
107
    /**
108
     * @return api key
109
     */
110
    public String getApiKey() {
111
        return (String) this.getDynValue(GOOGLEMAPS_APIKEY_PARAMTER_NAME);
112
    }
113

    
114
    /**
115
     * @param apiKey
116
     */
117
    public void setApiKey(String apiKey) {
118
        this.setDynValue(GOOGLEMAPS_APIKEY_PARAMTER_NAME, apiKey);
119
    }
120

    
121
    /**
122
     * @return language
123
     */
124
    public String getLanguage() {
125
        return (String) this.getDynValue(GOOGLEMAPS_LANGUAGE_PARAMTER_NAME);
126
    }
127

    
128
    /**
129
     * @param language
130
     */
131
    public void setLanguage(String language) {
132
        this.setDynValue(GOOGLEMAPS_LANGUAGE_PARAMTER_NAME, language);
133
    }
134

    
135
    /**
136
     * @return region
137
     */
138
    public String getRegion() {
139
        return (String) this.getDynValue(GOOGLEMAPS_REGION_PARAMTER_NAME);
140
    }
141

    
142
    /**
143
     * @param region
144
     */
145
    public void setRegion(String region) {
146
        this.setDynValue(GOOGLEMAPS_REGION_PARAMTER_NAME, region);
147
    }
148

    
149
    /**
150
     * @return region
151
     */
152
    public String getFormat() {
153
        return (String) this.getDynValue(GOOGLEMAPS_FORMAT_PARAMTER_NAME);
154
    }
155

    
156
    /**
157
     * @param format
158
     */
159
    public void setFormat(String format) {
160
        this.setDynValue(GOOGLEMAPS_FORMAT_PARAMTER_NAME, format);
161
    }
162

    
163
    @Override
164
    protected DelegatedDynObject getDelegatedDynObject() {
165
        return parameters;
166
    }
167

    
168
  @Override
169
  public String getDataStoreName() {
170
      return (String) this.getDynValue(DataStoreProviderServices.PROVIDER_PARAMTER_NAME);
171
  }
172

    
173
  @Override
174
  public boolean isValid() {
175
      return (this.getMapType() != null && this.getHasApiKey() != null);
176
  }
177

    
178
  @Override
179
  public String getDescription() {
180
      return this.getDynClass().getDescription();
181
  }
182

    
183
}