use of com.sldeditor.ui.render.RuleRenderOptions in project sldeditor by robward-scisys.
the class RuleRenderVisitorTest method testRuleRenderVisitor.
/**
* Test rule render visitor.
*/
@Test
public void testRuleRenderVisitor() {
StyledLayerDescriptor sld = createSLD();
StyledLayer styledLayer = sld.layers().get(0);
if (styledLayer instanceof NamedLayerImpl) {
NamedLayerImpl namedLayerImpl = (NamedLayerImpl) styledLayer;
Style style = namedLayerImpl.styles().get(0);
FeatureTypeStyle ftsToRender = style.featureTypeStyles().get(0);
// Just find matching feature type style
int symbolIndex = 0;
RuleRenderVisitor visitor = new RuleRenderVisitor(ftsToRender, null, symbolIndex, new RuleRenderOptions());
style.accept(visitor);
Style copy = (Style) visitor.getCopy();
Rule ruleToRender = ftsToRender.rules().get(0);
Rule actualRule = copy.featureTypeStyles().get(0).rules().get(0);
// Filters should be null
assertNull(actualRule.getFilter());
assertEquals(ruleToRender.symbolizers(), actualRule.symbolizers());
// Now try and find 2nd rule, 2nd symbolizer
ruleToRender = ftsToRender.rules().get(1);
symbolIndex = 1;
visitor = new RuleRenderVisitor(ftsToRender, ruleToRender, symbolIndex, new RuleRenderOptions());
style.accept(visitor);
copy = (Style) visitor.getCopy();
assertEquals(1, copy.featureTypeStyles().get(0).rules().size());
actualRule = copy.featureTypeStyles().get(0).rules().get(0);
assertNull(actualRule.getFilter());
assertEquals(1, actualRule.symbolizers().size());
assertEquals(ruleToRender.symbolizers().get(1), actualRule.symbolizers().get(0));
}
}
use of com.sldeditor.ui.render.RuleRenderOptions in project sldeditor by robward-scisys.
the class RuleRenderOptionsTest method test.
@Test
public void test() {
RuleRenderOptions options = new RuleRenderOptions();
assertTrue(options.isTransformationApplied() == false);
options.setApplyTransformation(true);
assertTrue(options.isTransformationApplied() == true);
}
use of com.sldeditor.ui.render.RuleRenderOptions in project sldeditor by robward-scisys.
the class RenderOptionsPanel method populate.
/**
* Populate.
*/
private void populate() {
RuleRenderOptions options = this.renderSymbol.getRuleRenderOptions();
applyTransformationCheckBox.setSelected(options.isTransformationApplied());
}
use of com.sldeditor.ui.render.RuleRenderOptions in project sldeditor by robward-scisys.
the class RenderOptionsPanel method createUI.
/**
* Creates the ui.
*/
private void createUI() {
setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
applyTransformationCheckBox = new JCheckBox(Localisation.getString(RenderOptionsPanel.class, "RenderOptionsPanel.applyTransformation"));
applyTransformationCheckBox.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
RuleRenderOptions options = renderSymbol.getRuleRenderOptions();
options.setApplyTransformation(applyTransformationCheckBox.isSelected());
updateSymbols();
}
});
// Hide for now
// add(applyTransformationCheckBox);
}
Aggregations