Statistics
| Revision:

root / branches / v2_0_0_prep / extensions / extRasterTools-SE / src / org / gvsig / raster / gui / wizards / PrepareLayerAskCoordinates.java @ 31496

History | View | Annotate | Download (2.53 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.raster.gui.wizards;
29

    
30
import java.util.Map;
31

    
32
import org.gvsig.andami.PluginServices;
33
import org.gvsig.app.prepareAction.PrepareContextView;
34
import org.gvsig.app.prepareAction.PrepareLayer;
35
import org.gvsig.fmap.mapcontext.layers.FLayer;
36
import org.gvsig.fmap.raster.layers.FLyrRasterSE;
37
import org.gvsig.raster.util.RasterToolsUtil;
38
import org.gvsig.rastertools.RasterModule;
39
import org.gvsig.rastertools.geolocation.ui.GeoLocationOpeningRasterDialog;
40

    
41

    
42
public class PrepareLayerAskCoordinates implements PrepareLayer {
43

    
44

    
45
        public FLayer prepare(FLayer layer, PrepareContextView context) {
46
                if (!(layer instanceof FLyrRasterSE))
47
                        return layer;
48
                FLyrRasterSE lyrRaster = (FLyrRasterSE) layer;
49
                if (RasterModule.askCoordinates)
50
                        if(        lyrRaster.getFullEnvelope().getMinimum(0) == 0 &&
51
                                        lyrRaster.getFullEnvelope().getMinimum(1) == 0 &&
52
                                        lyrRaster.getFullEnvelope().getMaximum(0) == (lyrRaster).getPxWidth() &&
53
                                        lyrRaster.getFullEnvelope().getMaximum(1) == (lyrRaster).getPxHeight())
54
                                if(RasterToolsUtil.messageBoxYesOrNot(lyrRaster.getName() + "\n" + PluginServices.getText(this, "layer_without_georref"), null)) {
55
                                        GeoLocationOpeningRasterDialog gld = new GeoLocationOpeningRasterDialog(lyrRaster);
56
                                        PluginServices.getMDIManager().addWindow(gld);
57
                                }
58

    
59

    
60
                return lyrRaster;
61
        }
62

    
63
        public String getDescription() {
64
                return "Prepare Coordinates for Raster Layer";
65
        }
66

    
67
        public String getName() {
68
                return "PrepareRasterLayerCoordinates";
69
        }
70

    
71
        public Object create() {
72
                return this;
73
        }
74

    
75
        public Object create(Object[] args) {
76
                return this;
77
        }
78

    
79
        public Object create(Map args) {
80
                return this;
81
        }
82
}