/** * Constructor for image of certain layer and style * * @param layer * @param styleName */ public WFSImage(WFSLayerStore layer, String client, String styleName, String highlightStyleName) { if (layer == null || styleName == null) { log.error("Failed to construct image (undefined params)"); return; } // check if tile buffer is given String tileBufferKey; if (styleName.startsWith(PREFIX_CUSTOM_STYLE)) { tileBufferKey = PREFIX_CUSTOM_STYLE; } else { tileBufferKey = styleName; } if (layer.getTileBuffer() != null && layer.getTileBuffer().containsKey(tileBufferKey)) { bufferSize = layer.getTileBuffer().get(tileBufferKey); } log.debug(tileBufferKey, "=", bufferSize); // TODO: possibility to change the custom style store key to sessionID (it is hard without // connection to get client) if (styleName.startsWith(PREFIX_CUSTOM_STYLE) && client != null) { try { this.customStyle = WFSCustomStyleStore.create(client, layer.getLayerId()); if (this.customStyle == null) { this.style = null; log.error("WFSCustomStyleStore not created", client, layer.getLayerId()); return; } this.customStyle.setGeometry( layer.getGMLGeometryProperty().replaceAll("^[^_]*:", "")); // set the geometry name log.debug(this.customStyle.getGeometry()); if (highlightStyleName == null) { this.style = createCustomSLDStyle(); } else { isHighlight = true; this.style = createCustomSLDStyle(); } } catch (Exception e) { this.style = null; log.error(e, "JSON parsing failed for WFSCustomStyleStore"); return; } } else if (highlightStyleName == null) { this.style = getSLDStyle(layer, styleName); } else { isHighlight = true; this.style = getSLDStyle(layer, highlightStyleName); } }