gvsig-raster / org.gvsig.raster / branches / org.gvsig.raster.2.4 / org.gvsig.osm / org.gvsig.osm.provider / src / main / java / org / gvsig / osm / provider / OSMRasterProviderParameters.java @ 8814
History | View | Annotate | Download (4.7 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.osm.provider; |
24 |
|
25 |
import java.net.URL; |
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.spi.AbstractDataParameters; |
33 |
import org.gvsig.fmap.dal.spi.DataStoreProviderServices; |
34 |
import org.gvsig.tools.dynobject.DelegatedDynObject; |
35 |
|
36 |
|
37 |
|
38 |
/**
|
39 |
* Parameters to create a OSM Provider
|
40 |
* @author fdiaz
|
41 |
*
|
42 |
*/
|
43 |
public class OSMRasterProviderParameters extends AbstractDataParameters implements OpenRasterStoreParameters{ |
44 |
|
45 |
private static final Logger logger = LoggerFactory.getLogger(OSMRasterProviderParameters.class); |
46 |
|
47 |
public static final String PARAMETERS_DEFINITION_NAME = "OSMStoreParameters"; |
48 |
|
49 |
public static final String OSM_NAME_PARAMETER_NAME = "name"; |
50 |
public static final String OSM_SERVICE_PARAMETER_NAME = "service"; |
51 |
public static final String OSM_MAX_LEVEL_PARAMETER_NAME = "maxLevel"; |
52 |
public static final String OSM_SUFFIX_PARAMETER_NAME = "suffix"; |
53 |
public static final String OSM_CRS_PARAMETER_NAME = "crs"; |
54 |
public static final String OSM_APIKEY_PARAMETER_NAME = "apiKey"; |
55 |
|
56 |
private DelegatedDynObject parameters;
|
57 |
|
58 |
/**
|
59 |
* Constructor
|
60 |
*/
|
61 |
public OSMRasterProviderParameters() {
|
62 |
this(PARAMETERS_DEFINITION_NAME);
|
63 |
} |
64 |
|
65 |
protected OSMRasterProviderParameters(String parametersDefinitionName) { |
66 |
this(parametersDefinitionName, OSMRasterProvider.NAME);
|
67 |
} |
68 |
|
69 |
|
70 |
/**
|
71 |
* Constructor
|
72 |
* @param parametersDefinitionName
|
73 |
* @param name
|
74 |
*/
|
75 |
public OSMRasterProviderParameters(String parametersDefinitionName, String name) { |
76 |
super();
|
77 |
this.parameters = (DelegatedDynObject) FileHelper.newParameters(parametersDefinitionName);
|
78 |
this.setDynValue(DataStoreProviderServices.PROVIDER_PARAMTER_NAME, name);
|
79 |
} |
80 |
|
81 |
/**
|
82 |
* @return name parameter.
|
83 |
*/
|
84 |
public String getName() { |
85 |
return (String) this.getDynValue(OSM_NAME_PARAMETER_NAME); |
86 |
} |
87 |
|
88 |
/**
|
89 |
* @param service
|
90 |
*/
|
91 |
public void setName(String name) { |
92 |
this.setDynValue(OSM_NAME_PARAMETER_NAME, name);
|
93 |
} |
94 |
|
95 |
/**
|
96 |
* @return service parameter.
|
97 |
*/
|
98 |
public URL getService() { |
99 |
return (URL) this.getDynValue(OSM_SERVICE_PARAMETER_NAME); |
100 |
} |
101 |
|
102 |
/**
|
103 |
* @param service
|
104 |
*/
|
105 |
public void setService(URL service) { |
106 |
this.setDynValue(OSM_SERVICE_PARAMETER_NAME, service);
|
107 |
} |
108 |
|
109 |
/**
|
110 |
* @return the max level
|
111 |
*/
|
112 |
public Integer getMaxLevel() { |
113 |
return (Integer) this.getDynValue(OSM_MAX_LEVEL_PARAMETER_NAME); |
114 |
} |
115 |
|
116 |
/**
|
117 |
* @param maxLevel
|
118 |
*/
|
119 |
public void setMaxLevel(int maxLevel) { |
120 |
this.setDynValue(OSM_MAX_LEVEL_PARAMETER_NAME, maxLevel);
|
121 |
} |
122 |
|
123 |
/**
|
124 |
* @return suffix
|
125 |
*/
|
126 |
public String getSuffix() { |
127 |
return (String) this.getDynValue(OSM_SUFFIX_PARAMETER_NAME); |
128 |
} |
129 |
|
130 |
/**
|
131 |
* @param suffix
|
132 |
*/
|
133 |
public void setSuffix(String suffix) { |
134 |
this.setDynValue(OSM_SUFFIX_PARAMETER_NAME, suffix);
|
135 |
} |
136 |
|
137 |
/**
|
138 |
* @return apiKey
|
139 |
*/
|
140 |
public String getApiKey() { |
141 |
return (String) this.getDynValue(OSM_APIKEY_PARAMETER_NAME); |
142 |
} |
143 |
|
144 |
/**
|
145 |
* @param suffix
|
146 |
*/
|
147 |
public void setApiKey(String apiKey) { |
148 |
this.setDynValue(OSM_APIKEY_PARAMETER_NAME, apiKey);
|
149 |
} |
150 |
|
151 |
@Override
|
152 |
protected DelegatedDynObject getDelegatedDynObject() {
|
153 |
return parameters;
|
154 |
} |
155 |
|
156 |
@Override
|
157 |
public String getDataStoreName() { |
158 |
return (String) this.getDynValue(DataStoreProviderServices.PROVIDER_PARAMTER_NAME); |
159 |
} |
160 |
|
161 |
@Override
|
162 |
public boolean isValid() { |
163 |
return (this.getName() != null && this.getService() != null && this.getSuffix() != null); |
164 |
} |
165 |
|
166 |
@Override
|
167 |
public String getDescription() { |
168 |
return this.getDynClass().getDescription(); |
169 |
} |
170 |
|
171 |
} |