gvsig-gdal / branches / org.gvsig.gdal-2018a / org.gvsig.gdal.prov / org.gvsig.gdal.raster / org.gvsig.gdal.raster.provider / src / main / java / org / gvsig / raster / gdal / provider / RasterGdalStoreParameters.java @ 361
History | View | Annotate | Download (4.42 KB)
1 |
/* gvSIG. Desktop Geographic Information System.
|
---|---|
2 |
*
|
3 |
* Copyright ? 2007-2016 gvSIG Association
|
4 |
*
|
5 |
* This program is free software; you can redistribute it and/or
|
6 |
* modify it under the terms of the GNU General Public License
|
7 |
* as published by the Free Software Foundation; either version 2
|
8 |
* of the License, or (at your option) any later version.
|
9 |
*
|
10 |
* This program is distributed in the hope that it will be useful,
|
11 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
13 |
* GNU General Public License for more details.
|
14 |
*
|
15 |
* You should have received a copy of the GNU General Public License
|
16 |
* along with this program; if not, write to the Free Software
|
17 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
18 |
* MA 02110-1301, USA.
|
19 |
*
|
20 |
* For any additional information, do not hesitate to contact us
|
21 |
* at info AT gvsig.com, or visit our website www.gvsig.com.
|
22 |
*/
|
23 |
package org.gvsig.raster.gdal.provider; |
24 |
|
25 |
import java.util.List; |
26 |
|
27 |
import org.cresques.cts.IProjection; |
28 |
import org.slf4j.Logger; |
29 |
import org.slf4j.LoggerFactory; |
30 |
|
31 |
import org.gvsig.fmap.crs.CRSFactory; |
32 |
import org.gvsig.fmap.dal.DataStore; |
33 |
import org.gvsig.fmap.dal.FileHelper; |
34 |
import org.gvsig.fmap.dal.raster.OpenRasterStoreParameters; |
35 |
import org.gvsig.fmap.dal.spi.AbstractDataParameters; |
36 |
import org.gvsig.fmap.dal.spi.DataStoreProviderServices; |
37 |
import org.gvsig.tools.dynobject.DelegatedDynObject; |
38 |
|
39 |
/**
|
40 |
* Parameters to create a GDAL Provider
|
41 |
* @author dmartinezizquierdo
|
42 |
*
|
43 |
*/
|
44 |
public class RasterGdalStoreParameters extends AbstractDataParameters implements |
45 |
OpenRasterStoreParameters{ |
46 |
|
47 |
private static final Logger logger = LoggerFactory.getLogger(RasterGdalStoreParameters.class); |
48 |
|
49 |
/**
|
50 |
* Definition parameters name used to open a store
|
51 |
*/
|
52 |
public static final String PARAMETERS_DEFINITION_NAME = "RasterGdalStoreParameters"; |
53 |
//
|
54 |
// /**
|
55 |
// * Parameter name for the CRS projection
|
56 |
// */
|
57 |
// public static final String CRS_PARAMTER_NAME = "crs";
|
58 |
/**
|
59 |
* Parameter name for the wld params to geolocalize a raster
|
60 |
*/
|
61 |
public static final String WLD_PARAMS_NAME= "wldParams"; |
62 |
/**
|
63 |
* Name of the group for specific driver options defined in the XML
|
64 |
*/
|
65 |
public static final String OPEN_OPTIONS_GROUP = "OpenOptions"; |
66 |
/**
|
67 |
* Name for the tag with the valid extensions for the driver
|
68 |
*/
|
69 |
public static final String VALID_EXTENSIONS_TAG_NAME = "validExtensions"; |
70 |
/**
|
71 |
* Name for the tag with the wld extension for the driver, if it is known
|
72 |
* By default a .wld extension will be used if none is found
|
73 |
*/
|
74 |
public static final String WLD_EXTENSION_TAG_NAME = "wldExtension"; |
75 |
|
76 |
|
77 |
private DelegatedDynObject parameters;
|
78 |
|
79 |
/**
|
80 |
* Constructor
|
81 |
* @param parametersDefinitionName
|
82 |
* @param name
|
83 |
*/
|
84 |
public RasterGdalStoreParameters(String parametersDefinitionName, String name) { |
85 |
super();
|
86 |
this.parameters = (DelegatedDynObject) FileHelper.newParameters(parametersDefinitionName);
|
87 |
this.setDynValue(DataStoreProviderServices.PROVIDER_PARAMTER_NAME, name);
|
88 |
} |
89 |
|
90 |
@Override
|
91 |
public String getDataStoreName() { |
92 |
return (String) this.getDynValue(DataStoreProviderServices.PROVIDER_PARAMTER_NAME); |
93 |
} |
94 |
|
95 |
@Override
|
96 |
public boolean isValid() { |
97 |
return true; |
98 |
} |
99 |
|
100 |
@Override
|
101 |
public String getDescription() { |
102 |
return this.getDynClass().getDescription(); |
103 |
} |
104 |
|
105 |
|
106 |
/**
|
107 |
* Sets CRS
|
108 |
* @param crsCode
|
109 |
*/
|
110 |
public void setCRS(String crsCode) { |
111 |
IProjection crs=CRSFactory.getCRS(crsCode); |
112 |
setDynValue(DataStore.METADATA_CRS, crs); |
113 |
} |
114 |
|
115 |
/**
|
116 |
* Sets CRS
|
117 |
* @param crs
|
118 |
*/
|
119 |
public void setCRS(IProjection crs) { |
120 |
setDynValue(DataStore.METADATA_CRS, crs); |
121 |
} |
122 |
|
123 |
|
124 |
/**
|
125 |
* Gets CRS
|
126 |
* @return IProjection
|
127 |
*/
|
128 |
public IProjection getCRS() {
|
129 |
return (IProjection) getDynValue(DataStore.METADATA_CRS);
|
130 |
} |
131 |
|
132 |
/**
|
133 |
* Gets the 6 params of a WLD file as Strings.
|
134 |
*
|
135 |
* @return A list with WLD parameters
|
136 |
*/
|
137 |
public List<String> getWldParams() { |
138 |
return (List<String>) getDynValue(WLD_PARAMS_NAME); |
139 |
} |
140 |
|
141 |
/**
|
142 |
* Sets the params of a wld file
|
143 |
* @param wldParams
|
144 |
*/
|
145 |
public void setWldParams(List<String> wldParams){ |
146 |
setDynValue(WLD_PARAMS_NAME,wldParams); |
147 |
} |
148 |
|
149 |
@Override
|
150 |
protected DelegatedDynObject getDelegatedDynObject() {
|
151 |
return parameters;
|
152 |
} |
153 |
|
154 |
} |