svn-gvsig-desktop / branches / v2_0_0_prep / libraries / libFMap_dataFile / src / org / gvsig / fmap / data / feature / file / dxf / DXFStoreParameters.java @ 23602
History | View | Annotate | Download (1.51 KB)
1 |
package org.gvsig.fmap.data.feature.file.dxf; |
---|---|
2 |
|
3 |
import java.io.File; |
4 |
import java.util.Map; |
5 |
|
6 |
import org.gvsig.fmap.data.InitializeException; |
7 |
import org.gvsig.fmap.data.feature.file.FileStoreParameters; |
8 |
|
9 |
import com.iver.utiles.NotExistInXMLEntity; |
10 |
import com.iver.utiles.XMLEntity; |
11 |
|
12 |
|
13 |
public class DXFStoreParameters extends FileStoreParameters { |
14 |
|
15 |
|
16 |
protected Map createDefaultValuesMap() { |
17 |
Map defaultValues = super.createDefaultValuesMap(); |
18 |
defaultValues.put("srsid", "EPSG:23030"); |
19 |
return defaultValues;
|
20 |
} |
21 |
|
22 |
public String getDataStoreName() { |
23 |
return DXFStore.DATASTORE_NAME;
|
24 |
} |
25 |
public String getSRSID() { |
26 |
return (String) this.get("srsid"); |
27 |
} |
28 |
public void setSRSID(String srsid) { |
29 |
this.put("srsid", srsid); |
30 |
} |
31 |
public boolean isValid() { |
32 |
return super.isValid() && this.getSRSID() != null |
33 |
&& this.getSRSID().length() > 0; |
34 |
} |
35 |
public boolean fileAccept(File f) { |
36 |
return f.getAbsolutePath().toLowerCase().endsWith(".dxf"); |
37 |
} |
38 |
|
39 |
public String getDescription() { |
40 |
return "DXF File"; |
41 |
} |
42 |
|
43 |
public XMLEntity getXMLEntity() {
|
44 |
XMLEntity xmlEntity = super.getXMLEntity();
|
45 |
xmlEntity.putProperty("srsid", this.getSRSID()); |
46 |
return xmlEntity;
|
47 |
} |
48 |
|
49 |
public void loadFromXMLEntity(XMLEntity xmlEntity) |
50 |
throws InitializeException {
|
51 |
|
52 |
super.loadFromXMLEntity(xmlEntity);
|
53 |
try {
|
54 |
this.setSRSID(xmlEntity.getStringProperty("srsid")); |
55 |
} catch (NotExistInXMLEntity e) {
|
56 |
throw new InitializeException("srsid property not found", this |
57 |
.getDataStoreName()); |
58 |
} |
59 |
|
60 |
} |
61 |
|
62 |
} |