Search in sources :

Example 1 with StopOnErrorMonitor

use of org.geotoolkit.display.canvas.control.StopOnErrorMonitor in project geotoolkit by Geomatys.

the class PortrayalServiceTest method testRendering.

private void testRendering(final MapLayer layer) throws Exception {
    final StopOnErrorMonitor monitor = new StopOnErrorMonitor();
    final MapLayers context = MapBuilder.createContext(CommonCRS.WGS84.normalizedGeographic());
    context.getComponents().add(layer);
    assertEquals(1, context.getComponents().size());
    for (final Envelope env : envelopes) {
        for (double[] drange : timestamps) {
            for (double[] erange : elevations) {
                final GeneralEnvelope cenv = new GeneralEnvelope(CRS.compound(env.getCoordinateReferenceSystem(), CommonCRS.Vertical.ELLIPSOIDAL.crs(), CommonCRS.Temporal.JAVA.crs()));
                cenv.subEnvelope(0, 2).setEnvelope(env);
                cenv.setRange(2, erange[0], erange[1]);
                cenv.setRange(3, drange[0], drange[1]);
                final CanvasDef cdef = new CanvasDef(new Dimension(800, 600), cenv);
                cdef.setAzimuth(0);
                cdef.setMonitor(monitor);
                final BufferedImage img = DefaultPortrayalService.portray(cdef, new SceneDef(context));
                assertNull(monitor.getLastException());
                assertNotNull(img);
            }
        }
    }
}
Also used : StopOnErrorMonitor(org.geotoolkit.display.canvas.control.StopOnErrorMonitor) Dimension(java.awt.Dimension) SampleDimension(org.apache.sis.coverage.SampleDimension) Envelope(org.opengis.geometry.Envelope) GeneralEnvelope(org.apache.sis.geometry.GeneralEnvelope) GeneralEnvelope(org.apache.sis.geometry.GeneralEnvelope) BufferedImage(java.awt.image.BufferedImage) MapLayers(org.apache.sis.portrayal.MapLayers)

Aggregations

Dimension (java.awt.Dimension)1 BufferedImage (java.awt.image.BufferedImage)1 SampleDimension (org.apache.sis.coverage.SampleDimension)1 GeneralEnvelope (org.apache.sis.geometry.GeneralEnvelope)1 MapLayers (org.apache.sis.portrayal.MapLayers)1 StopOnErrorMonitor (org.geotoolkit.display.canvas.control.StopOnErrorMonitor)1 Envelope (org.opengis.geometry.Envelope)1