TileSource: add alpha parameter
This commit is contained in:
parent
aa5a1436ca
commit
431790a638
@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2013 Hannes Janetzek
|
* Copyright 2013 Hannes Janetzek
|
||||||
* Copyright 2017 Andrey Novikov
|
* Copyright 2017 Andrey Novikov
|
||||||
* Copyright 2017 devemux86
|
* Copyright 2017-2018 devemux86
|
||||||
*
|
*
|
||||||
* This file is part of the OpenScienceMap project (http://www.opensciencemap.org).
|
* This file is part of the OpenScienceMap project (http://www.opensciencemap.org).
|
||||||
*
|
*
|
||||||
@ -68,7 +68,7 @@ public class BitmapTileLayer extends TileLayer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public BitmapTileLayer(Map map, TileSource tileSource, int cacheLimit) {
|
public BitmapTileLayer(Map map, TileSource tileSource, int cacheLimit) {
|
||||||
this(map, tileSource, cacheLimit, 1.0f);
|
this(map, tileSource, cacheLimit, tileSource.getAlpha());
|
||||||
}
|
}
|
||||||
|
|
||||||
public BitmapTileLayer(Map map, TileSource tileSource, int cacheLimit, float bitmapAlpha) {
|
public BitmapTileLayer(Map map, TileSource tileSource, int cacheLimit, float bitmapAlpha) {
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2013 Hannes Janetzek
|
* Copyright 2013 Hannes Janetzek
|
||||||
* Copyright 2016-2017 devemux86
|
* Copyright 2016-2018 devemux86
|
||||||
* Copyright 2017 Andrey Novikov
|
* Copyright 2017 Andrey Novikov
|
||||||
*
|
*
|
||||||
* This file is part of the OpenScienceMap project (http://www.opensciencemap.org).
|
* This file is part of the OpenScienceMap project (http://www.opensciencemap.org).
|
||||||
@ -25,10 +25,16 @@ import java.util.HashMap;
|
|||||||
public abstract class TileSource {
|
public abstract class TileSource {
|
||||||
|
|
||||||
public abstract static class Builder<T extends Builder<T>> {
|
public abstract static class Builder<T extends Builder<T>> {
|
||||||
|
protected float alpha = 1;
|
||||||
protected int zoomMin, zoomMax;
|
protected int zoomMin, zoomMax;
|
||||||
protected FadeStep[] fadeSteps;
|
protected FadeStep[] fadeSteps;
|
||||||
protected String name;
|
protected String name;
|
||||||
protected int tileSize;
|
protected int tileSize = 256;
|
||||||
|
|
||||||
|
public T alpha(float alpha) {
|
||||||
|
this.alpha = alpha;
|
||||||
|
return self();
|
||||||
|
}
|
||||||
|
|
||||||
public T zoomMin(int zoom) {
|
public T zoomMin(int zoom) {
|
||||||
zoomMin = zoom;
|
zoomMin = zoom;
|
||||||
@ -63,6 +69,7 @@ public abstract class TileSource {
|
|||||||
public abstract TileSource build();
|
public abstract TileSource build();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected float mAlpha = 1;
|
||||||
protected int mZoomMin = 0;
|
protected int mZoomMin = 0;
|
||||||
protected int mZoomMax = 20;
|
protected int mZoomMax = 20;
|
||||||
protected String mName;
|
protected String mName;
|
||||||
@ -77,6 +84,7 @@ public abstract class TileSource {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public TileSource(Builder<?> builder) {
|
public TileSource(Builder<?> builder) {
|
||||||
|
mAlpha = builder.alpha;
|
||||||
mZoomMin = builder.zoomMin;
|
mZoomMin = builder.zoomMin;
|
||||||
mZoomMax = builder.zoomMax;
|
mZoomMax = builder.zoomMax;
|
||||||
mFadeSteps = builder.fadeSteps;
|
mFadeSteps = builder.fadeSteps;
|
||||||
@ -96,6 +104,10 @@ public abstract class TileSource {
|
|||||||
|
|
||||||
private FadeStep[] mFadeSteps;
|
private FadeStep[] mFadeSteps;
|
||||||
|
|
||||||
|
public float getAlpha() {
|
||||||
|
return mAlpha;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Cache MUST be set before TileSource is added to a TileLayer!
|
* Cache MUST be set before TileSource is added to a TileLayer!
|
||||||
*/
|
*/
|
||||||
|
Loading…
x
Reference in New Issue
Block a user