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 };
}
}
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);
}
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);
}
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);
}
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);
}
Aggregations