add TileSource.Builders

This commit is contained in:
Hannes Janetzek
2014-09-11 20:11:29 +02:00
parent 67336e0c93
commit a97b3283a0
18 changed files with 276 additions and 131 deletions

View File

@@ -1,13 +1,14 @@
package org.oscim.test;
import static org.oscim.tiling.source.bitmap.DefaultSources.HD_HILLSHADE;
import static org.oscim.tiling.source.bitmap.DefaultSources.OPENSTREETMAP;
import static org.oscim.tiling.source.bitmap.DefaultSources.STAMEN_TONER;
import static org.oscim.tiling.source.bitmap.DefaultSources.STAMEN_WATERCOLOR;
import org.oscim.gdx.GdxMap;
import org.oscim.gdx.GdxMapApp;
import org.oscim.layers.tile.bitmap.BitmapTileLayer;
import org.oscim.renderer.MapRenderer;
import org.oscim.tiling.source.bitmap.DefaultSources.HillShadeHD;
import org.oscim.tiling.source.bitmap.DefaultSources.OpenStreetMap;
import org.oscim.tiling.source.bitmap.DefaultSources.StamenToner;
import org.oscim.tiling.source.bitmap.DefaultSources.StamenWatercolor;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -18,23 +19,28 @@ public class BitmapLayerTest extends GdxMap {
final Logger log = LoggerFactory.getLogger(BitmapTileLayer.class);
BitmapTileLayer mLayer = null;
BitmapTileLayer mShaded = null;
@Override
protected boolean onKeyDown(int keycode) {
if (keycode == Input.Keys.NUM_1) {
mMap.layers().remove(mLayer);
mLayer = new BitmapTileLayer(mMap, new OpenStreetMap());
mMap.layers().set(2, mLayer);
mLayer = new BitmapTileLayer(mMap, OPENSTREETMAP.build());
mMap.layers().add(mLayer);
return true;
} else if (keycode == Input.Keys.NUM_2) {
mMap.layers().remove(mLayer);
mLayer = new BitmapTileLayer(mMap, new StamenWatercolor());
mMap.layers().set(2, mLayer);
mLayer = new BitmapTileLayer(mMap, STAMEN_WATERCOLOR.build());
mMap.layers().add(mLayer);
return true;
} else if (keycode == Input.Keys.NUM_3) {
mMap.layers().remove(mLayer);
mLayer = new BitmapTileLayer(mMap, new HillShadeHD());
mMap.layers().set(2, mLayer);
if (mShaded != null) {
mMap.layers().remove(mShaded);
mShaded = null;
} else {
mShaded = new BitmapTileLayer(mMap, HD_HILLSHADE.build());
mMap.layers().add(mShaded);
}
return true;
}
@@ -45,7 +51,7 @@ public class BitmapLayerTest extends GdxMap {
public void createLayers() {
MapRenderer.setBackgroundColor(0xff888888);
mLayer = new BitmapTileLayer(mMap, new StamenToner());
mLayer = new BitmapTileLayer(mMap, STAMEN_TONER.build());
mMap.layers().add(mLayer);
}

View File

@@ -1,10 +1,11 @@
package org.oscim.test;
import static org.oscim.tiling.source.bitmap.DefaultSources.STAMEN_TONER;
import org.oscim.gdx.GdxMapApp;
import org.oscim.layers.tile.bitmap.BitmapTileLayer;
import org.oscim.layers.tile.buildings.S3DBLayer;
import org.oscim.tiling.TileSource;
import org.oscim.tiling.source.bitmap.DefaultSources;
import org.oscim.tiling.source.oscimap4.OSciMap4TileSource;
public class MeshTest extends GdxMapApp {
@@ -16,7 +17,7 @@ public class MeshTest extends GdxMapApp {
//VectorTileLayer l = mMap.setBaseMap(new OSciMap4TileSource());
//mMap.setTheme(VtmThemes.DEFAULT);
mMap.setBaseMap(new BitmapTileLayer(mMap, new DefaultSources.StamenToner()));
mMap.setBaseMap(new BitmapTileLayer(mMap, STAMEN_TONER.build()));
TileSource ts = new OSciMap4TileSource("http://opensciencemap.org/tiles/s3db");
S3DBLayer tl = new S3DBLayer(mMap, ts);

View File

@@ -1,5 +1,7 @@
package org.oscim.test;
import static org.oscim.tiling.source.bitmap.DefaultSources.STAMEN_TONER;
import org.oscim.core.MercatorProjection;
import org.oscim.gdx.GdxMap;
import org.oscim.gdx.GdxMapApp;
@@ -15,7 +17,6 @@ import org.oscim.layers.tile.vector.VectorTileLoader;
import org.oscim.renderer.MapRenderer;
import org.oscim.theme.DebugTheme;
import org.oscim.tiling.TileSource;
import org.oscim.tiling.source.bitmap.DefaultSources;
import org.oscim.tiling.source.oscimap4.OSciMap4TileSource;
public class TileRenderTest extends GdxMap {
@@ -114,7 +115,7 @@ public class TileRenderTest extends GdxMap {
}
}
mMap.setBaseMap(new BitmapTileLayer(mMap, new DefaultSources.StamenToner()));
mMap.setBaseMap(new BitmapTileLayer(mMap, STAMEN_TONER.build()));
mMap.layers().add(l);
}

View File

@@ -1,5 +1,7 @@
package org.oscim.test.jeo;
import static org.oscim.tiling.source.bitmap.DefaultSources.STAMEN_TONER;
import java.io.IOException;
import java.io.InputStream;
import java.net.URL;
@@ -14,7 +16,6 @@ import org.oscim.layers.OSMIndoorLayer;
import org.oscim.layers.TileGridLayer;
import org.oscim.layers.tile.bitmap.BitmapTileLayer;
import org.oscim.test.JeoTest;
import org.oscim.tiling.source.bitmap.DefaultSources.StamenToner;
public class LayerTest extends GdxMap {
@@ -24,7 +25,7 @@ public class LayerTest extends GdxMap {
@Override
public void createLayers() {
mMap.setBaseMap(new BitmapTileLayer(mMap, new StamenToner()));
mMap.setBaseMap(new BitmapTileLayer(mMap, STAMEN_TONER.build()));
mMap.layers().add(new TileGridLayer(mMap));
mMap.addTask(new Runnable() {