Search in sources :

Example 21 with MutableStyle

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

the class Styles method dashedLine.

public static MutableStyle dashedLine() 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;
    final Expression offset = LITERAL_ONE_FLOAT;
    // the visual element
    final Expression color = SF.literal(Color.BLUE);
    final Expression width = FF.literal(2);
    final Expression opacity = LITERAL_ONE_FLOAT;
    final Expression linecap = STROKE_CAP_BUTT;
    final Expression linejoin = STROKE_JOIN_ROUND;
    final float[] dashes = new float[] { 8, 4, 2, 2, 2, 2, 2, 4 };
    final Expression dashOffset = LITERAL_ZERO_FLOAT;
    final Stroke stroke = SF.stroke(color, opacity, width, linejoin, linecap, dashes, dashOffset);
    final LineSymbolizer symbolizer = SF.lineSymbolizer(name, geometry, desc, unit, stroke, offset);
    final MutableStyle style = SF.style(symbolizer);
    return style;
}
Also used : Stroke(org.opengis.style.Stroke) GraphicStroke(org.opengis.style.GraphicStroke) Description(org.opengis.style.Description) MutableStyle(org.geotoolkit.style.MutableStyle) Expression(org.opengis.filter.Expression) LineSymbolizer(org.opengis.style.LineSymbolizer) Unit(javax.measure.Unit)

Example 22 with MutableStyle

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

the class Styles method colorLine.

public static MutableStyle colorLine() {
    // 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 offset = LITERAL_ZERO_FLOAT;
    // the visual element
    final Expression color = SF.literal(Color.BLUE);
    final Expression width = FF.literal(4);
    final Expression opacity = LITERAL_ONE_FLOAT;
    final Stroke stroke = SF.stroke(color, width, opacity);
    final LineSymbolizer symbolizer = SF.lineSymbolizer(name, geometry, desc, unit, stroke, offset);
    final MutableStyle style = SF.style(symbolizer);
    return style;
}
Also used : Stroke(org.opengis.style.Stroke) GraphicStroke(org.opengis.style.GraphicStroke) Description(org.opengis.style.Description) MutableStyle(org.geotoolkit.style.MutableStyle) Expression(org.opengis.filter.Expression) LineSymbolizer(org.opengis.style.LineSymbolizer) Unit(javax.measure.Unit)

Example 23 with MutableStyle

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

the class Styles method uomLine.

public static MutableStyle uomLine() 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.METRE;
    final Expression offset = LITERAL_ZERO_FLOAT;
    // the visual element
    final Expression color = SF.literal(Color.BLUE);
    final Expression width = FF.literal(400);
    final Expression opacity = LITERAL_ONE_FLOAT;
    final Stroke stroke = SF.stroke(color, width, opacity);
    final LineSymbolizer symbolizer = SF.lineSymbolizer(name, geometry, desc, unit, stroke, offset);
    final MutableStyle style = SF.style(symbolizer);
    return style;
}
Also used : Stroke(org.opengis.style.Stroke) GraphicStroke(org.opengis.style.GraphicStroke) Description(org.opengis.style.Description) MutableStyle(org.geotoolkit.style.MutableStyle) Expression(org.opengis.filter.Expression) LineSymbolizer(org.opengis.style.LineSymbolizer) Unit(javax.measure.Unit)

Example 24 with MutableStyle

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

the class Styles method imagePoint.

public static MutableStyle imagePoint() 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(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 GraphicalSymbol external = SF.externalGraphic(SF.onlineResource(Styles.class.getResource("/data/fish.png").toURI()), "image/png", null);
    symbols.add(external);
    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) Description(org.opengis.style.Description) Graphic(org.opengis.style.Graphic) GraphicalSymbol(org.opengis.style.GraphicalSymbol) ArrayList(java.util.ArrayList) Unit(javax.measure.Unit) Displacement(org.opengis.style.Displacement) AnchorPoint(org.opengis.style.AnchorPoint) MutableStyle(org.geotoolkit.style.MutableStyle) Expression(org.opengis.filter.Expression)

Example 25 with MutableStyle

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

the class Styles method customRaster.

public static MutableStyle customRaster() {
    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 opacity = LITERAL_ONE_FLOAT;
    final ChannelSelection channels = null;
    final OverlapBehavior overlap = null;
    final ColorMap colormap = null;
    final ContrastEnhancement enhance = null;
    final ShadedRelief relief = null;
    final Symbolizer outline = null;
    final RasterSymbolizer symbol = SF.rasterSymbolizer(name, (String) null, desc, unit, opacity, channels, overlap, colormap, enhance, relief, outline);
    final MutableStyle style = SF.style(symbol);
    return style;
}
Also used : RasterSymbolizer(org.opengis.style.RasterSymbolizer) Description(org.opengis.style.Description) ContrastEnhancement(org.opengis.style.ContrastEnhancement) MutableStyle(org.geotoolkit.style.MutableStyle) Expression(org.opengis.filter.Expression) ChannelSelection(org.opengis.style.ChannelSelection) ColorMap(org.opengis.style.ColorMap) Unit(javax.measure.Unit) ShadedRelief(org.opengis.style.ShadedRelief) PointSymbolizer(org.opengis.style.PointSymbolizer) PolygonSymbolizer(org.opengis.style.PolygonSymbolizer) LineSymbolizer(org.opengis.style.LineSymbolizer) RasterSymbolizer(org.opengis.style.RasterSymbolizer) TextSymbolizer(org.opengis.style.TextSymbolizer) Symbolizer(org.opengis.style.Symbolizer) OverlapBehavior(org.opengis.style.OverlapBehavior)

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