Search in sources :

Example 1 with Displacement

use of org.opengis.style.Displacement 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 = (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<Expression>();
    fontFamilyList.add(fontFamily);
    Font font = (Font) styleFactory.font(fontFamilyList, fontStyle, fontWeight, fontSize);
    Description description = null;
    Unit<Length> unit = null;
    TextSymbolizer newTextSymbolizer = (TextSymbolizer) styleFactory.textSymbolizer(name, geometryField, description, unit, label, font, pointPlacement, halo, fill);
    return newTextSymbolizer;
}
Also used : PointPlacement(org.geotools.styling.PointPlacement) Fill(org.geotools.styling.Fill) Description(org.geotools.styling.Description) ArrayList(java.util.ArrayList) Displacement(org.opengis.style.Displacement) Font(org.geotools.styling.Font) AnchorPoint(org.geotools.styling.AnchorPoint) Expression(org.opengis.filter.expression.Expression) Length(javax.measure.quantity.Length) TextSymbolizer(org.geotools.styling.TextSymbolizer) Halo(org.geotools.styling.Halo)

Example 2 with Displacement

use of org.opengis.style.Displacement in project sldeditor by robward-scisys.

the class DefaultSymbols method createDefaultPointSymbolizer.

/**
 * Creates the default point symbolizer.
 *
 * @return the point symbolizer
 */
public static PointSymbolizer createDefaultPointSymbolizer() {
    String geometryFieldName = null;
    Expression geometryField = ff.property(geometryFieldName);
    List<GraphicalSymbol> symbolList = new ArrayList<GraphicalSymbol>();
    Stroke stroke = null;
    AnchorPoint anchorPoint = null;
    Displacement displacement = null;
    Fill fill = styleFactory.createFill(ff.literal(DEFAULT_MARKER_COLOUR));
    GraphicalSymbol symbol = styleFactory.mark(ff.literal(DEFAULT_MARKER_SYMBOL), fill, stroke);
    symbolList.add(symbol);
    Graphic graphic = styleFactory.graphic(symbolList, ff.literal(DEFAULT_COLOUR_OPACITY), ff.literal(DEFAULT_MARKER_SYMBOL_SIZE), ff.literal(0.0), anchorPoint, displacement);
    PointSymbolizer newPointSymbolizer = (PointSymbolizer) styleFactory.pointSymbolizer(Localisation.getString(SLDTreeTools.class, "TreeItem.newMarker"), geometryField, null, null, graphic);
    return newPointSymbolizer;
}
Also used : PointSymbolizer(org.geotools.styling.PointSymbolizer) Stroke(org.geotools.styling.Stroke) Fill(org.geotools.styling.Fill) AnchorPoint(org.geotools.styling.AnchorPoint) Expression(org.opengis.filter.expression.Expression) Graphic(org.geotools.styling.Graphic) GraphicalSymbol(org.opengis.style.GraphicalSymbol) ArrayList(java.util.ArrayList) Displacement(org.opengis.style.Displacement)

Aggregations

ArrayList (java.util.ArrayList)2 AnchorPoint (org.geotools.styling.AnchorPoint)2 Fill (org.geotools.styling.Fill)2 Expression (org.opengis.filter.expression.Expression)2 Displacement (org.opengis.style.Displacement)2 Length (javax.measure.quantity.Length)1 Description (org.geotools.styling.Description)1 Font (org.geotools.styling.Font)1 Graphic (org.geotools.styling.Graphic)1 Halo (org.geotools.styling.Halo)1 PointPlacement (org.geotools.styling.PointPlacement)1 PointSymbolizer (org.geotools.styling.PointSymbolizer)1 Stroke (org.geotools.styling.Stroke)1 TextSymbolizer (org.geotools.styling.TextSymbolizer)1 GraphicalSymbol (org.opengis.style.GraphicalSymbol)1