summaryrefslogtreecommitdiff
path: root/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/sources/RasterSource.java
blob: f5db6f2a37f4871e6268cf8c4893023c1ea00e3a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
package com.mapbox.mapboxsdk.style.sources;

import java.net.URL;

/**
 * Construct a Raster Source.
 *
 * @see <a href="https://www.mapbox.com/mapbox-gl-style-spec/#sources-raster">The style specificition</a>
 */
public class RasterSource extends Source {
    public static final String TYPE = "raster";
    private static final String URL_KEY = "url";
    private static final String TILE_SIZE_KEY = "tileSize";

    public RasterSource(String id, URL url) {
        this(id, url.toExternalForm());
    }

    public RasterSource(String id, String url) {
        super(id, TYPE);
        this.put(URL_KEY, url);
    }

    public RasterSource(String id, TileSet tileSet) {
        super(id, TYPE);
        this.putAll(tileSet.toValueObject());
    }

    public RasterSource withTileSize(int tileSize) {
        this.put(TILE_SIZE_KEY, (float) tileSize);
        return this;
    }
}