Statistics
| Revision:

root / branches / v2_0_0_prep / extensions / extGPE-gvSIG / src / org / gvsig / fmap / dal / store / gpe / GPEStoreParameters.java @ 38564

History | View | Annotate | Download (4.06 KB)

1 27499 jpiera
/* gvSIG. Geographic Information System of the Valencian Government
2 34026 jpiera
 *
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 27499 jpiera
23
/*
24 34026 jpiera
 * AUTHORS (In addition to CIT):
25
 * 2009 {Iver T.I.}   {Task}
26
 */
27
28 27499 jpiera
package org.gvsig.fmap.dal.store.gpe;
29
30
import java.io.File;
31
32 30752 jpiera
import org.cresques.cts.IProjection;
33 27499 jpiera
import org.gvsig.fmap.dal.DataStoreParameters;
34 32953 cordinyana
import org.gvsig.fmap.dal.FileHelper;
35 27499 jpiera
import org.gvsig.fmap.dal.serverexplorer.filesystem.FilesystemStoreParameters;
36
import org.gvsig.fmap.dal.spi.AbstractDataParameters;
37 32953 cordinyana
import org.gvsig.fmap.dal.spi.DataStoreProviderServices;
38 34026 jpiera
import org.gvsig.fmap.geom.primitive.Envelope;
39 27499 jpiera
import org.gvsig.tools.dynobject.DelegatedDynObject;
40 34130 jpiera
import org.gvsig.tools.dynobject.DynStruct;
41 27499 jpiera
42
/**
43
 * @author <a href="mailto:jpiera@gvsig.org">Jorge Piera</a>
44
 */
45
public class GPEStoreParameters extends AbstractDataParameters implements
46
DataStoreParameters, FilesystemStoreParameters {
47 32953 cordinyana
48 34026 jpiera
    public static final String PARAMETERS_DEFINITION_NAME = "GPEStoreParameters";
49 32953 cordinyana
50 34026 jpiera
    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 27499 jpiera
54 34026 jpiera
    private DelegatedDynObject parameters;
55 32953 cordinyana
56 34026 jpiera
    public GPEStoreParameters() {
57
        this(PARAMETERS_DEFINITION_NAME);
58
    }
59 31022 cordinyana
60 34026 jpiera
    protected GPEStoreParameters(String parametersDefinitionName) {
61
        this(parametersDefinitionName, GPEStoreProvider.NAME);
62
    }
63 27499 jpiera
64 34026 jpiera
    public GPEStoreParameters(String parametersDefinitionName, String name) {
65
        super();
66
        this.parameters = (DelegatedDynObject) FileHelper.newParameters(parametersDefinitionName);
67 34113 jpiera
        this.setDynValue(DataStoreProviderServices.PROVIDER_PARAMTER_NAME, name);
68 34026 jpiera
    }
69 27499 jpiera
70 34130 jpiera
    protected static void registerParametersDefinition(){
71
        DynStruct dynStruct = FileHelper.registerParametersDefinition(
72
            GPEStoreParameters.PARAMETERS_DEFINITION_NAME,
73
            GPEStoreParameters.class, "GPEParameters.xml");
74
        dynStruct.addDynFieldObject("Envelope").setClassOfValue(Envelope.class).setMandatory(false);
75
    }
76
77 34026 jpiera
    protected DelegatedDynObject getDelegatedDynObject() {
78
        return parameters;
79
    }
80 27499 jpiera
81 34026 jpiera
    public String getDataStoreName() {
82
        return GPEStoreProvider.NAME;
83
    }
84 27499 jpiera
85 34026 jpiera
    public String getDescription() {
86
        return GPEStoreProvider.DESCRIPTION;
87
    }
88 27499 jpiera
89 34026 jpiera
    public boolean isValid() {
90
        return (this.getFile() != null);
91
    }
92
93
    public File getFile() {
94
        return (File) this.getDynValue(FILE_PARAMETER_NAME);
95
    }
96
97
    public void setFile(File file) {
98
        this.setDynValue(FILE_PARAMETER_NAME, file);
99
    }
100
101
    public String getFileName() {
102
        return this.getFile().getAbsolutePath();
103
    }
104
105
    public void setFileName(String fileName) {
106
        this.setDynValue(FILE_PARAMETER_NAME, fileName);
107
    }
108
109
    public IProjection getCRS() {
110
        return (IProjection) this.getDynValue(CRS_PARAMETER_NAME);
111
    }
112
113
    public void setCRS(IProjection srs) {
114
        this.setDynValue(CRS_PARAMETER_NAME, srs);
115
    }
116
117
    public void setCRS(String srs) {
118
        this.setDynValue(CRS_PARAMETER_NAME, srs);
119
    }
120
121
    public Envelope getEnvelope() {
122
        return (Envelope) this.getDynValue(ENVELOPE_PARAMETER_NAME);
123
    }
124 34130 jpiera
125 34026 jpiera
    public void setEnvelope(Envelope envelope) {
126
        this.setDynValue(ENVELOPE_PARAMETER_NAME, envelope);
127
    }
128 34130 jpiera
}