root / org.gvsig.dgn / trunk / org.gvsig.dgn / org.gvsig.dgn.provider / src / main / java / org / gvsig / fmap / dal / store / dgn / DGNStoreParameters.java @ 87
History | View | Annotate | Download (8.27 KB)
1 |
package org.gvsig.fmap.dal.store.dgn; |
---|---|
2 |
|
3 |
import java.io.File; |
4 |
|
5 |
import org.cresques.cts.IProjection; |
6 |
import org.gvsig.fmap.dal.DataStoreParameters; |
7 |
import org.gvsig.fmap.dal.FileHelper; |
8 |
import org.gvsig.fmap.dal.feature.EditableFeatureType; |
9 |
import org.gvsig.fmap.dal.feature.FeatureType; |
10 |
import org.gvsig.fmap.dal.feature.NewFeatureStoreParameters; |
11 |
import org.gvsig.fmap.dal.serverexplorer.filesystem.FilesystemStoreParameters; |
12 |
import org.gvsig.fmap.dal.spi.AbstractDataParameters; |
13 |
import org.gvsig.fmap.dal.spi.DataStoreProviderServices; |
14 |
import org.gvsig.fmap.geom.Geometry; |
15 |
import org.gvsig.tools.dynobject.DelegatedDynObject; |
16 |
|
17 |
public class DGNStoreParameters extends AbstractDataParameters implements |
18 |
DataStoreParameters, FilesystemStoreParameters, |
19 |
NewFeatureStoreParameters { |
20 |
|
21 |
public static final String PARAMETERS_DEFINITION_NAME = "DGN"; |
22 |
|
23 |
private static final String FIELD_FILE = "file"; |
24 |
private static final String FIELD_CRS = "CRS"; |
25 |
private static final String FIELD_XMLFILE = "XMLFile"; |
26 |
private static final String FIELD_LOAD_MODE = "LoadMode"; |
27 |
private static final String FIELD_RELOAD = "Reload"; |
28 |
private static final String FIELD_GEOMTYPE_FILTER = "geomtypeFilter"; |
29 |
private static final String FIELD_LEVEL_FILTER = "levelFilter"; |
30 |
private static final String FIELD_TEXT_FILTER = "textFilter"; |
31 |
private static final String FIELD_COLOR_FILTER = "colorFilter"; |
32 |
private static final String FIELD_STYLE_FILTER = "styleFilter"; |
33 |
private static final String FIELD_WEIGHT_FILTER = "weightFilter"; |
34 |
private static final String FIELD_TYPE_FILTER = "typeFilter"; |
35 |
private static final String FIELD_STYPE_FILTER = "stypeFilter"; |
36 |
private static final String FIELD_GROUP_FILTER = "groupFilter"; |
37 |
private static final String FIELD_ID_FILTER = "idFilter"; |
38 |
private static final String FIELD_CROP_FILTER = "cropFilter"; |
39 |
private static final String FIELD_CROPOPERATION_FILTER = "cropOperationFilter"; |
40 |
private static final String FIELD_SKYPCORRUPTGEOMETRIES_FILTER = "skipCorruptGeometries"; |
41 |
private static final String FIELD_SORT_BY_GEOMETRY_TYPE = "sortByGeometryType"; |
42 |
private static final String FIELD_LOGS_ERRORS = "logErrors"; |
43 |
private static final String FIELD_IGNORE_Z = "ignoreZ"; |
44 |
private static final String FIELD_GROUPBY = "groupby"; |
45 |
private static final String FIELD_APPLYCONVEXHULL = "applyConvexHull"; |
46 |
private static final String FIELD_USE_Z_AS_ELEVATION = "useZAsElevation"; |
47 |
private static final String FIELD_ELEVATION_FACTOR = "elevationFactor"; |
48 |
private static final String FIELD_ROUND_ELEVATION = "roundElevation"; |
49 |
|
50 |
private DelegatedDynObject parameters;
|
51 |
|
52 |
public DGNStoreParameters() {
|
53 |
this(PARAMETERS_DEFINITION_NAME);
|
54 |
} |
55 |
|
56 |
protected DGNStoreParameters(String parametersDefinitionName) { |
57 |
this(parametersDefinitionName, DGNStoreProvider.NAME);
|
58 |
} |
59 |
|
60 |
public DGNStoreParameters(String parametersDefinitionName, String name) { |
61 |
super();
|
62 |
this.parameters = (DelegatedDynObject) FileHelper.newParameters(parametersDefinitionName);
|
63 |
this.setDynValue(DataStoreProviderServices.PROVIDER_PARAMTER_NAME, name);
|
64 |
} |
65 |
|
66 |
public String getDataStoreName() { |
67 |
return (String) this.getDynValue(DataStoreProviderServices.PROVIDER_PARAMTER_NAME); |
68 |
} |
69 |
|
70 |
public String getDescription() { |
71 |
return this.getDynClass().getDescription(); |
72 |
} |
73 |
|
74 |
public void setCRS(IProjection srs) { |
75 |
setDynValue(FIELD_CRS, srs); |
76 |
} |
77 |
|
78 |
public void setCRS(String srs) { |
79 |
setDynValue(FIELD_CRS, srs); |
80 |
} |
81 |
|
82 |
public IProjection getCRS() {
|
83 |
return (IProjection) getDynValue(FIELD_CRS);
|
84 |
} |
85 |
|
86 |
public String getFileName() { |
87 |
return this.getFile().getPath(); |
88 |
} |
89 |
|
90 |
public boolean isValid() { |
91 |
if (getCRS() == null) { |
92 |
return false; |
93 |
} |
94 |
if (getFile() == null) { |
95 |
return false; |
96 |
} |
97 |
return true; |
98 |
} |
99 |
|
100 |
public File getFile() { |
101 |
return (File) this.getDynValue(FIELD_FILE); |
102 |
} |
103 |
|
104 |
public File getXMLFile() { |
105 |
return (File) this.getDynValue(FIELD_XMLFILE); |
106 |
} |
107 |
|
108 |
public int getGeometryTypeFilter() { |
109 |
Integer x = (Integer) this.getDynValue(FIELD_GEOMTYPE_FILTER); |
110 |
if (x == null) { |
111 |
return Geometry.TYPES.GEOMETRY;
|
112 |
} |
113 |
return x.intValue();
|
114 |
} |
115 |
|
116 |
public int getLoadMode() { |
117 |
Integer x = (Integer) this.getDynValue(FIELD_LOAD_MODE); |
118 |
if (x == null) { |
119 |
return DGNStoreProvider.LOAD_MODE_PLAIN;
|
120 |
} |
121 |
return x.intValue();
|
122 |
} |
123 |
|
124 |
public double geElevationFactor() { |
125 |
Double x = (Double) this.getDynValue(FIELD_ELEVATION_FACTOR); |
126 |
if (x == null) { |
127 |
return 1; |
128 |
} |
129 |
return x.doubleValue();
|
130 |
} |
131 |
|
132 |
public int getCropOperationFilter() { |
133 |
Integer x = (Integer) this.getDynValue(FIELD_CROPOPERATION_FILTER); |
134 |
if (x == null) { |
135 |
return DGNStoreProvider.CROP_OPERATION_NONE;
|
136 |
} |
137 |
return x.intValue();
|
138 |
} |
139 |
|
140 |
public Geometry getCropFilter() {
|
141 |
Geometry x = (Geometry) this.getDynValue(FIELD_CROP_FILTER);
|
142 |
return x;
|
143 |
} |
144 |
|
145 |
public String getGroupBy() { |
146 |
return (String) this.getDynValue(FIELD_GROUPBY); |
147 |
} |
148 |
|
149 |
public String getLevelFilter() { |
150 |
return (String) this.getDynValue(FIELD_LEVEL_FILTER); |
151 |
} |
152 |
|
153 |
public String getGroupFilter() { |
154 |
return (String) this.getDynValue(FIELD_GROUP_FILTER); |
155 |
} |
156 |
|
157 |
public String getTextFilter() { |
158 |
return (String) this.getDynValue(FIELD_TEXT_FILTER); |
159 |
} |
160 |
|
161 |
public String getIDFilter() { |
162 |
return (String) this.getDynValue(FIELD_ID_FILTER); |
163 |
} |
164 |
|
165 |
public String getTypeFilter() { |
166 |
return (String) this.getDynValue(FIELD_TYPE_FILTER); |
167 |
} |
168 |
|
169 |
public String getSTypeFilter() { |
170 |
return (String) this.getDynValue(FIELD_STYPE_FILTER); |
171 |
} |
172 |
|
173 |
public String getColorFilter() { |
174 |
return (String) this.getDynValue(FIELD_COLOR_FILTER); |
175 |
} |
176 |
|
177 |
public String getStyleFilter() { |
178 |
return (String) this.getDynValue(FIELD_STYLE_FILTER); |
179 |
} |
180 |
|
181 |
public String getWeightFilter() { |
182 |
return (String) this.getDynValue(FIELD_WEIGHT_FILTER); |
183 |
} |
184 |
|
185 |
public boolean useReload() { |
186 |
Boolean x = (Boolean) this.getDynValue(FIELD_RELOAD); |
187 |
if (x == null) { |
188 |
return Boolean.FALSE; |
189 |
} |
190 |
return x.booleanValue();
|
191 |
} |
192 |
|
193 |
public boolean getApplyConvexHull() { |
194 |
Boolean x = (Boolean) this.getDynValue(FIELD_APPLYCONVEXHULL); |
195 |
if (x == null) { |
196 |
return Boolean.FALSE; |
197 |
} |
198 |
return x.booleanValue();
|
199 |
} |
200 |
|
201 |
public boolean getApplyRoundToElevation() { |
202 |
Boolean x = (Boolean) this.getDynValue(FIELD_ROUND_ELEVATION); |
203 |
if (x == null) { |
204 |
return Boolean.FALSE; |
205 |
} |
206 |
return x.booleanValue();
|
207 |
} |
208 |
|
209 |
public boolean ignoreZs() { |
210 |
Boolean x = (Boolean) this.getDynValue(FIELD_IGNORE_Z); |
211 |
if (x == null) { |
212 |
return Boolean.FALSE; |
213 |
} |
214 |
return x.booleanValue();
|
215 |
} |
216 |
|
217 |
public boolean logErrors() { |
218 |
Boolean x = (Boolean) this.getDynValue(FIELD_LOGS_ERRORS); |
219 |
if (x == null) { |
220 |
return Boolean.FALSE; |
221 |
} |
222 |
return x.booleanValue();
|
223 |
} |
224 |
|
225 |
public boolean skipCorruptGeometries() { |
226 |
Boolean x = (Boolean) this.getDynValue(FIELD_SKYPCORRUPTGEOMETRIES_FILTER); |
227 |
if (x == null) { |
228 |
return Boolean.FALSE; |
229 |
} |
230 |
return x.booleanValue();
|
231 |
} |
232 |
|
233 |
boolean useZAsElevation() {
|
234 |
Boolean x = (Boolean) this.getDynValue(FIELD_USE_Z_AS_ELEVATION); |
235 |
if (x == null) { |
236 |
return Boolean.FALSE; |
237 |
} |
238 |
return x.booleanValue();
|
239 |
} |
240 |
public boolean sortByGeometryType() { |
241 |
Boolean x = (Boolean) this.getDynValue(FIELD_SORT_BY_GEOMETRY_TYPE); |
242 |
if (x == null) { |
243 |
return Boolean.TRUE; |
244 |
} |
245 |
return x.booleanValue();
|
246 |
} |
247 |
|
248 |
public void setFile(File file) { |
249 |
this.setDynValue(FIELD_FILE, file);
|
250 |
} |
251 |
|
252 |
public void setFile(String file) { |
253 |
this.setDynValue(FIELD_FILE, file);
|
254 |
} |
255 |
|
256 |
public EditableFeatureType getDefaultFeatureType() {
|
257 |
return null; //TODO ???? |
258 |
} |
259 |
|
260 |
public void setDefaultFeatureType(FeatureType defaultFeatureType) { |
261 |
throw new UnsupportedOperationException(); |
262 |
} |
263 |
|
264 |
protected DelegatedDynObject getDelegatedDynObject() {
|
265 |
return parameters;
|
266 |
} |
267 |
|
268 |
|
269 |
} |