svn-gvsig-desktop / branches / v2_0_0_prep / extensions / extGPE-gvSIG / src / org / gvsig / fmap / dal / store / gpe / GPEStoreParameters.java @ 34026
History | View | Annotate | Download (3.86 KB)
1 |
/* gvSIG. Geographic Information System of the Valencian Government
|
---|---|
2 |
*
|
3 |
* Copyright (C) 2007-2008 Infrastructures and Transports Department
|
4 |
* of the Valencian Government (CIT)
|
5 |
*
|
6 |
* This program is free software; you can redistribute it and/or
|
7 |
* modify it under the terms of the GNU General Public License
|
8 |
* as published by the Free Software Foundation; either version 2
|
9 |
* of the License, or (at your option) any later version.
|
10 |
*
|
11 |
* This program is distributed in the hope that it will be useful,
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
14 |
* GNU General Public License for more details.
|
15 |
*
|
16 |
* You should have received a copy of the GNU General Public License
|
17 |
* along with this program; if not, write to the Free Software
|
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
19 |
* MA 02110-1301, USA.
|
20 |
*
|
21 |
*/
|
22 |
|
23 |
/*
|
24 |
* AUTHORS (In addition to CIT):
|
25 |
* 2009 {Iver T.I.} {Task}
|
26 |
*/
|
27 |
|
28 |
package org.gvsig.fmap.dal.store.gpe; |
29 |
|
30 |
import java.io.File; |
31 |
|
32 |
import org.cresques.cts.IProjection; |
33 |
|
34 |
import org.gvsig.fmap.dal.DataStoreParameters; |
35 |
import org.gvsig.fmap.dal.FileHelper; |
36 |
import org.gvsig.fmap.dal.serverexplorer.filesystem.FilesystemStoreParameters; |
37 |
import org.gvsig.fmap.dal.spi.AbstractDataParameters; |
38 |
import org.gvsig.fmap.dal.spi.DataStoreProviderServices; |
39 |
import org.gvsig.fmap.geom.primitive.Envelope; |
40 |
import org.gvsig.tools.dynobject.DelegatedDynObject; |
41 |
|
42 |
/**
|
43 |
* @author <a href="mailto:jpiera@gvsig.org">Jorge Piera</a>
|
44 |
*/
|
45 |
public class GPEStoreParameters extends AbstractDataParameters implements |
46 |
DataStoreParameters, FilesystemStoreParameters { |
47 |
|
48 |
public static final String PARAMETERS_DEFINITION_NAME = "GPEStoreParameters"; |
49 |
|
50 |
private static final String FILE_PARAMETER_NAME = "File"; |
51 |
private static final String CRS_PARAMETER_NAME = "CRS"; |
52 |
private static final String ENVELOPE_PARAMETER_NAME = "Envelope"; |
53 |
|
54 |
private DelegatedDynObject parameters;
|
55 |
|
56 |
public GPEStoreParameters() {
|
57 |
this(PARAMETERS_DEFINITION_NAME);
|
58 |
} |
59 |
|
60 |
protected GPEStoreParameters(String parametersDefinitionName) { |
61 |
this(parametersDefinitionName, GPEStoreProvider.NAME);
|
62 |
} |
63 |
|
64 |
public GPEStoreParameters(String parametersDefinitionName, String name) { |
65 |
super();
|
66 |
this.parameters = (DelegatedDynObject) FileHelper.newParameters(parametersDefinitionName);
|
67 |
//TODO review this parameters
|
68 |
this.parameters.getDynClass().addDynFieldObject(ENVELOPE_PARAMETER_NAME).setClassOfValue(Envelope.class).setMandatory(false); |
69 |
this.parameters.getDynClass().addDynField(DataStoreProviderServices.PROVIDER_PARAMTER_NAME);
|
70 |
} |
71 |
|
72 |
protected DelegatedDynObject getDelegatedDynObject() {
|
73 |
return parameters;
|
74 |
} |
75 |
|
76 |
public String getDataStoreName() { |
77 |
return GPEStoreProvider.NAME;
|
78 |
} |
79 |
|
80 |
public String getDescription() { |
81 |
return GPEStoreProvider.DESCRIPTION;
|
82 |
} |
83 |
|
84 |
public boolean isValid() { |
85 |
return (this.getFile() != null); |
86 |
} |
87 |
|
88 |
public File getFile() { |
89 |
return (File) this.getDynValue(FILE_PARAMETER_NAME); |
90 |
} |
91 |
|
92 |
public void setFile(File file) { |
93 |
this.setDynValue(FILE_PARAMETER_NAME, file);
|
94 |
} |
95 |
|
96 |
public String getFileName() { |
97 |
return this.getFile().getAbsolutePath(); |
98 |
} |
99 |
|
100 |
public void setFileName(String fileName) { |
101 |
this.setDynValue(FILE_PARAMETER_NAME, fileName);
|
102 |
} |
103 |
|
104 |
public IProjection getCRS() {
|
105 |
return (IProjection) this.getDynValue(CRS_PARAMETER_NAME); |
106 |
} |
107 |
|
108 |
public void setCRS(IProjection srs) { |
109 |
this.setDynValue(CRS_PARAMETER_NAME, srs);
|
110 |
} |
111 |
|
112 |
public void setCRS(String srs) { |
113 |
this.setDynValue(CRS_PARAMETER_NAME, srs);
|
114 |
} |
115 |
|
116 |
public Envelope getEnvelope() {
|
117 |
return (Envelope) this.getDynValue(ENVELOPE_PARAMETER_NAME); |
118 |
} |
119 |
|
120 |
public void setEnvelope(Envelope envelope) { |
121 |
this.setDynValue(ENVELOPE_PARAMETER_NAME, envelope);
|
122 |
} |
123 |
} |