svn-gvsig-desktop / tags / v1_1_Build_1014 / libraries / libJCRS / src / org / gvsig / crs / gui / panels / InfoCRSPanel.java @ 13593
History | View | Annotate | Download (12.1 KB)
1 | 8911 | jlgomez | /* 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 | 8594 | dguerrero | package org.gvsig.crs.gui.panels; |
42 | |||
43 | import java.awt.Dimension; |
||
44 | import java.awt.FlowLayout; |
||
45 | import java.awt.Font; |
||
46 | import java.awt.GridLayout; |
||
47 | import java.awt.event.ActionEvent; |
||
48 | import java.awt.event.ActionListener; |
||
49 | 13291 | jlgomez | import java.sql.ResultSet; |
50 | import java.sql.SQLException; |
||
51 | 8594 | dguerrero | |
52 | import javax.swing.JButton; |
||
53 | import javax.swing.JLabel; |
||
54 | import javax.swing.JPanel; |
||
55 | import javax.swing.JScrollPane; |
||
56 | import javax.swing.JTable; |
||
57 | import javax.swing.ListSelectionModel; |
||
58 | import javax.swing.table.DefaultTableModel; |
||
59 | |||
60 | import org.cresques.ui.DefaultDialogPanel; |
||
61 | 13291 | jlgomez | import org.gvsig.crs.EpsgConnection; |
62 | 8594 | dguerrero | import org.gvsig.crs.ICrs; |
63 | 13291 | jlgomez | import org.gvsig.crs.Query; |
64 | 8594 | dguerrero | |
65 | import com.iver.andami.PluginServices; |
||
66 | import com.iver.andami.ui.mdiManager.IWindow; |
||
67 | import com.iver.andami.ui.mdiManager.WindowInfo; |
||
68 | |||
69 | 8911 | jlgomez | /**
|
70 | * Clase que genera el panel de informaci?n del CRS seleccionado
|
||
71 | * en el caso del repositorio de la EPSG
|
||
72 | * @author Miguel Garc?a Jim?nez (garciajimenez.miguel@gmail.com)
|
||
73 | *
|
||
74 | */
|
||
75 | 8594 | dguerrero | public class InfoCRSPanel extends DefaultDialogPanel implements IWindow, ActionListener{ |
76 | |||
77 | private static final long serialVersionUID = 1L; |
||
78 | |||
79 | private JPanel panelLabels; |
||
80 | |||
81 | private JTable jTable; |
||
82 | public DefaultTableModel dtm = null; |
||
83 | private JScrollPane jScrollPane1 = null; |
||
84 | private JPanel jPanelbuttons; |
||
85 | private JButton jButtonOk; |
||
86 | |||
87 | private ICrs proj;
|
||
88 | |||
89 | private JLabel jLabelProjcs; |
||
90 | private JLabel jLabelGeogcs; |
||
91 | private JLabel jLabelDatum; |
||
92 | private JLabel jLabelSpheroid; |
||
93 | private JLabel jLabelPrimem; |
||
94 | private JLabel jLabelProjection; |
||
95 | private JLabel jLabelUnits; |
||
96 | private JLabel jLabelUnits_p; |
||
97 | private JLabel jLabelProjcsdinamic; |
||
98 | private JLabel jLabelGeogcsdinamic; |
||
99 | private JLabel jLabelDatumdinamic; |
||
100 | private JLabel jLabelSpheroiddinamic; |
||
101 | private JLabel jLabelPrimemdinamic; |
||
102 | private JLabel jLabelProjectiondinamic; |
||
103 | private JLabel jLabelUnitsdinamic; |
||
104 | private JLabel jLabelUnits_pdinamic; |
||
105 | |||
106 | 13398 | jlgomez | |
107 | 8594 | dguerrero | public InfoCRSPanel(ICrs p) {
|
108 | super(false); |
||
109 | proj = p; |
||
110 | inicializate(); |
||
111 | } |
||
112 | |||
113 | private void inicializate() { |
||
114 | this.add(getPanel(), null); |
||
115 | this.add(getJPanelButtons(),null); |
||
116 | } |
||
117 | |||
118 | private JPanel getPanel() { |
||
119 | if(panelLabels == null) { |
||
120 | panelLabels = new JPanel(); |
||
121 | panelLabels.setLayout(new GridLayout(6,4)); |
||
122 | panelLabels.setLayout(new FlowLayout(FlowLayout.LEADING,5,10)); |
||
123 | panelLabels.setPreferredSize(new Dimension(525, 300)); |
||
124 | panelLabels.add(getJLabelProjcs(),null);
|
||
125 | panelLabels.add(getJLabelProjcsDinamic(),null);
|
||
126 | panelLabels.add(getJLabelGeogcs(),null);
|
||
127 | panelLabels.add(getJLabelGeogcsDinamic(),null);
|
||
128 | panelLabels.add(getJLabelDatum(),null);
|
||
129 | panelLabels.add(getJLabelDatumDinamic(),null);
|
||
130 | panelLabels.add(getJLabelSpheroid(),null);
|
||
131 | panelLabels.add(getJLabelSpheroidDinamic(),null);
|
||
132 | panelLabels.add(getJLabelPrimen(),null);
|
||
133 | panelLabels.add(getJLabelPrimenDinamic(),null);
|
||
134 | panelLabels.add(getJLabelUnits(),null);
|
||
135 | panelLabels.add(getJLabelUnitsDinamic(),null);
|
||
136 | panelLabels.add(getJLabelProjection(),null);
|
||
137 | panelLabels.add(getJLabelProjectionDinamic(),null);
|
||
138 | panelLabels.add(getJLabelUnits_p(),null);
|
||
139 | panelLabels.add(getJLabelUnits_pDinamic(),null);
|
||
140 | panelLabels.add(getJScrollPane1(), null);
|
||
141 | } |
||
142 | return panelLabels;
|
||
143 | } |
||
144 | |||
145 | private JPanel getJPanelButtons() { |
||
146 | if(jPanelbuttons == null) { |
||
147 | jPanelbuttons = new JPanel(); |
||
148 | jPanelbuttons.setLayout(new FlowLayout(FlowLayout.RIGHT)); |
||
149 | jPanelbuttons.setPreferredSize(new Dimension(525,50)); |
||
150 | jPanelbuttons.add(getJButtonOk(),null);
|
||
151 | } |
||
152 | return jPanelbuttons;
|
||
153 | } |
||
154 | |||
155 | private JButton getJButtonOk() { |
||
156 | if(jButtonOk == null) { |
||
157 | jButtonOk = new JButton(); |
||
158 | jButtonOk.setText(PluginServices.getText(this,"ok")); |
||
159 | jButtonOk.setPreferredSize(new Dimension(100,25)); |
||
160 | jButtonOk.setMnemonic('O');
|
||
161 | jButtonOk.setToolTipText("Accept");
|
||
162 | jButtonOk.addActionListener(this);
|
||
163 | } |
||
164 | return jButtonOk;
|
||
165 | } |
||
166 | |||
167 | private JLabel getJLabelProjcs() { |
||
168 | if(jLabelProjcs == null) { |
||
169 | jLabelProjcs = new JLabel(); |
||
170 | jLabelProjcs.setPreferredSize(new Dimension(75,20)); |
||
171 | jLabelProjcs.setFont(new Font("Projcs:",Font.BOLD,10)); |
||
172 | 8665 | jlgomez | jLabelProjcs.setText(PluginServices.getText(this,"projcs")+":"); |
173 | 8594 | dguerrero | } |
174 | return jLabelProjcs;
|
||
175 | } |
||
176 | |||
177 | private JLabel getJLabelProjcsDinamic() { |
||
178 | if(jLabelProjcsdinamic == null) { |
||
179 | jLabelProjcsdinamic = new JLabel(); |
||
180 | jLabelProjcsdinamic.setPreferredSize(new Dimension(150,20)); |
||
181 | jLabelProjcsdinamic.setFont(new Font("",Font.ROMAN_BASELINE,10)); |
||
182 | jLabelProjcsdinamic.setText(proj.getCrsWkt().getProjcs()); |
||
183 | } |
||
184 | return jLabelProjcsdinamic;
|
||
185 | } |
||
186 | |||
187 | private JLabel getJLabelGeogcs() { |
||
188 | if(jLabelGeogcs == null) { |
||
189 | jLabelGeogcs = new JLabel(); |
||
190 | jLabelGeogcs.setPreferredSize(new Dimension(75,20)); |
||
191 | jLabelGeogcs.setFont(new Font("Geogcs:",Font.BOLD,10)); |
||
192 | 8665 | jlgomez | jLabelGeogcs.setText(PluginServices.getText(this,"geogcs")+ ":"); |
193 | 8594 | dguerrero | } |
194 | return jLabelGeogcs;
|
||
195 | } |
||
196 | |||
197 | private JLabel getJLabelGeogcsDinamic() { |
||
198 | if(jLabelGeogcsdinamic == null) { |
||
199 | jLabelGeogcsdinamic = new JLabel(); |
||
200 | jLabelGeogcsdinamic.setPreferredSize(new Dimension(150,20)); |
||
201 | jLabelGeogcsdinamic.setFont(new Font("",Font.ROMAN_BASELINE,10)); |
||
202 | jLabelGeogcsdinamic.setText(proj.getCrsWkt().getGeogcs()); |
||
203 | } |
||
204 | return jLabelGeogcsdinamic;
|
||
205 | } |
||
206 | |||
207 | private JLabel getJLabelDatum() { |
||
208 | if(jLabelDatum == null) { |
||
209 | jLabelDatum = new JLabel(); |
||
210 | jLabelDatum.setPreferredSize(new Dimension(75,20)); |
||
211 | jLabelDatum.setFont(new Font("Datum:",Font.BOLD,10)); |
||
212 | 8665 | jlgomez | jLabelDatum.setText(PluginServices.getText(this,"datum")+":"); |
213 | 8594 | dguerrero | } |
214 | return jLabelDatum;
|
||
215 | } |
||
216 | |||
217 | private JLabel getJLabelDatumDinamic() { |
||
218 | if(jLabelDatumdinamic == null) { |
||
219 | jLabelDatumdinamic = new JLabel(); |
||
220 | jLabelDatumdinamic.setPreferredSize(new Dimension(150,20)); |
||
221 | jLabelDatumdinamic.setFont(new Font("",Font.ROMAN_BASELINE,10)); |
||
222 | jLabelDatumdinamic.setText(proj.getCrsWkt().getDatumName()); |
||
223 | } |
||
224 | return jLabelDatumdinamic;
|
||
225 | } |
||
226 | |||
227 | private JLabel getJLabelSpheroid() { |
||
228 | if(jLabelSpheroid == null) { |
||
229 | jLabelSpheroid = new JLabel(); |
||
230 | jLabelSpheroid.setPreferredSize(new Dimension(75,20)); |
||
231 | jLabelSpheroid.setFont(new Font("Spheroid",Font.BOLD,10)); |
||
232 | 8665 | jlgomez | jLabelSpheroid.setText(PluginServices.getText(this,"spheriod")+":"); |
233 | 8594 | dguerrero | } |
234 | return jLabelSpheroid;
|
||
235 | } |
||
236 | |||
237 | private JLabel getJLabelSpheroidDinamic() { |
||
238 | if(jLabelSpheroiddinamic == null) { |
||
239 | String[] sphe = proj.getCrsWkt().getSpheroid(); |
||
240 | jLabelSpheroiddinamic = new JLabel(); |
||
241 | jLabelSpheroiddinamic.setPreferredSize(new Dimension(200,20)); |
||
242 | jLabelSpheroiddinamic.setFont(new Font("",Font.ROMAN_BASELINE,10)); |
||
243 | jLabelSpheroiddinamic.setText(sphe[0]+" , "+sphe[1]+" , "+sphe[2]); |
||
244 | } |
||
245 | return jLabelSpheroiddinamic;
|
||
246 | } |
||
247 | |||
248 | private JLabel getJLabelPrimen() { |
||
249 | if(jLabelPrimem == null) { |
||
250 | jLabelPrimem = new JLabel(); |
||
251 | jLabelPrimem.setPreferredSize(new Dimension(75,20)); |
||
252 | jLabelPrimem.setFont(new Font("Primen:",Font.BOLD,10)); |
||
253 | 8665 | jlgomez | jLabelPrimem.setText(PluginServices.getText(this,"primem")+":"); |
254 | 8594 | dguerrero | } |
255 | return jLabelPrimem;
|
||
256 | } |
||
257 | |||
258 | private JLabel getJLabelPrimenDinamic() { |
||
259 | if(jLabelPrimemdinamic == null) { |
||
260 | String pri[] = proj.getCrsWkt().getPrimen(); |
||
261 | jLabelPrimemdinamic = new JLabel(); |
||
262 | jLabelPrimemdinamic.setPreferredSize(new Dimension(150,20)); |
||
263 | jLabelPrimemdinamic.setFont(new Font("",Font.ROMAN_BASELINE,10)); |
||
264 | jLabelPrimemdinamic.setText(pri[0]+" , "+pri[1]); |
||
265 | } |
||
266 | return jLabelPrimemdinamic;
|
||
267 | } |
||
268 | |||
269 | private JLabel getJLabelProjection() { |
||
270 | if(jLabelProjection == null) { |
||
271 | jLabelProjection = new JLabel(); |
||
272 | jLabelProjection.setPreferredSize(new Dimension(75,20)); |
||
273 | jLabelProjection.setFont(new Font("Projection",Font.BOLD,10)); |
||
274 | 8665 | jlgomez | jLabelProjection.setText(PluginServices.getText(this,"projection")+":"); |
275 | 8594 | dguerrero | } |
276 | return jLabelProjection;
|
||
277 | } |
||
278 | |||
279 | private JLabel getJLabelProjectionDinamic() { |
||
280 | if(jLabelProjectiondinamic == null) { |
||
281 | jLabelProjectiondinamic = new JLabel(); |
||
282 | jLabelProjectiondinamic.setPreferredSize(new Dimension(150,20)); |
||
283 | jLabelProjectiondinamic.setFont(new Font("",Font.ROMAN_BASELINE,10)); |
||
284 | jLabelProjectiondinamic.setText(proj.getCrsWkt().getProjection()); |
||
285 | } |
||
286 | return jLabelProjectiondinamic;
|
||
287 | } |
||
288 | |||
289 | private JLabel getJLabelUnits() { |
||
290 | if(jLabelUnits == null) { |
||
291 | jLabelUnits = new JLabel(); |
||
292 | jLabelUnits.setPreferredSize(new Dimension(75,20)); |
||
293 | jLabelUnits.setFont(new Font("Units",Font.BOLD,10)); |
||
294 | 8665 | jlgomez | jLabelUnits.setText(PluginServices.getText(this,"units")+":"); |
295 | 8594 | dguerrero | } |
296 | return jLabelUnits;
|
||
297 | } |
||
298 | |||
299 | private JLabel getJLabelUnitsDinamic() { |
||
300 | if(jLabelUnitsdinamic == null) { |
||
301 | String[] units = proj.getCrsWkt().getUnit(); |
||
302 | jLabelUnitsdinamic = new JLabel(); |
||
303 | jLabelUnitsdinamic.setPreferredSize(new Dimension(200,20)); |
||
304 | jLabelUnitsdinamic.setFont(new Font("",Font.ROMAN_BASELINE,10)); |
||
305 | jLabelUnitsdinamic.setText(units[0]+" , "+units[1]); |
||
306 | } |
||
307 | return jLabelUnitsdinamic;
|
||
308 | } |
||
309 | |||
310 | private JLabel getJLabelUnits_p() { |
||
311 | if(jLabelUnits_p == null) { |
||
312 | jLabelUnits_p = new JLabel(); |
||
313 | jLabelUnits_p.setPreferredSize(new Dimension(75,20)); |
||
314 | jLabelUnits_p.setFont(new Font("",Font.BOLD,10)); |
||
315 | 8665 | jlgomez | jLabelUnits_p.setText(PluginServices.getText(this,"units_p")+":"); |
316 | 8594 | dguerrero | } |
317 | return jLabelUnits_p;
|
||
318 | } |
||
319 | |||
320 | private JLabel getJLabelUnits_pDinamic() { |
||
321 | if(jLabelUnits_pdinamic == null) { |
||
322 | String[] uni_p = proj.getCrsWkt().getUnit_p(); |
||
323 | jLabelUnits_pdinamic = new JLabel(); |
||
324 | jLabelUnits_pdinamic.setPreferredSize(new Dimension(150,20)); |
||
325 | jLabelUnits_pdinamic.setFont(new Font("",Font.ROMAN_BASELINE,10)); |
||
326 | jLabelUnits_pdinamic.setText(uni_p[0]+" , "+uni_p[1]); |
||
327 | |||
328 | } |
||
329 | return jLabelUnits_pdinamic;
|
||
330 | } |
||
331 | |||
332 | private JScrollPane getJScrollPane1() { |
||
333 | if(jScrollPane1 == null) { |
||
334 | jScrollPane1 = new JScrollPane(); |
||
335 | jScrollPane1.setPreferredSize(new Dimension(400,150)); |
||
336 | /* jScrollPane1.setBorder(
|
||
337 | BorderFactory.createCompoundBorder(
|
||
338 | BorderFactory.createCompoundBorder(
|
||
339 | BorderFactory.createTitledBorder("Transformations"),
|
||
340 | BorderFactory.createEmptyBorder(5,5,5,5)),
|
||
341 | jScrollPane1.getBorder()));*/
|
||
342 | jScrollPane1.setViewportView(getJTable()); |
||
343 | } |
||
344 | return jScrollPane1;
|
||
345 | } |
||
346 | |||
347 | private JTable getJTable() { |
||
348 | if(jTable == null) { |
||
349 | String[] columnNames = {PluginServices.getText(this,"nombre") |
||
350 | ,PluginServices.getText(this,"valor")}; |
||
351 | 13291 | jlgomez | |
352 | 8594 | dguerrero | String[] param_n = proj.getCrsWkt().getParam_name(); |
353 | 13374 | jlgomez | String[] param_v = proj.getCrsWkt().getParam_value(); |
354 | 8594 | dguerrero | Object[][]data; |
355 | if(param_v != null) { |
||
356 | data = new Object[param_v.length][2]; |
||
357 | for(int i = 0 ; i < 2 ; i++ ) |
||
358 | for(int j = 0 ; j < param_n.length ; j++) { |
||
359 | if(i == 0) |
||
360 | data[j][i] = param_n[j]; |
||
361 | else
|
||
362 | data[j][i] = param_v[j]; |
||
363 | } |
||
364 | } else
|
||
365 | data = new Object[1][1]; |
||
366 | dtm = new DefaultTableModel(data, columnNames); |
||
367 | jTable = new JTable(dtm); |
||
368 | jTable.setCellSelectionEnabled(false);
|
||
369 | jTable.setRowSelectionAllowed(true);
|
||
370 | jTable.setColumnSelectionAllowed(false);
|
||
371 | jTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
|
||
372 | |||
373 | } |
||
374 | return jTable;
|
||
375 | } |
||
376 | |||
377 | public WindowInfo getWindowInfo() {
|
||
378 | WindowInfo m_viewinfo=new WindowInfo(WindowInfo.MODALDIALOG);
|
||
379 | m_viewinfo.setTitle(PluginServices.getText(this,proj.getCrsWkt().getName()));
|
||
380 | return m_viewinfo;
|
||
381 | } |
||
382 | |||
383 | public void actionPerformed(ActionEvent e) { |
||
384 | if (e.getSource() == getJButtonOk()){
|
||
385 | PluginServices.getMDIManager().closeWindow(this);
|
||
386 | } |
||
387 | 13398 | jlgomez | } |
388 | 13291 | jlgomez | |
389 | 8594 | dguerrero | } |