Search in sources :

Example 1 with PointPlacement

use of org.geotools.styling.PointPlacement in project sldeditor by robward-scisys.

the class DefaultSymbols method createDefaultTextSymbolizer.

/**
 * Creates the default text symbolizer.
 *
 * @return the text symbolizer
 */
public static TextSymbolizer createDefaultTextSymbolizer() {
    Expression fontFamily = ff.literal("Serif");
    Expression fontSize = ff.literal(10.0);
    Expression fontStyle = ff.literal("normal");
    Expression fontWeight = ff.literal("normal");
    Expression rotation = ff.literal(0.0);
    Expression label = ff.literal("Test");
    String geometryFieldName = null;
    Expression geometryField = ff.property(geometryFieldName);
    String name = Localisation.getString(SLDTreeTools.class, "TreeItem.newText");
    AnchorPoint anchor = null;
    Displacement displacement = null;
    PointPlacement pointPlacement = styleFactory.pointPlacement(anchor, displacement, rotation);
    Expression fillColour = ff.literal(DEFAULT_COLOUR);
    Expression fillColourOpacity = ff.literal(1.0);
    Fill fill = styleFactory.fill(null, fillColour, fillColourOpacity);
    Halo halo = null;
    List<Expression> fontFamilyList = new ArrayList<>();
    fontFamilyList.add(fontFamily);
    Font font = styleFactory.font(fontFamilyList, fontStyle, fontWeight, fontSize);
    Description description = null;
    Unit<?> unit = null;
    return styleFactory.textSymbolizer(name, geometryField, description, unit, label, font, pointPlacement, halo, fill);
}
Also used : PointPlacement(org.geotools.styling.PointPlacement) Fill(org.geotools.styling.Fill) AnchorPoint(org.geotools.styling.AnchorPoint) Description(org.geotools.styling.Description) Expression(org.opengis.filter.expression.Expression) ArrayList(java.util.ArrayList) Displacement(org.opengis.style.Displacement) Halo(org.geotools.styling.Halo) Font(org.geotools.styling.Font)

Aggregations

ArrayList (java.util.ArrayList)1 AnchorPoint (org.geotools.styling.AnchorPoint)1 Description (org.geotools.styling.Description)1 Fill (org.geotools.styling.Fill)1 Font (org.geotools.styling.Font)1 Halo (org.geotools.styling.Halo)1 PointPlacement (org.geotools.styling.PointPlacement)1 Expression (org.opengis.filter.expression.Expression)1 Displacement (org.opengis.style.Displacement)1