Samples cleanup
Before Width: | Height: | Size: 14 KiB |
Before Width: | Height: | Size: 18 KiB |
Before Width: | Height: | Size: 22 KiB |
Before Width: | Height: | Size: 27 KiB |
Before Width: | Height: | Size: 32 KiB |
Before Width: | Height: | Size: 1.0 KiB |
Before Width: | Height: | Size: 1.0 KiB |
Before Width: | Height: | Size: 675 B |
Before Width: | Height: | Size: 2.0 KiB |
Before Width: | Height: | Size: 692 B |
Before Width: | Height: | Size: 44 KiB |
Before Width: | Height: | Size: 118 KiB |
Before Width: | Height: | Size: 73 KiB |
@ -16,43 +16,26 @@
|
|||||||
*/
|
*/
|
||||||
package org.oscim.stuff;
|
package org.oscim.stuff;
|
||||||
|
|
||||||
import com.badlogic.gdx.Input;
|
|
||||||
|
|
||||||
import org.oscim.gdx.GdxMap;
|
import org.oscim.gdx.GdxMap;
|
||||||
import org.oscim.gdx.GdxMapApp;
|
import org.oscim.gdx.GdxMapApp;
|
||||||
import org.oscim.layers.tile.buildings.BuildingLayer;
|
import org.oscim.layers.tile.buildings.BuildingLayer;
|
||||||
import org.oscim.layers.tile.vector.VectorTileLayer;
|
import org.oscim.layers.tile.vector.VectorTileLayer;
|
||||||
import org.oscim.layers.tile.vector.labeling.LabelLayer;
|
import org.oscim.layers.tile.vector.labeling.LabelLayer;
|
||||||
import org.oscim.theme.IRenderTheme.ThemeException;
|
import org.oscim.theme.VtmThemes;
|
||||||
import org.oscim.theme.StreamRenderTheme;
|
|
||||||
import org.oscim.theme.ThemeLoader;
|
|
||||||
import org.oscim.tiling.source.OkHttpEngine;
|
|
||||||
import org.oscim.tiling.source.UrlTileSource;
|
import org.oscim.tiling.source.UrlTileSource;
|
||||||
import org.oscim.tiling.source.oscimap4.OSciMap4TileSource;
|
import org.oscim.tiling.source.oscimap4.OSciMap4TileSource;
|
||||||
|
|
||||||
public class MapzenTest extends GdxMap {
|
public class MapzenTest extends GdxMap {
|
||||||
|
|
||||||
@Override
|
|
||||||
protected boolean onKeyDown(int keycode) {
|
|
||||||
if (keycode == Input.Keys.A) {
|
|
||||||
loadTheme();
|
|
||||||
}
|
|
||||||
|
|
||||||
return super.onKeyDown(keycode);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void createLayers() {
|
public void createLayers() {
|
||||||
UrlTileSource tileSource = OSciMap4TileSource.builder()
|
UrlTileSource tileSource = OSciMap4TileSource.builder()
|
||||||
.url("https://vector.mapzen.com/osm/v0.8/all")
|
.url("https://vector.mapzen.com/osm/v0.8/all")
|
||||||
.apiKey("vector-tiles-xxxxxxx") // Put a proper API key
|
.apiKey("vector-tiles-xxxxxxx") // Put a proper API key
|
||||||
.zoomMax(18)
|
|
||||||
.httpFactory(new OkHttpEngine.OkHttpFactory())
|
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
VectorTileLayer l = mMap.setBaseMap(tileSource);
|
VectorTileLayer l = mMap.setBaseMap(tileSource);
|
||||||
|
mMap.setTheme(VtmThemes.DEFAULT);
|
||||||
loadTheme();
|
|
||||||
|
|
||||||
mMap.layers().add(new BuildingLayer(mMap, l));
|
mMap.layers().add(new BuildingLayer(mMap, l));
|
||||||
mMap.layers().add(new LabelLayer(mMap, l));
|
mMap.layers().add(new LabelLayer(mMap, l));
|
||||||
@ -60,14 +43,6 @@ public class MapzenTest extends GdxMap {
|
|||||||
mMap.setMapPosition(53.08, 8.82, 1 << 17);
|
mMap.setMapPosition(53.08, 8.82, 1 << 17);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void loadTheme() {
|
|
||||||
try {
|
|
||||||
mMap.setTheme(ThemeLoader.load(new StreamRenderTheme("", getClass().getResourceAsStream("/assets/styles/mapzen.xml"))));
|
|
||||||
} catch (ThemeException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
GdxMapApp.init();
|
GdxMapApp.init();
|
||||||
GdxMapApp.run(new MapzenTest());
|
GdxMapApp.run(new MapzenTest());
|
||||||
|
@ -72,7 +72,7 @@ public class MapsforgeStyleTest extends GdxMap {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void loadTheme(final String styleId) {
|
private void loadTheme(final String styleId) {
|
||||||
mMap.setTheme(new StreamRenderTheme("", getClass().getResourceAsStream("/assets/styles/style.xml"), new XmlRenderThemeMenuCallback() {
|
mMap.setTheme(new StreamRenderTheme("", getClass().getResourceAsStream("/assets/styles/stylemenu.xml"), new XmlRenderThemeMenuCallback() {
|
||||||
@Override
|
@Override
|
||||||
public Set<String> getCategories(XmlRenderThemeStyleMenu renderThemeStyleMenu) {
|
public Set<String> getCategories(XmlRenderThemeStyleMenu renderThemeStyleMenu) {
|
||||||
// Use the selected style or the default
|
// Use the selected style or the default
|
||||||
|