*
* @param svgp SVG-Plot
*/
private void addCSSClasses(SVGPlot svgp, StylingPolicy sp) {
final StyleLibrary style = context.getStyleLibrary();
final LineStyleLibrary lines = style.lines();
final double width = .5 * style.getLineWidth(StyleLibrary.PLOT);
if(sp instanceof ClassStylingPolicy) {
ClassStylingPolicy csp = (ClassStylingPolicy) sp;
for(int i = csp.getMinStyle(); i < csp.getMaxStyle(); i++) {
String key = DATALINE + "_" + i;
if(!svgp.getCSSClassManager().contains(key)) {
CSSClass cls = new CSSClass(this, key);
cls.setStatement(SVGConstants.CSS_STROKE_LINECAP_PROPERTY, SVGConstants.CSS_ROUND_VALUE);
cls.setStatement(SVGConstants.CSS_STROKE_LINEJOIN_PROPERTY, SVGConstants.CSS_ROUND_VALUE);
cls.setStatement(SVGConstants.CSS_FILL_PROPERTY, SVGConstants.CSS_NONE_VALUE);
lines.formatCSSClass(cls, i, width);
svgp.addCSSClassOrLogError(cls);
}
}
}
else {
// Class for the distance function
if(!svgp.getCSSClassManager().contains(DATALINE)) {
CSSClass cls = new CSSClass(this, DATALINE);
cls.setStatement(SVGConstants.CSS_STROKE_LINECAP_PROPERTY, SVGConstants.CSS_ROUND_VALUE);
cls.setStatement(SVGConstants.CSS_STROKE_LINEJOIN_PROPERTY, SVGConstants.CSS_ROUND_VALUE);
cls.setStatement(SVGConstants.CSS_FILL_PROPERTY, SVGConstants.CSS_NONE_VALUE);
lines.formatCSSClass(cls, -1, width);
svgp.addCSSClassOrLogError(cls);
}
}
svgp.updateStyleElement();
}