Statistics
| Revision:

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

History | View | Annotate | Download (3.84 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.Panels.GeoRasterWizard;
57

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

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