root / branches / F2 / extensions / extJCRS / src / org / gvsig / crs / gui / CRSMainPanel.java @ 10786
History | View | Annotate | Download (9.01 KB)
1 |
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
|
---|---|
2 |
*
|
3 |
* Copyright (C) 2006 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.crs.gui; |
42 |
|
43 |
import java.awt.BorderLayout; |
44 |
import java.awt.CardLayout; |
45 |
import java.awt.Dimension; |
46 |
import java.awt.FlowLayout; |
47 |
import java.awt.GridLayout; |
48 |
import java.awt.event.ActionEvent; |
49 |
|
50 |
|
51 |
import javax.swing.BorderFactory; |
52 |
import javax.swing.JButton; |
53 |
import javax.swing.JComboBox; |
54 |
import javax.swing.JLabel; |
55 |
import javax.swing.JPanel; |
56 |
|
57 |
import org.cresques.cts.IProjection; |
58 |
import org.gvsig.crs.ICrs; |
59 |
import org.gvsig.crs.gui.panels.CrsRecentsPanel; |
60 |
import org.gvsig.crs.gui.panels.EPSGpanel; |
61 |
import org.gvsig.crs.gui.panels.ESRIpanel; |
62 |
import org.gvsig.crs.gui.panels.IAU2000panel; |
63 |
import org.gvsig.crs.gui.panels.NewCRSPanel; |
64 |
|
65 |
import com.iver.andami.PluginServices; |
66 |
import com.iver.andami.ui.mdiManager.IWindow; |
67 |
import com.iver.andami.ui.mdiManager.WindowInfo; |
68 |
|
69 |
/**
|
70 |
* Clase que genera el panel principal para la selecci?n de CRS
|
71 |
*
|
72 |
* @author Jos? Luis G?mez Mart?nez (jolugomar@gmail.com)
|
73 |
* @author Luisa Marina Fernandez (luisam.fernandez@uclm.es)
|
74 |
*
|
75 |
*/
|
76 |
public class CRSMainPanel extends JPanel implements IWindow { |
77 |
|
78 |
private static final long serialVersionUID = 1L; |
79 |
|
80 |
private JComboBox jComboOptions = null; |
81 |
private JPanel Combopanel = null; |
82 |
private JPanel USGSpanel = null; |
83 |
|
84 |
final String recientes = PluginServices.getText(this,"recientes"); |
85 |
final String epsg = PluginServices.getText(this,"EPSG"); |
86 |
final String usgs = PluginServices.getText(this,"USGS"); |
87 |
final String esri = PluginServices.getText(this,"ESRI"); |
88 |
final String iau2000 = PluginServices.getText(this,"IAU2000"); |
89 |
final String newCRS = PluginServices.getText(this,"nuevo_crs"); |
90 |
|
91 |
//String[] selection = {recientes, epsg, usgs, esri, iau2000, newCRS};
|
92 |
String[] selection = {recientes, epsg, iau2000,newCRS};//, esri}; |
93 |
|
94 |
boolean inAnApplet = true; |
95 |
public CrsRecentsPanel crsRecentsPanel = null; |
96 |
public EPSGpanel epsgPanel = null; |
97 |
public ESRIpanel esriPanel = null; |
98 |
public IAU2000panel iauPanel = null; |
99 |
public NewCRSPanel newCrsPanel=null; |
100 |
|
101 |
private JPanel jPanelMain = null; |
102 |
|
103 |
private JPanel jPanelButtons; |
104 |
private JButton jButtonAccept; |
105 |
private JButton jButonCancel; |
106 |
|
107 |
String dataSource = ""; |
108 |
|
109 |
public CRSMainPanel() {
|
110 |
crsRecentsPanel = new CrsRecentsPanel();
|
111 |
epsgPanel = new EPSGpanel();
|
112 |
esriPanel = new ESRIpanel();
|
113 |
iauPanel = new IAU2000panel();
|
114 |
newCrsPanel=new NewCRSPanel();
|
115 |
|
116 |
this.add(vista(), BorderLayout.NORTH); |
117 |
this.add(getJPanelButtons(), BorderLayout.SOUTH); |
118 |
|
119 |
setDataSource(selection[0]);
|
120 |
} |
121 |
|
122 |
public CRSMainPanel(int target) { |
123 |
crsRecentsPanel = new CrsRecentsPanel();
|
124 |
epsgPanel = new EPSGpanel();
|
125 |
esriPanel = new ESRIpanel();
|
126 |
iauPanel = new IAU2000panel();
|
127 |
newCrsPanel=new NewCRSPanel();
|
128 |
|
129 |
setDataSource(selection[0]);
|
130 |
} |
131 |
|
132 |
/**
|
133 |
* Panel con los controles necesarios para visualizarlo en el panel de
|
134 |
* selecci?n de CRS y transformaci?n de la capa a a?adir
|
135 |
* @return
|
136 |
*/
|
137 |
public JPanel capa(){ |
138 |
JPanel p = new JPanel(); |
139 |
//**p.setPreferredSize(new Dimension(550, 320));
|
140 |
//**p.setLayout(new GridLayout(0,1));
|
141 |
//p.setLayout(new FlowLayout(FlowLayout.LEFT,10,10));
|
142 |
p.setLayout(new BorderLayout()); |
143 |
p.setBorder(BorderFactory.createTitledBorder(PluginServices.getText(this,"seleccione_crs_capa")));//, |
144 |
/*BorderFactory.createEmptyBorder(1,1,1,1)),
|
145 |
p.getBorder()));*/
|
146 |
p.add(getCombopanel(),BorderLayout.NORTH);
|
147 |
p.add(getJPanelMain(),BorderLayout.CENTER);
|
148 |
return p;
|
149 |
} |
150 |
|
151 |
public JPanel vista(){ |
152 |
JPanel p = new JPanel(); |
153 |
//p.setPreferredSize(new Dimension(550, 320));
|
154 |
//p.setLayout(new GridLayout(0,1));
|
155 |
//p.setLayout(new FlowLayout(FlowLayout.LEFT,10,10));
|
156 |
/*p.setBorder(
|
157 |
BorderFactory.createCompoundBorder(
|
158 |
BorderFactory.createCompoundBorder(
|
159 |
BorderFactory.createTitledBorder(PluginServices.getText(this,"seleccione_crs_vista")),
|
160 |
BorderFactory.createEmptyBorder(2,2,2,2)),
|
161 |
p.getBorder()));*/
|
162 |
p.setLayout(new BorderLayout()); |
163 |
p.add(getCombopanel(),BorderLayout.NORTH);
|
164 |
p.add(getJPanelMain(),BorderLayout.CENTER);
|
165 |
return p;
|
166 |
} |
167 |
|
168 |
public JPanel getJPanelMain(){ |
169 |
if (jPanelMain == null){ |
170 |
jPanelMain = new JPanel(); |
171 |
jPanelMain.setLayout(new CardLayout()); |
172 |
jPanelMain.setPreferredSize(new Dimension(525, 230)); |
173 |
jPanelMain.add(recientes, crsRecentsPanel); |
174 |
jPanelMain.add(epsg, epsgPanel); |
175 |
jPanelMain.add(newCRS,newCrsPanel); |
176 |
jPanelMain.add(esri, esriPanel); |
177 |
jPanelMain.add(usgs, getJPanelUSGS()); |
178 |
jPanelMain.add(iau2000, iauPanel); |
179 |
} |
180 |
|
181 |
return jPanelMain;
|
182 |
} |
183 |
|
184 |
public JPanel getCombopanel(){ |
185 |
if (Combopanel == null){ |
186 |
Combopanel = new JPanel(); |
187 |
Combopanel.setLayout(new FlowLayout(FlowLayout.CENTER,10,5)); |
188 |
Combopanel.add(getJLabelTipo()); |
189 |
Combopanel.add(getJComboOptions()); |
190 |
} |
191 |
|
192 |
return Combopanel;
|
193 |
} |
194 |
|
195 |
private JLabel getJLabelTipo(){ |
196 |
JLabel jLabelTipo = new JLabel(); |
197 |
jLabelTipo.setPreferredSize(new Dimension(50,25)); |
198 |
jLabelTipo.setText(PluginServices.getText(this,"Tipo")+":"); |
199 |
return jLabelTipo;
|
200 |
} |
201 |
|
202 |
public JComboBox getJComboOptions(){ |
203 |
if (jComboOptions == null){ |
204 |
jComboOptions = new JComboBox(selection); |
205 |
jComboOptions.setPreferredSize(new Dimension(100,25)); |
206 |
jComboOptions.setEditable(false);
|
207 |
jComboOptions.setSelectedIndex(0);
|
208 |
} |
209 |
return jComboOptions;
|
210 |
} |
211 |
|
212 |
public JPanel getJPanelUSGS() { |
213 |
if (USGSpanel == null){ |
214 |
USGSpanel = new JPanel(); |
215 |
USGSpanel.setLayout(new GridLayout(3,4)); |
216 |
USGSpanel.setLayout(new FlowLayout(FlowLayout.LEFT,10,10)); |
217 |
USGSpanel.setPreferredSize(new Dimension(525, 400)); |
218 |
} |
219 |
return USGSpanel;
|
220 |
} |
221 |
|
222 |
private JPanel getJPanelButtons() { |
223 |
if(jPanelButtons == null) { |
224 |
jPanelButtons = new JPanel(); |
225 |
jPanelButtons.setLayout(new FlowLayout(FlowLayout.RIGHT)); |
226 |
//jPanelButtons.setPreferredSize(new Dimension(525,50));
|
227 |
jPanelButtons.add(getJButtonCancel(),null);
|
228 |
jPanelButtons.add(getJButtonAccept(),null);
|
229 |
} |
230 |
return jPanelButtons;
|
231 |
} |
232 |
|
233 |
public JButton getJButtonCancel() { |
234 |
if(jButonCancel == null) { |
235 |
jButonCancel = new JButton(); |
236 |
jButonCancel.setText(PluginServices.getText(this,"cancel")); |
237 |
jButonCancel.setPreferredSize(new Dimension(100,25)); |
238 |
jButonCancel.setMnemonic('C');
|
239 |
jButonCancel.setToolTipText("Cancel");
|
240 |
} |
241 |
return jButonCancel;
|
242 |
} |
243 |
|
244 |
public void cancelButton_actionPerformed(ActionEvent e) { |
245 |
PluginServices.getMDIManager().closeWindow(this);
|
246 |
} |
247 |
|
248 |
public JButton getJButtonAccept() { |
249 |
if(jButtonAccept == null) { |
250 |
jButtonAccept = new JButton(); |
251 |
jButtonAccept.setText(PluginServices.getText(this,"ok")); |
252 |
jButtonAccept.setPreferredSize(new Dimension(100,25)); |
253 |
jButtonAccept.setEnabled(false);
|
254 |
jButtonAccept.setMnemonic('A');
|
255 |
jButtonAccept.setToolTipText(PluginServices.getText(this,"ok")); |
256 |
} |
257 |
return jButtonAccept;
|
258 |
} |
259 |
|
260 |
public ICrs getProjection() {
|
261 |
if (getDataSource().equals(PluginServices.getText(this,"EPSG"))){ |
262 |
return epsgPanel.getProjection();
|
263 |
} |
264 |
else if (getDataSource().equals(PluginServices.getText(this,"IAU2000"))) { |
265 |
return iauPanel.getProjection();
|
266 |
} |
267 |
else if (getDataSource().equals(PluginServices.getText(this,"recientes"))) { |
268 |
return crsRecentsPanel.getProjection();
|
269 |
} |
270 |
else if (getDataSource().equals(PluginServices.getText(this,"ESRI"))) { |
271 |
return esriPanel.getProjection();
|
272 |
} |
273 |
return null; |
274 |
} |
275 |
|
276 |
public void setProjection(IProjection crs) { |
277 |
//setCrs((ICrs) crs);
|
278 |
} |
279 |
|
280 |
public void setDataSource(String sour){ |
281 |
dataSource = sour; |
282 |
} |
283 |
|
284 |
public String getDataSource(){ |
285 |
return dataSource;
|
286 |
} |
287 |
|
288 |
public WindowInfo getWindowInfo() {
|
289 |
WindowInfo m_viewinfo=new WindowInfo(WindowInfo.MODALDIALOG);
|
290 |
m_viewinfo.setTitle(PluginServices.getText(this, "seleccionar_crs")); |
291 |
return m_viewinfo;
|
292 |
} |
293 |
|
294 |
public EPSGpanel getEpsgPanel() {
|
295 |
return epsgPanel;
|
296 |
} |
297 |
|
298 |
|
299 |
|
300 |
public ESRIpanel getEsriPanel() {
|
301 |
return esriPanel;
|
302 |
} |
303 |
public IAU2000panel getIauPanel() {
|
304 |
return iauPanel;
|
305 |
} |
306 |
|
307 |
public CrsRecentsPanel getRecentsPanel() {
|
308 |
return crsRecentsPanel;
|
309 |
} |
310 |
|
311 |
public NewCRSPanel getNewCrsPanel() {
|
312 |
return newCrsPanel;
|
313 |
} |
314 |
|
315 |
} |