use of org.opengis.style.LineSymbolizer 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;
}
use of org.opengis.style.LineSymbolizer 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;
}
use of org.opengis.style.LineSymbolizer in project geotoolkit by Geomatys.
the class GTtoSE100Transformer method visit.
/**
* Transform a GT raster symbolizer in jaxb raster symbolizer.
*/
@Override
public JAXBElement<org.geotoolkit.sld.xml.v100.RasterSymbolizer> visit(final RasterSymbolizer raster, final Object data) {
final org.geotoolkit.sld.xml.v100.RasterSymbolizer tst = sld_factory_v100.createRasterSymbolizer();
tst.setGeometry(visitGeometryType(raster.getGeometryPropertyName()));
if (raster.getChannelSelection() != null) {
tst.setChannelSelection(visit(raster.getChannelSelection(), null));
}
if (raster.getColorMap() != null) {
tst.setColorMap(visit(raster.getColorMap(), null));
}
if (raster.getContrastEnhancement() != null) {
tst.setContrastEnhancement(visit(raster.getContrastEnhancement(), null));
}
if (raster.getImageOutline() != null) {
final org.geotoolkit.sld.xml.v100.ImageOutline iot = sld_factory_v100.createImageOutline();
if (raster.getImageOutline() instanceof LineSymbolizer) {
final LineSymbolizer ls = (LineSymbolizer) raster.getImageOutline();
iot.setLineSymbolizer(visit(ls, null).getValue());
tst.setImageOutline(iot);
} else if (raster.getImageOutline() instanceof PolygonSymbolizer) {
final PolygonSymbolizer ps = (PolygonSymbolizer) raster.getImageOutline();
iot.setPolygonSymbolizer(visit(ps, null).getValue());
tst.setImageOutline(iot);
}
}
tst.setOpacity(visitExpression(raster.getOpacity()));
if (raster.getOverlapBehavior() != null) {
tst.setOverlapBehavior(visit(raster.getOverlapBehavior(), null));
}
if (raster.getShadedRelief() != null) {
tst.setShadedRelief(visit(raster.getShadedRelief(), null));
}
return sld_factory_v100.createRasterSymbolizer(tst);
}
use of org.opengis.style.LineSymbolizer in project geotoolkit by Geomatys.
the class GTtoSE100Transformer method visit.
/**
* Transform a GT rule in jaxb rule or OnlineResource
*/
@Override
public org.geotoolkit.sld.xml.v100.Rule visit(final Rule rule, final Object data) {
final org.geotoolkit.sld.xml.v100.Rule rt = sld_factory_v100.createRule();
rt.setName(rule.getName());
if (rule.getDescription() != null) {
if (rule.getDescription().getAbstract() != null)
rt.setAbstract(rule.getDescription().getAbstract().toString());
if (rule.getDescription().getTitle() != null)
rt.setTitle(rule.getDescription().getTitle().toString());
}
if (rule.isElseFilter()) {
rt.setElseFilter(sld_factory_v100.createElseFilter());
} else if (rule.getFilter() != null) {
rt.setFilter(apply(rule.getFilter()));
}
if (rule.getLegend() != null) {
rt.setLegendGraphic(visit(rule.getLegend(), null));
}
rt.setMaxScaleDenominator(rule.getMaxScaleDenominator());
rt.setMinScaleDenominator(rule.getMinScaleDenominator());
for (final Symbolizer symbol : rule.symbolizers()) {
if (symbol instanceof LineSymbolizer) {
rt.getSymbolizer().add(visit((LineSymbolizer) symbol, null));
} else if (symbol instanceof PolygonSymbolizer) {
rt.getSymbolizer().add(visit((PolygonSymbolizer) symbol, null));
} else if (symbol instanceof PointSymbolizer) {
rt.getSymbolizer().add(visit((PointSymbolizer) symbol, null));
} else if (symbol instanceof RasterSymbolizer) {
rt.getSymbolizer().add(visit((RasterSymbolizer) symbol, null));
} else if (symbol instanceof TextSymbolizer) {
rt.getSymbolizer().add(visit((TextSymbolizer) symbol, null));
} else if (symbol instanceof ExtensionSymbolizer) {
// TODO provide jaxb parsing for unknowned symbolizers
// rt.getSymbolizer().add( visit((ExtensionSymbolizer)symbol,null));
}
}
return rt;
}
use of org.opengis.style.LineSymbolizer in project geotoolkit by Geomatys.
the class GTtoSE110Transformer method visit.
/**
* Transform a GT raster symbolizer in jaxb raster symbolizer.
*/
@Override
public JAXBElement<RasterSymbolizerType> visit(final RasterSymbolizer raster, final Object data) {
final RasterSymbolizerType tst = se_factory.createRasterSymbolizerType();
tst.setName(raster.getName());
tst.setDescription(visit(raster.getDescription(), null));
tst.setUom(visitUOM(raster.getUnitOfMeasure()));
tst.setGeometry(visitExpression(raster.getGeometry()));
if (raster.getChannelSelection() != null) {
tst.setChannelSelection(visit(raster.getChannelSelection(), null));
}
if (raster.getColorMap() != null) {
tst.setColorMap(visit(raster.getColorMap(), null));
}
if (raster.getContrastEnhancement() != null) {
tst.setContrastEnhancement(visit(raster.getContrastEnhancement(), null));
}
if (raster.getImageOutline() != null) {
final ImageOutlineType iot = se_factory.createImageOutlineType();
if (raster.getImageOutline() instanceof LineSymbolizer) {
final LineSymbolizer ls = (LineSymbolizer) raster.getImageOutline();
iot.setLineSymbolizer(visit(ls, null).getValue());
tst.setImageOutline(iot);
} else if (raster.getImageOutline() instanceof PolygonSymbolizer) {
final PolygonSymbolizer ps = (PolygonSymbolizer) raster.getImageOutline();
iot.setPolygonSymbolizer(visit(ps, null).getValue());
tst.setImageOutline(iot);
}
}
tst.setOpacity(visitExpression(raster.getOpacity()));
if (raster.getOverlapBehavior() != null) {
tst.setOverlapBehavior(visit(raster.getOverlapBehavior(), null));
}
if (raster.getShadedRelief() != null) {
tst.setShadedRelief(visit(raster.getShadedRelief(), null));
}
return se_factory.createRasterSymbolizer(tst);
}
Aggregations