root / tags / v1_0_2_Build_916 / extensions / extGeoreferencing / src / org / gvsig / georeferencing / gui / listeners / GeoRasterFrameListener.java @ 12327
History | View | Annotate | Download (4.53 KB)
1 | 5217 | nacho | /* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
|
---|---|---|---|
2 | 5791 | nacho | *
|
3 | * Copyright (C) 2006 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 | 5217 | nacho | package org.gvsig.georeferencing.gui.listeners; |
20 | |||
21 | import javax.swing.event.InternalFrameEvent; |
||
22 | import javax.swing.event.InternalFrameListener; |
||
23 | |||
24 | import org.cresques.px.Extent; |
||
25 | import org.gvsig.georeferencing.toc.GeoRasterTocMenuEntry; |
||
26 | |||
27 | import com.iver.andami.PluginServices; |
||
28 | import com.iver.cit.gvsig.fmap.layers.FLayer; |
||
29 | 5241 | nacho | import com.iver.cit.gvsig.fmap.layers.FLyrGeoRaster; |
30 | 8765 | jjdelcerro | import com.iver.cit.gvsig.project.documents.view.gui.View; |
31 | 5217 | nacho | |
32 | /**
|
||
33 | * Clase que maneja los eventos del frame que contiene los paneles de georreferenciaci?n.
|
||
34 | * @author Nacho Brodin (brodin_ign@gva.es)
|
||
35 | */
|
||
36 | public class GeoRasterFrameListener implements InternalFrameListener { |
||
37 | |||
38 | /**
|
||
39 | * This is the default constructor
|
||
40 | */
|
||
41 | public GeoRasterFrameListener() {
|
||
42 | super();
|
||
43 | } |
||
44 | |||
45 | /**
|
||
46 | * Cuando cerramos la ventana de georreferenciaci?n se elimina la barra de herramientas
|
||
47 | * y se destruye la capa de puntos.
|
||
48 | */
|
||
49 | public void internalFrameClosing(InternalFrameEvent arg0) { |
||
50 | //Desbloqueamos la entrada de men? para que se pueda abrir otro cuadro
|
||
51 | GeoRasterTocMenuEntry.isOpen = true;
|
||
52 | |||
53 | //Anulamos todos los cambios cargando el extent de origen a la capa
|
||
54 | //Cambiamos el nombre a la capa de georreferenciaci?n y eliminamos la capa de puntos.
|
||
55 | |||
56 | View theView = null; |
||
57 | try{
|
||
58 | 6880 | cesar | theView = (View) PluginServices.getMDIManager().getActiveWindow();
|
59 | 5217 | nacho | }catch(ClassCastException exc){ |
60 | return;
|
||
61 | } |
||
62 | |||
63 | theView.getMapControl().setTool("zoomIn");
|
||
64 | |||
65 | //((GeoRasterTocMenuEntry)FPopupMenu.getEntry("GeoRasterTocMenuEntry")).getMenu().setEnabled(true);
|
||
66 | |||
67 | for(int i=0;i<theView.getMapControl().getMapContext().getLayers().getLayersCount();i++){ |
||
68 | FLayer lyr = theView.getMapControl().getMapContext().getLayers().getLayer(i); |
||
69 | |||
70 | if( lyr instanceof FLyrGeoRaster && |
||
71 | lyr.getName().startsWith("*")){
|
||
72 | |||
73 | //Recuperamos el estado inicial de la capa de puntos
|
||
74 | |||
75 | ((FLyrGeoRaster)lyr).getFLyrPoints().recoveryState(); |
||
76 | |||
77 | ((FLyrGeoRaster)lyr).getFLyrPoints().setVisible(false);
|
||
78 | |||
79 | lyr.setName(lyr.getName().substring(1, lyr.getName().length()));
|
||
80 | lyr.setActive(false);
|
||
81 | |||
82 | //Reponemos el extent inicial
|
||
83 | Extent initExtent = ((FLyrGeoRaster)lyr).getStackZoom().getInitExtent(); |
||
84 | if(initExtent != null){ |
||
85 | ((FLyrGeoRaster)theView.getMapControl().getMapContext().getLayers().getLayer(lyr.getName())).setAssignExtent(initExtent); |
||
86 | theView.getMapControl().getMapContext().invalidate(); |
||
87 | } |
||
88 | |||
89 | //Dejamos de pintar la capa de puntos
|
||
90 | ((FLyrGeoRaster)lyr).getFLyrPoints().setVisible(false);
|
||
91 | } |
||
92 | } |
||
93 | |||
94 | PluginServices.getMainFrame().enableControls(); |
||
95 | } |
||
96 | |||
97 | /* (non-Javadoc)
|
||
98 | * @see javax.swing.event.InternalFrameListener#internalFrameActivated(javax.swing.event.InternalFrameEvent)
|
||
99 | */
|
||
100 | public void internalFrameActivated(InternalFrameEvent arg0) { |
||
101 | |||
102 | } |
||
103 | |||
104 | /* (non-Javadoc)
|
||
105 | * @see javax.swing.event.InternalFrameListener#internalFrameClosed(javax.swing.event.InternalFrameEvent)
|
||
106 | */
|
||
107 | public void internalFrameClosed(InternalFrameEvent arg0) { |
||
108 | 8765 | jjdelcerro | |
109 | 5217 | nacho | } |
110 | |||
111 | /* (non-Javadoc)
|
||
112 | * @see javax.swing.event.InternalFrameListener#internalFrameDeactivated(javax.swing.event.InternalFrameEvent)
|
||
113 | */
|
||
114 | public void internalFrameDeactivated(InternalFrameEvent arg0) { |
||
115 | 8765 | jjdelcerro | |
116 | 5217 | nacho | } |
117 | |||
118 | /* (non-Javadoc)
|
||
119 | * @see javax.swing.event.InternalFrameListener#internalFrameDeiconified(javax.swing.event.InternalFrameEvent)
|
||
120 | */
|
||
121 | public void internalFrameDeiconified(InternalFrameEvent arg0) { |
||
122 | 8765 | jjdelcerro | |
123 | 5217 | nacho | } |
124 | |||
125 | /* (non-Javadoc)
|
||
126 | * @see javax.swing.event.InternalFrameListener#internalFrameIconified(javax.swing.event.InternalFrameEvent)
|
||
127 | */
|
||
128 | public void internalFrameIconified(InternalFrameEvent arg0) { |
||
129 | 8765 | jjdelcerro | |
130 | 5217 | nacho | } |
131 | |||
132 | /* (non-Javadoc)
|
||
133 | * @see javax.swing.event.InternalFrameListener#internalFrameOpened(javax.swing.event.InternalFrameEvent)
|
||
134 | */
|
||
135 | public void internalFrameOpened(InternalFrameEvent arg0) { |
||
136 | 8765 | jjdelcerro | |
137 | 5217 | nacho | } |
138 | } |