Revision 10672
branches/v10/extensions/extWMS/src/com/iver/cit/gvsig/fmap/layers/FLyrWMS.java | ||
---|---|---|
1790 | 1790 |
|
1791 | 1791 |
public Image getImageLegend() { |
1792 | 1792 |
try { |
1793 |
//TODO: |
|
1794 |
//store legend graphic and show it in TOC only when layer visible |
|
1795 |
if (wms.hasLegendGraphic()){ |
|
1796 |
wmsStatus.setOnlineResource((String) onlineResources.get("GetLegendGraphic")); |
|
1797 |
File legend = getDriver().getLegendGraphic(wmsStatus, layerQuery, null); |
|
1793 |
if (wms == null) |
|
1794 |
wms = getDriver(); |
|
1795 |
if (wms.hasLegendGraphic()) { |
|
1796 |
wmsStatus.setOnlineResource((String) onlineResources |
|
1797 |
.get("GetLegendGraphic")); |
|
1798 |
String path = getPathImage();// File legend = |
|
1799 |
// getDriver().getLegendGraphic(wmsStatus, |
|
1800 |
// layerQuery, null); |
|
1798 | 1801 |
Image img = null; |
1799 |
if ((legend!= null) && (legend.length() > 0))
|
|
1800 |
img = ImageIO.read(legend);
|
|
1802 |
if ((path != null) && (path.length() > 0))
|
|
1803 |
img = new ImageIcon(path).getImage();
|
|
1801 | 1804 |
return img; |
1802 |
}else{ |
|
1803 |
return null; |
|
1804 | 1805 |
} |
1806 |
} catch (Exception e) { |
|
1807 |
} |
|
1808 |
return null; |
|
1809 |
} |
|
1810 |
|
|
1811 |
public String getPathImage() { |
|
1812 |
try { |
|
1813 |
File legend = getDriver().getLegendGraphic(wmsStatus, layerQuery, null); |
|
1814 |
return legend.getAbsolutePath(); |
|
1805 | 1815 |
}catch(Exception e){ |
1806 | 1816 |
//e.printStackTrace(); |
1807 | 1817 |
return null; |
Also available in: Unified diff