if (watermark != null) layout.addBlock(watermark);
}
}
public static MapDecorationLayout.Block getWatermark(WMSInfo wms) {
WatermarkInfo watermark = (wms == null ? null : wms.getWatermark());
if (watermark != null && watermark.isEnabled()) {
Map<String, String> options = new HashMap<String,String>();
options.put("url", watermark.getURL());
options.put("opacity", Float.toString((255f - watermark.getTransparency())/ 2.55f));
MapDecoration d = new WatermarkDecoration();
try {
d.loadOptions(options);
} catch (Exception e) {
LOGGER.log(Level.SEVERE, "Couldn't construct watermark from configuration", e);
throw new WmsException(e);
}
MapDecorationLayout.Block.Position p = null;
switch (watermark.getPosition()) {
case TOP_LEFT:
p = MapDecorationLayout.Block.Position.UL;
break;
case TOP_CENTER:
p = MapDecorationLayout.Block.Position.UC;