Statistics
| Revision:

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

History | View | Annotate | Download (4.17 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
                
97
                PluginServices.getMainFrame().enableControls();
98
                View vista = (View) PluginServices.getMDIManager().getActiveView();
99
                MapControl mapCtrl = vista.getMapControl();
100
                
101
               //Modificamos el nombre de la capa
102
                if ((lyr instanceof FLyrGeoRaster)){
103
                        lyrGeoRaster = (FLyrGeoRaster)lyr;
104
                        lyrGeoRaster.setName("*"+lyrGeoRaster.getName());
105
                        lyrGeoRaster.setActive(true);
106
                        geoDialog = lyrGeoRaster.getGeoDialog();
107
                        geoDialog.getSelectPointsPanel().resetControls(false);
108
                        geoDialog.getSelectPointsPanel().getTableControlerPanel().getCPoint().removeAllItems();
109
                        
110
                        //Cargamos la capa de puntos y los puntos desde la capa en el cuadro.
111
                geoDialog.getSelectPointsPanel().loadFromLyrPoints(lyrGeoRaster.getFLyrPoints());
112
                }
113
                                
114
                //Lanzamos el dialogo 
115
                JInternalFrame panel = new JInternalFrame();
116
                panel.addInternalFrameListener(new com.iver.cit.gvsig.gui.toolListeners.GeoRasterFrameListener());
117
        panel.setClosable(true);
118
        panel.setSize(geoDialog.getWidth(), geoDialog.getHeight() + 10);
119
        panel.setTitle(PluginServices.getText(this,"georreferenciar"));
120
        panel.getContentPane().add(geoDialog);
121
        geoDialog.setFrame(panel);
122
        
123
        MDIFrame mainFrame = (MDIFrame) PluginServices.getMainFrame();
124
        JLayeredPane lyrPane = mainFrame.getLayeredPane();
125
        lyrPane.add(panel, JDesktopPane.PALETTE_LAYER);
126
        panel.pack();
127
        panel.show();
128
        
129
        }
130
}