gvsig-raster / org.gvsig.raster.wcs / trunk / org.gvsig.raster.wcs / org.gvsig.raster.wcs.app / org.gvsig.raster.wcs.app.wcsclient / src / main / java / org / gvsig / raster / wcs / app / wcsclient / gui / panel / WCSParamsPanel.java @ 1356
History | View | Annotate | Download (16.9 KB)
1 | 418 | nbrodin | /* gvSIG. Geographic Information System of the Valencian Government
|
---|---|---|---|
2 | *
|
||
3 | * Copyright (C) 2007-2008 Infrastructures and Transports Department
|
||
4 | * of the Valencian Government (CIT)
|
||
5 | *
|
||
6 | * This program is free software; you can redistribute it and/or
|
||
7 | * modify it under the terms of the GNU General Public License
|
||
8 | * as published by the Free Software Foundation; either version 2
|
||
9 | * of the License, or (at your option) any later version.
|
||
10 | *
|
||
11 | * This program is distributed in the hope that it will be useful,
|
||
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||
14 | * GNU General Public License for more details.
|
||
15 | *
|
||
16 | * You should have received a copy of the GNU General Public License
|
||
17 | * along with this program; if not, write to the Free Software
|
||
18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||
19 | * MA 02110-1301, USA.
|
||
20 | *
|
||
21 | */
|
||
22 | |||
23 | package org.gvsig.raster.wcs.app.wcsclient.gui.panel; |
||
24 | |||
25 | import java.awt.event.FocusEvent; |
||
26 | import java.awt.event.FocusListener; |
||
27 | import java.awt.geom.Rectangle2D; |
||
28 | 1355 | nbrodin | import java.lang.reflect.InvocationTargetException; |
29 | 418 | nbrodin | import java.util.ArrayList; |
30 | import java.util.prefs.Preferences; |
||
31 | |||
32 | 1355 | nbrodin | import javax.swing.JOptionPane; |
33 | 418 | nbrodin | import javax.swing.JTabbedPane; |
34 | |||
35 | import org.gvsig.andami.PluginServices; |
||
36 | import org.gvsig.app.gui.WizardPanel; |
||
37 | import org.gvsig.app.gui.wizards.WizardListenerSupport; |
||
38 | 664 | nbrodin | import org.gvsig.fmap.dal.DALLocator; |
39 | import org.gvsig.fmap.dal.DataManager; |
||
40 | 418 | nbrodin | import org.gvsig.fmap.dal.DataStoreParameters; |
41 | 1356 | nbrodin | import org.gvsig.fmap.dal.coverage.exception.RasterDriverException; |
42 | 658 | nbrodin | import org.gvsig.fmap.dal.coverage.store.parameter.TileDataParameters; |
43 | 418 | nbrodin | import org.gvsig.fmap.dal.exception.InitializeException; |
44 | 664 | nbrodin | import org.gvsig.fmap.dal.exception.ProviderNotRegisteredException; |
45 | 418 | nbrodin | import org.gvsig.fmap.mapcontext.exceptions.LoadLayerException; |
46 | import org.gvsig.fmap.mapcontext.layers.FLayer; |
||
47 | 1355 | nbrodin | import org.gvsig.gui.beans.Messages; |
48 | 422 | nbrodin | import org.gvsig.raster.wcs.app.wcsclient.layer.FLyrWCS; |
49 | 485 | nbrodin | import org.gvsig.raster.wcs.io.FMapWCSParameter; |
50 | 470 | nbrodin | import org.gvsig.raster.wcs.io.WCSDataParameters; |
51 | import org.gvsig.raster.wcs.io.WCSLayerNode; |
||
52 | import org.gvsig.raster.wcs.io.WCSServerExplorer; |
||
53 | 418 | nbrodin | |
54 | |||
55 | /**
|
||
56 | * This class implements the map option panel.
|
||
57 | *
|
||
58 | * It includes a set of Listeners that implement some control rules which
|
||
59 | * refresh the component values that depends on those selected in the other
|
||
60 | * components to avoid to choose an invalid set of options. It also includes a
|
||
61 | * method (isCorrectlyConfigured()) that checks if the current set of values is
|
||
62 | * enough to correctly launch a GetMap request.
|
||
63 | *
|
||
64 | 485 | nbrodin | * The information is obtained from a WCSWizardDataSource object.
|
65 | 418 | nbrodin | *
|
66 | * @author Nacho Brodin (nachobrodin@gmail.com)
|
||
67 | *
|
||
68 | */
|
||
69 | public class WCSParamsPanel extends WizardPanel { |
||
70 | private static final long serialVersionUID = 1L; |
||
71 | public static Preferences fPrefs = Preferences.userRoot().node( "gvsig.wcs-wizard" ); |
||
72 | protected WCSServerExplorer explorer = null; |
||
73 | private LayerPanel layerPanel = null; |
||
74 | private InfoPanel infoPanel = null; |
||
75 | private FormatPanel formatsPanel = null; |
||
76 | private TimePanel timesPanel = null; |
||
77 | private ParameterPanel parameterPanel = null; |
||
78 | private int indTime; |
||
79 | private int indParameter; |
||
80 | private WizardListenerSupport listenerSupport;
|
||
81 | private JTabbedPane jTabbedPane = null; |
||
82 | 664 | nbrodin | private boolean lastCached = false; |
83 | 418 | nbrodin | |
84 | public WCSParamsPanel() {
|
||
85 | super();
|
||
86 | initialize(); |
||
87 | } |
||
88 | |||
89 | /**
|
||
90 | * This method initializes panelPage2
|
||
91 | *
|
||
92 | * @return Panel
|
||
93 | */
|
||
94 | private void initialize() { |
||
95 | this.setLayout(null); |
||
96 | this.setVisible(false); |
||
97 | this.setBounds(0, 0, 510, 427); |
||
98 | this.add(getJTabbedPane(), null); |
||
99 | } |
||
100 | |||
101 | /**
|
||
102 | * Fires a notification to this wizard listeners telling them if the
|
||
103 | * configuration is fair enough to send a GetMap request.
|
||
104 | *
|
||
105 | * @param b
|
||
106 | */
|
||
107 | public void fireWizardComplete(boolean b) { |
||
108 | listenerSupport.callStateChanged(b); |
||
109 | callStateChanged(b); |
||
110 | } |
||
111 | |||
112 | 664 | nbrodin | /**
|
113 | * WCSWizard doesn't have a JCheckBox for selecting with or without cache.
|
||
114 | *
|
||
115 | * @return
|
||
116 | * @throws LoadLayerException
|
||
117 | */
|
||
118 | 1356 | nbrodin | public FLayer getLayer() throws InitializeException { |
119 | 664 | nbrodin | return getLayer(lastCached);
|
120 | } |
||
121 | |||
122 | 470 | nbrodin | @SuppressWarnings("unchecked") |
123 | 1356 | nbrodin | public FLayer getLayer(boolean cached) throws InitializeException { |
124 | 664 | nbrodin | lastCached = cached; |
125 | 418 | nbrodin | FLyrWCS layer = new FLyrWCS();
|
126 | 664 | nbrodin | WCSDataParameters par = (WCSDataParameters)explorer.getStoreParameters(); |
127 | DataStoreParameters parameters = par; |
||
128 | 418 | nbrodin | |
129 | 664 | nbrodin | if(cached) {
|
130 | DataManager manager = DALLocator.getDataManager(); |
||
131 | TileDataParameters tileParams = null;
|
||
132 | try {
|
||
133 | tileParams = (TileDataParameters) manager.createStoreParameters("Tile Store");
|
||
134 | } catch (ProviderNotRegisteredException e) {
|
||
135 | 1356 | nbrodin | throw new InitializeException(e.getMessage(), e); |
136 | 664 | nbrodin | } |
137 | tileParams.setDataParameters(par); |
||
138 | parameters = tileParams; |
||
139 | 658 | nbrodin | } |
140 | 664 | nbrodin | |
141 | 483 | nbrodin | par.setURI(explorer.getHost().toString()); |
142 | 418 | nbrodin | par.setSRS(getSRS()); |
143 | par.setFormat(getFormat()); |
||
144 | par.setCoverageName(getLayerPanel().getSelectedCoverageName()); |
||
145 | par.setExtent(getExtent()); |
||
146 | par.setTime(getTimePanel().getTime()); |
||
147 | par.setParameter(getParameterPanel().getParameterString()); |
||
148 | String cName = getLayerPanel().getSelectedCoverageName();
|
||
149 | 470 | nbrodin | WCSLayerNode lNode = explorer.getCoverageByName(cName); |
150 | 418 | nbrodin | par.setMaxResolution(lNode.getMaxRes()); |
151 | par.setOnlineResources(explorer.getOnlineResources()); |
||
152 | |||
153 | try {
|
||
154 | 658 | nbrodin | layer.setParameters(parameters); |
155 | 418 | nbrodin | layer.setExplorer(explorer); |
156 | layer.setFullExtent(getExtent()); |
||
157 | 1042 | nbrodin | layer.setName(getLayerName()); |
158 | 418 | nbrodin | } catch (InitializeException e) {
|
159 | 1356 | nbrodin | String msg = getDriverExceptionMessage(e);
|
160 | if(msg != null) { |
||
161 | JOptionPane.showMessageDialog(this, msg, Messages.getText("Error"), JOptionPane.ERROR_MESSAGE); |
||
162 | return null; |
||
163 | } else
|
||
164 | throw e;
|
||
165 | 418 | nbrodin | } |
166 | return layer;
|
||
167 | } |
||
168 | 1356 | nbrodin | |
169 | /**
|
||
170 | * Gets the <code>RasterDriverException</code> message. The message
|
||
171 | * of this exception is returned by the server
|
||
172 | * @param e
|
||
173 | * @return
|
||
174 | */
|
||
175 | private String getDriverExceptionMessage(InitializeException e) { |
||
176 | Throwable ex = e;
|
||
177 | final int MAX_DEEP = 10; |
||
178 | int deep = 0; |
||
179 | while(deep < MAX_DEEP) {
|
||
180 | Throwable t = null; |
||
181 | if(ex instanceof RasterDriverException) { |
||
182 | return ex.getMessage();
|
||
183 | } else if(ex instanceof InitializeException) { |
||
184 | t = ex.getCause(); |
||
185 | } else if(ex instanceof InvocationTargetException) { |
||
186 | t = ((InvocationTargetException)ex).getTargetException();
|
||
187 | } |
||
188 | if(t == null) |
||
189 | return null; |
||
190 | else
|
||
191 | ex = t; |
||
192 | deep++; |
||
193 | } |
||
194 | return null; |
||
195 | } |
||
196 | 418 | nbrodin | |
197 | /**
|
||
198 | * Refreshes the content shown by this.
|
||
199 | */
|
||
200 | 1356 | nbrodin | @SuppressWarnings("unchecked") |
201 | 418 | nbrodin | public void refreshData(WCSDataParameters par) { |
202 | String coverageName = getLayerPanel().getSelectedInListCoverageName();
|
||
203 | if(coverageName == null && par != null) { |
||
204 | coverageName = par.getCoverageName(); |
||
205 | //coverageName = getLayerPanel().getNameByTitle(coverageName);
|
||
206 | } |
||
207 | cleanupWizard(); |
||
208 | if (coverageName != null) { |
||
209 | 470 | nbrodin | WCSLayerNode lyr = explorer.getCoverageByName(coverageName); |
210 | 418 | nbrodin | getLayerPanel().getTxtName().setText(lyr.getTitle()); |
211 | |||
212 | // CRS
|
||
213 | getFormatsPanel().getLstCRSs().clearSelection(); |
||
214 | getFormatsPanel().getLstCRSs().setListData(lyr.getSRSs().toArray()); |
||
215 | |||
216 | // Formats
|
||
217 | getFormatsPanel().getLstFormats().clearSelection(); |
||
218 | getFormatsPanel().getLstFormats().setListData(lyr.getFormats().toArray()); |
||
219 | |||
220 | // InterpolationMethods
|
||
221 | boolean b = lyr.getInterpolationMethods() != null; |
||
222 | getFormatsPanel().getCmbInterpolationMethods().removeAllItems(); |
||
223 | if (b) {
|
||
224 | ArrayList im = lyr.getInterpolationMethods();
|
||
225 | for (int i = 0; i < im.size(); i++) { |
||
226 | getFormatsPanel().getCmbInterpolationMethods().addItem(im.get(i)); |
||
227 | } |
||
228 | } |
||
229 | getFormatsPanel().getChkUseInterpolationMethod().setEnabled(b); |
||
230 | getFormatsPanel().getCmbInterpolationMethods().setEnabled(b); |
||
231 | |||
232 | // Time
|
||
233 | getTimePanel().getLstTimes().removeAll(); |
||
234 | ArrayList list = lyr.getTimePositions();
|
||
235 | b = !(list == null || list.isEmpty());
|
||
236 | if (b) {
|
||
237 | getTimePanel().getLstTimes().setListData(list.toArray()); |
||
238 | } |
||
239 | jTabbedPane.setEnabledAt(indTime, b); |
||
240 | |||
241 | // Parameters
|
||
242 | getParameterPanel().getCmbParam().removeAllItems(); |
||
243 | list = lyr.getParameterList(); |
||
244 | b = !(list == null || list.isEmpty());
|
||
245 | if (b) {
|
||
246 | for (int i = 0; i < list.size(); i++) { |
||
247 | getParameterPanel().getCmbParam().addItem(list.get(i)); |
||
248 | } |
||
249 | getParameterPanel().getSingleParamValuesList().setListData( |
||
250 | ((FMapWCSParameter) getParameterPanel().getCmbParam().getSelectedItem()).getValueList().toArray() |
||
251 | ); |
||
252 | } |
||
253 | jTabbedPane.setEnabledAt(indParameter, b); |
||
254 | fireWizardComplete(isCorrectlyConfigured()); |
||
255 | } |
||
256 | } |
||
257 | |||
258 | /**
|
||
259 | * Cleans up the wizard's components but the server's layers list.
|
||
260 | *
|
||
261 | * Limpia todos los componentes del wizard excepto la lista de capas del
|
||
262 | * servidor.
|
||
263 | */
|
||
264 | public void cleanupWizard() { |
||
265 | Object[] nada = new Object[0]; |
||
266 | |||
267 | getFormatsPanel().getLstCRSs().clearSelection(); |
||
268 | getFormatsPanel().getLstCRSs().setListData(nada); |
||
269 | |||
270 | getFormatsPanel().getLstFormats().clearSelection(); |
||
271 | getFormatsPanel().getLstFormats().setListData(nada); |
||
272 | |||
273 | getTimePanel().getLstTimes().clearSelection(); |
||
274 | getTimePanel().getLstTimes().setListData(nada); |
||
275 | |||
276 | getTimePanel().getLstSelectedTimes().clearSelection(); |
||
277 | getTimePanel().getLstSelectedTimes().setListData(nada); |
||
278 | |||
279 | getParameterPanel().getCmbParam().removeAllItems(); |
||
280 | getParameterPanel().getSingleParamValuesList().setVisible(true);
|
||
281 | |||
282 | getParameterPanel().getSingleParamValuesList().clearSelection(); |
||
283 | getParameterPanel().getSingleParamValuesList().setListData(nada); |
||
284 | } |
||
285 | |||
286 | /**
|
||
287 | * Refreshes the info tab
|
||
288 | */
|
||
289 | public void refreshInfo() { |
||
290 | FMapWCSParameter p = (FMapWCSParameter) getParameterPanel().getCmbParam().getSelectedItem(); |
||
291 | String pString = (p != null && getParameterPanel().getParameterString() != null) ? p.toString() + "=" + getParameterPanel().getParameterString().split("=")[1] : null; |
||
292 | infoPanel.refresh(explorer, |
||
293 | 470 | nbrodin | (WCSLayerNode) getLayerPanel().getLstCoverages().getSelectedValue(), |
294 | 418 | nbrodin | getTimePanel().getTime(), |
295 | getFormat(), |
||
296 | getSRS(), |
||
297 | pString); |
||
298 | } |
||
299 | |||
300 | |||
301 | public void setListenerSupport(WizardListenerSupport support) { |
||
302 | listenerSupport = support; |
||
303 | } |
||
304 | |||
305 | public void setWizardData(WCSServerExplorer data) { |
||
306 | this.explorer = data;
|
||
307 | getLayerPanel().getLstCoverages().setListData(data.getCoverageList()); |
||
308 | //((JDnDListModel) getLstSelectedLayers().getModel()).clear();
|
||
309 | //getLstSelectedLayers().repaint();
|
||
310 | //getLstFormats().setModel(new FormatListModel(this.explorer.getFormats()));
|
||
311 | //getTreeLayers().setModel(new LayerTreeModel(this.explorer.getLayerTree()));
|
||
312 | refreshInfo(); |
||
313 | } |
||
314 | |||
315 | /**
|
||
316 | * This method initializes jTabbedPane
|
||
317 | *
|
||
318 | * @return TabbedPane
|
||
319 | */
|
||
320 | public JTabbedPane getJTabbedPane() { |
||
321 | if (jTabbedPane == null) { |
||
322 | jTabbedPane = new JTabbedPane(); |
||
323 | jTabbedPane.setBounds(4, 4, 502, 415); |
||
324 | InfoPanel ip = getInfoPanel(); |
||
325 | ip.addFocusListener(new FocusListener() { |
||
326 | public void focusGained(FocusEvent e) { |
||
327 | refreshInfo(); |
||
328 | } |
||
329 | |||
330 | public void focusLost(FocusEvent e) { |
||
331 | } |
||
332 | }); |
||
333 | |||
334 | jTabbedPane.addTab(PluginServices.getText(this, "info"), null, ip, null); |
||
335 | LayerPanel lp = getLayerPanel(); |
||
336 | lp.setWCSParamsPanel(this);
|
||
337 | jTabbedPane.addTab(PluginServices.getText(this, "coverage"), null, lp, null); |
||
338 | FormatPanel fp = getFormatsPanel(); |
||
339 | fp.setWCSParamsPanel(this);
|
||
340 | jTabbedPane.addTab(PluginServices.getText(this, "format"), null, fp, null); |
||
341 | TimePanel tp = getTimePanel(); |
||
342 | tp.setWCSParamsPanel(this);
|
||
343 | jTabbedPane.addTab(PluginServices.getText(this, "time"), null, tp, null); |
||
344 | indTime = jTabbedPane.getTabCount() - 1;
|
||
345 | jTabbedPane.setEnabledAt(indTime, false);
|
||
346 | ParameterPanel pp = getParameterPanel(); |
||
347 | pp.setWCSParamsPanel(this);
|
||
348 | jTabbedPane.addTab(PluginServices.getText(this, "parameters"), null, pp, null); |
||
349 | indParameter = jTabbedPane.getTabCount() - 1;
|
||
350 | jTabbedPane.setEnabledAt(indParameter, false);
|
||
351 | } |
||
352 | return jTabbedPane;
|
||
353 | } |
||
354 | |||
355 | |||
356 | /**
|
||
357 | * This method initializes InfoPanel
|
||
358 | *
|
||
359 | * @return Panel
|
||
360 | */
|
||
361 | public InfoPanel getInfoPanel() {
|
||
362 | if (infoPanel == null) { |
||
363 | infoPanel = new InfoPanel();
|
||
364 | |||
365 | } |
||
366 | return infoPanel;
|
||
367 | } |
||
368 | |||
369 | /**
|
||
370 | * This method initializes TimePanel
|
||
371 | *
|
||
372 | * @return javax.swing.JPanel
|
||
373 | */
|
||
374 | public TimePanel getTimePanel() {
|
||
375 | if (timesPanel == null) { |
||
376 | timesPanel = new TimePanel();
|
||
377 | } |
||
378 | return timesPanel;
|
||
379 | } |
||
380 | |||
381 | /**
|
||
382 | * This method initializes FormatPanel
|
||
383 | *
|
||
384 | * @return javax.swing.JPanel
|
||
385 | */
|
||
386 | public FormatPanel getFormatsPanel() {
|
||
387 | if (formatsPanel == null) { |
||
388 | formatsPanel = new FormatPanel();
|
||
389 | } |
||
390 | return formatsPanel;
|
||
391 | } |
||
392 | |||
393 | /**
|
||
394 | * This method initializes ParameterPanel
|
||
395 | * @return javax.swing.JPanel
|
||
396 | */
|
||
397 | public ParameterPanel getParameterPanel() {
|
||
398 | if (parameterPanel == null) { |
||
399 | parameterPanel = new ParameterPanel();
|
||
400 | } |
||
401 | return parameterPanel;
|
||
402 | } |
||
403 | |||
404 | /**
|
||
405 | * This method initializes LayerPanel
|
||
406 | * @return javax.swing.JPanel
|
||
407 | */
|
||
408 | public LayerPanel getLayerPanel() {
|
||
409 | if (layerPanel == null) { |
||
410 | layerPanel = new LayerPanel();
|
||
411 | } |
||
412 | return layerPanel;
|
||
413 | } |
||
414 | |||
415 | /**
|
||
416 | * Sets the focus to the tab next to the current one.
|
||
417 | *
|
||
418 | * Enfoca a la solapa siguiente a la actualmente enfocada del TabbedPane
|
||
419 | *
|
||
420 | */
|
||
421 | public void avanzaTab() { |
||
422 | int currentPage = currentPage();
|
||
423 | int nPages = getNumTabs();
|
||
424 | if (nPages - 1 > currentPage) { |
||
425 | getJTabbedPane().setSelectedIndex(nextEnabledPage()); |
||
426 | } |
||
427 | } |
||
428 | |||
429 | /**
|
||
430 | * Sets the focus to the tab previous to the current one.
|
||
431 | */
|
||
432 | public void retrocedeTab() { |
||
433 | this.getJTabbedPane().setSelectedIndex(previousEnabledPage());
|
||
434 | |||
435 | } |
||
436 | |||
437 | /**
|
||
438 | * Returns the index of the current tab.
|
||
439 | * @return
|
||
440 | */
|
||
441 | public int currentPage() { |
||
442 | return getJTabbedPane().getSelectedIndex();
|
||
443 | } |
||
444 | |||
445 | /**
|
||
446 | 485 | nbrodin | * Returns the tab amount that the WCSParamsPanel currently have
|
447 | 418 | nbrodin | * @return int
|
448 | */
|
||
449 | public int getNumTabs() { |
||
450 | return getJTabbedPane().getTabCount();
|
||
451 | } |
||
452 | |||
453 | /**
|
||
454 | * <p>
|
||
455 | * Returns the index of the previous enabled tab.
|
||
456 | * </p>
|
||
457 | *
|
||
458 | * @return The index, or -1 if there is no one.
|
||
459 | */
|
||
460 | public int previousEnabledPage() { |
||
461 | int currentPage = currentPage();
|
||
462 | int j = 0; |
||
463 | if (currentPage == 0) { |
||
464 | j = -1;
|
||
465 | } |
||
466 | for (int i = currentPage - 1; i > -1; i--) { |
||
467 | if (getJTabbedPane().isEnabledAt(i)) {
|
||
468 | j = i; |
||
469 | break;
|
||
470 | } |
||
471 | } |
||
472 | return j;
|
||
473 | } |
||
474 | |||
475 | /**
|
||
476 | * <p>
|
||
477 | * Returns the previous of the previous enabled tab.
|
||
478 | * </p>
|
||
479 | * @return The index, or -1 if there is no one.
|
||
480 | */
|
||
481 | public int nextEnabledPage() { |
||
482 | int currentPage = currentPage();
|
||
483 | int nPages = getNumTabs();
|
||
484 | if (currentPage == nPages) {
|
||
485 | return -1; |
||
486 | } |
||
487 | for (int i = currentPage + 1; i < nPages; i++) { |
||
488 | if (getJTabbedPane().isEnabledAt(i)) {
|
||
489 | return i;
|
||
490 | } |
||
491 | } |
||
492 | return -1; |
||
493 | } |
||
494 | |||
495 | public void initWizard() { |
||
496 | } |
||
497 | |||
498 | public void execute() { |
||
499 | } |
||
500 | |||
501 | @Override
|
||
502 | public DataStoreParameters[] getParameters() { |
||
503 | // TODO Auto-generated method stub
|
||
504 | return null; |
||
505 | } |
||
506 | |||
507 | @Override
|
||
508 | public void close() { |
||
509 | // Nothing to do
|
||
510 | } |
||
511 | |||
512 | public WCSServerExplorer getExplorer() {
|
||
513 | return explorer;
|
||
514 | } |
||
515 | |||
516 | /**
|
||
517 | * Returns the extent of the currently selected coverage for the currently
|
||
518 | * selected SRS.
|
||
519 | *
|
||
520 | * @return Rectangle2D
|
||
521 | */
|
||
522 | public Rectangle2D getExtent() { |
||
523 | String cName = getLayerPanel().getSelectedCoverageName();
|
||
524 | if (cName!=null) { |
||
525 | return explorer.getCoverageByName(cName).getExtent(getSRS());
|
||
526 | } |
||
527 | return null; |
||
528 | } |
||
529 | |||
530 | /**
|
||
531 | * Returns the name of the selected coverage.
|
||
532 | *
|
||
533 | * @return String
|
||
534 | */
|
||
535 | public String getLayerName() { |
||
536 | return getLayerPanel().getTxtName().getText();
|
||
537 | } |
||
538 | |||
539 | /**
|
||
540 | * Returns the selected CRS.
|
||
541 | *
|
||
542 | * @return String
|
||
543 | */
|
||
544 | public String getSRS() { |
||
545 | return (String) getFormatsPanel().getLstCRSs().getSelectedValue(); |
||
546 | } |
||
547 | |||
548 | /**
|
||
549 | * Returns the selected format.
|
||
550 | *
|
||
551 | * @return String
|
||
552 | */
|
||
553 | public String getFormat() { |
||
554 | return (String) getFormatsPanel().getLstFormats().getSelectedValue(); |
||
555 | } |
||
556 | |||
557 | /**
|
||
558 | * Verifies that the selected parameters are enough to request the coverage
|
||
559 | * to the server.
|
||
560 | *
|
||
561 | * Comprueba que los par�metros seleccionados son suficientes para pedir la
|
||
562 | * cobertura al servidor.
|
||
563 | *
|
||
564 | * @return boolean
|
||
565 | */
|
||
566 | public boolean isCorrectlyConfigured() { |
||
567 | |||
568 | if (getLayerPanel().getSelectedCoverageName() == null) { |
||
569 | return false; |
||
570 | } |
||
571 | /*
|
||
572 | * Seg�n el est�ndar WCS, si se especifica bounding box el par�metro TIME
|
||
573 | * no es necesario. �ste es el caso de gvSIG, que siempre especifica BBOX
|
||
574 | * As� que, en teor�a, no deber�amos comprobar si se ha seleccionado algo
|
||
575 | * o no. Pero en las pruebas, el servidor que us�bamos respond�a con una
|
||
576 | * cobertura en blanco (negro) as� que se ha optado por evitar que se pueda
|
||
577 | * consultar sin ninguna posici�n para el tiempo (siempre que la cobertura
|
||
578 | * especifique posiciones para el tiempo).
|
||
579 | *
|
||
580 | * En cualquier caso con comentarizar la l�nea basta.
|
||
581 | */
|
||
582 | if (getTimePanel().timeRequired() && getTimePanel().getTime()==null) { |
||
583 | return false; |
||
584 | } |
||
585 | |||
586 | /*if (getParameterPanel().getCmbParam().getSelectedItem()!=null){
|
||
587 | if (parameterType == SINGLE_VALUE && getParameterPanel().getParameterString()==null) {
|
||
588 | return false;
|
||
589 | }
|
||
590 | if (parameterType == INTERVAL) {
|
||
591 | }
|
||
592 | }*/
|
||
593 | |||
594 | if (getSRS() == null) { |
||
595 | return false; |
||
596 | } |
||
597 | |||
598 | if (getFormat() == null) { |
||
599 | return false; |
||
600 | } |
||
601 | |||
602 | return true; |
||
603 | } |
||
604 | } // @jve:decl-index=0:visual-constraint="10,10" |