@Override public StyleDefinition add(final StyleDefinition other) { if (null != other.getAlpha()) { alpha = other.getAlpha(); if (null != other.getFillAlpha()) { fillAlpha = other.getFillAlpha(); if (null != other.getFillColor()) { fillColor = other.getFillColor(); if (null != other.getStrokeAlpha()) { strokeAlpha = other.getStrokeAlpha(); if (null != other.getStrokeWidth()) { strokeWidth = other.getStrokeWidth(); if (null != other.getStrokeColor()) { strokeColor = other.getStrokeColor(); if (null != other.getStrokeDashArray()) { strokeDashArray = other.getStrokeDashArray(); if (null != other.getFontFamily()) { fontFamily = other.getFontFamily(); if (null != other.getFontSize()) { fontSize = other.getFontSize();
public StyleDefinition getStyle(final List<String> names) { StyleDefinition result = null; for (String name : names) { final StyleDefinition style = getStyle(name); if (null != style && null == result) { result = style.copy(); } else if (null != style) { result.add(style.copy()); } } return result; }
if (null != styleDefinition.getFillColor()) { shapeRaw.append(formatString(FILL_COLOR, styleDefinition.getFillColor())); if (null != styleDefinition.getFillAlpha()) { shapeRaw.append(formatDouble(FILL_ALPHA, styleDefinition.getFillAlpha())); if (null != styleDefinition.getStrokeColor()) { shapeRaw.append(formatString(STROKE_COLOR, styleDefinition.getStrokeColor())); if (null != styleDefinition.getStrokeAlpha()) { shapeRaw.append(formatDouble(STROKE_ALPHA, styleDefinition.getStrokeAlpha())); if (null != styleDefinition.getStrokeWidth()) { shapeRaw.append(formatDouble(STROKE_WIDTH, styleDefinition.getStrokeWidth())); if (null != styleDefinition.getStrokeDashArray()) { String commaSeparatedValues = Stream.of(styleDefinition.getStrokeDashArray()).map(AbstractGenerator::formatDouble).collect(Collectors.joining(",")); shapeRaw.append(formatString(STROKE_DASHARRAY, commaSeparatedValues));
public static void assertStyleDef(final StyleDefinition styleDefinition, final double alpha, final String fillColor, final double fillAlpha, final String strokeColor, final double strokeAlpha, final double strokeWidth) { final double a = styleDefinition.getAlpha(); final String fc = styleDefinition.getFillColor(); final double fa = styleDefinition.getFillAlpha(); final String sc = styleDefinition.getStrokeColor(); final double sa = styleDefinition.getStrokeAlpha(); final double sw = styleDefinition.getStrokeWidth(); assertEquals(alpha, a, 0d); assertEquals(fillColor, fc); assertEquals(fillAlpha, fa, 0d); assertEquals(strokeColor, sc); assertEquals(strokeAlpha, sa, 0d); assertEquals(strokeWidth, sw, 0d); }
final StyleDefinition customStyle) { String result = ""; final Double alpha = null != customStyle ? customStyle.getAlpha() : globalStyle.getAlpha(); if (null != alpha) { result += viewInstanceName + AbstractGenerator.formatDouble(TITLE_ALPHA, alpha); final String fontFamily = null != customStyle ? customStyle.getFontFamily() : globalStyle.getFontFamily(); if (null != fontFamily) { result += viewInstanceName + AbstractGenerator.formatString(TITLE_FONT_FAMILY, fontFamily); final Double fontSize = null != customStyle ? customStyle.getFontSize() : globalStyle.getFontSize(); if (null != fontSize) { result += viewInstanceName + AbstractGenerator.formatDouble(TITLE_FONT_SIZE, fontSize); final String fontColor = null != customStyle ? customStyle.getFillColor() : globalStyle.getFillColor(); if (null != fontColor) { result += viewInstanceName + AbstractGenerator.formatString(TITLE_FONT_COLOR, fontColor); final Double strokeWidth = null != customStyle ? customStyle.getStrokeWidth() : globalStyle.getStrokeWidth(); if (null != strokeWidth) { result += viewInstanceName + AbstractGenerator.formatDouble(TITLE_STROKE_WIDTH, strokeWidth); final String strokeColor = null != customStyle ? customStyle.getStrokeColor() : globalStyle.getStrokeColor(); if (null != strokeColor) {
protected StyleDefinition translateStyles(final E element, final O def, final SVGTranslatorContext context) throws TranslatorException { final StyleDefinition styleDefinition = SVGStyleTranslator.parseStyleDefinition(element, context.getViewId(), context.getGlobalStyleSheet().orElse(null)); if (null != styleDefinition) { def.setAlpha(null != styleDefinition.getAlpha() ? styleDefinition.getAlpha() : 1d); } return styleDefinition; }