Package org.geowebcache.storage

Examples of org.geowebcache.storage.GeometryRasterMaskBuilder


        gridsetId = layer.getGridSubsets().keySet().iterator().next();
    }

    public void testBuildTileRangeMask() throws Exception {

        GeometryRasterMaskBuilder tileRangeMask = buildSampleFilterMatrix(layer, gridsetId);

        assertNotNull(tileRangeMask);
        assertEquals(0, tileRangeMask.getStartLevel());
        assertEquals(11, tileRangeMask.getNumLevels());
        assertEquals(layer.getGridSubset(gridsetId).getCoverages().length,
                tileRangeMask.getNumLevels());

    }
View Full Code Here


     * Test for {@link GeometryRasterMaskBuilder#getCoveredBounds(int)}
     *
     * @throws Exception
     */
    public void testCoveredBounds() throws Exception {
        GeometryRasterMaskBuilder tileRangeMask = buildSampleFilterMatrix(layer, gridsetId);

        long[][] coverages = layer.getGridSubset(gridsetId).getCoverages();
        long[][] expectedGridCoverages = {// just as a reminder
        new long[] { 0, 0, 1, 0, 0 },//
                new long[] { 0, 0, 3, 1, 1 },//
                new long[] { 0, 0, 7, 3, 2 },//
                new long[] { 0, 0, 15, 7, 3 },//
                new long[] { 0, 0, 31, 15, 4 },//
                new long[] { 0, 0, 63, 31, 5 },//
                new long[] { 0, 0, 127, 63, 6 },//
                new long[] { 0, 0, 255, 127, 7 },//
                new long[] { 0, 0, 511, 255, 8 },//
                new long[] { 0, 0, 1023, 511, 9 },//
                new long[] { 0, 0, 2047, 1023, 10 } //
        };
        TestUtils.assertEquals(expectedGridCoverages, coverages);

        TestUtils.assertEquals(new long[] { 0, 0, 1, 0, 0 }, tileRangeMask.getCoveredBounds(0));
        TestUtils.assertEquals(new long[] { 0, 0, 3, 1, 1 }, tileRangeMask.getCoveredBounds(1));
        TestUtils.assertEquals(new long[] { 1, 0, 7, 3, 2 }, tileRangeMask.getCoveredBounds(2));
        TestUtils.assertEquals(new long[] { 3, 0, 15, 6, 3 }, tileRangeMask.getCoveredBounds(3));
        TestUtils.assertEquals(new long[] { 7, 0, 31, 12, 4 }, tileRangeMask.getCoveredBounds(4));
        TestUtils.assertEquals(new long[] { 15, 0, 63, 24, 5 }, tileRangeMask.getCoveredBounds(5));
        TestUtils.assertEquals(new long[] { 31, 0, 127, 48, 6 }, tileRangeMask.getCoveredBounds(6));
        TestUtils.assertEquals(new long[] { 63, 0, 255, 96, 7 }, tileRangeMask.getCoveredBounds(7));
        TestUtils.assertEquals(new long[] { 127, 0, 511, 192, 8 },
                tileRangeMask.getCoveredBounds(8));
        TestUtils.assertEquals(new long[] { 255, 0, 1023, 384, 9 },
                tileRangeMask.getCoveredBounds(9));
        TestUtils.assertEquals(new long[] { 511, 0, 2047, 768, 10 },
                tileRangeMask.getCoveredBounds(10));
    }
View Full Code Here

                maxMaskLevel);

        logger.debug("Creating tile range mask based on GeoRSS feed's geometries from "
                + feedUrl.toExternalForm() + " for " + layer.getName());

        final GeometryRasterMaskBuilder tileRangeMask = matrixBuilder.buildTileRangeMask(
                geoRSSReader, this.lastUpdatedEntry);

        if (tileRangeMask == null) {
            logger.info("Did not create a tileRangeMask, presumably no new entries in feed.");
            return;
        }

        this.lastUpdatedEntry = matrixBuilder.getLastEntryUpdate();

        logger.debug("Created tile range mask based on GeoRSS geometry feed from " + pollDef
                + " for " + layer.getName() + ". Calculating number of affected tiles...");
        _logImagesToDisk(tileRangeMask);

        final boolean tilesAffected = tileRangeMask.hasTilesSet();
        if (tilesAffected) {
            logger.info("Launching reseed process " + pollDef + " for " + layer.getName());
        } else {
            logger.info(pollDef + " for " + layer.getName()
                    + " did not affect any tile. No need to reseed.");
View Full Code Here

        gridsetId = layer.getGridSubsets().iterator().next();
    }

    public void testBuildTileRangeMask() throws Exception {

        GeometryRasterMaskBuilder tileRangeMask = buildSampleFilterMatrix(layer, gridsetId);

        assertNotNull(tileRangeMask);
        assertEquals(0, tileRangeMask.getStartLevel());
        assertEquals(11, tileRangeMask.getNumLevels());
        assertEquals(layer.getGridSubset(gridsetId).getCoverages().length,
                tileRangeMask.getNumLevels());

    }
View Full Code Here

     * Test for {@link GeometryRasterMaskBuilder#getCoveredBounds(int)}
     *
     * @throws Exception
     */
    public void testCoveredBounds() throws Exception {
        GeometryRasterMaskBuilder tileRangeMask = buildSampleFilterMatrix(layer, gridsetId);

        long[][] coverages = layer.getGridSubset(gridsetId).getCoverages();
        long[][] expectedGridCoverages = {// just as a reminder
        new long[] { 0, 0, 1, 0, 0 },//
                new long[] { 0, 0, 3, 1, 1 },//
                new long[] { 0, 0, 7, 3, 2 },//
                new long[] { 0, 0, 15, 7, 3 },//
                new long[] { 0, 0, 31, 15, 4 },//
                new long[] { 0, 0, 63, 31, 5 },//
                new long[] { 0, 0, 127, 63, 6 },//
                new long[] { 0, 0, 255, 127, 7 },//
                new long[] { 0, 0, 511, 255, 8 },//
                new long[] { 0, 0, 1023, 511, 9 },//
                new long[] { 0, 0, 2047, 1023, 10 } //
        };
        TestUtils.assertEquals(expectedGridCoverages, coverages);

        TestUtils.assertEquals(new long[] { 0, 0, 1, 0, 0 }, tileRangeMask.getCoveredBounds(0));
        TestUtils.assertEquals(new long[] { 0, 0, 3, 1, 1 }, tileRangeMask.getCoveredBounds(1));
        TestUtils.assertEquals(new long[] { 1, 0, 7, 3, 2 }, tileRangeMask.getCoveredBounds(2));
        TestUtils.assertEquals(new long[] { 3, 0, 15, 6, 3 }, tileRangeMask.getCoveredBounds(3));
        TestUtils.assertEquals(new long[] { 7, 0, 31, 12, 4 }, tileRangeMask.getCoveredBounds(4));
        TestUtils.assertEquals(new long[] { 15, 0, 63, 24, 5 }, tileRangeMask.getCoveredBounds(5));
        TestUtils.assertEquals(new long[] { 31, 0, 127, 48, 6 }, tileRangeMask.getCoveredBounds(6));
        TestUtils.assertEquals(new long[] { 63, 0, 255, 96, 7 }, tileRangeMask.getCoveredBounds(7));
        TestUtils.assertEquals(new long[] { 127, 0, 511, 192, 8 },
                tileRangeMask.getCoveredBounds(8));
        TestUtils.assertEquals(new long[] { 255, 0, 1023, 384, 9 },
                tileRangeMask.getCoveredBounds(9));
        TestUtils.assertEquals(new long[] { 511, 0, 2047, 768, 10 },
                tileRangeMask.getCoveredBounds(10));
    }
View Full Code Here

    public GeometryRasterMaskBuilder buildTileRangeMask(final GeoRSSReader reader,
            String previousEntryUpdate) throws IOException {

        final GridSubset gridSubset = layer.getGridSubset(gridSetId);
        final int[] metaTilingFactors = layer.getMetaTilingFactors();
        GeometryRasterMaskBuilder matrix = null;

        Entry entry;
        Geometry geom;

        try {
            while ((entry = reader.nextEntry()) != null) {
                if (entry.getUpdated() != null && entry.getUpdated().equals(previousEntryUpdate)) {
                    logger.warn("Skipping entry with id " + entry.getId()
                            + " since it has the same date as our last feed update.");
                } else {
                    if (matrix == null) {
                        matrix = new GeometryRasterMaskBuilder(gridSubset, metaTilingFactors,
                                maxMaskLevel);
                    }

                    // Record the most recent updated entry. Date comparison
                    // done on the String as the format is like
                    // "2010-03-02T15:51:55Z" with the most significant part
                    // first.
                    if ((entry.getUpdated() != null)
                            && ((lastEntryUpdate == null) || (lastEntryUpdate.compareTo(entry
                                    .getUpdated()) < 0))) {
                        lastEntryUpdate = entry.getUpdated();
                    }

                    geom = entry.getWhere();
                    matrix.setMasksForGeometry(geom);
                }
            }
        } finally {
            if (matrix != null) {
                matrix.disposeGraphics();
            }
        }

        return matrix;
    }
View Full Code Here

                maxMaskLevel);

        logger.debug("Creating tile range mask based on GeoRSS feed's geometries from "
                + feedUrl.toExternalForm() + " for " + layerName);

        final GeometryRasterMaskBuilder tileRangeMask = matrixBuilder.buildTileRangeMask(
                geoRSSReader, previousUpdatedEntry);

        if (tileRangeMask == null) {
            logger.info("Did not create a tileRangeMask, presumably no new entries in feed.");
            return;
        }

        // store last updated entry to persist even after a restart
        final String lastUpdatedEntry = matrixBuilder.getLastEntryUpdate();
        storageBroker.putLayerMetadata(layerName, LAST_UPDATED, lastUpdatedEntry);

        logger.debug("Created tile range mask based on GeoRSS geometry feed from " + pollDef
                + " for " + layerName + ". Calculating number of affected tiles...");
        _logImagesToDisk(tileRangeMask);

        final boolean tilesAffected = tileRangeMask.hasTilesSet();
        if (tilesAffected) {
            logger.info("Launching reseed process " + pollDef + " for " + layerName);
        } else {
            logger.info(pollDef + " for " + layerName
                    + " did not affect any tile. No need to reseed.");
View Full Code Here

TOP

Related Classes of org.geowebcache.storage.GeometryRasterMaskBuilder

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.