@Test public void testGetStyleCss_WithAdditionalStyles() throws Exception { simpleFeature.setAttribute(PlainFeatureFactory.ATTRIB_NAME_STYLE_CSS, "fill:120,120,120;stroke:0,10,0"); final String styleCss = SimpleFeatureFigureFactory.getStyleCss(simpleFeature, "symbol:pin"); assertEquals("fill:120,120,120;stroke:0,10,0;symbol:pin", styleCss); }
static String getStyleCss(SimpleFeature simpleFeature, String defaultStyleCss) { Object styleAttribute = simpleFeature.getAttribute(PlainFeatureFactory.ATTRIB_NAME_STYLE_CSS); if (styleAttribute instanceof String) { String css = (String) styleAttribute; if (!css.trim().isEmpty()) { final StringBuilder sb = new StringBuilder(css); final String[] cssAttributes = defaultStyleCss.split(";"); for (String cssAttribute : cssAttributes) { if (!css.contains(cssAttribute.split(":")[0].trim())) { sb.append(";"); sb.append(cssAttribute); } } return sb.toString(); } } return defaultStyleCss; }
SimpleFeatureFigureFactory implements FigureFactory { static String getStyleCss(SimpleFeature simpleFeature, String defaultStyleCss) { Object styleAttribute = simpleFeature.getAttribute(PlainFeatureFactory.ATTRIB_NAME_STYLE_CSS); if (styleAttribute instanceof String) { String css = (String) styleAttribute; if (!css.trim().isEmpty()) { final StringBuilder sb = new StringBuilder(css); final String[] cssAttributes = defaultStyleCss.split(";"); for (String cssAttribute : cssAttributes) { if (!css.contains(cssAttribute.split(":")[0].trim())) { sb.append(";"); sb.append(cssAttribute); } } return sb.toString(); } } return defaultStyleCss; } }
SimpleFeatureFigureFactory implements FigureFactory { static String getStyleCss(SimpleFeature simpleFeature, String defaultStyleCss) { Object styleAttribute = simpleFeature.getAttribute(PlainFeatureFactory.ATTRIB_NAME_STYLE_CSS); if (styleAttribute instanceof String) { String css = (String) styleAttribute; if (!css.trim().isEmpty()) { final StringBuilder sb = new StringBuilder(css); final String[] cssAttributes = defaultStyleCss.split(";"); for (String cssAttribute : cssAttributes) { if (!css.contains(cssAttribute.split(":")[0].trim())) { sb.append(";"); sb.append(cssAttribute); } } return sb.toString(); } } return defaultStyleCss; } SimpleFeatureFigureFactory(SimpleFeatureType simpleFeatureType, SceneTransformProvider provider); }
SimpleFeatureFigureFactory implements FigureFactory { static String getStyleCss(SimpleFeature simpleFeature, String defaultStyleCss) { Object styleAttribute = simpleFeature.getAttribute(PlainFeatureFactory.ATTRIB_NAME_STYLE_CSS); if (styleAttribute instanceof String) { String css = (String) styleAttribute; if (!css.trim().isEmpty()) { final StringBuilder sb = new StringBuilder(css); final String[] cssAttributes = defaultStyleCss.split(";"); for (String cssAttribute : cssAttributes) { if (!css.contains(cssAttribute.split(":")[0].trim())) { sb.append(";"); sb.append(cssAttribute); } } return sb.toString(); } } return defaultStyleCss; } SimpleFeatureFigureFactory(SimpleFeatureType simpleFeatureType, SceneTransformProvider provider); @Override PointFigure createPointFigure(Point2D point, FigureStyle style); @Override ShapeFigure createLineFigure(Shape shape, FigureStyle style); @Override ShapeFigure createPolygonFigure(Shape shape, FigureStyle style); SimpleFeatureFigure createSimpleFeatureFigure(SimpleFeature simpleFeature, String defaultStyleCss); FigureStyle deriveSelectedStyle(FigureStyle style); }
SimpleFeatureFigureFactory implements FigureFactory { static String getStyleCss(SimpleFeature simpleFeature, String defaultStyleCss) { Object styleAttribute = simpleFeature.getAttribute(PlainFeatureFactory.ATTRIB_NAME_STYLE_CSS); if (styleAttribute instanceof String) { String css = (String) styleAttribute; if (!css.trim().isEmpty()) { final StringBuilder sb = new StringBuilder(css); final String[] cssAttributes = defaultStyleCss.split(";"); for (String cssAttribute : cssAttributes) { if (!css.contains(cssAttribute.split(":")[0].trim())) { sb.append(";"); sb.append(cssAttribute); } } return sb.toString(); } } return defaultStyleCss; } SimpleFeatureFigureFactory(SimpleFeatureType simpleFeatureType, SceneTransformProvider provider); @Override PointFigure createPointFigure(Point2D point, FigureStyle style); @Override ShapeFigure createLineFigure(Shape shape, FigureStyle style); @Override ShapeFigure createPolygonFigure(Shape shape, FigureStyle style); SimpleFeatureFigure createSimpleFeatureFigure(SimpleFeature simpleFeature, String defaultStyleCss); FigureStyle deriveSelectedStyle(FigureStyle style);  }