Search in sources :

Example 51 with MutableStyle

use of org.geotoolkit.style.MutableStyle in project geotoolkit by Geomatys.

the class Styles method linedText.

public static MutableStyle linedText() {
    // general informations
    final String name = "mySymbol";
    final Description desc = DEFAULT_DESCRIPTION;
    // use the default geometry of the feature
    final String geometry = null;
    final Unit unit = Units.POINT;
    final Expression label = FF.property("CNTRY_NAME");
    final Font font = SF.font(FF.literal("Arial"), FONT_STYLE_ITALIC, FONT_WEIGHT_BOLD, FF.literal(14));
    final LabelPlacement placement = SF.linePlacement(FF.literal(0));
    final Halo halo = SF.halo(Color.WHITE, 1);
    final Fill fill = SF.fill(Color.BLUE);
    final TextSymbolizer symbol = SF.textSymbolizer(name, geometry, desc, unit, label, font, placement, halo, fill);
    final MutableStyle style = SF.style(DEFAULT_POLYGON_SYMBOLIZER, symbol);
    return style;
}
Also used : Fill(org.opengis.style.Fill) GraphicFill(org.opengis.style.GraphicFill) Description(org.opengis.style.Description) LabelPlacement(org.opengis.style.LabelPlacement) MutableStyle(org.geotoolkit.style.MutableStyle) Expression(org.opengis.filter.Expression) TextSymbolizer(org.opengis.style.TextSymbolizer) Unit(javax.measure.Unit) Font(org.opengis.style.Font) Halo(org.opengis.style.Halo)

Example 52 with MutableStyle

use of org.geotoolkit.style.MutableStyle in project geotoolkit by Geomatys.

the class Styles method defaultRaster.

// ////////////////////////////////////////////////////////////////////
// RASTER SYMBOLIZER /////////////////////////////////////////////////
// ////////////////////////////////////////////////////////////////////
public static MutableStyle defaultRaster() {
    final RasterSymbolizer symbol = DEFAULT_RASTER_SYMBOLIZER;
    final MutableStyle style = SF.style(symbol);
    return style;
}
Also used : RasterSymbolizer(org.opengis.style.RasterSymbolizer) MutableStyle(org.geotoolkit.style.MutableStyle)

Example 53 with MutableStyle

use of org.geotoolkit.style.MutableStyle in project geotoolkit by Geomatys.

the class Styles method offsetPolygon.

public static MutableStyle offsetPolygon() {
    // we produce a gradient border effect by combining several
    // symbolizer progressivly smaller
    final PolygonSymbolizer symbol1 = SF.polygonSymbolizer("mySymbol", (String) null, DEFAULT_DESCRIPTION, Units.POINT, null, SF.fill(new Color(255, 0, 0)), DEFAULT_DISPLACEMENT, FF.literal(0));
    final PolygonSymbolizer symbol2 = SF.polygonSymbolizer("mySymbol", (String) null, DEFAULT_DESCRIPTION, Units.POINT, null, SF.fill(new Color(255, 70, 70)), DEFAULT_DISPLACEMENT, FF.literal(-10));
    final PolygonSymbolizer symbol3 = SF.polygonSymbolizer("mySymbol", (String) null, DEFAULT_DESCRIPTION, Units.POINT, null, SF.fill(new Color(255, 140, 140)), DEFAULT_DISPLACEMENT, FF.literal(-20));
    final PolygonSymbolizer symbol4 = SF.polygonSymbolizer("mySymbol", (String) null, DEFAULT_DESCRIPTION, Units.POINT, null, SF.fill(new Color(255, 210, 210)), DEFAULT_DISPLACEMENT, FF.literal(-30));
    final MutableStyle style = SF.style(symbol1, symbol2, symbol3, symbol4);
    return style;
}
Also used : MutableStyle(org.geotoolkit.style.MutableStyle) PolygonSymbolizer(org.opengis.style.PolygonSymbolizer)

Example 54 with MutableStyle

use of org.geotoolkit.style.MutableStyle in project geotoolkit by Geomatys.

the class Styles method ttfPoint.

public static MutableStyle ttfPoint() throws URISyntaxException {
    // general informations
    final String name = "mySymbol";
    final Description desc = DEFAULT_DESCRIPTION;
    // use the default geometry of the feature
    final String geometry = null;
    final Unit unit = Units.POINT;
    // the visual element
    final Expression size = FF.literal(32);
    final Expression opacity = LITERAL_ONE_FLOAT;
    final Expression rotation = LITERAL_ONE_FLOAT;
    final AnchorPoint anchor = DEFAULT_ANCHOR_POINT;
    final Displacement disp = DEFAULT_DISPLACEMENT;
    final List<GraphicalSymbol> symbols = new ArrayList<GraphicalSymbol>();
    final Stroke stroke = SF.stroke(Color.BLACK, 1);
    final Fill fill = SF.fill(Color.RED);
    final ExternalMark external = SF.externalMark(SF.onlineResource(IconBuilder.FONTAWESOME.toURI()), "ttf", FontAwesomeIcons.ICON_DICE.codePointAt(0));
    final Mark mark = SF.mark(external, fill, stroke);
    symbols.add(mark);
    final Graphic graphic = SF.graphic(symbols, opacity, size, rotation, anchor, disp);
    final PointSymbolizer symbolizer = SF.pointSymbolizer(name, geometry, desc, unit, graphic);
    final MutableStyle style = SF.style(symbolizer);
    return style;
}
Also used : PointSymbolizer(org.opengis.style.PointSymbolizer) Stroke(org.opengis.style.Stroke) GraphicStroke(org.opengis.style.GraphicStroke) Fill(org.opengis.style.Fill) GraphicFill(org.opengis.style.GraphicFill) Description(org.opengis.style.Description) Graphic(org.opengis.style.Graphic) GraphicalSymbol(org.opengis.style.GraphicalSymbol) ArrayList(java.util.ArrayList) ExternalMark(org.opengis.style.ExternalMark) Mark(org.opengis.style.Mark) Unit(javax.measure.Unit) Displacement(org.opengis.style.Displacement) AnchorPoint(org.opengis.style.AnchorPoint) ExternalMark(org.opengis.style.ExternalMark) MutableStyle(org.geotoolkit.style.MutableStyle) Expression(org.opengis.filter.Expression)

Example 55 with MutableStyle

use of org.geotoolkit.style.MutableStyle in project geotoolkit by Geomatys.

the class Styles method markPoint.

public static MutableStyle markPoint() {
    // general informations
    final String name = "mySymbol";
    final Description desc = DEFAULT_DESCRIPTION;
    // use the default geometry of the feature
    final String geometry = null;
    final Unit unit = Units.POINT;
    // the visual element
    final Expression size = FF.literal(12);
    final Expression opacity = LITERAL_ONE_FLOAT;
    final Expression rotation = LITERAL_ONE_FLOAT;
    final AnchorPoint anchor = DEFAULT_ANCHOR_POINT;
    final Displacement disp = DEFAULT_DISPLACEMENT;
    final List<GraphicalSymbol> symbols = new ArrayList<GraphicalSymbol>();
    final Stroke stroke = SF.stroke(Color.BLACK, 2);
    final Fill fill = SF.fill(Color.RED);
    final Mark mark = SF.mark(MARK_CIRCLE, fill, stroke);
    symbols.add(mark);
    final Graphic graphic = SF.graphic(symbols, opacity, size, rotation, anchor, disp);
    final PointSymbolizer symbolizer = SF.pointSymbolizer(name, geometry, desc, unit, graphic);
    final MutableStyle style = SF.style(symbolizer);
    return style;
}
Also used : PointSymbolizer(org.opengis.style.PointSymbolizer) Stroke(org.opengis.style.Stroke) GraphicStroke(org.opengis.style.GraphicStroke) Fill(org.opengis.style.Fill) GraphicFill(org.opengis.style.GraphicFill) Description(org.opengis.style.Description) Graphic(org.opengis.style.Graphic) GraphicalSymbol(org.opengis.style.GraphicalSymbol) ArrayList(java.util.ArrayList) ExternalMark(org.opengis.style.ExternalMark) Mark(org.opengis.style.Mark) Unit(javax.measure.Unit) Displacement(org.opengis.style.Displacement) AnchorPoint(org.opengis.style.AnchorPoint) MutableStyle(org.geotoolkit.style.MutableStyle) Expression(org.opengis.filter.Expression)

Aggregations

MutableStyle (org.geotoolkit.style.MutableStyle)55 Expression (org.opengis.filter.Expression)20 MapLayer (org.apache.sis.portrayal.MapLayer)19 Unit (javax.measure.Unit)16 MapLayers (org.apache.sis.portrayal.MapLayers)15 Description (org.opengis.style.Description)15 Test (org.junit.Test)12 ArrayList (java.util.ArrayList)11 Feature (org.opengis.feature.Feature)11 FeatureType (org.opengis.feature.FeatureType)11 Fill (org.opengis.style.Fill)11 GraphicalSymbol (org.opengis.style.GraphicalSymbol)11 Stroke (org.opengis.style.Stroke)11 FeatureTypeBuilder (org.apache.sis.feature.builder.FeatureTypeBuilder)10 FeatureSet (org.apache.sis.storage.FeatureSet)10 GraphicStroke (org.opengis.style.GraphicStroke)10 PointSymbolizer (org.opengis.style.PointSymbolizer)10 BufferedImage (java.awt.image.BufferedImage)9 MutableFeatureTypeStyle (org.geotoolkit.style.MutableFeatureTypeStyle)9 PolygonSymbolizer (org.opengis.style.PolygonSymbolizer)9