Tile decoders refactoring
This commit is contained in:
parent
1294ff9fea
commit
c20922b5f5
@ -22,7 +22,7 @@ import org.oscim.layers.tile.MapTile;
|
||||
import org.oscim.tiling.ITileDataSink;
|
||||
import org.oscim.tiling.OverzoomDataSink;
|
||||
import org.oscim.tiling.QueryResult;
|
||||
import org.oscim.tiling.source.mvt.MvtTileDecoder;
|
||||
import org.oscim.tiling.source.mvt.TileDecoder;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
@ -45,10 +45,10 @@ public class MBTilesMvtTileDataSource extends MBTilesTileDataSource {
|
||||
|
||||
private final String mLanguage;
|
||||
|
||||
private final ThreadLocal<MvtTileDecoder> mThreadLocalDecoders = new ThreadLocal<MvtTileDecoder>() {
|
||||
private final ThreadLocal<TileDecoder> mThreadLocalDecoders = new ThreadLocal<TileDecoder>() {
|
||||
@Override
|
||||
protected MvtTileDecoder initialValue() {
|
||||
return new MvtTileDecoder(mLanguage);
|
||||
protected TileDecoder initialValue() {
|
||||
return new TileDecoder(mLanguage);
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -78,6 +78,6 @@ public class OverpassTileSource extends UrlTileSource {
|
||||
|
||||
@Override
|
||||
public ITileDataSource getDataSource() {
|
||||
return new OverzoomTileDataSource(new UrlTileDataSource(this, new OverpassTileDecoder(), getHttpEngine()), mOverZoom);
|
||||
return new OverzoomTileDataSource(new UrlTileDataSource(this, new TileDecoder(), getHttpEngine()), mOverZoom);
|
||||
}
|
||||
}
|
||||
|
@ -39,14 +39,14 @@ import java.io.InputStream;
|
||||
import static org.oscim.core.MercatorProjection.latitudeToY;
|
||||
import static org.oscim.core.MercatorProjection.longitudeToX;
|
||||
|
||||
public class OverpassTileDecoder implements ITileDecoder {
|
||||
public class TileDecoder implements ITileDecoder {
|
||||
|
||||
private final MapElement mMapElement;
|
||||
private ITileDataSink mTileDataSink;
|
||||
|
||||
private double mTileY, mTileX, mTileScale;
|
||||
|
||||
public OverpassTileDecoder() {
|
||||
public TileDecoder() {
|
||||
mMapElement = new MapElement();
|
||||
mMapElement.layer = 5;
|
||||
}
|
@ -65,6 +65,6 @@ public class MapilionMvtTileSource extends UrlTileSource {
|
||||
|
||||
@Override
|
||||
public ITileDataSource getDataSource() {
|
||||
return new OverzoomTileDataSource(new UrlTileDataSource(this, new MvtTileDecoder(locale), getHttpEngine()), mOverZoom);
|
||||
return new OverzoomTileDataSource(new UrlTileDataSource(this, new TileDecoder(locale), getHttpEngine()), mOverZoom);
|
||||
}
|
||||
}
|
||||
|
@ -69,6 +69,6 @@ public class MapzenMvtTileSource extends UrlTileSource {
|
||||
|
||||
@Override
|
||||
public ITileDataSource getDataSource() {
|
||||
return new OverzoomTileDataSource(new UrlTileDataSource(this, new MvtTileDecoder(locale), getHttpEngine()), mOverZoom);
|
||||
return new OverzoomTileDataSource(new UrlTileDataSource(this, new TileDecoder(locale), getHttpEngine()), mOverZoom);
|
||||
}
|
||||
}
|
||||
|
@ -66,6 +66,6 @@ public class NextzenMvtTileSource extends UrlTileSource {
|
||||
|
||||
@Override
|
||||
public ITileDataSource getDataSource() {
|
||||
return new OverzoomTileDataSource(new UrlTileDataSource(this, new MvtTileDecoder(locale), getHttpEngine()), mOverZoom);
|
||||
return new OverzoomTileDataSource(new UrlTileDataSource(this, new TileDecoder(locale), getHttpEngine()), mOverZoom);
|
||||
}
|
||||
}
|
||||
|
@ -69,6 +69,6 @@ public class OpenMapTilesMvtTileSource extends UrlTileSource {
|
||||
|
||||
@Override
|
||||
public ITileDataSource getDataSource() {
|
||||
return new OverzoomTileDataSource(new UrlTileDataSource(this, new MvtTileDecoder(locale), getHttpEngine()), mOverZoom);
|
||||
return new OverzoomTileDataSource(new UrlTileDataSource(this, new TileDecoder(locale), getHttpEngine()), mOverZoom);
|
||||
}
|
||||
}
|
||||
|
@ -42,7 +42,7 @@ import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.util.Map;
|
||||
|
||||
public class MvtTileDecoder implements ITileDecoder {
|
||||
public class TileDecoder implements ITileDecoder {
|
||||
private final String mLocale;
|
||||
|
||||
private static final float REF_TILE_SIZE = 4096.0f;
|
||||
@ -52,11 +52,11 @@ public class MvtTileDecoder implements ITileDecoder {
|
||||
private final MapElement mMapElement;
|
||||
private ITileDataSink mTileDataSink;
|
||||
|
||||
public MvtTileDecoder() {
|
||||
public TileDecoder() {
|
||||
this("");
|
||||
}
|
||||
|
||||
public MvtTileDecoder(String locale) {
|
||||
public TileDecoder(String locale) {
|
||||
mLocale = locale;
|
||||
mGeomFactory = new GeometryFactory();
|
||||
mMapElement = new MapElement();
|
@ -24,11 +24,11 @@ import org.oscim.tiling.QueryResult;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
public class MvtTileDecoderTest {
|
||||
public class TileDecoderTest {
|
||||
|
||||
@Test
|
||||
public void tileDecodingTest() throws Exception {
|
||||
MvtTileDecoder decoder = new MvtTileDecoder();
|
||||
TileDecoder decoder = new TileDecoder();
|
||||
Tile tile = new Tile(0, 0, (byte) 0);
|
||||
ITileDataSink sink = new ITileDataSink() {
|
||||
@Override
|
@ -81,10 +81,10 @@ public class BitmapTileSource extends UrlTileSource {
|
||||
|
||||
@Override
|
||||
public ITileDataSource getDataSource() {
|
||||
return new UrlTileDataSource(this, new BitmapTileDecoder(), getHttpEngine());
|
||||
return new UrlTileDataSource(this, new TileDecoder(), getHttpEngine());
|
||||
}
|
||||
|
||||
public class BitmapTileDecoder implements ITileDecoder {
|
||||
public static class TileDecoder implements ITileDecoder {
|
||||
|
||||
@Override
|
||||
public boolean decode(Tile tile, ITileDataSink sink, InputStream is)
|
||||
|
@ -16,7 +16,7 @@
|
||||
* 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 org.oscim.tiling.source.mvt;
|
||||
package org.oscim.tiling.source.mapzen;
|
||||
|
||||
import org.oscim.core.GeometryBuffer.GeometryType;
|
||||
import org.oscim.core.MapElement;
|
Loading…
x
Reference in New Issue
Block a user