root / trunk / extensions / extRasterTools-SE / src / org / gvsig / rastertools / reproject / ui / LayerReprojectPanel.java @ 20856
History | View | Annotate | Download (5.62 KB)
1 |
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
|
---|---|
2 |
*
|
3 |
* Copyright (C) 2007 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 |
package org.gvsig.rastertools.reproject.ui; |
20 |
|
21 |
import java.awt.GridBagConstraints; |
22 |
|
23 |
import javax.swing.BorderFactory; |
24 |
import javax.swing.JPanel; |
25 |
|
26 |
import org.cresques.cts.IProjection; |
27 |
import org.gvsig.crs.ICrs; |
28 |
import org.gvsig.crs.repository.EpsgRepository; |
29 |
import org.gvsig.fmap.raster.layers.FLyrRasterSE; |
30 |
import org.gvsig.gui.beans.buttonspanel.ButtonsPanel; |
31 |
import org.gvsig.gui.beans.buttonspanel.ButtonsPanelEvent; |
32 |
import org.gvsig.gui.beans.defaultbuttonspanel.DefaultButtonsPanel; |
33 |
import org.gvsig.raster.beans.createlayer.CreateLayerPanel; |
34 |
import org.gvsig.raster.beans.createlayer.SelectDirectoryPanel; |
35 |
|
36 |
import com.iver.andami.PluginServices; |
37 |
import com.iver.andami.ui.mdiManager.IWindow; |
38 |
import com.iver.andami.ui.mdiManager.WindowInfo; |
39 |
|
40 |
/**
|
41 |
* Panel para la reproyecci?n de capas cargadas.
|
42 |
* 28/04/2008
|
43 |
* @author Nacho Brodin nachobrodin@gmail.com
|
44 |
*/
|
45 |
public class LayerReprojectPanel extends DefaultButtonsPanel implements IWindow { |
46 |
private static final long serialVersionUID = 1L; |
47 |
private CreateLayerPanel createLayerPanel = null; |
48 |
private JPanel nameFile = null; |
49 |
private ProjectionChooserPanel projectionSelector = null; |
50 |
private int w = 420; |
51 |
private int h = 290; |
52 |
private IProjection proj = null; |
53 |
private SelectDirectoryPanel dirPanel = null; |
54 |
private JPanel filePanel = null; |
55 |
|
56 |
/**
|
57 |
* Constructor
|
58 |
*/
|
59 |
public LayerReprojectPanel(FLyrRasterSE lyr) {
|
60 |
proj = lyr.getProjection(); |
61 |
getButtonsPanel().getButton(ButtonsPanel.BUTTON_APPLY).setVisible(true);
|
62 |
new LayerReprojectListener(lyr, this); |
63 |
|
64 |
init(); |
65 |
} |
66 |
|
67 |
/**
|
68 |
* Inicializaci?n de los componentes gr?ficos.
|
69 |
*/
|
70 |
private void init() { |
71 |
java.awt.GridBagConstraints gbc; |
72 |
setLayout(new java.awt.GridBagLayout());
|
73 |
|
74 |
gbc = new java.awt.GridBagConstraints();
|
75 |
gbc.gridx = 0;
|
76 |
gbc.gridy = 0;
|
77 |
gbc.weightx = 1D;
|
78 |
gbc.fill = GridBagConstraints.HORIZONTAL;
|
79 |
gbc.anchor = GridBagConstraints.WEST;
|
80 |
gbc.insets = new java.awt.Insets(0, 0, 0, 5); |
81 |
add(getProjectionSelector(), gbc); |
82 |
|
83 |
gbc.gridy = 1;
|
84 |
//add(getCreateLayerPanel(), gbc);
|
85 |
|
86 |
gbc.gridy = 2;
|
87 |
add(getFilePanel(), gbc); |
88 |
} |
89 |
|
90 |
/**
|
91 |
* Obtiene el panel de destino de fichero y nombre de capa
|
92 |
* @return JPanel
|
93 |
*/
|
94 |
public JPanel getFilePanel() { |
95 |
if(filePanel == null) { |
96 |
filePanel = new JPanel(); |
97 |
filePanel.setBorder(BorderFactory.createTitledBorder("dest_file")); |
98 |
filePanel.setLayout(new java.awt.GridBagLayout());
|
99 |
|
100 |
GridBagConstraints gbc = new java.awt.GridBagConstraints(); |
101 |
gbc.gridx = 0;
|
102 |
gbc.gridy = 0;
|
103 |
gbc.weightx = 1D;
|
104 |
gbc.fill = GridBagConstraints.HORIZONTAL;
|
105 |
gbc.anchor = GridBagConstraints.WEST;
|
106 |
gbc.insets = new java.awt.Insets(0, 0, 0, 5); |
107 |
filePanel.add(getNameFilePanel(), gbc); |
108 |
|
109 |
gbc.gridy = 1;
|
110 |
filePanel.add(getDirPanel(), gbc); |
111 |
} |
112 |
return filePanel;
|
113 |
} |
114 |
|
115 |
/**
|
116 |
* Obtiene el panel para la selecci?n de directorios
|
117 |
* @return
|
118 |
*/
|
119 |
public JPanel getDirPanel() { |
120 |
if(dirPanel == null) { |
121 |
dirPanel = new SelectDirectoryPanel();
|
122 |
} |
123 |
return dirPanel;
|
124 |
} |
125 |
|
126 |
/**
|
127 |
* Obtiene el desplegable con la lista de capas
|
128 |
* @return JComboBox
|
129 |
*/
|
130 |
public CreateLayerPanel getCreateLayerPanel() {
|
131 |
if(createLayerPanel == null) { |
132 |
createLayerPanel = new CreateLayerPanel();
|
133 |
//createLayerPanel.setBorder(BorderFactory.createTitledBorder("layer"));
|
134 |
} |
135 |
return createLayerPanel;
|
136 |
} |
137 |
|
138 |
/**
|
139 |
* Obtiene el desplegable con la lista de capas
|
140 |
* @return JComboBox
|
141 |
*/
|
142 |
public JPanel getNameFilePanel() { |
143 |
if(nameFile == null) { |
144 |
nameFile = getCreateLayerPanel().getFileNamePanel(); |
145 |
} |
146 |
return nameFile;
|
147 |
} |
148 |
|
149 |
/**
|
150 |
* Obtiene el bot?n que lanza el panel de selecci?n de proyecciones.
|
151 |
* @return
|
152 |
*/
|
153 |
public ProjectionChooserPanel getProjectionSelector() {
|
154 |
if(projectionSelector == null) { |
155 |
EpsgRepository epsgRep = new EpsgRepository();
|
156 |
ICrs crs = null;
|
157 |
try {
|
158 |
crs = epsgRep.getCrs("23030");
|
159 |
} catch (NumberFormatException ex) { |
160 |
return null; |
161 |
} |
162 |
projectionSelector = new ProjectionChooserPanel(proj);
|
163 |
projectionSelector.setBorder(BorderFactory.createTitledBorder("dest_proj")); |
164 |
//projectionSelector.
|
165 |
//((CRSMainPanel)projectionSelector.getContentPanel()).getJButtonAccept().setVisible(false);
|
166 |
//((CRSMainPanel)projectionSelector.getContentPanel()).getJButtonCancel().setVisible(false);
|
167 |
} |
168 |
return projectionSelector;
|
169 |
} |
170 |
|
171 |
/* (non-Javadoc)
|
172 |
* @see com.iver.andami.ui.mdiManager.View#getViewInfo()
|
173 |
*/
|
174 |
public WindowInfo getWindowInfo() {
|
175 |
WindowInfo m_viewinfo = new WindowInfo(WindowInfo.MODALDIALOG | WindowInfo.RESIZABLE);
|
176 |
m_viewinfo.setTitle(PluginServices.getText(this, "capa_a_reproyectar")); |
177 |
m_viewinfo.setWidth(w); |
178 |
m_viewinfo.setHeight(h); |
179 |
return m_viewinfo;
|
180 |
} |
181 |
|
182 |
public void actionButtonPressed(ButtonsPanelEvent e) { |
183 |
|
184 |
} |
185 |
} |