Search in sources :

Example 26 with Expression

use of org.opengis.filter.Expression in project geotoolkit by Geomatys.

the class CachedPolygonSymbolizer method evaluateDisplacement.

private void evaluateDisplacement() {
    Displacement disp = styleElement.getDisplacement();
    if (disp != null) {
        final Expression dispX = disp.getDisplacementX();
        final Expression dispY = disp.getDisplacementY();
        if (GO2Utilities.isStatic(dispX)) {
            cachedDispX = GO2Utilities.evaluate(dispX, null, Float.class, 0f);
        } else {
            GO2Utilities.getRequieredAttributsName(dispX, requieredAttributs);
        }
        if (GO2Utilities.isStatic(dispY)) {
            cachedDispY = GO2Utilities.evaluate(dispY, null, Float.class, 0f);
        } else {
            GO2Utilities.getRequieredAttributsName(dispY, requieredAttributs);
        }
        if (!Float.isNaN(cachedDispX) && !Float.isNaN(cachedDispY)) {
            cachedDisps = new float[] { cachedDispX, cachedDispY };
        }
    } else {
        // we can a disp X and Y of 0
        cachedDispX = 0f;
        cachedDispY = 0f;
        cachedDisps = new float[] { 0, 0 };
    }
}
Also used : Expression(org.opengis.filter.Expression) Displacement(org.opengis.style.Displacement)

Example 27 with Expression

use of org.opengis.filter.Expression in project geotoolkit by Geomatys.

the class SEforSLD110Test method testFillInterpolation.

// //////////////////////////////////////////////////////////////////////////
// JAXB TEST UNMARSHELLING FOR USER CASES //////////////////////////////////
// //////////////////////////////////////////////////////////////////////////
@Test
public void testFillInterpolation() throws JAXBException {
    final Unmarshaller UNMARSHALLER = POOL.acquireUnmarshaller();
    // Read test
    Object obj = UNMARSHALLER.unmarshal(FILE_SE_FILL_INTERPOLATION);
    assertNotNull(obj);
    JAXBElement<org.geotoolkit.se.xml.v110.PointSymbolizerType> jax = (JAXBElement<org.geotoolkit.se.xml.v110.PointSymbolizerType>) obj;
    PointSymbolizer pointSymbol = TRANSFORMER_GT.visit(jax.getValue());
    assertNotNull(pointSymbol);
    assertEquals(pointSymbol.getGeometryPropertyName(), valueGeom);
    assertEquals(Units.POINT, pointSymbol.getUnitOfMeasure());
    assertNotNull(pointSymbol.getGraphic());
    Graphic graphic = pointSymbol.getGraphic();
    Mark mark = (Mark) graphic.graphicalSymbols().get(0);
    Expression color = mark.getFill().getColor();
    assertTrue(color instanceof Interpolate);
    POOL.recycle(UNMARSHALLER);
}
Also used : PointSymbolizer(org.opengis.style.PointSymbolizer) Graphic(org.opengis.style.Graphic) Mark(org.opengis.style.Mark) JAXBElement(javax.xml.bind.JAXBElement) Interpolate(org.geotoolkit.style.function.Interpolate) Expression(org.opengis.filter.Expression) Unmarshaller(javax.xml.bind.Unmarshaller) Test(org.junit.Test)

Example 28 with Expression

use of org.opengis.filter.Expression in project geotoolkit by Geomatys.

the class Tester method createLineSymbolizer.

private static LineSymbolizer createLineSymbolizer() {
    String name = "the line symbolizer name";
    Description desc = STYLE_FACTORY.description("Line symbolizer title", "Line symbolizer description");
    Unit uom = Units.METRE;
    String geom = "geom";
    Stroke stroke = STYLE_FACTORY.stroke(Color.RED, 3, new float[] { 3, 6 });
    Expression offset = FILTER_FACTORY.literal(5);
    return STYLE_FACTORY.lineSymbolizer(name, geom, desc, uom, stroke, offset);
}
Also used : Stroke(org.opengis.style.Stroke) Description(org.opengis.style.Description) Expression(org.opengis.filter.Expression) SimpleInternationalString(org.apache.sis.util.SimpleInternationalString) Unit(javax.measure.Unit)

Example 29 with Expression

use of org.opengis.filter.Expression in project geotoolkit by Geomatys.

the class Tester method createTextSymbolizer.

private static TextSymbolizer createTextSymbolizer() {
    String name = "Text symbolizer name";
    Description desc = STYLE_FACTORY.description("Text symbolizer title", "Text symbolizer description");
    Unit uom = Units.FOOT;
    String geom = "geom";
    Fill fill = STYLE_FACTORY.fill(Color.ORANGE);
    Halo halo = STYLE_FACTORY.halo(Color.PINK, 12);
    PointPlacement placement = STYLE_FACTORY.pointPlacement();
    Font font = STYLE_FACTORY.font();
    Expression label = FILTER_FACTORY.literal("the feature field name");
    return STYLE_FACTORY.textSymbolizer(name, geom, desc, uom, label, font, placement, halo, fill);
}
Also used : Fill(org.opengis.style.Fill) PointPlacement(org.opengis.style.PointPlacement) Description(org.opengis.style.Description) Expression(org.opengis.filter.Expression) SimpleInternationalString(org.apache.sis.util.SimpleInternationalString) Unit(javax.measure.Unit) Halo(org.opengis.style.Halo) Font(org.opengis.style.Font)

Example 30 with Expression

use of org.opengis.filter.Expression in project geotoolkit by Geomatys.

the class Tester method createRasterSymbolizer.

private static RasterSymbolizer createRasterSymbolizer() {
    String name = "Raster symbolizer name";
    Description desc = STYLE_FACTORY.description("Raster symbolizer title", "Raster symbolizer description");
    Unit uom = Units.METRE;
    String geom = "geom";
    Expression opacity = FILTER_FACTORY.literal(0.5);
    ChannelSelection selection = STYLE_FACTORY.channelSelection(STYLE_FACTORY.selectedChannelType("chanel2", FILTER_FACTORY.literal(1)));
    OverlapBehavior overlap = OverlapBehavior.RANDOM;
    ColorMap colorMap = STYLE_FACTORY.colorMap();
    ContrastEnhancement enchance = STYLE_FACTORY.contrastEnhancement();
    ShadedRelief relief = STYLE_FACTORY.shadedRelief(FILTER_FACTORY.literal(3), true);
    Symbolizer outline = createLineSymbolizer();
    return STYLE_FACTORY.rasterSymbolizer(name, geom, desc, uom, opacity, selection, overlap, colorMap, enchance, relief, outline);
}
Also used : Description(org.opengis.style.Description) ContrastEnhancement(org.opengis.style.ContrastEnhancement) Expression(org.opengis.filter.Expression) ChannelSelection(org.opengis.style.ChannelSelection) ColorMap(org.opengis.style.ColorMap) SimpleInternationalString(org.apache.sis.util.SimpleInternationalString) 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

Expression (org.opengis.filter.Expression)325 Test (org.junit.Test)112 LineString (org.locationtech.jts.geom.LineString)73 Literal (org.opengis.filter.Literal)65 ArrayList (java.util.ArrayList)47 MultiLineString (org.locationtech.jts.geom.MultiLineString)46 Unit (javax.measure.Unit)45 Description (org.opengis.style.Description)40 Fill (org.opengis.style.Fill)38 GraphicFill (org.opengis.style.GraphicFill)38 Stroke (org.opengis.style.Stroke)35 Geometry (org.locationtech.jts.geom.Geometry)31 Displacement (org.opengis.style.Displacement)29 GraphicStroke (org.opengis.style.GraphicStroke)29 ValueReference (org.opengis.filter.ValueReference)27 JAXBElement (javax.xml.bind.JAXBElement)22 LineSymbolizer (org.opengis.style.LineSymbolizer)22 PointSymbolizer (org.opengis.style.PointSymbolizer)22 PolygonSymbolizer (org.opengis.style.PolygonSymbolizer)22 MutableStyle (org.geotoolkit.style.MutableStyle)21