use of org.polymap.core.style.model.feature.FilterMappedPrimitives in project polymap4-core by Polymap4.
the class StyleModelTest method propertyRangeMappedNumbers.
@Ignore
@Test
public void propertyRangeMappedNumbers() {
FeatureStyle fs = repo.newFeatureStyle();
// point
PointStyle point = fs.members().createElement(PointStyle.defaults);
point.diameter.createValue(new ValueInitializer<FilterMappedPrimitives<Double>>() {
@Override
public FilterMappedPrimitives<Double> initialize(FilterMappedPrimitives<Double> proto) throws Exception {
proto.add(ff.lessOrEqual(ff.property("foo"), ff.literal("big")), new Double(5));
proto.add(ff.less(ff.property("foo"), ff.literal("bigger")), new Double(15));
proto.add(ff.greaterOrEqual(ff.property("foo"), ff.literal("bigger")), new Double(23));
return proto;
}
});
fs.store();
log.info("SLD: " + repo.serializedFeatureStyle(fs.id(), String.class, OutputFormat.GEOSERVER));
Style style = repo.serializedFeatureStyle(fs.id(), Style.class, OutputFormat.GEOSERVER).get();
List<FeatureTypeStyle> featureTypeStyles = style.featureTypeStyles();
assertEquals(1, featureTypeStyles.size());
assertEquals(Filter.INCLUDE, featureTypeStyles.get(0).rules().get(0).getFilter());
log.info("SLD: " + repo.serializedFeatureStyle(fs.id(), String.class, OutputFormat.OGC));
style = repo.serializedFeatureStyle(fs.id(), Style.class, OutputFormat.OGC).get();
featureTypeStyles = style.featureTypeStyles();
assertEquals(1, featureTypeStyles.size());
assertEquals("[ foo <= big ]", featureTypeStyles.get(0).rules().get(0).getFilter().toString());
assertEquals("[ foo < bigger ]", featureTypeStyles.get(0).rules().get(1).getFilter().toString());
assertEquals("[ foo >= bigger ]", featureTypeStyles.get(0).rules().get(2).getFilter().toString());
}
use of org.polymap.core.style.model.feature.FilterMappedPrimitives in project polymap4-core by Polymap4.
the class StyleModelTest method propertyMappedNumbers.
@Ignore
@Test
public void propertyMappedNumbers() {
FeatureStyle fs = repo.newFeatureStyle();
// point
PointStyle point = fs.members().createElement(PointStyle.defaults);
point.diameter.createValue(new ValueInitializer<FilterMappedPrimitives<Double>>() {
@Override
public FilterMappedPrimitives<Double> initialize(FilterMappedPrimitives<Double> proto) throws Exception {
proto.add(ff.equals(ff.property("foo"), ff.literal("big")), new Double(5));
proto.add(ff.equals(ff.property("foo"), ff.literal("bigger")), new Double(15));
proto.add(ff.and(ff.notEqual(ff.property("foo"), ff.literal("big")), ff.notEqual(ff.property("foo"), ff.literal("bigger"))), new Double(23));
return proto;
}
});
fs.store();
log.info("SLD: " + repo.serializedFeatureStyle(fs.id(), String.class, OutputFormat.GEOSERVER));
Style style = repo.serializedFeatureStyle(fs.id(), Style.class, OutputFormat.GEOSERVER).get();
List<FeatureTypeStyle> featureTypeStyles = style.featureTypeStyles();
assertEquals(1, featureTypeStyles.size());
assertEquals(Filter.INCLUDE, featureTypeStyles.get(0).rules().get(0).getFilter());
log.info("SLD: " + repo.serializedFeatureStyle(fs.id(), String.class, OutputFormat.OGC));
style = repo.serializedFeatureStyle(fs.id(), Style.class, OutputFormat.OGC).get();
featureTypeStyles = style.featureTypeStyles();
assertEquals(1, featureTypeStyles.size());
assertEquals("[ foo = big ]", featureTypeStyles.get(0).rules().get(0).getFilter().toString());
assertEquals("[ foo = bigger ]", featureTypeStyles.get(0).rules().get(1).getFilter().toString());
assertEquals("[[ foo != big ] AND [ foo != bigger ]]", featureTypeStyles.get(0).rules().get(2).getFilter().toString());
}
Aggregations