root / trunk / extensions / extRemoteSensing / src / org / gvsig / remotesensing / profiles / gui / ProfileDialog.java @ 19683
History | View | Annotate | Download (4.02 KB)
1 |
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
|
---|---|
2 |
*
|
3 |
* Copyright (C) 2007 Instituto de Desarrollo Regional 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 |
* Instituto de Desarrollo Regional (Universidad de Castilla La-Mancha)
|
34 |
* Campus Universitario s/n
|
35 |
* 02071 Alabacete
|
36 |
* Spain
|
37 |
*
|
38 |
* +34 967 599 200
|
39 |
*/
|
40 |
|
41 |
package org.gvsig.remotesensing.profiles.gui; |
42 |
|
43 |
import java.awt.BorderLayout; |
44 |
|
45 |
import javax.swing.JPanel; |
46 |
|
47 |
import org.gvsig.gui.beans.buttonspanel.ButtonsPanel; |
48 |
import org.gvsig.gui.beans.buttonspanel.ButtonsPanelEvent; |
49 |
import org.gvsig.gui.beans.buttonspanel.ButtonsPanelListener; |
50 |
|
51 |
import com.iver.andami.PluginServices; |
52 |
import com.iver.andami.ui.mdiManager.IWindow; |
53 |
import com.iver.andami.ui.mdiManager.IWindowListener; |
54 |
import com.iver.andami.ui.mdiManager.WindowInfo; |
55 |
import com.iver.cit.gvsig.fmap.MapControl; |
56 |
import com.iver.cit.gvsig.project.documents.view.gui.View; |
57 |
|
58 |
/**
|
59 |
* Dialogo para los diagramas de Profiles.
|
60 |
*
|
61 |
* @author Alejandro Mu?oz Sanchez (alejandro.munoz@uclm.es)
|
62 |
* @version 11/12/2007
|
63 |
*
|
64 |
**/
|
65 |
|
66 |
public class ProfileDialog extends JPanel implements IWindow, IWindowListener, ButtonsPanelListener { |
67 |
|
68 |
private static final long serialVersionUID = 2847035927527203595L; |
69 |
private ProfilePanel zProfilePanel = null; |
70 |
private MapControl mapControl = null; |
71 |
private String previousTool = null; |
72 |
|
73 |
/**
|
74 |
* Constructor
|
75 |
* @param width Ancho del panel
|
76 |
* @param height Alto del panel
|
77 |
*/
|
78 |
public ProfileDialog(int width, int height, View view) { |
79 |
this.setSize(width, height);
|
80 |
this.setLayout(new BorderLayout()); |
81 |
mapControl = view.getMapControl(); |
82 |
this.add(getZProfilePanel(), BorderLayout.CENTER); |
83 |
previousTool = mapControl.getCurrentTool(); |
84 |
} |
85 |
|
86 |
|
87 |
public WindowInfo getWindowInfo() {
|
88 |
WindowInfo m_viewinfo = new WindowInfo(WindowInfo.PALETTE);
|
89 |
m_viewinfo.setTitle(PluginServices.getText(this, "perfiles_imagen")); |
90 |
m_viewinfo.setHeight(this.getHeight());
|
91 |
m_viewinfo.setWidth(this.getWidth());
|
92 |
return m_viewinfo;
|
93 |
} |
94 |
|
95 |
public void actionButtonPressed(ButtonsPanelEvent e) { |
96 |
// Al pulsar Cancelar la ventana se cierra y se refresca la vista
|
97 |
if (e.getButton() == ButtonsPanel.BUTTON_CANCEL) {
|
98 |
close(); |
99 |
} |
100 |
|
101 |
// Al pulsar Aceptar simplemente la ventana se cierra
|
102 |
if (e.getButton() == ButtonsPanel.BUTTON_ACCEPT) {
|
103 |
close(); |
104 |
} |
105 |
} |
106 |
|
107 |
/**
|
108 |
* Acciones a ejecutar cuando se cancela
|
109 |
*/
|
110 |
public void close() { |
111 |
try {
|
112 |
PluginServices.getMDIManager().closeWindow(this);
|
113 |
} catch (ArrayIndexOutOfBoundsException e) { |
114 |
//Si la ventana no se puede eliminar no hacemos nada
|
115 |
} |
116 |
} |
117 |
|
118 |
/** Recupera la herramienta previa seleccionada */
|
119 |
public void setPreviousTool(){ |
120 |
if (previousTool!=null) |
121 |
getZProfilePanel().getMapControl().setTool(previousTool); |
122 |
} |
123 |
|
124 |
public void windowActivated() { |
125 |
|
126 |
} |
127 |
|
128 |
public void windowClosed() { |
129 |
getZProfilePanel().getMapControl().rePaintDirtyLayers(); |
130 |
setPreviousTool(); |
131 |
} |
132 |
|
133 |
|
134 |
/**
|
135 |
* @return scatterplotpanel
|
136 |
* */
|
137 |
public ProfilePanel getZProfilePanel() {
|
138 |
if (zProfilePanel == null){ |
139 |
zProfilePanel = new ProfilePanel(this); |
140 |
zProfilePanel.addButtonPressedListener(this);
|
141 |
} |
142 |
return zProfilePanel;
|
143 |
} |
144 |
|
145 |
|
146 |
public MapControl getMapControl() {
|
147 |
return mapControl;
|
148 |
} |
149 |
} |