/** * Create a minimal style to render features of type {@code type}. * * @param type the feature type * @return a new Style instance */ public static Style createSimpleStyle(FeatureType type) { return createSimpleStyle(type, Color.BLACK); }
/** * Helper for some addLayer methods that take a Style argument. Checks if the style is null and, * if so, attepts to create a default Style. * * @param style style argument that was passed to addLayer * @param featureType feature type for which a default style be will made if required * @return the input Style object if not {@code null}, or a Style instance for a default style */ private Style checkStyle(Style style, FeatureType featureType) { if (style != null) { return style; } Style defaultStyle = SLD.createSimpleStyle(featureType); if (defaultStyle == null) { throw new IllegalStateException("Failed to creaate a default style for the layer"); } return defaultStyle; }
/** * Create a minimal style to render features of type {@code typeName} read from the given data * store * * @param store the data store containing the features * @param typeName the feature type to create the style for * @param color single color to use for all components of the Style * @return a new Style instance * @throws java.io.IOException if the data store cannot be accessed */ public static Style createSimpleStyle(DataStore store, String typeName, Color color) throws IOException { SimpleFeatureType type = store.getSchema(typeName); return createSimpleStyle(type, color); }
/** * Create a minimal style to render features of type {@code type}. * * @param type the feature type * * @return a new Style instance */ public static Style createSimpleStyle(FeatureType type) { return createSimpleStyle(type, Color.BLACK); }
/** * Helper for some addLayer methods that take a Style argument. Checks if the style is null and, * if so, attepts to create a default Style. * * @param style * style argument that was passed to addLayer * @param featureType * feature type for which a default style be will made if required * * @return the input Style object if not {@code null}, or a Style instance for a default style */ private Style checkStyle(Style style, FeatureType featureType) { if (style != null) { return style; } Style defaultStyle = SLD.createSimpleStyle(featureType); if (defaultStyle == null) { throw new IllegalStateException("Failed to creaate a default style for the layer"); } return defaultStyle; }
/** * Create a minimal style to render features of type {@code typeName} * read from the given data store * * @param store the data store containing the features * * @param typeName the feature type to create the style for * * @param color single color to use for all components of the Style * * @return a new Style instance * * @throws java.io.IOException if the data store cannot be accessed */ public static Style createSimpleStyle(AbstractDataStore store, String typeName, Color color) throws IOException { SimpleFeatureType type = store.getSchema(typeName); return createSimpleStyle(type, color); }
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; }