Package gov.nasa.worldwind.layers.Earth

Source Code of gov.nasa.worldwind.layers.Earth.DOES_NOT_WORK_TempoFloodings$URLBuilder

/*
*  Copyright (C) 2011-2014 GeoForge Project
*
*  This program is free software: you can redistribute it and/or modify
*  it under the terms of the GNU Lesser General Public License as published by
*  the Free Software Foundation, either version 3 of the License, or
*  (at your option) any later version.
*
*  This program is distributed in the hope that it will be useful,
*  but WITHOUT ANY WARRANTY; without even the implied warranty of
*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
*  GNU Lesser General Public License for more details.
*
*  You should have received a copy of the GNU Lesser General Public License
*  along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/

package gov.nasa.worldwind.layers.Earth;

import gov.nasa.worldwind.avlist.AVKey;
import gov.nasa.worldwind.avlist.AVList;
import gov.nasa.worldwind.avlist.AVListImpl;
import gov.nasa.worldwind.geom.Angle;
import gov.nasa.worldwind.geom.LatLon;
import gov.nasa.worldwind.geom.Sector;
import gov.nasa.worldwind.layers.BasicTiledImageLayer;
import gov.nasa.worldwind.util.LevelSet;
import gov.nasa.worldwind.util.Tile;
import gov.nasa.worldwind.util.TileUrlBuilder;
import java.net.MalformedURLException;
import java.net.URL;

/**
*
* @author Amadeus.Sowerby
*
* email: Amadeus.Sowerby_AT_gmail.com
* ... please remove "_AT_" from the above string to get the right email address
*/
public class DOES_NOT_WORK_TempoFloodings extends BasicTiledImageLayer
{
   public DOES_NOT_WORK_TempoFloodings() throws Exception
    {
        super(makeLevels(new URLBuilder()));
        this.setUseTransparentTextures(true);
        this.setMaxActiveAltitude(100e3);
        this.setMinActiveAltitude(1);
    }

    private static LevelSet makeLevels(URLBuilder urlBuilder)
    {
        AVList params = new AVListImpl();

        params.setValue(AVKey.TILE_WIDTH, 512);
        params.setValue(AVKey.TILE_HEIGHT, 512);
        params.setValue(AVKey.DATA_CACHE_NAME, "geoservices.brgm.fr/risques/REM_NAPPE_SEDIM");
        params.setValue(AVKey.SERVICE, "http://geoservices.brgm.fr/risques");
       
        params.setValue(AVKey.DATASET_NAME, "REM_NAPPE_SEDIM");
        params.setValue(AVKey.FORMAT_SUFFIX, ".gif");
        params.setValue(AVKey.TRANSPARENCY_COLORS, 0);
       
        params.setValue(AVKey.NUM_LEVELS, 20);
        params.setValue(AVKey.NUM_EMPTY_LEVELS, 0);
        params.setValue(AVKey.LEVEL_ZERO_TILE_DELTA, new LatLon(Angle.fromDegrees(.2d), Angle.fromDegrees(.2d)));
        params.setValue(AVKey.SECTOR, Sector.fromDegrees(41.32526397666552, 51.20139642647427, -5.625179091996616, 11.1443951255116));
        params.setValue(AVKey.TILE_URL_BUILDER, urlBuilder);
        //params.setValue(AVKey.EXPIRY_TIME, new GregorianCalendar(2007, 7, 6).getTimeInMillis());

        return new LevelSet(params);
    }

    private static class URLBuilder implements TileUrlBuilder
    {
        @Override
        public URL getURL(Tile tile, String imageFormat) throws MalformedURLException
        {
          
            StringBuffer sb = new StringBuffer(tile.getLevel().getService());
            if (sb.lastIndexOf("?") != sb.length() - 1)
                sb.append("?");
            sb.append("request=GetMap");
            sb.append("&layers=");
            sb.append(tile.getLevel().getDataset());
            sb.append("&srs=EPSG:4326");
            sb.append("&width=");
            sb.append(tile.getLevel().getTileWidth());
            sb.append("&height=");
            sb.append(tile.getLevel().getTileHeight());

            Sector s = tile.getSector();
            sb.append("&bbox=");
            sb.append(s.getMinLongitude().getDegrees());
            sb.append(",");
            sb.append(s.getMinLatitude().getDegrees());
            sb.append(",");
            sb.append(s.getMaxLongitude().getDegrees());
            sb.append(",");
            sb.append(s.getMaxLatitude().getDegrees());

            sb.append("&format=image/gif");
            sb.append("&version=1.1.1");
            sb.append("&styles=");

            return new java.net.URL(sb.toString());
        }


    }

    @Override
    public String toString()
    {
        return "Risques";
    }
}
TOP

Related Classes of gov.nasa.worldwind.layers.Earth.DOES_NOT_WORK_TempoFloodings$URLBuilder

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.