Compare commits
90 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c0d5f4a0ca | ||
|
|
2859a18d72 | ||
|
|
869446ad13 | ||
|
|
b2fd22885e | ||
|
|
7d6c623a80 | ||
|
|
6bea801bf6 | ||
|
|
d446a3448b | ||
|
|
d006ba5361 | ||
|
|
0eb4f3752f | ||
|
|
789c280fc2 | ||
|
|
a881eec9b1 | ||
|
|
1bc1d88464 | ||
|
|
1c18221f05 | ||
|
|
f4162acf04 | ||
|
|
1138978c22 | ||
|
|
bd43baba20 | ||
|
|
2e6da74af8 | ||
|
|
f6561d2a2e | ||
|
|
45a42bb242 | ||
|
|
3043173814 | ||
|
|
cde5d898c7 | ||
|
|
58f6215c0f | ||
|
|
d7d6fa57ac | ||
|
|
57bf615ab7 | ||
|
|
9bf3161010 | ||
|
|
98a977ea72 | ||
|
|
661bc08bbf | ||
|
|
804c8c4603 | ||
|
|
e103c38e3e | ||
|
|
e3b4ff502e | ||
|
|
6116ebb348 | ||
|
|
5c3a728d05 | ||
|
|
2070145880 | ||
|
|
e9a670f274 | ||
|
|
e5c87ba06e | ||
|
|
fa992b93f5 | ||
|
|
bf67074cf3 | ||
|
|
074320d6d2 | ||
|
|
6616c22a32 | ||
|
|
1ddba0fe8f | ||
|
|
0a374bc635 | ||
|
|
8602b5780a | ||
|
|
ab32f25a7c | ||
|
|
ebfb7bd85d | ||
|
|
ed739c59f5 | ||
|
|
238a5f8f14 | ||
|
|
126c47dfd7 | ||
|
|
e8389e6887 | ||
|
|
81f526dc56 | ||
|
|
23ae072ed6 | ||
|
|
20f4fad7f3 | ||
|
|
1805e86173 | ||
|
|
8acda4fbf5 | ||
|
|
65d8bd9675 | ||
|
|
34ea0af92d | ||
|
|
2d64186a1a | ||
|
|
4604f07042 | ||
|
|
52f47bd797 | ||
|
|
50f885b5f8 | ||
|
|
742405a193 | ||
|
|
18ee0a393f | ||
|
|
29634d29b5 | ||
|
|
635d5bacdd | ||
|
|
1156976ea5 | ||
|
|
964736d60f | ||
|
|
2de19ef080 | ||
|
|
0faf3eca66 | ||
|
|
c239d8c1b7 | ||
|
|
c28aec5f59 | ||
|
|
e0efff50a8 | ||
|
|
8364ff83d1 | ||
|
|
5d7a4e0954 | ||
|
|
2785d22a3a | ||
|
|
2768f84a5f | ||
|
|
1ede5c5456 | ||
|
|
5778d0e74a | ||
|
|
6672c57f05 | ||
|
|
c1fbdb42be | ||
|
|
841b3af042 | ||
|
|
bdd08e3486 | ||
|
|
68679c6dc0 | ||
|
|
9f280a41c0 | ||
|
|
65c8d5199f | ||
|
|
2b8326f465 | ||
|
|
488b350671 | ||
|
|
5285b0c272 | ||
|
|
ebe98c8990 | ||
|
|
c30095c59d | ||
|
|
f449a0a6fb | ||
|
|
74dfa07c81 |
@@ -4,8 +4,8 @@ jdk:
|
|||||||
- openjdk8
|
- openjdk8
|
||||||
env:
|
env:
|
||||||
global:
|
global:
|
||||||
- ANDROID=29
|
- ANDROID=30
|
||||||
- ANDROID_BUILD_TOOLS=29.0.2
|
- ANDROID_BUILD_TOOLS=30.0.3
|
||||||
- GRADLE_OPTS="-Xmx2048m"
|
- 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: 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=
|
- secure: AdKSZKA4gMuKXI4X4dQNJqcMv5OmPIHdN8fpy55Y9yoOQPQHZE3Zwc4QDWBh20q298jyEC854tVTPTysdZ7h+2s2FhsprYv1Bt/QNzKIrLpeIMj2quuVGMbdPuk08y55gost94KwVLJv0sIDpRlB/PEQkA7Mg/UDsT9zR8E1Ms5x+ul2C8e1ag0zzNl1wVnT5jY8WCp74uA/XXCcJl/80qT1stUERazCKwbKNo007hi7rdm4HA7YGevORq8e2r67je+WIBZUAwrHT0Zjuo4ibwUii4LdwvjuN3w0Z6e9Wf4x5bBqGgnih0T31uom2yPjNx+U/c2AWI+Nxfy/SEF2U+9bjBEZ3ZhI7F1B9ofXo2mhvvsVDiUrymMBbG2V64C9kAzeUh7xIBTqIrbdtpAEBV9FlLAtF2swVTwtCgZgcVTOt3RKXCi3X3nk3cuH7PAorFa/QGfT4xxVu2011FVAt2Rm7SD0ZWztZTSTz/4Nt/egtGBOJfrCc7oLEygLzDmLqsqCwCROITVQjWLjrtqDyLteaNiSXeNIQMKun3izApbXnHmXB+FV3R3EZocboqk3v5bmPTahnG6Ghc2zknWyyxSx+O9qIfOpHUL8JMJiT82lUQUeibtCn7DCE8wVQ/gYC5i+a+KO/d3NemSzIFlZ8aoUiEPYq18dYlsDXeLXwF0=
|
||||||
|
|||||||
14
build.gradle
14
build.gradle
@@ -4,7 +4,7 @@ buildscript {
|
|||||||
jcenter()
|
jcenter()
|
||||||
}
|
}
|
||||||
dependencies {
|
dependencies {
|
||||||
classpath 'com.android.tools.build:gradle:3.5.3'
|
classpath 'com.android.tools.build:gradle:4.0.2'
|
||||||
classpath 'com.github.dcendents:android-maven-gradle-plugin:2.1'
|
classpath 'com.github.dcendents:android-maven-gradle-plugin:2.1'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -14,7 +14,7 @@ allprojects {
|
|||||||
version = 'master-SNAPSHOT'
|
version = 'master-SNAPSHOT'
|
||||||
ext.isReleaseVersion = !version.endsWith("SNAPSHOT")
|
ext.isReleaseVersion = !version.endsWith("SNAPSHOT")
|
||||||
|
|
||||||
ext.androidBuildVersionTools = "29.0.2"
|
ext.androidBuildVersionTools = "30.0.3"
|
||||||
ext.gdxVersion = "1.9.10"
|
ext.gdxVersion = "1.9.10"
|
||||||
ext.gwtVersion = "2.8.2"
|
ext.gwtVersion = "2.8.2"
|
||||||
ext.slf4jVersion = "1.7.28"
|
ext.slf4jVersion = "1.7.28"
|
||||||
@@ -28,12 +28,12 @@ allprojects {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static def androidCompileSdk() { return 29 }
|
static def androidCompileSdk() { return 30 }
|
||||||
|
|
||||||
// 14 for Support Library, 16 for sqlite-android
|
// 14 for Support Library, 16 for sqlite-android
|
||||||
static def androidMinSdk() { return 16 }
|
static def androidMinSdk() { return 16 }
|
||||||
|
|
||||||
static def androidTargetSdk() { return 29 }
|
static def androidTargetSdk() { return 30 }
|
||||||
|
|
||||||
static def versionCode() { return 1 }
|
static def versionCode() { return 1 }
|
||||||
|
|
||||||
@@ -42,7 +42,6 @@ def versionName() { return version }
|
|||||||
subprojects {
|
subprojects {
|
||||||
repositories {
|
repositories {
|
||||||
google()
|
google()
|
||||||
maven { url 'https://repo.boundlessgeo.com/main/' }
|
|
||||||
jcenter()
|
jcenter()
|
||||||
maven { url 'https://jitpack.io' }
|
maven { url 'https://jitpack.io' }
|
||||||
}
|
}
|
||||||
@@ -51,5 +50,10 @@ subprojects {
|
|||||||
sourceCompatibility = JavaVersion.VERSION_1_7
|
sourceCompatibility = JavaVersion.VERSION_1_7
|
||||||
targetCompatibility = JavaVersion.VERSION_1_7
|
targetCompatibility = JavaVersion.VERSION_1_7
|
||||||
options.encoding = 'UTF-8'
|
options.encoding = 'UTF-8'
|
||||||
|
if (JavaVersion.current().isJava9Compatible()) {
|
||||||
|
if (!project.properties.containsKey('android')) {
|
||||||
|
options.compilerArgs.addAll(['--release', '7'])
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ if (project.hasProperty("android")) {
|
|||||||
task javadoc(type: Javadoc) {
|
task javadoc(type: Javadoc) {
|
||||||
source = android.sourceSets.main.java.srcDirs
|
source = android.sourceSets.main.java.srcDirs
|
||||||
classpath += project.files(android.getBootClasspath().join(File.pathSeparator))
|
classpath += project.files(android.getBootClasspath().join(File.pathSeparator))
|
||||||
|
classpath += project.android.libraryVariants.toList().first().javaCompileProvider.get().classpath
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
task sourcesJar(type: Jar) {
|
task sourcesJar(type: Jar) {
|
||||||
|
|||||||
@@ -7,6 +7,7 @@
|
|||||||
| [Cruiser](http://wiki.openstreetmap.org/wiki/Cruiser) | Map and navigation application | Proprietary/Free | Android, Desktop | Closed |
|
| [Cruiser](http://wiki.openstreetmap.org/wiki/Cruiser) | Map and navigation application | Proprietary/Free | Android, Desktop | Closed |
|
||||||
| [GCDroid](https://play.google.com/store/apps/details?id=com.gcdroid) | Geocaching App | Proprietary/Free and Commercial | Android | 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 |
|
| [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 |
|
| [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 |
|
| [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 |
|
| [MapTrek](http://maptrek.mobi) | Application for outdoor activities | GPL3/Free and Commercial | Android | Open |
|
||||||
@@ -18,6 +19,7 @@
|
|||||||
| [topoGuide](http://www.topoguide.gr/index-en.php) | Digital guides for the outdoor | Proprietary/Free and Commercial | Android | Closed |
|
| [topoGuide](http://www.topoguide.gr/index-en.php) | Digital guides for the outdoor | Proprietary/Free and Commercial | Android | Closed |
|
||||||
| [Ubitrek](https://play.google.com/store/apps/details?id=ubicarta.ubitrek) | Hiking with IGN maps | Proprietary/Free | Android | Closed |
|
| [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 |
|
| [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 |
|
| [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).
|
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).
|
||||||
|
|||||||
@@ -2,9 +2,7 @@
|
|||||||
|
|
||||||
As an open source project, we welcome new contributors and appreciate your help.
|
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).
|
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.
|
||||||
|
|
||||||
You may also create a new issue on [Github](https://github.com/mapsforge/vtm/issues) or comment on an existing one to describe your ideas. 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.
|
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.
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,31 @@
|
|||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
|
## New since 0.15.0
|
||||||
|
|
||||||
|
- Many other 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 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`
|
||||||
|
- Many other 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)
|
||||||
|
- More mutable itemized layer [#771](https://github.com/mapsforge/vtm/pull/771)
|
||||||
|
- 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
|
||||||
|
- [Solved issues](https://github.com/mapsforge/vtm/issues?q=is%3Aclosed+milestone%3A0.14.0)
|
||||||
|
|
||||||
## Version 0.13.0 (2020-01-12)
|
## Version 0.13.0 (2020-01-12)
|
||||||
|
|
||||||
- Render themes: symbols on lines with billboard / rotation [#743](https://github.com/mapsforge/vtm/pull/743)
|
- Render themes: symbols on lines with billboard / rotation [#743](https://github.com/mapsforge/vtm/pull/743)
|
||||||
@@ -214,6 +240,8 @@
|
|||||||
- libGDX layer gestures [#151](https://github.com/mapsforge/vtm/issues/151)
|
- 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 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 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)
|
- 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)
|
- 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)
|
- vtm-jts module [#53](https://github.com/mapsforge/vtm/issues/53)
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
For questions, reports and discussion please always use the [forum](https://groups.google.com/group/mapsforge-dev).
|
For questions or discussion please use the [forum](https://groups.google.com/group/mapsforge-dev).
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ Current version is [
|
### Desktop (LWJGL)
|
||||||
```groovy
|
```groovy
|
||||||
|
implementation 'org.mapsforge:vtm-desktop-lwjgl:[CURRENT-VERSION]'
|
||||||
implementation 'com.badlogicgames.gdx:gdx-backend-lwjgl:1.9.10'
|
implementation 'com.badlogicgames.gdx:gdx-backend-lwjgl:1.9.10'
|
||||||
implementation 'org.lwjgl.lwjgl:lwjgl:2.9.3'
|
implementation 'org.lwjgl.lwjgl:lwjgl:2.9.3'
|
||||||
implementation 'org.lwjgl.lwjgl:lwjgl-platform:2.9.3:natives-linux'
|
implementation 'org.lwjgl.lwjgl:lwjgl-platform:2.9.3:natives-linux'
|
||||||
@@ -73,6 +74,7 @@ implementation 'org.lwjgl.lwjgl:lwjgl-platform:2.9.3:natives-windows'
|
|||||||
|
|
||||||
### Desktop (LWJGL 3)
|
### Desktop (LWJGL 3)
|
||||||
```groovy
|
```groovy
|
||||||
|
implementation 'org.mapsforge:vtm-desktop-lwjgl3:[CURRENT-VERSION]'
|
||||||
implementation 'com.badlogicgames.gdx:gdx-backend-lwjgl3:1.9.10'
|
implementation 'com.badlogicgames.gdx:gdx-backend-lwjgl3:1.9.10'
|
||||||
implementation 'org.lwjgl:lwjgl:3.2.3'
|
implementation 'org.lwjgl:lwjgl:3.2.3'
|
||||||
implementation 'org.lwjgl:lwjgl:3.2.3:natives-linux'
|
implementation 'org.lwjgl:lwjgl:3.2.3:natives-linux'
|
||||||
@@ -129,29 +131,15 @@ implementation 'com.fasterxml.jackson.core:jackson-databind:2.9.9'
|
|||||||
|
|
||||||
### jeo (indoor maps)
|
### jeo (indoor maps)
|
||||||
|
|
||||||
Add _first_ the Boundless repository:
|
|
||||||
```groovy
|
```groovy
|
||||||
repositories {
|
repositories {
|
||||||
maven { url 'https://repo.boundlessgeo.com/main/' }
|
maven { url 'https://jitpack.io' }
|
||||||
jcenter()
|
|
||||||
...
|
|
||||||
}
|
}
|
||||||
```
|
|
||||||
|
|
||||||
```groovy
|
|
||||||
implementation 'org.mapsforge:vtm-jeo:[CURRENT-VERSION]'
|
implementation 'org.mapsforge:vtm-jeo:[CURRENT-VERSION]'
|
||||||
implementation('org.jeo:jeo:0-SNAPSHOT') {
|
implementation('com.github.jeo.jeo:jeo-carto:master-SNAPSHOT') {
|
||||||
exclude group: 'org.slf4j', module: 'slf4j-jdk14'
|
exclude group: 'org.slf4j', module: 'slf4j-jdk14'
|
||||||
}
|
}
|
||||||
implementation('org.jeo:jeo-carto:0-SNAPSHOT') {
|
|
||||||
exclude group: 'org.slf4j', module: 'slf4j-jdk14'
|
|
||||||
}
|
|
||||||
implementation('org.jeo:jeo-render:0-SNAPSHOT') {
|
|
||||||
exclude group: 'org.slf4j', module: 'slf4j-jdk14'
|
|
||||||
}
|
|
||||||
implementation 'org.osgeo:proj4j:0.1.0:jeo'
|
|
||||||
implementation 'com.metaweb:lessen:1.0'
|
|
||||||
implementation 'com.vividsolutions:jts:1.13'
|
|
||||||
```
|
```
|
||||||
|
|
||||||
## Snapshots
|
## Snapshots
|
||||||
|
|||||||
@@ -1,11 +1,12 @@
|
|||||||
# Mapsforge map providers (in lexical order)
|
# Mapsforge map providers (in lexical order)
|
||||||
|
|
||||||
- [AndroidMaps](http://www.androidmaps.co.uk/)
|
- [AndroidMaps](https://www.androidmaps.co.uk/)
|
||||||
- [Freizeitkarte](http://www.freizeitkarte-osm.de/android/en/index.html)
|
- [BBBike](https://extract.bbbike.org/?format=mapsforge-osm.zip)
|
||||||
- [Kurviger](https://offline-maps.kurviger.de/)
|
- [Freizeitkarte](https://www.freizeitkarte-osm.de/android/en/index.html)
|
||||||
- [Mapsforge](http://download.mapsforge.org/)
|
- [Kurviger](https://download.kurviger.de/)
|
||||||
- [OpenAndroMaps](http://www.openandromaps.org/en/)
|
- [Mapsforge](https://download.mapsforge.org/)
|
||||||
- [OpenMaps](http://openmaps.eu/)
|
- [OpenAndroMaps](https://www.openandromaps.org/en/)
|
||||||
|
- [OpenMaps](https://openmaps.eu/)
|
||||||
- [vector.city](https://vector.city/)
|
- [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).
|
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).
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
**This article describes how to use XML-based render-themes to style maps.**
|
**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. You can also report bugs and improvement requests via our [issue tracker](https://github.com/mapsforge/vtm/issues).
|
If you have any questions or problems, don't hesitate to ask our public [forum](https://groups.google.com/group/mapsforge-dev) for help.
|
||||||
|
|
||||||
## Introduction
|
## Introduction
|
||||||
|
|
||||||
@@ -109,11 +109,12 @@ There are different possibilities to simplify and accelerate map styling or chan
|
|||||||
|
|
||||||
### Style patterns
|
### Style patterns
|
||||||
|
|
||||||
If you want to use a specific style multiple times you not have to rewrite it for each text, area, or line rule.
|
If you want to use a specific style multiple times you not have to rewrite it for each text, line, area or symbol rule.
|
||||||
If you define a style set an `id` and use it with `use` in your rendering instructions:
|
If you define a style set an `id` and use it with `use` in your rendering instructions:
|
||||||
- `style-text`
|
- `style-text`
|
||||||
- `style-line`
|
- `style-line`
|
||||||
- `style-area`
|
- `style-area`
|
||||||
|
- `style-symbol`
|
||||||
|
|
||||||
This example styles all areas with the_residential_ style, which haven't the `highway` or `building` key.
|
This example styles all areas with the_residential_ style, which haven't the `highway` or `building` key.
|
||||||
|
|
||||||
|
|||||||
@@ -6,14 +6,14 @@
|
|||||||
# http://www.gradle.org/docs/current/userguide/build_environment.html
|
# http://www.gradle.org/docs/current/userguide/build_environment.html
|
||||||
# Specifies the JVM arguments used for the daemon process.
|
# Specifies the JVM arguments used for the daemon process.
|
||||||
# The setting is particularly useful for tweaking memory settings.
|
# The setting is particularly useful for tweaking memory settings.
|
||||||
org.gradle.jvmargs=-Xmx1536m
|
org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8
|
||||||
# When configured, Gradle will run in incubating parallel mode.
|
# When configured, Gradle will run in incubating parallel mode.
|
||||||
# This option should only be used with decoupled projects. More details, visit
|
# 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
|
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
|
||||||
# org.gradle.parallel=true
|
# org.gradle.parallel=true
|
||||||
# AndroidX package structure to make it clearer which packages are bundled with the
|
# 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
|
# https://developer.android.com/topic/libraries/support-library/androidx-rn
|
||||||
android.useAndroidX=true
|
android.useAndroidX=true
|
||||||
# Automatically convert third-party libraries to use AndroidX
|
# Automatically convert third-party libraries to use AndroidX
|
||||||
android.enableJetifier=true
|
android.enableJetifier=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-5.4.1-all.zip
|
distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-all.zip
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
zipStorePath=wrapper/dists
|
zipStorePath=wrapper/dists
|
||||||
|
|||||||
@@ -233,7 +233,11 @@
|
|||||||
|
|
||||||
<xs:complexType name="symbol">
|
<xs:complexType name="symbol">
|
||||||
<xs:attribute name="cat" type="xs:string" use="optional" />
|
<xs:attribute name="cat" type="xs:string" use="optional" />
|
||||||
<xs:attribute name="src" type="tns:src" use="required" />
|
|
||||||
|
<xs:attribute name="id" default="0" type="xs:string" use="optional" />
|
||||||
|
<xs:attribute name="use" default="0" type="xs:string" use="optional" />
|
||||||
|
|
||||||
|
<xs:attribute name="src" type="tns:src" use="optional" />
|
||||||
<xs:attribute name="symbol-width" type="xs:positiveInteger" use="optional" />
|
<xs:attribute name="symbol-width" type="xs:positiveInteger" use="optional" />
|
||||||
<xs:attribute name="symbol-height" type="xs:positiveInteger" use="optional" />
|
<xs:attribute name="symbol-height" type="xs:positiveInteger" use="optional" />
|
||||||
<xs:attribute name="symbol-percent" type="xs:positiveInteger" use="optional" />
|
<xs:attribute name="symbol-percent" type="xs:positiveInteger" use="optional" />
|
||||||
@@ -332,6 +336,7 @@
|
|||||||
<xs:sequence maxOccurs="256" minOccurs="0">
|
<xs:sequence maxOccurs="256" minOccurs="0">
|
||||||
<xs:choice maxOccurs="unbounded" minOccurs="0">
|
<xs:choice maxOccurs="unbounded" minOccurs="0">
|
||||||
<xs:element name="style-text" type="tns:text" />
|
<xs:element name="style-text" type="tns:text" />
|
||||||
|
<xs:element name="style-symbol" type="tns:symbol" />
|
||||||
<xs:element name="style-area" type="tns:area" />
|
<xs:element name="style-area" type="tns:area" />
|
||||||
<xs:element name="style-line" type="tns:line" />
|
<xs:element name="style-line" type="tns:line" />
|
||||||
<!-- <xs:element name="style-outline" type="tns:line" /> -->
|
<!-- <xs:element name="style-outline" type="tns:line" /> -->
|
||||||
|
|||||||
@@ -15,6 +15,7 @@
|
|||||||
android:allowBackup="true"
|
android:allowBackup="true"
|
||||||
android:icon="@mipmap/ic_launcher"
|
android:icon="@mipmap/ic_launcher"
|
||||||
android:label="@string/app_name"
|
android:label="@string/app_name"
|
||||||
|
android:requestLegacyExternalStorage="true"
|
||||||
android:usesCleartextTraffic="true">
|
android:usesCleartextTraffic="true">
|
||||||
<activity
|
<activity
|
||||||
android:name=".Samples"
|
android:name=".Samples"
|
||||||
@@ -33,6 +34,9 @@
|
|||||||
<activity
|
<activity
|
||||||
android:name=".ClusterMarkerOverlayActivity"
|
android:name=".ClusterMarkerOverlayActivity"
|
||||||
android:configChanges="keyboardHidden|orientation|screenSize" />
|
android:configChanges="keyboardHidden|orientation|screenSize" />
|
||||||
|
<activity
|
||||||
|
android:name=".FragmentActivity"
|
||||||
|
android:configChanges="keyboardHidden|orientation|screenSize" />
|
||||||
<activity
|
<activity
|
||||||
android:name=".GettingStarted"
|
android:name=".GettingStarted"
|
||||||
android:configChanges="keyboardHidden|orientation|screenSize" />
|
android:configChanges="keyboardHidden|orientation|screenSize" />
|
||||||
@@ -60,12 +64,6 @@
|
|||||||
<activity
|
<activity
|
||||||
android:name=".MapsforgeActivity"
|
android:name=".MapsforgeActivity"
|
||||||
android:configChanges="keyboardHidden|orientation|screenSize" />
|
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
|
<activity
|
||||||
android:name=".MapsforgeS3DBActivity"
|
android:name=".MapsforgeS3DBActivity"
|
||||||
android:configChanges="keyboardHidden|orientation|screenSize" />
|
android:configChanges="keyboardHidden|orientation|screenSize" />
|
||||||
|
|||||||
@@ -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.13.0'
|
implementation 'org.mapsforge:mapsforge-poi-android:0.15.0'
|
||||||
implementation 'org.mapsforge:sqlite-android:0.13.0:natives-armeabi-v7a'
|
implementation 'org.mapsforge:sqlite-android:0.15.0:natives-armeabi-v7a'
|
||||||
implementation 'org.mapsforge:sqlite-android:0.13.0:natives-arm64-v8a'
|
implementation 'org.mapsforge:sqlite-android:0.15.0:natives-arm64-v8a'
|
||||||
implementation 'org.mapsforge:sqlite-android:0.13.0:natives-x86'
|
implementation 'org.mapsforge:sqlite-android:0.15.0:natives-x86'
|
||||||
implementation 'org.mapsforge:sqlite-android:0.13.0:natives-x86_64'
|
implementation 'org.mapsforge:sqlite-android:0.15.0:natives-x86_64'
|
||||||
}
|
}
|
||||||
|
|
||||||
android {
|
android {
|
||||||
|
|||||||
12
vtm-android-example/res/layout/fragment_blank.xml
Normal file
12
vtm-android-example/res/layout/fragment_blank.xml
Normal 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>
|
||||||
@@ -1,9 +1,10 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:background="@android:color/white">
|
android:background="@android:color/white">
|
||||||
|
|
||||||
<org.oscim.android.MapView
|
<RelativeLayout
|
||||||
android:id="@+id/mapView"
|
android:id="@+id/mapView"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent" />
|
android:layout_height="match_parent" />
|
||||||
|
|||||||
9
vtm-android-example/res/menu/fragment_menu.xml
Normal file
9
vtm-android-example/res/menu/fragment_menu.xml
Normal 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>
|
||||||
@@ -28,5 +28,7 @@
|
|||||||
<string name="warning">Warning</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.\n\nadb push %s %s</string>
|
||||||
<string name="exit">Exit</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>
|
</resources>
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2010, 2011, 2012 mapsforge.org
|
* Copyright 2010, 2011, 2012 mapsforge.org
|
||||||
* Copyright 2016-2018 devemux86
|
* Copyright 2016-2020 devemux86
|
||||||
* Copyright 2017 Longri
|
* Copyright 2017 Longri
|
||||||
*
|
*
|
||||||
* 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
|
||||||
@@ -16,18 +16,11 @@
|
|||||||
*/
|
*/
|
||||||
package org.oscim.android.filepicker;
|
package org.oscim.android.filepicker;
|
||||||
|
|
||||||
import org.oscim.theme.ExternalRenderTheme;
|
import org.oscim.theme.ThemeLoader;
|
||||||
import org.oscim.theme.ThemeFile;
|
|
||||||
import org.oscim.theme.XmlThemeBuilder;
|
|
||||||
import org.oscim.tiling.TileSource.OpenResult;
|
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 java.io.File;
|
||||||
|
|
||||||
import javax.xml.parsers.SAXParserFactory;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Accepts all valid render theme XML files.
|
* Accepts all valid render theme XML files.
|
||||||
*/
|
*/
|
||||||
@@ -36,13 +29,8 @@ public final class ValidRenderTheme implements ValidFileFilter {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean accept(File file) {
|
public boolean accept(File file) {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
ThemeFile theme = new ExternalRenderTheme(file.getAbsolutePath());
|
ThemeLoader.load(file.getAbsolutePath());
|
||||||
DefaultHandler renderThemeHandler = new XmlThemeBuilder(theme);
|
|
||||||
XMLReader xmlReader = SAXParserFactory.newInstance().newSAXParser().getXMLReader();
|
|
||||||
xmlReader.setContentHandler(renderThemeHandler);
|
|
||||||
xmlReader.parse(new InputSource(theme.getRenderThemeAsStream()));
|
|
||||||
mOpenResult = OpenResult.SUCCESS;
|
mOpenResult = OpenResult.SUCCESS;
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
mOpenResult = new OpenResult(e.getMessage());
|
mOpenResult = new OpenResult(e.getMessage());
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2014 Hannes Janetzek
|
* Copyright 2014 Hannes Janetzek
|
||||||
* Copyright 2016-2018 devemux86
|
* Copyright 2016-2020 devemux86
|
||||||
* Copyright 2017 Longri
|
* Copyright 2017 Longri
|
||||||
*
|
*
|
||||||
* This file is part of the OpenScienceMap project (http://www.opensciencemap.org).
|
* This file is part of the OpenScienceMap project (http://www.opensciencemap.org).
|
||||||
@@ -19,7 +19,6 @@
|
|||||||
package org.oscim.android.test;
|
package org.oscim.android.test;
|
||||||
|
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
import org.oscim.backend.CanvasAdapter;
|
import org.oscim.backend.CanvasAdapter;
|
||||||
import org.oscim.backend.canvas.Bitmap;
|
import org.oscim.backend.canvas.Bitmap;
|
||||||
import org.oscim.backend.canvas.Canvas;
|
import org.oscim.backend.canvas.Canvas;
|
||||||
@@ -27,18 +26,20 @@ import org.oscim.backend.canvas.Color;
|
|||||||
import org.oscim.backend.canvas.Paint;
|
import org.oscim.backend.canvas.Paint;
|
||||||
import org.oscim.core.GeoPoint;
|
import org.oscim.core.GeoPoint;
|
||||||
import org.oscim.layers.marker.ItemizedLayer;
|
import org.oscim.layers.marker.ItemizedLayer;
|
||||||
|
import org.oscim.layers.marker.MarkerInterface;
|
||||||
import org.oscim.layers.marker.MarkerItem;
|
import org.oscim.layers.marker.MarkerItem;
|
||||||
import org.oscim.layers.marker.MarkerSymbol;
|
import org.oscim.layers.marker.MarkerSymbol;
|
||||||
import org.oscim.layers.marker.MarkerSymbol.HotspotPlace;
|
import org.oscim.layers.marker.MarkerSymbol.HotspotPlace;
|
||||||
import org.oscim.layers.tile.bitmap.BitmapTileLayer;
|
import org.oscim.layers.tile.bitmap.BitmapTileLayer;
|
||||||
import org.oscim.renderer.atlas.TextureAtlas;
|
import org.oscim.renderer.atlas.TextureAtlas;
|
||||||
import org.oscim.renderer.atlas.TextureRegion;
|
import org.oscim.renderer.atlas.TextureRegion;
|
||||||
import org.oscim.tiling.TileSource;
|
|
||||||
import org.oscim.tiling.source.OkHttpEngine;
|
import org.oscim.tiling.source.OkHttpEngine;
|
||||||
|
import org.oscim.tiling.source.UrlTileSource;
|
||||||
import org.oscim.tiling.source.bitmap.DefaultSources;
|
import org.oscim.tiling.source.bitmap.DefaultSources;
|
||||||
import org.oscim.utils.TextureAtlasUtils;
|
import org.oscim.utils.TextureAtlasUtils;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collections;
|
||||||
import java.util.LinkedHashMap;
|
import java.util.LinkedHashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@@ -49,9 +50,10 @@ public class AtlasMultiTextureActivity extends MarkerOverlayActivity {
|
|||||||
// Map events receiver
|
// Map events receiver
|
||||||
mMap.layers().add(new MapEventsReceiver(mMap));
|
mMap.layers().add(new MapEventsReceiver(mMap));
|
||||||
|
|
||||||
TileSource tileSource = DefaultSources.OPENSTREETMAP
|
UrlTileSource tileSource = DefaultSources.OPENSTREETMAP
|
||||||
.httpFactory(new OkHttpEngine.OkHttpFactory())
|
.httpFactory(new OkHttpEngine.OkHttpFactory())
|
||||||
.build();
|
.build();
|
||||||
|
tileSource.setHttpRequestHeaders(Collections.singletonMap("User-Agent", "vtm-android-example"));
|
||||||
mMap.layers().add(new BitmapTileLayer(mMap, tileSource));
|
mMap.layers().add(new BitmapTileLayer(mMap, tileSource));
|
||||||
|
|
||||||
// Create Atlas from Bitmaps
|
// Create Atlas from Bitmaps
|
||||||
@@ -65,7 +67,7 @@ public class AtlasMultiTextureActivity extends MarkerOverlayActivity {
|
|||||||
paint.setTextSize(12 * CanvasAdapter.getScale());
|
paint.setTextSize(12 * CanvasAdapter.getScale());
|
||||||
paint.setStrokeWidth(2 * CanvasAdapter.getScale());
|
paint.setStrokeWidth(2 * CanvasAdapter.getScale());
|
||||||
paint.setColor(Color.BLACK);
|
paint.setColor(Color.BLACK);
|
||||||
List<MarkerItem> pts = new ArrayList<>();
|
List<MarkerInterface> pts = new ArrayList<>();
|
||||||
for (double lat = -90; lat <= 90; lat += 10) {
|
for (double lat = -90; lat <= 90; lat += 10) {
|
||||||
for (double lon = -180; lon <= 180; lon += 10) {
|
for (double lon = -180; lon <= 180; lon += 10) {
|
||||||
String title = lat + "/" + lon;
|
String title = lat + "/" + lon;
|
||||||
@@ -85,29 +87,32 @@ public class AtlasMultiTextureActivity extends MarkerOverlayActivity {
|
|||||||
// With iOS we must flip the Y-Axis
|
// With iOS we must flip the Y-Axis
|
||||||
TextureAtlasUtils.createTextureRegions(inputMap, regionsMap, atlasList, true, false);
|
TextureAtlasUtils.createTextureRegions(inputMap, regionsMap, atlasList, true, false);
|
||||||
|
|
||||||
mMarkerLayer = new ItemizedLayer<>(mMap, new ArrayList<MarkerItem>(), (MarkerSymbol) null, this);
|
mMarkerLayer = new ItemizedLayer(mMap, new ArrayList<MarkerInterface>(), (MarkerSymbol) null, this);
|
||||||
mMap.layers().add(mMarkerLayer);
|
mMap.layers().add(mMarkerLayer);
|
||||||
|
|
||||||
mMarkerLayer.addItems(pts);
|
mMarkerLayer.addItems(pts);
|
||||||
|
|
||||||
// set all markers
|
// set all markers
|
||||||
for (MarkerItem item : pts) {
|
for (MarkerInterface item : pts) {
|
||||||
MarkerSymbol markerSymbol = new MarkerSymbol(regionsMap.get(item.getTitle()), HotspotPlace.BOTTOM_CENTER);
|
MarkerItem markerItem = (MarkerItem) item;
|
||||||
item.setMarker(markerSymbol);
|
MarkerSymbol markerSymbol = new MarkerSymbol(regionsMap.get(markerItem.getTitle()), HotspotPlace.BOTTOM_CENTER);
|
||||||
|
markerItem.setMarker(markerSymbol);
|
||||||
}
|
}
|
||||||
|
|
||||||
Toast.makeText(this, "Atlas count: " + atlasList.size(), Toast.LENGTH_SHORT).show();
|
Toast.makeText(this, "Atlas count: " + atlasList.size(), Toast.LENGTH_SHORT).show();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onItemSingleTapUp(int index, MarkerItem item) {
|
public boolean onItemSingleTapUp(int index, MarkerInterface item) {
|
||||||
Toast.makeText(this, "Marker tap\n" + item.getTitle(), Toast.LENGTH_SHORT).show();
|
MarkerItem markerItem = (MarkerItem) item;
|
||||||
|
Toast.makeText(this, "Marker tap\n" + markerItem.getTitle(), Toast.LENGTH_SHORT).show();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onItemLongPress(int index, MarkerItem item) {
|
public boolean onItemLongPress(int index, MarkerInterface item) {
|
||||||
Toast.makeText(this, "Marker long press\n" + item.getTitle(), Toast.LENGTH_SHORT).show();
|
MarkerItem markerItem = (MarkerItem) item;
|
||||||
|
Toast.makeText(this, "Marker long press\n" + markerItem.getTitle(), Toast.LENGTH_SHORT).show();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2013 Hannes Janetzek
|
* Copyright 2013 Hannes Janetzek
|
||||||
* Copyright 2016-2018 devemux86
|
* Copyright 2016-2020 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).
|
||||||
*
|
*
|
||||||
@@ -20,8 +20,8 @@ package org.oscim.android.test;
|
|||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.view.Menu;
|
import android.view.Menu;
|
||||||
import android.view.MenuItem;
|
import android.view.MenuItem;
|
||||||
|
import okhttp3.Cache;
|
||||||
import org.oscim.android.cache.TileCache;
|
import okhttp3.OkHttpClient;
|
||||||
import org.oscim.core.MapPosition;
|
import org.oscim.core.MapPosition;
|
||||||
import org.oscim.layers.TileGridLayer;
|
import org.oscim.layers.TileGridLayer;
|
||||||
import org.oscim.layers.tile.vector.VectorTileLayer;
|
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.TileSource;
|
||||||
import org.oscim.tiling.source.OkHttpEngine;
|
import org.oscim.tiling.source.OkHttpEngine;
|
||||||
import org.oscim.tiling.source.oscimap4.OSciMap4TileSource;
|
import org.oscim.tiling.source.oscimap4.OSciMap4TileSource;
|
||||||
import org.slf4j.Logger;
|
|
||||||
import org.slf4j.LoggerFactory;
|
import java.io.File;
|
||||||
|
|
||||||
public class BaseMapActivity extends MapActivity {
|
public class BaseMapActivity extends MapActivity {
|
||||||
static final Logger log = LoggerFactory.getLogger(BaseMapActivity.class);
|
|
||||||
|
|
||||||
static final boolean USE_CACHE = false;
|
static final boolean USE_CACHE = false;
|
||||||
|
|
||||||
@@ -41,8 +40,6 @@ public class BaseMapActivity extends MapActivity {
|
|||||||
TileSource mTileSource;
|
TileSource mTileSource;
|
||||||
TileGridLayer mGridLayer;
|
TileGridLayer mGridLayer;
|
||||||
|
|
||||||
private TileCache mCache;
|
|
||||||
|
|
||||||
public BaseMapActivity(int contentView) {
|
public BaseMapActivity(int contentView) {
|
||||||
super(contentView);
|
super(contentView);
|
||||||
}
|
}
|
||||||
@@ -54,15 +51,19 @@ public class BaseMapActivity extends MapActivity {
|
|||||||
public void onCreate(Bundle savedInstanceState) {
|
public void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(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()
|
mTileSource = OSciMap4TileSource.builder()
|
||||||
.httpFactory(new OkHttpEngine.OkHttpFactory())
|
.httpFactory(new OkHttpEngine.OkHttpFactory(builder))
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
if (USE_CACHE) {
|
|
||||||
mCache = new TileCache(this, null, "tile.db");
|
|
||||||
mCache.setCacheSize(512 * (1 << 10));
|
|
||||||
mTileSource.setCache(mCache);
|
|
||||||
}
|
|
||||||
mBaseLayer = mMap.setBaseMap(mTileSource);
|
mBaseLayer = mMap.setBaseMap(mTileSource);
|
||||||
|
|
||||||
/* set initial position on first run */
|
/* 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));
|
mMap.setMapPosition(53.08, 8.83, Math.pow(2, 16));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void onDestroy() {
|
|
||||||
super.onDestroy();
|
|
||||||
|
|
||||||
if (mCache != null)
|
|
||||||
mCache.dispose();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onOptionsItemSelected(MenuItem item) {
|
public boolean onOptionsItemSelected(MenuItem item) {
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2014 Hannes Janetzek
|
* Copyright 2014 Hannes Janetzek
|
||||||
* Copyright 2017-2018 devemux86
|
* Copyright 2017-2020 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
|
||||||
@@ -16,21 +16,21 @@
|
|||||||
package org.oscim.android.test;
|
package org.oscim.android.test;
|
||||||
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
import okhttp3.Cache;
|
||||||
import org.oscim.android.cache.TileCache;
|
import okhttp3.OkHttpClient;
|
||||||
import org.oscim.core.MapPosition;
|
import org.oscim.core.MapPosition;
|
||||||
import org.oscim.core.MercatorProjection;
|
import org.oscim.core.MercatorProjection;
|
||||||
import org.oscim.layers.tile.bitmap.BitmapTileLayer;
|
import org.oscim.layers.tile.bitmap.BitmapTileLayer;
|
||||||
import org.oscim.renderer.MapRenderer;
|
import org.oscim.renderer.MapRenderer;
|
||||||
|
import org.oscim.tiling.source.OkHttpEngine;
|
||||||
import org.oscim.tiling.source.bitmap.BitmapTileSource;
|
import org.oscim.tiling.source.bitmap.BitmapTileSource;
|
||||||
import org.oscim.tiling.source.bitmap.DefaultSources;
|
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 {
|
public class BitmapTileActivity extends MapActivity {
|
||||||
|
|
||||||
static final Logger log = LoggerFactory.getLogger(BitmapTileActivity.class);
|
|
||||||
|
|
||||||
private static final boolean USE_CACHE = false;
|
private static final boolean USE_CACHE = false;
|
||||||
|
|
||||||
private final BitmapTileSource mTileSource;
|
private final BitmapTileSource mTileSource;
|
||||||
@@ -45,8 +45,6 @@ public class BitmapTileActivity extends MapActivity {
|
|||||||
mTileSource = tileSource;
|
mTileSource = tileSource;
|
||||||
}
|
}
|
||||||
|
|
||||||
private TileCache mCache;
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onCreate(Bundle savedInstanceState) {
|
public void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
@@ -56,31 +54,24 @@ public class BitmapTileActivity extends MapActivity {
|
|||||||
if (mTileSource == null)
|
if (mTileSource == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
OkHttpClient.Builder builder = new OkHttpClient.Builder();
|
||||||
if (USE_CACHE) {
|
if (USE_CACHE) {
|
||||||
String cacheFile = mTileSource.getUrl()
|
// Cache the tiles into file system
|
||||||
.toString()
|
File cacheDirectory = new File(getExternalCacheDir(), "tiles");
|
||||||
.replaceFirst("https?://", "")
|
int cacheSize = 10 * 1024 * 1024; // 10 MB
|
||||||
.replaceAll("/", "-");
|
Cache cache = new Cache(cacheDirectory, cacheSize);
|
||||||
|
builder.cache(cache);
|
||||||
log.debug("use bitmap cache {}", cacheFile);
|
|
||||||
mCache = new TileCache(this, null, cacheFile);
|
|
||||||
mCache.setCacheSize(512 * (1 << 10));
|
|
||||||
mTileSource.setCache(mCache);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
mTileSource.setHttpEngine(new OkHttpEngine.OkHttpFactory(builder));
|
||||||
|
mTileSource.setHttpRequestHeaders(Collections.singletonMap("User-Agent", "vtm-android-example"));
|
||||||
|
|
||||||
mBitmapLayer = new BitmapTileLayer(mMap, mTileSource);
|
mBitmapLayer = new BitmapTileLayer(mMap, mTileSource);
|
||||||
mMap.layers().add(mBitmapLayer);
|
mMap.layers().add(mBitmapLayer);
|
||||||
|
|
||||||
//loooop(1);
|
//loooop(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void onDestroy() {
|
|
||||||
super.onDestroy();
|
|
||||||
if (mCache != null)
|
|
||||||
mCache.dispose();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Stress testing
|
// Stress testing
|
||||||
void loooop(final int i) {
|
void loooop(final int i) {
|
||||||
final long time = (long) (500 + Math.random() * 1000);
|
final long time = (long) (500 + Math.random() * 1000);
|
||||||
|
|||||||
@@ -0,0 +1,38 @@
|
|||||||
|
/*
|
||||||
|
* 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.Fragment;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.view.LayoutInflater;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.ViewGroup;
|
||||||
|
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
|
public class BlankFragment extends 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);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2016-2019 devemux86
|
* Copyright 2016-2020 devemux86
|
||||||
* Copyright 2017 nebular
|
* Copyright 2017 nebular
|
||||||
*
|
*
|
||||||
* 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
|
||||||
@@ -22,11 +22,12 @@ import org.oscim.backend.canvas.Color;
|
|||||||
import org.oscim.core.GeoPoint;
|
import org.oscim.core.GeoPoint;
|
||||||
import org.oscim.layers.marker.*;
|
import org.oscim.layers.marker.*;
|
||||||
import org.oscim.layers.tile.bitmap.BitmapTileLayer;
|
import org.oscim.layers.tile.bitmap.BitmapTileLayer;
|
||||||
import org.oscim.tiling.TileSource;
|
|
||||||
import org.oscim.tiling.source.OkHttpEngine;
|
import org.oscim.tiling.source.OkHttpEngine;
|
||||||
|
import org.oscim.tiling.source.UrlTileSource;
|
||||||
import org.oscim.tiling.source.bitmap.DefaultSources;
|
import org.oscim.tiling.source.bitmap.DefaultSources;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class ClusterMarkerOverlayActivity extends MarkerOverlayActivity {
|
public class ClusterMarkerOverlayActivity extends MarkerOverlayActivity {
|
||||||
@@ -39,9 +40,10 @@ public class ClusterMarkerOverlayActivity extends MarkerOverlayActivity {
|
|||||||
// Map events receiver
|
// Map events receiver
|
||||||
mMap.layers().add(new MapEventsReceiver(mMap));
|
mMap.layers().add(new MapEventsReceiver(mMap));
|
||||||
|
|
||||||
TileSource tileSource = DefaultSources.OPENSTREETMAP
|
UrlTileSource tileSource = DefaultSources.OPENSTREETMAP
|
||||||
.httpFactory(new OkHttpEngine.OkHttpFactory())
|
.httpFactory(new OkHttpEngine.OkHttpFactory())
|
||||||
.build();
|
.build();
|
||||||
|
tileSource.setHttpRequestHeaders(Collections.singletonMap("User-Agent", "vtm-android-example"));
|
||||||
mMap.layers().add(new BitmapTileLayer(mMap, tileSource));
|
mMap.layers().add(new BitmapTileLayer(mMap, tileSource));
|
||||||
|
|
||||||
Bitmap bitmapPoi = new AndroidBitmap(BitmapFactory.decodeResource(getResources(), R.drawable.marker_poi));
|
Bitmap bitmapPoi = new AndroidBitmap(BitmapFactory.decodeResource(getResources(), R.drawable.marker_poi));
|
||||||
@@ -63,15 +65,15 @@ public class ClusterMarkerOverlayActivity extends MarkerOverlayActivity {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
mMarkerLayer = new ItemizedLayer<>(
|
mMarkerLayer = new ItemizedLayer(
|
||||||
mMap,
|
mMap,
|
||||||
new ArrayList<MarkerItem>(),
|
new ArrayList<MarkerInterface>(),
|
||||||
markerRendererFactory,
|
markerRendererFactory,
|
||||||
this);
|
this);
|
||||||
mMap.layers().add(mMarkerLayer);
|
mMap.layers().add(mMarkerLayer);
|
||||||
|
|
||||||
// Create some markers spaced STEP degrees
|
// Create some markers spaced STEP degrees
|
||||||
List<MarkerItem> pts = new ArrayList<>();
|
List<MarkerInterface> pts = new ArrayList<>();
|
||||||
mMap.setMapPosition(53.08, 8.83, 1 << 15);
|
mMap.setMapPosition(53.08, 8.83, 1 << 15);
|
||||||
GeoPoint center = mMap.getMapPosition().getGeoPoint();
|
GeoPoint center = mMap.getMapPosition().getGeoPoint();
|
||||||
for (int x = -COUNT; x < COUNT; x++) {
|
for (int x = -COUNT; x < COUNT; x++) {
|
||||||
|
|||||||
@@ -0,0 +1,60 @@
|
|||||||
|
/*
|
||||||
|
* 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.app.Fragment;
|
||||||
|
import android.app.FragmentTransaction;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.view.Menu;
|
||||||
|
import android.view.MenuItem;
|
||||||
|
|
||||||
|
public class FragmentActivity extends Activity {
|
||||||
|
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
|
@Override
|
||||||
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
setContentView(R.layout.activity_map_fragment);
|
||||||
|
|
||||||
|
setTitle(getClass().getSimpleName());
|
||||||
|
|
||||||
|
if (savedInstanceState == null) {
|
||||||
|
Fragment mapFragment = MapFragment.newInstance();
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
|
@Override
|
||||||
|
public boolean onOptionsItemSelected(MenuItem item) {
|
||||||
|
if (item.getItemId() == R.id.replace_fragment) {
|
||||||
|
Fragment blankFragment = BlankFragment.newInstance();
|
||||||
|
FragmentTransaction ft = getFragmentManager().beginTransaction();
|
||||||
|
ft.replace(R.id.fragment_container, blankFragment);
|
||||||
|
ft.addToBackStack(null);
|
||||||
|
ft.commit();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return super.onOptionsItemSelected(item);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2013 Hannes Janetzek
|
* Copyright 2013 Hannes Janetzek
|
||||||
* Copyright 2016-2018 devemux86
|
* Copyright 2016-2020 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).
|
||||||
@@ -71,7 +71,7 @@ public class GdxActivity extends AndroidApplication {
|
|||||||
DateTimeAdapter.init(new DateTime());
|
DateTimeAdapter.init(new DateTime());
|
||||||
|
|
||||||
DisplayMetrics metrics = getResources().getDisplayMetrics();
|
DisplayMetrics metrics = getResources().getDisplayMetrics();
|
||||||
CanvasAdapter.dpi = (int) (metrics.scaledDensity * CanvasAdapter.DEFAULT_DPI);
|
CanvasAdapter.dpi = (int) (metrics.density * CanvasAdapter.DEFAULT_DPI);
|
||||||
Tile.SIZE = Tile.calculateTileSize();
|
Tile.SIZE = Tile.calculateTileSize();
|
||||||
|
|
||||||
AndroidApplicationConfiguration cfg = new AndroidApplicationConfiguration();
|
AndroidApplicationConfiguration cfg = new AndroidApplicationConfiguration();
|
||||||
|
|||||||
@@ -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
|
* 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
|
||||||
@@ -15,6 +15,9 @@
|
|||||||
package org.oscim.android.test;
|
package org.oscim.android.test;
|
||||||
|
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.net.Uri;
|
||||||
|
import android.os.Build;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import org.oscim.android.MapView;
|
import org.oscim.android.MapView;
|
||||||
import org.oscim.backend.CanvasAdapter;
|
import org.oscim.backend.CanvasAdapter;
|
||||||
@@ -25,24 +28,24 @@ import org.oscim.renderer.GLViewport;
|
|||||||
import org.oscim.scalebar.DefaultMapScaleBar;
|
import org.oscim.scalebar.DefaultMapScaleBar;
|
||||||
import org.oscim.scalebar.MapScaleBar;
|
import org.oscim.scalebar.MapScaleBar;
|
||||||
import org.oscim.scalebar.MapScaleBarLayer;
|
import org.oscim.scalebar.MapScaleBarLayer;
|
||||||
|
import org.oscim.theme.IRenderTheme;
|
||||||
import org.oscim.theme.VtmThemes;
|
import org.oscim.theme.VtmThemes;
|
||||||
import org.oscim.tiling.source.mapfile.MapFileTileSource;
|
import org.oscim.tiling.source.mapfile.MapFileTileSource;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.FileInputStream;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A very basic Android app example.
|
* A very basic Android app example.
|
||||||
* <p>
|
* <p>
|
||||||
* You'll need a map with filename berlin.map from download.mapsforge.org in device storage:
|
* You'll need a map with filename berlin.map from download.mapsforge.org in device storage.
|
||||||
* /sdcard/Android/data/org.oscim.android.test/files/
|
|
||||||
*/
|
*/
|
||||||
public class GettingStarted extends Activity {
|
public class GettingStarted extends Activity {
|
||||||
|
|
||||||
// Name of the map file in device storage
|
// Request code for selecting a map file
|
||||||
private static final String MAP_FILE = "berlin.map";
|
private static final int SELECT_MAP_FILE = 0;
|
||||||
|
|
||||||
private MapView mapView;
|
private MapView mapView;
|
||||||
private MapScaleBar mapScaleBar;
|
private IRenderTheme theme;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onCreate(Bundle savedInstanceState) {
|
public void onCreate(Bundle savedInstanceState) {
|
||||||
@@ -52,10 +55,30 @@ public class GettingStarted extends Activity {
|
|||||||
mapView = new MapView(this);
|
mapView = new MapView(this);
|
||||||
setContentView(mapView);
|
setContentView(mapView);
|
||||||
|
|
||||||
// Tile source
|
// Open map
|
||||||
MapFileTileSource tileSource = new MapFileTileSource();
|
Intent intent = new Intent(Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT ? Intent.ACTION_OPEN_DOCUMENT : Intent.ACTION_GET_CONTENT);
|
||||||
String mapPath = new File(getExternalFilesDir(null), MAP_FILE).getAbsolutePath();
|
intent.addCategory(Intent.CATEGORY_OPENABLE);
|
||||||
if (tileSource.setMapFile(mapPath)) {
|
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
|
// Vector layer
|
||||||
VectorTileLayer tileLayer = mapView.map().setBaseMap(tileSource);
|
VectorTileLayer tileLayer = mapView.map().setBaseMap(tileSource);
|
||||||
|
|
||||||
@@ -66,10 +89,10 @@ public class GettingStarted extends Activity {
|
|||||||
mapView.map().layers().add(new LabelLayer(mapView.map(), tileLayer));
|
mapView.map().layers().add(new LabelLayer(mapView.map(), tileLayer));
|
||||||
|
|
||||||
// Render theme
|
// Render theme
|
||||||
mapView.map().setTheme(VtmThemes.DEFAULT);
|
theme = mapView.map().setTheme(VtmThemes.DEFAULT);
|
||||||
|
|
||||||
// Scale bar
|
// Scale bar
|
||||||
mapScaleBar = new DefaultMapScaleBar(mapView.map());
|
MapScaleBar mapScaleBar = new DefaultMapScaleBar(mapView.map());
|
||||||
MapScaleBarLayer mapScaleBarLayer = new MapScaleBarLayer(mapView.map(), mapScaleBar);
|
MapScaleBarLayer mapScaleBarLayer = new MapScaleBarLayer(mapView.map(), mapScaleBar);
|
||||||
mapScaleBarLayer.getRenderer().setPosition(GLViewport.Position.BOTTOM_LEFT);
|
mapScaleBarLayer.getRenderer().setPosition(GLViewport.Position.BOTTOM_LEFT);
|
||||||
mapScaleBarLayer.getRenderer().setOffset(5 * CanvasAdapter.getScale(), 0);
|
mapScaleBarLayer.getRenderer().setOffset(5 * CanvasAdapter.getScale(), 0);
|
||||||
@@ -77,6 +100,11 @@ public class GettingStarted extends Activity {
|
|||||||
|
|
||||||
// Note: this map position is specific to Berlin area
|
// Note: this map position is specific to Berlin area
|
||||||
mapView.map().setMapPosition(52.517037, 13.38886, 1 << 12);
|
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,9 +122,8 @@ public class GettingStarted extends Activity {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onDestroy() {
|
protected void onDestroy() {
|
||||||
if (mapScaleBar != null)
|
|
||||||
mapScaleBar.destroy();
|
|
||||||
mapView.onDestroy();
|
mapView.onDestroy();
|
||||||
|
theme.dispose();
|
||||||
super.onDestroy();
|
super.onDestroy();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,9 +22,8 @@ import android.os.Bundle;
|
|||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
import android.widget.ToggleButton;
|
import android.widget.ToggleButton;
|
||||||
|
import io.jeo.map.Style;
|
||||||
import org.jeo.map.Style;
|
import io.jeo.vector.VectorDataset;
|
||||||
import org.jeo.vector.VectorDataset;
|
|
||||||
import org.oscim.backend.CanvasAdapter;
|
import org.oscim.backend.CanvasAdapter;
|
||||||
import org.oscim.backend.canvas.Color;
|
import org.oscim.backend.canvas.Color;
|
||||||
import org.oscim.layers.OSMIndoorLayer;
|
import org.oscim.layers.OSMIndoorLayer;
|
||||||
|
|||||||
125
vtm-android-example/src/org/oscim/android/test/MapFragment.java
Normal file
125
vtm-android-example/src/org/oscim/android/test/MapFragment.java
Normal file
@@ -0,0 +1,125 @@
|
|||||||
|
/*
|
||||||
|
* 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.app.Fragment;
|
||||||
|
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 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();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -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
|
* 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
|
||||||
@@ -16,10 +16,10 @@ package org.oscim.android.test;
|
|||||||
|
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
import okhttp3.Cache;
|
||||||
import okhttp3.CipherSuite;
|
import okhttp3.CipherSuite;
|
||||||
import okhttp3.ConnectionSpec;
|
import okhttp3.ConnectionSpec;
|
||||||
import okhttp3.OkHttpClient;
|
import okhttp3.OkHttpClient;
|
||||||
import org.oscim.android.cache.TileCache;
|
|
||||||
import org.oscim.layers.tile.bitmap.BitmapTileLayer;
|
import org.oscim.layers.tile.bitmap.BitmapTileLayer;
|
||||||
import org.oscim.layers.tile.buildings.BuildingLayer;
|
import org.oscim.layers.tile.buildings.BuildingLayer;
|
||||||
import org.oscim.layers.tile.vector.VectorTileLayer;
|
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.bitmap.DefaultSources;
|
||||||
import org.oscim.tiling.source.mvt.MapilionMvtTileSource;
|
import org.oscim.tiling.source.mvt.MapilionMvtTileSource;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -41,13 +42,18 @@ public class MapilionMvtActivity extends MapActivity {
|
|||||||
|
|
||||||
private static final boolean USE_CACHE = false;
|
private static final boolean USE_CACHE = false;
|
||||||
|
|
||||||
private TileCache mCache;
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onCreate(Bundle savedInstanceState) {
|
public void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
|
|
||||||
OkHttpClient.Builder builder = new OkHttpClient.Builder();
|
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
|
// https://github.com/square/okhttp/issues/4053
|
||||||
if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.KITKAT) {
|
if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.KITKAT) {
|
||||||
@@ -71,13 +77,6 @@ public class MapilionMvtActivity extends MapActivity {
|
|||||||
//.locale("en")
|
//.locale("en")
|
||||||
.build();
|
.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);
|
VectorTileLayer l = mMap.setBaseMap(tileSource);
|
||||||
mMap.setTheme(VtmThemes.OPENMAPTILES);
|
mMap.setTheme(VtmThemes.OPENMAPTILES);
|
||||||
|
|
||||||
@@ -91,12 +90,4 @@ public class MapilionMvtActivity extends MapActivity {
|
|||||||
mMap.layers().add(new BuildingLayer(mMap, l));
|
mMap.layers().add(new BuildingLayer(mMap, l));
|
||||||
mMap.layers().add(new LabelLayer(mMap, l));
|
mMap.layers().add(new LabelLayer(mMap, l));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void onDestroy() {
|
|
||||||
super.onDestroy();
|
|
||||||
|
|
||||||
if (mCache != null)
|
|
||||||
mCache.dispose();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2014 Hannes Janetzek
|
* Copyright 2014 Hannes Janetzek
|
||||||
* Copyright 2016-2018 devemux86
|
* Copyright 2016-2020 devemux86
|
||||||
* Copyright 2017 Longri
|
* Copyright 2017 Longri
|
||||||
* Copyright 2018 Gustl22
|
* Copyright 2018 Gustl22
|
||||||
*
|
*
|
||||||
@@ -19,15 +19,14 @@
|
|||||||
*/
|
*/
|
||||||
package org.oscim.android.test;
|
package org.oscim.android.test;
|
||||||
|
|
||||||
|
import android.app.Activity;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
|
import android.net.Uri;
|
||||||
|
import android.os.Build;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.view.Menu;
|
import android.view.Menu;
|
||||||
import android.view.MenuItem;
|
import android.view.MenuItem;
|
||||||
|
import org.oscim.android.theme.ContentRenderTheme;
|
||||||
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.backend.CanvasAdapter;
|
import org.oscim.backend.CanvasAdapter;
|
||||||
import org.oscim.core.MapElement;
|
import org.oscim.core.MapElement;
|
||||||
import org.oscim.core.MapPosition;
|
import org.oscim.core.MapPosition;
|
||||||
@@ -42,34 +41,36 @@ import org.oscim.layers.tile.vector.labeling.LabelLayer;
|
|||||||
import org.oscim.renderer.BitmapRenderer;
|
import org.oscim.renderer.BitmapRenderer;
|
||||||
import org.oscim.renderer.GLViewport;
|
import org.oscim.renderer.GLViewport;
|
||||||
import org.oscim.renderer.bucket.RenderBuckets;
|
import org.oscim.renderer.bucket.RenderBuckets;
|
||||||
import org.oscim.scalebar.DefaultMapScaleBar;
|
import org.oscim.scalebar.*;
|
||||||
import org.oscim.scalebar.ImperialUnitAdapter;
|
import org.oscim.theme.IRenderTheme;
|
||||||
import org.oscim.scalebar.MapScaleBar;
|
import org.oscim.theme.ThemeFile;
|
||||||
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.theme.VtmThemes;
|
||||||
import org.oscim.theme.styles.AreaStyle;
|
import org.oscim.theme.styles.AreaStyle;
|
||||||
import org.oscim.theme.styles.RenderStyle;
|
import org.oscim.theme.styles.RenderStyle;
|
||||||
import org.oscim.tiling.source.mapfile.MapFileTileSource;
|
import org.oscim.tiling.source.mapfile.MapFileTileSource;
|
||||||
import org.oscim.tiling.source.mapfile.MapInfo;
|
import org.oscim.tiling.source.mapfile.MapInfo;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
import java.io.FileInputStream;
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
public class MapsforgeActivity extends MapActivity {
|
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_MAP_FILE = 0;
|
||||||
static final int SELECT_THEME_FILE = SELECT_MAP_FILE + 1;
|
static final int SELECT_THEME_FILE = 1;
|
||||||
|
|
||||||
private static final Tag ISSEA_TAG = new Tag("natural", "issea");
|
private static final Tag ISSEA_TAG = new Tag("natural", "issea");
|
||||||
private static final Tag NOSEA_TAG = new Tag("natural", "nosea");
|
private static final Tag NOSEA_TAG = new Tag("natural", "nosea");
|
||||||
private static final Tag SEA_TAG = new Tag("natural", "sea");
|
private static final Tag SEA_TAG = new Tag("natural", "sea");
|
||||||
|
|
||||||
private TileGridLayer mGridLayer;
|
private TileGridLayer mGridLayer;
|
||||||
private DefaultMapScaleBar mMapScaleBar;
|
|
||||||
private Menu mMenu;
|
private Menu mMenu;
|
||||||
private boolean mS3db;
|
private final boolean mS3db;
|
||||||
private VectorTileLayer mTileLayer;
|
IRenderTheme mTheme;
|
||||||
MapFileTileSource mTileSource;
|
VectorTileLayer mTileLayer;
|
||||||
|
|
||||||
public MapsforgeActivity() {
|
public MapsforgeActivity() {
|
||||||
this(false);
|
this(false);
|
||||||
@@ -89,30 +90,10 @@ public class MapsforgeActivity extends MapActivity {
|
|||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
|
|
||||||
startActivityForResult(new Intent(this, MapFilePicker.class),
|
Intent intent = new Intent(Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT ? Intent.ACTION_OPEN_DOCUMENT : Intent.ACTION_GET_CONTENT);
|
||||||
SELECT_MAP_FILE);
|
intent.addCategory(Intent.CATEGORY_OPENABLE);
|
||||||
}
|
intent.setType("*/*");
|
||||||
|
startActivityForResult(intent, SELECT_MAP_FILE);
|
||||||
@Override
|
|
||||||
protected void onDestroy() {
|
|
||||||
if (mMapScaleBar != null)
|
|
||||||
mMapScaleBar.destroy();
|
|
||||||
|
|
||||||
super.onDestroy();
|
|
||||||
}
|
|
||||||
|
|
||||||
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());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -127,33 +108,45 @@ public class MapsforgeActivity extends MapActivity {
|
|||||||
|
|
||||||
switch (item.getItemId()) {
|
switch (item.getItemId()) {
|
||||||
case R.id.theme_default:
|
case R.id.theme_default:
|
||||||
mMap.setTheme(VtmThemes.DEFAULT);
|
if (mTheme != null)
|
||||||
|
mTheme.dispose();
|
||||||
|
mTheme = mMap.setTheme(VtmThemes.DEFAULT);
|
||||||
item.setChecked(true);
|
item.setChecked(true);
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
case R.id.theme_osmarender:
|
case R.id.theme_osmarender:
|
||||||
mMap.setTheme(VtmThemes.OSMARENDER);
|
if (mTheme != null)
|
||||||
|
mTheme.dispose();
|
||||||
|
mTheme = mMap.setTheme(VtmThemes.OSMARENDER);
|
||||||
item.setChecked(true);
|
item.setChecked(true);
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
case R.id.theme_osmagray:
|
case R.id.theme_osmagray:
|
||||||
mMap.setTheme(VtmThemes.OSMAGRAY);
|
if (mTheme != null)
|
||||||
|
mTheme.dispose();
|
||||||
|
mTheme = mMap.setTheme(VtmThemes.OSMAGRAY);
|
||||||
item.setChecked(true);
|
item.setChecked(true);
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
case R.id.theme_tubes:
|
case R.id.theme_tubes:
|
||||||
mMap.setTheme(VtmThemes.TRONRENDER);
|
if (mTheme != null)
|
||||||
|
mTheme.dispose();
|
||||||
|
mTheme = mMap.setTheme(VtmThemes.TRONRENDER);
|
||||||
item.setChecked(true);
|
item.setChecked(true);
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
case R.id.theme_newtron:
|
case R.id.theme_newtron:
|
||||||
mMap.setTheme(VtmThemes.NEWTRON);
|
if (mTheme != null)
|
||||||
|
mTheme.dispose();
|
||||||
|
mTheme = mMap.setTheme(VtmThemes.NEWTRON);
|
||||||
item.setChecked(true);
|
item.setChecked(true);
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
case R.id.theme_external:
|
case R.id.theme_external:
|
||||||
startActivityForResult(new Intent(this, ThemeFilePicker.class),
|
Intent intent = new Intent(Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT ? Intent.ACTION_OPEN_DOCUMENT : Intent.ACTION_GET_CONTENT);
|
||||||
SELECT_THEME_FILE);
|
intent.addCategory(Intent.CATEGORY_OPENABLE);
|
||||||
|
intent.setType("*/*");
|
||||||
|
startActivityForResult(intent, SELECT_THEME_FILE);
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
case R.id.gridlayer:
|
case R.id.gridlayer:
|
||||||
@@ -175,58 +168,64 @@ public class MapsforgeActivity extends MapActivity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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 (requestCode == SELECT_MAP_FILE) {
|
||||||
if (resultCode != RESULT_OK || intent == null || intent.getStringExtra(FilePicker.SELECTED_FILE) == null) {
|
if (resultCode != Activity.RESULT_OK || data == null) {
|
||||||
finish();
|
finish();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
mTileSource = new MapFileTileSource();
|
MapFileTileSource tileSource = new MapFileTileSource();
|
||||||
//mTileSource.setPreferredLanguage("en");
|
//tileSource.setPreferredLanguage("en");
|
||||||
String file = intent.getStringExtra(FilePicker.SELECTED_FILE);
|
|
||||||
if (mTileSource.setMapFile(file)) {
|
|
||||||
|
|
||||||
mTileLayer = mMap.setBaseMap(mTileSource);
|
try {
|
||||||
loadTheme(null);
|
Uri uri = data.getData();
|
||||||
|
FileInputStream fis = (FileInputStream) getContentResolver().openInputStream(uri);
|
||||||
if (mS3db)
|
tileSource.setMapFileInputStream(fis);
|
||||||
mMap.layers().add(new S3DBLayer(mMap, mTileLayer));
|
} catch (IOException e) {
|
||||||
else
|
log.error(e.getMessage());
|
||||||
mMap.layers().add(new BuildingLayer(mMap, mTileLayer));
|
finish();
|
||||||
mMap.layers().add(new LabelLayer(mMap, mTileLayer));
|
|
||||||
|
|
||||||
mMapScaleBar = new DefaultMapScaleBar(mMap);
|
|
||||||
mMapScaleBar.setScaleBarMode(DefaultMapScaleBar.ScaleBarMode.BOTH);
|
|
||||||
mMapScaleBar.setDistanceUnitAdapter(MetricUnitAdapter.INSTANCE);
|
|
||||||
mMapScaleBar.setSecondaryDistanceUnitAdapter(ImperialUnitAdapter.INSTANCE);
|
|
||||||
mMapScaleBar.setScaleBarPosition(MapScaleBar.ScaleBarPosition.BOTTOM_LEFT);
|
|
||||||
|
|
||||||
MapScaleBarLayer mapScaleBarLayer = new MapScaleBarLayer(mMap, mMapScaleBar);
|
|
||||||
BitmapRenderer renderer = mapScaleBarLayer.getRenderer();
|
|
||||||
renderer.setPosition(GLViewport.Position.BOTTOM_LEFT);
|
|
||||||
renderer.setOffset(5 * CanvasAdapter.getScale(), 0);
|
|
||||||
mMap.layers().add(mapScaleBarLayer);
|
|
||||||
|
|
||||||
MapInfo info = mTileSource.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();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else if (requestCode == SELECT_THEME_FILE) {
|
|
||||||
if (resultCode != RESULT_OK || intent == null || intent.getStringExtra(FilePicker.SELECTED_FILE) == null) {
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
String file = intent.getStringExtra(FilePicker.SELECTED_FILE);
|
mTileLayer = mMap.setBaseMap(tileSource);
|
||||||
ExternalRenderTheme externalRenderTheme = new ExternalRenderTheme(file);
|
loadTheme(null);
|
||||||
|
|
||||||
|
if (mS3db)
|
||||||
|
mMap.layers().add(new S3DBLayer(mMap, mTileLayer));
|
||||||
|
else
|
||||||
|
mMap.layers().add(new BuildingLayer(mMap, mTileLayer));
|
||||||
|
mMap.layers().add(new LabelLayer(mMap, mTileLayer));
|
||||||
|
|
||||||
|
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, mapScaleBar);
|
||||||
|
BitmapRenderer renderer = mapScaleBarLayer.getRenderer();
|
||||||
|
renderer.setPosition(GLViewport.Position.BOTTOM_LEFT);
|
||||||
|
renderer.setOffset(5 * CanvasAdapter.getScale(), 0);
|
||||||
|
mMap.layers().add(mapScaleBarLayer);
|
||||||
|
|
||||||
|
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();
|
||||||
|
}
|
||||||
|
} else if (requestCode == SELECT_THEME_FILE) {
|
||||||
|
if (resultCode != Activity.RESULT_OK || data == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
Uri uri = data.getData();
|
||||||
|
ThemeFile theme = new ContentRenderTheme(getContentResolver(), "", uri);
|
||||||
|
|
||||||
// Use tessellation with sea and land for Mapsforge themes
|
// Use tessellation with sea and land for Mapsforge themes
|
||||||
if (ThemeUtils.isMapsforgeTheme(externalRenderTheme)) {
|
if (theme.isMapsforgeTheme()) {
|
||||||
mTileLayer.addHook(new VectorTileLayer.TileLoaderThemeHook() {
|
mTileLayer.addHook(new VectorTileLayer.TileLoaderThemeHook() {
|
||||||
@Override
|
@Override
|
||||||
public boolean process(MapTile tile, RenderBuckets buckets, MapElement element, RenderStyle style, int level) {
|
public boolean process(MapTile tile, RenderBuckets buckets, MapElement element, RenderStyle style, int level) {
|
||||||
@@ -243,12 +242,16 @@ public class MapsforgeActivity extends MapActivity {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
mMap.setTheme(externalRenderTheme);
|
if (mTheme != null)
|
||||||
|
mTheme.dispose();
|
||||||
|
mTheme = mMap.setTheme(theme);
|
||||||
mMenu.findItem(R.id.theme_external).setChecked(true);
|
mMenu.findItem(R.id.theme_external).setChecked(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void loadTheme(final String styleId) {
|
protected void loadTheme(final String styleId) {
|
||||||
mMap.setTheme(VtmThemes.DEFAULT);
|
if (mTheme != null)
|
||||||
|
mTheme.dispose();
|
||||||
|
mTheme = mMap.setTheme(VtmThemes.DEFAULT);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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
|
* 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,7 +17,6 @@ package org.oscim.android.test;
|
|||||||
import android.view.Menu;
|
import android.view.Menu;
|
||||||
import android.view.MenuItem;
|
import android.view.MenuItem;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
import org.oscim.android.theme.AssetsRenderTheme;
|
import org.oscim.android.theme.AssetsRenderTheme;
|
||||||
import org.oscim.theme.XmlRenderThemeMenuCallback;
|
import org.oscim.theme.XmlRenderThemeMenuCallback;
|
||||||
import org.oscim.theme.XmlRenderThemeStyleLayer;
|
import org.oscim.theme.XmlRenderThemeStyleLayer;
|
||||||
@@ -58,7 +57,9 @@ public class MapsforgeStyleActivity extends MapsforgeActivity {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void loadTheme(final String styleId) {
|
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
|
@Override
|
||||||
public Set<String> getCategories(XmlRenderThemeStyleMenu renderThemeStyleMenu) {
|
public Set<String> getCategories(XmlRenderThemeStyleMenu renderThemeStyleMenu) {
|
||||||
// Use the selected style or the default
|
// Use the selected style or the default
|
||||||
|
|||||||
@@ -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
|
* 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
|
||||||
@@ -15,8 +15,8 @@
|
|||||||
package org.oscim.android.test;
|
package org.oscim.android.test;
|
||||||
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
import okhttp3.Cache;
|
||||||
import org.oscim.android.cache.TileCache;
|
import okhttp3.OkHttpClient;
|
||||||
import org.oscim.layers.tile.buildings.BuildingLayer;
|
import org.oscim.layers.tile.buildings.BuildingLayer;
|
||||||
import org.oscim.layers.tile.vector.VectorTileLayer;
|
import org.oscim.layers.tile.vector.VectorTileLayer;
|
||||||
import org.oscim.layers.tile.vector.labeling.LabelLayer;
|
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.UrlTileSource;
|
||||||
import org.oscim.tiling.source.geojson.MapzenGeojsonTileSource;
|
import org.oscim.tiling.source.geojson.MapzenGeojsonTileSource;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
|
||||||
public class MapzenGeojsonActivity extends MapActivity {
|
public class MapzenGeojsonActivity extends MapActivity {
|
||||||
|
|
||||||
private static final boolean USE_CACHE = false;
|
private static final boolean USE_CACHE = false;
|
||||||
|
|
||||||
private TileCache mCache;
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onCreate(Bundle savedInstanceState) {
|
public void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(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()
|
UrlTileSource tileSource = MapzenGeojsonTileSource.builder()
|
||||||
.apiKey("xxxxxxx") // Put a proper API key
|
.apiKey("xxxxxxx") // Put a proper API key
|
||||||
.httpFactory(new OkHttpEngine.OkHttpFactory())
|
.httpFactory(new OkHttpEngine.OkHttpFactory(builder))
|
||||||
//.locale("en")
|
//.locale("en")
|
||||||
.build();
|
.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);
|
VectorTileLayer l = mMap.setBaseMap(tileSource);
|
||||||
mMap.setTheme(VtmThemes.MAPZEN);
|
mMap.setTheme(VtmThemes.MAPZEN);
|
||||||
|
|
||||||
mMap.layers().add(new BuildingLayer(mMap, l));
|
mMap.layers().add(new BuildingLayer(mMap, l));
|
||||||
mMap.layers().add(new LabelLayer(mMap, l));
|
mMap.layers().add(new LabelLayer(mMap, l));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void onDestroy() {
|
|
||||||
super.onDestroy();
|
|
||||||
|
|
||||||
if (mCache != null)
|
|
||||||
mCache.dispose();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2016-2018 devemux86
|
* Copyright 2016-2020 devemux86
|
||||||
* Copyright 2017 Mathieu De Brito
|
* Copyright 2017 Mathieu De Brito
|
||||||
*
|
*
|
||||||
* 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
|
||||||
@@ -16,8 +16,8 @@
|
|||||||
package org.oscim.android.test;
|
package org.oscim.android.test;
|
||||||
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
import okhttp3.Cache;
|
||||||
import org.oscim.android.cache.TileCache;
|
import okhttp3.OkHttpClient;
|
||||||
import org.oscim.layers.tile.buildings.BuildingLayer;
|
import org.oscim.layers.tile.buildings.BuildingLayer;
|
||||||
import org.oscim.layers.tile.vector.VectorTileLayer;
|
import org.oscim.layers.tile.vector.VectorTileLayer;
|
||||||
import org.oscim.layers.tile.vector.labeling.LabelLayer;
|
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.UrlTileSource;
|
||||||
import org.oscim.tiling.source.mvt.MapzenMvtTileSource;
|
import org.oscim.tiling.source.mvt.MapzenMvtTileSource;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
|
||||||
public class MapzenMvtActivity extends MapActivity {
|
public class MapzenMvtActivity extends MapActivity {
|
||||||
|
|
||||||
private static final boolean USE_CACHE = false;
|
private static final boolean USE_CACHE = false;
|
||||||
|
|
||||||
private TileCache mCache;
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onCreate(Bundle savedInstanceState) {
|
public void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(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()
|
UrlTileSource tileSource = MapzenMvtTileSource.builder()
|
||||||
.apiKey("xxxxxxx") // Put a proper API key
|
.apiKey("xxxxxxx") // Put a proper API key
|
||||||
.httpFactory(new OkHttpEngine.OkHttpFactory())
|
.httpFactory(new OkHttpEngine.OkHttpFactory(builder))
|
||||||
//.locale("en")
|
//.locale("en")
|
||||||
.build();
|
.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);
|
VectorTileLayer l = mMap.setBaseMap(tileSource);
|
||||||
mMap.setTheme(VtmThemes.MAPZEN);
|
mMap.setTheme(VtmThemes.MAPZEN);
|
||||||
|
|
||||||
mMap.layers().add(new BuildingLayer(mMap, l));
|
mMap.layers().add(new BuildingLayer(mMap, l));
|
||||||
mMap.layers().add(new LabelLayer(mMap, l));
|
mMap.layers().add(new LabelLayer(mMap, l));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void onDestroy() {
|
|
||||||
super.onDestroy();
|
|
||||||
|
|
||||||
if (mCache != null)
|
|
||||||
mCache.dispose();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2014 Hannes Janetzek
|
* Copyright 2014 Hannes Janetzek
|
||||||
* Copyright 2016-2019 devemux86
|
* Copyright 2016-2020 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).
|
||||||
*
|
*
|
||||||
@@ -28,24 +28,25 @@ import org.oscim.event.GestureListener;
|
|||||||
import org.oscim.event.MotionEvent;
|
import org.oscim.event.MotionEvent;
|
||||||
import org.oscim.layers.Layer;
|
import org.oscim.layers.Layer;
|
||||||
import org.oscim.layers.marker.ItemizedLayer;
|
import org.oscim.layers.marker.ItemizedLayer;
|
||||||
|
import org.oscim.layers.marker.MarkerInterface;
|
||||||
import org.oscim.layers.marker.MarkerItem;
|
import org.oscim.layers.marker.MarkerItem;
|
||||||
import org.oscim.layers.marker.MarkerSymbol;
|
import org.oscim.layers.marker.MarkerSymbol;
|
||||||
import org.oscim.layers.marker.MarkerSymbol.HotspotPlace;
|
import org.oscim.layers.marker.MarkerSymbol.HotspotPlace;
|
||||||
import org.oscim.layers.tile.bitmap.BitmapTileLayer;
|
import org.oscim.layers.tile.bitmap.BitmapTileLayer;
|
||||||
import org.oscim.map.Map;
|
import org.oscim.map.Map;
|
||||||
import org.oscim.tiling.TileSource;
|
|
||||||
import org.oscim.tiling.source.OkHttpEngine;
|
import org.oscim.tiling.source.OkHttpEngine;
|
||||||
|
import org.oscim.tiling.source.UrlTileSource;
|
||||||
import org.oscim.tiling.source.bitmap.DefaultSources;
|
import org.oscim.tiling.source.bitmap.DefaultSources;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class MarkerOverlayActivity extends MapActivity
|
public class MarkerOverlayActivity extends MapActivity implements ItemizedLayer.OnItemGestureListener<MarkerInterface> {
|
||||||
implements ItemizedLayer.OnItemGestureListener<MarkerItem> {
|
|
||||||
|
|
||||||
static final boolean BILLBOARDS = true;
|
static final boolean BILLBOARDS = true;
|
||||||
MarkerSymbol mFocusMarker;
|
MarkerSymbol mFocusMarker;
|
||||||
ItemizedLayer<MarkerItem> mMarkerLayer;
|
ItemizedLayer mMarkerLayer;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onCreate(Bundle savedInstanceState) {
|
public void onCreate(Bundle savedInstanceState) {
|
||||||
@@ -58,9 +59,10 @@ public class MarkerOverlayActivity extends MapActivity
|
|||||||
// Map events receiver
|
// Map events receiver
|
||||||
mMap.layers().add(new MapEventsReceiver(mMap));
|
mMap.layers().add(new MapEventsReceiver(mMap));
|
||||||
|
|
||||||
TileSource tileSource = DefaultSources.OPENSTREETMAP
|
UrlTileSource tileSource = DefaultSources.OPENSTREETMAP
|
||||||
.httpFactory(new OkHttpEngine.OkHttpFactory())
|
.httpFactory(new OkHttpEngine.OkHttpFactory())
|
||||||
.build();
|
.build();
|
||||||
|
tileSource.setHttpRequestHeaders(Collections.singletonMap("User-Agent", "vtm-android-example"));
|
||||||
mMap.layers().add(new BitmapTileLayer(mMap, tileSource));
|
mMap.layers().add(new BitmapTileLayer(mMap, tileSource));
|
||||||
|
|
||||||
Bitmap bitmapPoi = new AndroidBitmap(BitmapFactory.decodeResource(getResources(), R.drawable.marker_poi));
|
Bitmap bitmapPoi = new AndroidBitmap(BitmapFactory.decodeResource(getResources(), R.drawable.marker_poi));
|
||||||
@@ -76,10 +78,10 @@ public class MarkerOverlayActivity extends MapActivity
|
|||||||
else
|
else
|
||||||
mFocusMarker = new MarkerSymbol(bitmapFocus, HotspotPlace.CENTER, false);
|
mFocusMarker = new MarkerSymbol(bitmapFocus, HotspotPlace.CENTER, false);
|
||||||
|
|
||||||
mMarkerLayer = new ItemizedLayer<>(mMap, new ArrayList<MarkerItem>(), symbol, this);
|
mMarkerLayer = new ItemizedLayer(mMap, new ArrayList<MarkerInterface>(), symbol, this);
|
||||||
mMap.layers().add(mMarkerLayer);
|
mMap.layers().add(mMarkerLayer);
|
||||||
|
|
||||||
List<MarkerItem> pts = new ArrayList<>();
|
List<MarkerInterface> pts = new ArrayList<>();
|
||||||
|
|
||||||
for (double lat = -90; lat <= 90; lat += 5) {
|
for (double lat = -90; lat <= 90; lat += 5) {
|
||||||
for (double lon = -180; lon <= 180; lon += 5)
|
for (double lon = -180; lon <= 180; lon += 5)
|
||||||
@@ -98,24 +100,26 @@ public class MarkerOverlayActivity extends MapActivity
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onItemSingleTapUp(int index, MarkerItem item) {
|
public boolean onItemSingleTapUp(int index, MarkerInterface item) {
|
||||||
if (item.getMarker() == null)
|
MarkerItem markerItem = (MarkerItem) item;
|
||||||
item.setMarker(mFocusMarker);
|
if (markerItem.getMarker() == null)
|
||||||
|
markerItem.setMarker(mFocusMarker);
|
||||||
else
|
else
|
||||||
item.setMarker(null);
|
markerItem.setMarker(null);
|
||||||
|
|
||||||
Toast.makeText(this, "Marker tap\n" + item.getTitle(), Toast.LENGTH_SHORT).show();
|
Toast.makeText(this, "Marker tap\n" + markerItem.getTitle(), Toast.LENGTH_SHORT).show();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onItemLongPress(int index, MarkerItem item) {
|
public boolean onItemLongPress(int index, MarkerInterface item) {
|
||||||
if (item.getMarker() == null)
|
MarkerItem markerItem = (MarkerItem) item;
|
||||||
item.setMarker(mFocusMarker);
|
if (markerItem.getMarker() == null)
|
||||||
|
markerItem.setMarker(mFocusMarker);
|
||||||
else
|
else
|
||||||
item.setMarker(null);
|
markerItem.setMarker(null);
|
||||||
|
|
||||||
Toast.makeText(this, "Marker long press\n" + item.getTitle(), Toast.LENGTH_SHORT).show();
|
Toast.makeText(this, "Marker long press\n" + markerItem.getTitle(), Toast.LENGTH_SHORT).show();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -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
|
* 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
|
||||||
@@ -15,8 +15,8 @@
|
|||||||
package org.oscim.android.test;
|
package org.oscim.android.test;
|
||||||
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
import okhttp3.Cache;
|
||||||
import org.oscim.android.cache.TileCache;
|
import okhttp3.OkHttpClient;
|
||||||
import org.oscim.layers.tile.buildings.BuildingLayer;
|
import org.oscim.layers.tile.buildings.BuildingLayer;
|
||||||
import org.oscim.layers.tile.vector.VectorTileLayer;
|
import org.oscim.layers.tile.vector.VectorTileLayer;
|
||||||
import org.oscim.layers.tile.vector.labeling.LabelLayer;
|
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.UrlTileSource;
|
||||||
import org.oscim.tiling.source.geojson.NextzenGeojsonTileSource;
|
import org.oscim.tiling.source.geojson.NextzenGeojsonTileSource;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
|
||||||
public class NextzenGeojsonActivity extends MapActivity {
|
public class NextzenGeojsonActivity extends MapActivity {
|
||||||
|
|
||||||
private static final boolean USE_CACHE = false;
|
private static final boolean USE_CACHE = false;
|
||||||
|
|
||||||
private TileCache mCache;
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onCreate(Bundle savedInstanceState) {
|
public void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(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()
|
UrlTileSource tileSource = NextzenGeojsonTileSource.builder()
|
||||||
.apiKey("xxxxxxx") // Put a proper API key
|
.apiKey("xxxxxxx") // Put a proper API key
|
||||||
.httpFactory(new OkHttpEngine.OkHttpFactory())
|
.httpFactory(new OkHttpEngine.OkHttpFactory(builder))
|
||||||
//.locale("en")
|
//.locale("en")
|
||||||
.build();
|
.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);
|
VectorTileLayer l = mMap.setBaseMap(tileSource);
|
||||||
mMap.setTheme(VtmThemes.MAPZEN);
|
mMap.setTheme(VtmThemes.MAPZEN);
|
||||||
|
|
||||||
mMap.layers().add(new BuildingLayer(mMap, l));
|
mMap.layers().add(new BuildingLayer(mMap, l));
|
||||||
mMap.layers().add(new LabelLayer(mMap, l));
|
mMap.layers().add(new LabelLayer(mMap, l));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void onDestroy() {
|
|
||||||
super.onDestroy();
|
|
||||||
|
|
||||||
if (mCache != null)
|
|
||||||
mCache.dispose();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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
|
* 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
|
||||||
@@ -15,8 +15,8 @@
|
|||||||
package org.oscim.android.test;
|
package org.oscim.android.test;
|
||||||
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
import okhttp3.Cache;
|
||||||
import org.oscim.android.cache.TileCache;
|
import okhttp3.OkHttpClient;
|
||||||
import org.oscim.layers.tile.buildings.BuildingLayer;
|
import org.oscim.layers.tile.buildings.BuildingLayer;
|
||||||
import org.oscim.layers.tile.vector.VectorTileLayer;
|
import org.oscim.layers.tile.vector.VectorTileLayer;
|
||||||
import org.oscim.layers.tile.vector.labeling.LabelLayer;
|
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.UrlTileSource;
|
||||||
import org.oscim.tiling.source.mvt.NextzenMvtTileSource;
|
import org.oscim.tiling.source.mvt.NextzenMvtTileSource;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
|
||||||
public class NextzenMvtActivity extends MapActivity {
|
public class NextzenMvtActivity extends MapActivity {
|
||||||
|
|
||||||
private static final boolean USE_CACHE = false;
|
private static final boolean USE_CACHE = false;
|
||||||
|
|
||||||
private TileCache mCache;
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onCreate(Bundle savedInstanceState) {
|
public void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(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()
|
UrlTileSource tileSource = NextzenMvtTileSource.builder()
|
||||||
.apiKey("xxxxxxx") // Put a proper API key
|
.apiKey("xxxxxxx") // Put a proper API key
|
||||||
.httpFactory(new OkHttpEngine.OkHttpFactory())
|
.httpFactory(new OkHttpEngine.OkHttpFactory(builder))
|
||||||
//.locale("en")
|
//.locale("en")
|
||||||
.build();
|
.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);
|
VectorTileLayer l = mMap.setBaseMap(tileSource);
|
||||||
mMap.setTheme(VtmThemes.MAPZEN);
|
mMap.setTheme(VtmThemes.MAPZEN);
|
||||||
|
|
||||||
mMap.layers().add(new BuildingLayer(mMap, l));
|
mMap.layers().add(new BuildingLayer(mMap, l));
|
||||||
mMap.layers().add(new LabelLayer(mMap, l));
|
mMap.layers().add(new LabelLayer(mMap, l));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void onDestroy() {
|
|
||||||
super.onDestroy();
|
|
||||||
|
|
||||||
if (mCache != null)
|
|
||||||
mCache.dispose();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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
|
* 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
|
||||||
@@ -15,8 +15,8 @@
|
|||||||
package org.oscim.android.test;
|
package org.oscim.android.test;
|
||||||
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
import okhttp3.Cache;
|
||||||
import org.oscim.android.cache.TileCache;
|
import okhttp3.OkHttpClient;
|
||||||
import org.oscim.layers.tile.buildings.BuildingLayer;
|
import org.oscim.layers.tile.buildings.BuildingLayer;
|
||||||
import org.oscim.layers.tile.vector.VectorTileLayer;
|
import org.oscim.layers.tile.vector.VectorTileLayer;
|
||||||
import org.oscim.layers.tile.vector.labeling.LabelLayer;
|
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.UrlTileSource;
|
||||||
import org.oscim.tiling.source.mvt.OpenMapTilesMvtTileSource;
|
import org.oscim.tiling.source.mvt.OpenMapTilesMvtTileSource;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
|
||||||
public class OpenMapTilesMvtActivity extends MapActivity {
|
public class OpenMapTilesMvtActivity extends MapActivity {
|
||||||
|
|
||||||
private static final boolean USE_CACHE = false;
|
private static final boolean USE_CACHE = false;
|
||||||
|
|
||||||
private TileCache mCache;
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onCreate(Bundle savedInstanceState) {
|
public void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(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()
|
UrlTileSource tileSource = OpenMapTilesMvtTileSource.builder()
|
||||||
.apiKey("xxxxxxx") // Put a proper API key
|
.apiKey("xxxxxxx") // Put a proper API key
|
||||||
.httpFactory(new OkHttpEngine.OkHttpFactory())
|
.httpFactory(new OkHttpEngine.OkHttpFactory(builder))
|
||||||
//.locale("en")
|
//.locale("en")
|
||||||
.build();
|
.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);
|
VectorTileLayer l = mMap.setBaseMap(tileSource);
|
||||||
mMap.setTheme(VtmThemes.OPENMAPTILES);
|
mMap.setTheme(VtmThemes.OPENMAPTILES);
|
||||||
|
|
||||||
mMap.layers().add(new BuildingLayer(mMap, l));
|
mMap.layers().add(new BuildingLayer(mMap, l));
|
||||||
mMap.layers().add(new LabelLayer(mMap, l));
|
mMap.layers().add(new LabelLayer(mMap, l));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void onDestroy() {
|
|
||||||
super.onDestroy();
|
|
||||||
|
|
||||||
if (mCache != null)
|
|
||||||
mCache.dispose();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2019 Gustl22
|
* Copyright 2019 Gustl22
|
||||||
|
* Copyright 2020 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
|
||||||
@@ -15,7 +16,6 @@
|
|||||||
package org.oscim.android.test;
|
package org.oscim.android.test;
|
||||||
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
|
||||||
import org.oscim.layers.tile.bitmap.BitmapTileLayer;
|
import org.oscim.layers.tile.bitmap.BitmapTileLayer;
|
||||||
import org.oscim.layers.tile.buildings.BuildingLayer;
|
import org.oscim.layers.tile.buildings.BuildingLayer;
|
||||||
import org.oscim.layers.tile.buildings.S3DBLayer;
|
import org.oscim.layers.tile.buildings.S3DBLayer;
|
||||||
@@ -25,9 +25,12 @@ import org.oscim.map.Viewport;
|
|||||||
import org.oscim.theme.VtmThemes;
|
import org.oscim.theme.VtmThemes;
|
||||||
import org.oscim.tiling.TileSource;
|
import org.oscim.tiling.TileSource;
|
||||||
import org.oscim.tiling.source.OkHttpEngine;
|
import org.oscim.tiling.source.OkHttpEngine;
|
||||||
|
import org.oscim.tiling.source.UrlTileSource;
|
||||||
import org.oscim.tiling.source.bitmap.DefaultSources;
|
import org.oscim.tiling.source.bitmap.DefaultSources;
|
||||||
import org.oscim.tiling.source.overpass.OverpassTileSource;
|
import org.oscim.tiling.source.overpass.OverpassTileSource;
|
||||||
|
|
||||||
|
import java.util.Collections;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Use Overpass API data for vector layer.
|
* Use Overpass API data for vector layer.
|
||||||
* Only for developing as can be error-prone.
|
* Only for developing as can be error-prone.
|
||||||
@@ -46,7 +49,7 @@ public class OverpassActivity extends MapActivity {
|
|||||||
.build();
|
.build();
|
||||||
VectorTileLayer l = mMap.setBaseMap(tileSource);
|
VectorTileLayer l = mMap.setBaseMap(tileSource);
|
||||||
|
|
||||||
TileSource bitmapTileSource = DefaultSources.OPENSTREETMAP
|
UrlTileSource bitmapTileSource = DefaultSources.OPENSTREETMAP
|
||||||
.httpFactory(new OkHttpEngine.OkHttpFactory())
|
.httpFactory(new OkHttpEngine.OkHttpFactory())
|
||||||
.zoomMax(15)
|
.zoomMax(15)
|
||||||
.fadeSteps(new BitmapTileLayer.FadeStep[]{
|
.fadeSteps(new BitmapTileLayer.FadeStep[]{
|
||||||
@@ -54,6 +57,7 @@ public class OverpassActivity extends MapActivity {
|
|||||||
new BitmapTileLayer.FadeStep(16, Viewport.MAX_ZOOM_LEVEL, 0f, 0f)
|
new BitmapTileLayer.FadeStep(16, Viewport.MAX_ZOOM_LEVEL, 0f, 0f)
|
||||||
})
|
})
|
||||||
.build();
|
.build();
|
||||||
|
bitmapTileSource.setHttpRequestHeaders(Collections.singletonMap("User-Agent", "vtm-android-example"));
|
||||||
mMap.layers().add(new BitmapTileLayer(mMap, bitmapTileSource));
|
mMap.layers().add(new BitmapTileLayer(mMap, bitmapTileSource));
|
||||||
|
|
||||||
BuildingLayer.RAW_DATA = true;
|
BuildingLayer.RAW_DATA = true;
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2017-2019 devemux86
|
* Copyright 2017-2020 devemux86
|
||||||
* Copyright 2018 Gustl22
|
* Copyright 2018 Gustl22
|
||||||
*
|
*
|
||||||
* 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
|
||||||
@@ -41,6 +41,7 @@ import org.oscim.event.GestureListener;
|
|||||||
import org.oscim.event.MotionEvent;
|
import org.oscim.event.MotionEvent;
|
||||||
import org.oscim.layers.Layer;
|
import org.oscim.layers.Layer;
|
||||||
import org.oscim.layers.marker.ItemizedLayer;
|
import org.oscim.layers.marker.ItemizedLayer;
|
||||||
|
import org.oscim.layers.marker.MarkerInterface;
|
||||||
import org.oscim.layers.marker.MarkerItem;
|
import org.oscim.layers.marker.MarkerItem;
|
||||||
import org.oscim.layers.marker.MarkerSymbol;
|
import org.oscim.layers.marker.MarkerSymbol;
|
||||||
import org.oscim.map.Map;
|
import org.oscim.map.Map;
|
||||||
@@ -57,14 +58,14 @@ import java.util.List;
|
|||||||
* Long press on map to search inside visible bounding box.<br/>
|
* Long press on map to search inside visible bounding box.<br/>
|
||||||
* Tap on POIs to show their name (in default locale).
|
* Tap on POIs to show their name (in default locale).
|
||||||
*/
|
*/
|
||||||
public class PoiSearchActivity extends MapsforgeActivity implements ItemizedLayer.OnItemGestureListener<MarkerItem> {
|
public class PoiSearchActivity extends MapsforgeActivity implements ItemizedLayer.OnItemGestureListener<MarkerInterface> {
|
||||||
|
|
||||||
private static final Logger log = LoggerFactory.getLogger(PoiSearchActivity.class);
|
private static final Logger log = LoggerFactory.getLogger(PoiSearchActivity.class);
|
||||||
|
|
||||||
private static final String POI_CATEGORY = "Restaurants";
|
private static final String POI_CATEGORY = "Restaurants";
|
||||||
private static final int SELECT_POI_FILE = MapsforgeActivity.SELECT_THEME_FILE + 1;
|
private static final int SELECT_POI_FILE = MapsforgeActivity.SELECT_THEME_FILE + 1;
|
||||||
|
|
||||||
private ItemizedLayer<MarkerItem> mMarkerLayer;
|
private ItemizedLayer mMarkerLayer;
|
||||||
private PoiPersistenceManager mPersistenceManager;
|
private PoiPersistenceManager mPersistenceManager;
|
||||||
|
|
||||||
public static class PoiFilePicker extends FilePicker {
|
public static class PoiFilePicker extends FilePicker {
|
||||||
@@ -138,7 +139,7 @@ public class PoiSearchActivity extends MapsforgeActivity implements ItemizedLaye
|
|||||||
super.onActivityResult(requestCode, resultCode, intent);
|
super.onActivityResult(requestCode, resultCode, intent);
|
||||||
|
|
||||||
if (requestCode == SELECT_MAP_FILE) {
|
if (requestCode == SELECT_MAP_FILE) {
|
||||||
if (mTileSource != null)
|
if (mTileLayer.getTileSource() != null)
|
||||||
startActivityForResult(new Intent(this, PoiFilePicker.class),
|
startActivityForResult(new Intent(this, PoiFilePicker.class),
|
||||||
SELECT_POI_FILE);
|
SELECT_POI_FILE);
|
||||||
else
|
else
|
||||||
@@ -154,19 +155,20 @@ public class PoiSearchActivity extends MapsforgeActivity implements ItemizedLaye
|
|||||||
|
|
||||||
Bitmap bitmap = new AndroidBitmap(BitmapFactory.decodeResource(getResources(), R.drawable.marker_green));
|
Bitmap bitmap = new AndroidBitmap(BitmapFactory.decodeResource(getResources(), R.drawable.marker_green));
|
||||||
MarkerSymbol symbol = new MarkerSymbol(bitmap, MarkerSymbol.HotspotPlace.BOTTOM_CENTER);
|
MarkerSymbol symbol = new MarkerSymbol(bitmap, MarkerSymbol.HotspotPlace.BOTTOM_CENTER);
|
||||||
mMarkerLayer = new ItemizedLayer<>(mMap, new ArrayList<MarkerItem>(), symbol, this);
|
mMarkerLayer = new ItemizedLayer(mMap, new ArrayList<MarkerInterface>(), symbol, this);
|
||||||
mMap.layers().add(mMarkerLayer);
|
mMap.layers().add(mMarkerLayer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onItemSingleTapUp(int index, MarkerItem item) {
|
public boolean onItemSingleTapUp(int index, MarkerInterface item) {
|
||||||
Toast.makeText(this, item.getTitle(), Toast.LENGTH_SHORT).show();
|
MarkerItem markerItem = (MarkerItem) item;
|
||||||
|
Toast.makeText(this, markerItem.getTitle(), Toast.LENGTH_SHORT).show();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onItemLongPress(int index, MarkerItem item) {
|
public boolean onItemLongPress(int index, MarkerInterface item) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -315,7 +317,7 @@ public class PoiSearchActivity extends MapsforgeActivity implements ItemizedLaye
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Overlay POI
|
// Overlay POI
|
||||||
List<MarkerItem> pts = new ArrayList<>();
|
List<MarkerInterface> pts = new ArrayList<>();
|
||||||
for (PointOfInterest pointOfInterest : pointOfInterests)
|
for (PointOfInterest pointOfInterest : pointOfInterests)
|
||||||
pts.add(new MarkerItem(pointOfInterest.getName(), "", new GeoPoint(pointOfInterest.getLatitude(), pointOfInterest.getLongitude())));
|
pts.add(new MarkerItem(pointOfInterest.getName(), "", new GeoPoint(pointOfInterest.getLatitude(), pointOfInterest.getLongitude())));
|
||||||
mMarkerLayer.addItems(pts);
|
mMarkerLayer.addItems(pts);
|
||||||
|
|||||||
@@ -97,7 +97,7 @@ public class ReverseGeocodeActivity extends MapsforgeActivity {
|
|||||||
int tileYMax = MercatorProjection.pixelYToTileY(pixelY + touchRadius, (byte) mMap.getMapPosition().getZoomLevel());
|
int tileYMax = MercatorProjection.pixelYToTileY(pixelY + touchRadius, (byte) mMap.getMapPosition().getZoomLevel());
|
||||||
Tile upperLeft = new Tile(tileXMin, tileYMin, (byte) mMap.getMapPosition().getZoomLevel());
|
Tile upperLeft = new Tile(tileXMin, tileYMin, (byte) mMap.getMapPosition().getZoomLevel());
|
||||||
Tile lowerRight = new Tile(tileXMax, tileYMax, (byte) mMap.getMapPosition().getZoomLevel());
|
Tile lowerRight = new Tile(tileXMax, tileYMax, (byte) mMap.getMapPosition().getZoomLevel());
|
||||||
MapReadResult mapReadResult = ((MapDatabase) ((OverzoomTileDataSource) mTileSource.getDataSource()).getDataSource()).readLabels(upperLeft, lowerRight);
|
MapReadResult mapReadResult = ((MapDatabase) ((OverzoomTileDataSource) mTileLayer.getTileSource().getDataSource()).getDataSource()).readLabels(upperLeft, lowerRight);
|
||||||
|
|
||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2010, 2011, 2012, 2013 mapsforge.org
|
* Copyright 2010, 2011, 2012, 2013 mapsforge.org
|
||||||
* Copyright 2013 Hannes Janetzek
|
* Copyright 2013 Hannes Janetzek
|
||||||
* Copyright 2016-2019 devemux86
|
* Copyright 2016-2020 devemux86
|
||||||
* Copyright 2016 mar-v-in
|
* Copyright 2016 mar-v-in
|
||||||
* Copyright 2016 Mathieu de Brito
|
* Copyright 2016 Mathieu de Brito
|
||||||
* Copyright 2017-2018 Longri
|
* Copyright 2017-2018 Longri
|
||||||
@@ -28,7 +28,6 @@ package org.oscim.android.test;
|
|||||||
|
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.net.Uri;
|
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.view.Gravity;
|
import android.view.Gravity;
|
||||||
@@ -99,12 +98,6 @@ public class Samples extends Activity {
|
|||||||
linearLayout.addView(createButton(GdxActivity.class));
|
linearLayout.addView(createButton(GdxActivity.class));
|
||||||
|
|
||||||
linearLayout.addView(createLabel("Features"));
|
linearLayout.addView(createLabel("Features"));
|
||||||
linearLayout.addView(createButton(null, "GraphHopper Routing", new View.OnClickListener() {
|
|
||||||
@Override
|
|
||||||
public void onClick(View v) {
|
|
||||||
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("https://github.com/graphhopper/graphhopper/tree/master/android")));
|
|
||||||
}
|
|
||||||
}));
|
|
||||||
linearLayout.addView(createButton(LocationActivity.class));
|
linearLayout.addView(createButton(LocationActivity.class));
|
||||||
linearLayout.addView(createButton(LocationTextureActivity.class));
|
linearLayout.addView(createButton(LocationTextureActivity.class));
|
||||||
linearLayout.addView(createButton(PoiSearchActivity.class));
|
linearLayout.addView(createButton(PoiSearchActivity.class));
|
||||||
@@ -132,5 +125,6 @@ public class Samples extends Activity {
|
|||||||
linearLayout.addView(createButton(GdxPoi3DActivity.class));
|
linearLayout.addView(createButton(GdxPoi3DActivity.class));
|
||||||
linearLayout.addView(createButton(OverpassActivity.class));
|
linearLayout.addView(createButton(OverpassActivity.class));
|
||||||
linearLayout.addView(createButton(ClusterMarkerOverlayActivity.class));
|
linearLayout.addView(createButton(ClusterMarkerOverlayActivity.class));
|
||||||
|
linearLayout.addView(createButton(FragmentActivity.class));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -38,7 +38,6 @@ import org.oscim.theme.ThemeLoader;
|
|||||||
import org.oscim.theme.VtmThemes;
|
import org.oscim.theme.VtmThemes;
|
||||||
|
|
||||||
public class SimpleMapActivity extends BaseMapActivity {
|
public class SimpleMapActivity extends BaseMapActivity {
|
||||||
private DefaultMapScaleBar mapScaleBar;
|
|
||||||
|
|
||||||
BuildingLayer mBuildingLayer;
|
BuildingLayer mBuildingLayer;
|
||||||
private boolean mShadow;
|
private boolean mShadow;
|
||||||
@@ -71,7 +70,7 @@ public class SimpleMapActivity extends BaseMapActivity {
|
|||||||
groupLayer.layers.add(new LabelLayer(mMap, mBaseLayer));
|
groupLayer.layers.add(new LabelLayer(mMap, mBaseLayer));
|
||||||
mMap.layers().add(groupLayer);
|
mMap.layers().add(groupLayer);
|
||||||
|
|
||||||
mapScaleBar = new DefaultMapScaleBar(mMap);
|
DefaultMapScaleBar mapScaleBar = new DefaultMapScaleBar(mMap);
|
||||||
mapScaleBar.setScaleBarMode(DefaultMapScaleBar.ScaleBarMode.BOTH);
|
mapScaleBar.setScaleBarMode(DefaultMapScaleBar.ScaleBarMode.BOTH);
|
||||||
mapScaleBar.setDistanceUnitAdapter(MetricUnitAdapter.INSTANCE);
|
mapScaleBar.setDistanceUnitAdapter(MetricUnitAdapter.INSTANCE);
|
||||||
mapScaleBar.setSecondaryDistanceUnitAdapter(ImperialUnitAdapter.INSTANCE);
|
mapScaleBar.setSecondaryDistanceUnitAdapter(ImperialUnitAdapter.INSTANCE);
|
||||||
@@ -86,14 +85,6 @@ public class SimpleMapActivity extends BaseMapActivity {
|
|||||||
mMap.setTheme(VtmThemes.DEFAULT);
|
mMap.setTheme(VtmThemes.DEFAULT);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void onDestroy() {
|
|
||||||
if (mapScaleBar != null)
|
|
||||||
mapScaleBar.destroy();
|
|
||||||
|
|
||||||
super.onDestroy();
|
|
||||||
}
|
|
||||||
|
|
||||||
void runTheMonkey() {
|
void runTheMonkey() {
|
||||||
themes[0] = ThemeLoader.load(VtmThemes.DEFAULT);
|
themes[0] = ThemeLoader.load(VtmThemes.DEFAULT);
|
||||||
themes[1] = ThemeLoader.load(VtmThemes.OSMARENDER);
|
themes[1] = ThemeLoader.load(VtmThemes.OSMARENDER);
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2012 Hannes Janetzek
|
* Copyright 2012 Hannes Janetzek
|
||||||
* Copyright 2016-2019 devemux86
|
* Copyright 2016-2020 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).
|
||||||
@@ -112,7 +112,7 @@ public class MapView extends GLSurfaceView {
|
|||||||
DateTimeAdapter.init(new DateTime());
|
DateTimeAdapter.init(new DateTime());
|
||||||
|
|
||||||
DisplayMetrics metrics = getResources().getDisplayMetrics();
|
DisplayMetrics metrics = getResources().getDisplayMetrics();
|
||||||
CanvasAdapter.dpi = (int) (metrics.scaledDensity * CanvasAdapter.DEFAULT_DPI);
|
CanvasAdapter.dpi = (int) (metrics.density * CanvasAdapter.DEFAULT_DPI);
|
||||||
if (!Parameters.CUSTOM_TILE_SIZE)
|
if (!Parameters.CUSTOM_TILE_SIZE)
|
||||||
Tile.SIZE = Tile.calculateTileSize();
|
Tile.SIZE = Tile.calculateTileSize();
|
||||||
|
|
||||||
|
|||||||
109
vtm-android/src/org/oscim/android/theme/ContentRenderTheme.java
Normal file
109
vtm-android/src/org/oscim/android/theme/ContentRenderTheme.java
Normal file
@@ -0,0 +1,109 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 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
|
||||||
|
* 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.ThemeUtils;
|
||||||
|
import org.oscim.theme.XmlRenderThemeMenuCallback;
|
||||||
|
import org.oscim.utils.Utils;
|
||||||
|
|
||||||
|
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 XmlRenderThemeMenuCallback mMenuCallback;
|
||||||
|
private final String mRelativePathPrefix;
|
||||||
|
private final Uri mUri;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param contentResolver the Android content resolver.
|
||||||
|
* @param relativePathPrefix the prefix for all relative resource paths.
|
||||||
|
* @param uri the XML render theme URI.
|
||||||
|
* @throws ThemeException if an error occurs while reading the render theme XML.
|
||||||
|
*/
|
||||||
|
public ContentRenderTheme(ContentResolver contentResolver, String relativePathPrefix, Uri uri) throws ThemeException {
|
||||||
|
this(contentResolver, relativePathPrefix, uri, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param contentResolver the Android content resolver.
|
||||||
|
* @param relativePathPrefix the prefix for all relative resource paths.
|
||||||
|
* @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, String relativePathPrefix, Uri uri, XmlRenderThemeMenuCallback menuCallback) throws ThemeException {
|
||||||
|
mContentResolver = contentResolver;
|
||||||
|
mRelativePathPrefix = relativePathPrefix;
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
if (!Utils.equals(mRelativePathPrefix, other.mRelativePathPrefix)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public XmlRenderThemeMenuCallback getMenuCallback() {
|
||||||
|
return mMenuCallback;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getRelativePathPrefix() {
|
||||||
|
return mRelativePathPrefix;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public InputStream getRenderThemeAsStream() throws ThemeException {
|
||||||
|
try {
|
||||||
|
return mContentResolver.openInputStream(mUri);
|
||||||
|
} catch (IOException e) {
|
||||||
|
throw new ThemeException(e.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isMapsforgeTheme() {
|
||||||
|
return ThemeUtils.isMapsforgeTheme(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setMenuCallback(XmlRenderThemeMenuCallback menuCallback) {
|
||||||
|
mMenuCallback = menuCallback;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -15,6 +15,7 @@
|
|||||||
android:allowBackup="true"
|
android:allowBackup="true"
|
||||||
android:icon="@mipmap/ic_launcher"
|
android:icon="@mipmap/ic_launcher"
|
||||||
android:label="@string/application_name"
|
android:label="@string/application_name"
|
||||||
|
android:requestLegacyExternalStorage="true"
|
||||||
android:usesCleartextTraffic="true">
|
android:usesCleartextTraffic="true">
|
||||||
|
|
||||||
<!-- android:theme="@style/Theme.TileMap" -->
|
<!-- android:theme="@style/Theme.TileMap" -->
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2013 Hannes Janetzek
|
* Copyright 2013 Hannes Janetzek
|
||||||
* Copyright 2016-2019 devemux86
|
* Copyright 2016-2020 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).
|
||||||
*
|
*
|
||||||
@@ -41,6 +41,7 @@ import org.slf4j.Logger;
|
|||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
import java.util.Collections;
|
||||||
|
|
||||||
public class MapLayers {
|
public class MapLayers {
|
||||||
|
|
||||||
@@ -183,7 +184,9 @@ public class MapLayers {
|
|||||||
|
|
||||||
switch (id) {
|
switch (id) {
|
||||||
case R.id.menu_layer_openstreetmap:
|
case R.id.menu_layer_openstreetmap:
|
||||||
mBackgroundLayer = new BitmapTileLayer(App.map, DefaultSources.OPENSTREETMAP.build());
|
UrlTileSource tileSource = DefaultSources.OPENSTREETMAP.build();
|
||||||
|
tileSource.setHttpRequestHeaders(Collections.singletonMap("User-Agent", "vtm-playground"));
|
||||||
|
mBackgroundLayer = new BitmapTileLayer(App.map, tileSource);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case R.id.menu_layer_naturalearth:
|
case R.id.menu_layer_naturalearth:
|
||||||
|
|||||||
@@ -23,19 +23,14 @@ import android.view.View;
|
|||||||
import android.widget.Button;
|
import android.widget.Button;
|
||||||
import android.widget.ImageView;
|
import android.widget.ImageView;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
import org.oscim.android.canvas.AndroidGraphics;
|
import org.oscim.android.canvas.AndroidGraphics;
|
||||||
import org.oscim.core.BoundingBox;
|
import org.oscim.core.BoundingBox;
|
||||||
import org.oscim.core.GeoPoint;
|
import org.oscim.core.GeoPoint;
|
||||||
|
import org.oscim.layers.marker.MarkerInterface;
|
||||||
import org.oscim.layers.marker.MarkerSymbol;
|
import org.oscim.layers.marker.MarkerSymbol;
|
||||||
import org.oscim.layers.marker.MarkerSymbol.HotspotPlace;
|
import org.oscim.layers.marker.MarkerSymbol.HotspotPlace;
|
||||||
import org.oscim.map.Map;
|
import org.oscim.map.Map;
|
||||||
import org.osmdroid.location.FlickrPOIProvider;
|
import org.osmdroid.location.*;
|
||||||
import org.osmdroid.location.FourSquareProvider;
|
|
||||||
import org.osmdroid.location.GeoNamesPOIProvider;
|
|
||||||
import org.osmdroid.location.NominatimPOIProvider;
|
|
||||||
import org.osmdroid.location.POI;
|
|
||||||
import org.osmdroid.location.PicasaPOIProvider;
|
|
||||||
import org.osmdroid.overlays.DefaultInfoWindow;
|
import org.osmdroid.overlays.DefaultInfoWindow;
|
||||||
import org.osmdroid.overlays.ExtendedMarkerItem;
|
import org.osmdroid.overlays.ExtendedMarkerItem;
|
||||||
import org.osmdroid.overlays.ItemizedOverlayWithBubble;
|
import org.osmdroid.overlays.ItemizedOverlayWithBubble;
|
||||||
@@ -45,7 +40,7 @@ import java.util.List;
|
|||||||
|
|
||||||
public class POISearch {
|
public class POISearch {
|
||||||
private final ArrayList<POI> mPOIs;
|
private final ArrayList<POI> mPOIs;
|
||||||
ItemizedOverlayWithBubble<ExtendedMarkerItem> poiMarkers;
|
ItemizedOverlayWithBubble poiMarkers;
|
||||||
MarkerSymbol[] mMarkers;
|
MarkerSymbol[] mMarkers;
|
||||||
|
|
||||||
private static final int MDEFAULT = 0;
|
private static final int MDEFAULT = 0;
|
||||||
@@ -57,9 +52,9 @@ public class POISearch {
|
|||||||
POISearch() {
|
POISearch() {
|
||||||
mPOIs = new ArrayList<POI>();
|
mPOIs = new ArrayList<POI>();
|
||||||
//POI markers:
|
//POI markers:
|
||||||
final ArrayList<ExtendedMarkerItem> poiItems = new ArrayList<ExtendedMarkerItem>();
|
final ArrayList<MarkerInterface> poiItems = new ArrayList<>();
|
||||||
|
|
||||||
poiMarkers = new ItemizedOverlayWithBubble<ExtendedMarkerItem>(App.map,
|
poiMarkers = new ItemizedOverlayWithBubble(App.map,
|
||||||
App.activity,
|
App.activity,
|
||||||
null,
|
null,
|
||||||
poiItems,
|
poiItems,
|
||||||
|
|||||||
@@ -24,10 +24,10 @@ import android.widget.Button;
|
|||||||
import android.widget.ImageView;
|
import android.widget.ImageView;
|
||||||
import android.widget.RelativeLayout;
|
import android.widget.RelativeLayout;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
import org.oscim.android.canvas.AndroidGraphics;
|
import org.oscim.android.canvas.AndroidGraphics;
|
||||||
import org.oscim.core.GeoPoint;
|
import org.oscim.core.GeoPoint;
|
||||||
import org.oscim.layers.PathLayer;
|
import org.oscim.layers.PathLayer;
|
||||||
|
import org.oscim.layers.marker.MarkerInterface;
|
||||||
import org.oscim.layers.marker.MarkerSymbol;
|
import org.oscim.layers.marker.MarkerSymbol;
|
||||||
import org.oscim.layers.marker.MarkerSymbol.HotspotPlace;
|
import org.oscim.layers.marker.MarkerSymbol.HotspotPlace;
|
||||||
import org.osmdroid.location.GeocoderNominatim;
|
import org.osmdroid.location.GeocoderNominatim;
|
||||||
@@ -48,7 +48,7 @@ public class RouteSearch {
|
|||||||
|
|
||||||
private final PathLayer mRouteOverlay;
|
private final PathLayer mRouteOverlay;
|
||||||
//private final ItemizedOverlayWithBubble<ExtendedOverlayItem> mRouteMarkers;
|
//private final ItemizedOverlayWithBubble<ExtendedOverlayItem> mRouteMarkers;
|
||||||
private final ItemizedOverlayWithBubble<ExtendedMarkerItem> mItineraryMarkers;
|
private final ItemizedOverlayWithBubble mItineraryMarkers;
|
||||||
|
|
||||||
private final RouteBar mRouteBar;
|
private final RouteBar mRouteBar;
|
||||||
|
|
||||||
@@ -63,9 +63,9 @@ public class RouteSearch {
|
|||||||
mViaPoints = new ArrayList<GeoPoint>();
|
mViaPoints = new ArrayList<GeoPoint>();
|
||||||
|
|
||||||
// Itinerary markers:
|
// Itinerary markers:
|
||||||
ArrayList<ExtendedMarkerItem> waypointsItems = new ArrayList<ExtendedMarkerItem>();
|
ArrayList<MarkerInterface> waypointsItems = new ArrayList<>();
|
||||||
|
|
||||||
mItineraryMarkers = new ItemizedOverlayWithBubble<ExtendedMarkerItem>(App.map,
|
mItineraryMarkers = new ItemizedOverlayWithBubble(App.map,
|
||||||
App.activity,
|
App.activity,
|
||||||
null,
|
null,
|
||||||
waypointsItems,
|
waypointsItems,
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2010, 2011, 2012 mapsforge.org
|
* 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
|
* 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
|
||||||
@@ -15,40 +15,30 @@
|
|||||||
*/
|
*/
|
||||||
package org.oscim.app.filefilter;
|
package org.oscim.app.filefilter;
|
||||||
|
|
||||||
import org.oscim.theme.ExternalRenderTheme;
|
import org.oscim.theme.ThemeLoader;
|
||||||
import org.oscim.theme.ThemeFile;
|
|
||||||
import org.oscim.theme.XmlThemeBuilder;
|
|
||||||
import org.oscim.tiling.TileSource.OpenResult;
|
import org.oscim.tiling.TileSource.OpenResult;
|
||||||
import org.xml.sax.InputSource;
|
|
||||||
import org.xml.sax.XMLReader;
|
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
|
||||||
import javax.xml.parsers.SAXParserFactory;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Accepts all valid render theme XML files.
|
* Accepts all valid render theme XML files.
|
||||||
*/
|
*/
|
||||||
public final class ValidRenderTheme implements ValidFileFilter {
|
public final class ValidRenderTheme implements ValidFileFilter {
|
||||||
private OpenResult openResult;
|
private OpenResult mOpenResult;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean accept(File file) {
|
public boolean accept(File file) {
|
||||||
try {
|
try {
|
||||||
ThemeFile theme = new ExternalRenderTheme(file.getAbsolutePath());
|
ThemeLoader.load(file.getAbsolutePath());
|
||||||
XmlThemeBuilder renderThemeHandler = new XmlThemeBuilder(theme);
|
mOpenResult = OpenResult.SUCCESS;
|
||||||
XMLReader xmlReader = SAXParserFactory.newInstance().newSAXParser().getXMLReader();
|
|
||||||
xmlReader.setContentHandler(renderThemeHandler);
|
|
||||||
xmlReader.parse(new InputSource(theme.getRenderThemeAsStream()));
|
|
||||||
this.openResult = OpenResult.SUCCESS;
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
this.openResult = new OpenResult(e.getMessage());
|
mOpenResult = new OpenResult(e.getMessage());
|
||||||
}
|
}
|
||||||
return this.openResult.isSuccess();
|
return mOpenResult.isSuccess();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public OpenResult getFileOpenResult() {
|
public OpenResult getFileOpenResult() {
|
||||||
return this.openResult;
|
return mOpenResult;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,7 +2,6 @@ package org.osmdroid.overlays;
|
|||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
|
||||||
import org.oscim.app.App;
|
import org.oscim.app.App;
|
||||||
import org.oscim.core.GeoPoint;
|
import org.oscim.core.GeoPoint;
|
||||||
import org.oscim.core.MapPosition;
|
import org.oscim.core.MapPosition;
|
||||||
@@ -10,6 +9,7 @@ import org.oscim.core.Point;
|
|||||||
import org.oscim.event.Event;
|
import org.oscim.event.Event;
|
||||||
import org.oscim.event.MotionEvent;
|
import org.oscim.event.MotionEvent;
|
||||||
import org.oscim.layers.marker.ItemizedLayer;
|
import org.oscim.layers.marker.ItemizedLayer;
|
||||||
|
import org.oscim.layers.marker.MarkerInterface;
|
||||||
import org.oscim.layers.marker.MarkerItem;
|
import org.oscim.layers.marker.MarkerItem;
|
||||||
import org.oscim.layers.marker.MarkerSymbol;
|
import org.oscim.layers.marker.MarkerSymbol;
|
||||||
import org.oscim.map.Map;
|
import org.oscim.map.Map;
|
||||||
@@ -22,14 +22,12 @@ import java.util.List;
|
|||||||
* taps on an overlay item, and displays item attributes. <br>
|
* taps on an overlay item, and displays item attributes. <br>
|
||||||
* Items must be ExtendedMarkerItem. <br>
|
* Items must be ExtendedMarkerItem. <br>
|
||||||
*
|
*
|
||||||
* @param <Item> ...
|
|
||||||
* @author M.Kergall
|
* @author M.Kergall
|
||||||
* @see ExtendedMarkerItem
|
* @see ExtendedMarkerItem
|
||||||
* @see InfoWindow
|
* @see InfoWindow
|
||||||
*/
|
*/
|
||||||
public class ItemizedOverlayWithBubble<Item extends MarkerItem> extends
|
public class ItemizedOverlayWithBubble extends ItemizedLayer
|
||||||
ItemizedLayer<Item> implements
|
implements ItemizedLayer.OnItemGestureListener<MarkerInterface>, Map.UpdateListener {
|
||||||
ItemizedLayer.OnItemGestureListener<Item>, Map.UpdateListener {
|
|
||||||
|
|
||||||
/* only one for all items of this overlay => one at a time */
|
/* only one for all items of this overlay => one at a time */
|
||||||
protected InfoWindow mBubble;
|
protected InfoWindow mBubble;
|
||||||
@@ -40,7 +38,7 @@ public class ItemizedOverlayWithBubble<Item extends MarkerItem> extends
|
|||||||
static int layoutResId = 0;
|
static int layoutResId = 0;
|
||||||
|
|
||||||
public ItemizedOverlayWithBubble(Map map, Context context,
|
public ItemizedOverlayWithBubble(Map map, Context context,
|
||||||
MarkerSymbol marker, List<Item> list, InfoWindow bubble) {
|
MarkerSymbol marker, List<MarkerInterface> list, InfoWindow bubble) {
|
||||||
super(map, list, marker, null);
|
super(map, list, marker, null);
|
||||||
|
|
||||||
if (bubble != null) {
|
if (bubble != null) {
|
||||||
@@ -66,12 +64,12 @@ public class ItemizedOverlayWithBubble<Item extends MarkerItem> extends
|
|||||||
}
|
}
|
||||||
|
|
||||||
public ItemizedOverlayWithBubble(Map map, Context context,
|
public ItemizedOverlayWithBubble(Map map, Context context,
|
||||||
MarkerSymbol marker, List<Item> aList) {
|
MarkerSymbol marker, List<MarkerInterface> aList) {
|
||||||
this(map, context, marker, aList, null);
|
this(map, context, marker, aList, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onItemLongPress(int index, MarkerItem item) {
|
public boolean onItemLongPress(int index, MarkerInterface item) {
|
||||||
if (mBubble.isOpen())
|
if (mBubble.isOpen())
|
||||||
hideBubble();
|
hideBubble();
|
||||||
else
|
else
|
||||||
@@ -80,7 +78,7 @@ public class ItemizedOverlayWithBubble<Item extends MarkerItem> extends
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onItemSingleTapUp(int index, MarkerItem item) {
|
public boolean onItemSingleTapUp(int index, MarkerInterface item) {
|
||||||
showBubble(index);
|
showBubble(index);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@@ -121,7 +119,6 @@ public class ItemizedOverlayWithBubble<Item extends MarkerItem> extends
|
|||||||
*
|
*
|
||||||
* @param index of the overlay item to show
|
* @param index of the overlay item to show
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
public void showBubbleOnItem(int index) {
|
public void showBubbleOnItem(int index) {
|
||||||
ExtendedMarkerItem item = (ExtendedMarkerItem) (mItemList.get(index));
|
ExtendedMarkerItem item = (ExtendedMarkerItem) (mItemList.get(index));
|
||||||
mItemWithBubble = item;
|
mItemWithBubble = item;
|
||||||
@@ -131,7 +128,7 @@ public class ItemizedOverlayWithBubble<Item extends MarkerItem> extends
|
|||||||
mMap.animator().animateTo(item.geoPoint);
|
mMap.animator().animateTo(item.geoPoint);
|
||||||
|
|
||||||
mMap.updateMap(true);
|
mMap.updateMap(true);
|
||||||
setFocus((Item) item);
|
setFocus(item);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -179,7 +176,7 @@ public class ItemizedOverlayWithBubble<Item extends MarkerItem> extends
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public synchronized boolean removeItem(final Item item) {
|
public synchronized boolean removeItem(final MarkerInterface item) {
|
||||||
boolean result = super.removeItem(item);
|
boolean result = super.removeItem(item);
|
||||||
if (mItemWithBubble == item) {
|
if (mItemWithBubble == item) {
|
||||||
hideBubble();
|
hideBubble();
|
||||||
|
|||||||
@@ -3,10 +3,7 @@ apply plugin: 'maven'
|
|||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
api project(':vtm')
|
api project(':vtm')
|
||||||
api('org.jeo:jeo:0-SNAPSHOT') {
|
api('com.github.jeo.jeo:jeo-carto:master-SNAPSHOT') {
|
||||||
exclude group: 'org.slf4j', module: 'slf4j-jdk14'
|
|
||||||
}
|
|
||||||
api('org.jeo:jeo-carto:0-SNAPSHOT') {
|
|
||||||
exclude group: 'org.slf4j', module: 'slf4j-jdk14'
|
exclude group: 'org.slf4j', module: 'slf4j-jdk14'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
package org.oscim.jeo;
|
package org.oscim.jeo;
|
||||||
|
|
||||||
import org.jeo.map.RGB;
|
import io.jeo.map.RGB;
|
||||||
|
|
||||||
public class JeoUtils {
|
public class JeoUtils {
|
||||||
public static int color(RGB rgb) {
|
public static int color(RGB rgb) {
|
||||||
|
|||||||
@@ -16,8 +16,8 @@
|
|||||||
*/
|
*/
|
||||||
package org.oscim.layers;
|
package org.oscim.layers;
|
||||||
|
|
||||||
import org.jeo.tile.Tile;
|
import io.jeo.tile.Tile;
|
||||||
import org.jeo.tile.TileDataset;
|
import io.jeo.tile.TileDataset;
|
||||||
import org.oscim.backend.CanvasAdapter;
|
import org.oscim.backend.CanvasAdapter;
|
||||||
import org.oscim.backend.canvas.Bitmap;
|
import org.oscim.backend.canvas.Bitmap;
|
||||||
import org.oscim.layers.tile.MapTile;
|
import org.oscim.layers.tile.MapTile;
|
||||||
@@ -30,9 +30,7 @@ import org.slf4j.LoggerFactory;
|
|||||||
import java.io.ByteArrayInputStream;
|
import java.io.ByteArrayInputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
import static org.oscim.tiling.QueryResult.FAILED;
|
import static org.oscim.tiling.QueryResult.*;
|
||||||
import static org.oscim.tiling.QueryResult.SUCCESS;
|
|
||||||
import static org.oscim.tiling.QueryResult.TILE_NOT_FOUND;
|
|
||||||
|
|
||||||
public class JeoTileSource extends TileSource {
|
public class JeoTileSource extends TileSource {
|
||||||
static final Logger log = LoggerFactory.getLogger(JeoTileSource.class);
|
static final Logger log = LoggerFactory.getLogger(JeoTileSource.class);
|
||||||
|
|||||||
@@ -19,16 +19,11 @@ package org.oscim.layers;
|
|||||||
import com.vividsolutions.jts.geom.Envelope;
|
import com.vividsolutions.jts.geom.Envelope;
|
||||||
import com.vividsolutions.jts.geom.Geometry;
|
import com.vividsolutions.jts.geom.Geometry;
|
||||||
import com.vividsolutions.jts.geom.LineString;
|
import com.vividsolutions.jts.geom.LineString;
|
||||||
|
import io.jeo.geom.Geom;
|
||||||
import org.jeo.geom.Geom;
|
import io.jeo.map.*;
|
||||||
import org.jeo.map.CartoCSS;
|
import io.jeo.vector.Feature;
|
||||||
import org.jeo.map.RGB;
|
import io.jeo.vector.VectorDataset;
|
||||||
import org.jeo.map.Rule;
|
import io.jeo.vector.VectorQuery;
|
||||||
import org.jeo.map.RuleList;
|
|
||||||
import org.jeo.map.Style;
|
|
||||||
import org.jeo.vector.Feature;
|
|
||||||
import org.jeo.vector.VectorDataset;
|
|
||||||
import org.jeo.vector.VectorQuery;
|
|
||||||
import org.oscim.jeo.JeoUtils;
|
import org.oscim.jeo.JeoUtils;
|
||||||
import org.oscim.map.Map;
|
import org.oscim.map.Map;
|
||||||
import org.oscim.renderer.bucket.LineBucket;
|
import org.oscim.renderer.bucket.LineBucket;
|
||||||
@@ -77,7 +72,7 @@ public class JeoVectorLayer extends JtsLayer {
|
|||||||
VectorQuery q = new VectorQuery().bounds(b);
|
VectorQuery q = new VectorQuery().bounds(b);
|
||||||
if (dbg)
|
if (dbg)
|
||||||
log.debug("query {}", b);
|
log.debug("query {}", b);
|
||||||
for (Feature f : mDataset.cursor(q)) {
|
for (Feature f : mDataset.read(q)) {
|
||||||
if (dbg)
|
if (dbg)
|
||||||
log.debug("feature {}", f);
|
log.debug("feature {}", f);
|
||||||
|
|
||||||
|
|||||||
@@ -21,13 +21,8 @@ package org.oscim.layers;
|
|||||||
import com.vividsolutions.jts.geom.Coordinate;
|
import com.vividsolutions.jts.geom.Coordinate;
|
||||||
import com.vividsolutions.jts.geom.Envelope;
|
import com.vividsolutions.jts.geom.Envelope;
|
||||||
import com.vividsolutions.jts.geom.Geometry;
|
import com.vividsolutions.jts.geom.Geometry;
|
||||||
|
import io.jeo.geom.CoordinatePath;
|
||||||
import org.jeo.geom.CoordinatePath;
|
import org.oscim.core.*;
|
||||||
import org.oscim.core.Box;
|
|
||||||
import org.oscim.core.GeometryBuffer;
|
|
||||||
import org.oscim.core.MapPosition;
|
|
||||||
import org.oscim.core.MercatorProjection;
|
|
||||||
import org.oscim.core.Tile;
|
|
||||||
import org.oscim.layers.vector.AbstractVectorLayer;
|
import org.oscim.layers.vector.AbstractVectorLayer;
|
||||||
import org.oscim.map.Map;
|
import org.oscim.map.Map;
|
||||||
import org.oscim.renderer.bucket.LineBucket;
|
import org.oscim.renderer.bucket.LineBucket;
|
||||||
|
|||||||
@@ -21,13 +21,12 @@ package org.oscim.layers;
|
|||||||
import com.vividsolutions.jts.geom.Envelope;
|
import com.vividsolutions.jts.geom.Envelope;
|
||||||
import com.vividsolutions.jts.geom.Geometry;
|
import com.vividsolutions.jts.geom.Geometry;
|
||||||
import com.vividsolutions.jts.geom.LineString;
|
import com.vividsolutions.jts.geom.LineString;
|
||||||
|
import io.jeo.map.CartoCSS;
|
||||||
import org.jeo.map.CartoCSS;
|
import io.jeo.map.RGB;
|
||||||
import org.jeo.map.RGB;
|
import io.jeo.map.Rule;
|
||||||
import org.jeo.map.Rule;
|
import io.jeo.map.Style;
|
||||||
import org.jeo.map.Style;
|
import io.jeo.vector.Feature;
|
||||||
import org.jeo.vector.Feature;
|
import io.jeo.vector.VectorDataset;
|
||||||
import org.jeo.vector.VectorDataset;
|
|
||||||
import org.oscim.backend.canvas.Color;
|
import org.oscim.backend.canvas.Color;
|
||||||
import org.oscim.jeo.JeoUtils;
|
import org.oscim.jeo.JeoUtils;
|
||||||
import org.oscim.map.Map;
|
import org.oscim.map.Map;
|
||||||
|
|||||||
@@ -18,21 +18,15 @@
|
|||||||
package org.oscim.test;
|
package org.oscim.test;
|
||||||
|
|
||||||
import com.vividsolutions.jts.geom.Geometry;
|
import com.vividsolutions.jts.geom.Geometry;
|
||||||
|
import io.jeo.carto.Carto;
|
||||||
import org.jeo.carto.Carto;
|
import io.jeo.data.Dataset;
|
||||||
import org.jeo.data.Dataset;
|
import io.jeo.data.mem.MemVectorDataset;
|
||||||
import org.jeo.data.mem.MemVector;
|
import io.jeo.data.mem.MemWorkspace;
|
||||||
import org.jeo.data.mem.MemWorkspace;
|
import io.jeo.geojson.GeoJSONDataset;
|
||||||
import org.jeo.geojson.GeoJSONDataset;
|
import io.jeo.geojson.GeoJSONReader;
|
||||||
import org.jeo.geojson.GeoJSONReader;
|
import io.jeo.geom.GeomBuilder;
|
||||||
import org.jeo.geom.GeomBuilder;
|
import io.jeo.map.Style;
|
||||||
import org.jeo.map.Style;
|
import io.jeo.vector.*;
|
||||||
import org.jeo.vector.Feature;
|
|
||||||
import org.jeo.vector.Features;
|
|
||||||
import org.jeo.vector.Schema;
|
|
||||||
import org.jeo.vector.SchemaBuilder;
|
|
||||||
import org.jeo.vector.VectorDataset;
|
|
||||||
import org.jeo.vector.VectorQuery;
|
|
||||||
import org.oscim.backend.canvas.Color;
|
import org.oscim.backend.canvas.Color;
|
||||||
import org.oscim.layers.OSMIndoorLayer;
|
import org.oscim.layers.OSMIndoorLayer;
|
||||||
import org.oscim.layers.tile.buildings.BuildingLayer;
|
import org.oscim.layers.tile.buildings.BuildingLayer;
|
||||||
@@ -42,11 +36,7 @@ import org.oscim.renderer.MapRenderer;
|
|||||||
import org.oscim.theme.styles.TextStyle;
|
import org.oscim.theme.styles.TextStyle;
|
||||||
import org.oscim.tiling.source.oscimap4.OSciMap4TileSource;
|
import org.oscim.tiling.source.oscimap4.OSciMap4TileSource;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.*;
|
||||||
import java.io.FileInputStream;
|
|
||||||
import java.io.FileNotFoundException;
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.io.InputStream;
|
|
||||||
|
|
||||||
public class JeoTest {
|
public class JeoTest {
|
||||||
|
|
||||||
@@ -101,13 +91,13 @@ public class JeoTest {
|
|||||||
GeoJSONReader r = new GeoJSONReader();
|
GeoJSONReader r = new GeoJSONReader();
|
||||||
|
|
||||||
@SuppressWarnings("resource")
|
@SuppressWarnings("resource")
|
||||||
MemWorkspace mem = new MemWorkspace();
|
MemWorkspace mem = new MemWorkspace("");
|
||||||
|
|
||||||
//mem.put("layer", data);
|
//mem.put("layer", data);
|
||||||
try {
|
try {
|
||||||
Schema s = new SchemaBuilder("way").schema();
|
Schema s = new SchemaBuilder("way").schema();
|
||||||
|
|
||||||
MemVector memData = mem.create(s);
|
MemVectorDataset memData = mem.create(s);
|
||||||
|
|
||||||
for (Feature f : r.features(is)) {
|
for (Feature f : r.features(is)) {
|
||||||
//System.out.println("loaded: " + f);
|
//System.out.println("loaded: " + f);
|
||||||
@@ -133,7 +123,7 @@ public class JeoTest {
|
|||||||
|
|
||||||
if (memory) {
|
if (memory) {
|
||||||
@SuppressWarnings("resource")
|
@SuppressWarnings("resource")
|
||||||
MemWorkspace mem = new MemWorkspace();
|
MemWorkspace mem = new MemWorkspace("");
|
||||||
|
|
||||||
//mem.put("layer", data);
|
//mem.put("layer", data);
|
||||||
try {
|
try {
|
||||||
@@ -141,9 +131,9 @@ public class JeoTest {
|
|||||||
Schema s = data.schema();
|
Schema s = data.schema();
|
||||||
VectorQuery q = new VectorQuery();
|
VectorQuery q = new VectorQuery();
|
||||||
|
|
||||||
MemVector memData = mem.create(s);
|
MemVectorDataset memData = mem.create(s);
|
||||||
|
|
||||||
for (Feature f : data.cursor(q)) {
|
for (Feature f : data.read(q)) {
|
||||||
memData.add(f);
|
memData.add(f);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -160,14 +150,14 @@ public class JeoTest {
|
|||||||
GeomBuilder gb = new GeomBuilder(4326);
|
GeomBuilder gb = new GeomBuilder(4326);
|
||||||
|
|
||||||
@SuppressWarnings("resource")
|
@SuppressWarnings("resource")
|
||||||
MemWorkspace mem = new MemWorkspace();
|
MemWorkspace mem = new MemWorkspace("");
|
||||||
Schema schema = new SchemaBuilder(layer)
|
Schema schema = new SchemaBuilder(layer)
|
||||||
.field("geometry", Geometry.class)
|
.field("geometry", Geometry.class)
|
||||||
.field("id", Integer.class)
|
.field("id", Integer.class)
|
||||||
.field("name", String.class)
|
.field("name", String.class)
|
||||||
.field("cost", Double.class).schema();
|
.field("cost", Double.class).schema();
|
||||||
|
|
||||||
MemVector data;
|
MemVectorDataset data;
|
||||||
try {
|
try {
|
||||||
data = mem.create(schema);
|
data = mem.create(schema);
|
||||||
} catch (UnsupportedOperationException e) {
|
} catch (UnsupportedOperationException e) {
|
||||||
@@ -181,15 +171,16 @@ public class JeoTest {
|
|||||||
Geometry g = gb.point(0, 0).toPoint();
|
Geometry g = gb.point(0, 0).toPoint();
|
||||||
//g.setSRID(4326);
|
//g.setSRID(4326);
|
||||||
|
|
||||||
data.add(Features.create(null, data.schema(),
|
|
||||||
|
data.add(new ListFeature(data.schema(),
|
||||||
g, 1, "anvil",
|
g, 1, "anvil",
|
||||||
10.99));
|
10.99));
|
||||||
|
|
||||||
data.add(Features.create(null, data.schema(),
|
data.add(new ListFeature(data.schema(),
|
||||||
gb.points(10, 10, 20, 20).toLineString(),
|
gb.points(10, 10, 20, 20).toLineString(),
|
||||||
2, "bomb", 11.99));
|
2, "bomb", 11.99));
|
||||||
|
|
||||||
data.add(Features.create(null, data.schema(),
|
data.add(new ListFeature(data.schema(),
|
||||||
gb.point(100, 10).toPoint().buffer(10),
|
gb.point(100, 10).toPoint().buffer(10),
|
||||||
3, "dynamite", 12.99));
|
3, "dynamite", 12.99));
|
||||||
|
|
||||||
|
|||||||
452
vtm-jeo/src/org/oscim/theme/carto/BasicFeature.java
Normal file
452
vtm-jeo/src/org/oscim/theme/carto/BasicFeature.java
Normal file
@@ -0,0 +1,452 @@
|
|||||||
|
/* Copyright 2013 The jeo project. All rights reserved.
|
||||||
|
*
|
||||||
|
* 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
|
||||||
|
*
|
||||||
|
* http://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.
|
||||||
|
*/
|
||||||
|
package org.oscim.theme.carto;
|
||||||
|
|
||||||
|
import com.vividsolutions.jts.geom.Geometry;
|
||||||
|
import io.jeo.util.Util;
|
||||||
|
import io.jeo.vector.Feature;
|
||||||
|
import io.jeo.vector.Field;
|
||||||
|
import io.jeo.vector.Schema;
|
||||||
|
import io.jeo.vector.SchemaBuilder;
|
||||||
|
import org.osgeo.proj4j.CoordinateReferenceSystem;
|
||||||
|
|
||||||
|
import java.util.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Basic feature implementation.
|
||||||
|
*
|
||||||
|
* @author Justin Deoliveira, Boundless
|
||||||
|
* <p>
|
||||||
|
* Adapted by Jan Lippert to the changes made in https://github.com/jeo/jeo/commit/e28695ccc8530ae6d1a2dff1fbd1e11449ef949f
|
||||||
|
*/
|
||||||
|
public class BasicFeature implements Feature {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* feature identifier
|
||||||
|
*/
|
||||||
|
protected String id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Underlying feature storage.
|
||||||
|
*/
|
||||||
|
protected Storage storage;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor taking a feature identifier.
|
||||||
|
*
|
||||||
|
* @param id The feature id, if <code>null</code> an identifier will be generated.
|
||||||
|
*/
|
||||||
|
public BasicFeature(String id) {
|
||||||
|
this(id, (Schema) null);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor taking a feature identifier and an explicit schema object.
|
||||||
|
*
|
||||||
|
* @param id The feature id, if <code>null</code> an identifier will be generated.
|
||||||
|
* @param schema The feature schema, if <code>null</code> the schema will be always be derived
|
||||||
|
*/
|
||||||
|
public BasicFeature(String id, Schema schema) {
|
||||||
|
this(id, (Storage)
|
||||||
|
(schema != null ? new ListStorage(null, schema) : new MapStorage(null, schema)));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructs a feature from an identifier and a list of values.
|
||||||
|
*
|
||||||
|
* @param id The feature id, if <code>null</code> an identifier will be generated.
|
||||||
|
* @param values The feature values.
|
||||||
|
*/
|
||||||
|
public BasicFeature(String id, List<Object> values) {
|
||||||
|
this(id, values, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructs a feature from an identifier, a list of values, and a schema.
|
||||||
|
*
|
||||||
|
* @param id The feature id, if <code>null</code> an identifier will be generated.
|
||||||
|
* @param values The feature values.
|
||||||
|
* @param schema The feature schema, if <code>null</code> the schema will be always be derived
|
||||||
|
*/
|
||||||
|
public BasicFeature(String id, List<Object> values, Schema schema) {
|
||||||
|
this(id, new ListStorage(values, schema));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructs a feature from an identifier and a map of values.
|
||||||
|
*
|
||||||
|
* @param id The feature id, if <code>null</code> an identifier will be generated.
|
||||||
|
* @param values The feature values.
|
||||||
|
*/
|
||||||
|
public BasicFeature(String id, Map<String, Object> values) {
|
||||||
|
this(id, values, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructs a feature from an identifier, a map of values, and a schema.
|
||||||
|
*
|
||||||
|
* @param id The feature id, if <code>null</code> an identifier will be generated.
|
||||||
|
* @param values The feature values.
|
||||||
|
* @param schema The feature schema, if <code>null</code> the schema will be always be derived
|
||||||
|
*/
|
||||||
|
public BasicFeature(String id, Map<String, Object> values, Schema schema) {
|
||||||
|
this(id, new MapStorage(values, schema));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor taking an identifier and feature storage object directly.
|
||||||
|
* <p>
|
||||||
|
* This constructor is typically only used for subclasses that need to implement custom feature
|
||||||
|
* storage.
|
||||||
|
* </p>
|
||||||
|
*/
|
||||||
|
protected BasicFeature(String id, Storage storage) {
|
||||||
|
this.id = id != null ? id : Util.uuid();
|
||||||
|
this.storage = storage;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String id() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*@Override
|
||||||
|
public CoordinateReferenceSystem getCRS() {
|
||||||
|
return crs;
|
||||||
|
}*/
|
||||||
|
|
||||||
|
public BasicFeature crs(CoordinateReferenceSystem crs) {
|
||||||
|
storage.crs(crs);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean has(String key) {
|
||||||
|
return storage.has(key);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Object get(String key) {
|
||||||
|
return storage.get(key);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public BasicFeature put(String key, Object val) {
|
||||||
|
storage.put(key, val);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public BasicFeature put(Geometry g) {
|
||||||
|
//TODO:optimize before triggering schema creation
|
||||||
|
Field gf = storage.schema(true).geometry();
|
||||||
|
if (gf == null) {
|
||||||
|
throw new IllegalArgumentException("Feature schema has no geometry");
|
||||||
|
}
|
||||||
|
|
||||||
|
return put(gf.name(), g);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Geometry geometry() {
|
||||||
|
return storage.geometry();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Map<String, Object> map() {
|
||||||
|
return storage.map();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return new StringBuilder(id).append(map()).toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
final int prime = 31;
|
||||||
|
int result = 1;
|
||||||
|
result = prime * result + ((id == null) ? 0 : id.hashCode());
|
||||||
|
result = prime * result + ((storage == null) ? 0 : storage.hashCode());
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(Object obj) {
|
||||||
|
if (this == obj)
|
||||||
|
return true;
|
||||||
|
if (obj == null)
|
||||||
|
return false;
|
||||||
|
if (getClass() != obj.getClass())
|
||||||
|
return false;
|
||||||
|
BasicFeature other = (BasicFeature) obj;
|
||||||
|
if (id == null) {
|
||||||
|
return other.id == null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return id.equals(other.id);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
protected static abstract class Storage {
|
||||||
|
Schema schema;
|
||||||
|
CoordinateReferenceSystem crs;
|
||||||
|
|
||||||
|
protected Storage(Schema schema) {
|
||||||
|
this.schema = schema;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected Storage crs(CoordinateReferenceSystem crs) {
|
||||||
|
this.crs = crs;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected Schema schema() {
|
||||||
|
return schema(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected Schema schema(boolean derive) {
|
||||||
|
if (schema == null && derive) {
|
||||||
|
schema = buildSchema();
|
||||||
|
|
||||||
|
// hack to apply crs override
|
||||||
|
if (crs != null && schema.crs() == null) {
|
||||||
|
schema = SchemaBuilder.crs(schema, crs);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return schema;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected Geometry geometry() {
|
||||||
|
if (schema != null) {
|
||||||
|
Field f = schema.geometry();
|
||||||
|
if (f != null) {
|
||||||
|
return (Geometry) get(f.name());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return findGeometry();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected CoordinateReferenceSystem crs() {
|
||||||
|
if (crs != null) {
|
||||||
|
return crs;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (schema != null) {
|
||||||
|
return schema.crs();
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Method for subclasses to implement to build a schema for the feature from its underlying
|
||||||
|
* attributes.
|
||||||
|
*/
|
||||||
|
protected abstract Schema buildSchema();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Method for subclasses to implement in order to find a geometry object when no schema
|
||||||
|
* information is available.
|
||||||
|
*/
|
||||||
|
protected abstract Geometry findGeometry();
|
||||||
|
|
||||||
|
protected abstract Object get(String key);
|
||||||
|
|
||||||
|
protected abstract Object get(int index);
|
||||||
|
|
||||||
|
protected abstract void put(String key, Object value);
|
||||||
|
|
||||||
|
protected abstract void set(int index, Object value);
|
||||||
|
|
||||||
|
protected abstract List<Object> list();
|
||||||
|
|
||||||
|
protected abstract Map<String, Object> map();
|
||||||
|
|
||||||
|
protected abstract boolean has(String key);
|
||||||
|
}
|
||||||
|
|
||||||
|
static class ListStorage extends Storage {
|
||||||
|
|
||||||
|
List<Object> list;
|
||||||
|
|
||||||
|
ListStorage(List<Object> values, Schema schema) {
|
||||||
|
super(schema);
|
||||||
|
this.list = pad(values, schema);
|
||||||
|
}
|
||||||
|
|
||||||
|
List<Object> pad(List<Object> values, Schema schema) {
|
||||||
|
//copy list passed in
|
||||||
|
values = values != null ? new ArrayList<Object>(values) : new ArrayList<Object>();
|
||||||
|
|
||||||
|
//expand up to size of schema if necessary
|
||||||
|
if (schema != null) {
|
||||||
|
while (values.size() < schema.size()) {
|
||||||
|
values.add(null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return values;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected Geometry findGeometry() {
|
||||||
|
for (Object o : list) {
|
||||||
|
if (o instanceof Geometry) {
|
||||||
|
return (Geometry) o;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected Schema buildSchema() {
|
||||||
|
List<Field> fields = new ArrayList<Field>();
|
||||||
|
int i = 0;
|
||||||
|
boolean g = false;
|
||||||
|
for (Object o : list) {
|
||||||
|
if (o instanceof Geometry && !g) {
|
||||||
|
//first geometry
|
||||||
|
fields.add(new Field("geometry", o.getClass()));
|
||||||
|
g = true;
|
||||||
|
} else {
|
||||||
|
//regular field
|
||||||
|
fields.add(new Field(String.format(Locale.ROOT, "field%d", i++), o != null ? o.getClass() : null));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return new Schema("feature", fields);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected boolean has(String key) {
|
||||||
|
return schema().indexOf(key) >= 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected Object get(int i) {
|
||||||
|
return list.get(i);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void set(int i, Object value) {
|
||||||
|
list.set(i, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected Object get(String key) {
|
||||||
|
int i = schema().indexOf(key);
|
||||||
|
return i != -1 ? get(i) : null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void put(String key, Object val) {
|
||||||
|
int i = schema().indexOf(key);
|
||||||
|
if (i == -1) {
|
||||||
|
throw new IllegalArgumentException("No such key " + key);
|
||||||
|
}
|
||||||
|
set(i, val);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected List<Object> list() {
|
||||||
|
return Collections.unmodifiableList(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected Map<String, Object> map() {
|
||||||
|
LinkedHashMap<String, Object> map = new LinkedHashMap<String, Object>();
|
||||||
|
for (Field f : schema()) {
|
||||||
|
map.put(f.name(), get(f.name()));
|
||||||
|
}
|
||||||
|
return map;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static class MapStorage extends Storage {
|
||||||
|
|
||||||
|
Map<String, Object> map;
|
||||||
|
|
||||||
|
MapStorage(Map<String, Object> values, Schema schema) {
|
||||||
|
super(schema);
|
||||||
|
this.map = values != null ?
|
||||||
|
new LinkedHashMap<String, Object>(values) : new LinkedHashMap<String, Object>();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected Schema buildSchema() {
|
||||||
|
List<Field> fields = new ArrayList<Field>();
|
||||||
|
for (Map.Entry<String, Object> e : map.entrySet()) {
|
||||||
|
fields.add(new Field(e.getKey(), e.getValue() != null ? e.getValue().getClass() : null));
|
||||||
|
}
|
||||||
|
|
||||||
|
return new Schema("feature", fields);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected Geometry findGeometry() {
|
||||||
|
for (Object obj : map.values()) {
|
||||||
|
if (obj instanceof Geometry) {
|
||||||
|
return (Geometry) obj;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected boolean has(String key) {
|
||||||
|
return map.containsKey(key);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected Object get(String key) {
|
||||||
|
return map.get(key);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void put(String key, Object val) {
|
||||||
|
if (!map.containsKey(key)) {
|
||||||
|
//new field, clear cached schema
|
||||||
|
schema = null;
|
||||||
|
}
|
||||||
|
map.put(key, val);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected Object get(int index) {
|
||||||
|
return Util.get(map, index);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void set(int index, Object value) {
|
||||||
|
Util.set(map, index, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected List<Object> list() {
|
||||||
|
List<Object> list = new ArrayList<Object>();
|
||||||
|
for (Field f : schema()) {
|
||||||
|
list.add(get(f.name()));
|
||||||
|
}
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected Map<String, Object> map() {
|
||||||
|
return Collections.unmodifiableMap(map);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -16,11 +16,9 @@
|
|||||||
*/
|
*/
|
||||||
package org.oscim.theme.carto;
|
package org.oscim.theme.carto;
|
||||||
|
|
||||||
import org.jeo.vector.BasicFeature;
|
|
||||||
import org.oscim.core.Tag;
|
import org.oscim.core.Tag;
|
||||||
import org.oscim.core.TagSet;
|
import org.oscim.core.TagSet;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import static java.lang.System.out;
|
import static java.lang.System.out;
|
||||||
@@ -64,27 +62,10 @@ class MatcherFeature extends BasicFeature {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<Object> list() {
|
|
||||||
out.println("EEEK list()");
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Map<String, Object> map() {
|
public Map<String, Object> map() {
|
||||||
out.println("EEEK map()");
|
out.println("EEEK map()");
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public Object get(int arg0) {
|
|
||||||
// TODO Auto-generated method stub
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public BasicFeature set(int arg0, Object arg1) {
|
|
||||||
// TODO Auto-generated method stub
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,11 +1,7 @@
|
|||||||
package org.oscim.theme.carto;
|
package org.oscim.theme.carto;
|
||||||
|
|
||||||
import org.jeo.carto.Carto;
|
import io.jeo.carto.Carto;
|
||||||
import org.jeo.map.CartoCSS;
|
import io.jeo.map.*;
|
||||||
import org.jeo.map.RGB;
|
|
||||||
import org.jeo.map.Rule;
|
|
||||||
import org.jeo.map.RuleList;
|
|
||||||
import org.jeo.map.Style;
|
|
||||||
import org.oscim.core.GeometryBuffer.GeometryType;
|
import org.oscim.core.GeometryBuffer.GeometryType;
|
||||||
import org.oscim.core.MapElement;
|
import org.oscim.core.MapElement;
|
||||||
import org.oscim.core.Tag;
|
import org.oscim.core.Tag;
|
||||||
@@ -19,9 +15,9 @@ import java.io.IOException;
|
|||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
import static io.jeo.map.CartoCSS.BACKGROUND_COLOR;
|
||||||
|
import static io.jeo.map.CartoCSS.OPACITY;
|
||||||
import static java.lang.System.out;
|
import static java.lang.System.out;
|
||||||
import static org.jeo.map.CartoCSS.BACKGROUND_COLOR;
|
|
||||||
import static org.jeo.map.CartoCSS.OPACITY;
|
|
||||||
|
|
||||||
public class RenderTheme implements IRenderTheme {
|
public class RenderTheme implements IRenderTheme {
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2014 Hannes Janetzek
|
* Copyright 2014 Hannes Janetzek
|
||||||
* Copyright 2016-2019 devemux86
|
* Copyright 2016-2019 devemux86
|
||||||
|
* Copyright 2020 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).
|
||||||
*
|
*
|
||||||
@@ -201,11 +202,11 @@ public class VectorLayer extends AbstractVectorLayer<Drawable> implements Gestur
|
|||||||
|
|
||||||
for (Drawable d : tmpDrawables) {
|
for (Drawable d : tmpDrawables) {
|
||||||
Style style = d.getStyle();
|
Style style = d.getStyle();
|
||||||
draw(t, level, d, style);
|
|
||||||
|
|
||||||
if (style != lastStyle)
|
if (lastStyle != null && lastStyle != style)
|
||||||
level += 2;
|
level += 2;
|
||||||
|
|
||||||
|
draw(t, level, d, style);
|
||||||
lastStyle = style;
|
lastStyle = style;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ public class PointDrawable extends JtsDrawable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public PointDrawable(GeoPoint point, Style style) {
|
public PointDrawable(GeoPoint point, Style style) {
|
||||||
this(point.getLongitude(), point.getLatitude(), style);
|
this(point.getLatitude(), point.getLongitude(), style);
|
||||||
}
|
}
|
||||||
|
|
||||||
public PointDrawable(double lat, double lon, Style style) {
|
public PointDrawable(double lat, double lon, Style style) {
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2014 Hannes Janetzek
|
* Copyright 2014 Hannes Janetzek
|
||||||
* Copyright 2017-2019 devemux86
|
* Copyright 2017-2020 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).
|
||||||
*
|
*
|
||||||
@@ -22,19 +22,22 @@ import org.oscim.core.BoundingBox;
|
|||||||
import org.oscim.gdx.GdxMapApp;
|
import org.oscim.gdx.GdxMapApp;
|
||||||
import org.oscim.layers.tile.bitmap.BitmapTileLayer;
|
import org.oscim.layers.tile.bitmap.BitmapTileLayer;
|
||||||
import org.oscim.renderer.MapRenderer;
|
import org.oscim.renderer.MapRenderer;
|
||||||
import org.oscim.tiling.TileSource;
|
|
||||||
import org.oscim.tiling.source.OkHttpEngine;
|
import org.oscim.tiling.source.OkHttpEngine;
|
||||||
|
import org.oscim.tiling.source.UrlTileSource;
|
||||||
import org.oscim.tiling.source.bitmap.DefaultSources;
|
import org.oscim.tiling.source.bitmap.DefaultSources;
|
||||||
|
|
||||||
|
import java.util.Collections;
|
||||||
|
|
||||||
public class AnimatorTest extends GdxMapApp {
|
public class AnimatorTest extends GdxMapApp {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void createLayers() {
|
public void createLayers() {
|
||||||
MapRenderer.setBackgroundColor(0xff000000);
|
MapRenderer.setBackgroundColor(0xff000000);
|
||||||
|
|
||||||
TileSource tileSource = DefaultSources.OPENSTREETMAP
|
UrlTileSource tileSource = DefaultSources.OPENSTREETMAP
|
||||||
.httpFactory(new OkHttpEngine.OkHttpFactory())
|
.httpFactory(new OkHttpEngine.OkHttpFactory())
|
||||||
.build();
|
.build();
|
||||||
|
tileSource.setHttpRequestHeaders(Collections.singletonMap("User-Agent", "vtm-playground"));
|
||||||
mMap.layers().add(new BitmapTileLayer(mMap, tileSource));
|
mMap.layers().add(new BitmapTileLayer(mMap, tileSource));
|
||||||
|
|
||||||
mMap.setMapPosition(0, 0, 1 << 4);
|
mMap.setMapPosition(0, 0, 1 << 4);
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2016-2018 devemux86
|
* Copyright 2016-2020 devemux86
|
||||||
* Copyright 2017 Longri
|
* Copyright 2017 Longri
|
||||||
*
|
*
|
||||||
* 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
|
||||||
@@ -23,17 +23,19 @@ import org.oscim.backend.canvas.Paint;
|
|||||||
import org.oscim.core.GeoPoint;
|
import org.oscim.core.GeoPoint;
|
||||||
import org.oscim.gdx.GdxMapApp;
|
import org.oscim.gdx.GdxMapApp;
|
||||||
import org.oscim.layers.marker.ItemizedLayer;
|
import org.oscim.layers.marker.ItemizedLayer;
|
||||||
|
import org.oscim.layers.marker.MarkerInterface;
|
||||||
import org.oscim.layers.marker.MarkerItem;
|
import org.oscim.layers.marker.MarkerItem;
|
||||||
import org.oscim.layers.marker.MarkerSymbol;
|
import org.oscim.layers.marker.MarkerSymbol;
|
||||||
import org.oscim.layers.tile.bitmap.BitmapTileLayer;
|
import org.oscim.layers.tile.bitmap.BitmapTileLayer;
|
||||||
import org.oscim.renderer.atlas.TextureAtlas;
|
import org.oscim.renderer.atlas.TextureAtlas;
|
||||||
import org.oscim.renderer.atlas.TextureRegion;
|
import org.oscim.renderer.atlas.TextureRegion;
|
||||||
import org.oscim.tiling.TileSource;
|
|
||||||
import org.oscim.tiling.source.OkHttpEngine;
|
import org.oscim.tiling.source.OkHttpEngine;
|
||||||
|
import org.oscim.tiling.source.UrlTileSource;
|
||||||
import org.oscim.tiling.source.bitmap.DefaultSources;
|
import org.oscim.tiling.source.bitmap.DefaultSources;
|
||||||
import org.oscim.utils.TextureAtlasUtils;
|
import org.oscim.utils.TextureAtlasUtils;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collections;
|
||||||
import java.util.LinkedHashMap;
|
import java.util.LinkedHashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@@ -46,9 +48,10 @@ public class AtlasMultiTextureTest extends MarkerLayerTest {
|
|||||||
// Map events receiver
|
// Map events receiver
|
||||||
mMap.layers().add(new MapEventsReceiver(mMap));
|
mMap.layers().add(new MapEventsReceiver(mMap));
|
||||||
|
|
||||||
TileSource tileSource = DefaultSources.OPENSTREETMAP
|
UrlTileSource tileSource = DefaultSources.OPENSTREETMAP
|
||||||
.httpFactory(new OkHttpEngine.OkHttpFactory())
|
.httpFactory(new OkHttpEngine.OkHttpFactory())
|
||||||
.build();
|
.build();
|
||||||
|
tileSource.setHttpRequestHeaders(Collections.singletonMap("User-Agent", "vtm-playground"));
|
||||||
mMap.layers().add(new BitmapTileLayer(mMap, tileSource));
|
mMap.layers().add(new BitmapTileLayer(mMap, tileSource));
|
||||||
|
|
||||||
mMap.setMapPosition(0, 0, 1 << 2);
|
mMap.setMapPosition(0, 0, 1 << 2);
|
||||||
@@ -64,7 +67,7 @@ public class AtlasMultiTextureTest extends MarkerLayerTest {
|
|||||||
paint.setTextSize(12);
|
paint.setTextSize(12);
|
||||||
paint.setStrokeWidth(2);
|
paint.setStrokeWidth(2);
|
||||||
paint.setColor(Color.BLACK);
|
paint.setColor(Color.BLACK);
|
||||||
List<MarkerItem> pts = new ArrayList<>();
|
List<MarkerInterface> pts = new ArrayList<>();
|
||||||
for (double lat = -90; lat <= 90; lat += 5) {
|
for (double lat = -90; lat <= 90; lat += 5) {
|
||||||
for (double lon = -180; lon <= 180; lon += 5) {
|
for (double lon = -180; lon <= 180; lon += 5) {
|
||||||
String title = lat + "/" + lon;
|
String title = lat + "/" + lon;
|
||||||
@@ -84,29 +87,32 @@ public class AtlasMultiTextureTest extends MarkerLayerTest {
|
|||||||
// With iOS we must flip the Y-Axis
|
// With iOS we must flip the Y-Axis
|
||||||
TextureAtlasUtils.createTextureRegions(inputMap, regionsMap, atlasList, true, false);
|
TextureAtlasUtils.createTextureRegions(inputMap, regionsMap, atlasList, true, false);
|
||||||
|
|
||||||
mMarkerLayer = new ItemizedLayer<>(mMap, new ArrayList<MarkerItem>(), (MarkerSymbol) null, this);
|
mMarkerLayer = new ItemizedLayer(mMap, new ArrayList<MarkerInterface>(), (MarkerSymbol) null, this);
|
||||||
mMap.layers().add(mMarkerLayer);
|
mMap.layers().add(mMarkerLayer);
|
||||||
|
|
||||||
mMarkerLayer.addItems(pts);
|
mMarkerLayer.addItems(pts);
|
||||||
|
|
||||||
// set all markers
|
// set all markers
|
||||||
for (MarkerItem item : pts) {
|
for (MarkerInterface item : pts) {
|
||||||
MarkerSymbol markerSymbol = new MarkerSymbol(regionsMap.get(item.getTitle()), HotspotPlace.BOTTOM_CENTER);
|
MarkerItem markerItem = (MarkerItem) item;
|
||||||
item.setMarker(markerSymbol);
|
MarkerSymbol markerSymbol = new MarkerSymbol(regionsMap.get(markerItem.getTitle()), HotspotPlace.BOTTOM_CENTER);
|
||||||
|
markerItem.setMarker(markerSymbol);
|
||||||
}
|
}
|
||||||
|
|
||||||
System.out.println("Atlas count: " + atlasList.size());
|
System.out.println("Atlas count: " + atlasList.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onItemSingleTapUp(int index, MarkerItem item) {
|
public boolean onItemSingleTapUp(int index, MarkerInterface item) {
|
||||||
System.out.println("Marker tap " + item.getTitle());
|
MarkerItem markerItem = (MarkerItem) item;
|
||||||
|
System.out.println("Marker tap " + markerItem.getTitle());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onItemLongPress(int index, MarkerItem item) {
|
public boolean onItemLongPress(int index, MarkerInterface item) {
|
||||||
System.out.println("Marker long press " + item.getTitle());
|
MarkerItem markerItem = (MarkerItem) item;
|
||||||
|
System.out.println("Marker long press " + markerItem.getTitle());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2016 devemux86
|
* Copyright 2016-2020 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).
|
||||||
*
|
*
|
||||||
@@ -20,8 +20,11 @@ import com.badlogic.gdx.Input;
|
|||||||
import org.oscim.gdx.GdxMapApp;
|
import org.oscim.gdx.GdxMapApp;
|
||||||
import org.oscim.layers.tile.bitmap.BitmapTileLayer;
|
import org.oscim.layers.tile.bitmap.BitmapTileLayer;
|
||||||
import org.oscim.renderer.MapRenderer;
|
import org.oscim.renderer.MapRenderer;
|
||||||
|
import org.oscim.tiling.source.UrlTileSource;
|
||||||
import org.oscim.tiling.source.bitmap.DefaultSources;
|
import org.oscim.tiling.source.bitmap.DefaultSources;
|
||||||
|
|
||||||
|
import java.util.Collections;
|
||||||
|
|
||||||
public class BitmapTileTest extends GdxMapApp {
|
public class BitmapTileTest extends GdxMapApp {
|
||||||
|
|
||||||
private BitmapTileLayer mLayer = null;
|
private BitmapTileLayer mLayer = null;
|
||||||
@@ -33,7 +36,9 @@ public class BitmapTileTest extends GdxMapApp {
|
|||||||
mMap.layers().remove(mShaded);
|
mMap.layers().remove(mShaded);
|
||||||
mShaded = null;
|
mShaded = null;
|
||||||
mMap.layers().remove(mLayer);
|
mMap.layers().remove(mLayer);
|
||||||
mLayer = new BitmapTileLayer(mMap, DefaultSources.OPENSTREETMAP.build());
|
UrlTileSource tileSource = DefaultSources.OPENSTREETMAP.build();
|
||||||
|
tileSource.setHttpRequestHeaders(Collections.singletonMap("User-Agent", "vtm-playground"));
|
||||||
|
mLayer = new BitmapTileLayer(mMap, tileSource);
|
||||||
mMap.layers().add(mLayer);
|
mMap.layers().add(mLayer);
|
||||||
mMap.clearMap();
|
mMap.clearMap();
|
||||||
return true;
|
return true;
|
||||||
@@ -64,7 +69,9 @@ public class BitmapTileTest extends GdxMapApp {
|
|||||||
public void createLayers() {
|
public void createLayers() {
|
||||||
MapRenderer.setBackgroundColor(0xff888888);
|
MapRenderer.setBackgroundColor(0xff888888);
|
||||||
|
|
||||||
mLayer = new BitmapTileLayer(mMap, DefaultSources.OPENSTREETMAP.build());
|
UrlTileSource tileSource = DefaultSources.OPENSTREETMAP.build();
|
||||||
|
tileSource.setHttpRequestHeaders(Collections.singletonMap("User-Agent", "vtm-playground"));
|
||||||
|
mLayer = new BitmapTileLayer(mMap, tileSource);
|
||||||
mMap.layers().add(mLayer);
|
mMap.layers().add(mLayer);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2016-2018 devemux86
|
* Copyright 2016-2020 devemux86
|
||||||
* Copyright 2017 nebular
|
* Copyright 2017 nebular
|
||||||
*
|
*
|
||||||
* 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
|
||||||
@@ -22,12 +22,13 @@ import org.oscim.core.GeoPoint;
|
|||||||
import org.oscim.gdx.GdxMapApp;
|
import org.oscim.gdx.GdxMapApp;
|
||||||
import org.oscim.layers.marker.*;
|
import org.oscim.layers.marker.*;
|
||||||
import org.oscim.layers.tile.bitmap.BitmapTileLayer;
|
import org.oscim.layers.tile.bitmap.BitmapTileLayer;
|
||||||
import org.oscim.tiling.TileSource;
|
|
||||||
import org.oscim.tiling.source.OkHttpEngine;
|
import org.oscim.tiling.source.OkHttpEngine;
|
||||||
|
import org.oscim.tiling.source.UrlTileSource;
|
||||||
import org.oscim.tiling.source.bitmap.DefaultSources;
|
import org.oscim.tiling.source.bitmap.DefaultSources;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class ClusterMarkerLayerTest extends MarkerLayerTest {
|
public class ClusterMarkerLayerTest extends MarkerLayerTest {
|
||||||
@@ -41,9 +42,10 @@ public class ClusterMarkerLayerTest extends MarkerLayerTest {
|
|||||||
// Map events receiver
|
// Map events receiver
|
||||||
mMap.layers().add(new MapEventsReceiver(mMap));
|
mMap.layers().add(new MapEventsReceiver(mMap));
|
||||||
|
|
||||||
TileSource tileSource = DefaultSources.OPENSTREETMAP
|
UrlTileSource tileSource = DefaultSources.OPENSTREETMAP
|
||||||
.httpFactory(new OkHttpEngine.OkHttpFactory())
|
.httpFactory(new OkHttpEngine.OkHttpFactory())
|
||||||
.build();
|
.build();
|
||||||
|
tileSource.setHttpRequestHeaders(Collections.singletonMap("User-Agent", "vtm-playground"));
|
||||||
mMap.layers().add(new BitmapTileLayer(mMap, tileSource));
|
mMap.layers().add(new BitmapTileLayer(mMap, tileSource));
|
||||||
|
|
||||||
mMap.setMapPosition(53.08, 8.83, 1 << 15);
|
mMap.setMapPosition(53.08, 8.83, 1 << 15);
|
||||||
@@ -67,15 +69,15 @@ public class ClusterMarkerLayerTest extends MarkerLayerTest {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
mMarkerLayer = new ItemizedLayer<>(
|
mMarkerLayer = new ItemizedLayer(
|
||||||
mMap,
|
mMap,
|
||||||
new ArrayList<MarkerItem>(),
|
new ArrayList<MarkerInterface>(),
|
||||||
markerRendererFactory,
|
markerRendererFactory,
|
||||||
this);
|
this);
|
||||||
mMap.layers().add(mMarkerLayer);
|
mMap.layers().add(mMarkerLayer);
|
||||||
|
|
||||||
// Create some markers spaced STEP degrees
|
// Create some markers spaced STEP degrees
|
||||||
List<MarkerItem> pts = new ArrayList<>();
|
List<MarkerInterface> pts = new ArrayList<>();
|
||||||
GeoPoint center = mMap.getMapPosition().getGeoPoint();
|
GeoPoint center = mMap.getMapPosition().getGeoPoint();
|
||||||
for (int x = -COUNT; x < COUNT; x++) {
|
for (int x = -COUNT; x < COUNT; x++) {
|
||||||
for (int y = -COUNT; y < COUNT; y++) {
|
for (int y = -COUNT; y < COUNT; y++) {
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ public class ExternalRenderThemeTest extends GdxMapApp {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
IRenderTheme theme = ThemeLoader.load(name);
|
IRenderTheme theme = ThemeLoader.load(name);
|
||||||
mapLayer.setRenderTheme(theme);
|
mapLayer.setTheme(theme);
|
||||||
MapRenderer.setBackgroundColor(theme.getMapBackground());
|
MapRenderer.setBackgroundColor(theme.getMapBackground());
|
||||||
} catch (ThemeException e) {
|
} catch (ThemeException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
@@ -80,7 +80,7 @@ public class ExternalRenderThemeTest extends GdxMapApp {
|
|||||||
// IRenderTheme theme =
|
// IRenderTheme theme =
|
||||||
// ThemeLoader.load("themes/elevate/theme.xml");
|
// ThemeLoader.load("themes/elevate/theme.xml");
|
||||||
// IRenderTheme theme = ThemeLoader.load("themes/vmap/theme.xml");
|
// IRenderTheme theme = ThemeLoader.load("themes/vmap/theme.xml");
|
||||||
l.setRenderTheme(theme);
|
l.setTheme(theme);
|
||||||
MapRenderer.setBackgroundColor(theme.getMapBackground());
|
MapRenderer.setBackgroundColor(theme.getMapBackground());
|
||||||
} catch (ThemeException e) {
|
} catch (ThemeException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2014 Hannes Janetzek
|
* Copyright 2014 Hannes Janetzek
|
||||||
* Copyright 2016-2019 devemux86
|
* Copyright 2016-2020 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).
|
||||||
*
|
*
|
||||||
@@ -28,12 +28,13 @@ import org.oscim.layers.vector.PathLayer;
|
|||||||
import org.oscim.layers.vector.geometries.Style;
|
import org.oscim.layers.vector.geometries.Style;
|
||||||
import org.oscim.map.Map;
|
import org.oscim.map.Map;
|
||||||
import org.oscim.renderer.bucket.TextureItem;
|
import org.oscim.renderer.bucket.TextureItem;
|
||||||
import org.oscim.tiling.TileSource;
|
|
||||||
import org.oscim.tiling.source.OkHttpEngine;
|
import org.oscim.tiling.source.OkHttpEngine;
|
||||||
|
import org.oscim.tiling.source.UrlTileSource;
|
||||||
import org.oscim.tiling.source.bitmap.DefaultSources;
|
import org.oscim.tiling.source.bitmap.DefaultSources;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class LineTexTest extends GdxMapApp {
|
public class LineTexTest extends GdxMapApp {
|
||||||
@@ -45,9 +46,10 @@ public class LineTexTest extends GdxMapApp {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void createLayers() {
|
public void createLayers() {
|
||||||
TileSource tileSource = DefaultSources.OPENSTREETMAP
|
UrlTileSource tileSource = DefaultSources.OPENSTREETMAP
|
||||||
.httpFactory(new OkHttpEngine.OkHttpFactory())
|
.httpFactory(new OkHttpEngine.OkHttpFactory())
|
||||||
.build();
|
.build();
|
||||||
|
tileSource.setHttpRequestHeaders(Collections.singletonMap("User-Agent", "vtm-playground"));
|
||||||
mMap.layers().add(new BitmapTileLayer(mMap, tileSource));
|
mMap.layers().add(new BitmapTileLayer(mMap, tileSource));
|
||||||
|
|
||||||
mMap.setMapPosition(0, 0, 1 << 2);
|
mMap.setMapPosition(0, 0, 1 << 2);
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2016-2018 devemux86
|
* Copyright 2016-2020 devemux86
|
||||||
* Copyright 2019 telemaxx
|
* Copyright 2019 telemaxx
|
||||||
*
|
*
|
||||||
* 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
|
||||||
@@ -25,6 +25,7 @@ import org.oscim.event.MotionEvent;
|
|||||||
import org.oscim.gdx.GdxMapApp;
|
import org.oscim.gdx.GdxMapApp;
|
||||||
import org.oscim.layers.Layer;
|
import org.oscim.layers.Layer;
|
||||||
import org.oscim.layers.marker.ItemizedLayer;
|
import org.oscim.layers.marker.ItemizedLayer;
|
||||||
|
import org.oscim.layers.marker.MarkerInterface;
|
||||||
import org.oscim.layers.marker.MarkerItem;
|
import org.oscim.layers.marker.MarkerItem;
|
||||||
import org.oscim.layers.marker.MarkerSymbol;
|
import org.oscim.layers.marker.MarkerSymbol;
|
||||||
import org.oscim.layers.tile.vector.VectorTileLayer;
|
import org.oscim.layers.tile.vector.VectorTileLayer;
|
||||||
@@ -41,7 +42,7 @@ import java.util.List;
|
|||||||
|
|
||||||
import static org.oscim.layers.marker.MarkerSymbol.HotspotPlace;
|
import static org.oscim.layers.marker.MarkerSymbol.HotspotPlace;
|
||||||
|
|
||||||
public class MarkerLayerLabelsTest extends GdxMapApp implements ItemizedLayer.OnItemGestureListener<MarkerItem> {
|
public class MarkerLayerLabelsTest extends GdxMapApp implements ItemizedLayer.OnItemGestureListener<MarkerInterface> {
|
||||||
|
|
||||||
private static final int FG_COLOR = 0xFF000000; // 100 percent black. AARRGGBB
|
private static final int FG_COLOR = 0xFF000000; // 100 percent black. AARRGGBB
|
||||||
private static final int BG_COLOR = 0x80FF69B4; // 50 percent pink. AARRGGBB
|
private static final int BG_COLOR = 0x80FF69B4; // 50 percent pink. AARRGGBB
|
||||||
@@ -87,11 +88,11 @@ public class MarkerLayerLabelsTest extends GdxMapApp implements ItemizedLayer.On
|
|||||||
//Bitmap bitmapPoi = CanvasAdapter.decodeBitmap(getClass().getResourceAsStream("/res/marker_poi2.png"));
|
//Bitmap bitmapPoi = CanvasAdapter.decodeBitmap(getClass().getResourceAsStream("/res/marker_poi2.png"));
|
||||||
MarkerSymbol symbol = new MarkerSymbol(bitmapPoi, HotspotPlace.CENTER, false);
|
MarkerSymbol symbol = new MarkerSymbol(bitmapPoi, HotspotPlace.CENTER, false);
|
||||||
|
|
||||||
ItemizedLayer<MarkerItem> markerLayer = new ItemizedLayer<>(mMap, new ArrayList<MarkerItem>(), symbol, this);
|
ItemizedLayer markerLayer = new ItemizedLayer(mMap, new ArrayList<MarkerInterface>(), symbol, this);
|
||||||
mMap.layers().add(markerLayer);
|
mMap.layers().add(markerLayer);
|
||||||
|
|
||||||
// creating some poi's
|
// creating some poi's
|
||||||
List<MarkerItem> pts = new ArrayList<>();
|
List<MarkerInterface> pts = new ArrayList<>();
|
||||||
pts.add(new MarkerItem("Brandenburger Tor", "#1789-1793", new GeoPoint(52.516275, 13.377704)));
|
pts.add(new MarkerItem("Brandenburger Tor", "#1789-1793", new GeoPoint(52.516275, 13.377704)));
|
||||||
pts.add(new MarkerItem("Siegessaeule, hidden description", "this is a hidden Description without a #", new GeoPoint(52.514543, 13.350119)));
|
pts.add(new MarkerItem("Siegessaeule, hidden description", "this is a hidden Description without a #", new GeoPoint(52.514543, 13.350119)));
|
||||||
pts.add(new MarkerItem("Gleisdreieck, without description", "", new GeoPoint(52.499562, 13.374063)));
|
pts.add(new MarkerItem("Gleisdreieck, without description", "", new GeoPoint(52.499562, 13.374063)));
|
||||||
@@ -101,9 +102,10 @@ public class MarkerLayerLabelsTest extends GdxMapApp implements ItemizedLayer.On
|
|||||||
+ "is drawn on the map\n"
|
+ "is drawn on the map\n"
|
||||||
+ "the rest is surpressed", new GeoPoint(52.509352, 13.375739)));
|
+ "the rest is surpressed", new GeoPoint(52.509352, 13.375739)));
|
||||||
|
|
||||||
for (MarkerItem mi : pts) {
|
for (MarkerInterface mi : pts) {
|
||||||
System.out.println("title: " + mi.title);
|
MarkerItem markerItem = (MarkerItem) mi;
|
||||||
mi.setMarker(createAdvancedSymbol(mi, bitmapPoi));
|
System.out.println("title: " + markerItem.title);
|
||||||
|
markerItem.setMarker(createAdvancedSymbol(markerItem, bitmapPoi));
|
||||||
}
|
}
|
||||||
|
|
||||||
markerLayer.addItems(pts);
|
markerLayer.addItems(pts);
|
||||||
@@ -198,14 +200,16 @@ public class MarkerLayerLabelsTest extends GdxMapApp implements ItemizedLayer.On
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onItemSingleTapUp(int index, MarkerItem item) {
|
public boolean onItemSingleTapUp(int index, MarkerInterface item) {
|
||||||
System.out.println("Marker tap " + item.getTitle());
|
MarkerItem markerItem = (MarkerItem) item;
|
||||||
|
System.out.println("Marker tap " + markerItem.getTitle());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onItemLongPress(int index, MarkerItem item) {
|
public boolean onItemLongPress(int index, MarkerInterface item) {
|
||||||
System.out.println("Marker long press " + item.getTitle());
|
MarkerItem markerItem = (MarkerItem) item;
|
||||||
|
System.out.println("Marker long press " + markerItem.getTitle());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -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
|
* 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
|
||||||
@@ -23,25 +23,27 @@ import org.oscim.event.MotionEvent;
|
|||||||
import org.oscim.gdx.GdxMapApp;
|
import org.oscim.gdx.GdxMapApp;
|
||||||
import org.oscim.layers.Layer;
|
import org.oscim.layers.Layer;
|
||||||
import org.oscim.layers.marker.ItemizedLayer;
|
import org.oscim.layers.marker.ItemizedLayer;
|
||||||
|
import org.oscim.layers.marker.MarkerInterface;
|
||||||
import org.oscim.layers.marker.MarkerItem;
|
import org.oscim.layers.marker.MarkerItem;
|
||||||
import org.oscim.layers.marker.MarkerSymbol;
|
import org.oscim.layers.marker.MarkerSymbol;
|
||||||
import org.oscim.layers.tile.bitmap.BitmapTileLayer;
|
import org.oscim.layers.tile.bitmap.BitmapTileLayer;
|
||||||
import org.oscim.map.Map;
|
import org.oscim.map.Map;
|
||||||
import org.oscim.tiling.TileSource;
|
|
||||||
import org.oscim.tiling.source.OkHttpEngine;
|
import org.oscim.tiling.source.OkHttpEngine;
|
||||||
|
import org.oscim.tiling.source.UrlTileSource;
|
||||||
import org.oscim.tiling.source.bitmap.DefaultSources;
|
import org.oscim.tiling.source.bitmap.DefaultSources;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import static org.oscim.layers.marker.MarkerSymbol.HotspotPlace;
|
import static org.oscim.layers.marker.MarkerSymbol.HotspotPlace;
|
||||||
|
|
||||||
public class MarkerLayerTest extends GdxMapApp implements ItemizedLayer.OnItemGestureListener<MarkerItem> {
|
public class MarkerLayerTest extends GdxMapApp implements ItemizedLayer.OnItemGestureListener<MarkerInterface> {
|
||||||
|
|
||||||
static final boolean BILLBOARDS = true;
|
static final boolean BILLBOARDS = true;
|
||||||
MarkerSymbol mFocusMarker;
|
MarkerSymbol mFocusMarker;
|
||||||
ItemizedLayer<MarkerItem> mMarkerLayer;
|
ItemizedLayer mMarkerLayer;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void createLayers() {
|
public void createLayers() {
|
||||||
@@ -49,9 +51,10 @@ public class MarkerLayerTest extends GdxMapApp implements ItemizedLayer.OnItemGe
|
|||||||
// Map events receiver
|
// Map events receiver
|
||||||
mMap.layers().add(new MapEventsReceiver(mMap));
|
mMap.layers().add(new MapEventsReceiver(mMap));
|
||||||
|
|
||||||
TileSource tileSource = DefaultSources.OPENSTREETMAP
|
UrlTileSource tileSource = DefaultSources.OPENSTREETMAP
|
||||||
.httpFactory(new OkHttpEngine.OkHttpFactory())
|
.httpFactory(new OkHttpEngine.OkHttpFactory())
|
||||||
.build();
|
.build();
|
||||||
|
tileSource.setHttpRequestHeaders(Collections.singletonMap("User-Agent", "vtm-playground"));
|
||||||
mMap.layers().add(new BitmapTileLayer(mMap, tileSource));
|
mMap.layers().add(new BitmapTileLayer(mMap, tileSource));
|
||||||
|
|
||||||
mMap.setMapPosition(0, 0, 1 << 2);
|
mMap.setMapPosition(0, 0, 1 << 2);
|
||||||
@@ -69,10 +72,10 @@ public class MarkerLayerTest extends GdxMapApp implements ItemizedLayer.OnItemGe
|
|||||||
else
|
else
|
||||||
mFocusMarker = new MarkerSymbol(bitmapFocus, HotspotPlace.CENTER, false);
|
mFocusMarker = new MarkerSymbol(bitmapFocus, HotspotPlace.CENTER, false);
|
||||||
|
|
||||||
mMarkerLayer = new ItemizedLayer<>(mMap, new ArrayList<MarkerItem>(), symbol, this);
|
mMarkerLayer = new ItemizedLayer(mMap, new ArrayList<MarkerInterface>(), symbol, this);
|
||||||
mMap.layers().add(mMarkerLayer);
|
mMap.layers().add(mMarkerLayer);
|
||||||
|
|
||||||
List<MarkerItem> pts = new ArrayList<>();
|
List<MarkerInterface> pts = new ArrayList<>();
|
||||||
for (double lat = -90; lat <= 90; lat += 5) {
|
for (double lat = -90; lat <= 90; lat += 5) {
|
||||||
for (double lon = -180; lon <= 180; lon += 5)
|
for (double lon = -180; lon <= 180; lon += 5)
|
||||||
pts.add(new MarkerItem(lat + "/" + lon, "", new GeoPoint(lat, lon)));
|
pts.add(new MarkerItem(lat + "/" + lon, "", new GeoPoint(lat, lon)));
|
||||||
@@ -84,24 +87,26 @@ public class MarkerLayerTest extends GdxMapApp implements ItemizedLayer.OnItemGe
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onItemSingleTapUp(int index, MarkerItem item) {
|
public boolean onItemSingleTapUp(int index, MarkerInterface item) {
|
||||||
if (item.getMarker() == null)
|
MarkerItem markerItem = (MarkerItem) item;
|
||||||
item.setMarker(mFocusMarker);
|
if (markerItem.getMarker() == null)
|
||||||
|
markerItem.setMarker(mFocusMarker);
|
||||||
else
|
else
|
||||||
item.setMarker(null);
|
markerItem.setMarker(null);
|
||||||
|
|
||||||
System.out.println("Marker tap " + item.getTitle());
|
System.out.println("Marker tap " + markerItem.getTitle());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onItemLongPress(int index, MarkerItem item) {
|
public boolean onItemLongPress(int index, MarkerInterface item) {
|
||||||
if (item.getMarker() == null)
|
MarkerItem markerItem = (MarkerItem) item;
|
||||||
item.setMarker(mFocusMarker);
|
if (markerItem.getMarker() == null)
|
||||||
|
markerItem.setMarker(mFocusMarker);
|
||||||
else
|
else
|
||||||
item.setMarker(null);
|
markerItem.setMarker(null);
|
||||||
|
|
||||||
System.out.println("Marker long press " + item.getTitle());
|
System.out.println("Marker long press " + markerItem.getTitle());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2016-2018 devemux86
|
* Copyright 2016-2020 devemux86
|
||||||
* Copyright 2019 Gustl22
|
* Copyright 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).
|
||||||
@@ -30,9 +30,12 @@ import org.oscim.map.Viewport;
|
|||||||
import org.oscim.theme.VtmThemes;
|
import org.oscim.theme.VtmThemes;
|
||||||
import org.oscim.tiling.TileSource;
|
import org.oscim.tiling.TileSource;
|
||||||
import org.oscim.tiling.source.OkHttpEngine;
|
import org.oscim.tiling.source.OkHttpEngine;
|
||||||
|
import org.oscim.tiling.source.UrlTileSource;
|
||||||
import org.oscim.tiling.source.bitmap.DefaultSources;
|
import org.oscim.tiling.source.bitmap.DefaultSources;
|
||||||
import org.oscim.tiling.source.overpass.OverpassTileSource;
|
import org.oscim.tiling.source.overpass.OverpassTileSource;
|
||||||
|
|
||||||
|
import java.util.Collections;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Use Overpass API data for vector layer.
|
* Use Overpass API data for vector layer.
|
||||||
* Only for developing as can be error-prone.
|
* Only for developing as can be error-prone.
|
||||||
@@ -51,7 +54,7 @@ public class OverpassTest extends GdxMapApp {
|
|||||||
.build();
|
.build();
|
||||||
VectorTileLayer l = map.setBaseMap(tileSource);
|
VectorTileLayer l = map.setBaseMap(tileSource);
|
||||||
|
|
||||||
TileSource bitmapTileSource = DefaultSources.OPENSTREETMAP
|
UrlTileSource bitmapTileSource = DefaultSources.OPENSTREETMAP
|
||||||
.httpFactory(new OkHttpEngine.OkHttpFactory())
|
.httpFactory(new OkHttpEngine.OkHttpFactory())
|
||||||
.zoomMax(15)
|
.zoomMax(15)
|
||||||
.fadeSteps(new BitmapTileLayer.FadeStep[]{
|
.fadeSteps(new BitmapTileLayer.FadeStep[]{
|
||||||
@@ -59,6 +62,7 @@ public class OverpassTest extends GdxMapApp {
|
|||||||
new BitmapTileLayer.FadeStep(16, Viewport.MAX_ZOOM_LEVEL, 0f, 0f)
|
new BitmapTileLayer.FadeStep(16, Viewport.MAX_ZOOM_LEVEL, 0f, 0f)
|
||||||
})
|
})
|
||||||
.build();
|
.build();
|
||||||
|
bitmapTileSource.setHttpRequestHeaders(Collections.singletonMap("User-Agent", "vtm-playground"));
|
||||||
mMap.layers().add(new BitmapTileLayer(mMap, bitmapTileSource));
|
mMap.layers().add(new BitmapTileLayer(mMap, bitmapTileSource));
|
||||||
|
|
||||||
BuildingLayer.RAW_DATA = true;
|
BuildingLayer.RAW_DATA = true;
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2016-2018 devemux86
|
* Copyright 2016-2020 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).
|
||||||
*
|
*
|
||||||
@@ -26,11 +26,12 @@ import org.oscim.gdx.GdxMapApp;
|
|||||||
import org.oscim.layers.tile.bitmap.BitmapTileLayer;
|
import org.oscim.layers.tile.bitmap.BitmapTileLayer;
|
||||||
import org.oscim.layers.vector.PathLayer;
|
import org.oscim.layers.vector.PathLayer;
|
||||||
import org.oscim.map.Map.UpdateListener;
|
import org.oscim.map.Map.UpdateListener;
|
||||||
import org.oscim.tiling.TileSource;
|
|
||||||
import org.oscim.tiling.source.OkHttpEngine;
|
import org.oscim.tiling.source.OkHttpEngine;
|
||||||
|
import org.oscim.tiling.source.UrlTileSource;
|
||||||
import org.oscim.tiling.source.bitmap.DefaultSources;
|
import org.oscim.tiling.source.bitmap.DefaultSources;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class PathLayerTest extends GdxMapApp {
|
public class PathLayerTest extends GdxMapApp {
|
||||||
@@ -41,9 +42,10 @@ public class PathLayerTest extends GdxMapApp {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void createLayers() {
|
public void createLayers() {
|
||||||
TileSource tileSource = DefaultSources.OPENSTREETMAP
|
UrlTileSource tileSource = DefaultSources.OPENSTREETMAP
|
||||||
.httpFactory(new OkHttpEngine.OkHttpFactory())
|
.httpFactory(new OkHttpEngine.OkHttpFactory())
|
||||||
.build();
|
.build();
|
||||||
|
tileSource.setHttpRequestHeaders(Collections.singletonMap("User-Agent", "vtm-playground"));
|
||||||
mMap.layers().add(new BitmapTileLayer(mMap, tileSource));
|
mMap.layers().add(new BitmapTileLayer(mMap, tileSource));
|
||||||
|
|
||||||
mMap.setMapPosition(0, 0, 1 << 2);
|
mMap.setMapPosition(0, 0, 1 << 2);
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2016-2018 devemux86
|
* Copyright 2016-2020 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).
|
||||||
*
|
*
|
||||||
@@ -22,18 +22,21 @@ import org.oscim.layers.tile.bitmap.BitmapTileLayer;
|
|||||||
import org.oscim.layers.vector.VectorLayer;
|
import org.oscim.layers.vector.VectorLayer;
|
||||||
import org.oscim.layers.vector.geometries.PointDrawable;
|
import org.oscim.layers.vector.geometries.PointDrawable;
|
||||||
import org.oscim.layers.vector.geometries.Style;
|
import org.oscim.layers.vector.geometries.Style;
|
||||||
import org.oscim.tiling.TileSource;
|
|
||||||
import org.oscim.tiling.source.OkHttpEngine;
|
import org.oscim.tiling.source.OkHttpEngine;
|
||||||
|
import org.oscim.tiling.source.UrlTileSource;
|
||||||
import org.oscim.tiling.source.bitmap.DefaultSources;
|
import org.oscim.tiling.source.bitmap.DefaultSources;
|
||||||
import org.oscim.utils.ColorUtil;
|
import org.oscim.utils.ColorUtil;
|
||||||
|
|
||||||
|
import java.util.Collections;
|
||||||
|
|
||||||
public class VectorLayerTest extends GdxMapApp {
|
public class VectorLayerTest extends GdxMapApp {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void createLayers() {
|
public void createLayers() {
|
||||||
TileSource tileSource = DefaultSources.OPENSTREETMAP
|
UrlTileSource tileSource = DefaultSources.OPENSTREETMAP
|
||||||
.httpFactory(new OkHttpEngine.OkHttpFactory())
|
.httpFactory(new OkHttpEngine.OkHttpFactory())
|
||||||
.build();
|
.build();
|
||||||
|
tileSource.setHttpRequestHeaders(Collections.singletonMap("User-Agent", "vtm-playground"));
|
||||||
mMap.layers().add(new BitmapTileLayer(mMap, tileSource));
|
mMap.layers().add(new BitmapTileLayer(mMap, tileSource));
|
||||||
|
|
||||||
mMap.setMapPosition(0, 0, 1 << 2);
|
mMap.setMapPosition(0, 0, 1 << 2);
|
||||||
|
|||||||
@@ -17,8 +17,8 @@
|
|||||||
*/
|
*/
|
||||||
package org.oscim.test.jeo;
|
package org.oscim.test.jeo;
|
||||||
|
|
||||||
import org.jeo.map.Style;
|
import io.jeo.map.Style;
|
||||||
import org.jeo.vector.VectorDataset;
|
import io.jeo.vector.VectorDataset;
|
||||||
import org.oscim.backend.canvas.Color;
|
import org.oscim.backend.canvas.Color;
|
||||||
import org.oscim.gdx.GdxMapApp;
|
import org.oscim.gdx.GdxMapApp;
|
||||||
import org.oscim.layers.JeoVectorLayer;
|
import org.oscim.layers.JeoVectorLayer;
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ public class ThemeTest extends GdxMapApp {
|
|||||||
|
|
||||||
VectorTileLayer l = mMap.setBaseMap(ts);
|
VectorTileLayer l = mMap.setBaseMap(ts);
|
||||||
|
|
||||||
l.setRenderTheme(new RenderTheme());
|
l.setTheme(new RenderTheme());
|
||||||
|
|
||||||
MapRenderer.setBackgroundColor(0xffcccccc);
|
MapRenderer.setBackgroundColor(0xffcccccc);
|
||||||
|
|
||||||
|
|||||||
@@ -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.13.0'
|
implementation 'org.mapsforge:mapsforge-core:0.15.0'
|
||||||
implementation 'org.mapsforge:mapsforge-map:0.13.0'
|
implementation 'org.mapsforge:mapsforge-map:0.15.0'
|
||||||
implementation 'org.mapsforge:mapsforge-map-awt:0.13.0'
|
implementation 'org.mapsforge:mapsforge-map-awt:0.15.0'
|
||||||
implementation 'org.mapsforge:mapsforge-map-reader:0.13.0'
|
implementation 'org.mapsforge:mapsforge-map-reader:0.15.0'
|
||||||
implementation 'org.mapsforge:mapsforge-themes:0.13.0'
|
implementation 'org.mapsforge:mapsforge-themes:0.15.0'
|
||||||
implementation 'net.sf.kxml:kxml2:2.3.0'
|
implementation 'net.sf.kxml:kxml2:2.3.0'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -165,6 +165,11 @@
|
|||||||
<style-line cap="butt" fix="true" id="water" stroke="#a4bbcc" width="1.0" />
|
<style-line cap="butt" fix="true" id="water" stroke="#a4bbcc" width="1.0" />
|
||||||
<style-line fix="false" id="river" stroke="#a4bbcc" use="water" />
|
<style-line fix="false" id="river" stroke="#a4bbcc" use="water" />
|
||||||
|
|
||||||
|
<!--###### SYMBOL styles ######-->
|
||||||
|
|
||||||
|
<!-- oneway -->
|
||||||
|
<style-symbol id="oneway" repeat="true" src="assets:symbols/oneway.svg" />
|
||||||
|
|
||||||
|
|
||||||
<!--###### ASSIGNMENT ######-->
|
<!--###### ASSIGNMENT ######-->
|
||||||
|
|
||||||
@@ -1079,7 +1084,7 @@
|
|||||||
<m k="area" v="~|false|no">
|
<m k="area" v="~|false|no">
|
||||||
<m k="highway">
|
<m k="highway">
|
||||||
<m k="oneway" v="yes|true" zoom-min="16">
|
<m k="oneway" v="yes|true" zoom-min="16">
|
||||||
<symbol repeat="true" src="assets:symbols/oneway.svg" />
|
<symbol use="oneway" />
|
||||||
</m>
|
</m>
|
||||||
</m>
|
</m>
|
||||||
</m>
|
</m>
|
||||||
|
|||||||
@@ -129,6 +129,9 @@
|
|||||||
<style-line fade="15" id="building" stroke="#eeb7b6b3" use="fix" />
|
<style-line fade="15" id="building" stroke="#eeb7b6b3" use="fix" />
|
||||||
<style-area fade="15" fill="#f2f0eb" id="building" />
|
<style-area fade="15" fill="#f2f0eb" id="building" />
|
||||||
|
|
||||||
|
<!-- oneway -->
|
||||||
|
<style-symbol id="oneway" repeat="true" src="assets:symbols/oneway.svg" />
|
||||||
|
|
||||||
<m closed="yes" e="way" k="layer" v="water">
|
<m closed="yes" e="way" k="layer" v="water">
|
||||||
<area mesh="true" use="water" />
|
<area mesh="true" use="water" />
|
||||||
</m>
|
</m>
|
||||||
@@ -1038,7 +1041,7 @@
|
|||||||
<m k="area" v="~|false|no">
|
<m k="area" v="~|false|no">
|
||||||
<m k="kind_detail">
|
<m k="kind_detail">
|
||||||
<m k="oneway" v="yes|true" zoom-min="16">
|
<m k="oneway" v="yes|true" zoom-min="16">
|
||||||
<symbol repeat="true" src="assets:symbols/oneway.svg" />
|
<symbol use="oneway" />
|
||||||
</m>
|
</m>
|
||||||
</m>
|
</m>
|
||||||
</m>
|
</m>
|
||||||
|
|||||||
@@ -118,6 +118,11 @@
|
|||||||
<style-line cap="butt" id="water:outline" stroke="#647b8c" width="1.0" />
|
<style-line cap="butt" id="water:outline" stroke="#647b8c" width="1.0" />
|
||||||
<style-line cap="butt" id="water" stroke="#cca4bbcc" width="0.6" />
|
<style-line cap="butt" id="water" stroke="#cca4bbcc" width="0.6" />
|
||||||
|
|
||||||
|
<!--###### SYMBOL styles ######-->
|
||||||
|
|
||||||
|
<!-- oneway -->
|
||||||
|
<style-symbol id="oneway" repeat="true" src="assets:symbols/oneway.svg" />
|
||||||
|
|
||||||
|
|
||||||
<!--###### ASSIGNMENT ######-->
|
<!--###### ASSIGNMENT ######-->
|
||||||
|
|
||||||
@@ -1080,7 +1085,7 @@
|
|||||||
<m k="area" v="~|false|no">
|
<m k="area" v="~|false|no">
|
||||||
<m k="highway">
|
<m k="highway">
|
||||||
<m k="oneway" v="yes|true" zoom-min="16">
|
<m k="oneway" v="yes|true" zoom-min="16">
|
||||||
<symbol repeat="true" src="assets:symbols/oneway.svg" />
|
<symbol use="oneway" />
|
||||||
</m>
|
</m>
|
||||||
</m>
|
</m>
|
||||||
</m>
|
</m>
|
||||||
|
|||||||
@@ -162,6 +162,11 @@
|
|||||||
<!-- <style-line id="building" stroke="#d0cec8" width="1.0" fix="true" cap="butt" fade="15"/> -->
|
<!-- <style-line id="building" stroke="#d0cec8" width="1.0" fix="true" cap="butt" fade="15"/> -->
|
||||||
<style-line fade="15" id="building" stroke="#eeb7b6b3" use="fix" />
|
<style-line fade="15" id="building" stroke="#eeb7b6b3" use="fix" />
|
||||||
|
|
||||||
|
<!--###### SYMBOL styles ######-->
|
||||||
|
|
||||||
|
<!-- oneway -->
|
||||||
|
<style-symbol id="oneway" repeat="true" src="assets:symbols/oneway.svg" />
|
||||||
|
|
||||||
|
|
||||||
<!--###### ASSIGNMENT ######-->
|
<!--###### ASSIGNMENT ######-->
|
||||||
|
|
||||||
@@ -332,7 +337,7 @@
|
|||||||
|
|
||||||
<m k="oneway" v="1" zoom-min="16">
|
<m k="oneway" v="1" zoom-min="16">
|
||||||
<m k="class" v="motorway|trunk|primary|secondary|tertiary|minor">
|
<m k="class" v="motorway|trunk|primary|secondary|tertiary|minor">
|
||||||
<symbol repeat="true" src="assets:symbols/oneway.svg" />
|
<symbol use="oneway" />
|
||||||
</m>
|
</m>
|
||||||
</m>
|
</m>
|
||||||
</m>
|
</m>
|
||||||
|
|||||||
@@ -52,6 +52,11 @@
|
|||||||
<style-line id="secondary" stroke="#c6c6c6" width="1.4" />
|
<style-line id="secondary" stroke="#c6c6c6" width="1.4" />
|
||||||
<style-line id="tertiary" stroke="#f7f7f7" width="1.15" />
|
<style-line id="tertiary" stroke="#f7f7f7" width="1.15" />
|
||||||
|
|
||||||
|
<!--###### SYMBOL styles ######-->
|
||||||
|
|
||||||
|
<!-- oneway -->
|
||||||
|
<style-symbol id="oneway" repeat="true" src="assets:symbols/oneway.svg" />
|
||||||
|
|
||||||
|
|
||||||
<!--###### ASSIGNMENT ######-->
|
<!--###### ASSIGNMENT ######-->
|
||||||
|
|
||||||
@@ -959,7 +964,7 @@
|
|||||||
<m k="area" v="~|false|no">
|
<m k="area" v="~|false|no">
|
||||||
<m k="highway">
|
<m k="highway">
|
||||||
<m k="oneway" v="yes|true" zoom-min="16">
|
<m k="oneway" v="yes|true" zoom-min="16">
|
||||||
<symbol repeat="true" src="assets:symbols/oneway.svg" />
|
<symbol use="oneway" />
|
||||||
</m>
|
</m>
|
||||||
</m>
|
</m>
|
||||||
</m>
|
</m>
|
||||||
|
|||||||
@@ -52,6 +52,11 @@
|
|||||||
<style-line id="secondary" stroke="#fdbf6f" width="1.4" />
|
<style-line id="secondary" stroke="#fdbf6f" width="1.4" />
|
||||||
<style-line id="tertiary" stroke="#ffff90" width="1.15" />
|
<style-line id="tertiary" stroke="#ffff90" width="1.15" />
|
||||||
|
|
||||||
|
<!--###### SYMBOL styles ######-->
|
||||||
|
|
||||||
|
<!-- oneway -->
|
||||||
|
<style-symbol id="oneway" repeat="true" src="assets:symbols/oneway.svg" />
|
||||||
|
|
||||||
|
|
||||||
<!--###### ASSIGNMENT ######-->
|
<!--###### ASSIGNMENT ######-->
|
||||||
|
|
||||||
@@ -959,7 +964,7 @@
|
|||||||
<m k="area" v="~|false|no">
|
<m k="area" v="~|false|no">
|
||||||
<m k="highway">
|
<m k="highway">
|
||||||
<m k="oneway" v="yes|true" zoom-min="16">
|
<m k="oneway" v="yes|true" zoom-min="16">
|
||||||
<symbol repeat="true" src="assets:symbols/oneway.svg" />
|
<symbol use="oneway" />
|
||||||
</m>
|
</m>
|
||||||
</m>
|
</m>
|
||||||
</m>
|
</m>
|
||||||
|
|||||||
@@ -119,6 +119,11 @@
|
|||||||
<style-line cap="butt" id="water:outline" stroke="#a4bbcc" width="1.0" />
|
<style-line cap="butt" id="water:outline" stroke="#a4bbcc" width="1.0" />
|
||||||
<style-line cap="butt" id="water" stroke="#cca4bbcc" width="0.6" />
|
<style-line cap="butt" id="water" stroke="#cca4bbcc" width="0.6" />
|
||||||
|
|
||||||
|
<!--###### SYMBOL styles ######-->
|
||||||
|
|
||||||
|
<!-- oneway -->
|
||||||
|
<style-symbol id="oneway" repeat="true" src="assets:symbols/oneway.svg" />
|
||||||
|
|
||||||
<!--###### ASSIGNMENT ######-->
|
<!--###### ASSIGNMENT ######-->
|
||||||
|
|
||||||
<m e="way" k="natural" v="issea|sea">
|
<m e="way" k="natural" v="issea|sea">
|
||||||
@@ -1073,7 +1078,7 @@
|
|||||||
<m k="area" v="~|false|no">
|
<m k="area" v="~|false|no">
|
||||||
<m k="highway">
|
<m k="highway">
|
||||||
<m k="oneway" v="yes|true" zoom-min="16">
|
<m k="oneway" v="yes|true" zoom-min="16">
|
||||||
<symbol repeat="true" src="assets:symbols/oneway.svg" />
|
<symbol use="oneway" />
|
||||||
</m>
|
</m>
|
||||||
</m>
|
</m>
|
||||||
</m>
|
</m>
|
||||||
|
|||||||
@@ -4,13 +4,13 @@ buildscript {
|
|||||||
}
|
}
|
||||||
dependencies {
|
dependencies {
|
||||||
classpath 'org.wisepersist:gwt-gradle-plugin:1.0.13'
|
classpath 'org.wisepersist:gwt-gradle-plugin:1.0.13'
|
||||||
classpath 'org.akhikhl.gretty:gretty:2.0.0'
|
classpath 'org.gretty:gretty:3.0.3'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
apply plugin: 'gwt'
|
apply plugin: 'gwt'
|
||||||
apply plugin: 'war'
|
apply plugin: 'war'
|
||||||
apply plugin: 'org.akhikhl.gretty'
|
apply plugin: 'org.gretty'
|
||||||
|
|
||||||
sourceSets {
|
sourceSets {
|
||||||
main.java.srcDirs = ['src']
|
main.java.srcDirs = ['src']
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2013 Hannes Janetzek
|
* Copyright 2013 Hannes Janetzek
|
||||||
* Copyright 2016-2018 Izumi Kawashima
|
* Copyright 2016-2018 Izumi Kawashima
|
||||||
* Copyright 2017-2018 devemux86
|
* Copyright 2017-2020 devemux86
|
||||||
* Copyright 2019 Gustl22
|
* Copyright 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).
|
||||||
@@ -23,13 +23,7 @@ import com.badlogic.gdx.Gdx;
|
|||||||
import com.badlogic.gdx.backends.gwt.GwtApplication;
|
import com.badlogic.gdx.backends.gwt.GwtApplication;
|
||||||
import com.badlogic.gdx.backends.gwt.GwtGraphics;
|
import com.badlogic.gdx.backends.gwt.GwtGraphics;
|
||||||
import com.badlogic.gdx.graphics.glutils.GLVersion;
|
import com.badlogic.gdx.graphics.glutils.GLVersion;
|
||||||
|
import org.oscim.backend.*;
|
||||||
import org.oscim.backend.AssetAdapter;
|
|
||||||
import org.oscim.backend.CanvasAdapter;
|
|
||||||
import org.oscim.backend.DateTimeAdapter;
|
|
||||||
import org.oscim.backend.GL;
|
|
||||||
import org.oscim.backend.GL30;
|
|
||||||
import org.oscim.backend.GLAdapter;
|
|
||||||
import org.oscim.core.MapPosition;
|
import org.oscim.core.MapPosition;
|
||||||
import org.oscim.core.Tile;
|
import org.oscim.core.Tile;
|
||||||
import org.oscim.gdx.GdxAssets;
|
import org.oscim.gdx.GdxAssets;
|
||||||
@@ -54,6 +48,8 @@ import org.oscim.tiling.source.oscimap4.OSciMap4TileSource;
|
|||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
import java.util.Collections;
|
||||||
|
|
||||||
class GwtMap extends GdxMap {
|
class GwtMap extends GdxMap {
|
||||||
static final Logger log = LoggerFactory.getLogger(GwtMap.class);
|
static final Logger log = LoggerFactory.getLogger(GwtMap.class);
|
||||||
|
|
||||||
@@ -107,9 +103,10 @@ class GwtMap extends GdxMap {
|
|||||||
|
|
||||||
if ("toner".equals(mapName))
|
if ("toner".equals(mapName))
|
||||||
ts = DefaultSources.STAMEN_TONER.build();
|
ts = DefaultSources.STAMEN_TONER.build();
|
||||||
else if ("osm".equals(mapName))
|
else if ("osm".equals(mapName)) {
|
||||||
ts = DefaultSources.OPENSTREETMAP.build();
|
ts = DefaultSources.OPENSTREETMAP.build();
|
||||||
else if ("watercolor".equals(mapName))
|
ts.setHttpRequestHeaders(Collections.singletonMap("User-Agent", "vtm-web-app"));
|
||||||
|
} else if ("watercolor".equals(mapName))
|
||||||
ts = DefaultSources.STAMEN_WATERCOLOR.build();
|
ts = DefaultSources.STAMEN_WATERCOLOR.build();
|
||||||
else if ("ne-landcover".equals(mapName))
|
else if ("ne-landcover".equals(mapName))
|
||||||
ts = DefaultSources.NE_LANDCOVER.build();
|
ts = DefaultSources.NE_LANDCOVER.build();
|
||||||
|
|||||||
@@ -4,13 +4,13 @@ buildscript {
|
|||||||
}
|
}
|
||||||
dependencies {
|
dependencies {
|
||||||
classpath 'org.wisepersist:gwt-gradle-plugin:1.0.13'
|
classpath 'org.wisepersist:gwt-gradle-plugin:1.0.13'
|
||||||
classpath 'org.akhikhl.gretty:gretty:2.0.0'
|
classpath 'org.gretty:gretty:3.0.3'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
apply plugin: 'gwt'
|
apply plugin: 'gwt'
|
||||||
apply plugin: 'war'
|
apply plugin: 'war'
|
||||||
apply plugin: 'org.akhikhl.gretty'
|
apply plugin: 'org.gretty'
|
||||||
|
|
||||||
sourceSets {
|
sourceSets {
|
||||||
main.java.srcDirs = ['src']
|
main.java.srcDirs = ['src']
|
||||||
|
|||||||
@@ -75,6 +75,9 @@ gwt {
|
|||||||
//}
|
//}
|
||||||
|
|
||||||
javadoc {
|
javadoc {
|
||||||
|
if (JavaVersion.current().isJava9Compatible()) {
|
||||||
|
options.addStringOption("-release", "8")
|
||||||
|
}
|
||||||
options.addStringOption("sourcepath", "")
|
options.addStringOption("sourcepath", "")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
1124
vtm-web/src/org/oscim/gdx/emu/org/xmlpull/v1/XmlPullParser.java
Normal file
1124
vtm-web/src/org/oscim/gdx/emu/org/xmlpull/v1/XmlPullParser.java
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,76 @@
|
|||||||
|
/* -*- c-basic-offset: 4; indent-tabs-mode: nil; -*- //------100-columns-wide------>|*/
|
||||||
|
// for license please see accompanying LICENSE.txt file (available also at http://www.xmlpull.org/)
|
||||||
|
|
||||||
|
package org.xmlpull.v1;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This exception is thrown to signal XML Pull Parser related faults.
|
||||||
|
*
|
||||||
|
* @author <a href="http://www.extreme.indiana.edu/~aslom/">Aleksander Slominski</a>
|
||||||
|
*/
|
||||||
|
public class XmlPullParserException extends Exception {
|
||||||
|
protected Throwable detail;
|
||||||
|
protected int row = -1;
|
||||||
|
protected int column = -1;
|
||||||
|
|
||||||
|
/* public XmlPullParserException() {
|
||||||
|
}*/
|
||||||
|
|
||||||
|
public XmlPullParserException(String s) {
|
||||||
|
super(s);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
public XmlPullParserException(String s, Throwable thrwble) {
|
||||||
|
super(s);
|
||||||
|
this.detail = thrwble;
|
||||||
|
}
|
||||||
|
|
||||||
|
public XmlPullParserException(String s, int row, int column) {
|
||||||
|
super(s);
|
||||||
|
this.row = row;
|
||||||
|
this.column = column;
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
public XmlPullParserException(String msg, XmlPullParser parser, Throwable chain) {
|
||||||
|
super ((msg == null ? "" : msg+" ")
|
||||||
|
+ (parser == null ? "" : "(position:"+parser.getPositionDescription()+") ")
|
||||||
|
+ (chain == null ? "" : "caused by: "+chain));
|
||||||
|
|
||||||
|
if (parser != null) {
|
||||||
|
this.row = parser.getLineNumber();
|
||||||
|
this.column = parser.getColumnNumber();
|
||||||
|
}
|
||||||
|
this.detail = chain;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Throwable getDetail() { return detail; }
|
||||||
|
// public void setDetail(Throwable cause) { this.detail = cause; }
|
||||||
|
public int getLineNumber() { return row; }
|
||||||
|
public int getColumnNumber() { return column; }
|
||||||
|
|
||||||
|
/*
|
||||||
|
public String getMessage() {
|
||||||
|
if(detail == null)
|
||||||
|
return super.getMessage();
|
||||||
|
else
|
||||||
|
return super.getMessage() + "; nested exception is: \n\t"
|
||||||
|
+ detail.getMessage();
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
//NOTE: code that prints this and detail is difficult in J2ME
|
||||||
|
public void printStackTrace() {
|
||||||
|
if (detail == null) {
|
||||||
|
super.printStackTrace();
|
||||||
|
} else {
|
||||||
|
synchronized(System.err) {
|
||||||
|
System.err.println(super.getMessage() + "; nested exception is:");
|
||||||
|
detail.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
@@ -0,0 +1,237 @@
|
|||||||
|
/* -*- c-basic-offset: 4; indent-tabs-mode: nil; -*- //------100-columns-wide------>|*/
|
||||||
|
// for license please see accompanying LICENSE.txt file (available also at http://www.xmlpull.org/)
|
||||||
|
|
||||||
|
package org.xmlpull.v1;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This class is used to create implementations of XML Pull Parser defined in XMPULL V1 API.
|
||||||
|
*
|
||||||
|
* @see XmlPullParser
|
||||||
|
*
|
||||||
|
* @author <a href="http://www.extreme.indiana.edu/~aslom/">Aleksander Slominski</a>
|
||||||
|
* @author Stefan Haustein
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class XmlPullParserFactory {
|
||||||
|
|
||||||
|
public static final String PROPERTY_NAME = "org.xmlpull.v1.XmlPullParserFactory";
|
||||||
|
protected ArrayList parserClasses;
|
||||||
|
protected ArrayList serializerClasses;
|
||||||
|
|
||||||
|
/** Unused, but we have to keep it because it's public API. */
|
||||||
|
protected String classNamesLocation = null;
|
||||||
|
|
||||||
|
// features are kept there
|
||||||
|
// TODO: This can't be made final because it's a public API.
|
||||||
|
protected HashMap<String, Boolean> features = new HashMap<String, Boolean>();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Protected constructor to be called by factory implementations.
|
||||||
|
*/
|
||||||
|
protected XmlPullParserFactory() {
|
||||||
|
parserClasses = new ArrayList<String>();
|
||||||
|
serializerClasses = new ArrayList<String>();
|
||||||
|
|
||||||
|
// GWT
|
||||||
|
/*try {
|
||||||
|
parserClasses.add(Class.forName("com.android.org.kxml2.io.KXmlParser"));
|
||||||
|
serializerClasses.add(Class.forName("com.android.org.kxml2.io.KXmlSerializer"));
|
||||||
|
} catch (ClassNotFoundException e) {
|
||||||
|
throw new AssertionError();
|
||||||
|
}*/
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the features to be set when XML Pull Parser is created by this factory.
|
||||||
|
* <p><b>NOTE:</b> factory features are not used for XML Serializer.
|
||||||
|
*
|
||||||
|
* @param name string with URI identifying feature
|
||||||
|
* @param state if true feature will be set; if false will be ignored
|
||||||
|
*/
|
||||||
|
public void setFeature(String name, boolean state) throws XmlPullParserException {
|
||||||
|
features.put(name, state);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the current value of the feature with given name.
|
||||||
|
* <p><b>NOTE:</b> factory features are not used for XML Serializer.
|
||||||
|
*
|
||||||
|
* @param name The name of feature to be retrieved.
|
||||||
|
* @return The value of named feature.
|
||||||
|
* Unknown features are <string>always</strong> returned as false
|
||||||
|
*/
|
||||||
|
public boolean getFeature(String name) {
|
||||||
|
Boolean value = features.get(name);
|
||||||
|
return value != null ? value.booleanValue() : false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Specifies that the parser produced by this factory will provide
|
||||||
|
* support for XML namespaces.
|
||||||
|
* By default the value of this is set to false.
|
||||||
|
*
|
||||||
|
* @param awareness true if the parser produced by this code
|
||||||
|
* will provide support for XML namespaces; false otherwise.
|
||||||
|
*/
|
||||||
|
public void setNamespaceAware(boolean awareness) {
|
||||||
|
features.put (XmlPullParser.FEATURE_PROCESS_NAMESPACES, awareness);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Indicates whether or not the factory is configured to produce
|
||||||
|
* parsers which are namespace aware
|
||||||
|
* (it simply set feature XmlPullParser.FEATURE_PROCESS_NAMESPACES to true or false).
|
||||||
|
*
|
||||||
|
* @return true if the factory is configured to produce parsers
|
||||||
|
* which are namespace aware; false otherwise.
|
||||||
|
*/
|
||||||
|
public boolean isNamespaceAware() {
|
||||||
|
return getFeature(XmlPullParser.FEATURE_PROCESS_NAMESPACES);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Specifies that the parser produced by this factory will be validating
|
||||||
|
* (it simply set feature XmlPullParser.FEATURE_VALIDATION to true or false).
|
||||||
|
*
|
||||||
|
* By default the value of this is set to false.
|
||||||
|
*
|
||||||
|
* @param validating - if true the parsers created by this factory must be validating.
|
||||||
|
*/
|
||||||
|
public void setValidating(boolean validating) {
|
||||||
|
features.put(XmlPullParser.FEATURE_VALIDATION, validating);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Indicates whether or not the factory is configured to produce parsers
|
||||||
|
* which validate the XML content during parse.
|
||||||
|
*
|
||||||
|
* @return true if the factory is configured to produce parsers
|
||||||
|
* which validate the XML content during parse; false otherwise.
|
||||||
|
*/
|
||||||
|
|
||||||
|
public boolean isValidating() {
|
||||||
|
return getFeature(XmlPullParser.FEATURE_VALIDATION);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a new instance of a XML Pull Parser
|
||||||
|
* using the currently configured factory features.
|
||||||
|
*
|
||||||
|
* @return A new instance of a XML Pull Parser.
|
||||||
|
*/
|
||||||
|
public XmlPullParser newPullParser() throws XmlPullParserException {
|
||||||
|
final XmlPullParser pp = getParserInstance();
|
||||||
|
for (Map.Entry<String, Boolean> entry : features.entrySet()) {
|
||||||
|
// NOTE: This test is needed for compatibility reasons. We guarantee
|
||||||
|
// that we only set a feature on a parser if its value is true.
|
||||||
|
if (entry.getValue()) {
|
||||||
|
pp.setFeature(entry.getKey(), entry.getValue());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return pp;
|
||||||
|
}
|
||||||
|
|
||||||
|
private XmlPullParser getParserInstance() throws XmlPullParserException {
|
||||||
|
ArrayList<Exception> exceptions = null;
|
||||||
|
|
||||||
|
if (parserClasses != null && !parserClasses.isEmpty()) {
|
||||||
|
exceptions = new ArrayList<Exception>();
|
||||||
|
for (Object o : parserClasses) {
|
||||||
|
// GWT
|
||||||
|
/*try {
|
||||||
|
if (o != null) {
|
||||||
|
Class<?> parserClass = (Class<?>) o;
|
||||||
|
return (XmlPullParser) parserClass.newInstance();
|
||||||
|
}
|
||||||
|
} catch (InstantiationException e) {
|
||||||
|
exceptions.add(e);
|
||||||
|
} catch (IllegalAccessException e) {
|
||||||
|
exceptions.add(e);
|
||||||
|
} catch (ClassCastException e) {
|
||||||
|
exceptions.add(e);
|
||||||
|
}*/
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
throw newInstantiationException("Invalid parser class list", exceptions);
|
||||||
|
}
|
||||||
|
|
||||||
|
private XmlSerializer getSerializerInstance() throws XmlPullParserException {
|
||||||
|
ArrayList<Exception> exceptions = null;
|
||||||
|
|
||||||
|
if (serializerClasses != null && !serializerClasses.isEmpty()) {
|
||||||
|
exceptions = new ArrayList<Exception>();
|
||||||
|
for (Object o : serializerClasses) {
|
||||||
|
// GWT
|
||||||
|
/*try {
|
||||||
|
if (o != null) {
|
||||||
|
Class<?> serializerClass = (Class<?>) o;
|
||||||
|
return (XmlSerializer) serializerClass.newInstance();
|
||||||
|
}
|
||||||
|
} catch (InstantiationException e) {
|
||||||
|
exceptions.add(e);
|
||||||
|
} catch (IllegalAccessException e) {
|
||||||
|
exceptions.add(e);
|
||||||
|
} catch (ClassCastException e) {
|
||||||
|
exceptions.add(e);
|
||||||
|
}*/
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
throw newInstantiationException("Invalid serializer class list", exceptions);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static XmlPullParserException newInstantiationException(String message,
|
||||||
|
ArrayList<Exception> exceptions) {
|
||||||
|
if (exceptions == null || exceptions.isEmpty()) {
|
||||||
|
return new XmlPullParserException(message);
|
||||||
|
} else {
|
||||||
|
XmlPullParserException exception = new XmlPullParserException(message);
|
||||||
|
for (Exception ex : exceptions) {
|
||||||
|
exception.addSuppressed(ex);
|
||||||
|
}
|
||||||
|
|
||||||
|
return exception;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a new instance of a XML Serializer.
|
||||||
|
*
|
||||||
|
* <p><b>NOTE:</b> factory features are not used for XML Serializer.
|
||||||
|
*
|
||||||
|
* @return A new instance of a XML Serializer.
|
||||||
|
* @throws XmlPullParserException if a parser cannot be created which satisfies the
|
||||||
|
* requested configuration.
|
||||||
|
*/
|
||||||
|
|
||||||
|
public XmlSerializer newSerializer() throws XmlPullParserException {
|
||||||
|
return getSerializerInstance();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a new instance of a PullParserFactory that can be used
|
||||||
|
* to create XML pull parsers. The factory will always return instances
|
||||||
|
* of Android's built-in {@link XmlPullParser} and {@link XmlSerializer}.
|
||||||
|
*/
|
||||||
|
public static XmlPullParserFactory newInstance () throws XmlPullParserException {
|
||||||
|
return new XmlPullParserFactory();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a factory that always returns instances of Android's built-in
|
||||||
|
* {@link XmlPullParser} and {@link XmlSerializer} implementation. This
|
||||||
|
* <b>does not</b> support factories capable of creating arbitrary parser
|
||||||
|
* and serializer implementations. Both arguments to this method are unused.
|
||||||
|
*/
|
||||||
|
public static XmlPullParserFactory newInstance (String unused, Class unused2)
|
||||||
|
throws XmlPullParserException {
|
||||||
|
return newInstance();
|
||||||
|
}
|
||||||
|
}
|
||||||
325
vtm-web/src/org/oscim/gdx/emu/org/xmlpull/v1/XmlSerializer.java
Normal file
325
vtm-web/src/org/oscim/gdx/emu/org/xmlpull/v1/XmlSerializer.java
Normal file
@@ -0,0 +1,325 @@
|
|||||||
|
package org.xmlpull.v1;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.OutputStream;
|
||||||
|
import java.io.Writer;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Define an interface to serialization of XML Infoset.
|
||||||
|
* This interface abstracts away if serialized XML is XML 1.0 compatible text or
|
||||||
|
* other formats of XML 1.0 serializations (such as binary XML for example with WBXML).
|
||||||
|
*
|
||||||
|
* <p><b>PLEASE NOTE:</b> This interface will be part of XmlPull 1.2 API.
|
||||||
|
* It is included as basis for discussion. It may change in any way.
|
||||||
|
*
|
||||||
|
* <p>Exceptions that may be thrown are: IOException or runtime exception
|
||||||
|
* (more runtime exceptions can be thrown but are not declared and as such
|
||||||
|
* have no semantics defined for this interface):
|
||||||
|
* <ul>
|
||||||
|
* <li><em>IllegalArgumentException</em> - for almost all methods to signal that
|
||||||
|
* argument is illegal
|
||||||
|
* <li><em>IllegalStateException</em> - to signal that call has good arguments but
|
||||||
|
* is not expected here (violation of contract) and for features/properties
|
||||||
|
* when requesting setting unimplemented feature/property
|
||||||
|
* (UnsupportedOperationException would be better but it is not in MIDP)
|
||||||
|
* </ul>
|
||||||
|
*
|
||||||
|
* <p><b>NOTE:</b> writing CDSECT, ENTITY_REF, IGNORABLE_WHITESPACE,
|
||||||
|
* PROCESSING_INSTRUCTION, COMMENT, and DOCDECL in some implementations
|
||||||
|
* may not be supported (for example when serializing to WBXML).
|
||||||
|
* In such case IllegalStateException will be thrown and it is recommended
|
||||||
|
* to use an optional feature to signal that implementation is not
|
||||||
|
* supporting this kind of output.
|
||||||
|
*/
|
||||||
|
|
||||||
|
public interface XmlSerializer {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set feature identified by name (recommended to be URI for uniqueness).
|
||||||
|
* Some well known optional features are defined in
|
||||||
|
* <a href="http://www.xmlpull.org/v1/doc/features.html">
|
||||||
|
* http://www.xmlpull.org/v1/doc/features.html</a>.
|
||||||
|
*
|
||||||
|
* If feature is not recognized or can not be set
|
||||||
|
* then IllegalStateException MUST be thrown.
|
||||||
|
*
|
||||||
|
* @exception IllegalStateException If the feature is not supported or can not be set
|
||||||
|
*/
|
||||||
|
void setFeature(String name,
|
||||||
|
boolean state)
|
||||||
|
throws IllegalArgumentException, IllegalStateException;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the current value of the feature with given name.
|
||||||
|
* <p><strong>NOTE:</strong> unknown properties are <strong>always</strong> returned as null
|
||||||
|
*
|
||||||
|
* @param name The name of feature to be retrieved.
|
||||||
|
* @return The value of named feature.
|
||||||
|
* @exception IllegalArgumentException if feature string is null
|
||||||
|
*/
|
||||||
|
boolean getFeature(String name);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the value of a property.
|
||||||
|
* (the property name is recommended to be URI for uniqueness).
|
||||||
|
* Some well known optional properties are defined in
|
||||||
|
* <a href="http://www.xmlpull.org/v1/doc/properties.html">
|
||||||
|
* http://www.xmlpull.org/v1/doc/properties.html</a>.
|
||||||
|
*
|
||||||
|
* If property is not recognized or can not be set
|
||||||
|
* then IllegalStateException MUST be thrown.
|
||||||
|
*
|
||||||
|
* @exception IllegalStateException if the property is not supported or can not be set
|
||||||
|
*/
|
||||||
|
void setProperty(String name,
|
||||||
|
Object value)
|
||||||
|
throws IllegalArgumentException, IllegalStateException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Look up the value of a property.
|
||||||
|
*
|
||||||
|
* The property name is any fully-qualified URI. I
|
||||||
|
* <p><strong>NOTE:</strong> unknown properties are <string>always</strong> returned as null
|
||||||
|
*
|
||||||
|
* @param name The name of property to be retrieved.
|
||||||
|
* @return The value of named property.
|
||||||
|
*/
|
||||||
|
Object getProperty(String name);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set to use binary output stream with given encoding.
|
||||||
|
*/
|
||||||
|
void setOutput (OutputStream os, String encoding)
|
||||||
|
throws IOException, IllegalArgumentException, IllegalStateException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the output to the given writer.
|
||||||
|
* <p><b>WARNING</b> no information about encoding is available!
|
||||||
|
*/
|
||||||
|
void setOutput (Writer writer)
|
||||||
|
throws IOException, IllegalArgumentException, IllegalStateException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Write <?xml declaration with encoding (if encoding not null)
|
||||||
|
* and standalone flag (if standalone not null)
|
||||||
|
* This method can only be called just after setOutput.
|
||||||
|
*/
|
||||||
|
void startDocument (String encoding, Boolean standalone)
|
||||||
|
throws IOException, IllegalArgumentException, IllegalStateException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Finish writing. All unclosed start tags will be closed and output
|
||||||
|
* will be flushed. After calling this method no more output can be
|
||||||
|
* serialized until next call to setOutput()
|
||||||
|
*/
|
||||||
|
void endDocument ()
|
||||||
|
throws IOException, IllegalArgumentException, IllegalStateException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Binds the given prefix to the given namespace.
|
||||||
|
* This call is valid for the next element including child elements.
|
||||||
|
* The prefix and namespace MUST be always declared even if prefix
|
||||||
|
* is not used in element (startTag() or attribute()) - for XML 1.0
|
||||||
|
* it must result in declaring <code>xmlns:prefix='namespace'</code>
|
||||||
|
* (or <code>xmlns:prefix="namespace"</code> depending what character is used
|
||||||
|
* to quote attribute value).
|
||||||
|
*
|
||||||
|
* <p><b>NOTE:</b> this method MUST be called directly before startTag()
|
||||||
|
* and if anything but startTag() or setPrefix() is called next there will be exception.
|
||||||
|
* <p><b>NOTE:</b> prefixes "xml" and "xmlns" are already bound
|
||||||
|
* and can not be redefined see:
|
||||||
|
* <a href="http://www.w3.org/XML/xml-names-19990114-errata#NE05">Namespaces in XML Errata</a>.
|
||||||
|
* <p><b>NOTE:</b> to set default namespace use as prefix empty string.
|
||||||
|
*
|
||||||
|
* @param prefix must be not null (or IllegalArgumentException is thrown)
|
||||||
|
* @param namespace must be not null
|
||||||
|
*/
|
||||||
|
void setPrefix (String prefix, String namespace)
|
||||||
|
throws IOException, IllegalArgumentException, IllegalStateException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return namespace that corresponds to given prefix
|
||||||
|
* If there is no prefix bound to this namespace return null
|
||||||
|
* but if generatePrefix is false then return generated prefix.
|
||||||
|
*
|
||||||
|
* <p><b>NOTE:</b> if the prefix is empty string "" and default namespace is bound
|
||||||
|
* to this prefix then empty string ("") is returned.
|
||||||
|
*
|
||||||
|
* <p><b>NOTE:</b> prefixes "xml" and "xmlns" are already bound
|
||||||
|
* will have values as defined
|
||||||
|
* <a href="http://www.w3.org/TR/REC-xml-names/">Namespaces in XML specification</a>
|
||||||
|
*/
|
||||||
|
String getPrefix (String namespace, boolean generatePrefix)
|
||||||
|
throws IllegalArgumentException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the current depth of the element.
|
||||||
|
* Outside the root element, the depth is 0. The
|
||||||
|
* depth is incremented by 1 when startTag() is called.
|
||||||
|
* The depth is decremented after the call to endTag()
|
||||||
|
* event was observed.
|
||||||
|
*
|
||||||
|
* <pre>
|
||||||
|
* <!-- outside --> 0
|
||||||
|
* <root> 1
|
||||||
|
* sometext 1
|
||||||
|
* <foobar> 2
|
||||||
|
* </foobar> 2
|
||||||
|
* </root> 1
|
||||||
|
* <!-- outside --> 0
|
||||||
|
* </pre>
|
||||||
|
*/
|
||||||
|
int getDepth();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the namespace URI of the current element as set by startTag().
|
||||||
|
*
|
||||||
|
* <p><b>NOTE:</b> that means in particular that: <ul>
|
||||||
|
* <li>if there was startTag("", ...) then getNamespace() returns ""
|
||||||
|
* <li>if there was startTag(null, ...) then getNamespace() returns null
|
||||||
|
* </ul>
|
||||||
|
*
|
||||||
|
* @return namespace set by startTag() that is currently in scope
|
||||||
|
*/
|
||||||
|
String getNamespace ();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the name of the current element as set by startTag().
|
||||||
|
* It can only be null before first call to startTag()
|
||||||
|
* or when last endTag() is called to close first startTag().
|
||||||
|
*
|
||||||
|
* @return namespace set by startTag() that is currently in scope
|
||||||
|
*/
|
||||||
|
String getName();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Writes a start tag with the given namespace and name.
|
||||||
|
* If there is no prefix defined for the given namespace,
|
||||||
|
* a prefix will be defined automatically.
|
||||||
|
* The explicit prefixes for namespaces can be established by calling setPrefix()
|
||||||
|
* immediately before this method.
|
||||||
|
* If namespace is null no namespace prefix is printed but just name.
|
||||||
|
* If namespace is empty string then serializer will make sure that
|
||||||
|
* default empty namespace is declared (in XML 1.0 xmlns='')
|
||||||
|
* or throw IllegalStateException if default namespace is already bound
|
||||||
|
* to non-empty string.
|
||||||
|
*/
|
||||||
|
XmlSerializer startTag (String namespace, String name)
|
||||||
|
throws IOException, IllegalArgumentException, IllegalStateException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Write an attribute. Calls to attribute() MUST follow a call to
|
||||||
|
* startTag() immediately. If there is no prefix defined for the
|
||||||
|
* given namespace, a prefix will be defined automatically.
|
||||||
|
* If namespace is null or empty string
|
||||||
|
* no namespace prefix is printed but just name.
|
||||||
|
*/
|
||||||
|
XmlSerializer attribute (String namespace, String name, String value)
|
||||||
|
throws IOException, IllegalArgumentException, IllegalStateException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Write end tag. Repetition of namespace and name is just for avoiding errors.
|
||||||
|
* <p><b>Background:</b> in kXML endTag had no arguments, and non matching tags were
|
||||||
|
* very difficult to find...
|
||||||
|
* If namespace is null no namespace prefix is printed but just name.
|
||||||
|
* If namespace is empty string then serializer will make sure that
|
||||||
|
* default empty namespace is declared (in XML 1.0 xmlns='').
|
||||||
|
*/
|
||||||
|
XmlSerializer endTag (String namespace, String name)
|
||||||
|
throws IOException, IllegalArgumentException, IllegalStateException;
|
||||||
|
|
||||||
|
|
||||||
|
// /**
|
||||||
|
// * Writes a start tag with the given namespace and name.
|
||||||
|
// * <br />If there is no prefix defined (prefix == null) for the given namespace,
|
||||||
|
// * a prefix will be defined automatically.
|
||||||
|
// * <br />If explicit prefixes is passed (prefix != null) then it will be used
|
||||||
|
// *and namespace declared if not already declared or
|
||||||
|
// * throw IllegalStateException the same prefix was already set on this
|
||||||
|
// * element (setPrefix()) and was bound to different namespace.
|
||||||
|
// * <br />If namespace is null then prefix must be null too or IllegalStateException is thrown.
|
||||||
|
// * <br />If namespace is null then no namespace prefix is printed but just name.
|
||||||
|
// * <br />If namespace is empty string then serializer will make sure that
|
||||||
|
// * default empty namespace is declared (in XML 1.0 xmlns='')
|
||||||
|
// * or throw IllegalStateException if default namespace is already bound
|
||||||
|
// * to non-empty string.
|
||||||
|
// */
|
||||||
|
// XmlSerializer startTag (String prefix, String namespace, String name)
|
||||||
|
// throws IOException, IllegalArgumentException, IllegalStateException;
|
||||||
|
//
|
||||||
|
// /**
|
||||||
|
// * Write an attribute. Calls to attribute() MUST follow a call to
|
||||||
|
// * startTag() immediately.
|
||||||
|
// * <br />If there is no prefix defined (prefix == null) for the given namespace,
|
||||||
|
// * a prefix will be defined automatically.
|
||||||
|
// * <br />If explicit prefixes is passed (prefix != null) then it will be used
|
||||||
|
// * and namespace declared if not already declared or
|
||||||
|
// * throw IllegalStateException the same prefix was already set on this
|
||||||
|
// * element (setPrefix()) and was bound to different namespace.
|
||||||
|
// * <br />If namespace is null then prefix must be null too or IllegalStateException is thrown.
|
||||||
|
// * <br />If namespace is null then no namespace prefix is printed but just name.
|
||||||
|
// * <br />If namespace is empty string then serializer will make sure that
|
||||||
|
// * default empty namespace is declared (in XML 1.0 xmlns='')
|
||||||
|
// * or throw IllegalStateException if default namespace is already bound
|
||||||
|
// * to non-empty string.
|
||||||
|
// */
|
||||||
|
// XmlSerializer attribute (String prefix, String namespace, String name, String value)
|
||||||
|
// throws IOException, IllegalArgumentException, IllegalStateException;
|
||||||
|
//
|
||||||
|
// /**
|
||||||
|
// * Write end tag. Repetition of namespace, prefix, and name is just for avoiding errors.
|
||||||
|
// * <br />If namespace or name arguments are different from corresponding startTag call
|
||||||
|
// * then IllegalArgumentException is thrown, if prefix argument is not null and is different
|
||||||
|
// * from corresponding starTag then IllegalArgumentException is thrown.
|
||||||
|
// * <br />If namespace is null then prefix must be null too or IllegalStateException is thrown.
|
||||||
|
// * <br />If namespace is null then no namespace prefix is printed but just name.
|
||||||
|
// * <br />If namespace is empty string then serializer will make sure that
|
||||||
|
// * default empty namespace is declared (in XML 1.0 xmlns='').
|
||||||
|
// * <p><b>Background:</b> in kXML endTag had no arguments, and non matching tags were
|
||||||
|
// * very difficult to find...</p>
|
||||||
|
// */
|
||||||
|
// ALEK: This is really optional as prefix in end tag MUST correspond to start tag but good for error checking
|
||||||
|
// XmlSerializer endTag (String prefix, String namespace, String name)
|
||||||
|
// throws IOException, IllegalArgumentException, IllegalStateException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Writes text, where special XML chars are escaped automatically
|
||||||
|
*/
|
||||||
|
XmlSerializer text (String text)
|
||||||
|
throws IOException, IllegalArgumentException, IllegalStateException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Writes text, where special XML chars are escaped automatically
|
||||||
|
*/
|
||||||
|
XmlSerializer text (char [] buf, int start, int len)
|
||||||
|
throws IOException, IllegalArgumentException, IllegalStateException;
|
||||||
|
|
||||||
|
void cdsect (String text)
|
||||||
|
throws IOException, IllegalArgumentException, IllegalStateException;
|
||||||
|
void entityRef (String text) throws IOException,
|
||||||
|
IllegalArgumentException, IllegalStateException;
|
||||||
|
void processingInstruction (String text)
|
||||||
|
throws IOException, IllegalArgumentException, IllegalStateException;
|
||||||
|
void comment (String text)
|
||||||
|
throws IOException, IllegalArgumentException, IllegalStateException;
|
||||||
|
void docdecl (String text)
|
||||||
|
throws IOException, IllegalArgumentException, IllegalStateException;
|
||||||
|
void ignorableWhitespace (String text)
|
||||||
|
throws IOException, IllegalArgumentException, IllegalStateException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Write all pending output to the stream.
|
||||||
|
* If method startTag() or attribute() was called then start tag is closed (final >)
|
||||||
|
* before flush() is called on underlying output stream.
|
||||||
|
*
|
||||||
|
* <p><b>NOTE:</b> if there is need to close start tag
|
||||||
|
* (so no more attribute() calls are allowed) but without flushing output
|
||||||
|
* call method text() with empty string (text("")).
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
void flush ()
|
||||||
|
throws IOException;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -2,6 +2,7 @@ apply plugin: 'java-library'
|
|||||||
apply plugin: 'maven'
|
apply plugin: 'maven'
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
|
api 'net.sf.kxml:kxml2:2.3.0'
|
||||||
api "org.slf4j:slf4j-api:$slf4jVersion"
|
api "org.slf4j:slf4j-api:$slf4jVersion"
|
||||||
compileOnly 'com.google.code.findbugs:jsr305:3.0.2'
|
compileOnly 'com.google.code.findbugs:jsr305:3.0.2'
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2013 Hannes Janetzek
|
* Copyright 2013 Hannes Janetzek
|
||||||
* Copyright 2016-2018 devemux86
|
* Copyright 2016-2020 devemux86
|
||||||
* Copyright 2017 Longri
|
* Copyright 2017 Longri
|
||||||
*
|
*
|
||||||
* This file is part of the OpenScienceMap project (http://www.opensciencemap.org).
|
* This file is part of the OpenScienceMap project (http://www.opensciencemap.org).
|
||||||
@@ -59,6 +59,11 @@ public abstract class CanvasAdapter {
|
|||||||
*/
|
*/
|
||||||
public static Platform platform = Platform.UNKNOWN;
|
public static Platform platform = Platform.UNKNOWN;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The symbol scale.
|
||||||
|
*/
|
||||||
|
public static float symbolScale = 1;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The text scale.
|
* The text scale.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -254,8 +254,8 @@ public final class Color {
|
|||||||
* exception. Supported formats are:
|
* exception. Supported formats are:
|
||||||
* #RRGGBB
|
* #RRGGBB
|
||||||
* #AARRGGBB
|
* #AARRGGBB
|
||||||
* 'red', 'blue', 'green', 'black', 'white', 'gray', 'cyan', 'magenta',
|
* rgb(r, g, b)
|
||||||
* 'yellow', 'lightgray', 'darkgray'
|
* rgba(r, g, b, a)
|
||||||
*
|
*
|
||||||
* @param colorString the color string
|
* @param colorString the color string
|
||||||
* @return the int
|
* @return the int
|
||||||
|
|||||||
@@ -66,4 +66,11 @@ public abstract class EventDispatcher<E extends EventListener, T> {
|
|||||||
tell(l.data, event, data);
|
tell(l.data, event, data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Remove all listeners.
|
||||||
|
*/
|
||||||
|
public void clear() {
|
||||||
|
mListeners = null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -98,7 +98,7 @@ public class ClusterMarkerRenderer extends MarkerRenderer {
|
|||||||
* @param defaultSymbol The default symbol
|
* @param defaultSymbol The default symbol
|
||||||
* @param style The desired style, or NULL to disable clustering
|
* @param style The desired style, or NULL to disable clustering
|
||||||
*/
|
*/
|
||||||
public ClusterMarkerRenderer(MarkerLayer<MarkerInterface> markerLayer, MarkerSymbol defaultSymbol, ClusterMarkerRenderer.ClusterStyle style) {
|
public ClusterMarkerRenderer(MarkerLayer markerLayer, MarkerSymbol defaultSymbol, ClusterMarkerRenderer.ClusterStyle style) {
|
||||||
super(markerLayer, defaultSymbol);
|
super(markerLayer, defaultSymbol);
|
||||||
|
|
||||||
mClusteringEnabled = style != null;
|
mClusteringEnabled = style != null;
|
||||||
@@ -141,7 +141,7 @@ public class ClusterMarkerRenderer extends MarkerRenderer {
|
|||||||
/* the grid slot size in px. increase to group more aggressively. currently set to marker size */
|
/* 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 = ScreenUtils.getPixels(MAP_GRID_SIZE_DP);
|
||||||
|
|
||||||
/* the factor to map into Grid Coordinates (discrete squares of GRIDSIZE x GRIDSIZE) */
|
/* the factor to map into Grid Coordinates (discrete squares of GRIDSIZE x GRIDSIZE) */
|
||||||
final double factor = (scale / GRIDSIZE);
|
final double factor = (scale / GRIDSIZE);
|
||||||
|
|
||||||
InternalItem.Clustered[] tmp = new InternalItem.Clustered[size];
|
InternalItem.Clustered[] tmp = new InternalItem.Clustered[size];
|
||||||
@@ -154,7 +154,7 @@ public class ClusterMarkerRenderer extends MarkerRenderer {
|
|||||||
|
|
||||||
it.item = mMarkerLayer.createItem(i);
|
it.item = mMarkerLayer.createItem(i);
|
||||||
|
|
||||||
/* pre-project points */
|
/* pre-project points */
|
||||||
MercatorProjection.project(it.item.getPoint(), mMapPoint);
|
MercatorProjection.project(it.item.getPoint(), mMapPoint);
|
||||||
it.px = mMapPoint.x;
|
it.px = mMapPoint.x;
|
||||||
it.py = mMapPoint.y;
|
it.py = mMapPoint.y;
|
||||||
@@ -260,7 +260,7 @@ public class ClusterMarkerRenderer extends MarkerRenderer {
|
|||||||
float cos = (float) Math.cos(angle);
|
float cos = (float) Math.cos(angle);
|
||||||
float sin = (float) Math.sin(angle);
|
float sin = (float) Math.sin(angle);
|
||||||
|
|
||||||
/* check visibility */
|
/* check visibility */
|
||||||
for (InternalItem itm : mItems) {
|
for (InternalItem itm : mItems) {
|
||||||
InternalItem.Clustered it = (InternalItem.Clustered) itm;
|
InternalItem.Clustered it = (InternalItem.Clustered) itm;
|
||||||
|
|
||||||
@@ -299,7 +299,7 @@ public class ClusterMarkerRenderer extends MarkerRenderer {
|
|||||||
|
|
||||||
//log.debug(numVisible + " " + changedVisible + " " + changesInvisible);
|
//log.debug(numVisible + " " + changedVisible + " " + changesInvisible);
|
||||||
|
|
||||||
/* only update when zoomlevel changed, new items are visible
|
/* only update when zoomlevel changed, new items are visible
|
||||||
* or more than 10 of the current items became invisible */
|
* or more than 10 of the current items became invisible */
|
||||||
//if ((numVisible == 0) && (changedVisible == 0 && changesInvisible < 10))
|
//if ((numVisible == 0) && (changedVisible == 0 && changesInvisible < 10))
|
||||||
// return;
|
// return;
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
* Copyright 2013 Hannes Janetzek
|
* Copyright 2013 Hannes Janetzek
|
||||||
* Copyright 2016 Izumi Kawashima
|
* Copyright 2016 Izumi Kawashima
|
||||||
* Copyright 2017 Longri
|
* Copyright 2017 Longri
|
||||||
* Copyright 2017 devemux86
|
* Copyright 2017-2020 devemux86
|
||||||
* Copyright 2017 nebular
|
* Copyright 2017 nebular
|
||||||
*
|
*
|
||||||
* This file is part of the OpenScienceMap project (http://www.opensciencemap.org).
|
* This file is part of the OpenScienceMap project (http://www.opensciencemap.org).
|
||||||
@@ -23,14 +23,14 @@ package org.oscim.layers.marker;
|
|||||||
/**
|
/**
|
||||||
* The internal representation of a marker.
|
* The internal representation of a marker.
|
||||||
*/
|
*/
|
||||||
class InternalItem {
|
public class InternalItem {
|
||||||
|
|
||||||
MarkerInterface item;
|
public MarkerInterface item;
|
||||||
boolean visible;
|
public boolean visible;
|
||||||
boolean changes;
|
public boolean changes;
|
||||||
float x, y;
|
public float x, y;
|
||||||
double px, py;
|
public double px, py;
|
||||||
float dy;
|
public float dy;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
@@ -43,15 +43,15 @@ class InternalItem {
|
|||||||
* It only adds a couple properties to InternalItem, and the semantics "InternalItem.Clustered"
|
* It only adds a couple properties to InternalItem, and the semantics "InternalItem.Clustered"
|
||||||
* are not bad.
|
* are not bad.
|
||||||
*/
|
*/
|
||||||
static class Clustered extends InternalItem {
|
public static class Clustered extends InternalItem {
|
||||||
/**
|
/**
|
||||||
* If this is >0, this item will be displayed as a cluster circle, with size clusterSize+1.
|
* If this is >0, this item will be displayed as a cluster circle, with size clusterSize+1.
|
||||||
*/
|
*/
|
||||||
int clusterSize;
|
public int clusterSize;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* If this is true, this item is hidden (because it's represented by another InternalItem acting as cluster.
|
* If this is true, this item is hidden (because it's represented by another InternalItem acting as cluster.
|
||||||
*/
|
*/
|
||||||
boolean clusteredOut;
|
public boolean clusteredOut;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
* Copyright 2012 osmdroid authors: Nicolas Gramlich, Theodore Hong, Fred Eisele
|
* Copyright 2012 osmdroid authors: Nicolas Gramlich, Theodore Hong, Fred Eisele
|
||||||
*
|
*
|
||||||
* Copyright 2013 Hannes Janetzek
|
* Copyright 2013 Hannes Janetzek
|
||||||
* Copyright 2016-2019 devemux86
|
* Copyright 2016-2020 devemux86
|
||||||
* Copyright 2016 Stephan Leuschner
|
* Copyright 2016 Stephan Leuschner
|
||||||
* Copyright 2016 Pedinel
|
* Copyright 2016 Pedinel
|
||||||
* Copyright 2019 Carlos Alberto Martínez Gadea
|
* Copyright 2019 Carlos Alberto Martínez Gadea
|
||||||
@@ -31,30 +31,25 @@ import org.oscim.event.GestureListener;
|
|||||||
import org.oscim.event.MotionEvent;
|
import org.oscim.event.MotionEvent;
|
||||||
import org.oscim.map.Map;
|
import org.oscim.map.Map;
|
||||||
import org.oscim.map.Viewport;
|
import org.oscim.map.Viewport;
|
||||||
import org.slf4j.Logger;
|
|
||||||
import org.slf4j.LoggerFactory;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class ItemizedLayer<Item extends MarkerInterface> extends MarkerLayer<Item>
|
public class ItemizedLayer extends MarkerLayer implements GestureListener {
|
||||||
implements GestureListener {
|
|
||||||
|
|
||||||
static final Logger log = LoggerFactory.getLogger(ItemizedLayer.class);
|
protected final List<MarkerInterface> mItemList;
|
||||||
|
|
||||||
protected final List<Item> mItemList;
|
|
||||||
protected final Point mTmpPoint = new Point();
|
protected final Point mTmpPoint = new Point();
|
||||||
protected OnItemGestureListener<Item> mOnItemGestureListener;
|
protected OnItemGestureListener<MarkerInterface> mOnItemGestureListener;
|
||||||
protected int mDrawnItemsLimit = Integer.MAX_VALUE;
|
protected int mDrawnItemsLimit = Integer.MAX_VALUE;
|
||||||
|
|
||||||
public ItemizedLayer(Map map, MarkerSymbol defaultMarker) {
|
public ItemizedLayer(Map map, MarkerSymbol defaultMarker) {
|
||||||
this(map, new ArrayList<Item>(), defaultMarker, null);
|
this(map, new ArrayList<MarkerInterface>(), defaultMarker, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public ItemizedLayer(Map map, List<Item> list,
|
public ItemizedLayer(Map map, List<MarkerInterface> list,
|
||||||
MarkerSymbol defaultMarker,
|
MarkerSymbol defaultMarker,
|
||||||
OnItemGestureListener<Item> listener) {
|
OnItemGestureListener<MarkerInterface> listener) {
|
||||||
|
|
||||||
super(map, defaultMarker);
|
super(map, defaultMarker);
|
||||||
|
|
||||||
@@ -64,12 +59,12 @@ public class ItemizedLayer<Item extends MarkerInterface> extends MarkerLayer<Ite
|
|||||||
}
|
}
|
||||||
|
|
||||||
public ItemizedLayer(Map map, MarkerRendererFactory markerRendererFactory) {
|
public ItemizedLayer(Map map, MarkerRendererFactory markerRendererFactory) {
|
||||||
this(map, new ArrayList<Item>(), markerRendererFactory, null);
|
this(map, new ArrayList<MarkerInterface>(), markerRendererFactory, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public ItemizedLayer(Map map, List<Item> list,
|
public ItemizedLayer(Map map, List<MarkerInterface> list,
|
||||||
MarkerRendererFactory markerRendererFactory,
|
MarkerRendererFactory markerRendererFactory,
|
||||||
OnItemGestureListener<Item> listener) {
|
OnItemGestureListener<MarkerInterface> listener) {
|
||||||
|
|
||||||
super(map, markerRendererFactory);
|
super(map, markerRendererFactory);
|
||||||
|
|
||||||
@@ -78,12 +73,12 @@ public class ItemizedLayer<Item extends MarkerInterface> extends MarkerLayer<Ite
|
|||||||
populate();
|
populate();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setOnItemGestureListener(OnItemGestureListener<Item> listener) {
|
public void setOnItemGestureListener(OnItemGestureListener<MarkerInterface> listener) {
|
||||||
mOnItemGestureListener = listener;
|
mOnItemGestureListener = listener;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected synchronized Item createItem(int index) {
|
protected synchronized MarkerInterface createItem(int index) {
|
||||||
return mItemList.get(index);
|
return mItemList.get(index);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -92,23 +87,24 @@ public class ItemizedLayer<Item extends MarkerInterface> extends MarkerLayer<Ite
|
|||||||
return Math.min(mItemList.size(), mDrawnItemsLimit);
|
return Math.min(mItemList.size(), mDrawnItemsLimit);
|
||||||
}
|
}
|
||||||
|
|
||||||
public synchronized boolean addItem(Item item) {
|
public synchronized boolean addItem(MarkerInterface item) {
|
||||||
final boolean result = mItemList.add(item);
|
final boolean result = mItemList.add(item);
|
||||||
populate();
|
populate();
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public synchronized void addItem(int location, Item item) {
|
public synchronized void addItem(int location, MarkerInterface item) {
|
||||||
mItemList.add(location, item);
|
mItemList.add(location, item);
|
||||||
|
populate();
|
||||||
}
|
}
|
||||||
|
|
||||||
public synchronized boolean addItems(Collection<Item> items) {
|
public synchronized boolean addItems(Collection<MarkerInterface> items) {
|
||||||
final boolean result = mItemList.addAll(items);
|
final boolean result = mItemList.addAll(items);
|
||||||
populate();
|
populate();
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public synchronized List<Item> getItemList() {
|
public synchronized List<MarkerInterface> getItemList() {
|
||||||
return mItemList;
|
return mItemList;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -123,14 +119,14 @@ public class ItemizedLayer<Item extends MarkerInterface> extends MarkerLayer<Ite
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public synchronized boolean removeItem(Item item) {
|
public synchronized boolean removeItem(MarkerInterface item) {
|
||||||
final boolean result = mItemList.remove(item);
|
final boolean result = mItemList.remove(item);
|
||||||
populate();
|
populate();
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public synchronized Item removeItem(int position) {
|
public synchronized MarkerInterface removeItem(int position) {
|
||||||
final Item result = mItemList.remove(position);
|
final MarkerInterface result = mItemList.remove(position);
|
||||||
populate();
|
populate();
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@@ -146,33 +142,31 @@ public class ItemizedLayer<Item extends MarkerInterface> extends MarkerLayer<Ite
|
|||||||
// public boolean onTap(MotionEvent event, MapPosition pos) {
|
// public boolean onTap(MotionEvent event, MapPosition pos) {
|
||||||
// return activateSelectedItems(event, mActiveItemSingleTap);
|
// return activateSelectedItems(event, mActiveItemSingleTap);
|
||||||
// }
|
// }
|
||||||
protected boolean onSingleTapUpHelper(int index, Item item) {
|
protected boolean onSingleTapUpHelper(int index, MarkerInterface item) {
|
||||||
return mOnItemGestureListener.onItemSingleTapUp(index, item);
|
return mOnItemGestureListener.onItemSingleTapUp(index, item);
|
||||||
}
|
}
|
||||||
|
|
||||||
private final ActiveItem mActiveItemSingleTap = new ActiveItem() {
|
private final ActiveItem mActiveItemSingleTap = new ActiveItem() {
|
||||||
@Override
|
@Override
|
||||||
public boolean run(int index) {
|
public boolean run(int index) {
|
||||||
final ItemizedLayer<Item> that = ItemizedLayer.this;
|
|
||||||
if (mOnItemGestureListener == null) {
|
if (mOnItemGestureListener == null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return onSingleTapUpHelper(index, that.mItemList.get(index));
|
return onSingleTapUpHelper(index, mItemList.get(index));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
protected boolean onLongPressHelper(int index, Item item) {
|
protected boolean onLongPressHelper(int index, MarkerInterface item) {
|
||||||
return this.mOnItemGestureListener.onItemLongPress(index, item);
|
return this.mOnItemGestureListener.onItemLongPress(index, item);
|
||||||
}
|
}
|
||||||
|
|
||||||
private final ActiveItem mActiveItemLongPress = new ActiveItem() {
|
private final ActiveItem mActiveItemLongPress = new ActiveItem() {
|
||||||
@Override
|
@Override
|
||||||
public boolean run(final int index) {
|
public boolean run(final int index) {
|
||||||
final ItemizedLayer<Item> that = ItemizedLayer.this;
|
if (mOnItemGestureListener == null) {
|
||||||
if (that.mOnItemGestureListener == null) {
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return onLongPressHelper(index, that.mItemList.get(index));
|
return onLongPressHelper(index, mItemList.get(index));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -205,7 +199,7 @@ public class ItemizedLayer<Item extends MarkerInterface> extends MarkerLayer<Ite
|
|||||||
double dist = (20 * CanvasAdapter.getScale()) * (20 * CanvasAdapter.getScale());
|
double dist = (20 * CanvasAdapter.getScale()) * (20 * CanvasAdapter.getScale());
|
||||||
|
|
||||||
for (int i = 0; i < size; i++) {
|
for (int i = 0; i < size; i++) {
|
||||||
Item item = mItemList.get(i);
|
MarkerInterface item = mItemList.get(i);
|
||||||
|
|
||||||
if (!box.contains(item.getPoint().longitudeE6,
|
if (!box.contains(item.getPoint().longitudeE6,
|
||||||
item.getPoint().latitudeE6))
|
item.getPoint().latitudeE6))
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user