Mapzen vector tiles: fix example, provide vtm-stylesheet, #50

This commit is contained in:
Emux 2016-07-06 17:15:42 +03:00
parent 7a88524343
commit 51f3e2368b
17 changed files with 1199 additions and 23 deletions

View File

@ -5,12 +5,13 @@ dependencies {
compile project(':vtm-desktop')
compile project(':vtm-extras')
compile project(':vtm-jeo')
runtime 'com.squareup.okhttp:okhttp:1.5.2'
}
sourceSets {
main {
java.srcDirs = ['src']
resources.srcDirs = ["${buildDir}/assets"]
resources.srcDirs = ['resources']
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 675 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 692 B

File diff suppressed because it is too large Load Diff

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 32 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 44 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 118 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 73 KiB

View File

@ -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;
import java.io.FileNotFoundException;
import com.badlogic.gdx.Input;
import org.oscim.backend.CanvasAdapter;
import org.oscim.gdx.GdxMap;
import org.oscim.gdx.GdxMapApp;
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.UrlTileSource;
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 {
final Logger log = LoggerFactory.getLogger(MapzenTest.class);
@Override
protected boolean onKeyDown(int keycode) {
if (keycode == Input.Keys.A) {
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);
}
@Override
public void createLayers() {
UrlTileSource tileSource = OSciMap4TileSource.builder()
//.url("http://vector.dev.mapzen.com/osm/all")
.url("http://vector.mapzen.com/osm/all")
.url("https://vector.mapzen.com/osm/v0.8/all")
.apiKey("vector-tiles-xxxxxxx") // Put a proper API key
.zoomMax(18)
.httpFactory(new OkHttpEngine.OkHttpFactory())
.build();
@ -59,17 +61,14 @@ public class MapzenTest extends GdxMap {
private void loadTheme() {
try {
mMap.setTheme(ThemeLoader.load("assets/styles/mapzen.xml"));
mMap.setTheme(ThemeLoader.load(getClass().getResourceAsStream("/assets/styles/mapzen.xml")));
} catch (ThemeException e) {
e.printStackTrace();
} catch (FileNotFoundException e) {
e.printStackTrace();
}
}
public static void main(String[] args) {
GdxMapApp.init();
CanvasAdapter.dpi = 200;
GdxMapApp.run(new MapzenTest(), null, 512);
GdxMapApp.run(new MapzenTest(), null, 400);
}
}