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