vtm-mvt module with new MVT tile decoder (#481)
This commit is contained in:
@@ -87,6 +87,9 @@
|
||||
<activity
|
||||
android:name=".OpenMapTilesGeojsonMapActivity"
|
||||
android:configChanges="keyboardHidden|orientation|screenSize" />
|
||||
<activity
|
||||
android:name=".OpenMapTilesMvtMapActivity"
|
||||
android:configChanges="keyboardHidden|orientation|screenSize" />
|
||||
<activity
|
||||
android:name=".OSciMapS3DBMapActivity"
|
||||
android:configChanges="keyboardHidden|orientation|screenSize" />
|
||||
|
||||
@@ -10,6 +10,7 @@ dependencies {
|
||||
implementation project(':vtm-jeo')
|
||||
implementation project(':vtm-json')
|
||||
implementation project(':vtm-jts')
|
||||
implementation project(':vtm-mvt')
|
||||
implementation project(':vtm-themes')
|
||||
implementation "org.slf4j:slf4j-android:$slf4jVersion"
|
||||
|
||||
@@ -35,7 +36,9 @@ android {
|
||||
defaultConfig {
|
||||
versionCode versionCode()
|
||||
versionName versionName()
|
||||
minSdkVersion androidMinSdk()
|
||||
// FIXME Minimum API Level by mapbox-vector-tile
|
||||
//minSdkVersion androidMinSdk()
|
||||
minSdkVersion 26
|
||||
targetSdkVersion androidTargetSdk()
|
||||
}
|
||||
|
||||
@@ -64,6 +67,14 @@ android {
|
||||
exclude 'META-INF/LICENSE'
|
||||
exclude 'META-INF/NOTICE'
|
||||
}
|
||||
|
||||
buildTypes {
|
||||
all {
|
||||
minifyEnabled true
|
||||
useProguard false
|
||||
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
task run(dependsOn: 'installDebug') {
|
||||
|
||||
10
vtm-android-example/proguard-rules.pro
vendored
Normal file
10
vtm-android-example/proguard-rules.pro
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
-keep class com.** { *; }
|
||||
-dontwarn com.**
|
||||
-keep class jsqlite.** { *; }
|
||||
-dontwarn jsqlite.**
|
||||
-keep class okhttp3.** { *; }
|
||||
-dontwarn okhttp3.**
|
||||
-keep class okio.** { *; }
|
||||
-dontwarn okio.**
|
||||
-keep class org.** { *; }
|
||||
-dontwarn org.**
|
||||
@@ -0,0 +1,68 @@
|
||||
/*
|
||||
* Copyright 2016-2017 devemux86
|
||||
*
|
||||
* 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.android.test;
|
||||
|
||||
import android.os.Bundle;
|
||||
|
||||
import org.oscim.android.cache.TileCache;
|
||||
import org.oscim.layers.TileGridLayer;
|
||||
import org.oscim.layers.tile.buildings.BuildingLayer;
|
||||
import org.oscim.layers.tile.vector.VectorTileLayer;
|
||||
import org.oscim.layers.tile.vector.labeling.LabelLayer;
|
||||
import org.oscim.theme.VtmThemes;
|
||||
import org.oscim.tiling.source.OkHttpEngine;
|
||||
import org.oscim.tiling.source.UrlTileSource;
|
||||
import org.oscim.tiling.source.mvt.OpenMapTilesMvtTileSource;
|
||||
|
||||
public class OpenMapTilesMvtMapActivity extends MapActivity {
|
||||
|
||||
private static final boolean USE_CACHE = false;
|
||||
|
||||
private TileCache mCache;
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
UrlTileSource tileSource = OpenMapTilesMvtTileSource.builder()
|
||||
.apiKey("xxxxxxx") // Put a proper API key
|
||||
.httpFactory(new OkHttpEngine.OkHttpFactory())
|
||||
//.locale("en")
|
||||
.build();
|
||||
|
||||
if (USE_CACHE) {
|
||||
// Cache the tiles into a local SQLite database
|
||||
mCache = new TileCache(this, null, "tile.db");
|
||||
mCache.setCacheSize(512 * (1 << 10));
|
||||
tileSource.setCache(mCache);
|
||||
}
|
||||
|
||||
VectorTileLayer l = mMap.setBaseMap(tileSource);
|
||||
mMap.setTheme(VtmThemes.OPENMAPTILES);
|
||||
|
||||
mMap.layers().add(new BuildingLayer(mMap, l));
|
||||
mMap.layers().add(new LabelLayer(mMap, l));
|
||||
|
||||
mMap.layers().add(new TileGridLayer(mMap, getResources().getDisplayMetrics().density));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
super.onDestroy();
|
||||
|
||||
if (mCache != null)
|
||||
mCache.dispose();
|
||||
}
|
||||
}
|
||||
@@ -83,6 +83,7 @@ public class Samples extends Activity {
|
||||
linearLayout.addView(createButton(MapsforgeMapActivity.class));
|
||||
/*linearLayout.addView(createButton(MapzenMvtMapActivity.class));
|
||||
linearLayout.addView(createButton(MapzenGeojsonMapActivity.class));*/
|
||||
linearLayout.addView(createButton(OpenMapTilesMvtMapActivity.class));
|
||||
linearLayout.addView(createButton(OpenMapTilesGeojsonMapActivity.class));
|
||||
linearLayout.addView(createButton(GdxMapActivity.class));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user