use of org.polymap.core.style.model.FeatureStyle in project polymap4-core by Polymap4.
the class StyleModelTest method testSimplePolygon.
@Test
public void testSimplePolygon() throws Exception {
FeatureStyle fs = repo.newFeatureStyle();
PolygonStyle style = fs.members().createElement(PolygonStyle.defaults);
assertTrue(style.visibleIf.get() instanceof ConstantFilter);
style.fill.get().color.createValue(ConstantColor.defaults(0, 0, 0));
style.fill.get().opacity.createValue(ConstantNumber.defaults(0.0));
style.stroke.get().color.createValue(ConstantColor.defaults(100, 100, 100));
style.stroke.get().width.createValue(ConstantNumber.defaults(5.0));
style.stroke.get().opacity.createValue(ConstantNumber.defaults(0.5));
fs.store();
log.info("SLD: " + repo.serializedFeatureStyle(fs.id(), String.class));
Style result = repo.serializedFeatureStyle(fs.id(), Style.class).get();
assertEquals(1, result.featureTypeStyles().size());
FeatureTypeStyle fts = result.featureTypeStyles().get(0);
assertEquals(1, fts.rules().size());
Rule rule = fts.rules().get(0);
assertEquals(0, rule.getMinScaleDenominator(), 0);
assertEquals(Double.POSITIVE_INFINITY, rule.getMaxScaleDenominator(), 0);
assertEquals(1, rule.symbolizers().size());
assertNull(rule.getFilter());
PolygonSymbolizer polygon = (PolygonSymbolizer) rule.symbolizers().get(0);
assertEqualsLiteral(0.5, polygon.getStroke().getOpacity());
assertEqualsLiteral(5.0, polygon.getStroke().getWidth());
assertEqualsLiteral(0.0, polygon.getFill().getOpacity());
}
use of org.polymap.core.style.model.FeatureStyle in project polymap4-core by Polymap4.
the class StyleModelTest method testScaleMappedNumbers.
@Test
public void testScaleMappedNumbers() throws Exception {
FeatureStyle fs = repo.newFeatureStyle();
PointStyle point = fs.members().createElement(PointStyle.defaults);
point.diameter.createValue(ScaleMappedPrimitives.defaults()).add(0, 1, new Double(1)).add(1, 2, new Double(2)).add(2, Double.POSITIVE_INFINITY, new Double(3));
fs.store();
log.info("SLD: " + repo.serializedFeatureStyle(fs.id(), String.class));
Style result = repo.serializedFeatureStyle(fs.id(), Style.class).get();
assertEquals(1, result.featureTypeStyles().size());
FeatureTypeStyle fts = result.featureTypeStyles().get(0);
assertEquals(3, fts.rules().size());
assertEqualsLiteral(1.0, ((PointSymbolizer) fts.rules().get(0).symbolizers().get(0)).getGraphic().getSize());
assertEqualsLiteral(2.0, ((PointSymbolizer) fts.rules().get(1).symbolizers().get(0)).getGraphic().getSize());
assertEqualsLiteral(3.0, ((PointSymbolizer) fts.rules().get(2).symbolizers().get(0)).getGraphic().getSize());
}
use of org.polymap.core.style.model.FeatureStyle in project polymap4-core by Polymap4.
the class StyleModelTest method simpleLine.
@Ignore
@Test
public void simpleLine() throws Exception {
FeatureStyle fs = repo.newFeatureStyle();
// point
LineStyle line = fs.members().createElement(LineStyle.defaults);
line.fill.get().color.createValue(ConstantColor.defaults(0, 0, 100));
line.fill.get().width.createValue(ConstantNumber.defaults(15.0));
line.fill.get().strokeStyle.get().capStyle.createValue(ConstantStrokeCapStyle.defaults());
line.fill.get().strokeStyle.get().dashStyle.createValue(ConstantStrokeDashStyle.defaults(StrokeDashStyle.dashdot));
line.fill.get().strokeStyle.get().joinStyle.createValue(ConstantStrokeJoinStyle.defaults());
line.stroke.get().color.createValue(ConstantColor.defaults(100, 0, 0));
line.stroke.get().width.createValue(ConstantNumber.defaults(2.0));
line.stroke.get().strokeStyle.get().capStyle.createValue(ConstantStrokeCapStyle.defaults());
line.stroke.get().strokeStyle.get().dashStyle.createValue(ConstantStrokeDashStyle.defaults());
line.stroke.get().strokeStyle.get().joinStyle.createValue(ConstantStrokeJoinStyle.defaults());
fs.store();
log.info("SLD: " + repo.serializedFeatureStyle(fs.id(), String.class));
}
Aggregations