104 Commits

Author SHA1 Message Date
Emux
f5f77157c9 0.17.0 2022-01-03 16:59:14 +02:00
Emux
8e0d467ceb AwtCanvas fill color with alpha (#891) 2021-12-29 15:56:31 +02:00
Emux
044c8ce74f Update Changelog.md 2021-12-21 12:33:24 +02:00
Emux
87dc04251d Update Android Gradle plugin 2021-12-09 15:44:32 +02:00
Emux
0a2f47ee57 Update Android Gradle plugin 2021-12-01 16:58:14 +02:00
Emux
172664c55b Add parking motorcycle symbol (#889) 2021-11-17 14:06:34 +02:00
Emux
cd90e95a4a XmlThemeBuilder: support Mapsforge hillshading no-op rule (#887) 2021-11-13 16:17:59 +02:00
Emux
b3f18a92d2 Update Applications.md 2021-11-04 11:17:12 +02:00
Pg
774ceced8b Update applications list (#886) 2021-11-04 11:02:52 +02:00
Emux
2ea8e006a3 Update Android samples 2021-10-21 13:07:43 +03:00
Emux
f04b8d36f8 Update Android samples 2021-10-20 17:31:37 +03:00
Emux
37363b31da Update android.yml 2021-10-16 15:29:15 +03:00
Emux
44a1756229 Gradle 7 (#885) 2021-10-15 16:23:51 +03:00
Emux
a184e25348 Remove old Android ABIs (#884) 2021-10-13 17:51:00 +03:00
Emux
6f64e97faf Update Integration.md 2021-10-12 19:53:46 +03:00
Emux
30ad6f1cef Update android.yml 2021-10-12 19:44:25 +03:00
Emux
bd965750a9 Samples: fix warnings (#883) 2021-10-12 19:35:17 +03:00
Emux
f076544993 Fix compile warnings (#881) 2021-10-10 17:42:35 +03:00
Emux
bb03b40075 Update android.yml 2021-10-07 20:17:29 +03:00
Emux
634a2e5c0d Update Android (#879) 2021-10-07 17:57:11 +03:00
Emux
c3203b3cb4 Add charging station symbol (#878) 2021-09-30 15:14:13 +03:00
Emux
a82275315c OkHttpEngine: close catching Exception #369 (#873) 2021-09-08 14:04:35 +03:00
Emux
12a58e5827 Update changelog 2021-08-16 15:29:05 +03:00
Frank Knoll
9895921a5c Draggable marker sample (#869) 2021-08-16 15:23:29 +03:00
Emux
ba8b800ee0 Update Gradle properties 2021-07-29 15:47:59 +03:00
Emux
8be9211ed6 Update Android Gradle plugin 2021-07-28 14:29:00 +03:00
Emux
b8983007d2 Drawable style point reduction / texture repeat options (#862) 2021-07-25 13:59:01 +03:00
Emux
bd24ba12d5 AbstractVectorLayer minor optimization (#859) 2021-07-16 13:50:03 +03:00
Emux
5de7070f15 Move cluster experiment in samples (#858) 2021-06-24 15:07:36 +03:00
Emux
e2c901d1e5 Update documentation 2021-06-23 19:01:44 +03:00
Emux
156fda15cd Create android.yml 2021-06-23 18:39:44 +03:00
Emux
425e5dac61 Uninstall Travis 2021-06-23 17:28:27 +03:00
Emux
8f15859f9b travis-ci.com 2021-06-17 14:33:10 +03:00
Emux
6d29d11499 Render themes: add place=neighbourhood (#852) 2021-06-17 13:51:01 +03:00
Emux
6da37d481d Render themes: add place=hamlet (#851) 2021-06-13 15:53:02 +03:00
Thomas Theussing
62015eee0b MarkerLayerLabelsTest: switch to bitmap tile source (#849) 2021-05-29 17:45:44 +03:00
Emux
e62e27cf22 0.16.0 2021-05-27 18:47:05 +03:00
Emux
76bf76a090 Update Applications.md 2021-05-27 15:46:06 +03:00
Emux
e906305910 Update changelog 2021-05-17 16:49:50 +03:00
Александр
08b94a0c42 Distant labels rendering (#844) 2021-05-17 16:46:36 +03:00
Emux
c508bde844 TileSource.OpenResult: allow null error messages (#837) 2021-05-12 14:45:20 +03:00
Emux
d4b7e34d17 Update Gradle (#835) 2021-05-05 14:28:17 +03:00
Emux
d5543bd7ef Map scale bar improvements (#828) 2021-04-13 13:52:28 +03:00
Emux
354bc16ead InputHandler: keyboard improvements (#827) 2021-04-13 12:36:54 +03:00
Emux
8889235690 Update Android Gradle plugin (#826) 2021-04-07 14:48:04 +03:00
Emux
9b43d7f498 JCenter deprecation (#825) 2021-04-07 14:02:12 +03:00
Emux
ef2d2dd197 ContentResolverResourceProvider: honor also absolute file references in theme resources (#823) 2021-03-31 15:04:26 +03:00
Emux
1245158ba3 SVG Salamander (#819) 2021-03-27 19:47:24 +02:00
Emux
ef5f7acbdf JCenter (#818) 2021-03-27 19:37:53 +02:00
Emux
e1c24ee8cf InputHandler: keyboard improvements (#817) 2021-03-24 18:10:28 +02:00
Emux
9f5ddd2381 Update docs 2021-03-17 13:09:01 +02:00
Emux
1fbc501bef Update docs 2021-03-16 19:41:43 +02:00
Emux
d7c69e12d6 Maven central (#813) 2021-03-16 18:34:31 +02:00
Emux
1fa86b5e07 GitHub Discussions 2021-03-16 17:26:09 +02:00
Emux
efed81bdeb Update ISSUE_TEMPLATE.md 2021-03-15 10:29:21 +02:00
Emux
a308eb48ac Update OkHttp (#811) 2021-03-14 15:58:53 +02:00
Emux
5926dd3e65 Render themes: add river labels (#810) 2021-03-04 15:37:39 +02:00
Emux
a11e620792 Render themes: improve lake labels (#809) 2021-03-04 14:41:33 +02:00
Emux
6850eff26c ContentResolverResourceProvider should handle document Uris correctly (#808) 2021-03-01 11:09:43 +02:00
Emux
ddf94ae2ca ZipXmlThemeResourceProvider: add method to just scan zip for xml themes (#807) 2021-02-22 14:06:03 +02:00
Emux
22ed9653ec AndroidBitmap: convert unsupported bitmap formats (#805) 2021-01-29 16:51:31 +02:00
Emux
3bb8ce00c5 Render themes: Android scoped storage, zip render theme, custom resource providers (#804) 2021-01-21 15:01:19 +02:00
Emux
b9cbd97c40 Nautical unit adapter with feet (#803) 2021-01-12 18:12:16 +02:00
Emux
6801b895e4 Mapsforge themes compatibility improvements #100 (#802) 2021-01-11 17:30:44 +02:00
Emux
c0d5f4a0ca 0.15.0 2021-01-01 18:59:48 +02:00
Emux
2859a18d72 Deploy improvements 2021-01-01 18:44:53 +02:00
Emux
869446ad13 JobQueue.clear: change log level 2020-12-31 14:06:54 +02:00
Emux
b2fd22885e Samples: reorder theme dispose 2020-12-28 14:12:01 +02:00
Meibes
7d6c623a80 Samples MapFragment: use theme dispose function (#800) 2020-12-28 13:43:56 +02:00
Emux
6bea801bf6 Samples: use theme dispose function 2020-12-28 12:12:14 +02:00
Emux
d446a3448b Samples: add theme.dispose 2020-12-28 11:56:32 +02:00
Emux
d006ba5361 VectorTileLayer: code improvements 2020-12-25 14:53:19 +02:00
Meibes
0eb4f3752f OSMUtils.isArea: reorder 'if' based on OSM stats (#799) 2020-12-24 10:33:12 +02:00
Emux
789c280fc2 OSMUtils.isArea improvements #798 2020-12-23 17:16:08 +02:00
Meibes
a881eec9b1 OSMUtils.isArea improvements (#798) 2020-12-23 13:31:41 +02:00
Meibes
1bc1d88464 Android Samples: add Fragment example (#796) 2020-12-22 11:40:34 +02:00
Emux
1c18221f05 ReadBuffer: fix docs 2020-12-13 13:26:21 +02:00
Emux
f4162acf04 Update Android build tools 2020-12-10 12:06:10 +02:00
Emux
1138978c22 Use --release=7 for compiling the non-android libraries on Java >= 9 (#795) 2020-12-03 13:30:31 +02:00
Emux
bd43baba20 TileLayer: move tileSource in parent class (#794) 2020-11-30 17:47:14 +02:00
Meibes
2e6da74af8 Color: fix parseColor javadoc (#793) 2020-11-28 12:20:09 +02:00
Meibes
f6561d2a2e OsmTileLayer: add constructor (#792) 2020-11-28 12:18:16 +02:00
Emux
45a42bb242 Samples improvements #785 2020-11-24 14:13:56 +02:00
Emux
3043173814 Symbol scale option (#790) 2020-11-15 17:20:52 +02:00
Emux
cde5d898c7 Update Integration.md 2020-11-11 10:57:48 +02:00
Emux
58f6215c0f Samples improvements #785 2020-10-21 17:57:49 +03:00
Emux
d7d6fa57ac Parameters: increase maximum buffer size for map files (Japan) (#789) 2020-10-19 13:39:22 +03:00
Emux
57bf615ab7 Update Gradle (#788) 2020-10-13 14:11:45 +03:00
Emux
9bf3161010 Update Android Gradle plugin 2020-10-08 15:18:35 +03:00
Emux
98a977ea72 Merge pull request #786 from mapsforge/xml
Render theme xml pull parser
2020-09-25 16:58:44 +03:00
Emux
661bc08bbf Render theme xml pull parser, fix #431 2020-09-25 16:57:52 +03:00
Emux
804c8c4603 Merge pull request #785 from mapsforge/storage
Android: scoped storage example
2020-09-24 14:18:41 +03:00
Emux
e103c38e3e Android: scoped storage example 2020-09-24 14:18:20 +03:00
Emux
e3b4ff502e Merge pull request #784 from mapsforge/mapsforge
Mapsforge: map stream support
2020-09-24 14:02:48 +03:00
Emux
6116ebb348 Mapsforge: map stream support 2020-09-24 14:00:49 +03:00
Emux
5c3a728d05 Merge pull request #783 from mapsforge/content
Render theme from Android content providers
2020-09-24 13:54:14 +03:00
Emux
2070145880 Render theme from Android content providers 2020-09-24 13:52:13 +03:00
Emux
e9a670f274 Update Android samples 2020-09-17 10:46:17 +03:00
Emux
e5c87ba06e Merge pull request #782 from mapsforge/android
Update Android
2020-09-09 17:57:22 +03:00
Emux
fa992b93f5 Update Android 2020-09-09 17:47:42 +03:00
Emux
bf67074cf3 Merge pull request #781 from mapsforge/cache
Android samples: use OkHttp cache
2020-09-02 17:09:48 +03:00
Emux
074320d6d2 Android samples: use OkHttp cache 2020-09-02 17:08:39 +03:00
Emux
6616c22a32 Update changelog 2020-08-30 20:24:41 +03:00
Izumi Kawashima
1ddba0fe8f Use org.gretty instead of org.akhikhl.gretty maven repository (#780) 2020-08-30 18:09:28 +03:00
177 changed files with 5117 additions and 1482 deletions

32
.github/workflows/android.yml vendored Normal file
View File

@@ -0,0 +1,32 @@
name: Android CI
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: set up JDK 11
uses: actions/setup-java@v2
with:
java-version: '11'
distribution: 'adopt'
cache: gradle
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Build with Gradle
run: ./gradlew build
- name: Publish
if: github.event_name != 'pull_request'
env:
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
run: ./gradlew -PSONATYPE_USERNAME="$SONATYPE_USERNAME" -PSONATYPE_PASSWORD="$SONATYPE_PASSWORD" publish

View File

@@ -1,32 +0,0 @@
sudo: false
language: android
jdk:
- openjdk8
env:
global:
- ANDROID=29
- ANDROID_BUILD_TOOLS=29.0.3
- GRADLE_OPTS="-Xmx2048m"
- secure: sW674wuFZOuoX7jHQHDbX3j8NxL8JxR07cyq+CrrqJ537dU9lxWQmMBRUpOb+p/q7sQ74PUtiKJkmFgKCSJSAKY+nr6GJ8P/q6u5TUKbmUWODSn8znehX2zualfvFwpF4PILok/wUzXBQE62jn4lUua7cMdsHRMNHbLmKqBoVL0meObDDjsaJ/RCbOPuruy3FmgvXPp0+Y4zl1GsklDSyjFzg4LBzjAk9Ryvh1O4zvJBkkyfCgurLKCnOKIPy3v5fPMS9oDfO1aarAVGoZZe416pvTW4hb8cdB6kn9XWYDob4NDFX/sP5k7XIhd/NAIn9LrKFg0sLtATaKLX+BcasF1CgDR/u6+SEeQd5QaRF7Go2Nq5Ltuu4OIFONI2qhEeVDDK6Otf2WSWj9KPno2GHuumBfbg4ypWoJgmZrMXk8JeVV/OP/0jIQz3p/7yfF21X1XBEqYaVHPAMKdEYYkCSa46KfACyOt6LfnkuCHtoTOpFo7sq0omIA2HOtpIx1u3vMBUyAbQqT6cokkKB1b6gNTFwhHc+8ybfLFPljJB8cWshI+V/b06S6fekRmvTNxvDykWNsdlkENBYqc9hMfjcT4hO4K+76SWN62mimQYODvFyfTVMC7WkQ3k/XEnmqUPV5XkbaILbS1d/tA57N148FiJ5/QXtI6Y94imubYyVqU=
- secure: AdKSZKA4gMuKXI4X4dQNJqcMv5OmPIHdN8fpy55Y9yoOQPQHZE3Zwc4QDWBh20q298jyEC854tVTPTysdZ7h+2s2FhsprYv1Bt/QNzKIrLpeIMj2quuVGMbdPuk08y55gost94KwVLJv0sIDpRlB/PEQkA7Mg/UDsT9zR8E1Ms5x+ul2C8e1ag0zzNl1wVnT5jY8WCp74uA/XXCcJl/80qT1stUERazCKwbKNo007hi7rdm4HA7YGevORq8e2r67je+WIBZUAwrHT0Zjuo4ibwUii4LdwvjuN3w0Z6e9Wf4x5bBqGgnih0T31uom2yPjNx+U/c2AWI+Nxfy/SEF2U+9bjBEZ3ZhI7F1B9ofXo2mhvvsVDiUrymMBbG2V64C9kAzeUh7xIBTqIrbdtpAEBV9FlLAtF2swVTwtCgZgcVTOt3RKXCi3X3nk3cuH7PAorFa/QGfT4xxVu2011FVAt2Rm7SD0ZWztZTSTz/4Nt/egtGBOJfrCc7oLEygLzDmLqsqCwCROITVQjWLjrtqDyLteaNiSXeNIQMKun3izApbXnHmXB+FV3R3EZocboqk3v5bmPTahnG6Ghc2zknWyyxSx+O9qIfOpHUL8JMJiT82lUQUeibtCn7DCE8wVQ/gYC5i+a+KO/d3NemSzIFlZ8aoUiEPYq18dYlsDXeLXwF0=
android:
components:
- tools
- platform-tools
- tools
- build-tools-$ANDROID_BUILD_TOOLS
- android-$ANDROID
before_install:
- yes | sdkmanager "platforms;android-$ANDROID"
script:
- ./gradlew clean build
after_success:
- if [ "$TRAVIS_BRANCH" == "master" ] && [ "$TRAVIS_PULL_REQUEST" == "false" ]; then
./gradlew uploadArchives -PSONATYPE_USERNAME="${SONATYPE_USERNAME}" -PSONATYPE_PASSWORD="${SONATYPE_PASSWORD}";
fi
notifications:
email:
recipients:
- secure: fOInp4SGBqiIMgnsGceQTa0SuFLaAoxAF15W0crhuljGlqSgnbnBjh0xFEF4P5+q3VT3DgDZs53GVVo6S9gEl8AWJy84KGuUX1M/CQKUQC4bwNXJdHfY3MIy6D50da6UfwWeNS4ienKh2Rj6w2TapN9M8C9nJJZk9aJFc9NWZmWTVboHZd4oUDeeRBJ6KSk1Ay7L/mmxv4cMCXaW7pPJixvUFESKNYgK4KAN3zYpym2UijrQ8zf7OVcYnTorcAuXUZDk8EvwdHl3rIAdlbVqvyZ8rmoQ2Da/Q2VlWUL/HrHUVJtCPZ+T+dNUag4a8joIDqWKwcyk76PElmgft3azb7GERb+bkZz1ToQc2IvuOeUk2SsuXWZugoEQImKWl/yWeirWBLrwzieaVh4j04dMSn/Npc1yL5kjX9EuiM6MFHdYPianMpvhFiaYKihjzW0GPV6sfuY7xS8cA9L9DjAsXoHIXIxc/+hRA+bpPUl+qMaQdGjJmNJJ2VPFnOY0XCsDDQDIVa3nZOA6aXMUG2c4H26RJZPe7uvfRiuL86n3KAmkoXSwne9t8WYMgl89LMsU5XxjBvwz2Qa1HqG09tVs6nhB23easrhEYEf/ZsGg0DIIL1FImUHj+wUUfZXeyFmbiE6lD/i2+3a5DqzZGHbXUDCoUIagObMf8fe2z5+0K/Q=
on_success: always
on_failure: always

View File

@@ -1,5 +1,4 @@
[![Maven Central](https://img.shields.io/maven-central/v/org.mapsforge/vtm.svg)](https://search.maven.org/search?q=g:org.mapsforge)
[![Build Status](https://travis-ci.org/mapsforge/vtm.svg?branch=master)](https://travis-ci.org/mapsforge/vtm)
[![License: LGPL v3](https://img.shields.io/badge/License-LGPL%20v3-blue.svg)](http://www.gnu.org/licenses/lgpl-3.0)
# V™
@@ -12,7 +11,7 @@ VTM (Vector Tile Map) was developed within the [OpenScienceMap](https://github.c
See the **[integration guide](docs/Integration.md)** and [changelog](docs/Changelog.md). And read through [how to contribute](docs/CONTRIBUTING.md) guidelines.
If you have any questions or problems, don't hesitate to ask our public [forum](https://groups.google.com/group/mapsforge-dev) for help.
If you have any questions or problems, don't hesitate to ask the Discussions for help.
## Features
- Java map library

View File

@@ -1,20 +1,17 @@
buildscript {
repositories {
google()
jcenter()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:4.0.1'
classpath 'com.github.dcendents:android-maven-gradle-plugin:2.1'
classpath 'com.android.tools.build:gradle:7.0.4'
}
}
allprojects {
group = 'org.mapsforge'
version = 'master-SNAPSHOT'
ext.isReleaseVersion = !version.endsWith("SNAPSHOT")
ext.androidBuildVersionTools = "29.0.3"
ext.gdxVersion = "1.9.10"
ext.gwtVersion = "2.8.2"
ext.slf4jVersion = "1.7.28"
@@ -28,12 +25,12 @@ allprojects {
}
}
static def androidCompileSdk() { return 29 }
static def androidCompileSdk() { return 31 }
// 14 for Support Library, 16 for sqlite-android
static def androidMinSdk() { return 16 }
static def androidMinSdk() { return 21 }
static def androidTargetSdk() { return 29 }
static def androidTargetSdk() { return 31 }
static def versionCode() { return 1 }
@@ -42,13 +39,19 @@ def versionName() { return version }
subprojects {
repositories {
google()
jcenter()
mavenCentral()
maven { url 'https://jitpack.io' }
maven { url "https://plugins.gradle.org/m2/" }
}
tasks.withType(JavaCompile) {
sourceCompatibility = JavaVersion.VERSION_1_7
targetCompatibility = JavaVersion.VERSION_1_7
options.encoding = 'UTF-8'
if (JavaVersion.current().isJava9Compatible()) {
if (!project.properties.containsKey('android')) {
options.compilerArgs.addAll(['--release', '7'])
}
}
}
}

View File

@@ -1,83 +1,63 @@
apply plugin: 'signing'
if (project.hasProperty("android")) {
task sourcesJar(type: Jar) {
classifier = 'sources'
from android.sourceSets.main.java.srcDirs
}
task javadoc(type: Javadoc) {
source = android.sourceSets.main.java.srcDirs
classpath += project.files(android.getBootClasspath().join(File.pathSeparator))
}
} else {
task sourcesJar(type: Jar) {
classifier = 'sources'
from sourceSets.main.allSource
}
java {
withJavadocJar()
withSourcesJar()
}
task javadocJar(type: Jar, dependsOn: javadoc) {
classifier = 'javadoc'
from javadoc.destinationDir
}
artifacts {
archives javadocJar
archives sourcesJar
}
signing {
required { isReleaseVersion && gradle.taskGraph.hasTask("uploadArchives") }
sign configurations.archives
}
uploadArchives {
repositories {
mavenDeployer {
beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) }
repository(url: "https://oss.sonatype.org/service/local/staging/deploy/maven2/") {
authentication(userName: SONATYPE_USERNAME, password: SONATYPE_PASSWORD)
}
snapshotRepository(url: "https://oss.sonatype.org/content/repositories/snapshots/") {
authentication(userName: SONATYPE_USERNAME, password: SONATYPE_PASSWORD)
}
pom.project {
packaging 'jar'
name 'vtm'
description 'OpenGL vector map library written in Java - running on Android, iOS, Desktop and within the browser.'
url 'https://github.com/mapsforge/vtm'
publishing {
publications {
maven(MavenPublication) {
pom {
name = 'VTM'
description = 'OpenGL vector map library - running on Android, iOS, Desktop and browser.'
url = 'https://github.com/mapsforge/vtm'
licenses {
license {
name 'GNU Lesser GPL'
url 'http://www.gnu.org/licenses/lgpl.html'
distribution 'repo'
name = 'GNU Lesser GPL'
url = 'https://www.gnu.org/licenses/lgpl.html'
}
}
scm {
connection 'scm:git:https://github.com/mapsforge/vtm'
developerConnection 'scm:git:https://github.com/mapsforge/vtm'
url 'https://github.com/mapsforge/vtm'
}
developers {
developer {
id 'hannes.janetzek'
name 'Hannes Janetzek'
email 'hannes.janetzek@gmail.com'
id = 'hannes.janetzek'
name = 'Hannes Janetzek'
email = 'hannes.janetzek@gmail.com'
}
developer {
id 'devemux86'
name 'Emux'
email 'devemux86@gmail.com'
id = 'devemux86'
name = 'Emux'
email = 'devemux86@gmail.com'
}
}
scm {
connection = 'scm:git:https://github.com/mapsforge/vtm'
developerConnection = 'scm:git:https://github.com/mapsforge/vtm'
url = 'https://github.com/mapsforge/vtm'
}
}
}
}
repositories {
maven {
def releasesRepoUrl = 'https://oss.sonatype.org/service/local/staging/deploy/maven2/'
def snapshotsRepoUrl = 'https://oss.sonatype.org/content/repositories/snapshots/'
url = version.endsWith('SNAPSHOT') ? snapshotsRepoUrl : releasesRepoUrl
credentials {
username = SONATYPE_USERNAME
password = SONATYPE_PASSWORD
}
}
}
}
signing {
required { !version.endsWith('SNAPSHOT') }
sign publishing.publications.maven
}
javadoc {
if (JavaVersion.current().isJava9Compatible()) {
options.addBooleanOption('html5', true)
}
}

View File

@@ -4,22 +4,20 @@
|--------|--------|----------------|-------------|-----------|
| [AdvRider WD](https://play.google.com/store/apps/details?id=com.abware.watchdog_client) | Tool-set for the adventure rider | Proprietary/Free | Android | Closed |
| [Cachebox 3.0](https://github.com/Longri/cachebox3.0) | Geocaching application | Apache 2.0/Free | Android, Desktop, iOS | Open |
| [Cruiser](http://wiki.openstreetmap.org/wiki/Cruiser) | Map and navigation application | Proprietary/Free | Android, Desktop | Closed |
| [Cruiser](https://wiki.openstreetmap.org/wiki/Cruiser) | Map and navigation platform | Proprietary/Free | Android, Desktop | Closed |
| [GCDroid](https://play.google.com/store/apps/details?id=com.gcdroid) | Geocaching App | Proprietary/Free and Commercial | Android | Closed |
| [GPSLogger II](https://play.google.com/store/apps/details?id=com.emacberry.gpslogger) | Map and navigation, Fitness & Cycling application | Proprietary/Free | Android | Closed |
| [HabanaTrans](https://play.google.com/store/apps/details?id=cu.pabloapk.habanatrans&hl=es_419) | Public transport, map offline, gps, routing | Proprietary/Free | Android | Closed |
| [Hunt Cyprus](https://play.google.com/store/apps/developer?id=Talent+S.A.) | Map and navigation application for hunters | Proprietary/Free and Commercial | Android | Closed |
| [Kurviger](https://kurviger.de/en) | Route planner specialized on motorcyclists | Proprietary/Free and Commercial | Android | Closed |
| [MapTrek](http://maptrek.mobi) | Application for outdoor activities | GPL3/Free and Commercial | Android | Open |
| [Kurviger](https://play.google.com/store/apps/details?id=gr.talent.kurviger) | Route planner specialized on motorcyclists | Proprietary/Free (in-app purchases) | Android | Closed |
| [MyRunningApp](https://play.google.com/store/apps/details?id=it.nimarsolutions.rungpstracker) | Fitness app | Proprietary/Free | Android | Closed |
| [MyTourbook](http://mytourbook.sourceforge.net/mytourbook/) | Visualize and analyze tours | GPL2/Free | Desktop | Open |
| [Navi Cyprus](https://play.google.com/store/apps/developer?id=Talent+S.A.) | Map and navigation application | Proprietary/Free and Commercial | Android | Closed |
| [Pocket Maps](https://github.com/junjunguo/PocketMaps) | Offline maps, routing & tracking functions | MIT/Free | Android | Open |
| Tokyo Ogiqvo | Visualize App | Commercial | [Android](https://play.google.com/store/apps/details?id=com.ogiqvo.view.tokyo&hl=ja), [iOS](https://itunes.apple.com/us/app/tokyo-ogiqvo/id1097100677?mt=8) | Closed |
| [topoGuide](http://www.topoguide.gr/index-en.php) | Digital guides for the outdoor | Proprietary/Free and Commercial | Android | Closed |
| [Trekarta](https://github.com/andreynovikov/trekarta) | Application for outdoor activities | GPL3/Free and Commercial | Android | Open |
| [Ubitrek](https://play.google.com/store/apps/details?id=ubicarta.ubitrek) | Hiking with IGN maps | Proprietary/Free | Android | Closed |
| [VTM with Eclipse RCP](https://github.com/wolfgang-ch/vtm-with-rcp) | VTM with an Eclipse RCP application | GPL3/Free | Desktop | Open |
| [Walkaholic](https://play.google.com/store/apps/details?id=com.walkaholic.hikeapp) | Hiking app with official routes and online/offline maps | Proprietary/Free (in-app purchases) | Android | Closed |
| [XCTrack](http://xctrack.org/) | Flight computer for paraglider pilots | Proprietary/Free | Android | Closed |
You know an application that is missing here? Please inform us by sending a message via our public [forum](https://groups.google.com/group/mapsforge-dev).

View File

@@ -2,7 +2,7 @@
As an open source project, we welcome new contributors and appreciate your help.
Before you start working on an unresolved issue or try to implement a new feature, please contact us via our public [forum](https://groups.google.com/group/mapsforge-dev). We will then discuss the best way to realize your proposal and figure out how we can help you to get started quickly.
Before you start working on an unresolved issue or try to implement a new feature, please contact us via the Discussions. We will then discuss the best way to realize your proposal and figure out how we can help you to get started quickly.
If you are only requesting a small change in the code, you may attach a patch file to the corresponding issue, but it is best to create a pull request on Github. Make sure that your patch is derived from the latest version in our **master** repository, otherwise we might be unable to apply it. Important is to keep pull requests simple with one feature in each. Please follow our code and style conventions.

View File

@@ -1,5 +1,41 @@
# Changelog
## New since 0.17.0
- Minor improvements and bug fixes
- [Solved issues](https://github.com/mapsforge/vtm/issues?q=is%3Aclosed+milestone%3A0.18.0)
## Version 0.17.0 (2022-01-03)
- Drawable style point reduction option [#862](https://github.com/mapsforge/vtm/pull/862)
- Drawable style texture repeat option [#862](https://github.com/mapsforge/vtm/pull/862)
- Draggable marker Android sample [#869](https://github.com/mapsforge/vtm/pull/869)
- Move cluster experiment in samples [#858](https://github.com/mapsforge/vtm/pull/858)
- Minor improvements and bug fixes
- [Solved issues](https://github.com/mapsforge/vtm/issues?q=is%3Aclosed+milestone%3A0.17.0)
## Version 0.16.0 (2021-05-27)
- Android: scoped storage map / theme example [#804](https://github.com/mapsforge/vtm/pull/804)
- Render theme from zip archive [#804](https://github.com/mapsforge/vtm/pull/804)
- Render themes: custom resource providers [#804](https://github.com/mapsforge/vtm/pull/804)
- Nautical unit adapter with feet [#803](https://github.com/mapsforge/vtm/pull/803)
- Distant labels rendering option [#844](https://github.com/mapsforge/vtm/pull/844)
- `Parameters.DISTANT_LABELS`
- Minor improvements and bug fixes
- [Solved issues](https://github.com/mapsforge/vtm/issues?q=is%3Aclosed+milestone%3A0.16.0)
## Version 0.15.0 (2021-01-01)
- Android: scoped storage map example [#785](https://github.com/mapsforge/vtm/pull/785)
- Mapsforge: map stream support [#784](https://github.com/mapsforge/vtm/pull/784)
- Render theme from Android content providers [#783](https://github.com/mapsforge/vtm/pull/783)
- Render theme xml pull parser [#786](https://github.com/mapsforge/vtm/pull/786)
- Symbol scale option [#790](https://github.com/mapsforge/vtm/pull/790)
- `Parameters.SYMBOL_SCALING`
- Minor improvements and bug fixes
- [Solved issues](https://github.com/mapsforge/vtm/issues?q=is%3Aclosed+milestone%3A0.15.0)
## Version 0.14.0 (2020-08-25)
- Render themes: symbol styles [#769](https://github.com/mapsforge/vtm/pull/769)
@@ -7,7 +43,7 @@
- Marker renderer sort option
- `Parameters.MARKER_SORT`
- Update vtm-jeo module [#770](https://github.com/mapsforge/vtm/pull/770)
- Many other minor improvements and bug fixes
- Minor improvements and bug fixes
- [Solved issues](https://github.com/mapsforge/vtm/issues?q=is%3Aclosed+milestone%3A0.14.0)
## Version 0.13.0 (2020-01-12)
@@ -22,7 +58,7 @@
- `MapView.OPENGL_VERSION`
- Android: threaded system initialization
- `Parameters.THREADED_INIT`
- Many other minor improvements and bug fixes
- Minor improvements and bug fixes
- [Solved issues](https://github.com/mapsforge/vtm/issues?q=is%3Aclosed+milestone%3A0.13.0)
## Version 0.12.0 (2019-09-17)
@@ -39,14 +75,14 @@
- `Parameters.POLY_LABEL`
- Android 10 compatibility [#728](https://github.com/mapsforge/vtm/issues/728)
- libGDX 1.9.10 [#731](https://github.com/mapsforge/vtm/issues/731)
- Many other minor improvements and bug fixes
- Minor improvements and bug fixes
- [Solved issues](https://github.com/mapsforge/vtm/issues?q=is%3Aclosed+milestone%3A0.12.0)
## Version 0.11.1 (2019-04-12)
- MBTiles raster tile source (Android) [#708](https://github.com/mapsforge/vtm/pull/708)
- Fix Android 4.2 crash [#713](https://github.com/mapsforge/vtm/issues/713)
- Many other minor improvements and bug fixes
- Minor improvements and bug fixes
- [Solved issues](https://github.com/mapsforge/vtm/issues?q=is%3Aclosed+milestone%3A0.11.1)
## Version 0.11.0 (2019-03-25)
@@ -72,7 +108,7 @@
- OpenGL ES 3.0 support [#646](https://github.com/mapsforge/vtm/issues/646)
- OpenGL ES 2.0 complete [#642](https://github.com/mapsforge/vtm/pull/642)
- libGDX 1.9.9 [#635](https://github.com/mapsforge/vtm/issues/635)
- Many other minor improvements and bug fixes
- Minor improvements and bug fixes
- [Solved issues](https://github.com/mapsforge/vtm/issues?q=is%3Aclosed+milestone%3A0.11.0)
## Version 0.10.0 (2018-08-28)
@@ -108,7 +144,7 @@
- Android 9 compatibility [#550](https://github.com/mapsforge/vtm/issues/550)
- JTS (LocationTech) [#484](https://github.com/mapsforge/vtm/issues/484)
- SVG Salamander (JitPack) [#560](https://github.com/mapsforge/vtm/issues/560)
- Many other minor improvements and bug fixes
- Minor improvements and bug fixes
- [Solved issues](https://github.com/mapsforge/vtm/issues?q=is%3Aclosed+milestone%3A0.10.0)
## Version 0.9.2 (2018-01-04)
@@ -121,7 +157,7 @@
- LwHttp engine fix http headers [#460](https://github.com/mapsforge/vtm/issues/460)
- S3DBLayer renamed to S3DBTileLayer [#452](https://github.com/mapsforge/vtm/issues/452)
- Many other minor improvements and bug fixes
- Minor improvements and bug fixes
- [Solved issues](https://github.com/mapsforge/vtm/issues?q=is%3Aclosed+milestone%3A0.9.1)
## Version 0.9.0 (2017-12-03)
@@ -150,7 +186,7 @@
- Gradle 4 / Android plugin 3 support [#433](https://github.com/mapsforge/vtm/issues/433)
- libGDX 1.9.7 [#434](https://github.com/mapsforge/vtm/issues/434)
- Internal render themes various improvements [#41](https://github.com/mapsforge/vtm/issues/41)
- Many other minor improvements and bug fixes
- Minor improvements and bug fixes
- [Solved issues](https://github.com/mapsforge/vtm/issues?q=is%3Aclosed+milestone%3A0.9.0)
## Version 0.8.0 (2017-07-19)
@@ -176,7 +212,7 @@
- Gretty plugin at web modules [#338](https://github.com/mapsforge/vtm/issues/338)
- libGDX 1.9.6 [#333](https://github.com/mapsforge/vtm/issues/333)
- Internal render themes various improvements [#41](https://github.com/mapsforge/vtm/issues/41)
- Many other minor improvements and bug fixes
- Minor improvements and bug fixes
- [Solved issues](https://github.com/mapsforge/vtm/issues?q=is%3Aclosed+milestone%3A0.8.0)
## Version 0.7.0 (2017-02-26)
@@ -204,10 +240,10 @@
- Fix theme parsing in non-Latin locales [#297](https://github.com/mapsforge/vtm/issues/297)
- libGDX 1.9.5 [#270](https://github.com/mapsforge/vtm/issues/270)
- Internal render themes various improvements [#41](https://github.com/mapsforge/vtm/issues/41)
- Many other minor improvements and bug fixes
- Minor improvements and bug fixes
- [Solved issues](https://github.com/mapsforge/vtm/issues?q=is%3Aclosed+milestone%3A0.7.0)
## Version 0.6.0 (2016-10-28) - VTM revive
## Version 0.6.0 (2016-10-28) - VTM revival
- Mapsforge maps **v4** support [#34](https://github.com/mapsforge/vtm/issues/34)
- Render theme SVG resources [#60](https://github.com/mapsforge/vtm/issues/60)
@@ -224,6 +260,8 @@
- libGDX layer gestures [#151](https://github.com/mapsforge/vtm/issues/151)
- Render theme area tessellation option [#37](https://github.com/mapsforge/vtm/issues/37)
- Render theme resources optional location prefixes [#66](https://github.com/mapsforge/vtm/issues/66)
- Render theme from input stream [#161](https://github.com/mapsforge/vtm/issues/161)
- Render theme from Android assets [#162](https://github.com/mapsforge/vtm/issues/162)
- Graphics API platform enhancements [#92](https://github.com/mapsforge/vtm/issues/92)
- GeoPoint & BoundingBox improvements [#201](https://github.com/mapsforge/vtm/issues/201) [#200](https://github.com/mapsforge/vtm/issues/200)
- vtm-jts module [#53](https://github.com/mapsforge/vtm/issues/53)
@@ -233,5 +271,5 @@
- SNAPSHOT builds publish to Sonatype OSSRH [#165](https://github.com/mapsforge/vtm/issues/165)
- libGDX 1.9.4 [#164](https://github.com/mapsforge/vtm/issues/164)
- Internal render themes various improvements [#41](https://github.com/mapsforge/vtm/issues/41)
- Many other minor improvements and bug fixes
- Minor improvements and bug fixes
- [Solved issues](https://github.com/mapsforge/vtm/issues?q=is%3Aclosed+milestone%3A0.6.0)

View File

@@ -1 +1 @@
For questions or discussion please use the [forum](https://groups.google.com/group/mapsforge-dev).
For questions, reports and feature requests please use the Discussions.

View File

@@ -10,6 +10,7 @@ Current version is [![Maven Central](https://img.shields.io/maven-central/v/org.
```groovy
implementation 'org.mapsforge:vtm:[CURRENT-VERSION]'
implementation 'org.mapsforge:vtm-themes:[CURRENT-VERSION]'
implementation 'net.sf.kxml:kxml2:2.3.0'
implementation 'org.slf4j:slf4j-api:1.7.28'
```
@@ -47,23 +48,19 @@ Detailed iOS instructions can be found [here](ios.md).
### Desktop
```groovy
repositories {
maven { url 'https://jitpack.io' }
}
implementation 'org.mapsforge:vtm-gdx:[CURRENT-VERSION]'
implementation 'org.mapsforge:vtm-desktop:[CURRENT-VERSION]'
implementation 'org.mapsforge:vtm-desktop:[CURRENT-VERSION]:natives-linux'
implementation 'org.mapsforge:vtm-desktop:[CURRENT-VERSION]:natives-osx'
implementation 'org.mapsforge:vtm-desktop:[CURRENT-VERSION]:natives-windows'
implementation 'org.mapsforge:vtm-desktop-lwjgl:[CURRENT-VERSION]'
implementation 'com.badlogicgames.gdx:gdx:1.9.10'
implementation 'com.badlogicgames.gdx:gdx-platform:1.9.10:natives-desktop'
implementation 'com.github.blackears:svgSalamander:v1.1.1'
implementation 'com.formdev:svgSalamander:1.1.2.4'
```
### Desktop (LWJGL)
```groovy
implementation 'org.mapsforge:vtm-desktop-lwjgl:[CURRENT-VERSION]'
implementation 'com.badlogicgames.gdx:gdx-backend-lwjgl:1.9.10'
implementation 'org.lwjgl.lwjgl:lwjgl:2.9.3'
implementation 'org.lwjgl.lwjgl:lwjgl-platform:2.9.3:natives-linux'
@@ -73,6 +70,7 @@ implementation 'org.lwjgl.lwjgl:lwjgl-platform:2.9.3:natives-windows'
### Desktop (LWJGL 3)
```groovy
implementation 'org.mapsforge:vtm-desktop-lwjgl3:[CURRENT-VERSION]'
implementation 'com.badlogicgames.gdx:gdx-backend-lwjgl3:1.9.10'
implementation 'org.lwjgl:lwjgl:3.2.3'
implementation 'org.lwjgl:lwjgl:3.2.3:natives-linux'
@@ -93,7 +91,7 @@ implementation 'org.locationtech.jts:jts-core:1.15.1'
```groovy
implementation 'org.mapsforge:vtm-http:[CURRENT-VERSION]'
// https://github.com/square/okhttp/issues/4481
implementation 'com.squareup.okhttp3:okhttp:3.12.5'
implementation 'com.squareup.okhttp3:okhttp:3.12.13'
implementation 'com.squareup.okio:okio:1.15.0'
```

View File

@@ -8,5 +8,3 @@
- [OpenAndroMaps](https://www.openandromaps.org/en/)
- [OpenMaps](https://openmaps.eu/)
- [vector.city](https://vector.city/)
You know a Mapsforge map provider that is missing here? Please inform us by sending a message via our public [forum](https://groups.google.com/group/mapsforge-dev).

View File

@@ -1,8 +1,6 @@
# RenderTheme
**This article describes how to use XML-based render-themes to style maps.**
If you have any questions or problems, don't hesitate to ask our public [forum](https://groups.google.com/group/mapsforge-dev) for help.
This article describes how to use XML-based render-themes to style maps.
## Introduction

View File

@@ -6,14 +6,14 @@
# http://www.gradle.org/docs/current/userguide/build_environment.html
# Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings.
org.gradle.jvmargs=-Xmx2048m
org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8
# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
# org.gradle.parallel=true
# AndroidX package structure to make it clearer which packages are bundled with the
# Android operating system, and which are packaged with your app's APK
# Android operating system, and which are packaged with your app"s APK
# https://developer.android.com/topic/libraries/support-library/androidx-rn
android.useAndroidX=true
# Automatically convert third-party libraries to use AndroidX
android.enableJetifier=true
android.enableJetifier=true

Binary file not shown.

View File

@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.1.1-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.0.2-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

53
gradlew vendored
View File

@@ -1,5 +1,21 @@
#!/usr/bin/env sh
#
# Copyright 2015 the original author or authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
##############################################################################
##
## Gradle start up script for UN*X
@@ -28,7 +44,7 @@ APP_NAME="Gradle"
APP_BASE_NAME=`basename "$0"`
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS=""
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum"
@@ -66,6 +82,7 @@ esac
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
# Determine the Java command to use to start the JVM.
if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
@@ -109,10 +126,11 @@ if $darwin; then
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
fi
# For Cygwin, switch paths to Windows format before running java
if $cygwin ; then
# For Cygwin or MSYS, switch paths to Windows format before running java
if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
JAVACMD=`cygpath --unix "$JAVACMD"`
# We build the pattern for arguments to be converted via cygpath
@@ -138,19 +156,19 @@ if $cygwin ; then
else
eval `echo args$i`="\"$arg\""
fi
i=$((i+1))
i=`expr $i + 1`
done
case $i in
(0) set -- ;;
(1) set -- "$args0" ;;
(2) set -- "$args0" "$args1" ;;
(3) set -- "$args0" "$args1" "$args2" ;;
(4) set -- "$args0" "$args1" "$args2" "$args3" ;;
(5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
(6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
(7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
(8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
(9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
0) set -- ;;
1) set -- "$args0" ;;
2) set -- "$args0" "$args1" ;;
3) set -- "$args0" "$args1" "$args2" ;;
4) set -- "$args0" "$args1" "$args2" "$args3" ;;
5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
esac
fi
@@ -159,14 +177,9 @@ save () {
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
echo " "
}
APP_ARGS=$(save "$@")
APP_ARGS=`save "$@"`
# Collect all arguments for the java command, following the shell quoting and substitution rules
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
cd "$(dirname "$0")"
fi
exec "$JAVACMD" "$@"

43
gradlew.bat vendored
View File

@@ -1,3 +1,19 @@
@rem
@rem Copyright 2015 the original author or authors.
@rem
@rem Licensed under the Apache License, Version 2.0 (the "License");
@rem you may not use this file except in compliance with the License.
@rem You may obtain a copy of the License at
@rem
@rem https://www.apache.org/licenses/LICENSE-2.0
@rem
@rem Unless required by applicable law or agreed to in writing, software
@rem distributed under the License is distributed on an "AS IS" BASIS,
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@rem See the License for the specific language governing permissions and
@rem limitations under the License.
@rem
@if "%DEBUG%" == "" @echo off
@rem ##########################################################################
@rem
@@ -13,15 +29,18 @@ if "%DIRNAME%" == "" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS=
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome
set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto init
if "%ERRORLEVEL%" == "0" goto execute
echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
@@ -35,7 +54,7 @@ goto fail
set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto init
if exist "%JAVA_EXE%" goto execute
echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
@@ -45,28 +64,14 @@ echo location of your Java installation.
goto fail
:init
@rem Get command-line arguments, handling Windows variants
if not "%OS%" == "Windows_NT" goto win9xME_args
:win9xME_args
@rem Slurp the command line arguments.
set CMD_LINE_ARGS=
set _SKIP=2
:win9xME_args_slurp
if "x%~1" == "x" goto execute
set CMD_LINE_ARGS=%*
:execute
@rem Setup the command line
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
:end
@rem End local scope for the variables with windows NT shell

View File

@@ -1,7 +1,7 @@
apply plugin: 'java-library'
apply plugin: 'java'
dependencies {
api "com.badlogicgames.gdx:gdx-jnigen:$gdxVersion"
implementation "com.badlogicgames.gdx:gdx-jnigen:$gdxVersion"
}
sourceSets {

View File

@@ -5,6 +5,7 @@
android:versionCode="1"
android:versionName="1.0">
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission
@@ -15,10 +16,12 @@
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:requestLegacyExternalStorage="true"
android:usesCleartextTraffic="true">
<activity
android:name=".Samples"
android:configChanges="keyboardHidden|orientation|screenSize">
android:configChanges="keyboardHidden|orientation|screenSize"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
@@ -33,6 +36,12 @@
<activity
android:name=".ClusterMarkerOverlayActivity"
android:configChanges="keyboardHidden|orientation|screenSize" />
<activity
android:name=".DraggableMarkerOverlayActivity"
android:configChanges="keyboardHidden|orientation|screenSize" />
<activity
android:name=".FragmentActivity"
android:configChanges="keyboardHidden|orientation|screenSize" />
<activity
android:name=".GettingStarted"
android:configChanges="keyboardHidden|orientation|screenSize" />
@@ -60,12 +69,6 @@
<activity
android:name=".MapsforgeActivity"
android:configChanges="keyboardHidden|orientation|screenSize" />
<activity
android:name=".MapsforgeActivity$MapFilePicker"
android:configChanges="keyboardHidden|orientation|screenSize" />
<activity
android:name=".MapsforgeActivity$ThemeFilePicker"
android:configChanges="keyboardHidden|orientation|screenSize" />
<activity
android:name=".MapsforgeS3DBActivity"
android:configChanges="keyboardHidden|orientation|screenSize" />

View File

@@ -16,27 +16,26 @@ dependencies {
implementation project(':vtm-gdx')
implementation project(':vtm-gdx-poi3d')
implementation 'org.mapsforge:mapsforge-poi-android:0.14.0'
implementation 'org.mapsforge:sqlite-android:0.14.0:natives-armeabi-v7a'
implementation 'org.mapsforge:sqlite-android:0.14.0:natives-arm64-v8a'
implementation 'org.mapsforge:sqlite-android:0.14.0:natives-x86'
implementation 'org.mapsforge:sqlite-android:0.14.0:natives-x86_64'
implementation 'org.mapsforge:mapsforge-poi-android:0.17.0'
implementation 'org.mapsforge:sqlite-android:0.17.0:natives-armeabi-v7a'
implementation 'org.mapsforge:sqlite-android:0.17.0:natives-arm64-v8a'
implementation 'org.mapsforge:sqlite-android:0.17.0:natives-x86'
implementation 'org.mapsforge:sqlite-android:0.17.0:natives-x86_64'
}
android {
compileSdkVersion androidCompileSdk()
buildToolsVersion "$androidBuildVersionTools"
compileSdk androidCompileSdk()
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
defaultConfig {
versionCode project.versionCode()
versionName project.versionName()
minSdkVersion androidMinSdk()
targetSdkVersion androidTargetSdk()
minSdk androidMinSdk()
targetSdk androidTargetSdk()
}
sourceSets {

View File

@@ -0,0 +1,10 @@
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<org.oscim.android.drag.DragMapView
android:id="@+id/mapView"
android:layout_width="fill_parent"
android:layout_height="fill_parent" />
</RelativeLayout>

View File

@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@android:color/white">
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="@string/empty_fragment_text" />
</RelativeLayout>

View File

@@ -1,9 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@android:color/white">
<org.oscim.android.MapView
<RelativeLayout
android:id="@+id/mapView"
android:layout_width="match_parent"
android:layout_height="match_parent" />

View File

@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:id="@+id/replace_fragment"
android:showAsAction="never"
android:title="@string/replace_fragment" />
</menu>

View File

@@ -20,6 +20,9 @@
<item
android:id="@+id/theme_newtron"
android:title="@string/theme_newtron" />
<item
android:id="@+id/theme_external_archive"
android:title="@string/theme_external_archive" />
<item
android:id="@+id/theme_external"
android:title="@string/theme_external" />

View File

@@ -6,7 +6,8 @@
<string name="theme_osmagray">Osmagray</string>
<string name="theme_tubes">Tubes</string>
<string name="theme_newtron">NewTron</string>
<string name="theme_external">External theme</string>
<string name="theme_external">External theme (Android 5)</string>
<string name="theme_external_archive">External theme archive</string>
<string name="styler_mode_line">Line</string>
<string name="styler_mode_area">Area</string>
<string name="styler_mode_outline">Outline</string>
@@ -15,6 +16,7 @@
<string name="style_2">Hide nature</string>
<string name="menu_gridlayer">Grid</string>
<string name="dialog_reverse_geocoding_title">Reverse Geocoding</string>
<string name="dialog_theme_title">Select a theme</string>
<string name="add">Add</string>
<string name="cancel">Cancel</string>
<string name="error">Error</string>
@@ -26,7 +28,9 @@
<string name="search_value">void or value</string>
<string name="now">Now</string>
<string name="warning">Warning</string>
<string name="startup_message_mbtiles">To run this sample activity, you need an MBTiles database installed on storage.\n\nadb push %s %s</string>
<string name="startup_message_mbtiles">To run this sample activity, you need an MBTiles database installed on storage.</string>
<string name="exit">Exit</string>
<string name="replace_fragment">Replace fragment</string>
<string name="empty_fragment_text">This is a fragment to test the back stack behaviour of the map fragment.</string>
</resources>

View File

@@ -19,13 +19,13 @@
* 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.layers.marker;
package org.oscim.android.cluster;
import org.oscim.backend.canvas.Bitmap;
import org.oscim.core.MercatorProjection;
import org.oscim.core.PointF;
import org.oscim.core.Tile;
import org.oscim.layers.marker.utils.ScreenUtils;
import org.oscim.layers.marker.*;
import org.oscim.layers.marker.utils.SparseIntArray;
import org.oscim.renderer.GLViewport;
import org.oscim.renderer.bucket.SymbolItem;
@@ -45,7 +45,7 @@ public class ClusterMarkerRenderer extends MarkerRenderer {
/**
* default color of number inside the icon. Would be super-cool to cook this into the map theme
*/
private static int CLUSTER_COLORTEXT = 0xff8000c0;
private static final int CLUSTER_COLORTEXT = 0xff8000c0;
/**
* default color of circle background
@@ -84,12 +84,12 @@ public class ClusterMarkerRenderer extends MarkerRenderer {
* We use a flat Sparse array to calculate the clusters. The sparse array models a 2D map where every (x,y) denotes
* a grid slot, ie. 64x64dp. For efficiency I use a linear sparsearray with ARRindex = SLOTypos * max_x + SLOTxpos"
*/
private SparseIntArray mGridMap = new SparseIntArray(200); // initial space for 200 markers, that's not a lot of memory, and in most cases will avoid resizing the array
private final SparseIntArray mGridMap = new SparseIntArray(200); // initial space for 200 markers, that's not a lot of memory, and in most cases will avoid resizing the array
/**
* Whether to enable clustering or disable the functionality
*/
private boolean mClusteringEnabled = false;
private final boolean mClusteringEnabled;
/**
* Constructs a clustered marker renderer
@@ -139,18 +139,18 @@ public class ClusterMarkerRenderer extends MarkerRenderer {
*/
private void repopulateCluster(int size, double scale) {
/* the grid slot size in px. increase to group more aggressively. currently set to marker size */
final int GRIDSIZE = ScreenUtils.getPixels(MAP_GRID_SIZE_DP);
final int GRIDSIZE = ClusterUtils.getPixels(MAP_GRID_SIZE_DP);
/* the factor to map into Grid Coordinates (discrete squares of GRIDSIZE x GRIDSIZE) */
final double factor = (scale / GRIDSIZE);
InternalItem.Clustered[] tmp = new InternalItem.Clustered[size];
Clustered[] tmp = new Clustered[size];
// clear grid map to count items that share the same "grid slot"
mGridMap.clear();
for (int i = 0; i < size; i++) {
InternalItem.Clustered it = tmp[i] = new InternalItem.Clustered();
Clustered it = tmp[i] = new Clustered();
it.item = mMarkerLayer.createItem(i);
@@ -160,7 +160,7 @@ public class ClusterMarkerRenderer extends MarkerRenderer {
it.py = mMapPoint.y;
// items can be declared non-clusterable
if (!(it.item instanceof MarkerItem.NonClusterable)) {
if (!(it.item instanceof NonClusterable)) {
final int
absposx = (int) (it.px * factor), // absolute item X position in the grid
@@ -244,7 +244,7 @@ public class ClusterMarkerRenderer extends MarkerRenderer {
int numVisible = 0;
// Increase view to show items that are partially visible
mMarkerLayer.map().viewport().getMapExtents(mBox, Tile.SIZE / 2);
mMarkerLayer.map().viewport().getMapExtents(mBox, Tile.SIZE >> 1);
long flip = (long) (Tile.SIZE * v.pos.scale) >> 1;
@@ -262,7 +262,7 @@ public class ClusterMarkerRenderer extends MarkerRenderer {
/* check visibility */
for (InternalItem itm : mItems) {
InternalItem.Clustered it = (InternalItem.Clustered) itm;
Clustered it = (Clustered) itm;
it.changes = false;
it.x = (float) ((it.px - mx) * scale);
@@ -318,7 +318,7 @@ public class ClusterMarkerRenderer extends MarkerRenderer {
//log.debug(Arrays.toString(mItems));
for (InternalItem itm : mItems) {
InternalItem.Clustered it = (InternalItem.Clustered) itm;
Clustered it = (Clustered) itm;
// skip invisible AND clustered-out
if ((!it.visible) || (it.clusteredOut))
@@ -387,7 +387,7 @@ public class ClusterMarkerRenderer extends MarkerRenderer {
// create and cache bitmap. This is unacceptable inside the GL thread,
// so we'll call this routine at the beginning to pre-cache all bitmaps
ScreenUtils.ClusterDrawable drawable = new ScreenUtils.ClusterDrawable(
ClusterUtils.ClusterDrawable drawable = new ClusterUtils.ClusterDrawable(
MAP_MARKER_CLUSTER_SIZE_DP - CLUSTER_MAXSIZE + size, // make size dependent on cluster size
mStyleForeground,
mStyleBackground,

View File

@@ -14,7 +14,7 @@
* 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.layers.marker.utils;
package org.oscim.android.cluster;
import org.oscim.backend.CanvasAdapter;
import org.oscim.backend.canvas.Bitmap;
@@ -25,7 +25,7 @@ import org.oscim.backend.canvas.Paint;
* A simple utility class to make clustered markers functionality self-contained.
* Includes a method to translate between DPs and PXs and a circular icon generator.
*/
public class ScreenUtils {
public class ClusterUtils {
/**
* Get pixels from DPs
@@ -38,8 +38,9 @@ public class ScreenUtils {
}
public static class ClusterDrawable {
private Paint mPaintText = CanvasAdapter.newPaint();
private Paint mPaintCircle = CanvasAdapter.newPaint(), mPaintBorder = CanvasAdapter.newPaint();
private final Paint mPaintText = CanvasAdapter.newPaint();
private final Paint mPaintCircle = CanvasAdapter.newPaint();
private final Paint mPaintBorder = CanvasAdapter.newPaint();
private int mSize;
private String mText;
@@ -57,8 +58,8 @@ public class ScreenUtils {
}
private void setup(int sizedp, int foregroundColor, int backgroundColor) {
mSize = ScreenUtils.getPixels(sizedp);
mPaintText.setTextSize(ScreenUtils.getPixels((int) (sizedp * 0.6666666)));
mSize = ClusterUtils.getPixels(sizedp);
mPaintText.setTextSize(ClusterUtils.getPixels((int) (sizedp * 0.6666666)));
mPaintText.setColor(foregroundColor);
mPaintCircle.setColor(backgroundColor);

View File

@@ -0,0 +1,33 @@
/*
* Copyright 2017 nebular
* Copyright 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.cluster;
import org.oscim.layers.marker.InternalItem;
/**
* Extension for clustered items.
*/
public class Clustered extends InternalItem {
/**
* If this is >0, this item will be displayed as a cluster circle, with size clusterSize+1.
*/
public int clusterSize;
/**
* If this is true, this item is hidden (because it's represented by another InternalItem acting as cluster.
*/
public boolean clusteredOut;
}

View File

@@ -0,0 +1,33 @@
/*
* Copyright 2017 nebular
* Copyright 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.cluster;
import org.oscim.core.GeoPoint;
import org.oscim.layers.marker.MarkerItem;
/**
* If a MarkerItem is created using this convenience class instead of MarkerItem,
* this specific item will not be clusterable.
*/
public class NonClusterable extends MarkerItem {
public NonClusterable(String title, String description, GeoPoint geoPoint) {
super(null, title, description, geoPoint);
}
public NonClusterable(Object uid, String title, String description, GeoPoint geoPoint) {
super(uid, title, description, geoPoint);
}
}

View File

@@ -0,0 +1,26 @@
/*
* Copyright 2021 Frank Knoll
*
* 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.drag;
import org.oscim.core.GeoPoint;
public interface DragAndDropListener {
void startDragItemAtGeoPoint(DraggableMarkerItem item, GeoPoint geoPoint);
void ongoingDragItemToGeoPoint(DraggableMarkerItem item, GeoPoint geoPoint);
void dropItemAtGeoPoint(DraggableMarkerItem item, GeoPoint geoPoint);
}

View File

@@ -0,0 +1,65 @@
/*
* Copyright 2013 Hannes Janetzek
* Copyright 2016 devemux86
* Copyright 2021 Frank Knoll
*
* 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.android.drag;
import android.view.MotionEvent;
import org.oscim.android.input.AndroidMotionEvent;
import org.oscim.android.input.GestureHandler;
import org.oscim.event.Gesture;
import org.oscim.map.Map;
class DragGestureHandler extends GestureHandler {
public static final Gesture START_DRAG = new Gesture() {
};
public static final Gesture ONGOING_DRAG = new Gesture() {
};
public static final Gesture END_DRAG = new Gesture() {
};
private final AndroidMotionEvent mMotionEvent;
private final Map mMap;
private boolean scrolling = false;
public DragGestureHandler(Map map) {
super(map);
mMotionEvent = new AndroidMotionEvent();
mMap = map;
}
public boolean isScrolling() {
return scrolling;
}
public void setScrolling(boolean scrolling) {
this.scrolling = scrolling;
}
@Override
public void onShowPress(MotionEvent e) {
scrolling = true;
mMap.handleGesture(START_DRAG, mMotionEvent.wrap(e));
}
@Override
public boolean onScroll(MotionEvent e1, MotionEvent e2, float distanceX, float distanceY) {
scrolling = true;
return mMap.handleGesture(ONGOING_DRAG, mMotionEvent.wrap(e2));
}
}

View File

@@ -0,0 +1,62 @@
/*
* Copyright 2012 Hannes Janetzek
* Copyright 2016-2020 devemux86
* Copyright 2018-2019 Gustl22
* Copyright 2021 Frank Knoll
*
* 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.android.drag;
import android.content.Context;
import android.util.AttributeSet;
import android.view.GestureDetector;
import org.oscim.android.MapView;
import org.oscim.map.Map;
import org.oscim.utils.Parameters;
public class DragMapView extends MapView {
private DragGestureHandler gestureHandler;
public DragMapView(Context context) {
super(context);
}
public DragMapView(Context context, AttributeSet attributeSet) {
super(context, attributeSet);
if (!Parameters.MAP_EVENT_LAYER2) {
gestureHandler = new DragGestureHandler(mMap);
mGestureDetector = new GestureDetector(context, gestureHandler);
mGestureDetector.setOnDoubleTapListener(gestureHandler);
}
}
@Override
public boolean onTouchEvent(android.view.MotionEvent motionEvent) {
if (!isClickable()) {
return false;
}
if (motionEvent.getAction() == android.view.MotionEvent.ACTION_UP) {
if (gestureHandler.isScrolling()) {
gestureHandler.setScrolling(false);
return ((Map) mMap).handleGesture(DragGestureHandler.END_DRAG, mMotionEvent.wrap(motionEvent));
}
}
return super.onTouchEvent(motionEvent);
}
}

View File

@@ -0,0 +1,82 @@
/*
* Copyright 2012 osmdroid authors: Nicolas Gramlich, Theodore Hong, Fred Eisele
*
* Copyright 2013 Hannes Janetzek
* Copyright 2016-2021 devemux86
* Copyright 2016 Stephan Leuschner
* Copyright 2016 Pedinel
* Copyright 2019 Carlos Alberto Martínez Gadea
* Copyright 2021 Frank Knoll
*
* 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.android.drag;
import org.oscim.core.GeoPoint;
import org.oscim.event.Gesture;
import org.oscim.event.GestureListener;
import org.oscim.event.MotionEvent;
import org.oscim.layers.marker.ItemizedLayer;
import org.oscim.layers.marker.MarkerInterface;
import org.oscim.layers.marker.MarkerSymbol;
import org.oscim.map.Map;
import java.util.List;
import static org.oscim.android.drag.DragGestureHandler.*;
public class DraggableItemizedLayer extends ItemizedLayer implements GestureListener {
private final ItemDragger itemDragger;
public DraggableItemizedLayer(Map map,
List<MarkerInterface> markerItems,
MarkerSymbol defaultMarker,
OnItemGestureListener<MarkerInterface> listener) {
super(map, markerItems, defaultMarker, listener);
itemDragger = new ItemDragger(this, map);
}
@Override
protected boolean activateSelectedItems(MotionEvent event, ActiveItem task) {
return super.activateSelectedItems(event, task);
}
protected List<MarkerInterface> getMarkerItems() {
return mItemList;
}
@Override
public boolean onGesture(Gesture gesture, MotionEvent event) {
if (!isEnabled()) {
return false;
}
if (gesture == START_DRAG) {
return itemDragger.startDragItem(event, getGeoPoint(event));
} else if (gesture == ONGOING_DRAG) {
return itemDragger.ongoingDragItemTo(getGeoPoint(event));
} else if (gesture == END_DRAG) {
return itemDragger.dropItemAt(getGeoPoint(event));
} else {
itemDragger.noDrag();
}
return super.onGesture(gesture, event);
}
private GeoPoint getGeoPoint(MotionEvent event) {
return map().viewport().fromScreenPoint(event.getX(), event.getY());
}
}

View File

@@ -0,0 +1,43 @@
/*
* Copyright 2012 osmdroid authors:
* Copyright 2012 Nicolas Gramlich
* Copyright 2012 Theodore Hong
* Copyright 2012 Fred Eisele
*
* Copyright 2014 Hannes Janetzek
* Copyright 2016 devemux86
* Copyright 2016 Erik Duisters
* Copyright 2017 Longri
* Copyright 2021 Frank Knoll
*
* 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.android.drag;
import org.oscim.core.GeoPoint;
import org.oscim.layers.marker.MarkerItem;
public class DraggableMarkerItem extends MarkerItem {
private final DragAndDropListener dragAndDropListener;
public DraggableMarkerItem(String title, String description, GeoPoint geoPoint, DragAndDropListener dragAndDropListener) {
super(title, description, geoPoint);
this.dragAndDropListener = dragAndDropListener;
}
public DragAndDropListener getDragAndDropListener() {
return dragAndDropListener;
}
}

View File

@@ -0,0 +1,96 @@
/*
* Copyright 2021 Frank Knoll
*
* 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.drag;
import org.oscim.core.GeoPoint;
import org.oscim.event.MotionEvent;
import org.oscim.layers.marker.ItemizedLayer;
import org.oscim.layers.marker.MarkerItem;
import org.oscim.layers.marker.MarkerLayer;
import org.oscim.map.Map;
class ItemDragger {
private final DraggableItemizedLayer draggableItemizedLayer;
private final DragAndDropListener dragItemAndRedrawListener;
private DraggableMarkerItem dragItem;
public ItemDragger(DraggableItemizedLayer draggableItemizedLayer, Map map) {
this.draggableItemizedLayer = draggableItemizedLayer;
this.dragItemAndRedrawListener = createDragItemAndRedrawListener(draggableItemizedLayer, map);
}
public boolean startDragItem(MotionEvent event, final GeoPoint geoPoint) {
dragItem = null;
return draggableItemizedLayer.activateSelectedItems(
event,
new ItemizedLayer.ActiveItem() {
@Override
public boolean run(int index) {
dragItem = (DraggableMarkerItem) draggableItemizedLayer.getMarkerItems().get(index);
dragItemAndRedrawListener.startDragItemAtGeoPoint(dragItem, geoPoint);
return true;
}
});
}
public boolean ongoingDragItemTo(GeoPoint geoPoint) {
if (dragItem == null) {
return false;
}
dragItemAndRedrawListener.ongoingDragItemToGeoPoint(dragItem, geoPoint);
return true;
}
public boolean dropItemAt(GeoPoint geoPoint) {
if (dragItem == null) {
return false;
}
dragItemAndRedrawListener.dropItemAtGeoPoint(dragItem, geoPoint);
return true;
}
public void noDrag() {
dragItem = null;
}
private DragAndDropListener createDragItemAndRedrawListener(final MarkerLayer markerLayer, final Map map) {
return new DragAndDropListener() {
@Override
public void startDragItemAtGeoPoint(DraggableMarkerItem item, GeoPoint geoPoint) {
item.getDragAndDropListener().startDragItemAtGeoPoint(item, geoPoint);
updateLocationOfMarkerItemAndRedraw(item, geoPoint);
}
@Override
public void ongoingDragItemToGeoPoint(DraggableMarkerItem item, GeoPoint geoPoint) {
item.getDragAndDropListener().ongoingDragItemToGeoPoint(item, geoPoint);
updateLocationOfMarkerItemAndRedraw(item, geoPoint);
}
@Override
public void dropItemAtGeoPoint(DraggableMarkerItem item, GeoPoint geoPoint) {
item.getDragAndDropListener().dropItemAtGeoPoint(item, geoPoint);
updateLocationOfMarkerItemAndRedraw(item, geoPoint);
}
private void updateLocationOfMarkerItemAndRedraw(MarkerItem markerItem, GeoPoint location) {
markerItem.geoPoint = location;
markerLayer.populate();
map.render();
}
};
}
}

View File

@@ -192,6 +192,7 @@ public class FilePicker extends Activity implements AdapterView.OnItemClickListe
// }
}
@SuppressWarnings("deprecation")
@Override
protected Dialog onCreateDialog(int id) {
AlertDialog.Builder builder = new AlertDialog.Builder(this);

View File

@@ -1,6 +1,6 @@
/*
* Copyright 2010, 2011, 2012 mapsforge.org
* Copyright 2016-2018 devemux86
* Copyright 2016-2020 devemux86
* Copyright 2017 Longri
*
* This program is free software: you can redistribute it and/or modify it under the
@@ -16,18 +16,11 @@
*/
package org.oscim.android.filepicker;
import org.oscim.theme.ExternalRenderTheme;
import org.oscim.theme.ThemeFile;
import org.oscim.theme.XmlThemeBuilder;
import org.oscim.theme.ThemeLoader;
import org.oscim.tiling.TileSource.OpenResult;
import org.xml.sax.InputSource;
import org.xml.sax.XMLReader;
import org.xml.sax.helpers.DefaultHandler;
import java.io.File;
import javax.xml.parsers.SAXParserFactory;
/**
* Accepts all valid render theme XML files.
*/
@@ -36,13 +29,8 @@ public final class ValidRenderTheme implements ValidFileFilter {
@Override
public boolean accept(File file) {
try {
ThemeFile theme = new ExternalRenderTheme(file.getAbsolutePath());
DefaultHandler renderThemeHandler = new XmlThemeBuilder(theme);
XMLReader xmlReader = SAXParserFactory.newInstance().newSAXParser().getXMLReader();
xmlReader.setContentHandler(renderThemeHandler);
xmlReader.parse(new InputSource(theme.getRenderThemeAsStream()));
ThemeLoader.load(file.getAbsolutePath());
mOpenResult = OpenResult.SUCCESS;
} catch (Exception e) {
mOpenResult = new OpenResult(e.getMessage());

View File

@@ -1,6 +1,6 @@
/*
* Copyright 2013 Hannes Janetzek
* Copyright 2016-2018 devemux86
* Copyright 2016-2020 devemux86
*
* This file is part of the OpenScienceMap project (http://www.opensciencemap.org).
*
@@ -20,8 +20,8 @@ package org.oscim.android.test;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import org.oscim.android.cache.TileCache;
import okhttp3.Cache;
import okhttp3.OkHttpClient;
import org.oscim.core.MapPosition;
import org.oscim.layers.TileGridLayer;
import org.oscim.layers.tile.vector.VectorTileLayer;
@@ -29,11 +29,10 @@ import org.oscim.theme.VtmThemes;
import org.oscim.tiling.TileSource;
import org.oscim.tiling.source.OkHttpEngine;
import org.oscim.tiling.source.oscimap4.OSciMap4TileSource;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.File;
public class BaseMapActivity extends MapActivity {
static final Logger log = LoggerFactory.getLogger(BaseMapActivity.class);
static final boolean USE_CACHE = false;
@@ -41,8 +40,6 @@ public class BaseMapActivity extends MapActivity {
TileSource mTileSource;
TileGridLayer mGridLayer;
private TileCache mCache;
public BaseMapActivity(int contentView) {
super(contentView);
}
@@ -54,15 +51,19 @@ public class BaseMapActivity extends MapActivity {
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
OkHttpClient.Builder builder = new OkHttpClient.Builder();
if (USE_CACHE) {
// Cache the tiles into file system
File cacheDirectory = new File(getExternalCacheDir(), "tiles");
int cacheSize = 10 * 1024 * 1024; // 10 MB
Cache cache = new Cache(cacheDirectory, cacheSize);
builder.cache(cache);
}
mTileSource = OSciMap4TileSource.builder()
.httpFactory(new OkHttpEngine.OkHttpFactory())
.httpFactory(new OkHttpEngine.OkHttpFactory(builder))
.build();
if (USE_CACHE) {
mCache = new TileCache(this, null, "tile.db");
mCache.setCacheSize(512 * (1 << 10));
mTileSource.setCache(mCache);
}
mBaseLayer = mMap.setBaseMap(mTileSource);
/* set initial position on first run */
@@ -72,14 +73,6 @@ public class BaseMapActivity extends MapActivity {
mMap.setMapPosition(53.08, 8.83, Math.pow(2, 16));
}
@Override
protected void onDestroy() {
super.onDestroy();
if (mCache != null)
mCache.dispose();
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {

View File

@@ -16,22 +16,21 @@
package org.oscim.android.test;
import android.os.Bundle;
import org.oscim.android.cache.TileCache;
import okhttp3.Cache;
import okhttp3.OkHttpClient;
import org.oscim.core.MapPosition;
import org.oscim.core.MercatorProjection;
import org.oscim.layers.tile.bitmap.BitmapTileLayer;
import org.oscim.renderer.MapRenderer;
import org.oscim.tiling.source.OkHttpEngine;
import org.oscim.tiling.source.bitmap.BitmapTileSource;
import org.oscim.tiling.source.bitmap.DefaultSources;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.File;
import java.util.Collections;
public class BitmapTileActivity extends MapActivity {
static final Logger log = LoggerFactory.getLogger(BitmapTileActivity.class);
private static final boolean USE_CACHE = false;
private final BitmapTileSource mTileSource;
@@ -43,12 +42,9 @@ public class BitmapTileActivity extends MapActivity {
public BitmapTileActivity(BitmapTileSource tileSource) {
super(R.layout.activity_map);
tileSource.setHttpRequestHeaders(Collections.singletonMap("User-Agent", "vtm-android-example"));
mTileSource = tileSource;
}
private TileCache mCache;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
@@ -58,31 +54,24 @@ public class BitmapTileActivity extends MapActivity {
if (mTileSource == null)
return;
OkHttpClient.Builder builder = new OkHttpClient.Builder();
if (USE_CACHE) {
String cacheFile = mTileSource.getUrl()
.toString()
.replaceFirst("https?://", "")
.replaceAll("/", "-");
log.debug("use bitmap cache {}", cacheFile);
mCache = new TileCache(this, null, cacheFile);
mCache.setCacheSize(512 * (1 << 10));
mTileSource.setCache(mCache);
// Cache the tiles into file system
File cacheDirectory = new File(getExternalCacheDir(), "tiles");
int cacheSize = 10 * 1024 * 1024; // 10 MB
Cache cache = new Cache(cacheDirectory, cacheSize);
builder.cache(cache);
}
mTileSource.setHttpEngine(new OkHttpEngine.OkHttpFactory(builder));
mTileSource.setHttpRequestHeaders(Collections.singletonMap("User-Agent", "vtm-android-example"));
mBitmapLayer = new BitmapTileLayer(mMap, mTileSource);
mMap.layers().add(mBitmapLayer);
//loooop(1);
}
@Override
protected void onDestroy() {
super.onDestroy();
if (mCache != null)
mCache.dispose();
}
// Stress testing
void loooop(final int i) {
final long time = (long) (500 + Math.random() * 1000);

View File

@@ -0,0 +1,37 @@
/*
* Copyright 2020 Meibes
*
* 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 android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
@SuppressWarnings("deprecation")
public class BlankFragment extends android.app.Fragment {
static BlankFragment newInstance() {
BlankFragment instance = new BlankFragment();
Bundle args = new Bundle();
instance.setArguments(args);
return instance;
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
return inflater.inflate(R.layout.fragment_blank, container, false);
}
}

View File

@@ -17,6 +17,7 @@ package org.oscim.android.test;
import android.graphics.BitmapFactory;
import org.oscim.android.canvas.AndroidBitmap;
import org.oscim.android.cluster.ClusterMarkerRenderer;
import org.oscim.backend.canvas.Bitmap;
import org.oscim.backend.canvas.Color;
import org.oscim.core.GeoPoint;

View File

@@ -0,0 +1,105 @@
/*
* Copyright 2014 Hannes Janetzek
* Copyright 2016-2020 devemux86
* Copyright 2021 Frank Knoll
*
* 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.android.test;
import android.graphics.BitmapFactory;
import android.os.Bundle;
import android.util.Log;
import org.oscim.android.canvas.AndroidBitmap;
import org.oscim.android.drag.DragAndDropListener;
import org.oscim.android.drag.DraggableItemizedLayer;
import org.oscim.android.drag.DraggableMarkerItem;
import org.oscim.core.GeoPoint;
import org.oscim.layers.marker.ItemizedLayer;
import org.oscim.layers.marker.MarkerInterface;
import org.oscim.layers.marker.MarkerSymbol;
import org.oscim.layers.marker.MarkerSymbol.HotspotPlace;
import org.oscim.layers.tile.bitmap.BitmapTileLayer;
import org.oscim.tiling.source.OkHttpEngine;
import org.oscim.tiling.source.UrlTileSource;
import org.oscim.tiling.source.bitmap.DefaultSources;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
public class DraggableMarkerOverlayActivity extends MapActivity {
public DraggableMarkerOverlayActivity() {
super(R.layout.activity_map_draggable);
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
createLayers();
}
void createLayers() {
UrlTileSource tileSource = DefaultSources.OPENSTREETMAP
.httpFactory(new OkHttpEngine.OkHttpFactory())
.build();
tileSource.setHttpRequestHeaders(Collections.singletonMap("User-Agent", "vtm-android-example"));
mMap.layers().add(new BitmapTileLayer(mMap, tileSource));
ItemizedLayer mMarkerLayer = new DraggableItemizedLayer(
mMap,
new ArrayList<MarkerInterface>(),
new MarkerSymbol(
new AndroidBitmap(BitmapFactory.decodeResource(getResources(), R.drawable.marker_poi)),
HotspotPlace.BOTTOM_CENTER),
null);
mMap.layers().add(mMarkerLayer);
DragAndDropListener dragAndDropListener = new DragAndDropListener() {
@Override
public void startDragItemAtGeoPoint(DraggableMarkerItem item, GeoPoint geoPoint) {
Log.i(DraggableMarkerOverlayActivity.this.getClass().getSimpleName(), "startDragItemAtGeoPoint: " + geoPoint);
}
@Override
public void ongoingDragItemToGeoPoint(DraggableMarkerItem item, GeoPoint geoPoint) {
Log.i(DraggableMarkerOverlayActivity.this.getClass().getSimpleName(), "ongoingDragItemToGeoPoint: " + geoPoint);
}
@Override
public void dropItemAtGeoPoint(DraggableMarkerItem item, GeoPoint geoPoint) {
Log.i(DraggableMarkerOverlayActivity.this.getClass().getSimpleName(), "dropItemAtGeoPoint: " + geoPoint);
}
};
List<MarkerInterface> pts = new ArrayList<>();
for (double lat = -90; lat <= 90; lat += 45) {
for (double lon = -180; lon <= 180; lon += 45) {
pts.add(new DraggableMarkerItem(lat + "/" + lon, "", new GeoPoint(lat, lon), dragAndDropListener));
}
}
mMarkerLayer.addItems(pts);
}
@Override
protected void onResume() {
super.onResume();
/* ignore saved position */
mMap.setMapPosition(0, 0, 1 << 2);
}
}

View File

@@ -0,0 +1,57 @@
/*
* Copyright 2020 Meibes
*
* 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.app.Activity;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
@SuppressWarnings("deprecation")
public class FragmentActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_map_fragment);
setTitle(getClass().getSimpleName());
if (savedInstanceState == null) {
android.app.Fragment mapFragment = MapFragment.newInstance();
android.app.FragmentTransaction ft = getFragmentManager().beginTransaction();
ft.add(R.id.fragment_container, mapFragment).commit();
}
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.fragment_menu, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
if (item.getItemId() == R.id.replace_fragment) {
android.app.Fragment blankFragment = BlankFragment.newInstance();
android.app.FragmentTransaction ft = getFragmentManager().beginTransaction();
ft.replace(R.id.fragment_container, blankFragment);
ft.addToBackStack(null);
ft.commit();
return true;
}
return super.onOptionsItemSelected(item);
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2018-2019 devemux86
* Copyright 2018-2020 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
@@ -15,6 +15,9 @@
package org.oscim.android.test;
import android.app.Activity;
import android.content.Intent;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import org.oscim.android.MapView;
import org.oscim.backend.CanvasAdapter;
@@ -25,23 +28,24 @@ import org.oscim.renderer.GLViewport;
import org.oscim.scalebar.DefaultMapScaleBar;
import org.oscim.scalebar.MapScaleBar;
import org.oscim.scalebar.MapScaleBarLayer;
import org.oscim.theme.IRenderTheme;
import org.oscim.theme.VtmThemes;
import org.oscim.tiling.source.mapfile.MapFileTileSource;
import java.io.File;
import java.io.FileInputStream;
/**
* A very basic Android app example.
* <p>
* You'll need a map with filename berlin.map from download.mapsforge.org in device storage:
* /sdcard/Android/data/org.oscim.android.test/files/
* You'll need a map with filename berlin.map from download.mapsforge.org in device storage.
*/
public class GettingStarted extends Activity {
// Name of the map file in device storage
private static final String MAP_FILE = "berlin.map";
// Request code for selecting a map file
private static final int SELECT_MAP_FILE = 0;
private MapView mapView;
private IRenderTheme theme;
@Override
public void onCreate(Bundle savedInstanceState) {
@@ -51,10 +55,30 @@ public class GettingStarted extends Activity {
mapView = new MapView(this);
setContentView(mapView);
// Tile source
MapFileTileSource tileSource = new MapFileTileSource();
String mapPath = new File(getExternalFilesDir(null), MAP_FILE).getAbsolutePath();
if (tileSource.setMapFile(mapPath)) {
// Open map
Intent intent = new Intent(Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT ? Intent.ACTION_OPEN_DOCUMENT : Intent.ACTION_GET_CONTENT);
intent.addCategory(Intent.CATEGORY_OPENABLE);
intent.setType("*/*");
startActivityForResult(intent, SELECT_MAP_FILE);
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
if (requestCode == SELECT_MAP_FILE && resultCode == Activity.RESULT_OK) {
if (data != null) {
Uri uri = data.getData();
openMap(uri);
}
}
}
private void openMap(Uri uri) {
try {
// Tile source
MapFileTileSource tileSource = new MapFileTileSource();
FileInputStream fis = (FileInputStream) getContentResolver().openInputStream(uri);
tileSource.setMapFileInputStream(fis);
// Vector layer
VectorTileLayer tileLayer = mapView.map().setBaseMap(tileSource);
@@ -65,7 +89,7 @@ public class GettingStarted extends Activity {
mapView.map().layers().add(new LabelLayer(mapView.map(), tileLayer));
// Render theme
mapView.map().setTheme(VtmThemes.DEFAULT);
theme = mapView.map().setTheme(VtmThemes.DEFAULT);
// Scale bar
MapScaleBar mapScaleBar = new DefaultMapScaleBar(mapView.map());
@@ -76,6 +100,11 @@ public class GettingStarted extends Activity {
// Note: this map position is specific to Berlin area
mapView.map().setMapPosition(52.517037, 13.38886, 1 << 12);
} catch (Exception e) {
/*
* In case of map file errors avoid crash, but developers should handle these cases!
*/
e.printStackTrace();
}
}
@@ -94,6 +123,7 @@ public class GettingStarted extends Activity {
@Override
protected void onDestroy() {
mapView.onDestroy();
theme.dispose();
super.onDestroy();
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2016-2019 devemux86
* Copyright 2016-2021 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
@@ -96,6 +96,7 @@ public class LocationActivity extends BitmapTileActivity implements LocationList
public void onProviderEnabled(String provider) {
}
@SuppressWarnings("deprecation")
@Override
public void onStatusChanged(String provider, int status, Bundle extras) {
}
@@ -103,7 +104,7 @@ public class LocationActivity extends BitmapTileActivity implements LocationList
private void enableAvailableProviders() {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
if (checkSelfPermission(Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED) {
requestPermissions(new String[]{Manifest.permission.ACCESS_FINE_LOCATION}, 0);
requestPermissions(new String[]{Manifest.permission.ACCESS_COARSE_LOCATION, Manifest.permission.ACCESS_FINE_LOCATION}, 0);
return;
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2016-2019 devemux86
* Copyright 2016-2021 devemux86
* Copyright 2018 Longri
*
* This program is free software: you can redistribute it and/or modify it under the
@@ -126,6 +126,7 @@ public class LocationTextureActivity extends BitmapTileActivity implements Locat
public void onProviderEnabled(String provider) {
}
@SuppressWarnings("deprecation")
@Override
public void onStatusChanged(String provider, int status, Bundle extras) {
}
@@ -133,7 +134,7 @@ public class LocationTextureActivity extends BitmapTileActivity implements Locat
private void enableAvailableProviders() {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
if (checkSelfPermission(Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED) {
requestPermissions(new String[]{Manifest.permission.ACCESS_FINE_LOCATION}, 0);
requestPermissions(new String[]{Manifest.permission.ACCESS_COARSE_LOCATION, Manifest.permission.ACCESS_FINE_LOCATION}, 0);
return;
}
}

View File

@@ -41,7 +41,7 @@ public class MBTilesBitmapActivity extends BitmapTileActivity {
if (!file.exists()) {
AlertDialog.Builder builder = new AlertDialog.Builder(this)
.setTitle(R.string.warning)
.setMessage(getResources().getString(R.string.startup_message_mbtiles, file.getName(), file.getAbsolutePath()))
.setMessage(getResources().getString(R.string.startup_message_mbtiles))
.setPositiveButton(R.string.exit, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {

View File

@@ -45,7 +45,7 @@ public class MBTilesMvtActivity extends MapActivity {
if (!file.exists()) {
AlertDialog.Builder builder = new AlertDialog.Builder(this)
.setTitle(R.string.warning)
.setMessage(getResources().getString(R.string.startup_message_mbtiles, file.getName(), file.getAbsolutePath()))
.setMessage(getResources().getString(R.string.startup_message_mbtiles))
.setPositiveButton(R.string.exit, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {

View File

@@ -0,0 +1,124 @@
/*
* Copyright 2018-2020 devemux86
* Copyright 2020 Meibes
*
* 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 android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.RelativeLayout;
import org.oscim.android.MapView;
import org.oscim.backend.CanvasAdapter;
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.renderer.GLViewport;
import org.oscim.scalebar.DefaultMapScaleBar;
import org.oscim.scalebar.MapScaleBar;
import org.oscim.scalebar.MapScaleBarLayer;
import org.oscim.theme.IRenderTheme;
import org.oscim.theme.VtmThemes;
import org.oscim.tiling.source.mapfile.MapFileTileSource;
import java.io.File;
/**
* You'll need a map with filename berlin.map from download.mapsforge.org in device storage.
*/
@SuppressWarnings("deprecation")
public class MapFragment extends android.app.Fragment {
private MapView mapView;
private IRenderTheme theme;
public static MapFragment newInstance() {
MapFragment instance = new MapFragment();
Bundle args = new Bundle();
instance.setArguments(args);
return instance;
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
return inflater.inflate(R.layout.fragment_map, container, false);
}
@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
mapView = new MapView(getActivity());
RelativeLayout relativeLayout = view.findViewById(R.id.mapView);
relativeLayout.addView(mapView);
// Tile source
MapFileTileSource tileSource = new MapFileTileSource();
File file = new File(getActivity().getExternalFilesDir(null), "berlin.map");
tileSource.setMapFile(file.getAbsolutePath());
// Vector layer
VectorTileLayer tileLayer = mapView.map().setBaseMap(tileSource);
// Building layer
mapView.map().layers().add(new BuildingLayer(mapView.map(), tileLayer));
// Label layer
mapView.map().layers().add(new LabelLayer(mapView.map(), tileLayer));
// Render theme
theme = mapView.map().setTheme(VtmThemes.DEFAULT);
// Scale bar
MapScaleBar mapScaleBar = new DefaultMapScaleBar(mapView.map());
MapScaleBarLayer mapScaleBarLayer = new MapScaleBarLayer(mapView.map(), mapScaleBar);
mapScaleBarLayer.getRenderer().setPosition(GLViewport.Position.BOTTOM_LEFT);
mapScaleBarLayer.getRenderer().setOffset(5 * CanvasAdapter.getScale(), 0);
mapView.map().layers().add(mapScaleBarLayer);
// Note: this map position is specific to Berlin area
mapView.map().setMapPosition(52.517037, 13.38886, 1 << 12);
}
@Override
public void onResume() {
super.onResume();
if (mapView != null) {
mapView.onResume();
}
}
@Override
public void onPause() {
if (mapView != null) {
mapView.onPause();
}
super.onPause();
}
@Override
public void onDestroyView() {
if (mapView != null) {
mapView.onDestroy();
mapView = null;
}
if (theme != null) {
theme.dispose();
theme = null;
}
super.onDestroyView();
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2018-2019 devemux86
* Copyright 2018-2020 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
@@ -16,10 +16,10 @@ package org.oscim.android.test;
import android.os.Build;
import android.os.Bundle;
import okhttp3.Cache;
import okhttp3.CipherSuite;
import okhttp3.ConnectionSpec;
import okhttp3.OkHttpClient;
import org.oscim.android.cache.TileCache;
import org.oscim.layers.tile.bitmap.BitmapTileLayer;
import org.oscim.layers.tile.buildings.BuildingLayer;
import org.oscim.layers.tile.vector.VectorTileLayer;
@@ -30,6 +30,7 @@ import org.oscim.tiling.source.UrlTileSource;
import org.oscim.tiling.source.bitmap.DefaultSources;
import org.oscim.tiling.source.mvt.MapilionMvtTileSource;
import java.io.File;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
@@ -41,13 +42,18 @@ public class MapilionMvtActivity extends MapActivity {
private static final boolean USE_CACHE = false;
private TileCache mCache;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
OkHttpClient.Builder builder = new OkHttpClient.Builder();
if (USE_CACHE) {
// Cache the tiles into file system
File cacheDirectory = new File(getExternalCacheDir(), "tiles");
int cacheSize = 10 * 1024 * 1024; // 10 MB
Cache cache = new Cache(cacheDirectory, cacheSize);
builder.cache(cache);
}
// https://github.com/square/okhttp/issues/4053
if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.KITKAT) {
@@ -71,13 +77,6 @@ public class MapilionMvtActivity extends MapActivity {
//.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);
@@ -91,12 +90,4 @@ public class MapilionMvtActivity extends MapActivity {
mMap.layers().add(new BuildingLayer(mMap, l));
mMap.layers().add(new LabelLayer(mMap, l));
}
@Override
protected void onDestroy() {
super.onDestroy();
if (mCache != null)
mCache.dispose();
}
}

View File

@@ -1,8 +1,9 @@
/*
* Copyright 2014 Hannes Janetzek
* Copyright 2016-2018 devemux86
* Copyright 2016-2021 devemux86
* Copyright 2017 Longri
* Copyright 2018 Gustl22
* Copyright 2021 eddiemuc
*
* This file is part of the OpenScienceMap project (http://www.opensciencemap.org).
*
@@ -19,15 +20,18 @@
*/
package org.oscim.android.test;
import android.app.Activity;
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.content.Intent;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.provider.DocumentsContract;
import android.view.Menu;
import android.view.MenuItem;
import org.oscim.android.filepicker.FilePicker;
import org.oscim.android.filepicker.FilterByFileExtension;
import org.oscim.android.filepicker.ValidMapFile;
import org.oscim.android.filepicker.ValidRenderTheme;
import org.oscim.android.theme.ContentRenderTheme;
import org.oscim.android.theme.ContentResolverResourceProvider;
import org.oscim.backend.CanvasAdapter;
import org.oscim.core.MapElement;
import org.oscim.core.MapPosition;
@@ -42,23 +46,29 @@ import org.oscim.layers.tile.vector.labeling.LabelLayer;
import org.oscim.renderer.BitmapRenderer;
import org.oscim.renderer.GLViewport;
import org.oscim.renderer.bucket.RenderBuckets;
import org.oscim.scalebar.DefaultMapScaleBar;
import org.oscim.scalebar.ImperialUnitAdapter;
import org.oscim.scalebar.MapScaleBar;
import org.oscim.scalebar.MapScaleBarLayer;
import org.oscim.scalebar.MetricUnitAdapter;
import org.oscim.theme.ExternalRenderTheme;
import org.oscim.theme.ThemeUtils;
import org.oscim.theme.VtmThemes;
import org.oscim.scalebar.*;
import org.oscim.theme.*;
import org.oscim.theme.styles.AreaStyle;
import org.oscim.theme.styles.RenderStyle;
import org.oscim.tiling.source.mapfile.MapFileTileSource;
import org.oscim.tiling.source.mapfile.MapInfo;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.BufferedInputStream;
import java.io.FileInputStream;
import java.io.IOException;
import java.util.List;
import java.util.zip.ZipInputStream;
public class MapsforgeActivity extends MapActivity {
private static final Logger log = LoggerFactory.getLogger(MapsforgeActivity.class);
static final int SELECT_MAP_FILE = 0;
static final int SELECT_THEME_FILE = SELECT_MAP_FILE + 1;
private static final int SELECT_THEME_ARCHIVE = 1;
private static final int SELECT_THEME_DIR = 2;
static final int SELECT_THEME_FILE = 3;
private static final Tag ISSEA_TAG = new Tag("natural", "issea");
private static final Tag NOSEA_TAG = new Tag("natural", "nosea");
@@ -66,8 +76,10 @@ public class MapsforgeActivity extends MapActivity {
private TileGridLayer mGridLayer;
private Menu mMenu;
private boolean mS3db;
private final boolean mS3db;
IRenderTheme mTheme;
VectorTileLayer mTileLayer;
private Uri mThemeDirUri;
public MapsforgeActivity() {
this(false);
@@ -87,22 +99,10 @@ public class MapsforgeActivity extends MapActivity {
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
startActivityForResult(new Intent(this, MapFilePicker.class),
SELECT_MAP_FILE);
}
public static class MapFilePicker extends FilePicker {
public MapFilePicker() {
setFileDisplayFilter(new FilterByFileExtension(".map"));
setFileSelectFilter(new ValidMapFile());
}
}
public static class ThemeFilePicker extends FilePicker {
public ThemeFilePicker() {
setFileDisplayFilter(new FilterByFileExtension(".xml"));
setFileSelectFilter(new ValidRenderTheme());
}
Intent intent = new Intent(Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT ? Intent.ACTION_OPEN_DOCUMENT : Intent.ACTION_GET_CONTENT);
intent.addCategory(Intent.CATEGORY_OPENABLE);
intent.setType("*/*");
startActivityForResult(intent, SELECT_MAP_FILE);
}
@Override
@@ -117,33 +117,53 @@ public class MapsforgeActivity extends MapActivity {
switch (item.getItemId()) {
case R.id.theme_default:
mMap.setTheme(VtmThemes.DEFAULT);
if (mTheme != null)
mTheme.dispose();
mTheme = mMap.setTheme(VtmThemes.DEFAULT);
item.setChecked(true);
return true;
case R.id.theme_osmarender:
mMap.setTheme(VtmThemes.OSMARENDER);
if (mTheme != null)
mTheme.dispose();
mTheme = mMap.setTheme(VtmThemes.OSMARENDER);
item.setChecked(true);
return true;
case R.id.theme_osmagray:
mMap.setTheme(VtmThemes.OSMAGRAY);
if (mTheme != null)
mTheme.dispose();
mTheme = mMap.setTheme(VtmThemes.OSMAGRAY);
item.setChecked(true);
return true;
case R.id.theme_tubes:
mMap.setTheme(VtmThemes.TRONRENDER);
if (mTheme != null)
mTheme.dispose();
mTheme = mMap.setTheme(VtmThemes.TRONRENDER);
item.setChecked(true);
return true;
case R.id.theme_newtron:
mMap.setTheme(VtmThemes.NEWTRON);
if (mTheme != null)
mTheme.dispose();
mTheme = mMap.setTheme(VtmThemes.NEWTRON);
item.setChecked(true);
return true;
case R.id.theme_external_archive:
Intent intent = new Intent(Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT ? Intent.ACTION_OPEN_DOCUMENT : Intent.ACTION_GET_CONTENT);
intent.addCategory(Intent.CATEGORY_OPENABLE);
intent.setType("*/*");
startActivityForResult(intent, SELECT_THEME_ARCHIVE);
return true;
case R.id.theme_external:
startActivityForResult(new Intent(this, ThemeFilePicker.class),
SELECT_THEME_FILE);
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP)
return false;
intent = new Intent(Intent.ACTION_OPEN_DOCUMENT_TREE);
intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
startActivityForResult(intent, SELECT_THEME_DIR);
return true;
case R.id.gridlayer:
@@ -165,20 +185,23 @@ public class MapsforgeActivity extends MapActivity {
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent intent) {
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
if (requestCode == SELECT_MAP_FILE) {
if (resultCode != RESULT_OK || intent == null || intent.getStringExtra(FilePicker.SELECTED_FILE) == null) {
if (resultCode != Activity.RESULT_OK || data == null) {
finish();
return;
}
MapFileTileSource mTileSource = new MapFileTileSource();
//mTileSource.setPreferredLanguage("en");
String file = intent.getStringExtra(FilePicker.SELECTED_FILE);
if (mTileSource.setMapFile(file)) {
try {
Uri uri = data.getData();
mTileLayer = mMap.setBaseMap(mTileSource);
MapFileTileSource tileSource = new MapFileTileSource();
//tileSource.setPreferredLanguage("en");
FileInputStream fis = (FileInputStream) getContentResolver().openInputStream(uri);
tileSource.setMapFileInputStream(fis);
mTileLayer = mMap.setBaseMap(tileSource);
loadTheme(null);
if (mS3db)
@@ -187,58 +210,114 @@ public class MapsforgeActivity extends MapActivity {
mMap.layers().add(new BuildingLayer(mMap, mTileLayer));
mMap.layers().add(new LabelLayer(mMap, mTileLayer));
DefaultMapScaleBar mMapScaleBar = new DefaultMapScaleBar(mMap);
mMapScaleBar.setScaleBarMode(DefaultMapScaleBar.ScaleBarMode.BOTH);
mMapScaleBar.setDistanceUnitAdapter(MetricUnitAdapter.INSTANCE);
mMapScaleBar.setSecondaryDistanceUnitAdapter(ImperialUnitAdapter.INSTANCE);
mMapScaleBar.setScaleBarPosition(MapScaleBar.ScaleBarPosition.BOTTOM_LEFT);
DefaultMapScaleBar mapScaleBar = new DefaultMapScaleBar(mMap);
mapScaleBar.setScaleBarMode(DefaultMapScaleBar.ScaleBarMode.BOTH);
mapScaleBar.setDistanceUnitAdapter(MetricUnitAdapter.INSTANCE);
mapScaleBar.setSecondaryDistanceUnitAdapter(ImperialUnitAdapter.INSTANCE);
mapScaleBar.setScaleBarPosition(MapScaleBar.ScaleBarPosition.BOTTOM_LEFT);
MapScaleBarLayer mapScaleBarLayer = new MapScaleBarLayer(mMap, mMapScaleBar);
MapScaleBarLayer mapScaleBarLayer = new MapScaleBarLayer(mMap, mapScaleBar);
BitmapRenderer renderer = mapScaleBarLayer.getRenderer();
renderer.setPosition(GLViewport.Position.BOTTOM_LEFT);
renderer.setOffset(5 * CanvasAdapter.getScale(), 0);
mMap.layers().add(mapScaleBarLayer);
MapInfo info = mTileSource.getMapInfo();
MapInfo info = tileSource.getMapInfo();
if (!info.boundingBox.contains(mMap.getMapPosition().getGeoPoint())) {
MapPosition pos = new MapPosition();
pos.setByBoundingBox(info.boundingBox, Tile.SIZE * 4, Tile.SIZE * 4);
mMap.setMapPosition(pos);
mPrefs.clear();
}
} catch (Exception e) {
log.error(e.getMessage());
finish();
}
} else if (requestCode == SELECT_THEME_FILE) {
if (resultCode != RESULT_OK || intent == null || intent.getStringExtra(FilePicker.SELECTED_FILE) == null) {
} else if (requestCode == SELECT_THEME_ARCHIVE) {
if (resultCode != Activity.RESULT_OK || data == null)
return;
}
String file = intent.getStringExtra(FilePicker.SELECTED_FILE);
ExternalRenderTheme externalRenderTheme = new ExternalRenderTheme(file);
try {
final Uri uri = data.getData();
// Use tessellation with sea and land for Mapsforge themes
if (ThemeUtils.isMapsforgeTheme(externalRenderTheme)) {
mTileLayer.addHook(new VectorTileLayer.TileLoaderThemeHook() {
final List<String> xmlThemes = ZipXmlThemeResourceProvider.scanXmlThemes(new ZipInputStream(new BufferedInputStream(getContentResolver().openInputStream(uri))));
if (xmlThemes.isEmpty())
return;
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setTitle(R.string.dialog_theme_title);
builder.setSingleChoiceItems(xmlThemes.toArray(new String[0]), -1, new DialogInterface.OnClickListener() {
@Override
public boolean process(MapTile tile, RenderBuckets buckets, MapElement element, RenderStyle style, int level) {
if (element.tags.contains(ISSEA_TAG) || element.tags.contains(SEA_TAG) || element.tags.contains(NOSEA_TAG)) {
if (style instanceof AreaStyle)
((AreaStyle) style).mesh = true;
public void onClick(DialogInterface dialog, int which) {
try {
dialog.dismiss();
ThemeFile theme = new ZipRenderTheme(xmlThemes.get(which), new ZipXmlThemeResourceProvider(new ZipInputStream(new BufferedInputStream(getContentResolver().openInputStream(uri)))));
if (mTheme != null)
mTheme.dispose();
mTheme = mMap.setTheme(theme);
mapsforgeTheme(mTheme);
mMenu.findItem(R.id.theme_external_archive).setChecked(true);
} catch (IOException e) {
e.printStackTrace();
}
return false;
}
@Override
public void complete(MapTile tile, boolean success) {
}
});
builder.show();
} catch (IOException e) {
e.printStackTrace();
}
} else if (requestCode == SELECT_THEME_DIR) {
if (resultCode != Activity.RESULT_OK || data == null)
return;
mMap.setTheme(externalRenderTheme);
mThemeDirUri = data.getData();
// Now we have the directory for resources, but we need to let the user also select a theme file
Intent intent = new Intent(Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT ? Intent.ACTION_OPEN_DOCUMENT : Intent.ACTION_GET_CONTENT);
intent.addCategory(Intent.CATEGORY_OPENABLE);
intent.setType("*/*");
intent.putExtra(DocumentsContract.EXTRA_INITIAL_URI, mThemeDirUri);
startActivityForResult(intent, SELECT_THEME_FILE);
} else if (requestCode == SELECT_THEME_FILE) {
if (resultCode != Activity.RESULT_OK || data == null)
return;
Uri uri = data.getData();
ThemeFile theme = new ContentRenderTheme(getContentResolver(), uri);
theme.setResourceProvider(new ContentResolverResourceProvider(getContentResolver(), mThemeDirUri));
if (mTheme != null)
mTheme.dispose();
mTheme = mMap.setTheme(theme);
mapsforgeTheme(mTheme);
mMenu.findItem(R.id.theme_external).setChecked(true);
}
}
protected void loadTheme(final String styleId) {
mMap.setTheme(VtmThemes.DEFAULT);
if (mTheme != null)
mTheme.dispose();
mTheme = mMap.setTheme(VtmThemes.DEFAULT);
}
private void mapsforgeTheme(IRenderTheme theme) {
if (!theme.isMapsforgeTheme())
return;
// Use tessellation with sea and land for Mapsforge themes
mTileLayer.addHook(new VectorTileLayer.TileLoaderThemeHook() {
@Override
public boolean process(MapTile tile, RenderBuckets buckets, MapElement element, RenderStyle style, int level) {
if (element.tags.contains(ISSEA_TAG) || element.tags.contains(SEA_TAG) || element.tags.contains(NOSEA_TAG)) {
if (style instanceof AreaStyle)
((AreaStyle) style).mesh = true;
}
return false;
}
@Override
public void complete(MapTile tile, boolean success) {
}
});
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2016-2017 devemux86
* Copyright 2016-2020 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
@@ -17,7 +17,6 @@ package org.oscim.android.test;
import android.view.Menu;
import android.view.MenuItem;
import android.widget.Toast;
import org.oscim.android.theme.AssetsRenderTheme;
import org.oscim.theme.XmlRenderThemeMenuCallback;
import org.oscim.theme.XmlRenderThemeStyleLayer;
@@ -58,7 +57,9 @@ public class MapsforgeStyleActivity extends MapsforgeActivity {
@Override
protected void loadTheme(final String styleId) {
mMap.setTheme(new AssetsRenderTheme(getAssets(), "", "vtm/stylemenu.xml", new XmlRenderThemeMenuCallback() {
if (mTheme != null)
mTheme.dispose();
mTheme = mMap.setTheme(new AssetsRenderTheme(getAssets(), "", "vtm/stylemenu.xml", new XmlRenderThemeMenuCallback() {
@Override
public Set<String> getCategories(XmlRenderThemeStyleMenu renderThemeStyleMenu) {
// Use the selected style or the default

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2017-2018 devemux86
* Copyright 2017-2020 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
@@ -15,8 +15,8 @@
package org.oscim.android.test;
import android.os.Bundle;
import org.oscim.android.cache.TileCache;
import okhttp3.Cache;
import okhttp3.OkHttpClient;
import org.oscim.layers.tile.buildings.BuildingLayer;
import org.oscim.layers.tile.vector.VectorTileLayer;
import org.oscim.layers.tile.vector.labeling.LabelLayer;
@@ -25,41 +25,35 @@ import org.oscim.tiling.source.OkHttpEngine;
import org.oscim.tiling.source.UrlTileSource;
import org.oscim.tiling.source.geojson.MapzenGeojsonTileSource;
import java.io.File;
public class MapzenGeojsonActivity extends MapActivity {
private static final boolean USE_CACHE = false;
private TileCache mCache;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
OkHttpClient.Builder builder = new OkHttpClient.Builder();
if (USE_CACHE) {
// Cache the tiles into file system
File cacheDirectory = new File(getExternalCacheDir(), "tiles");
int cacheSize = 10 * 1024 * 1024; // 10 MB
Cache cache = new Cache(cacheDirectory, cacheSize);
builder.cache(cache);
}
UrlTileSource tileSource = MapzenGeojsonTileSource.builder()
.apiKey("xxxxxxx") // Put a proper API key
.httpFactory(new OkHttpEngine.OkHttpFactory())
.httpFactory(new OkHttpEngine.OkHttpFactory(builder))
//.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.MAPZEN);
mMap.layers().add(new BuildingLayer(mMap, l));
mMap.layers().add(new LabelLayer(mMap, l));
}
@Override
protected void onDestroy() {
super.onDestroy();
if (mCache != null)
mCache.dispose();
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2016-2018 devemux86
* Copyright 2016-2020 devemux86
* Copyright 2017 Mathieu De Brito
*
* This program is free software: you can redistribute it and/or modify it under the
@@ -16,8 +16,8 @@
package org.oscim.android.test;
import android.os.Bundle;
import org.oscim.android.cache.TileCache;
import okhttp3.Cache;
import okhttp3.OkHttpClient;
import org.oscim.layers.tile.buildings.BuildingLayer;
import org.oscim.layers.tile.vector.VectorTileLayer;
import org.oscim.layers.tile.vector.labeling.LabelLayer;
@@ -26,41 +26,35 @@ import org.oscim.tiling.source.OkHttpEngine;
import org.oscim.tiling.source.UrlTileSource;
import org.oscim.tiling.source.mvt.MapzenMvtTileSource;
import java.io.File;
public class MapzenMvtActivity extends MapActivity {
private static final boolean USE_CACHE = false;
private TileCache mCache;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
OkHttpClient.Builder builder = new OkHttpClient.Builder();
if (USE_CACHE) {
// Cache the tiles into file system
File cacheDirectory = new File(getExternalCacheDir(), "tiles");
int cacheSize = 10 * 1024 * 1024; // 10 MB
Cache cache = new Cache(cacheDirectory, cacheSize);
builder.cache(cache);
}
UrlTileSource tileSource = MapzenMvtTileSource.builder()
.apiKey("xxxxxxx") // Put a proper API key
.httpFactory(new OkHttpEngine.OkHttpFactory())
.httpFactory(new OkHttpEngine.OkHttpFactory(builder))
//.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.MAPZEN);
mMap.layers().add(new BuildingLayer(mMap, l));
mMap.layers().add(new LabelLayer(mMap, l));
}
@Override
protected void onDestroy() {
super.onDestroy();
if (mCache != null)
mCache.dispose();
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2018 devemux86
* Copyright 2018-2020 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
@@ -15,8 +15,8 @@
package org.oscim.android.test;
import android.os.Bundle;
import org.oscim.android.cache.TileCache;
import okhttp3.Cache;
import okhttp3.OkHttpClient;
import org.oscim.layers.tile.buildings.BuildingLayer;
import org.oscim.layers.tile.vector.VectorTileLayer;
import org.oscim.layers.tile.vector.labeling.LabelLayer;
@@ -25,41 +25,35 @@ import org.oscim.tiling.source.OkHttpEngine;
import org.oscim.tiling.source.UrlTileSource;
import org.oscim.tiling.source.geojson.NextzenGeojsonTileSource;
import java.io.File;
public class NextzenGeojsonActivity extends MapActivity {
private static final boolean USE_CACHE = false;
private TileCache mCache;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
OkHttpClient.Builder builder = new OkHttpClient.Builder();
if (USE_CACHE) {
// Cache the tiles into file system
File cacheDirectory = new File(getExternalCacheDir(), "tiles");
int cacheSize = 10 * 1024 * 1024; // 10 MB
Cache cache = new Cache(cacheDirectory, cacheSize);
builder.cache(cache);
}
UrlTileSource tileSource = NextzenGeojsonTileSource.builder()
.apiKey("xxxxxxx") // Put a proper API key
.httpFactory(new OkHttpEngine.OkHttpFactory())
.httpFactory(new OkHttpEngine.OkHttpFactory(builder))
//.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.MAPZEN);
mMap.layers().add(new BuildingLayer(mMap, l));
mMap.layers().add(new LabelLayer(mMap, l));
}
@Override
protected void onDestroy() {
super.onDestroy();
if (mCache != null)
mCache.dispose();
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2018 devemux86
* Copyright 2018-2020 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
@@ -15,8 +15,8 @@
package org.oscim.android.test;
import android.os.Bundle;
import org.oscim.android.cache.TileCache;
import okhttp3.Cache;
import okhttp3.OkHttpClient;
import org.oscim.layers.tile.buildings.BuildingLayer;
import org.oscim.layers.tile.vector.VectorTileLayer;
import org.oscim.layers.tile.vector.labeling.LabelLayer;
@@ -25,41 +25,35 @@ import org.oscim.tiling.source.OkHttpEngine;
import org.oscim.tiling.source.UrlTileSource;
import org.oscim.tiling.source.mvt.NextzenMvtTileSource;
import java.io.File;
public class NextzenMvtActivity extends MapActivity {
private static final boolean USE_CACHE = false;
private TileCache mCache;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
OkHttpClient.Builder builder = new OkHttpClient.Builder();
if (USE_CACHE) {
// Cache the tiles into file system
File cacheDirectory = new File(getExternalCacheDir(), "tiles");
int cacheSize = 10 * 1024 * 1024; // 10 MB
Cache cache = new Cache(cacheDirectory, cacheSize);
builder.cache(cache);
}
UrlTileSource tileSource = NextzenMvtTileSource.builder()
.apiKey("xxxxxxx") // Put a proper API key
.httpFactory(new OkHttpEngine.OkHttpFactory())
.httpFactory(new OkHttpEngine.OkHttpFactory(builder))
//.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.MAPZEN);
mMap.layers().add(new BuildingLayer(mMap, l));
mMap.layers().add(new LabelLayer(mMap, l));
}
@Override
protected void onDestroy() {
super.onDestroy();
if (mCache != null)
mCache.dispose();
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2016-2018 devemux86
* Copyright 2016-2020 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
@@ -15,8 +15,8 @@
package org.oscim.android.test;
import android.os.Bundle;
import org.oscim.android.cache.TileCache;
import okhttp3.Cache;
import okhttp3.OkHttpClient;
import org.oscim.layers.tile.buildings.BuildingLayer;
import org.oscim.layers.tile.vector.VectorTileLayer;
import org.oscim.layers.tile.vector.labeling.LabelLayer;
@@ -25,41 +25,35 @@ import org.oscim.tiling.source.OkHttpEngine;
import org.oscim.tiling.source.UrlTileSource;
import org.oscim.tiling.source.mvt.OpenMapTilesMvtTileSource;
import java.io.File;
public class OpenMapTilesMvtActivity extends MapActivity {
private static final boolean USE_CACHE = false;
private TileCache mCache;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
OkHttpClient.Builder builder = new OkHttpClient.Builder();
if (USE_CACHE) {
// Cache the tiles into file system
File cacheDirectory = new File(getExternalCacheDir(), "tiles");
int cacheSize = 10 * 1024 * 1024; // 10 MB
Cache cache = new Cache(cacheDirectory, cacheSize);
builder.cache(cache);
}
UrlTileSource tileSource = OpenMapTilesMvtTileSource.builder()
.apiKey("xxxxxxx") // Put a proper API key
.httpFactory(new OkHttpEngine.OkHttpFactory())
.httpFactory(new OkHttpEngine.OkHttpFactory(builder))
//.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));
}
@Override
protected void onDestroy() {
super.onDestroy();
if (mCache != null)
mCache.dispose();
}
}

View File

@@ -18,7 +18,6 @@ package org.oscim.android.test;
import android.content.Context;
import android.content.Intent;
import android.graphics.BitmapFactory;
import android.os.AsyncTask;
import android.os.Bundle;
import android.text.Editable;
import android.text.TextWatcher;
@@ -58,6 +57,7 @@ import java.util.List;
* Long press on map to search inside visible bounding box.<br/>
* Tap on POIs to show their name (in default locale).
*/
@SuppressWarnings("deprecation")
public class PoiSearchActivity extends MapsforgeActivity implements ItemizedLayer.OnItemGestureListener<MarkerInterface> {
private static final Logger log = LoggerFactory.getLogger(PoiSearchActivity.class);
@@ -275,7 +275,7 @@ public class PoiSearchActivity extends MapsforgeActivity implements ItemizedLaye
}
}
private class PoiSearchTask extends AsyncTask<BoundingBox, Void, Collection<PointOfInterest>> {
private class PoiSearchTask extends android.os.AsyncTask<BoundingBox, Void, Collection<PointOfInterest>> {
private final WeakReference<PoiSearchActivity> weakActivity;
private final String category;
private final List<Tag> patterns;

View File

@@ -28,7 +28,6 @@ package org.oscim.android.test;
import android.app.Activity;
import android.content.Intent;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.view.Gravity;
@@ -87,8 +86,8 @@ public class Samples extends Activity {
LinearLayout linearLayout = findViewById(R.id.samples);
linearLayout.addView(createButton(GettingStarted.class));
linearLayout.addView(createLabel(null));
linearLayout.addView(createButton(SimpleMapActivity.class));
linearLayout.addView(createButton(MapsforgeActivity.class));
linearLayout.addView(createButton(SimpleMapActivity.class));
linearLayout.addView(createButton(MBTilesMvtActivity.class));
linearLayout.addView(createButton(MapilionMvtActivity.class));
/*linearLayout.addView(createButton(MapzenMvtActivity.class));
@@ -125,6 +124,8 @@ public class Samples extends Activity {
linearLayout.addView(createButton(JeoIndoorActivity.class));
linearLayout.addView(createButton(GdxPoi3DActivity.class));
linearLayout.addView(createButton(OverpassActivity.class));
linearLayout.addView(createButton(DraggableMarkerOverlayActivity.class));
linearLayout.addView(createButton(ClusterMarkerOverlayActivity.class));
linearLayout.addView(createButton(FragmentActivity.class));
}
}

View File

@@ -1,2 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<manifest package="org.oscim.gdx" />

View File

@@ -1,57 +1,31 @@
apply plugin: 'com.android.library'
apply plugin: 'com.github.dcendents.android-maven'
apply plugin: 'java-library'
apply plugin: 'maven-publish'
dependencies {
compileOnly files("${System.env.ANDROID_HOME}/platforms/android-${androidCompileSdk()}/android.jar")
api project(':vtm')
api "com.badlogicgames.gdx:gdx-backend-android:$gdxVersion"
}
android {
compileSdkVersion androidCompileSdk()
buildToolsVersion "$androidBuildVersionTools"
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
defaultConfig {
versionCode project.versionCode()
versionName project.versionName()
minSdkVersion androidMinSdk()
targetSdkVersion androidTargetSdk()
}
sourceSets {
main {
manifest.srcFile 'AndroidManifest.xml'
java.srcDirs = ['src']
}
debug.setRoot('build-types/debug')
release.setRoot('build-types/release')
}
lintOptions { abortOnError false }
sourceSets {
main.java.srcDirs = ['src']
}
android.libraryVariants.all { variant ->
def name = variant.buildType.name
if (name == "debug")
return
file('natives').eachDir() { dir ->
task("nativesJar-${dir.name}", type: Jar) {
classifier "natives-${dir.name}"
from(dir.path)
}
}
def jar = project.tasks.create "jar${name.capitalize()}", Jar
jar.dependsOn variant.javaCompileProvider
jar.exclude '**/BuildConfig.class'
jar.exclude '**/R.class'
jar.exclude '**/R$*.class'
jar.from variant.javaCompileProvider.get().destinationDir
artifacts.add('archives', jar)
file('natives').eachDir() { dir ->
def nativesJar = project.tasks.create "nativesJar${name.capitalize()}-${dir.name}", Jar
nativesJar.classifier = "natives-${dir.name}"
nativesJar.from(dir.path)
artifacts.add('archives', nativesJar)
publishing {
publications {
maven(MavenPublication) {
from components.java
file('natives').eachDir() { dir ->
artifact tasks["nativesJar-${dir.name}"]
}
}
}
}

View File

@@ -35,12 +35,12 @@ package org.oscim.gdx;
import android.annotation.SuppressLint;
import android.opengl.GLES30;
import org.oscim.backend.GL30;
/**
* See https://github.com/libgdx/libgdx/blob/master/backends/gdx-backend-android/src/com/badlogic/gdx/backends/android/AndroidGL30.java
*/
@SuppressWarnings("deprecation")
@SuppressLint("NewApi")
public class AndroidGL30 extends AndroidGL implements GL30 {
@Override

View File

@@ -1,2 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<manifest package="org.oscim.android.mvt" />

View File

@@ -1,51 +1,22 @@
apply plugin: 'com.android.library'
apply plugin: 'com.github.dcendents.android-maven'
apply plugin: 'java-library'
apply plugin: 'maven-publish'
dependencies {
compileOnly files("${System.env.ANDROID_HOME}/platforms/android-${androidCompileSdk()}/android.jar")
api project(':vtm-android')
api project(':vtm-mvt')
}
android {
compileSdkVersion androidCompileSdk()
buildToolsVersion "$androidBuildVersionTools"
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
defaultConfig {
versionCode project.versionCode()
versionName project.versionName()
minSdkVersion androidMinSdk()
targetSdkVersion androidTargetSdk()
}
sourceSets {
main {
manifest.srcFile 'AndroidManifest.xml'
java.srcDirs = ['src']
}
debug.setRoot('build-types/debug')
release.setRoot('build-types/release')
}
lintOptions { abortOnError false }
sourceSets {
main.java.srcDirs = ['src']
}
android.libraryVariants.all { variant ->
def name = variant.buildType.name
if (name == "debug")
return
def jar = project.tasks.create "jar${name.capitalize()}", Jar
jar.dependsOn variant.javaCompileProvider
jar.exclude '**/BuildConfig.class'
jar.exclude '**/R.class'
jar.exclude '**/R$*.class'
jar.from variant.javaCompileProvider.get().destinationDir
artifacts.add('archives', jar)
publishing {
publications {
maven(MavenPublication) {
from components.java
}
}
}
if (project.hasProperty("SONATYPE_USERNAME")) {

View File

@@ -1,2 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<manifest package="org.oscim.android" />

View File

@@ -1,57 +1,31 @@
apply plugin: 'com.android.library'
apply plugin: 'com.github.dcendents.android-maven'
apply plugin: 'java-library'
apply plugin: 'maven-publish'
dependencies {
compileOnly files("${System.env.ANDROID_HOME}/platforms/android-${androidCompileSdk()}/android.jar")
api project(':vtm')
api 'com.caverock:androidsvg:1.4'
}
android {
compileSdkVersion androidCompileSdk()
buildToolsVersion "$androidBuildVersionTools"
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
defaultConfig {
versionCode project.versionCode()
versionName project.versionName()
minSdkVersion androidMinSdk()
targetSdkVersion androidTargetSdk()
}
sourceSets {
main {
manifest.srcFile 'AndroidManifest.xml'
java.srcDirs = ['src']
}
debug.setRoot('build-types/debug')
release.setRoot('build-types/release')
}
lintOptions { abortOnError false }
sourceSets {
main.java.srcDirs = ['src']
}
android.libraryVariants.all { variant ->
def name = variant.buildType.name
if (name == "debug")
return
file('natives').eachDir() { dir ->
task("nativesJar-${dir.name}", type: Jar) {
classifier "natives-${dir.name}"
from(dir.path)
}
}
def jar = project.tasks.create "jar${name.capitalize()}", Jar
jar.dependsOn variant.javaCompileProvider
jar.exclude '**/BuildConfig.class'
jar.exclude '**/R.class'
jar.exclude '**/R$*.class'
jar.from variant.javaCompileProvider.get().destinationDir
artifacts.add('archives', jar)
file('natives').eachDir() { dir ->
def nativesJar = project.tasks.create "nativesJar${name.capitalize()}-${dir.name}", Jar
nativesJar.classifier = "natives-${dir.name}"
nativesJar.from(dir.path)
artifacts.add('archives', nativesJar)
publishing {
publications {
maven(MavenPublication) {
from components.java
file('natives').eachDir() { dir ->
artifact tasks["nativesJar-${dir.name}"]
}
}
}
}

View File

@@ -92,6 +92,7 @@ public class MapView extends GLSurfaceView {
this(context, null);
}
@SuppressWarnings("deprecation")
public MapView(Context context, AttributeSet attributeSet) {
super(context, attributeSet);

View File

@@ -1,7 +1,7 @@
/*
* Copyright 2013 Hannes Janetzek
* Copyright 2016 Longri
* Copyright 2016-2018 devemux86
* Copyright 2016-2021 devemux86
*
* This file is part of the OpenScienceMap project (http://www.opensciencemap.org).
*
@@ -22,7 +22,6 @@ import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.opengl.GLES20;
import android.opengl.GLUtils;
import org.oscim.backend.CanvasAdapter;
import org.oscim.utils.GraphicUtils;
import org.oscim.utils.IOUtils;
@@ -39,6 +38,7 @@ public class AndroidBitmap implements org.oscim.backend.canvas.Bitmap {
Bitmap bitmap = BitmapFactory.decodeStream(inputStream);
try {
GLUtils.getType(bitmap);
GLUtils.getInternalFormat(bitmap);
} catch (IllegalArgumentException e) {
bitmap = bitmap.copy(ARGB_8888, false);
}
@@ -95,6 +95,9 @@ public class AndroidBitmap implements org.oscim.backend.canvas.Bitmap {
@Override
public void uploadToTexture(boolean replace) {
if (mBitmap.isRecycled())
return;
int format = GLUtils.getInternalFormat(mBitmap);
int type = GLUtils.getType(mBitmap);

View File

@@ -30,6 +30,7 @@ import org.oscim.backend.canvas.Canvas;
import org.oscim.backend.canvas.Paint;
import org.oscim.layers.marker.MarkerSymbol;
import org.oscim.layers.marker.MarkerSymbol.HotspotPlace;
import org.oscim.theme.XmlThemeResourceProvider;
import java.io.IOException;
import java.io.InputStream;
@@ -69,8 +70,8 @@ public final class AndroidGraphics extends CanvasAdapter {
}
@Override
public Bitmap loadBitmapAssetImpl(String relativePathPrefix, String src, int width, int height, int percent) throws IOException {
return createBitmap(relativePathPrefix, src, width, height, percent);
public Bitmap loadBitmapAssetImpl(String relativePathPrefix, String src, XmlThemeResourceProvider resourceProvider, int width, int height, int percent) throws IOException {
return createBitmap(relativePathPrefix, src, resourceProvider, width, height, percent);
}
@Override
@@ -106,6 +107,9 @@ public final class AndroidGraphics extends CanvasAdapter {
return new AndroidBitmap(bitmap);
}
/**
* @deprecated
*/
public static Bitmap drawableToBitmap(Resources res, int resId) {
return drawableToBitmap(res.getDrawable(resId));
}

View File

@@ -35,12 +35,12 @@ package org.oscim.android.gl;
import android.annotation.SuppressLint;
import android.opengl.GLES30;
import org.oscim.backend.GL30;
/**
* See https://github.com/libgdx/libgdx/blob/master/backends/gdx-backend-android/src/com/badlogic/gdx/backends/android/AndroidGL30.java
*/
@SuppressWarnings("deprecation")
@SuppressLint("NewApi")
public class AndroidGL30 extends AndroidGL implements GL30 {
@Override

View File

@@ -1,7 +1,8 @@
/*
* Copyright 2010, 2011, 2012 mapsforge.org
* Copyright 2016-2017 devemux86
* Copyright 2016-2021 devemux86
* Copyright 2017 Andrey Novikov
* Copyright 2021 eddiemuc
*
* 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
@@ -18,11 +19,10 @@ package org.oscim.android.theme;
import android.content.res.AssetManager;
import android.text.TextUtils;
import org.oscim.theme.IRenderTheme.ThemeException;
import org.oscim.theme.ThemeFile;
import org.oscim.theme.ThemeUtils;
import org.oscim.theme.XmlRenderThemeMenuCallback;
import org.oscim.theme.XmlThemeResourceProvider;
import org.oscim.utils.Utils;
import java.io.IOException;
@@ -37,8 +37,10 @@ public class AssetsRenderTheme implements ThemeFile {
private final AssetManager mAssetManager;
private final String mFileName;
private boolean mMapsforgeTheme;
private XmlRenderThemeMenuCallback mMenuCallback;
private final String mRelativePathPrefix;
private XmlThemeResourceProvider mResourceProvider;
/**
* @param assetManager the Android asset manager.
@@ -100,13 +102,28 @@ public class AssetsRenderTheme implements ThemeFile {
}
}
@Override
public XmlThemeResourceProvider getResourceProvider() {
return mResourceProvider;
}
@Override
public boolean isMapsforgeTheme() {
return ThemeUtils.isMapsforgeTheme(this);
return mMapsforgeTheme;
}
@Override
public void setMapsforgeTheme(boolean mapsforgeTheme) {
mMapsforgeTheme = mapsforgeTheme;
}
@Override
public void setMenuCallback(XmlRenderThemeMenuCallback menuCallback) {
mMenuCallback = menuCallback;
}
@Override
public void setResourceProvider(XmlThemeResourceProvider resourceProvider) {
mResourceProvider = resourceProvider;
}
}

View File

@@ -0,0 +1,119 @@
/*
* Copyright 2020-2021 devemux86
* Copyright 2021 eddiemuc
*
* 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.theme;
import android.content.ContentResolver;
import android.net.Uri;
import org.oscim.theme.IRenderTheme.ThemeException;
import org.oscim.theme.ThemeFile;
import org.oscim.theme.XmlRenderThemeMenuCallback;
import org.oscim.theme.XmlThemeResourceProvider;
import java.io.IOException;
import java.io.InputStream;
/**
* An ContentRenderTheme allows for customizing the rendering style of the map
* via an XML from the Android content providers.
*/
public class ContentRenderTheme implements ThemeFile {
private static final long serialVersionUID = 1L;
private final ContentResolver mContentResolver;
private boolean mMapsforgeTheme;
private XmlRenderThemeMenuCallback mMenuCallback;
private XmlThemeResourceProvider mResourceProvider;
private final Uri mUri;
/**
* @param contentResolver the Android content resolver.
* @param uri the XML render theme URI.
* @throws ThemeException if an error occurs while reading the render theme XML.
*/
public ContentRenderTheme(ContentResolver contentResolver, Uri uri) throws ThemeException {
this(contentResolver, uri, null);
}
/**
* @param contentResolver the Android content resolver.
* @param uri the XML render theme URI.
* @param menuCallback the interface callback to create a settings menu on the fly.
* @throws ThemeException if an error occurs while reading the render theme XML.
*/
public ContentRenderTheme(ContentResolver contentResolver, Uri uri, XmlRenderThemeMenuCallback menuCallback) throws ThemeException {
mContentResolver = contentResolver;
mUri = uri;
mMenuCallback = menuCallback;
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
} else if (!(obj instanceof ContentRenderTheme)) {
return false;
}
ContentRenderTheme other = (ContentRenderTheme) obj;
if (getRenderThemeAsStream() != other.getRenderThemeAsStream()) {
return false;
}
return true;
}
@Override
public XmlRenderThemeMenuCallback getMenuCallback() {
return mMenuCallback;
}
@Override
public String getRelativePathPrefix() {
return "";
}
@Override
public InputStream getRenderThemeAsStream() throws ThemeException {
try {
return mContentResolver.openInputStream(mUri);
} catch (IOException e) {
throw new ThemeException(e.getMessage());
}
}
@Override
public XmlThemeResourceProvider getResourceProvider() {
return mResourceProvider;
}
@Override
public boolean isMapsforgeTheme() {
return mMapsforgeTheme;
}
@Override
public void setMapsforgeTheme(boolean mapsforgeTheme) {
mMapsforgeTheme = mapsforgeTheme;
}
@Override
public void setMenuCallback(XmlRenderThemeMenuCallback menuCallback) {
mMenuCallback = menuCallback;
}
@Override
public void setResourceProvider(XmlThemeResourceProvider resourceProvider) {
mResourceProvider = resourceProvider;
}
}

View File

@@ -0,0 +1,179 @@
/*
* Copyright 2021 eddiemuc
*
* 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.theme;
import android.content.ContentResolver;
import android.content.Intent;
import android.database.Cursor;
import android.net.Uri;
import android.os.Build;
import android.provider.DocumentsContract;
import org.oscim.backend.CanvasAdapter;
import org.oscim.theme.XmlThemeResourceProvider;
import org.oscim.utils.IOUtils;
import java.io.FileNotFoundException;
import java.io.InputStream;
import java.util.*;
/**
* An xml theme resource provider resolving resources using Android scoped storage (document framework).
* <p>
* Implementation note: these methods do not use DocumentFile internally,
* but query directly for document info due to vastly better performance.
* Also for better performance, this implementation caches resource uris.
* <p>
* Note: this implementation requires minimum Android 5.0 (API 21)
*/
public class ContentResolverResourceProvider implements XmlThemeResourceProvider {
private final ContentResolver contentResolver;
private final Uri relativeRootUri;
private final boolean isDocumentUri;
private final Map<String, Uri> resourceUriCache = new HashMap<>();
private static class DocumentInfo {
private final String name;
private final Uri uri;
private final boolean isDirectory;
private DocumentInfo(String name, Uri uri, boolean isDirectory) {
this.name = name;
this.uri = uri;
this.isDirectory = isDirectory;
}
}
/**
* Creates a new content resolver resource provider.
*
* @param contentResolver content resolver used to read content.
* @param relativeRootUri uri pointing to a directory.
* Uri is assumed to be a pure tree Uri (as e.g. returned by {@link Intent#ACTION_OPEN_DOCUMENT_TREE}).
*/
public ContentResolverResourceProvider(ContentResolver contentResolver, Uri relativeRootUri) {
this(contentResolver, relativeRootUri, false);
}
/**
* Creates a new content resolver resource provider.
*
* @param contentResolver content resolver used to read content.
* @param relativeRootUri uri pointing to a directory.
* @param isDocumentUri Uris as returned e.g. by {@link Intent#ACTION_OPEN_DOCUMENT_TREE}) cannot directly be used to scan directories and read content.
* They must be converted to document uris first using {@link DocumentsContract#buildChildDocumentsUriUsingTree(Uri, String)}.
* However, in some situations this conversion was done previously by caller (e.g. if root dir should be subdirectory of a directory returned by {@link Intent#ACTION_OPEN_DOCUMENT_TREE}).
* In these cases, converted Uri will point to original root directory which is not always the wanted behaviour.
* Thus, this parameter allows caller to control whether conversion should be done or not.
* If set to true, then given Uri is considered to be a document uri already and no conversion is done.
* If set to false, uri is considered to be a pure tree uri as returned e.g. by {@link Intent#ACTION_OPEN_DOCUMENT_TREE}) and it is converted.
*/
public ContentResolverResourceProvider(ContentResolver contentResolver, Uri relativeRootUri, boolean isDocumentUri) {
this.contentResolver = contentResolver;
this.relativeRootUri = relativeRootUri;
this.isDocumentUri = isDocumentUri;
refreshCache();
}
/**
* Build uri cache for one dir level (recursive function).
*/
private void buildCacheLevel(String prefix, Uri dirUri) {
List<DocumentInfo> docs = queryDir(dirUri);
for (DocumentInfo doc : docs) {
if (doc.isDirectory) {
buildCacheLevel(prefix + doc.name + "/", doc.uri);
} else {
// Store both relative urls and absolute urls
resourceUriCache.put(CanvasAdapter.PREFIX_FILE + prefix + doc.name, doc.uri);
resourceUriCache.put(CanvasAdapter.PREFIX_FILE + "/" + prefix + doc.name, doc.uri);
}
}
}
@Override
public InputStream createInputStream(String relativePath, String source) throws FileNotFoundException {
Uri docUri = resourceUriCache.get(source);
if (docUri != null) {
return contentResolver.openInputStream(docUri);
}
return null;
}
/**
* Query the content of a directory using scoped storage.
*
* @return a list of arrays with info [0: name (String), 1: uri (Uri), 2: isDir (boolean)]
*/
private List<DocumentInfo> queryDir(Uri dirUri) {
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) {
return Collections.emptyList();
}
if (dirUri == null) {
return Collections.emptyList();
}
List<DocumentInfo> result = new ArrayList<>();
Uri childrenUri = DocumentsContract.buildChildDocumentsUriUsingTree(dirUri, DocumentsContract.getDocumentId(dirUri));
String[] columns = new String[]{
DocumentsContract.Document.COLUMN_DOCUMENT_ID,
DocumentsContract.Document.COLUMN_DISPLAY_NAME,
DocumentsContract.Document.COLUMN_MIME_TYPE
};
Cursor c = null;
try {
c = contentResolver.query(childrenUri, columns, null, null, null);
while (c.moveToNext()) {
String documentId = c.getString(0);
String name = c.getString(1);
String mimeType = c.getString(2);
Uri uri = DocumentsContract.buildDocumentUriUsingTree(dirUri, documentId);
boolean isDir = DocumentsContract.Document.MIME_TYPE_DIR.equals(mimeType);
result.add(new DocumentInfo(name, uri, isDir));
}
return result;
} finally {
IOUtils.closeQuietly(c);
}
}
/**
* Refresh the uri cache by recreating it.
*/
private void refreshCache() {
resourceUriCache.clear();
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) {
return;
}
if (relativeRootUri == null) {
return;
}
Uri dirUri = relativeRootUri;
if (!isDocumentUri) {
// Convert "tree uri" to a "document uri"
dirUri = DocumentsContract.buildDocumentUriUsingTree(dirUri, DocumentsContract.getTreeDocumentId(dirUri));
}
buildCacheLevel("", dirUri);
}
}

View File

@@ -5,6 +5,7 @@
android:versionCode="1"
android:versionName="1.0">
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.INTERNET" />
@@ -15,12 +16,14 @@
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/application_name"
android:requestLegacyExternalStorage="true"
android:usesCleartextTraffic="true">
<!-- android:theme="@style/Theme.TileMap" -->
<activity
android:name=".TileMap"
android:configChanges="keyboardHidden|orientation|screenSize"
android:exported="true"
android:launchMode="singleTask">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

View File

@@ -5,24 +5,23 @@ dependencies {
implementation project(':vtm-extras')
implementation project(':vtm-themes')
// https://github.com/square/okhttp/issues/4481
implementation 'com.squareup.okhttp3:okhttp:3.12.5'
implementation 'com.squareup.okhttp3:okhttp:3.12.13'
implementation "org.slf4j:slf4j-android:$slf4jVersion"
}
android {
compileSdkVersion androidCompileSdk()
buildToolsVersion "$androidBuildVersionTools"
compileSdk androidCompileSdk()
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
defaultConfig {
versionCode project.versionCode()
versionName project.versionName()
minSdkVersion androidMinSdk()
targetSdkVersion androidTargetSdk()
minSdk androidMinSdk()
targetSdk androidTargetSdk()
}
sourceSets {

View File

@@ -1,6 +1,6 @@
/* Copyright 2010, 2011, 2012 mapsforge.org
* Copyright 2012 Hannes Janetzek
* Copyright 2016-2019 devemux86
* Copyright 2016-2021 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
@@ -77,7 +77,7 @@ public class TileMap extends MapActivity implements MapEventsReceiver {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
if (checkSelfPermission(Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED)
requestPermissions(new String[]{Manifest.permission.ACCESS_FINE_LOCATION}, 0);
requestPermissions(new String[]{Manifest.permission.ACCESS_COARSE_LOCATION, Manifest.permission.ACCESS_FINE_LOCATION}, 0);
}
setContentView(R.layout.activity_tilemap);

View File

@@ -1,6 +1,6 @@
/*
* Copyright 2010, 2011, 2012 mapsforge.org
* Copyright 2016 devemux86
* Copyright 2016-2020 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
@@ -15,40 +15,30 @@
*/
package org.oscim.app.filefilter;
import org.oscim.theme.ExternalRenderTheme;
import org.oscim.theme.ThemeFile;
import org.oscim.theme.XmlThemeBuilder;
import org.oscim.theme.ThemeLoader;
import org.oscim.tiling.TileSource.OpenResult;
import org.xml.sax.InputSource;
import org.xml.sax.XMLReader;
import java.io.File;
import javax.xml.parsers.SAXParserFactory;
/**
* Accepts all valid render theme XML files.
*/
public final class ValidRenderTheme implements ValidFileFilter {
private OpenResult openResult;
private OpenResult mOpenResult;
@Override
public boolean accept(File file) {
try {
ThemeFile theme = new ExternalRenderTheme(file.getAbsolutePath());
XmlThemeBuilder renderThemeHandler = new XmlThemeBuilder(theme);
XMLReader xmlReader = SAXParserFactory.newInstance().newSAXParser().getXMLReader();
xmlReader.setContentHandler(renderThemeHandler);
xmlReader.parse(new InputSource(theme.getRenderThemeAsStream()));
this.openResult = OpenResult.SUCCESS;
ThemeLoader.load(file.getAbsolutePath());
mOpenResult = OpenResult.SUCCESS;
} catch (Exception e) {
this.openResult = new OpenResult(e.getMessage());
mOpenResult = new OpenResult(e.getMessage());
}
return this.openResult.isSuccess();
return mOpenResult.isSuccess();
}
@Override
public OpenResult getFileOpenResult() {
return this.openResult;
return mOpenResult;
}
}

View File

@@ -1,5 +1,5 @@
apply plugin: 'java-library'
apply plugin: 'maven'
apply plugin: 'maven-publish'
dependencies {
api project(':vtm-desktop')
@@ -7,8 +7,14 @@ dependencies {
}
sourceSets {
main {
java.srcDirs = ['src']
main.java.srcDirs = ['src']
}
publishing {
publications {
maven(MavenPublication) {
from components.java
}
}
}

View File

@@ -24,6 +24,7 @@ import java.nio.*;
/**
* See https://github.com/libgdx/libgdx/blob/master/backends/gdx-backend-lwjgl/src/com/badlogic/gdx/backends/lwjgl/LwjglGL30.java
*/
@SuppressWarnings("deprecation")
public class LwjglGL30 extends LwjglGL20 implements org.oscim.backend.GL30 {
@Override
public void readBuffer(int mode) {

View File

@@ -1,5 +1,5 @@
apply plugin: 'java-library'
apply plugin: 'maven'
apply plugin: 'maven-publish'
dependencies {
api project(':vtm-desktop')
@@ -7,8 +7,14 @@ dependencies {
}
sourceSets {
main {
java.srcDirs = ['src']
main.java.srcDirs = ['src']
}
publishing {
publications {
maven(MavenPublication) {
from components.java
}
}
}

View File

@@ -24,6 +24,7 @@ import java.nio.*;
/**
* See https://github.com/libgdx/libgdx/blob/master/backends/gdx-backend-lwjgl3/src/com/badlogic/gdx/backends/lwjgl3/Lwjgl3GL30.java
*/
@SuppressWarnings("deprecation")
public class Lwjgl3GL30 extends Lwjgl3GL20 implements org.oscim.backend.GL30 {
@Override
public void readBuffer(int mode) {

View File

@@ -1,25 +1,30 @@
apply plugin: 'java-library'
apply plugin: 'maven'
apply plugin: 'maven-publish'
dependencies {
api project(':vtm-gdx')
api 'com.github.blackears:svgSalamander:v1.1.1'
api 'com.formdev:svgSalamander:1.1.2.4'
}
sourceSets {
main {
java.srcDirs = ['src']
}
main.java.srcDirs = ['src']
}
file('natives').eachDir() { dir ->
task("nativesJar-${dir.name}", type: Jar) {
classifier = "natives-${dir.name}"
classifier "natives-${dir.name}"
from(dir.path)
}
}
artifacts {
archives tasks["nativesJar-${dir.name}"]
publishing {
publications {
maven(MavenPublication) {
from components.java
file('natives').eachDir() { dir ->
artifact tasks["nativesJar-${dir.name}"]
}
}
}
}

View File

@@ -1,7 +1,7 @@
/*
* Copyright 2010, 2011, 2012, 2013 mapsforge.org
* Copyright 2013 Hannes Janetzek
* Copyright 2016-2017 devemux86
* Copyright 2016-2021 devemux86
* Copyright 2017 nebular
* Copyright 2017 Longri
*
@@ -25,12 +25,7 @@ import org.oscim.backend.canvas.Canvas;
import org.oscim.backend.canvas.Color;
import org.oscim.backend.canvas.Paint;
import java.awt.AlphaComposite;
import java.awt.Composite;
import java.awt.Graphics2D;
import java.awt.Image;
import java.awt.RenderingHints;
import java.awt.Shape;
import java.awt.*;
import java.awt.font.TextLayout;
import java.awt.geom.AffineTransform;
import java.awt.image.BufferedImage;
@@ -188,7 +183,7 @@ public class AwtCanvas implements Canvas {
@Override
public void fillRectangle(float x, float y, float width, float height, int color) {
java.awt.Color awtColor = color == Color.TRANSPARENT ? TRANSPARENT : new java.awt.Color(color);
java.awt.Color awtColor = color == Color.TRANSPARENT ? TRANSPARENT : new java.awt.Color(color, true);
Composite originalComposite = this.canvas.getComposite();
this.canvas.setComposite(AlphaComposite.getInstance(color == Color.TRANSPARENT ? AlphaComposite.CLEAR : AlphaComposite.SRC_OVER));
this.canvas.setColor(awtColor);

View File

@@ -23,11 +23,9 @@ import org.oscim.backend.Platform;
import org.oscim.backend.canvas.Bitmap;
import org.oscim.backend.canvas.Canvas;
import org.oscim.backend.canvas.Paint;
import org.oscim.theme.XmlThemeResourceProvider;
import java.awt.Font;
import java.awt.FontMetrics;
import java.awt.Graphics2D;
import java.awt.RenderingHints;
import java.awt.*;
import java.awt.image.BufferedImage;
import java.io.IOException;
import java.io.InputStream;
@@ -119,7 +117,7 @@ public class AwtGraphics extends CanvasAdapter {
}
@Override
public Bitmap loadBitmapAssetImpl(String relativePathPrefix, String src, int width, int height, int percent) throws IOException {
return createBitmap(relativePathPrefix, src, width, height, percent);
public Bitmap loadBitmapAssetImpl(String relativePathPrefix, String src, XmlThemeResourceProvider resourceProvider, int width, int height, int percent) throws IOException {
return createBitmap(relativePathPrefix, src, resourceProvider, width, height, percent);
}
}

View File

@@ -1,5 +1,5 @@
apply plugin: 'java-library'
apply plugin: 'maven'
apply plugin: 'maven-publish'
dependencies {
api project(':vtm')
@@ -13,6 +13,14 @@ sourceSets {
main.java.srcDirs = ['src']
}
publishing {
publications {
maven(MavenPublication) {
from components.java
}
}
}
if (project.hasProperty("SONATYPE_USERNAME")) {
afterEvaluate {
project.apply from: "${rootProject.projectDir}/deploy.gradle"

View File

@@ -1,5 +1,5 @@
apply plugin: 'java-library'
apply plugin: 'maven'
apply plugin: 'maven-publish'
dependencies {
api project(':vtm-gdx')
@@ -10,6 +10,14 @@ sourceSets {
main.java.srcDirs = ['src']
}
publishing {
publications {
maven(MavenPublication) {
from components.java
}
}
}
if (project.hasProperty("SONATYPE_USERNAME")) {
afterEvaluate {
project.apply from: "${rootProject.projectDir}/deploy.gradle"

View File

@@ -1,5 +1,5 @@
apply plugin: 'java-library'
apply plugin: 'maven'
apply plugin: 'maven-publish'
dependencies {
api project(':vtm')
@@ -12,8 +12,19 @@ sourceSets {
main.resources.srcDirs = ['src']
}
publishing {
publications {
maven(MavenPublication) {
from components.java
}
}
}
if (project.hasProperty("SONATYPE_USERNAME")) {
afterEvaluate {
project.apply from: "${rootProject.projectDir}/deploy.gradle"
tasks.named("sourcesJar") {
duplicatesStrategy DuplicatesStrategy.INCLUDE
}
}
}

View File

@@ -1,6 +1,6 @@
/*
* Copyright 2013 Hannes Janetzek
* Copyright 2016-2017 devemux86
* Copyright 2016-2021 devemux86
* Copyright 2017 Longri
*
* This file is part of the OpenScienceMap project (http://www.opensciencemap.org).
@@ -22,7 +22,6 @@ import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.Input;
import com.badlogic.gdx.Input.Buttons;
import com.badlogic.gdx.InputProcessor;
import org.oscim.layers.GenericLayer;
import org.oscim.layers.GroupLayer;
import org.oscim.layers.Layer;
@@ -79,19 +78,19 @@ public class InputHandler implements InputProcessor {
break;
case Input.Keys.UP:
mViewport.moveMap(0, -50);
mMap.updateMap(true);
break;
case Input.Keys.DOWN:
mViewport.moveMap(0, 50);
mMap.updateMap(true);
break;
case Input.Keys.DOWN:
mViewport.moveMap(0, -50);
mMap.updateMap(true);
break;
case Input.Keys.LEFT:
mViewport.moveMap(-50, 0);
mViewport.moveMap(50, 0);
mMap.updateMap(true);
break;
case Input.Keys.RIGHT:
mViewport.moveMap(50, 0);
mViewport.moveMap(-50, 0);
mMap.updateMap(true);
break;
case Input.Keys.D:
@@ -110,6 +109,15 @@ public class InputHandler implements InputProcessor {
mMap.animator().animateZoom(500, 2, 0, 0);
mMap.updateMap(false);
break;
case Input.Keys.MINUS:
mMap.animator().animateZoom(500, 0.5, 0, 0);
mMap.updateMap(true);
break;
case Input.Keys.PLUS:
case Input.Keys.EQUALS:
mMap.animator().animateZoom(500, 2, 0, 0);
mMap.updateMap(true);
break;
case Input.Keys.NUM_1:
mMap.setTheme(VtmThemes.DEFAULT);

View File

@@ -1,16 +1,24 @@
apply plugin: 'java-library'
apply plugin: 'maven'
apply plugin: 'maven-publish'
dependencies {
api project(':vtm')
// https://github.com/square/okhttp/issues/4481
api 'com.squareup.okhttp3:okhttp:3.12.5'
api 'com.squareup.okhttp3:okhttp:3.12.13'
}
sourceSets {
main.java.srcDirs = ['src']
}
publishing {
publications {
maven(MavenPublication) {
from components.java
}
}
}
if (project.hasProperty("SONATYPE_USERNAME")) {
afterEvaluate {
project.apply from: "${rootProject.projectDir}/deploy.gradle"

View File

@@ -1,7 +1,7 @@
/*
* Copyright 2014 Charles Greb
* Copyright 2014 Hannes Janetzek
* Copyright 2017 devemux86
* Copyright 2017-2021 devemux86
* Copyright 2017 Mathieu De Brito
*
* This file is part of the OpenScienceMap project (http://www.opensciencemap.org).
@@ -19,8 +19,10 @@
*/
package org.oscim.tiling.source;
import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.Response;
import org.oscim.core.Tile;
import org.oscim.utils.IOUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -31,10 +33,6 @@ import java.io.OutputStream;
import java.net.URL;
import java.util.Map.Entry;
import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.Response;
public class OkHttpEngine implements HttpEngine {
private static final Logger log = LoggerFactory.getLogger(OkHttpEngine.class);
@@ -100,7 +98,11 @@ public class OkHttpEngine implements HttpEngine {
if (mInputStream == null)
return;
IOUtils.closeQuietly(mInputStream);
try {
mInputStream.close();
} catch (Exception e) {
log.error(e.getMessage(), e);
}
mInputStream = null;
}
@@ -117,9 +119,7 @@ public class OkHttpEngine implements HttpEngine {
@Override
public boolean requestCompleted(boolean success) {
IOUtils.closeQuietly(mInputStream);
mInputStream = null;
close();
return success;
}
}

View File

@@ -1,6 +1,6 @@
buildscript {
repositories {
jcenter()
mavenCentral()
}
dependencies {
classpath 'com.mobidevelop.robovm:robovm-gradle-plugin:2.3.7'

View File

@@ -19,7 +19,6 @@
package org.oscim.ios.test;
import com.badlogic.gdx.graphics.glutils.GLVersion;
import org.oscim.backend.GLAdapter;
import org.oscim.backend.canvas.Color;
import org.oscim.core.GeoPoint;
@@ -74,7 +73,7 @@ public class IOSPathLayerTest extends GdxMap {
mMap.setMapPosition(0, 0, 1 << 2);
tex = Utils.loadTexture("", "patterns/pike.png", 0, 0, 100);
tex = Utils.loadTexture("", "patterns/pike.png", null, 0, 0, 100);
// tex = new TextureItem(CanvasAdapter.getBitmapAsset("", "patterns/pike.png"));
tex.mipmap = true;

View File

@@ -1,6 +1,6 @@
buildscript {
repositories {
jcenter()
mavenCentral()
}
dependencies {
classpath 'com.mobidevelop.robovm:robovm-gradle-plugin:2.3.7'
@@ -8,7 +8,7 @@ buildscript {
}
apply plugin: 'java-library'
apply plugin: 'maven'
apply plugin: 'maven-publish'
apply plugin: 'robovm'
sourceSets.main.java.srcDirs = ["src/"]
@@ -42,7 +42,6 @@ task copyVtmThemesResources(type: Copy) {
into("${buildDir}")
}
tasks.withType(JavaCompile) {
compileTask -> compileTask.dependsOn copyVtmResources
}
@@ -52,7 +51,8 @@ tasks.withType(JavaCompile) {
}
task nativesJar(type: Jar) {
classifier = 'natives'
dependsOn copyVtmResources, copyVtmThemesResources
classifier 'natives'
from('natives')
}
@@ -60,8 +60,20 @@ artifacts {
archives nativesJar
}
publishing {
publications {
maven(MavenPublication) {
from components.java
artifact nativesJar
}
}
}
if (project.hasProperty("SONATYPE_USERNAME")) {
afterEvaluate {
project.apply from: "${rootProject.projectDir}/deploy.gradle"
tasks.named("sourcesJar") {
dependsOn copyVtmResources, copyVtmThemesResources
}
}
}

View File

@@ -15,7 +15,6 @@
package org.oscim.ios.backend;
import com.badlogic.gdx.backends.iosrobovm.IOSGLES30;
import org.oscim.backend.GL30;
import java.nio.Buffer;
@@ -26,6 +25,7 @@ import java.nio.LongBuffer;
/**
* iOS specific implementation of {@link GL30}.
*/
@SuppressWarnings("deprecation")
public class IosGL30 extends IosGL implements GL30 {
private static final IOSGLES30 iOSGL = new IOSGLES30();

View File

@@ -21,6 +21,7 @@ import org.oscim.backend.Platform;
import org.oscim.backend.canvas.Bitmap;
import org.oscim.backend.canvas.Canvas;
import org.oscim.backend.canvas.Paint;
import org.oscim.theme.XmlThemeResourceProvider;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -70,7 +71,7 @@ public class IosGraphics extends CanvasAdapter {
}
@Override
protected Bitmap loadBitmapAssetImpl(String relativePathPrefix, String src, int width, int height, int percent) throws IOException {
return createBitmap(relativePathPrefix, src, width, height, percent);
protected Bitmap loadBitmapAssetImpl(String relativePathPrefix, String src, XmlThemeResourceProvider resourceProvider, int width, int height, int percent) throws IOException {
return createBitmap(relativePathPrefix, src, resourceProvider, width, height, percent);
}
}

Some files were not shown because too many files have changed in this diff Show More