Search in sources :

Example 1 with RenderSymbol

use of com.sldeditor.render.RenderSymbol in project sldeditor by robward-scisys.

the class RenderSymbolTest method testRenderSymbol.

/**
 * Test method for {@link com.sldeditor.render.RenderSymbol#RenderSymbol()}.
 */
@Test
public void testRenderSymbol() {
    RenderSymbol symbol = new RenderSymbol();
    StyledLayerDescriptor sld = createSLD();
    StyledLayer styledLayer = sld.layers().get(0);
    if (styledLayer instanceof NamedLayerImpl) {
        NamedLayerImpl namedLayerImpl = (NamedLayerImpl) styledLayer;
        Style expectedStyle = namedLayerImpl.styles().get(0);
        SelectedSymbol.getInstance().setSld(sld);
        Style actualStyle = symbol.getRenderStyle(SelectedSymbol.getInstance());
        assertNull(actualStyle.featureTypeStyles().get(0).rules().get(0).getFilter());
        assertEquals(expectedStyle.getName(), actualStyle.getName());
        Rule expectedRule = expectedStyle.featureTypeStyles().get(0).rules().get(1);
        SelectedSymbol.getInstance().setFeatureTypeStyle(expectedStyle.featureTypeStyles().get(0));
        SelectedSymbol.getInstance().setRule(expectedRule);
        actualStyle = symbol.getRenderStyle(SelectedSymbol.getInstance());
        assertNull(actualStyle.featureTypeStyles().get(0).rules().get(0).getFilter());
        assertEquals(expectedRule.getName(), actualStyle.featureTypeStyles().get(0).rules().get(0).getName());
    }
}
Also used : StyledLayerDescriptor(org.geotools.styling.StyledLayerDescriptor) StyledLayer(org.geotools.styling.StyledLayer) NamedLayerImpl(org.geotools.styling.NamedLayerImpl) RenderSymbol(com.sldeditor.render.RenderSymbol) Style(org.geotools.styling.Style) Rule(org.geotools.styling.Rule) Test(org.junit.Test)

Aggregations

RenderSymbol (com.sldeditor.render.RenderSymbol)1 NamedLayerImpl (org.geotools.styling.NamedLayerImpl)1 Rule (org.geotools.styling.Rule)1 Style (org.geotools.styling.Style)1 StyledLayer (org.geotools.styling.StyledLayer)1 StyledLayerDescriptor (org.geotools.styling.StyledLayerDescriptor)1 Test (org.junit.Test)1