Package org.locationtech.udig.catalog.internal.wmt.wmtsource

Examples of org.locationtech.udig.catalog.internal.wmt.wmtsource.WWSource


            identifier = service.getIdentifier();
        }
    }
   
    public WWGeoResource(WWService service, IResolve parent, QuadTileSet quadTileSet) {
        this(service, parent, new WWSource(quadTileSet));
    }
View Full Code Here


         * @param wmtSource
         * @return
         */
        public WWTile getTileFromCoordinate(double lat, double lon,
                WMTZoomLevel zoomLevel, WMTSource wmtSource) {
            WWSource wwSource = (WWSource) wmtSource;
           
            // normalize latitude and longitude
            lat = WMTTileFactory.normalizeDegreeValue(lat, 90);
            lon = WMTTileFactory.normalizeDegreeValue(lon, 180);

            lat = WMTTileFactory.moveInRange(lat,
                    wwSource.getBounds().getMinY(), wwSource.getBounds().getMaxY());
            lon = WMTTileFactory.moveInRange(lon,
                    wwSource.getBounds().getMinX(), wwSource.getBounds().getMaxX());
           
            WWZoomLevel wwZoomLevel = (WWZoomLevel) zoomLevel;
            int row = WMTTileName.arithmeticMod(
                        (int) Math.ceil(Math.abs((lat - WWSource.WORLD_BOUNDS.getMinY())  / wwZoomLevel.getHeightInWorldUnits())) - 1,
                        zoomLevel.getMaxTilePerColNumber());
View Full Code Here

            return new WWTile(col, row, wwZoomLevel, (WWSource) wmtSource);
        }
        //endregion

        public WMTZoomLevel getZoomLevel(int zoomLevel, WMTSource wmtSource) {
            WWSource wwSource = (WWSource) wmtSource;
           
            return wwSource.getZoomLevel(zoomLevel);
        }
View Full Code Here

   
    @Test
    public void testTiles() throws Exception {
        Element rootElement = getRootElement();       
        QuadTileSet quadTileSet = new QuadTileSet(rootElement.getChild("ChildLayerSet").getChild("QuadTileSet"), "");
        WWSource wwSource = new WWSource(quadTileSet);
       
        assertEquals(2, wwSource.getZoomLevel(0).getMaxTilePerColNumber());
        assertEquals(4, wwSource.getZoomLevel(0).getMaxTilePerRowNumber());
       
        WWTile tile1 = new WWTile(0, 0, wwSource.getZoomLevel(0), wwSource);       
        assertEquals(new Envelope(-180, -90, -90, 0), tile1.getBounds());
       
        WWTile tile2 = tile1.getRightNeighbour();       
        assertEquals(new Envelope(-90, 0, -90, 0), tile2.getBounds());
       
View Full Code Here

       
        QuadTileSet quadTileSet = new QuadTileSet(((Element) rootElement.getChildren("ChildLayerSet").get(3)).getChild("QuadTileSet"), "");
       
        assertEquals("Robben Island (0.5m)", quadTileSet.getName());
       
        WWSource wwSource = new WWSource(quadTileSet);
       
        // extent is not covered from QuadTileSet
        WMTRenderJob renderJob1 = WMTRenderJob.createRenderJob(
                new ReferencedEnvelope(1, 2, 48, 49, DefaultGeographicCRS.WGS84),
                10000,
                wwSource);
       
        Map<String, Tile> tiles1 = wwSource.cutExtentIntoTiles(renderJob1,
                50,
                true, null, 1000);
        assertEquals(true, tiles1.isEmpty());
       
        // bounds of the QuadTileSet are inside the extent
        WMTRenderJob renderJob2 = WMTRenderJob.createRenderJob(
                new ReferencedEnvelope(18.34, 18.4, -33.85, -33.5, DefaultGeographicCRS.WGS84),
                20000000,
                wwSource);
        Map<String, Tile> tiles2 = wwSource.cutExtentIntoTiles(renderJob2,
                50,
                true, null, 1000);
        assertEquals(1, tiles2.size());
    }
View Full Code Here

    @Test
    public void testTileFromCoordinateWholeWorld() throws Exception {
        Element rootElement = QuadTileSetTest.getRootElement();
        QuadTileSet quadTileSet = new QuadTileSet(rootElement.getChild("ChildLayerSet").getChild("QuadTileSet"), "");
       
        WWSource wwSource = new WWSource(quadTileSet);
       
        assertEquals(new WWTile(0, 1, wwSource.getZoomLevel(0), wwSource).getTileName().toString(),
                ((WWTile) wwSource.getTileFactory().getTileFromCoordinate(90, -180, wwSource.getZoomLevel(0), wwSource)).getTileName().toString());
       
        assertEquals(new WWTile(0, 1, wwSource.getZoomLevel(0), wwSource).getTileName().toString(),
                ((WWTile) wwSource.getTileFactory().getTileFromCoordinate(89, -180, wwSource.getZoomLevel(0), wwSource)).getTileName().toString());
       
        assertEquals(new WWTile(0, 0, wwSource.getZoomLevel(0), wwSource).getTileName().toString(),
                ((WWTile) wwSource.getTileFactory().getTileFromCoordinate(-89, -180, wwSource.getZoomLevel(0), wwSource)).getTileName().toString());
       
   
    }
View Full Code Here

TOP

Related Classes of org.locationtech.udig.catalog.internal.wmt.wmtsource.WWSource

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.