root / trunk / extensions / extRemoteSensing / src / org / gvsig / remotesensing / profiles / gui / ProfileDialog.java @ 24986
History | View | Annotate | Download (4.69 KB)
1 | 19683 | amunoz | /* 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 | 21151 | amunoz | import org.gvsig.fmap.raster.layers.FLyrRasterSE; |
48 | 19683 | amunoz | import org.gvsig.gui.beans.buttonspanel.ButtonsPanel; |
49 | import org.gvsig.gui.beans.buttonspanel.ButtonsPanelEvent; |
||
50 | import org.gvsig.gui.beans.buttonspanel.ButtonsPanelListener; |
||
51 | |||
52 | import com.iver.andami.PluginServices; |
||
53 | import com.iver.andami.ui.mdiManager.IWindow; |
||
54 | import com.iver.andami.ui.mdiManager.IWindowListener; |
||
55 | import com.iver.andami.ui.mdiManager.WindowInfo; |
||
56 | import com.iver.cit.gvsig.fmap.MapControl; |
||
57 | 19729 | amunoz | import com.iver.cit.gvsig.fmap.layers.GraphicLayer; |
58 | 19683 | amunoz | import com.iver.cit.gvsig.project.documents.view.gui.View; |
59 | |||
60 | /**
|
||
61 | * Dialogo para los diagramas de Profiles.
|
||
62 | *
|
||
63 | * @author Alejandro Mu?oz Sanchez (alejandro.munoz@uclm.es)
|
||
64 | * @version 11/12/2007
|
||
65 | *
|
||
66 | **/
|
||
67 | |||
68 | public class ProfileDialog extends JPanel implements IWindow, IWindowListener, ButtonsPanelListener { |
||
69 | |||
70 | private static final long serialVersionUID = 2847035927527203595L; |
||
71 | 19729 | amunoz | private ProfilePanel profilePanel = null; |
72 | 19683 | amunoz | private MapControl mapControl = null; |
73 | private String previousTool = null; |
||
74 | 21151 | amunoz | private FLyrRasterSE fLayer= null; |
75 | 19683 | amunoz | |
76 | /**
|
||
77 | * Constructor
|
||
78 | * @param width Ancho del panel
|
||
79 | * @param height Alto del panel
|
||
80 | */
|
||
81 | 21151 | amunoz | public ProfileDialog(int width, int height, View view, FLyrRasterSE fLayer) { |
82 | 19683 | amunoz | this.setSize(width, height);
|
83 | this.setLayout(new BorderLayout()); |
||
84 | 21151 | amunoz | this.fLayer= fLayer;
|
85 | 19683 | amunoz | mapControl = view.getMapControl(); |
86 | 19729 | amunoz | this.add(getProfilePanel(), BorderLayout.CENTER); |
87 | 19683 | amunoz | previousTool = mapControl.getCurrentTool(); |
88 | } |
||
89 | |||
90 | |||
91 | public WindowInfo getWindowInfo() {
|
||
92 | 20304 | amunoz | WindowInfo m_viewinfo = new WindowInfo(WindowInfo.PALETTE);
|
93 | 21151 | amunoz | if(fLayer != null) |
94 | m_viewinfo.setAdditionalInfo(fLayer.getName()); |
||
95 | m_viewinfo.setTitle(PluginServices.getText(this, "perfiles_imagen")+" - "+m_viewinfo.getAdditionalInfo()); |
||
96 | 19683 | amunoz | m_viewinfo.setHeight(this.getHeight());
|
97 | m_viewinfo.setWidth(this.getWidth());
|
||
98 | return m_viewinfo;
|
||
99 | } |
||
100 | |||
101 | public void actionButtonPressed(ButtonsPanelEvent e) { |
||
102 | // Al pulsar Cancelar la ventana se cierra y se refresca la vista
|
||
103 | if (e.getButton() == ButtonsPanel.BUTTON_CANCEL) {
|
||
104 | close(); |
||
105 | } |
||
106 | |||
107 | // Al pulsar Aceptar simplemente la ventana se cierra
|
||
108 | if (e.getButton() == ButtonsPanel.BUTTON_ACCEPT) {
|
||
109 | close(); |
||
110 | } |
||
111 | } |
||
112 | |||
113 | /**
|
||
114 | * Acciones a ejecutar cuando se cancela
|
||
115 | */
|
||
116 | public void close() { |
||
117 | try {
|
||
118 | PluginServices.getMDIManager().closeWindow(this);
|
||
119 | } catch (ArrayIndexOutOfBoundsException e) { |
||
120 | //Si la ventana no se puede eliminar no hacemos nada
|
||
121 | } |
||
122 | } |
||
123 | |||
124 | /** Recupera la herramienta previa seleccionada */
|
||
125 | public void setPreviousTool(){ |
||
126 | if (previousTool!=null) |
||
127 | 19729 | amunoz | getProfilePanel().getMapControl().setTool(previousTool); |
128 | 19683 | amunoz | } |
129 | |||
130 | public void windowActivated() { |
||
131 | |||
132 | } |
||
133 | |||
134 | 20304 | amunoz | /**
|
135 | * M?todo que realiza acciones al cerrar el dialogo como eliminar los graphis
|
||
136 | * de la vista
|
||
137 | * */
|
||
138 | 19683 | amunoz | public void windowClosed() { |
139 | 19729 | amunoz | GraphicLayer graphicLayer = mapControl.getMapContext().getGraphicsLayer(); |
140 | graphicLayer.clearAllGraphics(); |
||
141 | graphicLayer.clearSymbolsGraphics(); |
||
142 | getProfilePanel().getMapControl().rePaintDirtyLayers(); |
||
143 | 19683 | amunoz | setPreviousTool(); |
144 | } |
||
145 | |||
146 | |||
147 | /**
|
||
148 | 19729 | amunoz | * @return ProfilePanel. Panel principal
|
149 | 19683 | amunoz | * */
|
150 | 19729 | amunoz | public ProfilePanel getProfilePanel() {
|
151 | if (profilePanel == null){ |
||
152 | profilePanel = new ProfilePanel(this); |
||
153 | profilePanel.addButtonPressedListener(this);
|
||
154 | 19683 | amunoz | } |
155 | 19729 | amunoz | return profilePanel;
|
156 | 19683 | amunoz | } |
157 | |||
158 | |||
159 | public MapControl getMapControl() {
|
||
160 | return mapControl;
|
||
161 | } |
||
162 | 21151 | amunoz | |
163 | public FLyrRasterSE getFlayer(){
|
||
164 | return fLayer;
|
||
165 | } |
||
166 | 24986 | jcampos | |
167 | |||
168 | public Object getWindowProfile() { |
||
169 | return WindowInfo.PROPERTIES_PROFILE;
|
||
170 | } |
||
171 | 19683 | amunoz | } |