Package repast.simphony.gis.styleEditor
Class StylePreviewFactory
- java.lang.Object
-
- repast.simphony.gis.styleEditor.StylePreviewFactory
-
public class StylePreviewFactory extends Object
Factory for creating style preview labels that are used in GUI elements to show how style agents will appear. Currently the the factory supports creation of two size: regular and small. Regular sized previews show how the styles will actually appear in the display with respect to size, while the small version is just a scaled down version that can easily fit in GUI elements like buttons or table cells.- Author:
- Eric Tatara, Nick Collier
-
-
Field Summary
Fields Modifier and Type Field Description static Color
DEFAULT_LINE_STROKE_COLOR
static double
DEFAULT_LINE_STROKE_OPACITY
static double
DEFAULT_LINE_STROKE_WIDTH
static Color
DEFAULT_POINT_FILL
static String
DEFAULT_POINT_MARK
static double
DEFAULT_POINT_OPACITY
static double
DEFAULT_POINT_ROTATION
static double
DEFAULT_POINT_SIZE
static Color
DEFAULT_POINT_STROKE_COLOR
static double
DEFAULT_POINT_STROKE_OPACITY
static double
DEFAULT_POINT_STROKE_WIDTH
static Color
DEFAULT_POLY_FILL
static double
DEFAULT_POLY_OPACITY
static Color
DEFAULT_POLY_STROKE_COLOR
static double
DEFAULT_POLY_STROKE_OPACITY
static double
DEFAULT_POLY_STROKE_WIDTH
-
Constructor Summary
Constructors Constructor Description StylePreviewFactory()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static Icon
createIcon(org.geotools.styling.Rule rule)
Create an Icon instance from a Rule.static Icon
createIcon(org.geotools.styling.Style style)
Create an Icon instance from a Style.static PreviewLabel
createPreviewLabel(org.geotools.styling.Rule rule)
Creates an instance of a PreviewLabel using the Rule properties.static Icon
createSmallIcon(org.geotools.styling.Rule rule)
Create an small Icon instance from a Rule.static <T> T
evaluateExpression(org.opengis.filter.expression.Expression expr, T defaultValue, Class<T> type)
Returns either the evaluated expression if the expression is a Literal, or the default value for other types of expression, such as property expressions (which are the property name to be evaluated at run time).static org.geotools.styling.Style
getDefaultStyle(GeometryUtil.GeometryType geomType)
Provide a default style for the style editors.
-
-
-
Field Detail
-
DEFAULT_POINT_MARK
public static final String DEFAULT_POINT_MARK
- See Also:
- Constant Field Values
-
DEFAULT_POINT_SIZE
public static final double DEFAULT_POINT_SIZE
- See Also:
- Constant Field Values
-
DEFAULT_POINT_ROTATION
public static final double DEFAULT_POINT_ROTATION
- See Also:
- Constant Field Values
-
DEFAULT_POINT_FILL
public static final Color DEFAULT_POINT_FILL
-
DEFAULT_POINT_OPACITY
public static final double DEFAULT_POINT_OPACITY
- See Also:
- Constant Field Values
-
DEFAULT_POINT_STROKE_WIDTH
public static final double DEFAULT_POINT_STROKE_WIDTH
- See Also:
- Constant Field Values
-
DEFAULT_POINT_STROKE_COLOR
public static final Color DEFAULT_POINT_STROKE_COLOR
-
DEFAULT_POINT_STROKE_OPACITY
public static final double DEFAULT_POINT_STROKE_OPACITY
- See Also:
- Constant Field Values
-
DEFAULT_LINE_STROKE_WIDTH
public static final double DEFAULT_LINE_STROKE_WIDTH
- See Also:
- Constant Field Values
-
DEFAULT_LINE_STROKE_COLOR
public static final Color DEFAULT_LINE_STROKE_COLOR
-
DEFAULT_LINE_STROKE_OPACITY
public static final double DEFAULT_LINE_STROKE_OPACITY
- See Also:
- Constant Field Values
-
DEFAULT_POLY_FILL
public static final Color DEFAULT_POLY_FILL
-
DEFAULT_POLY_OPACITY
public static final double DEFAULT_POLY_OPACITY
- See Also:
- Constant Field Values
-
DEFAULT_POLY_STROKE_WIDTH
public static final double DEFAULT_POLY_STROKE_WIDTH
- See Also:
- Constant Field Values
-
DEFAULT_POLY_STROKE_COLOR
public static final Color DEFAULT_POLY_STROKE_COLOR
-
DEFAULT_POLY_STROKE_OPACITY
public static final double DEFAULT_POLY_STROKE_OPACITY
- See Also:
- Constant Field Values
-
-
Method Detail
-
createPreviewLabel
public static PreviewLabel createPreviewLabel(org.geotools.styling.Rule rule)
Creates an instance of a PreviewLabel using the Rule properties.- Parameters:
rule
- the Rule used to create the PreviewLabel- Returns:
- the new PrviewLabel
-
createIcon
public static Icon createIcon(org.geotools.styling.Style style)
Create an Icon instance from a Style. Useful for creating JLabel Icons for GUI components.- Parameters:
style
- the Style used to create the Icon- Returns:
- the Icon
-
createIcon
public static Icon createIcon(org.geotools.styling.Rule rule)
Create an Icon instance from a Rule. Useful for creating JLabel Icons for GUI components.- Parameters:
rule
- the Rule used to create the Icon- Returns:
- the Icon
-
createSmallIcon
public static Icon createSmallIcon(org.geotools.styling.Rule rule)
Create an small Icon instance from a Rule. Useful for creating JLabel Icons for GUI components that require small icons.- Parameters:
rule
- the Rule used to create the Icon- Returns:
- the Icon
-
getDefaultStyle
public static org.geotools.styling.Style getDefaultStyle(GeometryUtil.GeometryType geomType)
Provide a default style for the style editors.- Parameters:
geomType
- the geometry type for the selected agent class.- Returns:
- the default style for the geometry type.
-
evaluateExpression
public static <T> T evaluateExpression(org.opengis.filter.expression.Expression expr, T defaultValue, Class<T> type)
Returns either the evaluated expression if the expression is a Literal, or the default value for other types of expression, such as property expressions (which are the property name to be evaluated at run time).- Parameters:
expr
- the Expression to evaluatedefaultValue
- the default value to use when the expression is not a Literaltype
- the class of the Expression literal- Returns:
- the evaluated expression
-
-