add getter for UrlTileSource.getUrl()

This commit is contained in:
Hannes Janetzek
2014-02-25 22:54:55 +01:00
parent 9fe4be522a
commit 50e3794cb9
6 changed files with 12 additions and 8 deletions

View File

@@ -30,10 +30,10 @@ public class MapnikVectorTileSource extends UrlTileSource {
@Override @Override
public ITileDataSource getDataSource() { public ITileDataSource getDataSource() {
return new UrlTileDataSource(this, new TileDecoder(), new LwHttp(mUrl)); return new UrlTileDataSource(this, new TileDecoder(), new LwHttp(getUrl()));
} }
protected int formatTilePath(Tile tile, byte[] path, int pos) { public int formatTilePath(Tile tile, byte[] path, int pos) {
// url formatter for mapbox streets // url formatter for mapbox streets
byte[] hexTable = { byte[] hexTable = {
'0', '1', '2', '3', '0', '1', '2', '3',

View File

@@ -35,6 +35,6 @@ public class OSciMap1TileSource extends UrlTileSource {
@Override @Override
public ITileDataSource getDataSource() { public ITileDataSource getDataSource() {
return new UrlTileDataSource(this, new TileDecoder(), new LwHttp(mUrl)); return new UrlTileDataSource(this, new TileDecoder(), new LwHttp(getUrl()));
} }
} }

View File

@@ -44,7 +44,7 @@ public class OSciMap2TileSource extends UrlTileSource {
@Override @Override
public ITileDataSource getDataSource() { public ITileDataSource getDataSource() {
return new UrlTileDataSource(this, new TileDecoder(), new LwHttp(mUrl)); return new UrlTileDataSource(this, new TileDecoder(), new LwHttp(getUrl()));
} }
static class TileDecoder extends PbfDecoder { static class TileDecoder extends PbfDecoder {

View File

@@ -24,7 +24,7 @@ import org.oscim.tiling.TileSource;
public abstract class UrlTileSource extends TileSource { public abstract class UrlTileSource extends TileSource {
protected final URL mUrl; private final URL mUrl;
private byte[] mExt; private byte[] mExt;
public UrlTileSource(String urlString) { public UrlTileSource(String urlString) {
@@ -83,7 +83,7 @@ public abstract class UrlTileSource extends TileSource {
* @param pos current position * @param pos current position
* @return new position * @return new position
*/ */
protected int formatTilePath(Tile tile, byte[] buf, int pos) { public int formatTilePath(Tile tile, byte[] buf, int pos) {
String p = getTileUrl(tile); String p = getTileUrl(tile);
if (p != null) { if (p != null) {
byte[] b = p.getBytes(); byte[] b = p.getBytes();
@@ -103,4 +103,8 @@ public abstract class UrlTileSource extends TileSource {
System.arraycopy(mExt, 0, buf, pos, mExt.length); System.arraycopy(mExt, 0, buf, pos, mExt.length);
return pos + mExt.length; return pos + mExt.length;
} }
public URL getUrl() {
return mUrl;
}
} }

View File

@@ -32,7 +32,7 @@ public abstract class BitmapTileSource extends UrlTileSource {
@Override @Override
public ITileDataSource getDataSource() { public ITileDataSource getDataSource() {
return new UrlTileDataSource(this, new BitmapTileDecoder(), new LwHttp(mUrl)); return new UrlTileDataSource(this, new BitmapTileDecoder(), new LwHttp(getUrl()));
} }
public class BitmapTileDecoder implements ITileDecoder { public class BitmapTileDecoder implements ITileDecoder {

View File

@@ -34,6 +34,6 @@ public class OSciMap4TileSource extends UrlTileSource {
@Override @Override
public ITileDataSource getDataSource() { public ITileDataSource getDataSource() {
return new UrlTileDataSource(this, new TileDecoder(), new LwHttp(mUrl)); return new UrlTileDataSource(this, new TileDecoder(), new LwHttp(getUrl()));
} }
} }