Package org.geotools.renderer.style

Source Code of org.geotools.renderer.style.OpacityFinderTest

package org.geotools.renderer.style;

import java.net.URL;

import junit.framework.TestCase;

import org.geotools.factory.CommonFactoryFinder;
import org.geotools.renderer.lite.OpacityFinder;
import org.geotools.styling.RasterSymbolizer;
import org.geotools.styling.SLDParser;
import org.geotools.styling.Style;
import org.geotools.styling.StyleFactory;
import org.geotools.test.TestData;


public class OpacityFinderTest extends TestCase {

    public void testRasterOpacity() throws Exception {
        StyleFactory factory = CommonFactoryFinder.getStyleFactory(null);
        URL styleURL = TestData.getResource(this, "raster.sld");

        SLDParser stylereader = new SLDParser(factory, styleURL);

        Style style = stylereader.readXML()[0];

        OpacityFinder opacityFinder = new OpacityFinder(new Class[] { RasterSymbolizer.class });

        style.accept(opacityFinder);

        org.junit.Assert.assertTrue(opacityFinder.hasOpacity);
    }
   
    public void testColorMapOpacity() throws Exception {
        StyleFactory factory = CommonFactoryFinder.getStyleFactory(null);
        URL styleURL = TestData.getResource(this, "raster-cmalpha.sld");

        SLDParser stylereader = new SLDParser(factory, styleURL);

        Style style = stylereader.readXML()[0];

        OpacityFinder opacityFinder = new OpacityFinder(new Class[] { RasterSymbolizer.class });

        style.accept(opacityFinder);

        org.junit.Assert.assertTrue(opacityFinder.hasOpacity);
    }
}
TOP

Related Classes of org.geotools.renderer.style.OpacityFinderTest

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.