Statistics
| Revision:

root / trunk / extensions / extGeoreferencing / src / com / iver / cit / gvsig / gui / toolListeners / GeoRasterFrameListener.java @ 3019

History | View | Annotate | Download (4.71 KB)

1 2998 nacho
/* 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 = (View) PluginServices.getMDIManager().getActiveView();
76
                FLyrPoints lyrPoints = null;
77
78
                for(int i=0;i<theView.getMapControl().getMapContext().getLayers().getLayersCount();i++){
79
                        FLayer lyr = theView.getMapControl().getMapContext().getLayers().getLayer(i);
80
                        if(        lyr instanceof FLyrGeoRaster &&
81
                                lyr.getName().startsWith("*") &&
82
                                lyr.isActive()){
83
                                lyr.setName(lyr.getName().substring(1, lyr.getName().length()));
84 3003 nacho
                                lyr.setActive(false);
85 3011 nacho
86
                                //Reponemos el extent inicial
87 2998 nacho
                                Extent initExtent = ((FLyrGeoRaster)lyr).getStackZoom().getInitExtent();
88
                                if(initExtent != null){
89
                                        ((FLyrGeoRaster)theView.getMapControl().getMapContext().getLayers().getLayer(lyr.getName())).setAssignExtent(initExtent);
90
                                        theView.getMapControl().getMapContext().invalidate();
91
                                }
92 3011 nacho
                                ((FLyrGeoRaster)lyr).getGeoDialog().getSelectPointsPanel().clearList();
93
94 2998 nacho
                        }
95 3011 nacho
                        System.out.println("ELIMINAR!!");
96
                        if(        lyr instanceof FLyrPoints){
97
                                System.out.println("ELIMINANDO "+lyr.getName());
98 2998 nacho
                                theView.getMapControl().getMapContext().getLayers().removeLayer(i);
99 3011 nacho
                        }
100 2998 nacho
                }
101
102
                PluginServices.getMainFrame().enableControls();
103
        }
104
105
        /* (non-Javadoc)
106
         * @see javax.swing.event.InternalFrameListener#internalFrameActivated(javax.swing.event.InternalFrameEvent)
107
         */
108
        public void internalFrameActivated(InternalFrameEvent arg0) {
109
                // TODO Auto-generated method stub
110
111
        }
112
113
        /* (non-Javadoc)
114
         * @see javax.swing.event.InternalFrameListener#internalFrameClosed(javax.swing.event.InternalFrameEvent)
115
         */
116
        public void internalFrameClosed(InternalFrameEvent arg0) {
117
                // TODO Auto-generated method stub
118
        }
119
120
        /* (non-Javadoc)
121
         * @see javax.swing.event.InternalFrameListener#internalFrameDeactivated(javax.swing.event.InternalFrameEvent)
122
         */
123
        public void internalFrameDeactivated(InternalFrameEvent arg0) {
124
                // TODO Auto-generated method stub
125
        }
126
127
        /* (non-Javadoc)
128
         * @see javax.swing.event.InternalFrameListener#internalFrameDeiconified(javax.swing.event.InternalFrameEvent)
129
         */
130
        public void internalFrameDeiconified(InternalFrameEvent arg0) {
131
                // TODO Auto-generated method stub
132
        }
133
134
        /* (non-Javadoc)
135
         * @see javax.swing.event.InternalFrameListener#internalFrameIconified(javax.swing.event.InternalFrameEvent)
136
         */
137
        public void internalFrameIconified(InternalFrameEvent arg0) {
138
                // TODO Auto-generated method stub
139
        }
140
141
        /* (non-Javadoc)
142
         * @see javax.swing.event.InternalFrameListener#internalFrameOpened(javax.swing.event.InternalFrameEvent)
143
         */
144
        public void internalFrameOpened(InternalFrameEvent arg0) {
145
                // TODO Auto-generated method stub
146
        }
147
}