Tile source: store tile size, closes #182

This commit is contained in:
Emux 2016-09-25 18:24:13 +03:00
parent ec4f12b576
commit aa3aec0218

View File

@ -1,5 +1,6 @@
/* /*
* Copyright 2013 Hannes Janetzek * Copyright 2013 Hannes Janetzek
* Copyright 2016 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).
* *
@ -25,6 +26,7 @@ public abstract class TileSource {
public abstract static class Builder<T extends Builder<T>> { public abstract static class Builder<T extends Builder<T>> {
protected int zoomMin, zoomMax; protected int zoomMin, zoomMax;
protected FadeStep[] fadeSteps; protected FadeStep[] fadeSteps;
protected int tileSize;
public T zoomMin(int zoom) { public T zoomMin(int zoom) {
zoomMin = zoom; zoomMin = zoom;
@ -41,6 +43,11 @@ public abstract class TileSource {
return self(); return self();
} }
public T tileSize(int tileSize) {
this.tileSize = tileSize;
return self();
}
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
protected T self() { protected T self() {
return (T) this; return (T) this;
@ -51,6 +58,7 @@ public abstract class TileSource {
protected int mZoomMin = 0; protected int mZoomMin = 0;
protected int mZoomMax = 20; protected int mZoomMax = 20;
protected int mTileSize = 256;
protected TileSource() { protected TileSource() {
} }
@ -64,6 +72,7 @@ public abstract class TileSource {
mZoomMin = builder.zoomMin; mZoomMin = builder.zoomMin;
mZoomMax = builder.zoomMax; mZoomMax = builder.zoomMax;
mFadeSteps = builder.fadeSteps; mFadeSteps = builder.fadeSteps;
mTileSize = builder.tileSize;
} }
public abstract ITileDataSource getDataSource(); public abstract ITileDataSource getDataSource();
@ -97,6 +106,10 @@ public abstract class TileSource {
return mFadeSteps; return mFadeSteps;
} }
public int getTileSize() {
return mTileSize;
}
public TileSource setOption(String key, String value) { public TileSource setOption(String key, String value) {
options.put(key, value); options.put(key, value);
return this; return this;