Samples: fix BitmapLayerTest, #32
This commit is contained in:
parent
a922ae7e78
commit
b434b38872
@ -22,41 +22,40 @@ import org.oscim.gdx.GdxMap;
|
|||||||
import org.oscim.gdx.GdxMapApp;
|
import org.oscim.gdx.GdxMapApp;
|
||||||
import org.oscim.layers.tile.bitmap.BitmapTileLayer;
|
import org.oscim.layers.tile.bitmap.BitmapTileLayer;
|
||||||
import org.oscim.renderer.MapRenderer;
|
import org.oscim.renderer.MapRenderer;
|
||||||
import org.slf4j.Logger;
|
import org.oscim.tiling.source.bitmap.DefaultSources;
|
||||||
import org.slf4j.LoggerFactory;
|
|
||||||
|
|
||||||
import static org.oscim.tiling.source.bitmap.DefaultSources.HIKEBIKE_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;
|
|
||||||
|
|
||||||
public class BitmapLayerTest extends GdxMap {
|
public class BitmapLayerTest extends GdxMap {
|
||||||
|
|
||||||
final Logger log = LoggerFactory.getLogger(BitmapTileLayer.class);
|
private BitmapTileLayer mLayer = null;
|
||||||
|
private BitmapTileLayer mShaded = null;
|
||||||
BitmapTileLayer mLayer = null;
|
|
||||||
BitmapTileLayer mShaded = null;
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected boolean onKeyDown(int keycode) {
|
protected boolean onKeyDown(int keycode) {
|
||||||
if (keycode == Input.Keys.NUM_1) {
|
if (keycode == Input.Keys.NUM_1) {
|
||||||
|
mMap.layers().remove(mShaded);
|
||||||
|
mShaded = null;
|
||||||
mMap.layers().remove(mLayer);
|
mMap.layers().remove(mLayer);
|
||||||
mLayer = new BitmapTileLayer(mMap, OPENSTREETMAP.build());
|
mLayer = new BitmapTileLayer(mMap, DefaultSources.OPENSTREETMAP.build());
|
||||||
mMap.layers().add(mLayer);
|
mMap.layers().add(mLayer);
|
||||||
|
mMap.clearMap();
|
||||||
return true;
|
return true;
|
||||||
} else if (keycode == Input.Keys.NUM_2) {
|
} else if (keycode == Input.Keys.NUM_2) {
|
||||||
|
mMap.layers().remove(mShaded);
|
||||||
|
mShaded = null;
|
||||||
mMap.layers().remove(mLayer);
|
mMap.layers().remove(mLayer);
|
||||||
mLayer = new BitmapTileLayer(mMap, STAMEN_WATERCOLOR.build());
|
mLayer = new BitmapTileLayer(mMap, DefaultSources.STAMEN_TONER.build());
|
||||||
mMap.layers().add(mLayer);
|
mMap.layers().add(mLayer);
|
||||||
|
mMap.clearMap();
|
||||||
return true;
|
return true;
|
||||||
} else if (keycode == Input.Keys.NUM_3) {
|
} else if (keycode == Input.Keys.NUM_3) {
|
||||||
if (mShaded != null) {
|
if (mShaded != null) {
|
||||||
mMap.layers().remove(mShaded);
|
mMap.layers().remove(mShaded);
|
||||||
mShaded = null;
|
mShaded = null;
|
||||||
} else {
|
} else {
|
||||||
mShaded = new BitmapTileLayer(mMap, HIKEBIKE_HILLSHADE.build());
|
mShaded = new BitmapTileLayer(mMap, DefaultSources.HIKEBIKE_HILLSHADE.build());
|
||||||
mMap.layers().add(mShaded);
|
mMap.layers().add(mShaded);
|
||||||
}
|
}
|
||||||
|
mMap.clearMap();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -67,13 +66,12 @@ public class BitmapLayerTest extends GdxMap {
|
|||||||
public void createLayers() {
|
public void createLayers() {
|
||||||
MapRenderer.setBackgroundColor(0xff888888);
|
MapRenderer.setBackgroundColor(0xff888888);
|
||||||
|
|
||||||
mLayer = new BitmapTileLayer(mMap, STAMEN_TONER.build());
|
mLayer = new BitmapTileLayer(mMap, DefaultSources.OPENSTREETMAP.build());
|
||||||
mMap.layers().add(mLayer);
|
mMap.layers().add(mLayer);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
|
|
||||||
GdxMapApp.init();
|
GdxMapApp.init();
|
||||||
GdxMapApp.run(new BitmapLayerTest(), null, 256);
|
GdxMapApp.run(new BitmapLayerTest(), null, 256);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user