use of org.geotoolkit.style.MutableRule in project geotoolkit by Geomatys.
the class MapfileToSLDProcess method convert.
private void convert(final MutableStyledLayerDescriptor sld, final Feature feature) throws ProcessException {
final Collection<Feature> layers = (Collection<Feature>) feature.getPropertyValue(MAP_LAYER.toString());
for (final Feature mflayer : layers) {
// create an sld layer
final MutableNamedLayer sldLayer = SLDF.createNamedLayer();
sld.layers().add(sldLayer);
final String name = String.valueOf(mflayer.getPropertyValue(LAYER_NAME.toString()));
sldLayer.setName(name);
sldLayer.setDescription(SF.description(name, name));
// create the style
final MutableStyle sldStyle = SF.style();
sldLayer.styles().add(sldStyle);
final MutableFeatureTypeStyle fts = SF.featureTypeStyle();
sldStyle.featureTypeStyles().add(fts);
final Double minscale = (Double) mflayer.getPropertyValue(LAYER_MINSCALEDENOM.toString());
final Double maxscale = (Double) mflayer.getPropertyValue(LAYER_MAXSCALEDENOM.toString());
final Collection<Feature> classes = (Collection<Feature>) mflayer.getPropertyValue(LAYER_CLASS.toString());
for (final Feature clazz : classes) {
final MutableRule rule = createRule(mflayer, minscale, maxscale, clazz);
fts.rules().add(rule);
}
}
}
use of org.geotoolkit.style.MutableRule in project geotoolkit by Geomatys.
the class Styles method scaleRule.
// ////////////////////////////////////////////////////////////////////
// RULES /////////////////////////////////////////////////////////////
// ////////////////////////////////////////////////////////////////////
public static MutableStyle scaleRule() {
final MutableRule over = SF.rule();
over.setMinScaleDenominator(1000000);
over.symbolizers().add(SF.polygonSymbolizer(DEFAULT_STROKE, SF.fill(Color.RED), null));
final MutableRule under = SF.rule();
under.setMaxScaleDenominator(1000000);
under.symbolizers().add(SF.polygonSymbolizer(DEFAULT_STROKE, SF.fill(Color.GREEN), null));
final MutableStyle style = SF.style();
final MutableFeatureTypeStyle fts = SF.featureTypeStyle();
fts.rules().add(over);
fts.rules().add(under);
style.featureTypeStyles().add(fts);
return style;
}
use of org.geotoolkit.style.MutableRule in project geotoolkit by Geomatys.
the class Styles method filterRule.
public static MutableStyle filterRule() {
final MutableRule over = SF.rule();
over.setFilter(FF.greaterOrEqual(FF.property("POP_CNTRY"), FF.literal(5000000)));
over.symbolizers().add(SF.polygonSymbolizer(DEFAULT_STROKE, SF.fill(Color.RED), null));
final MutableRule under = SF.rule();
under.setFilter(FF.less(FF.property("POP_CNTRY"), FF.literal(5000000)));
under.symbolizers().add(SF.polygonSymbolizer(DEFAULT_STROKE, SF.fill(Color.GREEN), null));
final MutableStyle style = SF.style();
final MutableFeatureTypeStyle fts = SF.featureTypeStyle();
fts.rules().add(over);
fts.rules().add(under);
style.featureTypeStyles().add(fts);
return style;
}
Aggregations