Statistics
| Revision:

svn-gvsig-desktop / trunk / extensions / extGeoreferencing / src / com / iver / cit / gvsig / gui / toc / GeoRasterTocMenuEntry.java @ 3102

History | View | Annotate | Download (4.39 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
import com.iver.cit.gvsig.gui.wizards.WizardListenerSupport;
59

    
60
/**
61
 * Cambia las propiedades de la conexi?n al servidor WCS.
62
 * 
63
 * @author Nacho Brodin brodin_ign@gva.es
64
 */
65
public class GeoRasterTocMenuEntry  extends TocMenuEntry{
66
        private JMenuItem propsMenuItem;
67
        private FLayer lyr = null;
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
                
97
                PluginServices.getMainFrame().enableControls();
98
                
99
               //Modificamos el nombre de la capa
100
                if ((lyr instanceof FLyrGeoRaster)){
101
                        lyrGeoRaster = (FLyrGeoRaster)lyr;
102
                        lyrGeoRaster.setName("*"+lyrGeoRaster.getName());
103
                        lyrGeoRaster.setActive(true);
104
                        geoDialog = lyrGeoRaster.getGeoDialog();
105
                        geoDialog.getSelectPointsPanel().resetControls(false);
106
                        geoDialog.getSelectPointsPanel().getTableControlerPanel().getCPoint().removeAllItems();
107
                        
108
                        //Salvamos el estado actual de la capa por si se cancela.
109
                if(lyrGeoRaster.getFLyrPoints() != null)
110
                        lyrGeoRaster.getFLyrPoints().saveState();
111
                
112
                        //Cargamos la capa de puntos y los puntos desde la capa en el cuadro.
113
                geoDialog.getSelectPointsPanel().loadFromLyrPoints(lyrGeoRaster.getFLyrPoints());                
114
                }
115
                                
116
                //Lanzamos el dialogo 
117
                JInternalFrame panel = new JInternalFrame();
118
                panel.addInternalFrameListener(new com.iver.cit.gvsig.gui.toolListeners.GeoRasterFrameListener());
119
        panel.setClosable(true);
120
        panel.setResizable(true);
121
        panel.setTitle(PluginServices.getText(this,"georreferenciar"));
122
        panel.getContentPane().add(geoDialog);
123
        geoDialog.setFrame(panel);
124
        
125
        MDIFrame mainFrame = (MDIFrame) PluginServices.getMainFrame();
126
        JLayeredPane lyrPane = mainFrame.getLayeredPane();
127
        lyrPane.add(panel, JDesktopPane.PALETTE_LAYER);
128
        panel.pack();
129
        panel.setSize(geoDialog.getWidth(), geoDialog.getHeight() + 10);
130
        panel.show();
131
        
132
        PluginServices.getMainFrame().enableControls();
133
             
134
        }
135
        
136
        
137
}