Search in sources :

Example 6 with StyleBuilder

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;
}
Also used : StyleFactory(org.geotools.styling.StyleFactory) StyledLayerDescriptor(org.geotools.styling.StyledLayerDescriptor) Fill(org.geotools.styling.Fill) Stroke(org.geotools.styling.Stroke) PolygonSymbolizer(org.geotools.styling.PolygonSymbolizer) ExternalGraphic(org.geotools.styling.ExternalGraphic) Graphic(org.geotools.styling.Graphic) StyleBuilder(org.geotools.styling.StyleBuilder) Style(org.geotools.styling.Style) FeatureTypeStyle(org.geotools.styling.FeatureTypeStyle) FeatureTypeStyle(org.geotools.styling.FeatureTypeStyle) Rule(org.geotools.styling.Rule) NamedLayer(org.geotools.styling.NamedLayer)

Example 7 with StyleBuilder

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;
}
Also used : StyleFactory(org.geotools.styling.StyleFactory) StyledLayerDescriptor(org.geotools.styling.StyledLayerDescriptor) Stroke(org.geotools.styling.Stroke) ExternalGraphic(org.geotools.styling.ExternalGraphic) Graphic(org.geotools.styling.Graphic) LineSymbolizer(org.geotools.styling.LineSymbolizer) StyleBuilder(org.geotools.styling.StyleBuilder) Style(org.geotools.styling.Style) FeatureTypeStyle(org.geotools.styling.FeatureTypeStyle) FeatureTypeStyle(org.geotools.styling.FeatureTypeStyle) Rule(org.geotools.styling.Rule) NamedLayer(org.geotools.styling.NamedLayer)

Example 8 with StyleBuilder

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);
}
Also used : StyleBuilder(org.geotools.styling.StyleBuilder) Font(org.geotools.styling.Font)

Example 9 with StyleBuilder

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);
}
Also used : StyleBuilder(org.geotools.styling.StyleBuilder) Font(org.geotools.styling.Font)

Example 10 with StyleBuilder

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);
}
Also used : Geometry(com.vividsolutions.jts.geom.Geometry) FieldConfigPopulation(com.sldeditor.ui.detail.config.FieldConfigPopulation) Expression(org.opengis.filter.expression.Expression) FieldConfigCommonData(com.sldeditor.ui.detail.config.FieldConfigCommonData) StyleBuilder(org.geotools.styling.StyleBuilder) FieldConfigColour(com.sldeditor.ui.detail.config.FieldConfigColour) FieldIdEnum(com.sldeditor.common.xml.ui.FieldIdEnum) GraphicPanelFieldManager(com.sldeditor.ui.detail.GraphicPanelFieldManager) Test(org.junit.Test)

Aggregations

StyleBuilder (org.geotools.styling.StyleBuilder)30 Test (org.junit.Test)25 FieldConfigCommonData (com.sldeditor.ui.detail.config.FieldConfigCommonData)24 GraphicPanelFieldManager (com.sldeditor.ui.detail.GraphicPanelFieldManager)16 Mark (org.geotools.styling.Mark)16 FieldIdEnum (com.sldeditor.common.xml.ui.FieldIdEnum)14 PointFillDetails (com.sldeditor.ui.detail.PointFillDetails)11 FieldConfigColour (com.sldeditor.ui.detail.config.FieldConfigColour)11 FieldConfigBase (com.sldeditor.ui.detail.config.FieldConfigBase)9 FieldConfigSlider (com.sldeditor.ui.detail.config.FieldConfigSlider)9 FieldConfigSymbolType (com.sldeditor.ui.detail.config.FieldConfigSymbolType)9 ExternalGraphicImpl (org.geotools.styling.ExternalGraphicImpl)9 ColourFieldConfig (com.sldeditor.ui.detail.ColourFieldConfig)7 Expression (org.opengis.filter.expression.Expression)6 Font (org.geotools.styling.Font)5 FieldConfigPopulation (com.sldeditor.ui.detail.config.FieldConfigPopulation)4 FieldConfigMarker (com.sldeditor.ui.detail.config.symboltype.FieldConfigMarker)4 Geometry (com.vividsolutions.jts.geom.Geometry)4 File (java.io.File)4 IOException (java.io.IOException)4