Compare commits
14 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ae7c7b1910 | ||
|
|
cf234cd7ca | ||
|
|
4fb99aaf28 | ||
|
|
7e09e4f2e8 | ||
|
|
d428b689ba | ||
|
|
3c0ca26b67 | ||
|
|
84ccf9d1bc | ||
|
|
5442e67518 | ||
|
|
6fb02ec055 | ||
|
|
825cd05150 | ||
|
|
9357cf380b | ||
|
|
670883701d | ||
|
|
86794c8838 | ||
|
|
c4003bab33 |
10
.github/workflows/android.yml
vendored
10
.github/workflows/android.yml
vendored
@@ -2,9 +2,9 @@ name: Android CI
|
|||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches: [ master ]
|
branches: [ "master" ]
|
||||||
pull_request:
|
pull_request:
|
||||||
branches: [ master ]
|
branches: [ "master" ]
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
@@ -12,12 +12,12 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v3
|
||||||
- name: set up JDK 11
|
- name: set up JDK 11
|
||||||
uses: actions/setup-java@v2
|
uses: actions/setup-java@v3
|
||||||
with:
|
with:
|
||||||
java-version: '11'
|
java-version: '11'
|
||||||
distribution: 'adopt'
|
distribution: 'temurin'
|
||||||
cache: gradle
|
cache: gradle
|
||||||
|
|
||||||
- name: Grant execute permission for gradlew
|
- name: Grant execute permission for gradlew
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ If you have any questions or problems, don't hesitate to ask the Discussions for
|
|||||||
- iOS (libGDX/RoboVM, [instructions](docs/ios.md))
|
- iOS (libGDX/RoboVM, [instructions](docs/ios.md))
|
||||||
- Desktop (libGDX/LWJGL, [instructions](docs/desktop.md))
|
- Desktop (libGDX/LWJGL, [instructions](docs/desktop.md))
|
||||||
- HTML5/WebGL (libGDX/GWT, [instructions](docs/web.md))
|
- HTML5/WebGL (libGDX/GWT, [instructions](docs/web.md))
|
||||||
|
- Building VTM: set `ANDROID_HOME` environment variable with the Android SDK installation directory
|
||||||
|
|
||||||
### Projects
|
### Projects
|
||||||
- **vtm** core library
|
- **vtm** core library
|
||||||
|
|||||||
17
build.gradle
17
build.gradle
@@ -1,11 +1,5 @@
|
|||||||
buildscript {
|
plugins {
|
||||||
repositories {
|
id 'com.android.application' version '7.0.4' apply false
|
||||||
google()
|
|
||||||
mavenCentral()
|
|
||||||
}
|
|
||||||
dependencies {
|
|
||||||
classpath 'com.android.tools.build:gradle:7.0.4'
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
allprojects {
|
allprojects {
|
||||||
@@ -37,13 +31,6 @@ static def versionCode() { return 1 }
|
|||||||
def versionName() { return version }
|
def versionName() { return version }
|
||||||
|
|
||||||
subprojects {
|
subprojects {
|
||||||
repositories {
|
|
||||||
google()
|
|
||||||
mavenCentral()
|
|
||||||
maven { url 'https://jitpack.io' }
|
|
||||||
maven { url "https://plugins.gradle.org/m2/" }
|
|
||||||
}
|
|
||||||
|
|
||||||
tasks.withType(JavaCompile) {
|
tasks.withType(JavaCompile) {
|
||||||
sourceCompatibility = JavaVersion.VERSION_1_7
|
sourceCompatibility = JavaVersion.VERSION_1_7
|
||||||
targetCompatibility = JavaVersion.VERSION_1_7
|
targetCompatibility = JavaVersion.VERSION_1_7
|
||||||
|
|||||||
@@ -1,7 +1,17 @@
|
|||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
## New since 0.17.0
|
## New since 0.18.0
|
||||||
|
|
||||||
|
- Minor improvements and bug fixes
|
||||||
|
- [Solved issues](https://github.com/mapsforge/vtm/issues?q=is%3Aclosed+milestone%3A0.19.0)
|
||||||
|
|
||||||
|
## Version 0.18.0 (2022-06-18)
|
||||||
|
|
||||||
|
- Mapsforge: deduplicate maps [#903](https://github.com/mapsforge/vtm/pull/903)
|
||||||
|
- Fix overlapping map regions [#903](https://github.com/mapsforge/vtm/pull/903) [#905](https://github.com/mapsforge/vtm/pull/905)
|
||||||
|
- Fix `vtm-jni64.dll` [#911](https://github.com/mapsforge/vtm/pull/911)
|
||||||
|
- Mapsforge: simplification exceptions [#906](https://github.com/mapsforge/vtm/pull/906)
|
||||||
|
- `Parameters.SIMPLIFICATION_EXCEPTIONS`
|
||||||
- Minor improvements and bug fixes
|
- Minor improvements and bug fixes
|
||||||
- [Solved issues](https://github.com/mapsforge/vtm/issues?q=is%3Aclosed+milestone%3A0.18.0)
|
- [Solved issues](https://github.com/mapsforge/vtm/issues?q=is%3Aclosed+milestone%3A0.18.0)
|
||||||
|
|
||||||
|
|||||||
@@ -55,7 +55,7 @@ implementation 'org.mapsforge:vtm-desktop:[CURRENT-VERSION]:natives-osx'
|
|||||||
implementation 'org.mapsforge:vtm-desktop:[CURRENT-VERSION]:natives-windows'
|
implementation 'org.mapsforge:vtm-desktop:[CURRENT-VERSION]:natives-windows'
|
||||||
implementation 'com.badlogicgames.gdx:gdx:1.9.10'
|
implementation 'com.badlogicgames.gdx:gdx:1.9.10'
|
||||||
implementation 'com.badlogicgames.gdx:gdx-platform:1.9.10:natives-desktop'
|
implementation 'com.badlogicgames.gdx:gdx-platform:1.9.10:natives-desktop'
|
||||||
implementation 'com.formdev:svgSalamander:1.1.2.4'
|
implementation 'com.formdev:svgSalamander:1.1.3'
|
||||||
```
|
```
|
||||||
|
|
||||||
### Desktop (LWJGL)
|
### Desktop (LWJGL)
|
||||||
|
|||||||
@@ -15,5 +15,7 @@ org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8
|
|||||||
# 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
|
# https://developer.android.com/topic/libraries/support-library/androidx-rn
|
||||||
android.useAndroidX=true
|
android.useAndroidX=true
|
||||||
# Automatically convert third-party libraries to use AndroidX
|
# Enables namespacing of each library's R class so that its R class includes only the
|
||||||
android.enableJetifier=true
|
# resources declared in the library itself and none from the library's dependencies,
|
||||||
|
# thereby reducing the size of the R class for that library
|
||||||
|
android.nonTransitiveRClass=true
|
||||||
2
gradle/wrapper/gradle-wrapper.properties
vendored
2
gradle/wrapper/gradle-wrapper.properties
vendored
@@ -1,5 +1,5 @@
|
|||||||
distributionBase=GRADLE_USER_HOME
|
distributionBase=GRADLE_USER_HOME
|
||||||
distributionPath=wrapper/dists
|
distributionPath=wrapper/dists
|
||||||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.0.2-bin.zip
|
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-bin.zip
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
zipStorePath=wrapper/dists
|
zipStorePath=wrapper/dists
|
||||||
|
|||||||
203
jni/jni/build-windows64.xml
Normal file
203
jni/jni/build-windows64.xml
Normal file
@@ -0,0 +1,203 @@
|
|||||||
|
<project name="vtm-jni-Windows-64" basedir="." default="postcompile">
|
||||||
|
|
||||||
|
<!-- include the environment -->
|
||||||
|
<property environment="env"/>
|
||||||
|
|
||||||
|
<!-- output directory for temporary object files -->
|
||||||
|
<property name="buildDir" value="target/windows64" />
|
||||||
|
|
||||||
|
<!-- output directory for the shared library -->
|
||||||
|
<property name="libsDir" value="../libs/windows64" />
|
||||||
|
|
||||||
|
<!-- the name of the shared library -->
|
||||||
|
<property name="libName" value="vtm-jni64.dll"/>
|
||||||
|
|
||||||
|
<!-- the jni header jniPlatform to use -->
|
||||||
|
<property name="jniPlatform" value="win32"/>
|
||||||
|
|
||||||
|
<!-- the compiler to use when compiling c files -->
|
||||||
|
<property name="cCompiler" value="gcc"/>
|
||||||
|
|
||||||
|
<!-- the compiler to use when compiling c++ files -->
|
||||||
|
<property name="cppCompiler" value="g++"/>
|
||||||
|
|
||||||
|
<!-- the command to use when archiving files -->
|
||||||
|
<property name="archiver" value="ar"/>
|
||||||
|
|
||||||
|
<!-- the compilerPrefix for the C & C++ compilers -->
|
||||||
|
<property name="compilerPrefix" value="x86_64-w64-mingw32-"/>
|
||||||
|
|
||||||
|
<!-- the compilerSuffix for the C & C++ compilers -->
|
||||||
|
<property name="compilerSuffix" value=".exe" />
|
||||||
|
|
||||||
|
<!-- define gcc compiler, options and files to compile -->
|
||||||
|
<property name="gcc" value="${compilerPrefix}${cCompiler}${compilerSuffix}"/>
|
||||||
|
<property name="gcc-opts" value="-c -Wall -O2 -mfpmath=sse -msse2 -fmessage-length=0 -m64 -Wall -std=c99 -O2 -ffast-math -DNDEBUG"/>
|
||||||
|
<fileset id="gcc-files" dir="./">
|
||||||
|
<exclude name="target/"/>
|
||||||
|
<include name="memcpy_wrap.c"/>
|
||||||
|
<include name="gl/utils.c"/>
|
||||||
|
<include name="libtess2/Source/bucketalloc.c"/>
|
||||||
|
<include name="libtess2/Source/dict.c"/>
|
||||||
|
<include name="libtess2/Source/geom.c"/>
|
||||||
|
<include name="libtess2/Source/mesh.c"/>
|
||||||
|
<include name="libtess2/Source/priorityq.c"/>
|
||||||
|
<include name="libtess2/Source/sweep.c"/>
|
||||||
|
<include name="libtess2/Source/tess.c"/>
|
||||||
|
</fileset>
|
||||||
|
|
||||||
|
<!-- define g++ compiler, options and files to compile -->
|
||||||
|
<property name="g++" value="${compilerPrefix}${cppCompiler}${compilerSuffix}"/>
|
||||||
|
<property name="g++-opts" value="-c -Wall -O2 -mfpmath=sse -msse2 -fmessage-length=0 -m64 -Wall -std=c99 -O2 -ffast-math -DNDEBUG -fpermissive"/>
|
||||||
|
<fileset id="g++-files" dir="./">
|
||||||
|
<exclude name="target/"/>
|
||||||
|
<include name="**/*.cpp"/>
|
||||||
|
</fileset>
|
||||||
|
|
||||||
|
<!-- define linker and options -->
|
||||||
|
<property name="linker" value="${compilerPrefix}${cppCompiler}${compilerSuffix}"/>
|
||||||
|
<property name="linker-opts" value="-Wl,--kill-at -shared -static -static-libgcc -static-libstdc++ -m64"/>
|
||||||
|
<property name="libraries" value=""/>
|
||||||
|
|
||||||
|
<!-- define stripper -->
|
||||||
|
<property name="stripper" value="${compilerPrefix}strip${compilerSuffix}"/>
|
||||||
|
|
||||||
|
<!-- cleans the build directory, removes all object files and shared libs -->
|
||||||
|
<target name="clean">
|
||||||
|
<delete includeemptydirs="true" quiet="true">
|
||||||
|
<fileset dir="${buildDir}"/>
|
||||||
|
<fileset dir="${libsDir}" includes="**/*"/>
|
||||||
|
</delete>
|
||||||
|
</target>
|
||||||
|
|
||||||
|
<target name="precompile" depends="clean">
|
||||||
|
<condition property="compiler-found">
|
||||||
|
<and>
|
||||||
|
<or>
|
||||||
|
<!-- Include both b/c Windows might be either -->
|
||||||
|
<available file="${g++}" filepath="${env.PATH}"/>
|
||||||
|
<available file="${g++}" filepath="${env.Path}"/>
|
||||||
|
</or>
|
||||||
|
<or>
|
||||||
|
<!-- Include both b/c Windows might be either -->
|
||||||
|
<available file="${gcc}" filepath="${env.PATH}"/>
|
||||||
|
<available file="${gcc}" filepath="${env.Path}"/>
|
||||||
|
</or>
|
||||||
|
</and>
|
||||||
|
</condition>
|
||||||
|
<condition property="has-compiler">
|
||||||
|
<equals arg1="${compiler-found}" arg2="true"/>
|
||||||
|
</condition>
|
||||||
|
<condition property="stripper-found">
|
||||||
|
<or>
|
||||||
|
<!-- Include both b/c Windows might be either -->
|
||||||
|
<available file="${stripper}" filepath="${env.PATH}"/>
|
||||||
|
<available file="${stripper}" filepath="${env.Path}"/>
|
||||||
|
</or>
|
||||||
|
</condition>
|
||||||
|
<condition property="should-strip">
|
||||||
|
<and>
|
||||||
|
<equals arg1="${stripper-found}" arg2="true"/>
|
||||||
|
<equals arg1="${release}" arg2="true"/>
|
||||||
|
<!-- Don't strip mac osx libs -->
|
||||||
|
<not>
|
||||||
|
<contains string="${libName}" substring="dylib"/>
|
||||||
|
</not>
|
||||||
|
</and>
|
||||||
|
</condition>
|
||||||
|
|
||||||
|
</target>
|
||||||
|
|
||||||
|
<target name="create-build-dir" depends="precompile" if="has-compiler">
|
||||||
|
<!-- FIXME this is pretty nasty :/ -->
|
||||||
|
<copy todir="${buildDir}">
|
||||||
|
<fileset refid="g++-files"/>
|
||||||
|
<fileset refid="gcc-files"/>
|
||||||
|
</copy>
|
||||||
|
<delete>
|
||||||
|
<fileset dir="${buildDir}">
|
||||||
|
<include name="*"/>
|
||||||
|
<exclude name="*.o"/>
|
||||||
|
</fileset>
|
||||||
|
</delete>
|
||||||
|
</target>
|
||||||
|
|
||||||
|
<!-- compiles all C and C++ files to object files in the build directory -->
|
||||||
|
<target name="compile" depends="create-build-dir" if="has-compiler">
|
||||||
|
<mkdir dir="${buildDir}"/>
|
||||||
|
<apply failonerror="true" executable="${g++}" dest="${buildDir}" verbose="true">
|
||||||
|
<arg line="${g++-opts}"/>
|
||||||
|
<arg value="-Ijni-headers"/>
|
||||||
|
<arg value="-Ijni-headers/${jniPlatform}"/>
|
||||||
|
<arg value="-I."/>
|
||||||
|
<arg value="-I."/>
|
||||||
|
<arg value="-Ilibtess2/Include"/>
|
||||||
|
|
||||||
|
<srcfile/>
|
||||||
|
<arg value="-o"/>
|
||||||
|
<targetfile/>
|
||||||
|
<fileset refid="g++-files"/>
|
||||||
|
<compositemapper>
|
||||||
|
<mapper type="glob" from="*.cpp" to="*.o"/>
|
||||||
|
<mapper type="glob" from="*.mm" to="*.o"/>
|
||||||
|
</compositemapper>
|
||||||
|
</apply>
|
||||||
|
<apply failonerror="true" executable="${gcc}" dest="${buildDir}" verbose="true">
|
||||||
|
<arg line="${gcc-opts}"/>
|
||||||
|
<arg value="-Ijni-headers"/>
|
||||||
|
<arg value="-Ijni-headers/${jniPlatform}"/>
|
||||||
|
<arg value="-I."/>
|
||||||
|
<arg value="-I."/>
|
||||||
|
<arg value="-Ilibtess2/Include"/>
|
||||||
|
<arg value="-Ilibtess2/Source"/>
|
||||||
|
|
||||||
|
<srcfile/>
|
||||||
|
<arg value="-o"/>
|
||||||
|
<targetfile/>
|
||||||
|
<fileset refid="gcc-files"/>
|
||||||
|
<compositemapper>
|
||||||
|
<mapper type="glob" from="*.c" to="*.o"/>
|
||||||
|
<mapper type="glob" from="*.m" to="*.o"/>
|
||||||
|
</compositemapper>
|
||||||
|
</apply>
|
||||||
|
</target>
|
||||||
|
|
||||||
|
<!-- links the shared library based on the previously compiled object files -->
|
||||||
|
<target name="link" depends="compile" if="has-compiler">
|
||||||
|
<fileset dir="${buildDir}" id="objFileSet">
|
||||||
|
<patternset>
|
||||||
|
<include name="**/*.o" />
|
||||||
|
</patternset>
|
||||||
|
</fileset>
|
||||||
|
<pathconvert pathsep=" " property="objFiles" refid="objFileSet" />
|
||||||
|
<mkdir dir="${libsDir}" />
|
||||||
|
<exec executable="${linker}" failonerror="true" dir="${buildDir}">
|
||||||
|
<arg line="${linker-opts}" />
|
||||||
|
<arg value="-o" />
|
||||||
|
<arg path="${libsDir}/${libName}" />
|
||||||
|
<arg line="${objFiles}"/>
|
||||||
|
<arg line="${libraries}" />
|
||||||
|
</exec>
|
||||||
|
</target>
|
||||||
|
|
||||||
|
<!-- strips the shared library of debug symbols -->
|
||||||
|
<target name="strip" depends="link" if="should-strip">
|
||||||
|
<exec executable="${stripper}" failonerror="true" dir="${buildDir}">
|
||||||
|
<arg value="--strip-unneeded"/>
|
||||||
|
<arg path="${libsDir}/${libName}" />
|
||||||
|
</exec>
|
||||||
|
</target>
|
||||||
|
|
||||||
|
<!-- copy dll into dev environment
|
||||||
|
<target name="copyDLL" depends="link">
|
||||||
|
<copy
|
||||||
|
file ="${libsDir}/${libName}"
|
||||||
|
todir ="C:/DAT/MT/mytourbook/bundles/net.tourbook.ext.vtm.windows/natives"
|
||||||
|
/>
|
||||||
|
</target>
|
||||||
|
-->
|
||||||
|
|
||||||
|
<target name="postcompile" depends="strip">
|
||||||
|
|
||||||
|
</target>
|
||||||
|
</project>
|
||||||
@@ -102,7 +102,7 @@ matrix4_proj2D(float* mat, float* vec, float *out);
|
|||||||
|
|
||||||
jlong JNI(alloc)(JNIEnv *env, jclass* clazz)
|
jlong JNI(alloc)(JNIEnv *env, jclass* clazz)
|
||||||
{
|
{
|
||||||
return (long) calloc(16, sizeof(float));
|
return (jlong) calloc(16, sizeof(float));
|
||||||
}
|
}
|
||||||
|
|
||||||
jobject JNI(getBuffer)(JNIEnv *env, jclass* clazz,jlong ptr){
|
jobject JNI(getBuffer)(JNIEnv *env, jclass* clazz,jlong ptr){
|
||||||
|
|||||||
@@ -23,7 +23,7 @@
|
|||||||
//@line:131
|
//@line:131
|
||||||
{
|
{
|
||||||
if (size <= 0)
|
if (size <= 0)
|
||||||
return (long)tessNewTess(0);
|
return (jlong)tessNewTess(0);
|
||||||
if (size > 10)
|
if (size > 10)
|
||||||
size = 10;
|
size = 10;
|
||||||
TESSalloc ma;
|
TESSalloc ma;
|
||||||
@@ -39,7 +39,7 @@
|
|||||||
ma.regionBucketSize = 1 << size; // 256
|
ma.regionBucketSize = 1 << size; // 256
|
||||||
ma.extraVertices = 8;
|
ma.extraVertices = 8;
|
||||||
//ma.extraVertices = 256;
|
//ma.extraVertices = 256;
|
||||||
return (long)tessNewTess(&ma);
|
return (jlong)tessNewTess(&ma);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,3 +1,18 @@
|
|||||||
|
pluginManagement {
|
||||||
|
repositories {
|
||||||
|
gradlePluginPortal()
|
||||||
|
google()
|
||||||
|
mavenCentral()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
dependencyResolutionManagement {
|
||||||
|
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
|
||||||
|
repositories {
|
||||||
|
google()
|
||||||
|
mavenCentral()
|
||||||
|
maven { url 'https://jitpack.io' }
|
||||||
|
}
|
||||||
|
}
|
||||||
rootProject.name = 'vtm-parent'
|
rootProject.name = 'vtm-parent'
|
||||||
include ':vtm'
|
include ':vtm'
|
||||||
include ':vtm-android'
|
include ':vtm-android'
|
||||||
|
|||||||
@@ -16,11 +16,11 @@ dependencies {
|
|||||||
implementation project(':vtm-gdx')
|
implementation project(':vtm-gdx')
|
||||||
implementation project(':vtm-gdx-poi3d')
|
implementation project(':vtm-gdx-poi3d')
|
||||||
|
|
||||||
implementation 'org.mapsforge:mapsforge-poi-android:0.17.0'
|
implementation 'org.mapsforge:mapsforge-poi-android:0.18.0'
|
||||||
implementation 'org.mapsforge:sqlite-android:0.17.0:natives-armeabi-v7a'
|
implementation 'org.mapsforge:sqlite-android:0.18.0:natives-armeabi-v7a'
|
||||||
implementation 'org.mapsforge:sqlite-android:0.17.0:natives-arm64-v8a'
|
implementation 'org.mapsforge:sqlite-android:0.18.0:natives-arm64-v8a'
|
||||||
implementation 'org.mapsforge:sqlite-android:0.17.0:natives-x86'
|
implementation 'org.mapsforge:sqlite-android:0.18.0:natives-x86'
|
||||||
implementation 'org.mapsforge:sqlite-android:0.17.0:natives-x86_64'
|
implementation 'org.mapsforge:sqlite-android:0.18.0:natives-x86_64'
|
||||||
}
|
}
|
||||||
|
|
||||||
android {
|
android {
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ apply plugin: 'maven-publish'
|
|||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
api project(':vtm-gdx')
|
api project(':vtm-gdx')
|
||||||
api 'com.formdev:svgSalamander:1.1.2.4'
|
api 'com.formdev:svgSalamander:1.1.3'
|
||||||
}
|
}
|
||||||
|
|
||||||
sourceSets {
|
sourceSets {
|
||||||
|
|||||||
Binary file not shown.
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2016-2019 devemux86
|
* Copyright 2016-2022 devemux86
|
||||||
* Copyright 2018-2019 Gustl22
|
* Copyright 2018-2019 Gustl22
|
||||||
*
|
*
|
||||||
* This file is part of the OpenScienceMap project (http://www.opensciencemap.org).
|
* This file is part of the OpenScienceMap project (http://www.opensciencemap.org).
|
||||||
@@ -67,6 +67,7 @@ public class MapsforgeTest extends GdxMapApp {
|
|||||||
mapFileTileSource.setMapFile(mapFile.getAbsolutePath());
|
mapFileTileSource.setMapFile(mapFile.getAbsolutePath());
|
||||||
tileSource.add(mapFileTileSource);
|
tileSource.add(mapFileTileSource);
|
||||||
}
|
}
|
||||||
|
//tileSource.setDeduplicate(true);
|
||||||
//tileSource.setPreferredLanguage("en");
|
//tileSource.setPreferredLanguage("en");
|
||||||
|
|
||||||
VectorTileLayer l = mMap.setBaseMap(tileSource);
|
VectorTileLayer l = mMap.setBaseMap(tileSource);
|
||||||
@@ -139,13 +140,13 @@ public class MapsforgeTest extends GdxMapApp {
|
|||||||
for (String arg : args) {
|
for (String arg : args) {
|
||||||
File mapFile = new File(arg);
|
File mapFile = new File(arg);
|
||||||
if (!mapFile.exists()) {
|
if (!mapFile.exists()) {
|
||||||
throw new IllegalArgumentException("file does not exist: " + mapFile);
|
System.err.println("file does not exist: " + mapFile);
|
||||||
} else if (!mapFile.isFile()) {
|
} else if (!mapFile.isFile()) {
|
||||||
throw new IllegalArgumentException("not a file: " + mapFile);
|
System.err.println("not a file: " + mapFile);
|
||||||
} else if (!mapFile.canRead()) {
|
} else if (!mapFile.canRead()) {
|
||||||
throw new IllegalArgumentException("cannot read file: " + mapFile);
|
System.err.println("cannot read file: " + mapFile);
|
||||||
}
|
} else
|
||||||
result.add(mapFile);
|
result.add(mapFile);
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,11 +10,11 @@ dependencies {
|
|||||||
implementation 'com.fifesoft:rsyntaxtextarea:2.6.1'
|
implementation 'com.fifesoft:rsyntaxtextarea:2.6.1'
|
||||||
implementation 'com.jtattoo:JTattoo:1.6.11'
|
implementation 'com.jtattoo:JTattoo:1.6.11'
|
||||||
|
|
||||||
implementation 'org.mapsforge:mapsforge-core:0.17.0'
|
implementation 'org.mapsforge:mapsforge-core:0.18.0'
|
||||||
implementation 'org.mapsforge:mapsforge-map:0.17.0'
|
implementation 'org.mapsforge:mapsforge-map:0.18.0'
|
||||||
implementation 'org.mapsforge:mapsforge-map-awt:0.17.0'
|
implementation 'org.mapsforge:mapsforge-map-awt:0.18.0'
|
||||||
implementation 'org.mapsforge:mapsforge-map-reader:0.17.0'
|
implementation 'org.mapsforge:mapsforge-map-reader:0.18.0'
|
||||||
implementation 'org.mapsforge:mapsforge-themes:0.17.0'
|
implementation 'org.mapsforge:mapsforge-themes:0.18.0'
|
||||||
implementation 'net.sf.kxml:kxml2:2.3.0'
|
implementation 'net.sf.kxml:kxml2:2.3.0'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2013 Hannes Janetzek
|
* Copyright 2013 Hannes Janetzek
|
||||||
* Copyright 2016-2021 devemux86
|
* Copyright 2016-2022 devemux86
|
||||||
* Copyright 2017 Longri
|
* Copyright 2017 Longri
|
||||||
* Copyright 2021 eddiemuc
|
* Copyright 2021 eddiemuc
|
||||||
*
|
*
|
||||||
@@ -250,8 +250,12 @@ public abstract class CanvasAdapter {
|
|||||||
return new File(parentPath, pathName);
|
return new File(parentPath, pathName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static float getDeviceScale() {
|
||||||
|
return CanvasAdapter.dpi / CanvasAdapter.DEFAULT_DPI;
|
||||||
|
}
|
||||||
|
|
||||||
public static float getScale() {
|
public static float getScale() {
|
||||||
return (CanvasAdapter.dpi / CanvasAdapter.DEFAULT_DPI) * userScale;
|
return getDeviceScale() * userScale;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected static void init(CanvasAdapter adapter) {
|
protected static void init(CanvasAdapter adapter) {
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
* Copyright 2012 Hannes Janetzek
|
* Copyright 2012 Hannes Janetzek
|
||||||
* Copyright 2016 Andrey Novikov
|
* Copyright 2016 Andrey Novikov
|
||||||
* Copyright 2017-2019 Gustl22
|
* Copyright 2017-2019 Gustl22
|
||||||
* Copyright 2018-2019 devemux86
|
* Copyright 2018-2022 devemux86
|
||||||
* Copyright 2019 marq24
|
* Copyright 2019 marq24
|
||||||
*
|
*
|
||||||
* This file is part of the OpenScienceMap project (http://www.opensciencemap.org).
|
* This file is part of the OpenScienceMap project (http://www.opensciencemap.org).
|
||||||
@@ -38,6 +38,8 @@ public class MapElement extends GeometryBuffer {
|
|||||||
*/
|
*/
|
||||||
public int layer;
|
public int layer;
|
||||||
|
|
||||||
|
public int level;
|
||||||
|
|
||||||
public final TagSet tags = new TagSet();
|
public final TagSet tags = new TagSet();
|
||||||
|
|
||||||
public MapElement() {
|
public MapElement() {
|
||||||
@@ -61,6 +63,7 @@ public class MapElement extends GeometryBuffer {
|
|||||||
this.centroidPosition = element.centroidPosition;
|
this.centroidPosition = element.centroidPosition;
|
||||||
this.labelPosition = element.labelPosition;
|
this.labelPosition = element.labelPosition;
|
||||||
this.setLayer(element.layer);
|
this.setLayer(element.layer);
|
||||||
|
this.level = element.level;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -121,6 +124,7 @@ public class MapElement extends GeometryBuffer {
|
|||||||
@Override
|
@Override
|
||||||
public MapElement clear() {
|
public MapElement clear() {
|
||||||
layer = 5;
|
layer = 5;
|
||||||
|
level = 0;
|
||||||
super.clear();
|
super.clear();
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2013 Hannes Janetzek
|
* Copyright 2013 Hannes Janetzek
|
||||||
* Copyright 2016 Andrey Novikov
|
* Copyright 2016 Andrey Novikov
|
||||||
* Copyright 2016 devemux86
|
* Copyright 2016-2022 devemux86
|
||||||
* Copyright 2017-2019 Gustl22
|
* Copyright 2017-2019 Gustl22
|
||||||
*
|
*
|
||||||
* This file is part of the OpenScienceMap project (http://www.opensciencemap.org).
|
* This file is part of the OpenScienceMap project (http://www.opensciencemap.org).
|
||||||
@@ -22,6 +22,7 @@ package org.oscim.core;
|
|||||||
import org.oscim.utils.Utils;
|
import org.oscim.utils.Utils;
|
||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
import java.util.Collection;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The Class TagSet holds a set of Tags.
|
* The Class TagSet holds a set of Tags.
|
||||||
@@ -219,6 +220,20 @@ public class TagSet {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks if any tag is contained in TagSet.
|
||||||
|
*
|
||||||
|
* @param tags the tags
|
||||||
|
* @return true, iff any tag is in TagSet
|
||||||
|
*/
|
||||||
|
public boolean contains(Collection<Tag> tags) {
|
||||||
|
for (Tag tag : tags) {
|
||||||
|
if (contains(tag))
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2012-2014 Hannes Janetzek
|
* Copyright 2012-2014 Hannes Janetzek
|
||||||
* Copyright 2016-2019 devemux86
|
* Copyright 2016-2022 devemux86
|
||||||
*
|
*
|
||||||
* This file is part of the OpenScienceMap project (http://www.opensciencemap.org).
|
* This file is part of the OpenScienceMap project (http://www.opensciencemap.org).
|
||||||
*
|
*
|
||||||
@@ -18,28 +18,13 @@
|
|||||||
package org.oscim.layers.tile.vector;
|
package org.oscim.layers.tile.vector;
|
||||||
|
|
||||||
import org.oscim.core.GeometryBuffer.GeometryType;
|
import org.oscim.core.GeometryBuffer.GeometryType;
|
||||||
import org.oscim.core.MapElement;
|
import org.oscim.core.*;
|
||||||
import org.oscim.core.MercatorProjection;
|
|
||||||
import org.oscim.core.Tag;
|
|
||||||
import org.oscim.core.TagSet;
|
|
||||||
import org.oscim.core.Tile;
|
|
||||||
import org.oscim.layers.tile.MapTile;
|
import org.oscim.layers.tile.MapTile;
|
||||||
import org.oscim.layers.tile.TileLoader;
|
import org.oscim.layers.tile.TileLoader;
|
||||||
import org.oscim.renderer.bucket.CircleBucket;
|
import org.oscim.renderer.bucket.*;
|
||||||
import org.oscim.renderer.bucket.LineBucket;
|
|
||||||
import org.oscim.renderer.bucket.LineTexBucket;
|
|
||||||
import org.oscim.renderer.bucket.MeshBucket;
|
|
||||||
import org.oscim.renderer.bucket.PolygonBucket;
|
|
||||||
import org.oscim.renderer.bucket.RenderBuckets;
|
|
||||||
import org.oscim.theme.IRenderTheme;
|
import org.oscim.theme.IRenderTheme;
|
||||||
import org.oscim.theme.RenderTheme;
|
import org.oscim.theme.RenderTheme;
|
||||||
import org.oscim.theme.styles.AreaStyle;
|
import org.oscim.theme.styles.*;
|
||||||
import org.oscim.theme.styles.CircleStyle;
|
|
||||||
import org.oscim.theme.styles.ExtrusionStyle;
|
|
||||||
import org.oscim.theme.styles.LineStyle;
|
|
||||||
import org.oscim.theme.styles.RenderStyle;
|
|
||||||
import org.oscim.theme.styles.SymbolStyle;
|
|
||||||
import org.oscim.theme.styles.TextStyle;
|
|
||||||
import org.oscim.tiling.ITileDataSource;
|
import org.oscim.tiling.ITileDataSource;
|
||||||
import org.oscim.tiling.QueryResult;
|
import org.oscim.tiling.QueryResult;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
@@ -209,7 +194,7 @@ public class VectorTileLoader extends TileLoader implements RenderStyle.Callback
|
|||||||
if (element.type == GeometryType.POINT) {
|
if (element.type == GeometryType.POINT) {
|
||||||
renderNode(renderTheme.matchElement(element.type, tags, mTile.zoomLevel));
|
renderNode(renderTheme.matchElement(element.type, tags, mTile.zoomLevel));
|
||||||
} else {
|
} else {
|
||||||
mCurBucket = getValidLayer(element.layer) * renderTheme.getLevels();
|
mCurBucket = getValidLayer(element.layer) * renderTheme.getLevels() * (element.level > 0 ? element.level : 1);
|
||||||
renderWay(renderTheme.matchElement(element.type, tags, mTile.zoomLevel));
|
renderWay(renderTheme.matchElement(element.type, tags, mTile.zoomLevel));
|
||||||
}
|
}
|
||||||
clearState();
|
clearState();
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2016-2018 devemux86
|
* Copyright 2016-2022 devemux86
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify it under the
|
* 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
|
* terms of the GNU Lesser General Public License as published by the Free Software
|
||||||
@@ -17,8 +17,15 @@ package org.oscim.tiling;
|
|||||||
import org.oscim.backend.canvas.Bitmap;
|
import org.oscim.backend.canvas.Bitmap;
|
||||||
import org.oscim.core.MapElement;
|
import org.oscim.core.MapElement;
|
||||||
|
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
public class TileDataSink implements ITileDataSink {
|
public class TileDataSink implements ITileDataSink {
|
||||||
|
|
||||||
|
public final Set<Integer> hashPois = new HashSet<>();
|
||||||
|
public final Set<Integer> hashWays = new HashSet<>();
|
||||||
|
|
||||||
|
public int level, levels;
|
||||||
private QueryResult result;
|
private QueryResult result;
|
||||||
private final ITileDataSink sink;
|
private final ITileDataSink sink;
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
* Copyright 2010, 2011, 2012 mapsforge.org
|
* Copyright 2010, 2011, 2012 mapsforge.org
|
||||||
* Copyright 2013, 2014 Hannes Janetzek
|
* Copyright 2013, 2014 Hannes Janetzek
|
||||||
* Copyright 2014-2015 Ludwig M Brinckmann
|
* Copyright 2014-2015 Ludwig M Brinckmann
|
||||||
* Copyright 2016-2020 devemux86
|
* Copyright 2016-2022 devemux86
|
||||||
* Copyright 2016 Andrey Novikov
|
* Copyright 2016 Andrey Novikov
|
||||||
* Copyright 2017-2018 Gustl22
|
* Copyright 2017-2018 Gustl22
|
||||||
* Copyright 2018 Bezzu
|
* Copyright 2018 Bezzu
|
||||||
@@ -31,6 +31,7 @@ import org.oscim.layers.tile.MapTile;
|
|||||||
import org.oscim.layers.tile.buildings.BuildingLayer;
|
import org.oscim.layers.tile.buildings.BuildingLayer;
|
||||||
import org.oscim.tiling.ITileDataSink;
|
import org.oscim.tiling.ITileDataSink;
|
||||||
import org.oscim.tiling.ITileDataSource;
|
import org.oscim.tiling.ITileDataSource;
|
||||||
|
import org.oscim.tiling.TileDataSink;
|
||||||
import org.oscim.tiling.source.mapfile.header.SubFileParameter;
|
import org.oscim.tiling.source.mapfile.header.SubFileParameter;
|
||||||
import org.oscim.utils.Parameters;
|
import org.oscim.utils.Parameters;
|
||||||
import org.oscim.utils.geom.TileClipper;
|
import org.oscim.utils.geom.TileClipper;
|
||||||
@@ -224,6 +225,8 @@ public class MapDatabase implements ITileDataSource {
|
|||||||
private int zoomLevelMin = 0;
|
private int zoomLevelMin = 0;
|
||||||
private int zoomLevelMax = Byte.MAX_VALUE;
|
private int zoomLevelMax = Byte.MAX_VALUE;
|
||||||
|
|
||||||
|
private boolean deduplicate;
|
||||||
|
|
||||||
public MapDatabase(MapFileTileSource tileSource) throws IOException {
|
public MapDatabase(MapFileTileSource tileSource) throws IOException {
|
||||||
mTileSource = tileSource;
|
mTileSource = tileSource;
|
||||||
try {
|
try {
|
||||||
@@ -306,7 +309,10 @@ public class MapDatabase implements ITileDataSource {
|
|||||||
|
|
||||||
QueryCalculations.calculateBaseTiles(queryParameters, tile, subFileParameter);
|
QueryCalculations.calculateBaseTiles(queryParameters, tile, subFileParameter);
|
||||||
QueryCalculations.calculateBlocks(queryParameters, subFileParameter);
|
QueryCalculations.calculateBlocks(queryParameters, subFileParameter);
|
||||||
processBlocks(sink, queryParameters, subFileParameter);
|
if (deduplicate)
|
||||||
|
processBlocks(sink, queryParameters, subFileParameter, tile.getBoundingBox(), Selector.ALL, new MapReadResult());
|
||||||
|
else
|
||||||
|
processBlocks(sink, queryParameters, subFileParameter);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
log.error(e.getMessage());
|
log.error(e.getMessage());
|
||||||
sink.completed(FAILED);
|
sink.completed(FAILED);
|
||||||
@@ -424,6 +430,10 @@ public class MapDatabase implements ITileDataSource {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void setDeduplicate(boolean deduplicate) {
|
||||||
|
this.deduplicate = deduplicate;
|
||||||
|
}
|
||||||
|
|
||||||
private void setTileClipping(QueryParameters queryParameters, SubFileParameter subFileParameter,
|
private void setTileClipping(QueryParameters queryParameters, SubFileParameter subFileParameter,
|
||||||
long currentRow, long currentCol) {
|
long currentRow, long currentCol) {
|
||||||
long numRows = queryParameters.toBlockY - queryParameters.fromBlockY;
|
long numRows = queryParameters.toBlockY - queryParameters.fromBlockY;
|
||||||
@@ -694,6 +704,7 @@ public class MapDatabase implements ITileDataSource {
|
|||||||
|
|
||||||
e.setLayer(layer);
|
e.setLayer(layer);
|
||||||
|
|
||||||
|
PointOfInterest poi = null;
|
||||||
if (pois != null) {
|
if (pois != null) {
|
||||||
List<Tag> tags = new ArrayList<>();
|
List<Tag> tags = new ArrayList<>();
|
||||||
for (int i = 0; i < e.tags.size(); i++)
|
for (int i = 0; i < e.tags.size(); i++)
|
||||||
@@ -702,12 +713,15 @@ public class MapDatabase implements ITileDataSource {
|
|||||||
// depending on the zoom level configuration the poi can lie outside
|
// depending on the zoom level configuration the poi can lie outside
|
||||||
// the tile requested, we filter them out here
|
// the tile requested, we filter them out here
|
||||||
if (!filterRequired || boundingBox.contains(position)) {
|
if (!filterRequired || boundingBox.contains(position)) {
|
||||||
pois.add(new PointOfInterest(layer, tags, position));
|
poi = new PointOfInterest(layer, tags, position);
|
||||||
|
pois.add(poi);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mapDataSink != null)
|
if (mapDataSink != null) {
|
||||||
mapDataSink.process(e);
|
if (!deduplicate || poi == null || (mapDataSink instanceof TileDataSink && ((TileDataSink) mapDataSink).hashPois.add(poi.hashCode())))
|
||||||
|
mapDataSink.process(e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@@ -822,6 +836,7 @@ public class MapDatabase implements ITileDataSource {
|
|||||||
|| e.tags.contains(TAG_ISSEA)
|
|| e.tags.contains(TAG_ISSEA)
|
||||||
|| e.tags.contains(TAG_SEA)
|
|| e.tags.contains(TAG_SEA)
|
||||||
|| e.tags.contains(TAG_NOSEA)
|
|| e.tags.contains(TAG_NOSEA)
|
||||||
|
|| e.tags.contains(Parameters.SIMPLIFICATION_EXCEPTIONS)
|
||||||
|| deltaLon > minDeltaLon || deltaLon < -minDeltaLon
|
|| deltaLon > minDeltaLon || deltaLon < -minDeltaLon
|
||||||
|| deltaLat > minDeltaLat || deltaLat < -minDeltaLat)) {
|
|| deltaLat > minDeltaLat || deltaLat < -minDeltaLat)) {
|
||||||
// Point reduction except lines and land/sea polygons
|
// Point reduction except lines and land/sea polygons
|
||||||
@@ -1047,6 +1062,7 @@ public class MapDatabase implements ITileDataSource {
|
|||||||
|
|
||||||
e.setLayer(layer);
|
e.setLayer(layer);
|
||||||
|
|
||||||
|
Way way = null;
|
||||||
if (ways != null) {
|
if (ways != null) {
|
||||||
BoundingBox wayFilterBbox = boundingBox.extendMeters(wayFilterDistance);
|
BoundingBox wayFilterBbox = boundingBox.extendMeters(wayFilterDistance);
|
||||||
GeoPoint[][] wayNodesArray = wayNodes.toArray(new GeoPoint[wayNodes.size()][]);
|
GeoPoint[][] wayNodesArray = wayNodes.toArray(new GeoPoint[wayNodes.size()][]);
|
||||||
@@ -1056,13 +1072,19 @@ public class MapDatabase implements ITileDataSource {
|
|||||||
tags.add(e.tags.get(i));
|
tags.add(e.tags.get(i));
|
||||||
if (Selector.ALL == selector || hasName || hasHouseNr || hasRef || wayAsLabelTagFilter(tags)) {
|
if (Selector.ALL == selector || hasName || hasHouseNr || hasRef || wayAsLabelTagFilter(tags)) {
|
||||||
GeoPoint labelPos = labelPosition != null ? new GeoPoint(labelPosition[1] / 1E6, labelPosition[0] / 1E6) : null;
|
GeoPoint labelPos = labelPosition != null ? new GeoPoint(labelPosition[1] / 1E6, labelPosition[0] / 1E6) : null;
|
||||||
ways.add(new Way(layer, tags, wayNodesArray, labelPos, e.type));
|
way = new Way(layer, tags, wayNodesArray, labelPos, e.type);
|
||||||
|
ways.add(way);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mapDataSink != null)
|
if (mapDataSink != null) {
|
||||||
mapDataSink.process(e);
|
if (!deduplicate || way == null || (mapDataSink instanceof TileDataSink && ((TileDataSink) mapDataSink).hashWays.add(way.hashCode()))) {
|
||||||
|
if (mapDataSink instanceof TileDataSink)
|
||||||
|
e.level = e.isLine() ? ((TileDataSink) mapDataSink).levels : ((TileDataSink) mapDataSink).level;
|
||||||
|
mapDataSink.process(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2010, 2011, 2012, 2013 mapsforge.org
|
* Copyright 2010, 2011, 2012, 2013 mapsforge.org
|
||||||
* Copyright 2014-2015 Ludwig M Brinckmann
|
* Copyright 2014-2015 Ludwig M Brinckmann
|
||||||
* Copyright 2017 devemux86
|
* Copyright 2015-2022 devemux86
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify it under the
|
* 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
|
* terms of the GNU Lesser General Public License as published by the Free Software
|
||||||
@@ -17,13 +17,21 @@
|
|||||||
package org.oscim.tiling.source.mapfile;
|
package org.oscim.tiling.source.mapfile;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An immutable container for the data returned from a MapDataStore.
|
* An immutable container for the data returned from a MapDataStore.
|
||||||
*/
|
*/
|
||||||
public class MapReadResult {
|
public class MapReadResult {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Hash codes.
|
||||||
|
*/
|
||||||
|
private final Set<Integer> hashPois = new HashSet<>();
|
||||||
|
private final Set<Integer> hashWays = new HashSet<>();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* True if the read area is completely covered by water, false otherwise.
|
* True if the read area is completely covered by water, false otherwise.
|
||||||
*/
|
*/
|
||||||
@@ -50,8 +58,8 @@ public class MapReadResult {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds other MapReadResult by combining pois and ways. Optionally, deduplication can
|
* Adds other MapReadResult by combining pois and ways.
|
||||||
* be requested (much more expensive).
|
* Optionally deduplication can be requested (more expensive).
|
||||||
*
|
*
|
||||||
* @param other the MapReadResult to add to this.
|
* @param other the MapReadResult to add to this.
|
||||||
* @param deduplicate true if check for duplicates is required.
|
* @param deduplicate true if check for duplicates is required.
|
||||||
@@ -59,12 +67,12 @@ public class MapReadResult {
|
|||||||
public void add(MapReadResult other, boolean deduplicate) {
|
public void add(MapReadResult other, boolean deduplicate) {
|
||||||
if (deduplicate) {
|
if (deduplicate) {
|
||||||
for (PointOfInterest poi : other.pointOfInterests) {
|
for (PointOfInterest poi : other.pointOfInterests) {
|
||||||
if (!this.pointOfInterests.contains(poi)) {
|
if (this.hashPois.add(poi.hashCode())) {
|
||||||
this.pointOfInterests.add(poi);
|
this.pointOfInterests.add(poi);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (Way way : other.ways) {
|
for (Way way : other.ways) {
|
||||||
if (!this.ways.contains(way)) {
|
if (this.hashWays.add(way.hashCode())) {
|
||||||
this.ways.add(way);
|
this.ways.add(way);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -73,5 +81,4 @@ public class MapReadResult {
|
|||||||
this.ways.addAll(other.ways);
|
this.ways.addAll(other.ways);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2016-2018 devemux86
|
* Copyright 2016-2022 devemux86
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify it under the
|
* 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
|
* terms of the GNU Lesser General Public License as published by the Free Software
|
||||||
@@ -18,6 +18,7 @@ import org.oscim.core.Tile;
|
|||||||
import org.oscim.layers.tile.MapTile;
|
import org.oscim.layers.tile.MapTile;
|
||||||
import org.oscim.tiling.ITileDataSink;
|
import org.oscim.tiling.ITileDataSink;
|
||||||
import org.oscim.tiling.ITileDataSource;
|
import org.oscim.tiling.ITileDataSource;
|
||||||
|
import org.oscim.tiling.QueryResult;
|
||||||
import org.oscim.tiling.TileDataSink;
|
import org.oscim.tiling.TileDataSink;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@@ -25,9 +26,15 @@ import java.util.List;
|
|||||||
|
|
||||||
public class MultiMapDatabase implements ITileDataSource {
|
public class MultiMapDatabase implements ITileDataSource {
|
||||||
|
|
||||||
|
private final boolean deduplicate;
|
||||||
private final List<MapDatabase> mapDatabases = new ArrayList<>();
|
private final List<MapDatabase> mapDatabases = new ArrayList<>();
|
||||||
|
|
||||||
public MultiMapDatabase() {
|
public MultiMapDatabase() {
|
||||||
|
this(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public MultiMapDatabase(boolean deduplicate) {
|
||||||
|
this.deduplicate = deduplicate;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean add(MapDatabase mapDatabase) {
|
public boolean add(MapDatabase mapDatabase) {
|
||||||
@@ -39,12 +46,30 @@ public class MultiMapDatabase implements ITileDataSource {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void query(MapTile tile, ITileDataSink sink) {
|
public void query(MapTile tile, ITileDataSink sink) {
|
||||||
TileDataSink dataSink = new TileDataSink(sink);
|
boolean deduplicate = this.deduplicate;
|
||||||
for (MapDatabase mapDatabase : mapDatabases) {
|
if (deduplicate) {
|
||||||
if (mapDatabase.supportsTile(tile))
|
int n = 0;
|
||||||
mapDatabase.query(tile, dataSink);
|
for (MapDatabase mapDatabase : mapDatabases) {
|
||||||
|
if (mapDatabase.supportsTile(tile)) {
|
||||||
|
if (++n > 1) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
deduplicate = n > 1;
|
||||||
}
|
}
|
||||||
sink.completed(dataSink.getResult());
|
|
||||||
|
TileDataSink dataSink = new TileDataSink(sink);
|
||||||
|
for (int i = 0, n = mapDatabases.size(); i < n; i++) {
|
||||||
|
MapDatabase mapDatabase = mapDatabases.get(i);
|
||||||
|
if (mapDatabase.supportsTile(tile)) {
|
||||||
|
mapDatabase.setDeduplicate(deduplicate);
|
||||||
|
dataSink.level = i + 1;
|
||||||
|
dataSink.levels = n;
|
||||||
|
mapDatabase.query(tile, dataSink);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
sink.completed(QueryResult.SUCCESS);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -61,7 +86,7 @@ public class MultiMapDatabase implements ITileDataSource {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public MapReadResult readLabels(Tile tile) {
|
public MapReadResult readLabels(Tile tile, boolean deduplicate) {
|
||||||
MapReadResult mapReadResult = new MapReadResult();
|
MapReadResult mapReadResult = new MapReadResult();
|
||||||
for (MapDatabase mdb : mapDatabases) {
|
for (MapDatabase mdb : mapDatabases) {
|
||||||
if (mdb.supportsTile(tile)) {
|
if (mdb.supportsTile(tile)) {
|
||||||
@@ -71,13 +96,13 @@ public class MultiMapDatabase implements ITileDataSource {
|
|||||||
}
|
}
|
||||||
boolean isWater = mapReadResult.isWater & result.isWater;
|
boolean isWater = mapReadResult.isWater & result.isWater;
|
||||||
mapReadResult.isWater = isWater;
|
mapReadResult.isWater = isWater;
|
||||||
mapReadResult.add(result, false);
|
mapReadResult.add(result, deduplicate);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return mapReadResult;
|
return mapReadResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
public MapReadResult readLabels(Tile upperLeft, Tile lowerRight) {
|
public MapReadResult readLabels(Tile upperLeft, Tile lowerRight, boolean deduplicate) {
|
||||||
MapReadResult mapReadResult = new MapReadResult();
|
MapReadResult mapReadResult = new MapReadResult();
|
||||||
for (MapDatabase mdb : mapDatabases) {
|
for (MapDatabase mdb : mapDatabases) {
|
||||||
if (mdb.supportsTile(upperLeft)) {
|
if (mdb.supportsTile(upperLeft)) {
|
||||||
@@ -87,13 +112,13 @@ public class MultiMapDatabase implements ITileDataSource {
|
|||||||
}
|
}
|
||||||
boolean isWater = mapReadResult.isWater & result.isWater;
|
boolean isWater = mapReadResult.isWater & result.isWater;
|
||||||
mapReadResult.isWater = isWater;
|
mapReadResult.isWater = isWater;
|
||||||
mapReadResult.add(result, false);
|
mapReadResult.add(result, deduplicate);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return mapReadResult;
|
return mapReadResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
public MapReadResult readMapData(Tile tile) {
|
public MapReadResult readMapData(Tile tile, boolean deduplicate) {
|
||||||
MapReadResult mapReadResult = new MapReadResult();
|
MapReadResult mapReadResult = new MapReadResult();
|
||||||
for (MapDatabase mdb : mapDatabases) {
|
for (MapDatabase mdb : mapDatabases) {
|
||||||
if (mdb.supportsTile(tile)) {
|
if (mdb.supportsTile(tile)) {
|
||||||
@@ -103,13 +128,13 @@ public class MultiMapDatabase implements ITileDataSource {
|
|||||||
}
|
}
|
||||||
boolean isWater = mapReadResult.isWater & result.isWater;
|
boolean isWater = mapReadResult.isWater & result.isWater;
|
||||||
mapReadResult.isWater = isWater;
|
mapReadResult.isWater = isWater;
|
||||||
mapReadResult.add(result, false);
|
mapReadResult.add(result, deduplicate);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return mapReadResult;
|
return mapReadResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
public MapReadResult readMapData(Tile upperLeft, Tile lowerRight) {
|
public MapReadResult readMapData(Tile upperLeft, Tile lowerRight, boolean deduplicate) {
|
||||||
MapReadResult mapReadResult = new MapReadResult();
|
MapReadResult mapReadResult = new MapReadResult();
|
||||||
for (MapDatabase mdb : mapDatabases) {
|
for (MapDatabase mdb : mapDatabases) {
|
||||||
if (mdb.supportsTile(upperLeft)) {
|
if (mdb.supportsTile(upperLeft)) {
|
||||||
@@ -119,13 +144,13 @@ public class MultiMapDatabase implements ITileDataSource {
|
|||||||
}
|
}
|
||||||
boolean isWater = mapReadResult.isWater & result.isWater;
|
boolean isWater = mapReadResult.isWater & result.isWater;
|
||||||
mapReadResult.isWater = isWater;
|
mapReadResult.isWater = isWater;
|
||||||
mapReadResult.add(result, false);
|
mapReadResult.add(result, deduplicate);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return mapReadResult;
|
return mapReadResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
public MapReadResult readPoiData(Tile tile) {
|
public MapReadResult readPoiData(Tile tile, boolean deduplicate) {
|
||||||
MapReadResult mapReadResult = new MapReadResult();
|
MapReadResult mapReadResult = new MapReadResult();
|
||||||
for (MapDatabase mdb : mapDatabases) {
|
for (MapDatabase mdb : mapDatabases) {
|
||||||
if (mdb.supportsTile(tile)) {
|
if (mdb.supportsTile(tile)) {
|
||||||
@@ -135,13 +160,13 @@ public class MultiMapDatabase implements ITileDataSource {
|
|||||||
}
|
}
|
||||||
boolean isWater = mapReadResult.isWater & result.isWater;
|
boolean isWater = mapReadResult.isWater & result.isWater;
|
||||||
mapReadResult.isWater = isWater;
|
mapReadResult.isWater = isWater;
|
||||||
mapReadResult.add(result, false);
|
mapReadResult.add(result, deduplicate);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return mapReadResult;
|
return mapReadResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
public MapReadResult readPoiData(Tile upperLeft, Tile lowerRight) {
|
public MapReadResult readPoiData(Tile upperLeft, Tile lowerRight, boolean deduplicate) {
|
||||||
MapReadResult mapReadResult = new MapReadResult();
|
MapReadResult mapReadResult = new MapReadResult();
|
||||||
for (MapDatabase mdb : mapDatabases) {
|
for (MapDatabase mdb : mapDatabases) {
|
||||||
if (mdb.supportsTile(upperLeft)) {
|
if (mdb.supportsTile(upperLeft)) {
|
||||||
@@ -151,7 +176,7 @@ public class MultiMapDatabase implements ITileDataSource {
|
|||||||
}
|
}
|
||||||
boolean isWater = mapReadResult.isWater & result.isWater;
|
boolean isWater = mapReadResult.isWater & result.isWater;
|
||||||
mapReadResult.isWater = isWater;
|
mapReadResult.isWater = isWater;
|
||||||
mapReadResult.add(result, false);
|
mapReadResult.add(result, deduplicate);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return mapReadResult;
|
return mapReadResult;
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2016-2018 devemux86
|
* Copyright 2016-2022 devemux86
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify it under the
|
* 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
|
* terms of the GNU Lesser General Public License as published by the Free Software
|
||||||
@@ -33,6 +33,7 @@ public class MultiMapFileTileSource extends TileSource implements IMapFileTileSo
|
|||||||
|
|
||||||
private static final Logger log = LoggerFactory.getLogger(MultiMapFileTileSource.class);
|
private static final Logger log = LoggerFactory.getLogger(MultiMapFileTileSource.class);
|
||||||
|
|
||||||
|
private boolean deduplicate;
|
||||||
private final List<MapFileTileSource> mapFileTileSources = new ArrayList<>();
|
private final List<MapFileTileSource> mapFileTileSources = new ArrayList<>();
|
||||||
private final Map<MapFileTileSource, int[]> zoomsByTileSource = new HashMap<>();
|
private final Map<MapFileTileSource, int[]> zoomsByTileSource = new HashMap<>();
|
||||||
|
|
||||||
@@ -72,7 +73,7 @@ public class MultiMapFileTileSource extends TileSource implements IMapFileTileSo
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ITileDataSource getDataSource() {
|
public ITileDataSource getDataSource() {
|
||||||
MultiMapDatabase multiMapDatabase = new MultiMapDatabase();
|
MultiMapDatabase multiMapDatabase = new MultiMapDatabase(deduplicate);
|
||||||
for (MapFileTileSource mapFileTileSource : mapFileTileSources) {
|
for (MapFileTileSource mapFileTileSource : mapFileTileSources) {
|
||||||
try {
|
try {
|
||||||
MapDatabase mapDatabase = new MapDatabase(mapFileTileSource);
|
MapDatabase mapDatabase = new MapDatabase(mapFileTileSource);
|
||||||
@@ -112,6 +113,10 @@ public class MultiMapFileTileSource extends TileSource implements IMapFileTileSo
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setDeduplicate(boolean deduplicate) {
|
||||||
|
this.deduplicate = deduplicate;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setPreferredLanguage(String preferredLanguage) {
|
public void setPreferredLanguage(String preferredLanguage) {
|
||||||
for (MapFileTileSource mapFileTileSource : mapFileTileSources) {
|
for (MapFileTileSource mapFileTileSource : mapFileTileSources) {
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2017-2020 devemux86
|
* Copyright 2017-2022 devemux86
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify it under the
|
* 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
|
* terms of the GNU Lesser General Public License as published by the Free Software
|
||||||
@@ -14,6 +14,11 @@
|
|||||||
*/
|
*/
|
||||||
package org.oscim.utils;
|
package org.oscim.utils;
|
||||||
|
|
||||||
|
import org.oscim.core.Tag;
|
||||||
|
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
public final class Parameters {
|
public final class Parameters {
|
||||||
|
|
||||||
public enum SymbolScaling {ALL, POI}
|
public enum SymbolScaling {ALL, POI}
|
||||||
@@ -74,6 +79,11 @@ public final class Parameters {
|
|||||||
*/
|
*/
|
||||||
public static boolean POT_TEXTURES = false;
|
public static boolean POT_TEXTURES = false;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Simplification exceptions.
|
||||||
|
*/
|
||||||
|
public static final Set<Tag> SIMPLIFICATION_EXCEPTIONS = new HashSet<>();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Reduce points on-the-fly while reading from map files.
|
* Reduce points on-the-fly while reading from map files.
|
||||||
* e.g. 0 (no simplification), 2, 4, ...
|
* e.g. 0 (no simplification), 2, 4, ...
|
||||||
|
|||||||
Reference in New Issue
Block a user