use of org.geotools.styling.StyleBuilder in project sldeditor by robward-scisys.
the class SLDExternalImagesTest method createTestPolygon.
/**
* Creates the test polygon.
*
* @param url the url
* @return the styled layer descriptor
*/
private StyledLayerDescriptor createTestPolygon(URL url) {
StyleBuilder sb = new StyleBuilder();
StyleFactory styleFactory = sb.getStyleFactory();
StyledLayerDescriptor sld = styleFactory.createStyledLayerDescriptor();
NamedLayer namedLayer = styleFactory.createNamedLayer();
sld.addStyledLayer(namedLayer);
Style style = styleFactory.createStyle();
namedLayer.addStyle(style);
List<FeatureTypeStyle> ftsList = style.featureTypeStyles();
FeatureTypeStyle fts = styleFactory.createFeatureTypeStyle();
ftsList.add(fts);
Rule rule = styleFactory.createRule();
fts.rules().add(rule);
PolygonSymbolizer polygon = styleFactory.createPolygonSymbolizer();
rule.symbolizers().add(polygon);
Graphic graphicFill1 = createGraphic(url, styleFactory);
Graphic graphicFill2 = createGraphic(url, styleFactory);
Graphic graphicStroke = createGraphic(url, styleFactory);
Fill fill = styleFactory.createFill(null, null, null, graphicFill1);
polygon.setFill(fill);
Stroke stroke = styleFactory.createStroke(null, null, null, null, null, null, null, graphicFill2, graphicStroke);
polygon.setStroke(stroke);
return sld;
}
use of org.geotools.styling.StyleBuilder in project sldeditor by robward-scisys.
the class SLDExternalImagesTest method createTestLine.
/**
* Creates the test line.
*
* @param url the url
* @return the styled layer descriptor
*/
private StyledLayerDescriptor createTestLine(URL url) {
StyleBuilder sb = new StyleBuilder();
StyleFactory styleFactory = sb.getStyleFactory();
StyledLayerDescriptor sld = styleFactory.createStyledLayerDescriptor();
NamedLayer namedLayer = styleFactory.createNamedLayer();
sld.addStyledLayer(namedLayer);
Style style = styleFactory.createStyle();
namedLayer.addStyle(style);
List<FeatureTypeStyle> ftsList = style.featureTypeStyles();
FeatureTypeStyle fts = styleFactory.createFeatureTypeStyle();
ftsList.add(fts);
Rule rule = styleFactory.createRule();
fts.rules().add(rule);
LineSymbolizer line = styleFactory.createLineSymbolizer();
rule.symbolizers().add(line);
Graphic graphicFill = createGraphic(url, styleFactory);
Graphic graphicStroke = createGraphic(url, styleFactory);
Stroke stroke = styleFactory.createStroke(null, null, null, null, null, null, null, graphicFill, graphicStroke);
line.setStroke(stroke);
return sld;
}
use of org.geotools.styling.StyleBuilder in project sldeditor by robward-scisys.
the class FieldConfigFont method populateField.
/**
* Populate string field, overridden if necessary.
*
* @param value the value
*/
@Override
public void populateField(String value) {
StyleBuilder styleBuilder = new StyleBuilder();
Font font = styleBuilder.createFont(defaultValue, DEFAULT_FONT_SIZE);
populateField(font);
}
use of org.geotools.styling.StyleBuilder in project sldeditor by robward-scisys.
the class FieldConfigFontPreview method populateField.
/**
* Populate string field, overridden if necessary.
*
* @param value the value
*/
@Override
public void populateField(String value) {
StyleBuilder styleBuilder = new StyleBuilder();
Font font = styleBuilder.createFont(defaultValue, DEFAULT_FONT_SIZE);
populateField(font);
}
use of org.geotools.styling.StyleBuilder in project sldeditor by robward-scisys.
the class FieldConfigPopulationTest method testColour.
/**
* Test method for
* {@link com.sldeditor.ui.detail.config.FieldConfigPopulation#populateColourField(com.sldeditor.ui.detail.config.FieldId, org.opengis.filter.expression.Expression, org.opengis.filter.expression.Expression)}.
*/
@Test
public void testColour() {
FieldIdEnum fieldId = FieldIdEnum.DESCRIPTION;
GraphicPanelFieldManager fieldConfigManager = new GraphicPanelFieldManager(String.class);
FieldConfigColour colourField = new FieldConfigColour(new FieldConfigCommonData(Geometry.class, fieldId, "label", true));
colourField.createUI();
colourField.createUI();
fieldConfigManager.add(fieldId, colourField);
FieldConfigPopulation obj = new FieldConfigPopulation(fieldConfigManager);
StyleBuilder styleBuilder = new StyleBuilder();
Expression colour = styleBuilder.colorExpression(Color.red);
obj.populateColourField(fieldId, colour);
FieldIdEnum wrongFieldEnum = FieldIdEnum.ELSE_FILTER;
obj.populateColourField(wrongFieldEnum, colour);
}
Aggregations