Statistics
| Revision:

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

History | View | Annotate | Download (4.68 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.toolListeners;
42

    
43
import javax.swing.event.InternalFrameEvent;
44
import javax.swing.event.InternalFrameListener;
45

    
46
import org.cresques.px.Extent;
47

    
48
import com.iver.andami.PluginServices;
49
import com.iver.cit.gvsig.fmap.layers.FLayer;
50
import com.iver.cit.gvsig.fmap.layers.FLyrGeoRaster;
51
import com.iver.cit.gvsig.fmap.layers.FLyrPoints;
52
import com.iver.cit.gvsig.gui.View;
53

    
54
/**
55
* Clase que maneja los eventos del frame que contiene los paneles de georreferenciaci?n.
56
* @author Nacho Brodin (brodin_ign@gva.es)
57
*/
58
public class GeoRasterFrameListener implements InternalFrameListener {
59
                
60
        /**
61
         * This is the default constructor
62
         */
63
        public GeoRasterFrameListener() {
64
                super();
65
        }
66
        
67
        /**
68
         * Cuando cerramos la ventana de georreferenciaci?n se elimina la barra de herramientas
69
         * y se destruye la capa de puntos.
70
         */
71
        public void internalFrameClosing(InternalFrameEvent arg0) {
72

    
73
                //Anulamos todos los cambios cargando el extent de origen a la capa 
74
                //Cambiamos el nombre a la capa de georreferenciaci?n y eliminamos la capa de puntos.
75
                View theView = null;
76
                try{
77
                        theView = (View) PluginServices.getMDIManager().getActiveView();
78
                }catch(ClassCastException exc){
79
                        return;
80
                }
81
                                
82
                for(int i=0;i<theView.getMapControl().getMapContext().getLayers().getLayersCount();i++){
83
                        FLayer lyr = theView.getMapControl().getMapContext().getLayers().getLayer(i);
84
                        if(        lyr instanceof FLyrGeoRaster && 
85
                                lyr.getName().startsWith("*") &&
86
                                lyr.isActive()){
87
                                lyr.setName(lyr.getName().substring(1, lyr.getName().length()));
88
                                lyr.setActive(false);
89
                                
90
                                //Reponemos el extent inicial
91
                                Extent initExtent = ((FLyrGeoRaster)lyr).getStackZoom().getInitExtent();
92
                                if(initExtent != null){
93
                                        ((FLyrGeoRaster)theView.getMapControl().getMapContext().getLayers().getLayer(lyr.getName())).setAssignExtent(initExtent);
94
                                        theView.getMapControl().getMapContext().invalidate();
95
                                }
96
                                ((FLyrGeoRaster)lyr).getGeoDialog().getSelectPointsPanel().clearList();
97
                                
98
                        }
99
                        
100
                        if(        lyr instanceof FLyrPoints)
101
                                theView.getMapControl().getMapContext().getLayers().removeLayer(i);
102
                        
103
                        
104
                }
105
                
106
                PluginServices.getMainFrame().enableControls();
107
        }
108
        
109
        /* (non-Javadoc)
110
         * @see javax.swing.event.InternalFrameListener#internalFrameActivated(javax.swing.event.InternalFrameEvent)
111
         */
112
        public void internalFrameActivated(InternalFrameEvent arg0) {
113
                // TODO Auto-generated method stub
114

    
115
        }
116
        
117
        /* (non-Javadoc)
118
         * @see javax.swing.event.InternalFrameListener#internalFrameClosed(javax.swing.event.InternalFrameEvent)
119
         */
120
        public void internalFrameClosed(InternalFrameEvent arg0) {
121
                // TODO Auto-generated method stub
122
        }
123

    
124
        /* (non-Javadoc)
125
         * @see javax.swing.event.InternalFrameListener#internalFrameDeactivated(javax.swing.event.InternalFrameEvent)
126
         */
127
        public void internalFrameDeactivated(InternalFrameEvent arg0) {
128
                // TODO Auto-generated method stub
129
        }
130
        
131
        /* (non-Javadoc)
132
         * @see javax.swing.event.InternalFrameListener#internalFrameDeiconified(javax.swing.event.InternalFrameEvent)
133
         */
134
        public void internalFrameDeiconified(InternalFrameEvent arg0) {
135
                // TODO Auto-generated method stub
136
        }
137
        
138
        /* (non-Javadoc)
139
         * @see javax.swing.event.InternalFrameListener#internalFrameIconified(javax.swing.event.InternalFrameEvent)
140
         */
141
        public void internalFrameIconified(InternalFrameEvent arg0) {
142
                // TODO Auto-generated method stub
143
        }
144
        
145
        /* (non-Javadoc)
146
         * @see javax.swing.event.InternalFrameListener#internalFrameOpened(javax.swing.event.InternalFrameEvent)
147
         */
148
        public void internalFrameOpened(InternalFrameEvent arg0) {
149
                // TODO Auto-generated method stub
150
        }
151
}
152