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
/* 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
import org.gvsig.fmap.dal.DataStoreParameters;
34
import org.gvsig.fmap.dal.FileHelper;
35
import org.gvsig.fmap.dal.serverexplorer.filesystem.FilesystemStoreParameters;
36
import org.gvsig.fmap.dal.spi.AbstractDataParameters;
37
import org.gvsig.fmap.dal.spi.DataStoreProviderServices;
38
import org.gvsig.fmap.geom.primitive.Envelope;
39
import org.gvsig.tools.dynobject.DelegatedDynObject;
40
import org.gvsig.tools.dynobject.DynStruct;
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
        this.setDynValue(DataStoreProviderServices.PROVIDER_PARAMTER_NAME, name);       
68
    }
69

    
70
    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
    protected DelegatedDynObject getDelegatedDynObject() {
78
        return parameters;
79
    }
80

    
81
    public String getDataStoreName() {
82
        return GPEStoreProvider.NAME;
83
    }
84

    
85
    public String getDescription() {
86
        return GPEStoreProvider.DESCRIPTION;
87
    }
88

    
89
    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

    
125
    public void setEnvelope(Envelope envelope) {
126
        this.setDynValue(ENVELOPE_PARAMETER_NAME, envelope);
127
    }
128
}