public class StyleGenerator extends Object
Modifier and Type | Field and Description |
---|---|
static int |
ELSEMODE_IGNORE |
static int |
ELSEMODE_INCLUDEASMAX |
static int |
ELSEMODE_INCLUDEASMIN |
Modifier | Constructor and Description |
---|---|
protected |
StyleGenerator() |
Modifier and Type | Method and Description |
---|---|
static FeatureTypeStyle |
createFeatureTypeStyle(Classifier classifier,
Expression expression,
Color[] colors,
String typeId,
GeometryDescriptor geometryAttrType,
int elseMode,
double opacity,
Stroke defaultStroke)
Merges a classifier, array of colors and other data into a FeatureTypeStyle object.
|
static boolean |
isRanged(String styleExpression)
Determines if a string is an instance of a ranged expression or unique values.
|
static void |
modifyFTS(FeatureTypeStyle fts,
int ruleIndex,
String styleExpression)
Used to update an existing style based on the provided input.
|
static Filter |
toExplicitFilter(String styleExpression,
Expression attribExpr)
Creates a filter with each value explicitly defined.
|
static Filter |
toExplicitFilter(String styleExpression,
SimpleFeatureType featureType,
String attributeTypeName)
Creates a filter with each value explicitly defined.
|
static Filter[] |
toFilter(String[] styleExpression,
SimpleFeatureType[] featureType,
String[] attributeTypeName)
Converts an array of styleExpressions and attributes into Filters
styleExpression[0] = "1..5"; styleExpression[1] = "5..10"; styleExpression[2] = "11, -13"; ---> filter[0] = [[1 <= attr] AND [attr < 5]] filter[1] = [[6 <= attr] AND [attr <= 10]] filter[2] = [[attr = 11] OR [attr = -13]] |
static Filter |
toRangedFilter(String styleExpression,
SimpleFeatureType featureType,
String attributeTypeName,
boolean upperBoundClosed)
Creates a filter for a range of values.
|
static String |
toStyleExpression(Filter filter) |
static String[] |
toStyleExpression(Filter[] filter) |
public static final int ELSEMODE_IGNORE
public static final int ELSEMODE_INCLUDEASMIN
public static final int ELSEMODE_INCLUDEASMAX
public static FeatureTypeStyle createFeatureTypeStyle(Classifier classifier, Expression expression, Color[] colors, String typeId, GeometryDescriptor geometryAttrType, int elseMode, double opacity, Stroke defaultStroke) throws IllegalFilterException
classifier
- colors
- typeId
- semantic type identifier, which will be prefixed with "colorbrewer:"geometryAttrType
- elseMode
- opacity
- defaultStroke
- IllegalFilterException
public static void modifyFTS(FeatureTypeStyle fts, int ruleIndex, String styleExpression) throws IllegalFilterException
fts
- ruleIndex
- styleExpression
- IllegalFilterException
public static Filter[] toFilter(String[] styleExpression, SimpleFeatureType[] featureType, String[] attributeTypeName) throws IllegalFilterException
styleExpression[0] = "1..5";
styleExpression[1] = "5..10";
styleExpression[2] = "11, -13";
--->
filter[0] = [[1 <= attr] AND [attr < 5]]
filter[1] = [[6 <= attr] AND [attr <= 10]]
filter[2] = [[attr = 11] OR [attr = -13]]
styleExpression
- strings of ranged expressions "lowValue..highValue" or explicit values
"value1, value2"featureType
- attributeTypeName
- IllegalFilterException
public static Filter toRangedFilter(String styleExpression, SimpleFeatureType featureType, String attributeTypeName, boolean upperBoundClosed) throws IllegalFilterException
Examples:
"1..5", closed=true --> [[1 <= attr] AND [attr <= 5]]
"1..10", closed=false --> [[1 <= attr] AND [attr < 10]] "..10, closed=true --> [attr <= 10]
styleExpression
- the ranged style expression (minValue..maxValue)featureType
- the featureTypeattributeTypeName
- the attributeTypeName whose values correspond toupperBoundClosed
- does the upper bound include the max value? (true: <=, false: <)IllegalFilterException
public static boolean isRanged(String styleExpression)
public static Filter toExplicitFilter(String styleExpression, SimpleFeatureType featureType, String attributeTypeName) throws IllegalFilterException
Examples:
"LIB" --> [PARTY = LIB]
"LIB, NDP" --> [[PARTY = LIB] OR [PARTY = NDP]]
styleExpression
- the list of attribute values, separated by commas (and optional
spaces)attributeTypeName
- A Sting with the attributeTypeName whose values correspond toIllegalFilterException
public static Filter toExplicitFilter(String styleExpression, Expression attribExpr) throws IllegalFilterException
Examples:
"LIB" --> [PARTY = LIB]
"LIB, NDP" --> [[PARTY = LIB] OR [PARTY = NDP]]
styleExpression
- the list of attribute values, separated by commas (and optional
spaces)attribExpr
- an Expression to compare each value with (simple case =
attributeExpression)IllegalFilterException
Copyright © 1996–2019 Geotools. All rights reserved.