/** * Create a point style without labels * * @param wellKnownName one of: Circle, Square, Cross, X, Triangle or Star * @param lineColor color for the point symbol outline * @param fillColor color for the point symbol fill * @param opacity a value between 0 and 1 for the opacity of the fill * @param size size of the point symbol * @return a new Style instance */ public static Style createPointStyle( String wellKnownName, Color lineColor, Color fillColor, float opacity, float size) { return createPointStyle(wellKnownName, lineColor, fillColor, opacity, size, null, null); }
fillColor = color; return createPointStyle("Circle", color, fillColor, 0.5f, 3.0f);
/** * Create a point style without labels * * @param wellKnownName one of: Circle, Square, Cross, X, Triangle or Star * @param lineColor color for the point symbol outline * @param fillColor color for the point symbol fill * @param opacity a value between 0 and 1 for the opacity of the fill * @param size size of the point symbol * * @return a new Style instance */ public static Style createPointStyle( String wellKnownName, Color lineColor, Color fillColor, float opacity, float size) { return createPointStyle(wellKnownName, lineColor, fillColor, opacity, size, null, null); }
Style style = SLD.createPointStyle("circle", Color.BLUE, Color.BLUE, 1f, 10f); PointSymbolizer ps = (PointSymbolizer)
public Style getDefaultFeatureStyle() { Style defaultStyle = null; Class<?> origBinding = featureType.getGeometryDescriptor().getType().getBinding(); Random rnd = new Random(); Color randomColor = Color.getHSBColor(rnd.nextFloat(), 1.0f, 1.0f); if (origBinding.isAssignableFrom(Point.class)) { defaultStyle = SLD.createPointStyle("Circle", Color.GRAY, randomColor, 1.0f, 4); } else if (origBinding.isAssignableFrom(MultiPoint.class)) { defaultStyle = SLD.createPointStyle("Circle", Color.GRAY, randomColor, 1.0f, 4); } else if (origBinding.isAssignableFrom(LineString.class)) { defaultStyle = SLD.createLineStyle(randomColor, 1f); } else if (origBinding.isAssignableFrom(MultiLineString.class)) { defaultStyle = SLD.createLineStyle(randomColor, 1f); } else if (origBinding.isAssignableFrom(Polygon.class)) { defaultStyle = SLD.createPolygonStyle(Color.GRAY, randomColor, 0.5f); } else if (origBinding.isAssignableFrom(MultiPolygon.class)) { defaultStyle = SLD.createPolygonStyle(Color.GRAY, randomColor, 0.5f); } return defaultStyle; }
fillColor = color; return createPointStyle("Circle", color, fillColor, 0.5f, 3.0f);
protected final PointSymbolizer mark( String name, Color stroke, Color fill, float opacity, int size) { return SLD.pointSymbolizer(SLD.createPointStyle(name, stroke, fill, opacity, size)); }
case MULTIPOINT: style = SLD.createPointStyle( dialog.getPointSymbolName(), dialog.getLineColor(),
public Style getStyle() { Style style = null; if ( geometry instanceof Point ) { style = SLD.createPointStyle( CIRCLE, strokeColor, fillColor, fillOpacity, radius ); } else if ( geometry instanceof Polygon || geometry instanceof MultiPolygon ) { if ( MapLayerType.BOUNDARY.equals( mapLayerType ) ) { style = SLD.createLineStyle( strokeColor, LINE_STROKE_WIDTH ); } else { style = SLD.createPolygonStyle( strokeColor, fillColor, fillOpacity ); } } else { style = SLD.createSimpleStyle( getFeatureType() ); } return style; }
@Test public void testGraphicFallbacks() { FilterFactory ff = CommonFactoryFinder.getFilterFactory(); Style style = SLD.createPointStyle("circle", Color.RED, Color.yellow, 0.5f, 10f); Graphic g = SLD.graphic(SLD.pointSymbolizer(style)); g.setRotation(ff.literal(45)); g.setOpacity(ff.literal(0.5)); Map<String, String> props = new HashMap<String, String>(); props.put("0.0.0", ""); style = IconPropertyInjector.injectProperties(style, props); g = SLD.graphic(SLD.pointSymbolizer(style)); assertEquals(10.0, g.getSize().evaluate(null, Double.class), 0.1); assertEquals(45.0, g.getRotation().evaluate(null, Double.class), 0.1); assertEquals(0.5, g.getOpacity().evaluate(null, Double.class), 0.1); } }
style = SLD.createPointStyle( dialog.getPointSymbolName(), dialog.getLineColor(),