private static StrokeInfo createStroke(Map<String, Object> properties) { StrokeInfo s = new StrokeInfo(); s.setStrokeColor(getPropValue(STROKECOLOR, properties, DEFAULT_STROKECOLOR)); s.setStrokeWidth(getPropValue(STROKEWIDTH, properties, DEFAULT_STROKEWIDTH)); s.setStrokeOpacity(getPropValue(STROKEOPACITY, properties, DEFAULT_STROKEOPACITY)); return s; }
/** * Creates a stroke with the specified CSS parameters. * * @param color the color * @param width the width * @param opacity the opacity * @param dashArray the dash array * @return the stroke */ public static StrokeInfo createStroke(String color, int width, float opacity, String dashArray) { StrokeInfo strokeInfo = new StrokeInfo(); if (color != null) { strokeInfo.getCssParameterList().add(createCssParameter("stroke", color)); } strokeInfo.getCssParameterList().add(createCssParameter("stroke-width", width)); if (dashArray != null) { strokeInfo.getCssParameterList().add(createCssParameter("stroke-dasharray", dashArray)); } strokeInfo.getCssParameterList().add(createCssParameter("stroke-opacity", opacity)); return strokeInfo; }
private static void extractProperties(LineSymbolizerInfo lsi, Map<String, Object> properties) { if (lsi.getStroke() != null && lsi.getStroke().getCssParameterList() != null) { List<CssParameterInfo> plist = lsi.getStroke().getCssParameterList(); properties.put(STROKECOLOR, extractCssPropertyValue(STROKECOLOR, plist, DEFAULT_STROKECOLOR)); properties.put(STROKEOPACITY, extractCssPropertyValue(STROKEOPACITY, plist, DEFAULT_STROKEOPACITY)); properties.put(STROKEWIDTH, extractCssPropertyValue(STROKEWIDTH, plist, DEFAULT_STROKEWIDTH)); } }
private static void extractProperties(PolygonSymbolizerInfo psi, Map<String, Object> properties) { if (psi.getStroke() != null && psi.getStroke().getCssParameterList() != null) { List<CssParameterInfo> plist = psi.getStroke().getCssParameterList(); properties.put(STROKECOLOR, extractCssPropertyValue(STROKECOLOR, plist, DEFAULT_STROKECOLOR)); properties.put(STROKEOPACITY, extractCssPropertyValue(STROKEOPACITY, plist, DEFAULT_STROKEOPACITY)); properties.put(STROKEWIDTH, extractCssPropertyValue(STROKEWIDTH, plist, DEFAULT_STROKEWIDTH)); } if (psi.getFill() != null && psi.getFill().getCssParameterList() != null) { List<CssParameterInfo> plist = psi.getFill().getCssParameterList(); properties.put(FILLCOLOR, extractCssPropertyValue(FILLCOLOR, plist, DEFAULT_FILLCOLOR)); properties.put(FILLOPACITY, extractCssPropertyValue(FILLOPACITY, plist, DEFAULT_FILLOPACITY)); } }
private static void extractProperties(PointSymbolizerInfo psi, Map<String, Object> properties) { if (psi.getGraphic() != null && psi.getGraphic() != null) { if (psi.getGraphic().getSize() != null && psi.getGraphic().getSize().getValue() != null) { properties.put(SIZE, Float.valueOf(psi.getGraphic().getSize().getValue())); } if (psi.getGraphic().getChoiceList() != null && psi.getGraphic().getChoiceList().size() > 0) { ChoiceInfo ci = psi.getGraphic().getChoiceList().get(0); if (ci.getMark() != null) { if (ci.getMark().getStroke() != null && ci.getMark().getStroke().getCssParameterList() != null) { List<CssParameterInfo> plist = ci.getMark().getStroke().getCssParameterList(); properties.put(STROKECOLOR, extractCssPropertyValue(STROKECOLOR, plist, DEFAULT_STROKECOLOR)); properties.put(STROKEOPACITY, extractCssPropertyValue(STROKEOPACITY, plist, DEFAULT_STROKEOPACITY)); properties.put(STROKEWIDTH, extractCssPropertyValue(STROKEWIDTH, plist, DEFAULT_STROKEWIDTH)); } if (ci.getMark().getFill() != null && ci.getMark().getFill().getCssParameterList() != null) { List<CssParameterInfo> plist = ci.getMark().getFill().getCssParameterList(); properties.put(FILLCOLOR, extractCssPropertyValue(FILLCOLOR, plist, DEFAULT_FILLCOLOR)); properties.put(FILLOPACITY, extractCssPropertyValue(FILLOPACITY, plist, DEFAULT_FILLOPACITY)); } if (ci.getMark().getWellKnownName() != null && ci.getMark().getWellKnownName().getWellKnownName() != null) { properties.put(WELLKNOWNNAME, ci.getMark().getWellKnownName().getWellKnownName()); } } } } }