Statistics
| Revision:

root / trunk / extensions / extGeoreferencing / src / com / iver / cit / gvsig / gui / toc / GeoRasterTocMenuEntry.java @ 3009

History | View | Annotate | Download (3.92 KB)

1
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
2
*
3
* Copyright (C) 2005 IVER T.I. and Generalitat Valenciana.
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., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
18
*
19
* For more information, contact:
20
*
21
*  Generalitat Valenciana
22
*   Conselleria d'Infraestructures i Transport
23
*   Av. Blasco Ib??ez, 50
24
*   46010 VALENCIA
25
*   SPAIN
26
*
27
*      +34 963862235
28
*   gvsig@gva.es
29
*      www.gvsig.gva.es
30
*
31
*    or
32
*
33
*   IVER T.I. S.A
34
*   Salamanca 50
35
*   46005 Valencia
36
*   Spain
37
*
38
*   +34 963163400
39
*   dac@iver.es
40
*/
41
package com.iver.cit.gvsig.gui.toc;
42

    
43
import java.awt.event.ActionEvent;
44

    
45
import javax.swing.JDesktopPane;
46
import javax.swing.JInternalFrame;
47
import javax.swing.JLayeredPane;
48
import javax.swing.JMenuItem;
49

    
50
import com.iver.andami.PluginServices;
51
import com.iver.andami.ui.mdiFrame.MDIFrame;
52
import com.iver.cit.gvsig.fmap.MapControl;
53
import com.iver.cit.gvsig.fmap.layers.FLayer;
54
import com.iver.cit.gvsig.fmap.layers.FLyrGeoRaster;
55
import com.iver.cit.gvsig.gui.View;
56
import com.iver.cit.gvsig.gui.Dialogs.GeoreferencingDialog;
57
import com.iver.cit.gvsig.gui.Panels.GeoRasterWizard;
58

    
59
/**
60
 * Cambia las propiedades de la conexi?n al servidor WCS.
61
 * 
62
 * @author Nacho Brodin brodin_ign@gva.es
63
 */
64
public class GeoRasterTocMenuEntry  extends TocMenuEntry{
65
        private JMenuItem propsMenuItem;
66
        private FLayer lyr = null;
67

    
68
        
69
        public void initialize(FPopupMenu m) {
70
                super.initialize(m);
71
                
72
                if (isTocItemBranch()) {
73
                        lyr = getNodeLayer();
74
                        
75
                    // Opcciones para capas FLyrGeoRaster
76
                    if ((lyr instanceof FLyrGeoRaster)) {
77
                            propsMenuItem = new JMenuItem(PluginServices.getText(this, "georaster_properties"));
78
                            getMenu().add( propsMenuItem );
79
                            propsMenuItem.setFont(FPopupMenu.theFont);
80
                            getMenu().setEnabled(true);
81
                            propsMenuItem.addActionListener(this);                           
82
                     }
83
                }
84
        }
85
                
86
        /**
87
         * Evento producido al pulsar la entrada de men? del toc
88
         * que muestra el cuadro con el dialogo de las propiedades 
89
         * de la capa de raster georreferenciada.
90
         */
91
        public void actionPerformed(ActionEvent e) {
92
                FLyrGeoRaster lyrGeoRaster = null;
93
               lyr = getNodeLayer();
94
               GeoreferencingDialog geoDialog = null;
95
               
96
               //Modificamos el nombre de la capa
97
                if ((lyr instanceof FLyrGeoRaster)){
98
                        lyrGeoRaster = (FLyrGeoRaster)lyr;
99
                        lyrGeoRaster.setName("*"+lyrGeoRaster.getName());
100
                        geoDialog = lyrGeoRaster.getGeoDialog();
101
                        //Cargamos la capa de puntos y los puntos desde la capa en el cuadro.
102
                geoDialog.getSelectPointsPanel().loadFromLyrPoints(lyrGeoRaster.getFLyrPoints());
103
                }
104
                
105
                //Lanzamos el dialogo 
106
                PluginServices.getMainFrame().enableControls();
107
                View vista = (View) PluginServices.getMDIManager().getActiveView();
108
                MapControl mapCtrl = vista.getMapControl();
109
                                
110
                JInternalFrame panel = new JInternalFrame();
111
                panel.addInternalFrameListener(new com.iver.cit.gvsig.gui.toolListeners.GeoRasterFrameListener());
112
        panel.setClosable(true);
113
        panel.setSize(400, 340);
114
        panel.setTitle(PluginServices.getText(this,"georreferenciar"));
115
        panel.getContentPane().add(geoDialog);
116
        geoDialog.setFrame(panel);
117
        
118
        MDIFrame mainFrame = (MDIFrame) PluginServices.getMainFrame();
119
        JLayeredPane lyrPane = mainFrame.getLayeredPane();
120
        lyrPane.add(panel, JDesktopPane.PALETTE_LAYER);       
121
        panel.show();   
122
        }
123
}