svn-gvsig-desktop / branches / v2_0_0_prep / libraries / libFMap_dalfile / src / org / gvsig / fmap / dal / store / dxf / DXFStoreParameters.java @ 37333
History | View | Annotate | Download (2.74 KB)
1 |
package org.gvsig.fmap.dal.store.dxf; |
---|---|
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 DXFStoreParameters extends AbstractDataParameters implements |
18 |
DataStoreParameters, FilesystemStoreParameters, |
19 |
NewFeatureStoreParameters { |
20 |
|
21 |
public static final String PARAMETERS_DEFINITION_NAME = "DXFStoreParameters"; |
22 |
|
23 |
private static final String FILE_PARAMTER_NAME = "File"; |
24 |
private static final String CRS_PARAMTER_NAME = "CRS"; |
25 |
|
26 |
private DelegatedDynObject parameters;
|
27 |
|
28 |
|
29 |
public DXFStoreParameters() {
|
30 |
this(PARAMETERS_DEFINITION_NAME);
|
31 |
} |
32 |
|
33 |
protected DXFStoreParameters(String parametersDefinitionName) { |
34 |
this(parametersDefinitionName, DXFStoreProvider.NAME);
|
35 |
} |
36 |
|
37 |
public DXFStoreParameters(String parametersDefinitionName, String name) { |
38 |
super();
|
39 |
this.parameters = (DelegatedDynObject) FileHelper.newParameters(parametersDefinitionName);
|
40 |
this.setDynValue(DataStoreProviderServices.PROVIDER_PARAMTER_NAME, name);
|
41 |
} |
42 |
|
43 |
public String getDataStoreName() { |
44 |
return (String) this.getDynValue(DataStoreProviderServices.PROVIDER_PARAMTER_NAME); |
45 |
} |
46 |
|
47 |
public String getDescription() { |
48 |
return this.getDynClass().getDescription(); |
49 |
} |
50 |
|
51 |
protected DelegatedDynObject getDelegatedDynObject() {
|
52 |
return parameters;
|
53 |
} |
54 |
|
55 |
public void setCRS(String srs) { |
56 |
setDynValue(CRS_PARAMTER_NAME, srs); |
57 |
} |
58 |
|
59 |
public void setCRS(IProjection srs) { |
60 |
setDynValue(CRS_PARAMTER_NAME, srs); |
61 |
} |
62 |
|
63 |
public IProjection getCRS() {
|
64 |
return (IProjection) getDynValue(CRS_PARAMTER_NAME);
|
65 |
} |
66 |
|
67 |
public String getFileName() { |
68 |
if( this.getFile() == null ) { |
69 |
return null; |
70 |
} |
71 |
return this.getFile().getPath(); |
72 |
} |
73 |
|
74 |
public boolean isValid() { |
75 |
if (getCRS() == null ) { |
76 |
return false; |
77 |
} |
78 |
if (getFileName() == null) { |
79 |
return false; |
80 |
} |
81 |
return true; |
82 |
} |
83 |
|
84 |
public File getFile() { |
85 |
return (File) this.getDynValue(FILE_PARAMTER_NAME); |
86 |
} |
87 |
|
88 |
public void setFile(File file) { |
89 |
this.setDynValue(FILE_PARAMTER_NAME, file);
|
90 |
} |
91 |
|
92 |
public void setFile(String file) { |
93 |
this.setDynValue(FILE_PARAMTER_NAME, file);
|
94 |
} |
95 |
|
96 |
public EditableFeatureType getDefaultFeatureType() {
|
97 |
return DXFStoreProvider.createFeatureType(null, Geometry.SUBTYPES.GEOM3D); |
98 |
} |
99 |
|
100 |
public void setDefaultFeatureType(FeatureType defaultFeatureType) { |
101 |
throw new UnsupportedOperationException(); |
102 |
} |
103 |
} |