Statistics
| Revision:

gvsig-raster / org.gvsig.raster.tools / branches / org.gvsig.raster.tools_dataaccess_refactoring / org.gvsig.raster.tools.app.basic / src / main / java / org / gvsig / raster / tools / app / basic / raster / gui / wizard / PrepareDataStoreParametersVTR.java @ 2372

History | View | Annotate | Download (2.64 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
package org.gvsig.raster.tools.app.basic.raster.gui.wizard;
23

    
24
import java.io.File;
25
import java.util.Map;
26

    
27
import org.gvsig.app.prepareAction.PrepareContext;
28
import org.gvsig.app.prepareAction.PrepareDataStoreParameters;
29
import org.gvsig.fmap.dal.DataStoreParameters;
30
import org.gvsig.fmap.dal.coverage.RasterLocator;
31
import org.gvsig.fmap.dal.coverage.store.parameter.RasterFileStoreParameters;
32
import org.gvsig.raster.tools.app.basic.tool.raw.ui.main.OpenRawFileDefaultView;
33

    
34
/**
35
 * @author jmvivo
36
 *
37
 */
38
public class PrepareDataStoreParametersVTR implements
39
                PrepareDataStoreParameters {
40

    
41
        public DataStoreParameters prepare(DataStoreParameters storeParamters,
42
                        PrepareContext context) {
43
                if (!(storeParamters instanceof RasterFileStoreParameters))
44
                        return storeParamters;
45
                RasterFileStoreParameters rasterParams = (RasterFileStoreParameters) storeParamters;
46
                File file = rasterParams.getFile();
47
                if (RasterLocator.getManager().getFileUtils().getExtensionFromFileName(file.getAbsolutePath()).equals("raw")) {
48
                        OpenRawFileDefaultView view = new OpenRawFileDefaultView(file.getAbsolutePath());
49
                         file = view.getImageFile();
50
                }
51
                if (file == null)
52
                        return null;
53
                rasterParams.setFile(file);
54
                return rasterParams;
55
        }
56

    
57
        public String getDescription() {
58
                return "Prepare Raster VTR parameters";
59
        }
60

    
61
        public String getName() {
62
                return "PrepareVTR";
63
        }
64

    
65
        public Object create() {
66
                return this;
67
        }
68

    
69
        public Object create(Object[] args) {
70
                return this;
71
        }
72

    
73
        @SuppressWarnings("unchecked")
74
        public Object create(Map args) {
75
                return this;
76
        }
77

    
78
        public void post(DataStoreParameters storeParameters, PrepareContext context) {
79
                // TODO Auto-generated method stub
80
                
81
        }
82

    
83
        public void pre(DataStoreParameters storeParameters, PrepareContext context) {
84
                // TODO Auto-generated method stub
85
                
86
        }
87

    
88
}