Mapzen vector tiles: fix example, provide vtm-stylesheet, #50
@ -5,12 +5,13 @@ dependencies {
|
|||||||
compile project(':vtm-desktop')
|
compile project(':vtm-desktop')
|
||||||
compile project(':vtm-extras')
|
compile project(':vtm-extras')
|
||||||
compile project(':vtm-jeo')
|
compile project(':vtm-jeo')
|
||||||
|
runtime 'com.squareup.okhttp:okhttp:1.5.2'
|
||||||
}
|
}
|
||||||
|
|
||||||
sourceSets {
|
sourceSets {
|
||||||
main {
|
main {
|
||||||
java.srcDirs = ['src']
|
java.srcDirs = ['src']
|
||||||
resources.srcDirs = ["${buildDir}/assets"]
|
resources.srcDirs = ['resources']
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
BIN
vtm-playground/resources/assets/patterns/dots.png
Normal file
After Width: | Height: | Size: 1.0 KiB |
BIN
vtm-playground/resources/assets/patterns/dotsv4.png
Normal file
After Width: | Height: | Size: 1.0 KiB |
BIN
vtm-playground/resources/assets/patterns/park_texture.png
Normal file
After Width: | Height: | Size: 675 B |
BIN
vtm-playground/resources/assets/patterns/park_texture_2.png
Normal file
After Width: | Height: | Size: 2.0 KiB |
BIN
vtm-playground/resources/assets/patterns/water_texture.png
Normal file
After Width: | Height: | Size: 692 B |
1176
vtm-playground/resources/assets/styles/mapzen.xml
Normal file
BIN
vtm-playground/resources/assets/styles/osmarender.png
Normal file
After Width: | Height: | Size: 23 KiB |
BIN
vtm-playground/resources/assets/styles/poi_icons_16.png
Normal file
After Width: | Height: | Size: 14 KiB |
BIN
vtm-playground/resources/assets/styles/poi_icons_20.png
Normal file
After Width: | Height: | Size: 18 KiB |
BIN
vtm-playground/resources/assets/styles/poi_icons_24.png
Normal file
After Width: | Height: | Size: 22 KiB |
BIN
vtm-playground/resources/assets/styles/poi_icons_28.png
Normal file
After Width: | Height: | Size: 27 KiB |
BIN
vtm-playground/resources/assets/styles/poi_icons_32.png
Normal file
After Width: | Height: | Size: 32 KiB |
BIN
vtm-playground/resources/assets/textures/grass.png
Normal file
After Width: | Height: | Size: 44 KiB |
BIN
vtm-playground/resources/assets/textures/water.png
Normal file
After Width: | Height: | Size: 118 KiB |
BIN
vtm-playground/resources/assets/textures/wood.png
Normal file
After Width: | Height: | Size: 73 KiB |
@ -1,8 +1,23 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2016 devemux86
|
||||||
|
*
|
||||||
|
* This file is part of the OpenScienceMap project (http://www.opensciencemap.org).
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify it under the
|
||||||
|
* terms of the GNU Lesser General Public License as published by the Free Software
|
||||||
|
* Foundation, either version 3 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||||
|
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||||
|
* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* 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.stuff;
|
package org.oscim.stuff;
|
||||||
|
|
||||||
import java.io.FileNotFoundException;
|
import com.badlogic.gdx.Input;
|
||||||
|
|
||||||
import org.oscim.backend.CanvasAdapter;
|
|
||||||
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;
|
||||||
@ -13,36 +28,23 @@ import org.oscim.theme.ThemeLoader;
|
|||||||
import org.oscim.tiling.source.OkHttpEngine;
|
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;
|
||||||
import org.slf4j.Logger;
|
|
||||||
import org.slf4j.LoggerFactory;
|
|
||||||
|
|
||||||
import com.badlogic.gdx.Input;
|
|
||||||
|
|
||||||
public class MapzenTest extends GdxMap {
|
public class MapzenTest extends GdxMap {
|
||||||
|
|
||||||
final Logger log = LoggerFactory.getLogger(MapzenTest.class);
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected boolean onKeyDown(int keycode) {
|
protected boolean onKeyDown(int keycode) {
|
||||||
if (keycode == Input.Keys.A) {
|
if (keycode == Input.Keys.A) {
|
||||||
loadTheme();
|
loadTheme();
|
||||||
}
|
}
|
||||||
if (keycode == Input.Keys.NUM_1) {
|
|
||||||
mMap.setMapPosition(53, 8, 10);
|
|
||||||
}
|
|
||||||
if (keycode == Input.Keys.NUM_2) {
|
|
||||||
mMap.setMapPosition(53.1, 8.8, 12);
|
|
||||||
}
|
|
||||||
|
|
||||||
return super.onKeyDown(keycode);
|
return super.onKeyDown(keycode);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void createLayers() {
|
public void createLayers() {
|
||||||
|
|
||||||
UrlTileSource tileSource = OSciMap4TileSource.builder()
|
UrlTileSource tileSource = OSciMap4TileSource.builder()
|
||||||
//.url("http://vector.dev.mapzen.com/osm/all")
|
.url("https://vector.mapzen.com/osm/v0.8/all")
|
||||||
.url("http://vector.mapzen.com/osm/all")
|
.apiKey("vector-tiles-xxxxxxx") // Put a proper API key
|
||||||
.zoomMax(18)
|
.zoomMax(18)
|
||||||
.httpFactory(new OkHttpEngine.OkHttpFactory())
|
.httpFactory(new OkHttpEngine.OkHttpFactory())
|
||||||
.build();
|
.build();
|
||||||
@ -59,17 +61,14 @@ public class MapzenTest extends GdxMap {
|
|||||||
|
|
||||||
private void loadTheme() {
|
private void loadTheme() {
|
||||||
try {
|
try {
|
||||||
mMap.setTheme(ThemeLoader.load("assets/styles/mapzen.xml"));
|
mMap.setTheme(ThemeLoader.load(getClass().getResourceAsStream("/assets/styles/mapzen.xml")));
|
||||||
} catch (ThemeException e) {
|
} catch (ThemeException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
} catch (FileNotFoundException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
GdxMapApp.init();
|
GdxMapApp.init();
|
||||||
CanvasAdapter.dpi = 200;
|
GdxMapApp.run(new MapzenTest(), null, 400);
|
||||||
GdxMapApp.run(new MapzenTest(), null, 512);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|