Revision 4181 org.gvsig.raster.wms/trunk/org.gvsig.raster.wms/org.gvsig.raster.wms.app.wmsclient/src/main/java/org/gvsig/raster/wms/app/wmsclient/gui/panel/WMSParamsPanel.java
WMSParamsPanel.java | ||
---|---|---|
2 | 2 |
* |
3 | 3 |
* Copyright (C) 2007-2008 Infrastructures and Transports Department |
4 | 4 |
* of the Valencian Government (CIT) |
5 |
*
|
|
5 |
* |
|
6 | 6 |
* This program is free software; you can redistribute it and/or |
7 | 7 |
* modify it under the terms of the GNU General Public License |
8 | 8 |
* as published by the Free Software Foundation; either version 2 |
9 | 9 |
* of the License, or (at your option) any later version. |
10 |
*
|
|
10 |
* |
|
11 | 11 |
* This program is distributed in the hope that it will be useful, |
12 | 12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
13 | 13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
14 | 14 |
* GNU General Public License for more details. |
15 |
*
|
|
15 |
* |
|
16 | 16 |
* You should have received a copy of the GNU General Public License |
17 | 17 |
* along with this program; if not, write to the Free Software |
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
|
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
19 | 19 |
* MA 02110-1301, USA. |
20 |
*
|
|
20 |
* |
|
21 | 21 |
*/ |
22 |
|
|
22 |
|
|
23 | 23 |
package org.gvsig.raster.wms.app.wmsclient.gui.panel; |
24 | 24 |
|
25 | 25 |
import java.awt.Component; |
... | ... | |
30 | 30 |
import java.awt.event.MouseAdapter; |
31 | 31 |
import java.awt.event.MouseEvent; |
32 | 32 |
import java.lang.reflect.InvocationTargetException; |
33 |
import java.net.URI; |
|
34 |
import java.net.URISyntaxException; |
|
33 | 35 |
import java.util.AbstractCollection; |
34 | 36 |
import java.util.ArrayList; |
35 | 37 |
import java.util.Hashtable; |
... | ... | |
201 | 203 |
this.setBounds(0, 0, 510, 427); |
202 | 204 |
this.add(getJTabbedPane(), null); |
203 | 205 |
} |
204 |
|
|
206 |
|
|
205 | 207 |
public boolean isUpdatingCache() { |
206 | 208 |
return updating; |
207 | 209 |
} |
... | ... | |
372 | 374 |
|
373 | 375 |
return jTxtNomCapa; |
374 | 376 |
} |
375 |
|
|
377 |
|
|
376 | 378 |
/** |
377 | 379 |
* This method initializes jPanel1 |
378 | 380 |
* |
... | ... | |
413 | 415 |
} |
414 | 416 |
return jPanelSrsSelection; |
415 | 417 |
} |
416 |
|
|
418 |
|
|
417 | 419 |
/** |
418 | 420 |
* This method initializes jPanel6 |
419 | 421 |
* |
... | ... | |
472 | 474 |
} |
473 | 475 |
return chkTransparency; |
474 | 476 |
} |
475 |
|
|
477 |
|
|
476 | 478 |
/** |
477 | 479 |
* This method initializes jScrollPane2 |
478 | 480 |
* |
... | ... | |
488 | 490 |
|
489 | 491 |
return jScrollPane2; |
490 | 492 |
} |
491 |
|
|
493 |
|
|
492 | 494 |
/** |
493 | 495 |
* This method initializes jScrollPane3 |
494 | 496 |
* |
... | ... | |
535 | 537 |
public void valueChanged( |
536 | 538 |
javax.swing.event.TreeSelectionEvent e) { |
537 | 539 |
|
538 |
boolean isGetMapable = false;
|
|
540 |
boolean isGetMapable = false; |
|
539 | 541 |
TreePath[] selecciones = getTreeLayers() |
540 | 542 |
.getSelectionPaths(); |
541 | 543 |
if (selecciones != null) { |
... | ... | |
567 | 569 |
|
568 | 570 |
boolean b; |
569 | 571 |
this.repaint(); |
570 |
boolean infoFormatOk = ((getLstInfoFormats().getModel().getSize()!= 0 &&
|
|
571 |
getLstInfoFormats().getSelectedIndex() != -1) ||
|
|
572 |
boolean infoFormatOk = ((getLstInfoFormats().getModel().getSize()!= 0 && |
|
573 |
getLstInfoFormats().getSelectedIndex() != -1) || |
|
572 | 574 |
getLstInfoFormats().getModel().getSize() == 0); |
573 | 575 |
if ((getLstSRSs().getSelectedIndex() != -1) |
574 | 576 |
&& (getLstFormats().getSelectedIndex() != -1) |
... | ... | |
853 | 855 |
} |
854 | 856 |
return lstSRSs; |
855 | 857 |
} |
856 |
|
|
858 |
|
|
857 | 859 |
/** |
858 | 860 |
* This method initializes lstSRSs |
859 | 861 |
* |
... | ... | |
958 | 960 |
public String getFormat() { |
959 | 961 |
return (String) getLstFormats().getSelectedValue(); |
960 | 962 |
} |
961 |
|
|
963 |
|
|
962 | 964 |
public String getInfoFormat() { |
963 | 965 |
return (String) getLstInfoFormats().getSelectedValue(); |
964 | 966 |
} |
... | ... | |
1087 | 1089 |
} |
1088 | 1090 |
return -1; |
1089 | 1091 |
} |
1090 |
|
|
1092 |
|
|
1091 | 1093 |
/** |
1092 | 1094 |
* Returns the index of the format within the formats list. |
1093 | 1095 |
* |
... | ... | |
1291 | 1293 |
public void setTransparent(boolean b) { |
1292 | 1294 |
getChkTransparency().setSelected(b); |
1293 | 1295 |
} |
1294 |
|
|
1295 |
|
|
1296 |
|
|
1297 |
|
|
1296 | 1298 |
/** |
1297 | 1299 |
* Returns true if the WMS protocol version in use is |
1298 | 1300 |
* >= 1.3.0, and false otherwise. |
... | ... | |
1333 | 1335 |
WMSLayerNode[] layers = selectedLayersToArray(); |
1334 | 1336 |
Vector<RemoteWMSStyle> v = new Vector<RemoteWMSStyle>(layers.length); |
1335 | 1337 |
int posInsertion = 0; |
1336 |
|
|
1338 |
|
|
1337 | 1339 |
for (int i = layers.length - 1; i >= 0; i--) { |
1338 | 1340 |
RemoteWMSStyle sty = layers[i].getSelectedStyle(); |
1339 | 1341 |
if(sty != null) |
... | ... | |
1478 | 1480 |
par.setFixedSize(getFixedSize()); |
1479 | 1481 |
par.setQueryable(explorer.isQueryable()); |
1480 | 1482 |
par.setName(node.getTitle()); |
1481 |
par.setURI(explorer.getHost()); |
|
1482 |
par.deleteCache(updating); |
|
1483 |
try { |
|
1484 |
par.setURI(new URI(explorer.getHost())); |
|
1485 |
} catch (URISyntaxException e1) { |
|
1486 |
throw new LoadLayerException("Can't create URI from "+explorer.getHost(), e1); |
|
1487 |
} |
|
1488 |
par.deleteCache(updating); |
|
1483 | 1489 |
par.setXyAxisOrder(getXYAxisorder()); |
1484 |
|
|
1490 |
|
|
1485 | 1491 |
FLyrWMS layer = new FLyrWMS(); |
1486 | 1492 |
try { |
1487 | 1493 |
layer.setParameters(parameters); |
... | ... | |
1512 | 1518 |
return getLayerPlain(cached); |
1513 | 1519 |
} |
1514 | 1520 |
} |
1515 |
|
|
1521 |
|
|
1516 | 1522 |
public FLayer getLayer() throws InitializeException { |
1517 | 1523 |
return getLayer(lastCached); |
1518 | 1524 |
} |
... | ... | |
1522 | 1528 |
* layer tree in WMS |
1523 | 1529 |
* |
1524 | 1530 |
* @return |
1525 |
* @throws LoadLayerException
|
|
1531 |
* @throws LoadLayerException |
|
1526 | 1532 |
*/ |
1527 | 1533 |
protected FLayer getLayerTree() throws InitializeException { |
1528 | 1534 |
LayerTree layerTree = getLayerStructure(); |
... | ... | |
1552 | 1558 |
if (node.getChildren().size() > 0) { |
1553 | 1559 |
FLayers l = null; |
1554 | 1560 |
if (this.getMapCtrl() == null) { |
1555 |
AbstractViewPanel v =
|
|
1561 |
AbstractViewPanel v = |
|
1556 | 1562 |
(AbstractViewPanel) PluginServices.getMDIManager().getActiveWindow(); |
1557 | 1563 |
l = new FLayers(); |
1558 | 1564 |
l.setMapContext(v.getMapControl().getMapContext()); |
... | ... | |
1573 | 1579 |
return l; |
1574 | 1580 |
} else { |
1575 | 1581 |
if (nodeSelected(selection, node)) { |
1576 |
|
|
1582 |
|
|
1577 | 1583 |
DataStoreParameters parameters = explorer.getStoredParameters(); |
1578 | 1584 |
WMSDataParameters par = null; |
1579 | 1585 |
if(parameters instanceof WMSDataParameters) { |
... | ... | |
1596 | 1602 |
par.setFixedSize(getFixedSize()); |
1597 | 1603 |
par.setQueryable(node.isQueryable()); |
1598 | 1604 |
par.setName(node.getTitle()); |
1599 |
par.setURI(explorer.getHost()); |
|
1605 |
try { |
|
1606 |
par.setURI(new URI(explorer.getHost())); |
|
1607 |
} catch (URISyntaxException e1) { |
|
1608 |
throw new InitializeException("Can't create URI from "+explorer.getHost(), e1); |
|
1609 |
} |
|
1600 | 1610 |
par.deleteCache(updating); |
1601 | 1611 |
par.setXyAxisOrder(getXYAxisorder()); |
1602 |
|
|
1612 |
|
|
1603 | 1613 |
FLyrWMS layer = new FLyrWMS(); |
1604 | 1614 |
layer.setParameters(parameters); |
1605 | 1615 |
layer.setName(node.getName()); |
... | ... | |
1630 | 1640 |
protected FLayer getLayerPlain(boolean cached) throws InitializeException { |
1631 | 1641 |
WMSDataParameters par = (WMSDataParameters)explorer.getStoredParameters(); |
1632 | 1642 |
DataStoreParameters parameters = par; |
1633 |
|
|
1643 |
|
|
1634 | 1644 |
if(cached) { |
1635 | 1645 |
DataManager manager = DALLocator.getDataManager(); |
1636 | 1646 |
TileDataParameters tileParams = null; |
... | ... | |
1642 | 1652 |
tileParams.setDataParameters(par); |
1643 | 1653 |
parameters = tileParams; |
1644 | 1654 |
} |
1645 |
|
|
1655 |
|
|
1646 | 1656 |
par.setFormat(getFormat()); |
1647 | 1657 |
par.setInfoFormat(getInfoFormat()); |
1648 | 1658 |
par.setLayerQuery(getLayersQuery()); |
... | ... | |
1655 | 1665 |
par.setFixedSize(getFixedSize()); |
1656 | 1666 |
par.setQueryable(explorer.isQueryable()); |
1657 | 1667 |
par.setName(getLayerName()); |
1658 |
par.setURI(explorer.getHost()); |
|
1659 |
par.deleteCache(updating); |
|
1668 |
try { |
|
1669 |
par.setURI(new URI(explorer.getHost())); |
|
1670 |
} catch (URISyntaxException e1) { |
|
1671 |
throw new InitializeException("Can't create URI from "+explorer.getHost(), e1); |
|
1672 |
} par.deleteCache(updating); |
|
1660 | 1673 |
par.setXyAxisOrder(getXYAxisorder()); |
1661 |
|
|
1674 |
|
|
1662 | 1675 |
FLyrWMS layer = new FLyrWMS(); |
1663 | 1676 |
layer.setParameters(parameters); |
1664 | 1677 |
layer.setExplorer(explorer); |
... | ... | |
1667 | 1680 |
} |
1668 | 1681 |
|
1669 | 1682 |
/** |
1670 |
* Gets the <code>RasterDriverException</code> message. The message
|
|
1683 |
* Gets the <code>RasterDriverException</code> message. The message |
|
1671 | 1684 |
* of this exception is returned by the server |
1672 | 1685 |
* @param e |
1673 | 1686 |
* @return |
... | ... | |
1684 | 1697 |
t = ex.getCause(); |
1685 | 1698 |
} else if(ex instanceof InvocationTargetException) { |
1686 | 1699 |
t = ((InvocationTargetException)ex).getTargetException(); |
1687 |
}
|
|
1700 |
} |
|
1688 | 1701 |
if(t == null) |
1689 | 1702 |
return null; |
1690 | 1703 |
else |
... | ... | |
1840 | 1853 |
public void close() { |
1841 | 1854 |
// Nothing to do |
1842 | 1855 |
} |
1843 |
|
|
1856 |
|
|
1844 | 1857 |
public WMSServerExplorer getExplorer() { |
1845 | 1858 |
return explorer; |
1846 | 1859 |
} |
Also available in: Unified diff