/* * (non-Javadoc) * * @see * org.geosdi.geoplatform.gui.impl.map.store.GPLayerBuilder#buildRaster( * org.geosdi.geoplatform.gui.model.GPRasterBean) */ @Override public WMS buildRaster(GPRasterBean rasterBean) { WMSParams wmsParams = new WMSParams(); wmsParams.setFormat("image/png"); wmsParams.setLayers(rasterBean.getName()); if (!rasterBean.getStyles().isEmpty()) { wmsParams.setStyles(rasterBean.getStyles().get(0).getStyleString()); } wmsParams.setIsTransparent(true); if (rasterBean.getBbox() != null) { Bounds bbox = new Bounds( rasterBean.getBbox().getLowerLeftX(), rasterBean.getBbox().getLowerLeftY(), rasterBean.getBbox().getUpperRightX(), rasterBean.getBbox().getUpperRightY()); bbox.transform( new Projection(rasterBean.getCrs()), new Projection(mapWidget.getMap().getProjection())); wmsParams.setMaxExtent(bbox); } WMSOptions wmsOption = new WMSOptions(); wmsOption.setIsBaseLayer(false); wmsOption.setDisplayInLayerSwitcher(false); wmsOption.setDisplayOutsideMaxExtent(true); wmsOption.setBuffer(0); wmsOption.setRatio(1); WMS layer = new WMS(rasterBean.getLabel(), rasterBean.getDataSource(), wmsParams, wmsOption); layer.setOpacity(rasterBean.getOpacity()); return layer; }
/* * (non-Javadoc) * * @see * org.geosdi.geoplatform.gui.impl.map.store.GPLayerBuilder#buildVector( * org.geosdi.geoplatform.gui.model.GPVectorBean) */ @Override public WMS buildVector(GPVectorBean vectorBean) { WMSParams wmsParams = new WMSParams(); wmsParams.setFormat("image/png"); wmsParams.setLayers(vectorBean.getName()); wmsParams.setStyles(""); wmsParams.setIsTransparent(true); if (vectorBean.getBbox() != null) { Bounds bbox = new Bounds( vectorBean.getBbox().getLowerLeftX(), vectorBean.getBbox().getLowerLeftY(), vectorBean.getBbox().getUpperRightX(), vectorBean.getBbox().getUpperRightY()); bbox.transform( new Projection(vectorBean.getCrs()), new Projection(mapWidget.getMap().getProjection())); wmsParams.setMaxExtent(bbox); } WMSOptions wmsOption = new WMSOptions(); wmsOption.setIsBaseLayer(false); wmsOption.setDisplayInLayerSwitcher(false); wmsOption.setDisplayOutsideMaxExtent(true); wmsOption.setBuffer(0); wmsOption.setRatio(1); String dataSource = vectorBean.getDataSource(); dataSource = dataSource.replaceAll("wfs", "wms"); return new WMS(vectorBean.getLabel(), dataSource, wmsParams, wmsOption); }