Package org.geotools.coverageio.jp2k

Examples of org.geotools.coverageio.jp2k.JP2KReader


         }catch (FileNotFoundException fnfe){
             LOGGER.warning("test-data not found: sample.jp2 \nTests are skipped");
             return;
        }
        
    final AbstractGridCoverage2DReader reader = new JP2KReader(file);
    final GeneralEnvelope envelope = reader.getOriginalEnvelope();
    final Granule granule = new Granule(new ReferencedEnvelope(envelope), file);
    final Level level = granule.getLevel(0);
    if (level != null){
      final AffineTransform btl = level.getBaseToLevelTransform();
        assertTrue(btl.isIdentity());
View Full Code Here


        //
        // Setting several parameters
        //
        // //
        final Hints hints = new Hints(Hints.OVERVIEW_POLICY,OverviewPolicy.getDefaultPolicy());
        final JP2KReader reader = new JP2KReader(file,hints);
        final ParameterValue<GridGeometry2D> gg = JP2KFormat.READ_GRIDGEOMETRY2D.createValue();
        final ParameterValue<Boolean> useMT = JP2KFormat.USE_MULTITHREADING.createValue();
        final ParameterValue<Boolean> useJAI = JP2KFormat.USE_JAI_IMAGEREAD.createValue();
        final ParameterValue<String> tileSize= JP2KFormat.SUGGESTED_TILE_SIZE.createValue();
        final ParameterValue<Color> transparentColor = JP2KFormat.INPUT_TRANSPARENT_COLOR.createValue();
        transparentColor.setValue(new Color(0, 0, 0));
        tileSize.setValue("128,128");
       
        useMT.setValue(false);
        useJAI.setValue(true);
        final GeneralEnvelope oldEnvelope = reader.getOriginalEnvelope();
        gg.setValue(new GridGeometry2D(reader.getOriginalGridRange(), oldEnvelope));
       
        // //
        //
        // Reading
        //
        // //
        final GridCoverage2D gc = (GridCoverage2D) reader.read(
            new GeneralParameterValue[] { gg, useJAI, useMT, tileSize, transparentColor});
        assertNotNull(gc);
        forceDataLoading(gc);
       
        final MathTransform g2w = reader.getRaster2Model();
        final AffineTransform at = (AffineTransform)g2w;
        assertEquals(at.getScaleX(), 0.9, DELTA);
        assertEquals(at.getScaleY(), -0.9, DELTA);
        assertEquals(at.getTranslateX(), -179.55, DELTA);
        assertEquals(at.getTranslateY(), 89.55, DELTA);
View Full Code Here

        //
        // Testing Direct read
        //
        // //

        final AbstractGridCoverage2DReader reader = new JP2KReader(file);
        final int nCov = reader.getGridCoverageCount();
        assertEquals(nCov, 1);
       
        final ParameterValue<GridGeometry2D> gg = JP2KFormat.READ_GRIDGEOMETRY2D.createValue();
        final ParameterValue<Boolean> useJAI = JP2KFormat.USE_JAI_IMAGEREAD.createValue();
        useJAI.setValue(false);
        final GeneralEnvelope oldEnvelope = reader.getOriginalEnvelope();
        checkReader(reader);
        gg.setValue(new GridGeometry2D(reader.getOriginalGridRange(), oldEnvelope));
        GridCoverage2D gc = (GridCoverage2D) reader.read(new GeneralParameterValue[] { gg, useJAI});
        assertNotNull(gc);
        forceDataLoading(gc);
       
        // //
        //
        // Testing simple imageRead
        //
        // //

        useJAI.setValue(true);
        final Envelope wgs84Envelope = CRS.transform(oldEnvelope, DefaultGeographicCRS.WGS84);
        gg.setValue(new GridGeometry2D(reader.getOriginalGridRange(), wgs84Envelope));
        gc = (GridCoverage2D) reader.read(new GeneralParameterValue[] {gg, useJAI});
        assertNotNull(gc);
        forceDataLoading(gc);
    }
View Full Code Here

        }catch (FileNotFoundException fnfe){
            LOGGER.warning("test-data not found: sample.jp2 \nTests are skipped");
            return;
        }
       
        final JP2KReader reader = new JP2KReader(file);
        checkReader(reader);
        final GeneralEnvelope envelope = reader.getOriginalEnvelope();
        final RasterManager manager = new RasterManager(reader);
        final ParameterValue<GridGeometry2D> gg = JP2KFormat.READ_GRIDGEOMETRY2D.createValue();
        final ParameterValue<Boolean> useJAI = JP2KFormat.USE_JAI_IMAGEREAD.createValue();
        useJAI.setValue(false);
        gg.setValue(new GridGeometry2D(reader.getOriginalGridRange(), envelope));
        final GeneralParameterValue[] params = new GeneralParameterValue[] { gg, useJAI};
        final RasterLayerRequest request = new RasterLayerRequest(params, manager);
        final Rectangle area = request.getDestinationRasterArea();
        assertEquals(area.width, 400);
        assertEquals(area.height, 200);
View Full Code Here

TOP

Related Classes of org.geotools.coverageio.jp2k.JP2KReader

Copyright © 2018 www.massapicom. 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.