Compare commits
122 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4d9ad3e942 | ||
|
|
ae6ce553b9 | ||
|
|
13c42d509c | ||
|
|
a6aa2b2388 | ||
|
|
9f7fe2577b | ||
|
|
ad2348631a | ||
|
|
2dbad2b16a | ||
|
|
8db30d8537 | ||
|
|
25f0310334 | ||
|
|
3041ab5515 | ||
|
|
27e2c5dde5 | ||
|
|
a386cfea4f | ||
|
|
fe104300ba | ||
|
|
f1ae5c3d68 | ||
|
|
767019ee06 | ||
|
|
3a3a58d273 | ||
|
|
0eb53403d1 | ||
|
|
4938852b40 | ||
|
|
0d14473132 | ||
|
|
34ddf3a005 | ||
|
|
9ca4785701 | ||
|
|
8d2aba9c65 | ||
|
|
2872ce94a3 | ||
|
|
d5ebf43e3d | ||
|
|
223eb120fa | ||
|
|
b94d943247 | ||
|
|
d409aa5b96 | ||
|
|
644c83ed69 | ||
|
|
db871d4a22 | ||
|
|
3f959a3b46 | ||
|
|
903dbad9c6 | ||
|
|
3afca64080 | ||
|
|
16f0d524c5 | ||
|
|
f669022ca3 | ||
|
|
dce7886447 | ||
|
|
f77c46f56d | ||
|
|
45383397bc | ||
|
|
c14e93e25d | ||
|
|
7b7b5a923a | ||
|
|
6b4bb7d8bf | ||
|
|
5d4d630ce0 | ||
|
|
8d121c0798 | ||
|
|
6b362e5125 | ||
|
|
c2eb679adf | ||
|
|
183cb8aafd | ||
|
|
4bf27bc910 | ||
|
|
f0639972b4 | ||
|
|
e1d17321c6 | ||
|
|
b75ac0d647 | ||
|
|
7f81ddf47f | ||
|
|
c580e1d7a5 | ||
|
|
7a28788972 | ||
|
|
36e547d828 | ||
|
|
bd762dae9e | ||
|
|
347c1d31bb | ||
|
|
c6be08a903 | ||
|
|
8ab2195500 | ||
|
|
9fff945978 | ||
|
|
18d8e18bdf | ||
|
|
b32692942f | ||
|
|
9c58d8219c | ||
|
|
32c57a42a4 | ||
|
|
6c004b8be7 | ||
|
|
9a31cc07b5 | ||
|
|
0de27b7354 | ||
|
|
dc340a382e | ||
|
|
4c9354c326 | ||
|
|
d1fdca170e | ||
|
|
d614809df0 | ||
|
|
0c3acfd69c | ||
|
|
da95660c73 | ||
|
|
c8396062ae | ||
|
|
579f49bfd6 | ||
|
|
20f1121d3a | ||
|
|
26253a6104 | ||
|
|
b190211e5a | ||
|
|
edf29d2b0e | ||
|
|
a001f4615c | ||
|
|
5818edc228 | ||
|
|
e562ebdff6 | ||
|
|
d08ef59278 | ||
|
|
bb1d602267 | ||
|
|
c1eca04ab1 | ||
|
|
f6c28dc158 | ||
|
|
b760eadd4d | ||
|
|
7500ca1711 | ||
|
|
808671c1fb | ||
|
|
2d3ab0b6fd | ||
|
|
6461d39357 | ||
|
|
e0c02a83d0 | ||
|
|
ca56e0fe33 | ||
|
|
320ce5b44d | ||
|
|
f061e06d94 | ||
|
|
d1ce52ef52 | ||
|
|
28961caa79 | ||
|
|
4b30ca3242 | ||
|
|
84c45e153a | ||
|
|
d8001e23f6 | ||
|
|
559f4899dd | ||
|
|
04f02d9ae5 | ||
|
|
acb7727234 | ||
|
|
ac0455b1b4 | ||
|
|
5480cd6df8 | ||
|
|
325f848969 | ||
|
|
ea402f77f1 | ||
|
|
759915861e | ||
|
|
bc46217449 | ||
|
|
d8030c1364 | ||
|
|
23d34fa00a | ||
|
|
29322acf87 | ||
|
|
5dcffcc537 | ||
|
|
67afa0b7ab | ||
|
|
a6ecab334c | ||
|
|
edf89ce36b | ||
|
|
4f687e6fec | ||
|
|
cfc036c7ec | ||
|
|
3dbc44e9c2 | ||
|
|
c9e1c81cca | ||
|
|
f7e5544238 | ||
|
|
981536595f | ||
|
|
5aaa2ca96b | ||
|
|
b7a3844aac |
@@ -6,8 +6,8 @@ android:
|
|||||||
components:
|
components:
|
||||||
- platform-tools
|
- platform-tools
|
||||||
- tools
|
- tools
|
||||||
- build-tools-25.0.2
|
- build-tools-26.0.0
|
||||||
- android-25
|
- android-26
|
||||||
- extra-android-m2repository
|
- extra-android-m2repository
|
||||||
env:
|
env:
|
||||||
global:
|
global:
|
||||||
|
|||||||
15
README.md
@@ -17,25 +17,26 @@ If you have any questions or problems, don't hesitate to ask our public [mailing
|
|||||||
- OpenGL vector-tile rendering
|
- OpenGL vector-tile rendering
|
||||||
- Themeable vector layers
|
- Themeable vector layers
|
||||||
- Support for multiple tile sources:
|
- Support for multiple tile sources:
|
||||||
- OpenScienceMap (.vtm)
|
- OpenScienceMap vector tiles
|
||||||
- Mapsforge (.map)
|
- Mapsforge vector maps
|
||||||
- Mapbox tiles (.mvt)
|
- Mapbox vector tiles
|
||||||
- GeoJSON tiles
|
- GeoJSON vector tiles
|
||||||
- Raster tiles: any quadtree-scheme tiles as texture
|
- Raster tiles: any quadtree-scheme tiles as texture
|
||||||
- Backends:
|
- Backends:
|
||||||
- Android (optional libGDX)
|
- Android
|
||||||
- iOS (using libGDX/RoboVM, [instructions](docs/ios.md))
|
- iOS (using libGDX/RoboVM, [instructions](docs/ios.md))
|
||||||
- Desktop (using libGDX/LWJGL)
|
- Desktop (using libGDX/LWJGL)
|
||||||
- HTML5/WebGL (using libGDX/GWT, [instructions](docs/web.md))
|
- HTML5/WebGL (using libGDX/GWT, [instructions](docs/web.md))
|
||||||
|
|
||||||
### Projects
|
### Projects
|
||||||
- **vtm** contains the core library
|
- **vtm** contains the core library
|
||||||
- **vtm-android** Android backend (no libGDX required)
|
- **vtm-android** Android backend
|
||||||
- **vtm-android-example** provides examples using vtm-android
|
- **vtm-android-example** provides examples using vtm-android
|
||||||
- **vtm-gdx** common libGDX backend
|
- **vtm-gdx** common libGDX backend
|
||||||
- **vtm-android-gdx** Android backend (with libGDX)
|
- **vtm-android-gdx** Android backend (with libGDX)
|
||||||
- **vtm-desktop** Desktop backend
|
- **vtm-desktop** Desktop backend
|
||||||
- **vtm-ios** iOS backend
|
- **vtm-ios** iOS backend
|
||||||
|
- **vtm-ios-example** provides examples using vtm-ios
|
||||||
- **vtm-web** HTML5/GWT backend
|
- **vtm-web** HTML5/GWT backend
|
||||||
- **vtm-web-app** HTML5/GWT application
|
- **vtm-web-app** HTML5/GWT application
|
||||||
|
|
||||||
@@ -52,7 +53,7 @@ If you have any questions or problems, don't hesitate to ask our public [mailing
|
|||||||
## Credits
|
## Credits
|
||||||
This library contains code from several projects:
|
This library contains code from several projects:
|
||||||
- **Android** (Apache 2.0): some Matrix code, TimSort (http://source.android.com)
|
- **Android** (Apache 2.0): some Matrix code, TimSort (http://source.android.com)
|
||||||
- **libGDX** (Apache 2.0): AsyncTask, MathUtils and Interpolation classes (https://github.com/libgdx)
|
- **libGDX** (Apache 2.0): AsyncTask, MathUtils, Interpolation, PixmapPacker (https://github.com/libgdx)
|
||||||
- **mapsforge** (LGPL3): based on 0.2.4 (https://github.com/mapsforge/mapsforge)
|
- **mapsforge** (LGPL3): based on 0.2.4 (https://github.com/mapsforge/mapsforge)
|
||||||
- **osmdroid** (Apache 2.0): some overlay classes (https://github.com/osmdroid/osmdroid)
|
- **osmdroid** (Apache 2.0): some overlay classes (https://github.com/osmdroid/osmdroid)
|
||||||
- **tessellate** (SGI Free Software License B 2.0): (https://github.com/cscheid/tessellate)
|
- **tessellate** (SGI Free Software License B 2.0): (https://github.com/cscheid/tessellate)
|
||||||
|
|||||||
12
build.gradle
@@ -3,8 +3,8 @@ buildscript {
|
|||||||
jcenter()
|
jcenter()
|
||||||
}
|
}
|
||||||
dependencies {
|
dependencies {
|
||||||
classpath 'com.android.tools.build:gradle:2.2.3'
|
classpath 'com.android.tools.build:gradle:2.3.3'
|
||||||
classpath 'com.github.dcendents:android-maven-gradle-plugin:1.4.1'
|
classpath 'com.github.dcendents:android-maven-gradle-plugin:1.5'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -13,9 +13,10 @@ allprojects {
|
|||||||
version = 'master-SNAPSHOT'
|
version = 'master-SNAPSHOT'
|
||||||
ext.isReleaseVersion = !version.endsWith("SNAPSHOT")
|
ext.isReleaseVersion = !version.endsWith("SNAPSHOT")
|
||||||
|
|
||||||
ext.androidBuildVersionTools = "25.0.2"
|
ext.androidBuildVersionTools = "26.0.0"
|
||||||
ext.gdxVersion = "1.9.5"
|
ext.gdxVersion = "1.9.6"
|
||||||
ext.gwtVersion = "2.8.0"
|
ext.gwtVersion = "2.8.0"
|
||||||
|
ext.slf4jVersion = "1.7.25"
|
||||||
|
|
||||||
if (JavaVersion.current().isJava8Compatible()) {
|
if (JavaVersion.current().isJava8Compatible()) {
|
||||||
tasks.withType(Javadoc) {
|
tasks.withType(Javadoc) {
|
||||||
@@ -26,7 +27,7 @@ allprojects {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
def androidCompileSdk() { return 25 }
|
def androidCompileSdk() { return 26 }
|
||||||
|
|
||||||
def androidMinSdk() { return 10 }
|
def androidMinSdk() { return 10 }
|
||||||
|
|
||||||
@@ -38,7 +39,6 @@ def versionName() { return version }
|
|||||||
|
|
||||||
subprojects {
|
subprojects {
|
||||||
repositories {
|
repositories {
|
||||||
maven { url 'https://repo.boundlessgeo.com/main' }
|
|
||||||
jcenter()
|
jcenter()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -4,7 +4,14 @@
|
|||||||
|--------|--------|----------------|-------------|-----------|
|
|--------|--------|----------------|-------------|-----------|
|
||||||
| [Cachebox 3.0](https://github.com/Longri/cachebox3.0) | Geocaching application | Apache 2.0/Free | Android, Desktop, iOS | Open |
|
| [Cachebox 3.0](https://github.com/Longri/cachebox3.0) | Geocaching application | Apache 2.0/Free | Android, Desktop, iOS | Open |
|
||||||
| [Cruiser](http://wiki.openstreetmap.org/wiki/Cruiser) | Map and navigation application | Proprietary/Free | Android, Desktop | Closed |
|
| [Cruiser](http://wiki.openstreetmap.org/wiki/Cruiser) | Map and navigation application | Proprietary/Free | Android, Desktop | Closed |
|
||||||
| [Hunt Cyprus](https://play.google.com/store/apps/details?id=gr.talent.hunt.cy17) | Map and navigation application for hunters | Proprietary/Commercial | Android | Closed |
|
| [GCDroid](https://play.google.com/store/apps/details?id=com.gcdroid) | Geocaching App | 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 |
|
||||||
| [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 |
|
||||||
|
| [MyTourbook](http://mytourbook.sourceforge.net/mytourbook/) | Visualize and analyze tours | GPL2/Free | Desktop | Open |
|
||||||
|
| [Navi Cyprus](https://play.google.com/store/apps/developer?id=Talent+S.A.) | Map and navigation application | Proprietary/Free and Commercial | Android | Closed |
|
||||||
|
| [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 |
|
||||||
|
| [VTM with Eclipse RCP](https://github.com/wolfgang-ch/vtm-with-rcp) | VTM with an Eclipse RCP application | GPL3/Free | Desktop | Open |
|
||||||
|
|
||||||
You know an application that is missing here? Please inform us by sending a message via our public [mailing list](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 [mailing list](https://groups.google.com/group/mapsforge-dev).
|
||||||
|
|||||||
@@ -1,20 +1,35 @@
|
|||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
|
## Version 0.8.0 (2017-07-19)
|
||||||
|
|
||||||
|
- Real time (SVG) texture atlas [#63](https://github.com/mapsforge/vtm/issues/63)
|
||||||
|
- Marker clustering [#312](https://github.com/mapsforge/vtm/issues/312)
|
||||||
|
- Osmagray theme [#300](https://github.com/mapsforge/vtm/issues/300)
|
||||||
|
- Symbol rotation [#294](https://github.com/mapsforge/vtm/issues/294)
|
||||||
|
- Location renderer improvements [#317](https://github.com/mapsforge/vtm/issues/317)
|
||||||
|
- POT textures [#334](https://github.com/mapsforge/vtm/issues/334)
|
||||||
|
- OkHttp external cache [#135](https://github.com/mapsforge/vtm/issues/135)
|
||||||
|
- Texture atlas improvements [#301](https://github.com/mapsforge/vtm/pull/301) [#304](https://github.com/mapsforge/vtm/pull/304)
|
||||||
|
- vtm-json module [#367](https://github.com/mapsforge/vtm/issues/367)
|
||||||
|
- Mapzen GeoJSON vector tiles [#55](https://github.com/mapsforge/vtm/issues/55)
|
||||||
|
- vtm-ios-example module [#326](https://github.com/mapsforge/vtm/issues/326)
|
||||||
|
- Handle layers enabled state [#342](https://github.com/mapsforge/vtm/issues/342)
|
||||||
|
- Fix coord scale short overflow [#343](https://github.com/mapsforge/vtm/issues/343)
|
||||||
|
- Mapsforge map read improvements [#357](https://github.com/mapsforge/vtm/issues/357) [#370](https://github.com/mapsforge/vtm/issues/370)
|
||||||
|
- Improve canvas DPI setting [#349](https://github.com/mapsforge/vtm/issues/349)
|
||||||
|
- OSM indoor layer enhancements [#366](https://github.com/mapsforge/vtm/issues/366)
|
||||||
|
- Gretty plugin at web modules [#338](https://github.com/mapsforge/vtm/issues/338)
|
||||||
|
- Disable vtm-jeo module until update [#375](https://github.com/mapsforge/vtm/issues/375)
|
||||||
|
- Many other minor improvements and bug fixes
|
||||||
|
- [Solved issues](https://github.com/mapsforge/vtm/issues?q=is%3Aclosed+milestone%3A0.8.0)
|
||||||
|
|
||||||
## Version 0.7.0 (2017-02-26)
|
## Version 0.7.0 (2017-02-26)
|
||||||
|
|
||||||
- Same as 0.7.0-rc2
|
|
||||||
|
|
||||||
### Version 0.7.0-rc2 (2017-02-20)
|
|
||||||
|
|
||||||
- Fix theme parsing in non-Latin locales [#297](https://github.com/mapsforge/vtm/issues/297)
|
|
||||||
|
|
||||||
### Version 0.7.0-rc1 (2017-02-16)
|
|
||||||
|
|
||||||
- Mapsforge multiple map files [#208](https://github.com/mapsforge/vtm/issues/208)
|
- Mapsforge multiple map files [#208](https://github.com/mapsforge/vtm/issues/208)
|
||||||
- Improved gestures implementation [#253](https://github.com/mapsforge/vtm/issues/253)
|
- Improved gestures implementation [#253](https://github.com/mapsforge/vtm/issues/253)
|
||||||
- Polygon label position enhancements [#80](https://github.com/mapsforge/vtm/issues/80)
|
- Polygon label position enhancements [#80](https://github.com/mapsforge/vtm/issues/80)
|
||||||
- vtm-web modules update [#51](https://github.com/mapsforge/vtm/issues/51)
|
- vtm-web modules update [#51](https://github.com/mapsforge/vtm/issues/51)
|
||||||
- Mapbox (Mapzen) vector tiles [#57](https://github.com/mapsforge/vtm/issues/57)
|
- Mapzen MVT vector tiles [#57](https://github.com/mapsforge/vtm/issues/57)
|
||||||
- SVG resources scaling in themes [#214](https://github.com/mapsforge/vtm/issues/214)
|
- SVG resources scaling in themes [#214](https://github.com/mapsforge/vtm/issues/214)
|
||||||
- Circle map style [#122](https://github.com/mapsforge/vtm/issues/122)
|
- Circle map style [#122](https://github.com/mapsforge/vtm/issues/122)
|
||||||
- Oneway arrows in themes [#275](https://github.com/mapsforge/vtm/issues/275)
|
- Oneway arrows in themes [#275](https://github.com/mapsforge/vtm/issues/275)
|
||||||
@@ -29,24 +44,12 @@
|
|||||||
- Animator enhancements with easing functions [#246](https://github.com/mapsforge/vtm/issues/246)
|
- Animator enhancements with easing functions [#246](https://github.com/mapsforge/vtm/issues/246)
|
||||||
- Tile grid layer scaling [#238](https://github.com/mapsforge/vtm/issues/238)
|
- Tile grid layer scaling [#238](https://github.com/mapsforge/vtm/issues/238)
|
||||||
- Internal render themes new SVG resources [#251](https://github.com/mapsforge/vtm/issues/251)
|
- Internal render themes new SVG resources [#251](https://github.com/mapsforge/vtm/issues/251)
|
||||||
|
- Fix theme parsing in non-Latin locales [#297](https://github.com/mapsforge/vtm/issues/297)
|
||||||
- Internal render themes various improvements [#41](https://github.com/mapsforge/vtm/issues/41)
|
- Internal render themes various improvements [#41](https://github.com/mapsforge/vtm/issues/41)
|
||||||
- Many other minor improvements and bug fixes
|
- Many other minor improvements and bug fixes
|
||||||
- [Solved issues](https://github.com/mapsforge/vtm/issues?q=is%3Aclosed+milestone%3A0.7.0)
|
- [Solved issues](https://github.com/mapsforge/vtm/issues?q=is%3Aclosed+milestone%3A0.7.0)
|
||||||
|
|
||||||
## Version 0.6.0 (2016-10-28) -- VTM revive
|
## Version 0.6.0 (2016-10-28) - VTM revive
|
||||||
|
|
||||||
- Same as 0.6.0-rc3
|
|
||||||
|
|
||||||
### Version 0.6.0-rc3 (2016-10-22)
|
|
||||||
|
|
||||||
- Minor improvements and bug fixes
|
|
||||||
|
|
||||||
### Version 0.6.0-rc2 (2016-10-16)
|
|
||||||
|
|
||||||
- Location layer [#171](https://github.com/mapsforge/vtm/issues/171)
|
|
||||||
- Minor improvements and bug fixes
|
|
||||||
|
|
||||||
### Version 0.6.0-rc1 (2016-10-08)
|
|
||||||
|
|
||||||
- Render theme SVG resources [#60](https://github.com/mapsforge/vtm/issues/60)
|
- Render theme SVG resources [#60](https://github.com/mapsforge/vtm/issues/60)
|
||||||
- Mapsforge multilingual maps [#34](https://github.com/mapsforge/vtm/issues/34)
|
- Mapsforge multilingual maps [#34](https://github.com/mapsforge/vtm/issues/34)
|
||||||
@@ -55,7 +58,7 @@
|
|||||||
- Native libraries for all platforms [#14](https://github.com/mapsforge/vtm/issues/14)
|
- Native libraries for all platforms [#14](https://github.com/mapsforge/vtm/issues/14)
|
||||||
- Line stipple and texture rendering [#105](https://github.com/mapsforge/vtm/issues/105)
|
- Line stipple and texture rendering [#105](https://github.com/mapsforge/vtm/issues/105)
|
||||||
- Layer groups [#99](https://github.com/mapsforge/vtm/issues/99) [#103](https://github.com/mapsforge/vtm/issues/103)
|
- Layer groups [#99](https://github.com/mapsforge/vtm/issues/99) [#103](https://github.com/mapsforge/vtm/issues/103)
|
||||||
- Location renderer [#171](https://github.com/mapsforge/vtm/issues/171)
|
- Location renderer and layer [#171](https://github.com/mapsforge/vtm/issues/171)
|
||||||
- Map scale bar [#84](https://github.com/mapsforge/vtm/issues/84)
|
- Map scale bar [#84](https://github.com/mapsforge/vtm/issues/84)
|
||||||
- Tile size based on scale factor [#183](https://github.com/mapsforge/vtm/issues/183)
|
- Tile size based on scale factor [#183](https://github.com/mapsforge/vtm/issues/183)
|
||||||
- libGDX layer gestures [#151](https://github.com/mapsforge/vtm/issues/151)
|
- libGDX layer gestures [#151](https://github.com/mapsforge/vtm/issues/151)
|
||||||
@@ -67,5 +70,6 @@
|
|||||||
- Internal render themes various improvements [#41](https://github.com/mapsforge/vtm/issues/41)
|
- Internal render themes various improvements [#41](https://github.com/mapsforge/vtm/issues/41)
|
||||||
- LWJGL desktop libGDX backend [#129](https://github.com/mapsforge/vtm/issues/129)
|
- LWJGL desktop libGDX backend [#129](https://github.com/mapsforge/vtm/issues/129)
|
||||||
- SNAPSHOT builds publish to Sonatype OSSRH [#165](https://github.com/mapsforge/vtm/issues/165)
|
- SNAPSHOT builds publish to Sonatype OSSRH [#165](https://github.com/mapsforge/vtm/issues/165)
|
||||||
|
- Available on [Maven Central](http://search.maven.org/#search%7Cga%7C1%7Cg%3A%22org.mapsforge%22)
|
||||||
- Many other minor improvements and bug fixes
|
- Many other minor improvements and bug fixes
|
||||||
- [Solved issues](https://github.com/mapsforge/vtm/issues?q=is%3Aclosed+milestone%3A0.6.0)
|
- [Solved issues](https://github.com/mapsforge/vtm/issues?q=is%3Aclosed+milestone%3A0.6.0)
|
||||||
|
|||||||
@@ -10,15 +10,39 @@ Current version is [
|
||||||
|
```groovy
|
||||||
|
compile 'org.mapsforge:vtm-android:[CURRENT-VERSION]'
|
||||||
|
compile 'org.mapsforge:vtm-android:[CURRENT-VERSION]:natives-arm64-v8a'
|
||||||
compile 'org.mapsforge:vtm-android:[CURRENT-VERSION]:natives-armeabi'
|
compile 'org.mapsforge:vtm-android:[CURRENT-VERSION]:natives-armeabi'
|
||||||
compile 'org.mapsforge:vtm-android:[CURRENT-VERSION]:natives-armeabi-v7a'
|
compile 'org.mapsforge:vtm-android:[CURRENT-VERSION]:natives-armeabi-v7a'
|
||||||
compile 'org.mapsforge:vtm-android:[CURRENT-VERSION]:natives-x86'
|
compile 'org.mapsforge:vtm-android:[CURRENT-VERSION]:natives-x86'
|
||||||
|
compile 'org.mapsforge:vtm-android:[CURRENT-VERSION]:natives-x86_64'
|
||||||
|
compile 'org.mapsforge:vtm-gdx:[CURRENT-VERSION]'
|
||||||
|
compile 'org.mapsforge:vtm-android-gdx:[CURRENT-VERSION]'
|
||||||
|
compile 'org.mapsforge:vtm-android-gdx:[CURRENT-VERSION]:natives-arm64-v8a'
|
||||||
|
compile 'org.mapsforge:vtm-android-gdx:[CURRENT-VERSION]:natives-armeabi'
|
||||||
|
compile 'org.mapsforge:vtm-android-gdx:[CURRENT-VERSION]:natives-armeabi-v7a'
|
||||||
|
compile 'org.mapsforge:vtm-android-gdx:[CURRENT-VERSION]:natives-x86'
|
||||||
|
compile 'org.mapsforge:vtm-android-gdx:[CURRENT-VERSION]:natives-x86_64'
|
||||||
|
compile 'com.badlogicgames.gdx:gdx:1.9.6'
|
||||||
|
compile 'com.badlogicgames.gdx:gdx-backend-android:1.9.6'
|
||||||
compile 'com.caverock:androidsvg:1.2.2-beta-1'
|
compile 'com.caverock:androidsvg:1.2.2-beta-1'
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -33,9 +57,9 @@ compile 'org.mapsforge:vtm-desktop:[CURRENT-VERSION]'
|
|||||||
compile 'org.mapsforge:vtm-desktop:[CURRENT-VERSION]:natives-linux'
|
compile 'org.mapsforge:vtm-desktop:[CURRENT-VERSION]:natives-linux'
|
||||||
compile 'org.mapsforge:vtm-desktop:[CURRENT-VERSION]:natives-osx'
|
compile 'org.mapsforge:vtm-desktop:[CURRENT-VERSION]:natives-osx'
|
||||||
compile 'org.mapsforge:vtm-desktop:[CURRENT-VERSION]:natives-windows'
|
compile 'org.mapsforge:vtm-desktop:[CURRENT-VERSION]:natives-windows'
|
||||||
compile 'com.badlogicgames.gdx:gdx:1.9.5'
|
compile 'com.badlogicgames.gdx:gdx:1.9.6'
|
||||||
compile 'com.badlogicgames.gdx:gdx-platform:1.9.5:natives-desktop'
|
compile 'com.badlogicgames.gdx:gdx-platform:1.9.6:natives-desktop'
|
||||||
compile 'com.badlogicgames.gdx:gdx-backend-lwjgl:1.9.5'
|
compile 'com.badlogicgames.gdx:gdx-backend-lwjgl:1.9.6'
|
||||||
compile 'org.lwjgl.lwjgl:lwjgl:2.9.3'
|
compile 'org.lwjgl.lwjgl:lwjgl:2.9.3'
|
||||||
compile 'org.lwjgl.lwjgl:lwjgl-platform:2.9.3:natives-linux'
|
compile 'org.lwjgl.lwjgl:lwjgl-platform:2.9.3:natives-linux'
|
||||||
compile 'org.lwjgl.lwjgl:lwjgl-platform:2.9.3:natives-osx'
|
compile 'org.lwjgl.lwjgl:lwjgl-platform:2.9.3:natives-osx'
|
||||||
@@ -45,15 +69,10 @@ compile 'com.metsci.ext.com.kitfox.svg:svg-salamander:0.1.19'
|
|||||||
|
|
||||||
## Snapshots
|
## Snapshots
|
||||||
|
|
||||||
We publish regularly SNAPSHOT builds to Sonatype OSS Repository Hosting.
|
We publish SNAPSHOT builds to Sonatype OSS Repository Hosting.
|
||||||
|
|
||||||
You need to add the repository:
|
You need to add the repository:
|
||||||
```groovy
|
```groovy
|
||||||
configurations.all {
|
|
||||||
// check for latest snapshot on every build
|
|
||||||
resolutionStrategy.cacheChangingModulesFor 0, 'seconds'
|
|
||||||
}
|
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
|
maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
|
||||||
}
|
}
|
||||||
@@ -65,6 +84,13 @@ compile 'org.mapsforge:vtm:master-SNAPSHOT'
|
|||||||
...
|
...
|
||||||
```
|
```
|
||||||
|
|
||||||
|
For checking latest snapshot on every build:
|
||||||
|
```groovy
|
||||||
|
configurations.all {
|
||||||
|
resolutionStrategy.cacheChangingModulesFor 0, 'seconds'
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
## Maven
|
## Maven
|
||||||
|
|
||||||
The dependencies for Maven are declared in a similar way. For example:
|
The dependencies for Maven are declared in a similar way. For example:
|
||||||
|
|||||||
@@ -5,5 +5,6 @@
|
|||||||
- [Locusvectormaps](http://www.locusvectormaps.com)
|
- [Locusvectormaps](http://www.locusvectormaps.com)
|
||||||
- [Mapsforge](http://download.mapsforge.org/)
|
- [Mapsforge](http://download.mapsforge.org/)
|
||||||
- [OpenAndroMaps](http://www.openandromaps.org/en/)
|
- [OpenAndroMaps](http://www.openandromaps.org/en/)
|
||||||
|
- [OpenMaps](http://openmaps.eu/)
|
||||||
|
|
||||||
You know a Mapsforge map provider that is missing here? Please inform us by sending a message via our public [mailing list](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 [mailing list](https://groups.google.com/group/mapsforge-dev).
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
### Web implementation
|
### Web implementation
|
||||||
|
|
||||||
`./gradlew :vtm-web-app:jettyDraftWar` will run standalone Jetty server at port 8080.
|
`./gradlew :vtm-web-app:farmRun` will run standalone web server at port 8080.
|
||||||
|
|
||||||
Then go to `http://localhost:8080/vtm-web-app` in the web browser to see the map.
|
Then go to [http://localhost:8080/vtm-web-app](http://localhost:8080/vtm-web-app) in the web browser to see the map.
|
||||||
|
|
||||||
Hold right mouse button to change view direction.
|
Hold right mouse button to change view direction.
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
|
|
||||||
# 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=-Xmx1536m
|
||||||
|
|
||||||
# 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
|
||||||
|
|||||||
4
gradle/wrapper/gradle-wrapper.properties
vendored
@@ -1,6 +1,6 @@
|
|||||||
#Tue Aug 16 13:14:49 EEST 2016
|
#Fri Mar 03 12:50:23 EET 2017
|
||||||
distributionBase=GRADLE_USER_HOME
|
distributionBase=GRADLE_USER_HOME
|
||||||
distributionPath=wrapper/dists
|
distributionPath=wrapper/dists
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
zipStorePath=wrapper/dists
|
zipStorePath=wrapper/dists
|
||||||
distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-all.zip
|
distributionUrl=https\://services.gradle.org/distributions/gradle-3.3-all.zip
|
||||||
|
|||||||
@@ -84,6 +84,7 @@
|
|||||||
<xs:restriction base="xs:string">
|
<xs:restriction base="xs:string">
|
||||||
<xs:enumeration value="ele" />
|
<xs:enumeration value="ele" />
|
||||||
<xs:enumeration value="addr:housenumber" />
|
<xs:enumeration value="addr:housenumber" />
|
||||||
|
<xs:enumeration value="addr_housenumber" /> <!-- Mapzen -->
|
||||||
<xs:enumeration value="name" />
|
<xs:enumeration value="name" />
|
||||||
<xs:enumeration value="ref" />
|
<xs:enumeration value="ref" />
|
||||||
</xs:restriction>
|
</xs:restriction>
|
||||||
|
|||||||
@@ -1,19 +1,21 @@
|
|||||||
rootProject.name = 'vtm-parent'
|
rootProject.name = 'vtm-parent'
|
||||||
include ':vtm'
|
include ':vtm'
|
||||||
include ':vtm-http'
|
|
||||||
include ':vtm-jts'
|
|
||||||
include ':vtm-tests'
|
|
||||||
include ':vtm-extras'
|
|
||||||
include ':vtm-android'
|
include ':vtm-android'
|
||||||
include ':vtm-android-example'
|
include ':vtm-android-example'
|
||||||
include ':vtm-themes'
|
|
||||||
include ':vtm-gdx'
|
|
||||||
include ':vtm-desktop'
|
|
||||||
include ':vtm-android-gdx'
|
include ':vtm-android-gdx'
|
||||||
|
include ':vtm-app'
|
||||||
|
include ':vtm-desktop'
|
||||||
|
include ':vtm-extras'
|
||||||
|
include ':vtm-gdx'
|
||||||
|
include ':vtm-http'
|
||||||
|
include ':vtm-ios'
|
||||||
|
include ':vtm-ios-example'
|
||||||
|
//include ':vtm-jeo'
|
||||||
|
include ':vtm-json'
|
||||||
|
include ':vtm-jts'
|
||||||
|
include ':vtm-playground'
|
||||||
|
include ':vtm-tests'
|
||||||
|
include ':vtm-themes'
|
||||||
include ':vtm-web'
|
include ':vtm-web'
|
||||||
include ':vtm-web-app'
|
include ':vtm-web-app'
|
||||||
//include ':vtm-web-js'
|
//include ':vtm-web-js'
|
||||||
include ':vtm-jeo'
|
|
||||||
include ':vtm-playground'
|
|
||||||
include ':vtm-ios'
|
|
||||||
include ':vtm-app'
|
|
||||||
|
|||||||
@@ -29,12 +29,21 @@
|
|||||||
<activity
|
<activity
|
||||||
android:name=".AtlasMarkerOverlayActivity"
|
android:name=".AtlasMarkerOverlayActivity"
|
||||||
android:configChanges="keyboardHidden|orientation|screenSize" />
|
android:configChanges="keyboardHidden|orientation|screenSize" />
|
||||||
|
<activity
|
||||||
|
android:name=".AtlasMultiTextureActivity"
|
||||||
|
android:configChanges="keyboardHidden|orientation|screenSize" />
|
||||||
|
<activity
|
||||||
|
android:name=".AtlasThemeActivity"
|
||||||
|
android:configChanges="keyboardHidden|orientation|screenSize" />
|
||||||
<activity
|
<activity
|
||||||
android:name=".BitmapTileMapActivity"
|
android:name=".BitmapTileMapActivity"
|
||||||
android:configChanges="keyboardHidden|orientation|screenSize" />
|
android:configChanges="keyboardHidden|orientation|screenSize" />
|
||||||
<activity
|
<activity
|
||||||
android:name=".JeoIndoorMapActivity"
|
android:name=".ClusterMarkerOverlayActivity"
|
||||||
android:configChanges="keyboardHidden|orientation|screenSize" />
|
android:configChanges="keyboardHidden|orientation|screenSize" />
|
||||||
|
<!--<activity
|
||||||
|
android:name=".JeoIndoorMapActivity"
|
||||||
|
android:configChanges="keyboardHidden|orientation|screenSize" />-->
|
||||||
<activity
|
<activity
|
||||||
android:name=".LayerGroupActivity"
|
android:name=".LayerGroupActivity"
|
||||||
android:configChanges="keyboardHidden|orientation|screenSize" />
|
android:configChanges="keyboardHidden|orientation|screenSize" />
|
||||||
@@ -44,9 +53,6 @@
|
|||||||
<activity
|
<activity
|
||||||
android:name=".LocationActivity"
|
android:name=".LocationActivity"
|
||||||
android:configChanges="keyboardHidden|orientation|screenSize" />
|
android:configChanges="keyboardHidden|orientation|screenSize" />
|
||||||
<activity
|
|
||||||
android:name=".MapboxMapActivity"
|
|
||||||
android:configChanges="keyboardHidden|orientation|screenSize" />
|
|
||||||
<activity
|
<activity
|
||||||
android:name=".MapFragmentActivity"
|
android:name=".MapFragmentActivity"
|
||||||
android:configChanges="keyboardHidden|orientation|screenSize" />
|
android:configChanges="keyboardHidden|orientation|screenSize" />
|
||||||
@@ -62,6 +68,12 @@
|
|||||||
<activity
|
<activity
|
||||||
android:name=".MapsforgeStyleActivity"
|
android:name=".MapsforgeStyleActivity"
|
||||||
android:configChanges="keyboardHidden|orientation|screenSize" />
|
android:configChanges="keyboardHidden|orientation|screenSize" />
|
||||||
|
<activity
|
||||||
|
android:name=".MapzenGeojsonMapActivity"
|
||||||
|
android:configChanges="keyboardHidden|orientation|screenSize" />
|
||||||
|
<activity
|
||||||
|
android:name=".MapzenMvtMapActivity"
|
||||||
|
android:configChanges="keyboardHidden|orientation|screenSize" />
|
||||||
<activity
|
<activity
|
||||||
android:name=".MarkerOverlayActivity"
|
android:name=".MarkerOverlayActivity"
|
||||||
android:configChanges="keyboardHidden|orientation|screenSize" />
|
android:configChanges="keyboardHidden|orientation|screenSize" />
|
||||||
@@ -72,10 +84,13 @@
|
|||||||
android:name=".NewGesturesActivity"
|
android:name=".NewGesturesActivity"
|
||||||
android:configChanges="keyboardHidden|orientation|screenSize" />
|
android:configChanges="keyboardHidden|orientation|screenSize" />
|
||||||
<activity
|
<activity
|
||||||
android:name=".OsmJsonMapActivity"
|
android:name=".PathOverlayActivity"
|
||||||
android:configChanges="keyboardHidden|orientation|screenSize" />
|
android:configChanges="keyboardHidden|orientation|screenSize" />
|
||||||
<activity
|
<activity
|
||||||
android:name=".PathOverlayActivity"
|
android:name=".POTTextureActivity"
|
||||||
|
android:configChanges="keyboardHidden|orientation|screenSize" />
|
||||||
|
<activity
|
||||||
|
android:name=".RotateMarkerOverlayActivity"
|
||||||
android:configChanges="keyboardHidden|orientation|screenSize" />
|
android:configChanges="keyboardHidden|orientation|screenSize" />
|
||||||
<activity
|
<activity
|
||||||
android:name=".S3DBMapActivity"
|
android:name=".S3DBMapActivity"
|
||||||
|
|||||||
@@ -4,13 +4,14 @@ dependencies {
|
|||||||
compile project(':vtm-android')
|
compile project(':vtm-android')
|
||||||
compile project(':vtm-extras')
|
compile project(':vtm-extras')
|
||||||
compile project(':vtm-http')
|
compile project(':vtm-http')
|
||||||
compile(project(':vtm-jeo')) {
|
/*compile(project(':vtm-jeo')) {
|
||||||
exclude group: 'com.vividsolutions', module: 'jts'
|
exclude group: 'com.vividsolutions', module: 'jts'
|
||||||
}
|
}*/
|
||||||
|
compile project(':vtm-json')
|
||||||
compile project(':vtm-jts')
|
compile project(':vtm-jts')
|
||||||
compile project(':vtm-themes')
|
compile project(':vtm-themes')
|
||||||
compile 'com.noveogroup.android:android-logger:1.3.6'
|
compile 'com.noveogroup.android:android-logger:1.3.6'
|
||||||
compile 'com.android.support:support-v4:25.2.0'
|
compile 'com.android.support:support-v4:25.3.1'
|
||||||
}
|
}
|
||||||
|
|
||||||
android {
|
android {
|
||||||
|
|||||||
@@ -8,12 +8,15 @@
|
|||||||
android:id="@+id/theme_default"
|
android:id="@+id/theme_default"
|
||||||
android:checked="true"
|
android:checked="true"
|
||||||
android:title="@string/theme_default" />
|
android:title="@string/theme_default" />
|
||||||
<item
|
|
||||||
android:id="@+id/theme_tubes"
|
|
||||||
android:title="@string/theme_tubes" />
|
|
||||||
<item
|
<item
|
||||||
android:id="@+id/theme_osmarender"
|
android:id="@+id/theme_osmarender"
|
||||||
android:title="@string/theme_osmarender" />
|
android:title="@string/theme_osmarender" />
|
||||||
|
<item
|
||||||
|
android:id="@+id/theme_osmagray"
|
||||||
|
android:title="@string/theme_osmagray" />
|
||||||
|
<item
|
||||||
|
android:id="@+id/theme_tubes"
|
||||||
|
android:title="@string/theme_tubes" />
|
||||||
<item
|
<item
|
||||||
android:id="@+id/theme_newtron"
|
android:id="@+id/theme_newtron"
|
||||||
android:title="@string/theme_newtron" />
|
android:title="@string/theme_newtron" />
|
||||||
|
|||||||
@@ -2,8 +2,9 @@
|
|||||||
|
|
||||||
<string name="app_name">VTM Samples</string>
|
<string name="app_name">VTM Samples</string>
|
||||||
<string name="theme_default">Default</string>
|
<string name="theme_default">Default</string>
|
||||||
<string name="theme_tubes">Tubes</string>
|
|
||||||
<string name="theme_osmarender">Osmarender</string>
|
<string name="theme_osmarender">Osmarender</string>
|
||||||
|
<string name="theme_osmagray">Osmagray</string>
|
||||||
|
<string name="theme_tubes">Tubes</string>
|
||||||
<string name="theme_newtron">NewTron</string>
|
<string name="theme_newtron">NewTron</string>
|
||||||
<string name="ok">OK</string>
|
<string name="ok">OK</string>
|
||||||
<string name="cancel">Cancel</string>
|
<string name="cancel">Cancel</string>
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2014 Hannes Janetzek
|
* Copyright 2014 Hannes Janetzek
|
||||||
* Copyright 2016 devemux86
|
* Copyright 2016-2017 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,17 +19,20 @@
|
|||||||
package org.oscim.android.test;
|
package org.oscim.android.test;
|
||||||
|
|
||||||
import android.graphics.drawable.Drawable;
|
import android.graphics.drawable.Drawable;
|
||||||
import android.os.Bundle;
|
|
||||||
|
|
||||||
import org.oscim.backend.canvas.Bitmap;
|
import org.oscim.backend.canvas.Bitmap;
|
||||||
import org.oscim.core.GeoPoint;
|
import org.oscim.core.GeoPoint;
|
||||||
import org.oscim.layers.TileGridLayer;
|
|
||||||
import org.oscim.layers.marker.ItemizedLayer;
|
import org.oscim.layers.marker.ItemizedLayer;
|
||||||
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.buildings.BuildingLayer;
|
||||||
|
import org.oscim.layers.tile.vector.VectorTileLayer;
|
||||||
|
import org.oscim.layers.tile.vector.labeling.LabelLayer;
|
||||||
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.theme.VtmThemes;
|
||||||
|
import org.oscim.tiling.source.oscimap4.OSciMap4TileSource;
|
||||||
import org.oscim.utils.TextureAtlasUtils;
|
import org.oscim.utils.TextureAtlasUtils;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@@ -38,17 +41,18 @@ import java.util.List;
|
|||||||
|
|
||||||
import static org.oscim.android.canvas.AndroidGraphics.drawableToBitmap;
|
import static org.oscim.android.canvas.AndroidGraphics.drawableToBitmap;
|
||||||
|
|
||||||
public class AtlasMarkerOverlayActivity extends MarkerOverlayActivity
|
public class AtlasMarkerOverlayActivity extends MarkerOverlayActivity {
|
||||||
implements ItemizedLayer.OnItemGestureListener<MarkerItem> {
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onCreate(Bundle savedInstanceState) {
|
void createLayers() {
|
||||||
super.onCreate(savedInstanceState);
|
|
||||||
mBitmapLayer.tileRenderer().setBitmapAlpha(0.5f);
|
|
||||||
|
|
||||||
// Map events receiver
|
// Map events receiver
|
||||||
mMap.layers().add(new MapEventsReceiver(mMap));
|
mMap.layers().add(new MapEventsReceiver(mMap));
|
||||||
|
|
||||||
|
VectorTileLayer l = mMap.setBaseMap(new OSciMap4TileSource());
|
||||||
|
mMap.layers().add(new BuildingLayer(mMap, l));
|
||||||
|
mMap.layers().add(new LabelLayer(mMap, l));
|
||||||
|
mMap.setTheme(VtmThemes.DEFAULT);
|
||||||
|
|
||||||
/* directly load bitmap from resources */
|
/* directly load bitmap from resources */
|
||||||
Bitmap bitmapPoi = drawableToBitmap(getResources(), R.drawable.marker_poi);
|
Bitmap bitmapPoi = drawableToBitmap(getResources(), R.drawable.marker_poi);
|
||||||
|
|
||||||
@@ -79,11 +83,8 @@ public class AtlasMarkerOverlayActivity extends MarkerOverlayActivity
|
|||||||
else
|
else
|
||||||
mFocusMarker = new MarkerSymbol(regionsMap.get("focus"), HotspotPlace.CENTER, false);
|
mFocusMarker = new MarkerSymbol(regionsMap.get("focus"), HotspotPlace.CENTER, false);
|
||||||
|
|
||||||
ItemizedLayer<MarkerItem> markerLayer =
|
mMarkerLayer = new ItemizedLayer<>(mMap, new ArrayList<MarkerItem>(), symbol, this);
|
||||||
new ItemizedLayer<>(mMap, new ArrayList<MarkerItem>(),
|
mMap.layers().add(mMarkerLayer);
|
||||||
symbol, this);
|
|
||||||
|
|
||||||
mMap.layers().add(markerLayer);
|
|
||||||
|
|
||||||
List<MarkerItem> pts = new ArrayList<>();
|
List<MarkerItem> pts = new ArrayList<>();
|
||||||
|
|
||||||
@@ -92,8 +93,6 @@ public class AtlasMarkerOverlayActivity extends MarkerOverlayActivity
|
|||||||
pts.add(new MarkerItem(lat + "/" + lon, "", new GeoPoint(lat, lon)));
|
pts.add(new MarkerItem(lat + "/" + lon, "", new GeoPoint(lat, lon)));
|
||||||
}
|
}
|
||||||
|
|
||||||
markerLayer.addItems(pts);
|
mMarkerLayer.addItems(pts);
|
||||||
|
|
||||||
mMap.layers().add(new TileGridLayer(mMap, getResources().getDisplayMetrics().density));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,115 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2014 Hannes Janetzek
|
||||||
|
* Copyright 2016-2017 devemux86
|
||||||
|
* Copyright 2017 Longri
|
||||||
|
*
|
||||||
|
* This file is part of the OpenScienceMap project (http://www.opensciencemap.org).
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify it under the
|
||||||
|
* terms of the GNU Lesser General Public License as published by the Free Software
|
||||||
|
* Foundation, either version 3 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||||
|
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||||
|
* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public License along with
|
||||||
|
* this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
package org.oscim.android.test;
|
||||||
|
|
||||||
|
import android.widget.Toast;
|
||||||
|
|
||||||
|
import org.oscim.backend.CanvasAdapter;
|
||||||
|
import org.oscim.backend.canvas.Bitmap;
|
||||||
|
import org.oscim.backend.canvas.Canvas;
|
||||||
|
import org.oscim.backend.canvas.Color;
|
||||||
|
import org.oscim.backend.canvas.Paint;
|
||||||
|
import org.oscim.core.GeoPoint;
|
||||||
|
import org.oscim.layers.marker.ItemizedLayer;
|
||||||
|
import org.oscim.layers.marker.MarkerItem;
|
||||||
|
import org.oscim.layers.marker.MarkerSymbol;
|
||||||
|
import org.oscim.layers.marker.MarkerSymbol.HotspotPlace;
|
||||||
|
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.atlas.TextureAtlas;
|
||||||
|
import org.oscim.renderer.atlas.TextureRegion;
|
||||||
|
import org.oscim.theme.VtmThemes;
|
||||||
|
import org.oscim.tiling.source.oscimap4.OSciMap4TileSource;
|
||||||
|
import org.oscim.utils.TextureAtlasUtils;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.LinkedHashMap;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class AtlasMultiTextureActivity extends MarkerOverlayActivity {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
void createLayers() {
|
||||||
|
// Map events receiver
|
||||||
|
mMap.layers().add(new MapEventsReceiver(mMap));
|
||||||
|
|
||||||
|
VectorTileLayer l = mMap.setBaseMap(new OSciMap4TileSource());
|
||||||
|
mMap.layers().add(new BuildingLayer(mMap, l));
|
||||||
|
mMap.layers().add(new LabelLayer(mMap, l));
|
||||||
|
mMap.setTheme(VtmThemes.DEFAULT);
|
||||||
|
|
||||||
|
// Create Atlas from Bitmaps
|
||||||
|
java.util.Map<Object, Bitmap> inputMap = new LinkedHashMap<>();
|
||||||
|
java.util.Map<Object, TextureRegion> regionsMap = new LinkedHashMap<>();
|
||||||
|
List<TextureAtlas> atlasList = new ArrayList<>();
|
||||||
|
|
||||||
|
float scale = getResources().getDisplayMetrics().density;
|
||||||
|
Canvas canvas = CanvasAdapter.newCanvas();
|
||||||
|
Paint paint = CanvasAdapter.newPaint();
|
||||||
|
paint.setTypeface(Paint.FontFamily.DEFAULT, Paint.FontStyle.NORMAL);
|
||||||
|
paint.setTextSize(12 * scale);
|
||||||
|
paint.setStrokeWidth(2 * scale);
|
||||||
|
paint.setColor(Color.BLACK);
|
||||||
|
List<MarkerItem> pts = new ArrayList<>();
|
||||||
|
for (double lat = -90; lat <= 90; lat += 10) {
|
||||||
|
for (double lon = -180; lon <= 180; lon += 10) {
|
||||||
|
String title = lat + "/" + lon;
|
||||||
|
pts.add(new MarkerItem(title, "", new GeoPoint(lat, lon)));
|
||||||
|
|
||||||
|
Bitmap bmp = CanvasAdapter.newBitmap((int) (40 * scale), (int) (40 * scale), 0);
|
||||||
|
canvas.setBitmap(bmp);
|
||||||
|
canvas.fillColor(Color.GREEN);
|
||||||
|
|
||||||
|
canvas.drawText(Double.toString(lat), 3 * scale, 17 * scale, paint);
|
||||||
|
canvas.drawText(Double.toString(lon), 3 * scale, 35 * scale, paint);
|
||||||
|
inputMap.put(title, bmp);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Bitmaps will never used any more
|
||||||
|
// With iOS we must flip the Y-Axis
|
||||||
|
TextureAtlasUtils.createTextureRegions(inputMap, regionsMap, atlasList, true, false);
|
||||||
|
|
||||||
|
mMarkerLayer = new ItemizedLayer<>(mMap, new ArrayList<MarkerItem>(), (MarkerSymbol) null, this);
|
||||||
|
mMap.layers().add(mMarkerLayer);
|
||||||
|
|
||||||
|
mMarkerLayer.addItems(pts);
|
||||||
|
|
||||||
|
// set all markers
|
||||||
|
for (MarkerItem item : pts) {
|
||||||
|
MarkerSymbol markerSymbol = new MarkerSymbol(regionsMap.get(item.getTitle()), HotspotPlace.BOTTOM_CENTER);
|
||||||
|
item.setMarker(markerSymbol);
|
||||||
|
}
|
||||||
|
|
||||||
|
Toast.makeText(this, "Atlas count: " + atlasList.size(), Toast.LENGTH_SHORT).show();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onItemSingleTapUp(int index, MarkerItem item) {
|
||||||
|
Toast.makeText(this, "Marker tap\n" + item.getTitle(), Toast.LENGTH_SHORT).show();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onItemLongPress(int index, MarkerItem item) {
|
||||||
|
Toast.makeText(this, "Marker long press\n" + item.getTitle(), Toast.LENGTH_SHORT).show();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,30 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2017 Longri
|
||||||
|
* Copyright 2017 devemux86
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify it under the
|
||||||
|
* terms of the GNU Lesser General Public License as published by the Free Software
|
||||||
|
* Foundation, either version 3 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||||
|
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||||
|
* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public License along with
|
||||||
|
* this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
package org.oscim.android.test;
|
||||||
|
|
||||||
|
import android.os.Bundle;
|
||||||
|
|
||||||
|
import org.oscim.theme.ThemeLoader;
|
||||||
|
|
||||||
|
public class AtlasThemeActivity extends SimpleMapActivity {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onCreate(Bundle savedInstanceState) {
|
||||||
|
ThemeLoader.USE_ATLAS = true;
|
||||||
|
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2013 Hannes Janetzek
|
* Copyright 2013 Hannes Janetzek
|
||||||
* Copyright 2016 devemux86
|
* Copyright 2016-2017 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).
|
||||||
*
|
*
|
||||||
@@ -86,13 +86,18 @@ public class BaseMapActivity extends MapActivity {
|
|||||||
item.setChecked(true);
|
item.setChecked(true);
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
case R.id.theme_tubes:
|
case R.id.theme_osmarender:
|
||||||
mMap.setTheme(VtmThemes.TRONRENDER);
|
mMap.setTheme(VtmThemes.OSMARENDER);
|
||||||
item.setChecked(true);
|
item.setChecked(true);
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
case R.id.theme_osmarender:
|
case R.id.theme_osmagray:
|
||||||
mMap.setTheme(VtmThemes.OSMARENDER);
|
mMap.setTheme(VtmThemes.OSMAGRAY);
|
||||||
|
item.setChecked(true);
|
||||||
|
return true;
|
||||||
|
|
||||||
|
case R.id.theme_tubes:
|
||||||
|
mMap.setTheme(VtmThemes.TRONRENDER);
|
||||||
item.setChecked(true);
|
item.setChecked(true);
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2014 Hannes Janetzek
|
* Copyright 2014 Hannes Janetzek
|
||||||
|
* Copyright 2017 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,10 +18,8 @@ package org.oscim.android.test;
|
|||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
|
||||||
import org.oscim.android.cache.TileCache;
|
import org.oscim.android.cache.TileCache;
|
||||||
import org.oscim.backend.canvas.Color;
|
|
||||||
import org.oscim.core.MapPosition;
|
import org.oscim.core.MapPosition;
|
||||||
import org.oscim.core.MercatorProjection;
|
import org.oscim.core.MercatorProjection;
|
||||||
import org.oscim.layers.TileGridLayer;
|
|
||||||
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.bitmap.BitmapTileSource;
|
import org.oscim.tiling.source.bitmap.BitmapTileSource;
|
||||||
@@ -53,7 +52,6 @@ public class BitmapTileMapActivity extends MapActivity {
|
|||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
|
|
||||||
MapRenderer.setBackgroundColor(0xff777777);
|
MapRenderer.setBackgroundColor(0xff777777);
|
||||||
mMap.layers().add(new TileGridLayer(mMap, Color.GRAY, 1.8f, 8));
|
|
||||||
|
|
||||||
if (mTileSource == null)
|
if (mTileSource == null)
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -0,0 +1,87 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2016-2017 devemux86
|
||||||
|
* Copyright 2017 nebular
|
||||||
|
*
|
||||||
|
* 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 org.oscim.backend.canvas.Bitmap;
|
||||||
|
import org.oscim.backend.canvas.Color;
|
||||||
|
import org.oscim.core.GeoPoint;
|
||||||
|
import org.oscim.layers.marker.ClusterMarkerRenderer;
|
||||||
|
import org.oscim.layers.marker.ItemizedLayer;
|
||||||
|
import org.oscim.layers.marker.MarkerItem;
|
||||||
|
import org.oscim.layers.marker.MarkerSymbol;
|
||||||
|
import org.oscim.layers.tile.buildings.BuildingLayer;
|
||||||
|
import org.oscim.layers.tile.vector.VectorTileLayer;
|
||||||
|
import org.oscim.layers.tile.vector.labeling.LabelLayer;
|
||||||
|
import org.oscim.theme.VtmThemes;
|
||||||
|
import org.oscim.tiling.source.oscimap4.OSciMap4TileSource;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import static org.oscim.android.canvas.AndroidGraphics.drawableToBitmap;
|
||||||
|
|
||||||
|
public class ClusterMarkerOverlayActivity extends MarkerOverlayActivity {
|
||||||
|
|
||||||
|
private static final int COUNT = 5;
|
||||||
|
private static final float STEP = 100f / 110000f; // roughly 100 meters
|
||||||
|
|
||||||
|
@Override
|
||||||
|
void createLayers() {
|
||||||
|
// Map events receiver
|
||||||
|
mMap.layers().add(new MapEventsReceiver(mMap));
|
||||||
|
|
||||||
|
VectorTileLayer l = mMap.setBaseMap(new OSciMap4TileSource());
|
||||||
|
mMap.layers().add(new BuildingLayer(mMap, l));
|
||||||
|
mMap.layers().add(new LabelLayer(mMap, l));
|
||||||
|
mMap.setTheme(VtmThemes.DEFAULT);
|
||||||
|
|
||||||
|
Bitmap bitmapPoi = drawableToBitmap(getResources(), R.drawable.marker_poi);
|
||||||
|
MarkerSymbol symbol;
|
||||||
|
if (BILLBOARDS)
|
||||||
|
symbol = new MarkerSymbol(bitmapPoi, MarkerSymbol.HotspotPlace.BOTTOM_CENTER);
|
||||||
|
else
|
||||||
|
symbol = new MarkerSymbol(bitmapPoi, MarkerSymbol.HotspotPlace.CENTER, false);
|
||||||
|
|
||||||
|
mMarkerLayer = new ItemizedLayer<>(
|
||||||
|
mMap,
|
||||||
|
new ArrayList<MarkerItem>(),
|
||||||
|
ClusterMarkerRenderer.factory(symbol, new ClusterMarkerRenderer.ClusterStyle(Color.WHITE, Color.BLUE)),
|
||||||
|
this);
|
||||||
|
mMap.layers().add(mMarkerLayer);
|
||||||
|
|
||||||
|
// Create some markers spaced STEP degrees
|
||||||
|
List<MarkerItem> pts = new ArrayList<>();
|
||||||
|
GeoPoint center = mMap.getMapPosition().getGeoPoint();
|
||||||
|
for (int x = -COUNT; x < COUNT; x++) {
|
||||||
|
for (int y = -COUNT; y < COUNT; y++) {
|
||||||
|
double random = STEP * Math.random() * 2;
|
||||||
|
MarkerItem item = new MarkerItem(y + ", " + x, "",
|
||||||
|
new GeoPoint(center.getLatitude() + y * STEP + random, center.getLongitude() + x * STEP + random)
|
||||||
|
);
|
||||||
|
pts.add(item);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
mMarkerLayer.addItems(pts);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onResume() {
|
||||||
|
super.onResume();
|
||||||
|
|
||||||
|
/* ignore saved position */
|
||||||
|
mMap.setMapPosition(53.08, 8.83, 1 << 15);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,178 +1,186 @@
|
|||||||
/*
|
///*
|
||||||
* Copyright 2016 devemux86
|
// * Copyright 2014 Hannes Janetzek
|
||||||
*
|
// * Copyright 2016-2017 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).
|
||||||
* 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
|
// * This program is free software: you can redistribute it and/or modify it under the
|
||||||
* Foundation, either version 3 of the License, or (at your option) any later version.
|
// * 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
|
// * This program is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||||
* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
|
// * 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/>.
|
// * 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;
|
// */
|
||||||
|
//package org.oscim.android.test;
|
||||||
import android.content.Context;
|
//
|
||||||
import android.os.Bundle;
|
//import android.content.Context;
|
||||||
import android.view.View;
|
//import android.os.Bundle;
|
||||||
import android.widget.Toast;
|
//import android.view.View;
|
||||||
import android.widget.ToggleButton;
|
//import android.widget.Toast;
|
||||||
|
//import android.widget.ToggleButton;
|
||||||
import org.jeo.map.Style;
|
//
|
||||||
import org.jeo.vector.VectorDataset;
|
//import org.jeo.map.Style;
|
||||||
import org.oscim.layers.OSMIndoorLayer;
|
//import org.jeo.vector.VectorDataset;
|
||||||
import org.oscim.layers.tile.buildings.BuildingLayer;
|
//import org.oscim.backend.canvas.Color;
|
||||||
import org.oscim.layers.tile.vector.labeling.LabelLayer;
|
//import org.oscim.layers.OSMIndoorLayer;
|
||||||
import org.oscim.test.JeoTest;
|
//import org.oscim.layers.tile.buildings.BuildingLayer;
|
||||||
import org.oscim.theme.VtmThemes;
|
//import org.oscim.layers.tile.vector.labeling.LabelLayer;
|
||||||
import org.oscim.utils.IOUtils;
|
//import org.oscim.test.JeoTest;
|
||||||
import org.slf4j.Logger;
|
//import org.oscim.theme.VtmThemes;
|
||||||
import org.slf4j.LoggerFactory;
|
//import org.oscim.theme.styles.TextStyle;
|
||||||
|
//import org.oscim.utils.IOUtils;
|
||||||
import java.io.IOException;
|
//import org.slf4j.Logger;
|
||||||
import java.io.InputStream;
|
//import org.slf4j.LoggerFactory;
|
||||||
import java.net.URL;
|
//
|
||||||
import java.net.URLConnection;
|
//import java.io.IOException;
|
||||||
import java.util.Arrays;
|
//import java.io.InputStream;
|
||||||
|
//import java.net.URL;
|
||||||
public class JeoIndoorMapActivity extends BaseMapActivity {
|
//import java.net.URLConnection;
|
||||||
public static final Logger log = LoggerFactory.getLogger(JeoIndoorMapActivity.class);
|
//import java.util.Arrays;
|
||||||
|
//
|
||||||
// from http://overpass-turbo.eu/s/2vp
|
//public class JeoIndoorMapActivity extends BaseMapActivity {
|
||||||
String PATH = "https://gist.github.com/anonymous/8960337/raw/overpass.geojson";
|
// public static final Logger log = LoggerFactory.getLogger(JeoIndoorMapActivity.class);
|
||||||
//String PATH = "https://gist.github.com/hjanetzek/9280925/raw/overpass.geojson";
|
//
|
||||||
|
// // from http://overpass-turbo.eu/s/2vp
|
||||||
private OSMIndoorLayer mIndoorLayer;
|
// String PATH = "https://gist.githubusercontent.com/anonymous/09062103a66844a96048f25626078c8d/raw/1d3af6a5a55e9ea4adc9551fa633a051a44a5a9c/overpass.geojson";
|
||||||
|
//
|
||||||
public JeoIndoorMapActivity() {
|
// private OSMIndoorLayer mIndoorLayer;
|
||||||
super(R.layout.jeo_indoor_map);
|
//
|
||||||
}
|
// public JeoIndoorMapActivity() {
|
||||||
|
// super(R.layout.jeo_indoor_map);
|
||||||
@Override
|
// }
|
||||||
public void onCreate(Bundle savedInstanceState) {
|
//
|
||||||
super.onCreate(savedInstanceState);
|
// @Override
|
||||||
|
// public void onCreate(Bundle savedInstanceState) {
|
||||||
mMap.addTask(new Runnable() {
|
// super.onCreate(savedInstanceState);
|
||||||
@Override
|
//
|
||||||
public void run() {
|
// mMap.addTask(new Runnable() {
|
||||||
showToast("load data");
|
// @Override
|
||||||
InputStream is = null;
|
// public void run() {
|
||||||
try {
|
// showToast("load data");
|
||||||
// File file = new File(Environment.getExternalStorageDirectory()
|
// InputStream is = null;
|
||||||
// .getAbsolutePath(), "osmindoor.json");
|
// try {
|
||||||
// is = new FileInputStream(file);
|
// // File file = new File(Environment.getExternalStorageDirectory()
|
||||||
|
// // .getAbsolutePath(), "osmindoor.json");
|
||||||
URL url = new URL(PATH);
|
// // is = new FileInputStream(file);
|
||||||
URLConnection conn = url.openConnection();
|
//
|
||||||
is = conn.getInputStream();
|
// URL url = new URL(PATH);
|
||||||
loadJson(is);
|
// URLConnection conn = url.openConnection();
|
||||||
} catch (IOException e) {
|
// is = conn.getInputStream();
|
||||||
e.printStackTrace();
|
// loadJson(is);
|
||||||
} finally {
|
// } catch (IOException e) {
|
||||||
IOUtils.closeQuietly(is);
|
// e.printStackTrace();
|
||||||
}
|
// } finally {
|
||||||
}
|
// IOUtils.closeQuietly(is);
|
||||||
});
|
// }
|
||||||
|
// }
|
||||||
mMap.setTheme(VtmThemes.DEFAULT);
|
// });
|
||||||
|
//
|
||||||
mMap.layers().add(new BuildingLayer(mMap, mBaseLayer));
|
// mMap.setTheme(VtmThemes.DEFAULT);
|
||||||
mMap.layers().add(new LabelLayer(mMap, mBaseLayer));
|
//
|
||||||
|
// mMap.layers().add(new BuildingLayer(mMap, mBaseLayer));
|
||||||
// mMap.layers().add(new TileGridLayer(mMap));
|
// mMap.layers().add(new LabelLayer(mMap, mBaseLayer));
|
||||||
// String file = Environment.getExternalStorageDirectory().getAbsolutePath();
|
//
|
||||||
// VectorDataset data = (VectorDataset) JeoTest.getJsonData(file + "/states.json", true);
|
// // String file = Environment.getExternalStorageDirectory().getAbsolutePath();
|
||||||
// Style style = JeoTest.getStyle();
|
// // VectorDataset data = (VectorDataset) JeoTest.getJsonData(file + "/states.json", true);
|
||||||
// mMap.layers().add(new JeoVectorLayer(mMap, data, style));
|
// // Style style = JeoTest.getStyle();
|
||||||
}
|
// // mMap.layers().add(new JeoVectorLayer(mMap, data, style));
|
||||||
|
// }
|
||||||
void loadJson(InputStream is) {
|
//
|
||||||
showToast("got data");
|
// void loadJson(InputStream is) {
|
||||||
|
// showToast("got data");
|
||||||
VectorDataset data = JeoTest.readGeoJson(is);
|
//
|
||||||
Style style = JeoTest.getStyle();
|
// VectorDataset data = JeoTest.readGeoJson(is);
|
||||||
mIndoorLayer = new OSMIndoorLayer(mMap, data, style);
|
// Style style = JeoTest.getStyle();
|
||||||
mMap.layers().add(mIndoorLayer);
|
// float scale = getResources().getDisplayMetrics().density;
|
||||||
|
// TextStyle textStyle = TextStyle.builder()
|
||||||
showToast("data ready");
|
// .isCaption(true)
|
||||||
mMap.updateMap(true);
|
// .fontSize(16 * scale).color(Color.BLACK)
|
||||||
|
// .strokeWidth(2.2f * scale).strokeColor(Color.WHITE)
|
||||||
mIndoorLayer.activeLevels[0] = true;
|
// .build();
|
||||||
shift();
|
// mIndoorLayer = new OSMIndoorLayer(mMap, data, style, textStyle);
|
||||||
}
|
// mMap.layers().add(mIndoorLayer);
|
||||||
|
//
|
||||||
public void showToast(final String text) {
|
// showToast("data ready");
|
||||||
final Context ctx = this;
|
// mMap.updateMap(true);
|
||||||
runOnUiThread(new Runnable() {
|
//
|
||||||
@Override
|
// mIndoorLayer.activeLevels[0] = true;
|
||||||
public void run() {
|
// shift();
|
||||||
Toast toast = Toast.makeText(ctx, text, Toast.LENGTH_SHORT);
|
// }
|
||||||
toast.show();
|
//
|
||||||
}
|
// public void showToast(final String text) {
|
||||||
});
|
// final Context ctx = this;
|
||||||
}
|
// runOnUiThread(new Runnable() {
|
||||||
|
// @Override
|
||||||
boolean mShift = true;
|
// public void run() {
|
||||||
|
// Toast toast = Toast.makeText(ctx, text, Toast.LENGTH_SHORT);
|
||||||
public void shift() {
|
// toast.show();
|
||||||
if (!mShift)
|
// }
|
||||||
return;
|
// });
|
||||||
|
// }
|
||||||
mMap.postDelayed(new Runnable() {
|
//
|
||||||
|
// boolean mShift = true;
|
||||||
@Override
|
//
|
||||||
public void run() {
|
// public void shift() {
|
||||||
for (int i = 0; i < 10; i++) {
|
// if (!mShift)
|
||||||
if (mIndoorLayer.activeLevels[i]) {
|
// return;
|
||||||
mIndoorLayer.activeLevels[i] = false;
|
//
|
||||||
mIndoorLayer.activeLevels[(i + 1) % 9] = true;
|
// mMap.postDelayed(new Runnable() {
|
||||||
mIndoorLayer.update();
|
//
|
||||||
break;
|
// @Override
|
||||||
}
|
// public void run() {
|
||||||
}
|
// for (int i = 0; i < 10; i++) {
|
||||||
shift();
|
// if (mIndoorLayer.activeLevels[i]) {
|
||||||
}
|
// mIndoorLayer.activeLevels[i] = false;
|
||||||
}, 200);
|
// mIndoorLayer.activeLevels[(i + 1) % 9] = true;
|
||||||
|
// mIndoorLayer.update();
|
||||||
}
|
// break;
|
||||||
|
// }
|
||||||
public void onClick(View v) {
|
// }
|
||||||
mShift = false;
|
// shift();
|
||||||
|
// }
|
||||||
if (mIndoorLayer == null)
|
// }, 200);
|
||||||
return;
|
//
|
||||||
|
// }
|
||||||
int i = 0;
|
//
|
||||||
|
// public void onClick(View v) {
|
||||||
if (v instanceof ToggleButton) {
|
// mShift = false;
|
||||||
ToggleButton b = (ToggleButton) v;
|
//
|
||||||
i = (b.getTextOn().charAt(0) - '0') + 1;
|
// if (mIndoorLayer == null)
|
||||||
}
|
// return;
|
||||||
|
//
|
||||||
if (i < 0 || i > 9)
|
// int i = 0;
|
||||||
i = 0;
|
//
|
||||||
|
// if (v instanceof ToggleButton) {
|
||||||
mIndoorLayer.activeLevels[i] ^= true;
|
// ToggleButton b = (ToggleButton) v;
|
||||||
((ToggleButton) v).setChecked(mIndoorLayer.activeLevels[i]);
|
// i = (b.getTextOn().charAt(0) - '0') + 1;
|
||||||
log.debug(Arrays.toString(mIndoorLayer.activeLevels));
|
// }
|
||||||
mIndoorLayer.update();
|
//
|
||||||
}
|
// if (i < 0 || i > 9)
|
||||||
|
// i = 0;
|
||||||
@Override
|
//
|
||||||
protected void onStop() {
|
// mIndoorLayer.activeLevels[i] ^= true;
|
||||||
super.onStop();
|
// if (v instanceof ToggleButton)
|
||||||
}
|
// ((ToggleButton) v).setChecked(mIndoorLayer.activeLevels[i]);
|
||||||
|
// log.debug(Arrays.toString(mIndoorLayer.activeLevels));
|
||||||
@Override
|
// mIndoorLayer.update();
|
||||||
protected void onResume() {
|
// }
|
||||||
super.onResume();
|
//
|
||||||
|
// @Override
|
||||||
/* ignore saved position */
|
// protected void onStop() {
|
||||||
//mMap.setMapPosition(49.417, 8.673, 1 << 17);
|
// super.onStop();
|
||||||
mMap.setMapPosition(53.5620092, 9.9866457, 1 << 16);
|
// }
|
||||||
}
|
//
|
||||||
}
|
// @Override
|
||||||
|
// protected void onResume() {
|
||||||
|
// super.onResume();
|
||||||
|
//
|
||||||
|
// /* ignore saved position */
|
||||||
|
// //mMap.setMapPosition(49.417, 8.673, 1 << 17);
|
||||||
|
// mMap.setMapPosition(53.5620092, 9.9866457, 1 << 16);
|
||||||
|
// }
|
||||||
|
//}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2013 Hannes Janetzek
|
* Copyright 2013 Hannes Janetzek
|
||||||
* Copyright 2016 devemux86
|
* Copyright 2016-2017 devemux86
|
||||||
* Copyright 2016 Andrey Novikov
|
* Copyright 2016 Andrey Novikov
|
||||||
*
|
*
|
||||||
* 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,8 @@ public class LayerGroupActivity extends BaseMapActivity {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onDestroy() {
|
protected void onDestroy() {
|
||||||
mapScaleBar.destroy();
|
if (mapScaleBar != null)
|
||||||
|
mapScaleBar.destroy();
|
||||||
|
|
||||||
super.onDestroy();
|
super.onDestroy();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2014 Hannes Janetzek
|
* Copyright 2014 Hannes Janetzek
|
||||||
* Copyright 2016 devemux86
|
* Copyright 2016-2017 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).
|
||||||
*
|
*
|
||||||
@@ -31,26 +31,19 @@ import org.oscim.renderer.bucket.TextureItem;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import static org.oscim.tiling.source.bitmap.DefaultSources.STAMEN_TONER;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This is a very INEFFICIENT and somewhat less useful example for how to use
|
* This is a very INEFFICIENT and somewhat less useful example for how to use
|
||||||
* PathLayers!
|
* PathLayers!
|
||||||
*/
|
*/
|
||||||
public class LineTexActivity extends BitmapTileMapActivity {
|
public class LineTexActivity extends SimpleMapActivity {
|
||||||
|
|
||||||
private static final boolean ANIMATION = false;
|
private static final boolean ANIMATION = false;
|
||||||
|
|
||||||
private List<PathLayer> mPathLayers = new ArrayList<>();
|
private List<PathLayer> mPathLayers = new ArrayList<>();
|
||||||
|
|
||||||
public LineTexActivity() {
|
|
||||||
super(STAMEN_TONER.build());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onCreate(Bundle savedInstanceState) {
|
public void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
mBitmapLayer.tileRenderer().setBitmapAlpha(0.5f);
|
|
||||||
|
|
||||||
TextureItem tex = new TextureItem(CanvasAdapter.getBitmapAsset("", "patterns/pike.png"));
|
TextureItem tex = new TextureItem(CanvasAdapter.getBitmapAsset("", "patterns/pike.png"));
|
||||||
tex.mipmap = true;
|
tex.mipmap = true;
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ import android.os.Bundle;
|
|||||||
|
|
||||||
import org.oscim.core.MapPosition;
|
import org.oscim.core.MapPosition;
|
||||||
import org.oscim.layers.LocationLayer;
|
import org.oscim.layers.LocationLayer;
|
||||||
|
import org.oscim.renderer.LocationRenderer;
|
||||||
|
|
||||||
public class LocationActivity extends SimpleMapActivity implements LocationListener {
|
public class LocationActivity extends SimpleMapActivity implements LocationListener {
|
||||||
private LocationLayer locationLayer;
|
private LocationLayer locationLayer;
|
||||||
@@ -35,6 +36,7 @@ public class LocationActivity extends SimpleMapActivity implements LocationListe
|
|||||||
locationManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
|
locationManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
|
||||||
|
|
||||||
locationLayer = new LocationLayer(mMap);
|
locationLayer = new LocationLayer(mMap);
|
||||||
|
locationLayer.locationRenderer.setShader("location_1_reverse");
|
||||||
locationLayer.setEnabled(false);
|
locationLayer.setEnabled(false);
|
||||||
mMap.layers().add(locationLayer);
|
mMap.layers().add(locationLayer);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2014 Hannes Janetzek
|
* Copyright 2014 Hannes Janetzek
|
||||||
* Copyright 2016 devemux86
|
* Copyright 2016-2017 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).
|
||||||
*
|
*
|
||||||
@@ -31,6 +31,13 @@ import org.oscim.layers.TileGridLayer;
|
|||||||
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;
|
||||||
|
import org.oscim.renderer.BitmapRenderer;
|
||||||
|
import org.oscim.renderer.GLViewport;
|
||||||
|
import org.oscim.scalebar.DefaultMapScaleBar;
|
||||||
|
import org.oscim.scalebar.ImperialUnitAdapter;
|
||||||
|
import org.oscim.scalebar.MapScaleBar;
|
||||||
|
import org.oscim.scalebar.MapScaleBarLayer;
|
||||||
|
import org.oscim.scalebar.MetricUnitAdapter;
|
||||||
import org.oscim.theme.VtmThemes;
|
import org.oscim.theme.VtmThemes;
|
||||||
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;
|
||||||
@@ -39,6 +46,7 @@ public class MapsforgeMapActivity extends MapActivity {
|
|||||||
private static final int SELECT_MAP_FILE = 0;
|
private static final int SELECT_MAP_FILE = 0;
|
||||||
|
|
||||||
private TileGridLayer mGridLayer;
|
private TileGridLayer mGridLayer;
|
||||||
|
private DefaultMapScaleBar mMapScaleBar;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
@@ -48,6 +56,14 @@ public class MapsforgeMapActivity extends MapActivity {
|
|||||||
SELECT_MAP_FILE);
|
SELECT_MAP_FILE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onDestroy() {
|
||||||
|
if (mMapScaleBar != null)
|
||||||
|
mMapScaleBar.destroy();
|
||||||
|
|
||||||
|
super.onDestroy();
|
||||||
|
}
|
||||||
|
|
||||||
public static class MapFilePicker extends FilePicker {
|
public static class MapFilePicker extends FilePicker {
|
||||||
public MapFilePicker() {
|
public MapFilePicker() {
|
||||||
setFileDisplayFilter(new FilterByFileExtension(".map"));
|
setFileDisplayFilter(new FilterByFileExtension(".map"));
|
||||||
@@ -70,13 +86,18 @@ public class MapsforgeMapActivity extends MapActivity {
|
|||||||
item.setChecked(true);
|
item.setChecked(true);
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
case R.id.theme_tubes:
|
case R.id.theme_osmarender:
|
||||||
mMap.setTheme(VtmThemes.TRONRENDER);
|
mMap.setTheme(VtmThemes.OSMARENDER);
|
||||||
item.setChecked(true);
|
item.setChecked(true);
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
case R.id.theme_osmarender:
|
case R.id.theme_osmagray:
|
||||||
mMap.setTheme(VtmThemes.OSMARENDER);
|
mMap.setTheme(VtmThemes.OSMAGRAY);
|
||||||
|
item.setChecked(true);
|
||||||
|
return true;
|
||||||
|
|
||||||
|
case R.id.theme_tubes:
|
||||||
|
mMap.setTheme(VtmThemes.TRONRENDER);
|
||||||
item.setChecked(true);
|
item.setChecked(true);
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
@@ -123,6 +144,18 @@ public class MapsforgeMapActivity 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));
|
||||||
|
|
||||||
|
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 * getResources().getDisplayMetrics().density, 0);
|
||||||
|
mMap.layers().add(mapScaleBarLayer);
|
||||||
|
|
||||||
MapInfo info = tileSource.getMapInfo();
|
MapInfo info = tileSource.getMapInfo();
|
||||||
MapPosition pos = new MapPosition();
|
MapPosition pos = new MapPosition();
|
||||||
pos.setByBoundingBox(info.boundingBox, Tile.SIZE * 4, Tile.SIZE * 4);
|
pos.setByBoundingBox(info.boundingBox, Tile.SIZE * 4, Tile.SIZE * 4);
|
||||||
|
|||||||
@@ -0,0 +1,68 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2017 devemux86
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify it under the
|
||||||
|
* terms of the GNU Lesser General Public License as published by the Free Software
|
||||||
|
* Foundation, either version 3 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||||
|
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||||
|
* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public License along with
|
||||||
|
* this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
package org.oscim.android.test;
|
||||||
|
|
||||||
|
import android.os.Bundle;
|
||||||
|
|
||||||
|
import org.oscim.android.cache.TileCache;
|
||||||
|
import org.oscim.layers.TileGridLayer;
|
||||||
|
import org.oscim.layers.tile.buildings.BuildingLayer;
|
||||||
|
import org.oscim.layers.tile.vector.VectorTileLayer;
|
||||||
|
import org.oscim.layers.tile.vector.labeling.LabelLayer;
|
||||||
|
import org.oscim.theme.VtmThemes;
|
||||||
|
import org.oscim.tiling.source.OkHttpEngine;
|
||||||
|
import org.oscim.tiling.source.UrlTileSource;
|
||||||
|
import org.oscim.tiling.source.geojson.MapzenGeojsonTileSource;
|
||||||
|
|
||||||
|
public class MapzenGeojsonMapActivity extends MapActivity {
|
||||||
|
|
||||||
|
private static final boolean USE_CACHE = false;
|
||||||
|
|
||||||
|
private TileCache mCache;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onCreate(Bundle savedInstanceState) {
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
|
||||||
|
UrlTileSource tileSource = MapzenGeojsonTileSource.builder()
|
||||||
|
.apiKey("mapzen-xxxxxxx") // Put a proper API key
|
||||||
|
.httpFactory(new OkHttpEngine.OkHttpFactory())
|
||||||
|
//.locale("en")
|
||||||
|
.build();
|
||||||
|
|
||||||
|
if (USE_CACHE) {
|
||||||
|
// Cache the tiles into a local SQLite database
|
||||||
|
mCache = new TileCache(this, null, "tile.db");
|
||||||
|
mCache.setCacheSize(512 * (1 << 10));
|
||||||
|
tileSource.setCache(mCache);
|
||||||
|
}
|
||||||
|
|
||||||
|
VectorTileLayer l = mMap.setBaseMap(tileSource);
|
||||||
|
mMap.setTheme(VtmThemes.MAPZEN);
|
||||||
|
|
||||||
|
mMap.layers().add(new BuildingLayer(mMap, l));
|
||||||
|
mMap.layers().add(new LabelLayer(mMap, l));
|
||||||
|
|
||||||
|
mMap.layers().add(new TileGridLayer(mMap, getResources().getDisplayMetrics().density));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onDestroy() {
|
||||||
|
super.onDestroy();
|
||||||
|
|
||||||
|
if (mCache != null)
|
||||||
|
mCache.dispose();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2016-2017 devemux86
|
* Copyright 2016-2017 devemux86
|
||||||
|
* 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
|
||||||
* 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,30 +17,53 @@ package org.oscim.android.test;
|
|||||||
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
|
||||||
|
import org.oscim.android.cache.TileCache;
|
||||||
|
import org.oscim.layers.TileGridLayer;
|
||||||
import org.oscim.layers.tile.buildings.BuildingLayer;
|
import org.oscim.layers.tile.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;
|
||||||
import org.oscim.theme.VtmThemes;
|
import org.oscim.theme.VtmThemes;
|
||||||
import org.oscim.tiling.source.OkHttpEngine;
|
import org.oscim.tiling.source.OkHttpEngine;
|
||||||
import org.oscim.tiling.source.UrlTileSource;
|
import org.oscim.tiling.source.UrlTileSource;
|
||||||
import org.oscim.tiling.source.mvt.MapboxTileSource;
|
import org.oscim.tiling.source.mvt.MapzenMvtTileSource;
|
||||||
|
|
||||||
public class MapboxMapActivity extends MapActivity {
|
public class MapzenMvtMapActivity extends MapActivity {
|
||||||
|
|
||||||
|
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);
|
||||||
|
|
||||||
UrlTileSource tileSource = MapboxTileSource.builder()
|
UrlTileSource tileSource = MapzenMvtTileSource.builder()
|
||||||
.apiKey("mapzen-xxxxxxx") // Put a proper API key
|
.apiKey("mapzen-xxxxxxx") // Put a proper API key
|
||||||
.httpFactory(new OkHttpEngine.OkHttpFactory())
|
.httpFactory(new OkHttpEngine.OkHttpFactory())
|
||||||
//.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));
|
||||||
|
|
||||||
|
mMap.layers().add(new TileGridLayer(mMap, getResources().getDisplayMetrics().density));
|
||||||
|
}
|
||||||
|
|
||||||
|
@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 devemux86
|
* Copyright 2016-2017 devemux86
|
||||||
*
|
*
|
||||||
* This file is part of the OpenScienceMap project (http://www.opensciencemap.org).
|
* This file is part of the OpenScienceMap project (http://www.opensciencemap.org).
|
||||||
*
|
*
|
||||||
@@ -18,7 +18,6 @@
|
|||||||
package org.oscim.android.test;
|
package org.oscim.android.test;
|
||||||
|
|
||||||
import android.graphics.drawable.Drawable;
|
import android.graphics.drawable.Drawable;
|
||||||
import android.os.Bundle;
|
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
import org.oscim.backend.canvas.Bitmap;
|
import org.oscim.backend.canvas.Bitmap;
|
||||||
@@ -27,37 +26,39 @@ import org.oscim.event.Gesture;
|
|||||||
import org.oscim.event.GestureListener;
|
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.TileGridLayer;
|
|
||||||
import org.oscim.layers.marker.ItemizedLayer;
|
import org.oscim.layers.marker.ItemizedLayer;
|
||||||
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.buildings.BuildingLayer;
|
||||||
|
import org.oscim.layers.tile.vector.VectorTileLayer;
|
||||||
|
import org.oscim.layers.tile.vector.labeling.LabelLayer;
|
||||||
import org.oscim.map.Map;
|
import org.oscim.map.Map;
|
||||||
|
import org.oscim.theme.VtmThemes;
|
||||||
|
import org.oscim.tiling.source.oscimap4.OSciMap4TileSource;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import static org.oscim.android.canvas.AndroidGraphics.drawableToBitmap;
|
import static org.oscim.android.canvas.AndroidGraphics.drawableToBitmap;
|
||||||
import static org.oscim.tiling.source.bitmap.DefaultSources.STAMEN_TONER;
|
|
||||||
|
|
||||||
public class MarkerOverlayActivity extends BitmapTileMapActivity
|
public class MarkerOverlayActivity extends SimpleMapActivity
|
||||||
implements ItemizedLayer.OnItemGestureListener<MarkerItem> {
|
implements ItemizedLayer.OnItemGestureListener<MarkerItem> {
|
||||||
|
|
||||||
protected static final boolean BILLBOARDS = true;
|
static final boolean BILLBOARDS = true;
|
||||||
protected MarkerSymbol mFocusMarker;
|
MarkerSymbol mFocusMarker;
|
||||||
|
ItemizedLayer<MarkerItem> mMarkerLayer;
|
||||||
public MarkerOverlayActivity() {
|
|
||||||
super(STAMEN_TONER.build());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onCreate(Bundle savedInstanceState) {
|
void createLayers() {
|
||||||
super.onCreate(savedInstanceState);
|
|
||||||
mBitmapLayer.tileRenderer().setBitmapAlpha(0.5f);
|
|
||||||
|
|
||||||
// Map events receiver
|
// Map events receiver
|
||||||
mMap.layers().add(new MapEventsReceiver(mMap));
|
mMap.layers().add(new MapEventsReceiver(mMap));
|
||||||
|
|
||||||
|
VectorTileLayer l = mMap.setBaseMap(new OSciMap4TileSource());
|
||||||
|
mMap.layers().add(new BuildingLayer(mMap, l));
|
||||||
|
mMap.layers().add(new LabelLayer(mMap, l));
|
||||||
|
mMap.setTheme(VtmThemes.DEFAULT);
|
||||||
|
|
||||||
/* directly load bitmap from resources */
|
/* directly load bitmap from resources */
|
||||||
Bitmap bitmap = drawableToBitmap(getResources(), R.drawable.marker_poi);
|
Bitmap bitmap = drawableToBitmap(getResources(), R.drawable.marker_poi);
|
||||||
|
|
||||||
@@ -74,11 +75,8 @@ public class MarkerOverlayActivity extends BitmapTileMapActivity
|
|||||||
else
|
else
|
||||||
mFocusMarker = new MarkerSymbol(drawableToBitmap(d), HotspotPlace.CENTER, false);
|
mFocusMarker = new MarkerSymbol(drawableToBitmap(d), HotspotPlace.CENTER, false);
|
||||||
|
|
||||||
ItemizedLayer<MarkerItem> markerLayer =
|
mMarkerLayer = new ItemizedLayer<>(mMap, new ArrayList<MarkerItem>(), symbol, this);
|
||||||
new ItemizedLayer<>(mMap, new ArrayList<MarkerItem>(),
|
mMap.layers().add(mMarkerLayer);
|
||||||
symbol, this);
|
|
||||||
|
|
||||||
mMap.layers().add(markerLayer);
|
|
||||||
|
|
||||||
List<MarkerItem> pts = new ArrayList<>();
|
List<MarkerItem> pts = new ArrayList<>();
|
||||||
|
|
||||||
@@ -87,9 +85,7 @@ public class MarkerOverlayActivity extends BitmapTileMapActivity
|
|||||||
pts.add(new MarkerItem(lat + "/" + lon, "", new GeoPoint(lat, lon)));
|
pts.add(new MarkerItem(lat + "/" + lon, "", new GeoPoint(lat, lon)));
|
||||||
}
|
}
|
||||||
|
|
||||||
markerLayer.addItems(pts);
|
mMarkerLayer.addItems(pts);
|
||||||
|
|
||||||
mMap.layers().add(new TileGridLayer(mMap, getResources().getDisplayMetrics().density));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -122,7 +118,7 @@ public class MarkerOverlayActivity extends BitmapTileMapActivity
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected class MapEventsReceiver extends Layer implements GestureListener {
|
class MapEventsReceiver extends Layer implements GestureListener {
|
||||||
|
|
||||||
MapEventsReceiver(Map map) {
|
MapEventsReceiver(Map map) {
|
||||||
super(map);
|
super(map);
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2014 Hannes Janetzek
|
* Copyright 2014 Hannes Janetzek
|
||||||
* Copyright 2016 devemux86
|
* Copyright 2016-2017 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).
|
||||||
*
|
*
|
||||||
@@ -19,7 +19,6 @@ package org.oscim.android.test;
|
|||||||
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
|
||||||
import org.oscim.layers.TileGridLayer;
|
|
||||||
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;
|
||||||
@@ -65,8 +64,6 @@ public class OsmJsonMapActivity extends MapActivity {
|
|||||||
mMap.layers().add(l);
|
mMap.layers().add(l);
|
||||||
mMap.layers().add(new LabelLayer(mMap, l));
|
mMap.layers().add(new LabelLayer(mMap, l));
|
||||||
|
|
||||||
mMap.layers().add(new TileGridLayer(mMap, getResources().getDisplayMetrics().density));
|
|
||||||
|
|
||||||
mMap.setMapPosition(53.08, 8.83, Math.pow(2, 16));
|
mMap.setMapPosition(53.08, 8.83, Math.pow(2, 16));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,29 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2017 devemux86
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify it under the
|
||||||
|
* terms of the GNU Lesser General Public License as published by the Free Software
|
||||||
|
* Foundation, either version 3 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||||
|
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||||
|
* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public License along with
|
||||||
|
* this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
package org.oscim.android.test;
|
||||||
|
|
||||||
|
import android.os.Bundle;
|
||||||
|
|
||||||
|
import org.oscim.theme.ThemeLoader;
|
||||||
|
|
||||||
|
public class POTTextureActivity extends SimpleMapActivity {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onCreate(Bundle savedInstanceState) {
|
||||||
|
ThemeLoader.POT_TEXTURES = true;
|
||||||
|
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2014 Hannes Janetzek
|
* Copyright 2014 Hannes Janetzek
|
||||||
* Copyright 2016 devemux86
|
* Copyright 2016-2017 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,26 +28,19 @@ import org.oscim.map.Map.UpdateListener;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import static org.oscim.tiling.source.bitmap.DefaultSources.STAMEN_TONER;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This is a very INEFFICIENT and somewhat less useful example for how to use
|
* This is a very INEFFICIENT and somewhat less useful example for how to use
|
||||||
* PathLayers!
|
* PathLayers!
|
||||||
*/
|
*/
|
||||||
public class PathOverlayActivity extends BitmapTileMapActivity {
|
public class PathOverlayActivity extends SimpleMapActivity {
|
||||||
|
|
||||||
private static final boolean ANIMATION = true;
|
private static final boolean ANIMATION = true;
|
||||||
|
|
||||||
private List<PathLayer> mPathLayers = new ArrayList<>();
|
private List<PathLayer> mPathLayers = new ArrayList<>();
|
||||||
|
|
||||||
public PathOverlayActivity() {
|
|
||||||
super(STAMEN_TONER.build());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onCreate(Bundle savedInstanceState) {
|
public void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
mBitmapLayer.tileRenderer().setBitmapAlpha(0.5f);
|
|
||||||
|
|
||||||
for (double lat = -90; lat <= 90; lat += 5) {
|
for (double lat = -90; lat <= 90; lat += 5) {
|
||||||
int c = Color.fade(Color.rainbow((float) (lat + 90) / 180), 0.5f);
|
int c = Color.fade(Color.rainbow((float) (lat + 90) / 180), 0.5f);
|
||||||
|
|||||||
@@ -0,0 +1,78 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2014 Hannes Janetzek
|
||||||
|
* Copyright 2016-2017 devemux86
|
||||||
|
* Copyright 2017 Longri
|
||||||
|
*
|
||||||
|
* This file is part of the OpenScienceMap project (http://www.opensciencemap.org).
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify it under the
|
||||||
|
* terms of the GNU Lesser General Public License as published by the Free Software
|
||||||
|
* Foundation, either version 3 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||||
|
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||||
|
* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public License along with
|
||||||
|
* this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
package org.oscim.android.test;
|
||||||
|
|
||||||
|
import android.widget.Toast;
|
||||||
|
|
||||||
|
import org.oscim.layers.marker.MarkerItem;
|
||||||
|
|
||||||
|
import java.util.Timer;
|
||||||
|
import java.util.TimerTask;
|
||||||
|
import java.util.concurrent.atomic.AtomicInteger;
|
||||||
|
|
||||||
|
public class RotateMarkerOverlayActivity extends MarkerOverlayActivity {
|
||||||
|
|
||||||
|
private Timer timer;
|
||||||
|
private int markerCount = 0;
|
||||||
|
|
||||||
|
private void itemEvent(final MarkerItem item) {
|
||||||
|
if (item.getMarker() == null) {
|
||||||
|
item.setMarker(mFocusMarker);
|
||||||
|
markerCount++;
|
||||||
|
final AtomicInteger rotValue = new AtomicInteger(0);
|
||||||
|
if (timer != null)
|
||||||
|
timer.cancel();
|
||||||
|
timer = new Timer();
|
||||||
|
TimerTask timerTask = new TimerTask() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
float value = (float) (rotValue.incrementAndGet() * 10);
|
||||||
|
item.setRotation(value);
|
||||||
|
if (rotValue.get() > 36)
|
||||||
|
rotValue.set(0);
|
||||||
|
mMarkerLayer.update();
|
||||||
|
mMap.updateMap(true);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
timer.schedule(timerTask, 1000, 1000);
|
||||||
|
|
||||||
|
} else {
|
||||||
|
item.setMarker(null);
|
||||||
|
markerCount--;
|
||||||
|
if (timer != null && markerCount == 0)
|
||||||
|
timer.cancel();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onItemSingleTapUp(int index, MarkerItem item) {
|
||||||
|
itemEvent(item);
|
||||||
|
|
||||||
|
Toast.makeText(this, "Marker tap\n" + item.getTitle(), Toast.LENGTH_SHORT).show();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onItemLongPress(int index, MarkerItem item) {
|
||||||
|
itemEvent(item);
|
||||||
|
|
||||||
|
Toast.makeText(this, "Marker long press\n" + item.getTitle(), Toast.LENGTH_SHORT).show();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,7 +1,9 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2010, 2011, 2012, 2013 mapsforge.org
|
* Copyright 2010, 2011, 2012, 2013 mapsforge.org
|
||||||
* Copyright 2013 Hannes Janetzek
|
* Copyright 2013 Hannes Janetzek
|
||||||
* Copyright 2016 devemux86
|
* Copyright 2016-2017 devemux86
|
||||||
|
* Copyright 2017 Longri
|
||||||
|
* 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).
|
||||||
*
|
*
|
||||||
@@ -38,19 +40,26 @@ public class Samples extends Activity {
|
|||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
|
|
||||||
setContentView(R.layout.activity_samples);
|
setContentView(R.layout.activity_samples);
|
||||||
LinearLayout linearLayout = (LinearLayout) findViewById(R.id.samples);
|
LinearLayout linearLayout = findViewById(R.id.samples);
|
||||||
linearLayout.addView(createButton(SimpleMapActivity.class));
|
linearLayout.addView(createButton(SimpleMapActivity.class));
|
||||||
linearLayout.addView(createButton(MapsforgeMapActivity.class));
|
linearLayout.addView(createButton(MapsforgeMapActivity.class));
|
||||||
|
linearLayout.addView(createButton(MapzenMvtMapActivity.class));
|
||||||
|
linearLayout.addView(createButton(MapzenGeojsonMapActivity.class));
|
||||||
|
|
||||||
|
linearLayout.addView(createLabel("Vector Features"));
|
||||||
linearLayout.addView(createButton(MapsforgeStyleActivity.class));
|
linearLayout.addView(createButton(MapsforgeStyleActivity.class));
|
||||||
linearLayout.addView(createButton(MapboxMapActivity.class));
|
linearLayout.addView(createButton(AtlasThemeActivity.class));
|
||||||
linearLayout.addView(createButton(OsmJsonMapActivity.class));
|
linearLayout.addView(createButton(POTTextureActivity.class));
|
||||||
|
|
||||||
linearLayout.addView(createLabel("Raster Maps"));
|
linearLayout.addView(createLabel("Raster Maps"));
|
||||||
linearLayout.addView(createButton(BitmapTileMapActivity.class));
|
linearLayout.addView(createButton(BitmapTileMapActivity.class));
|
||||||
|
|
||||||
linearLayout.addView(createLabel("Overlays"));
|
linearLayout.addView(createLabel("Overlays"));
|
||||||
linearLayout.addView(createButton(MarkerOverlayActivity.class));
|
linearLayout.addView(createButton(MarkerOverlayActivity.class));
|
||||||
|
linearLayout.addView(createButton(RotateMarkerOverlayActivity.class));
|
||||||
linearLayout.addView(createButton(AtlasMarkerOverlayActivity.class));
|
linearLayout.addView(createButton(AtlasMarkerOverlayActivity.class));
|
||||||
|
linearLayout.addView(createButton(AtlasMultiTextureActivity.class));
|
||||||
|
linearLayout.addView(createButton(ClusterMarkerOverlayActivity.class));
|
||||||
linearLayout.addView(createButton(PathOverlayActivity.class));
|
linearLayout.addView(createButton(PathOverlayActivity.class));
|
||||||
linearLayout.addView(createButton(LineTexActivity.class));
|
linearLayout.addView(createButton(LineTexActivity.class));
|
||||||
linearLayout.addView(createButton(VectorLayerMapActivity.class));
|
linearLayout.addView(createButton(VectorLayerMapActivity.class));
|
||||||
@@ -68,7 +77,7 @@ public class Samples extends Activity {
|
|||||||
linearLayout.addView(createButton(MapPositionActivity.class));
|
linearLayout.addView(createButton(MapPositionActivity.class));
|
||||||
linearLayout.addView(createButton(S3DBMapActivity.class));
|
linearLayout.addView(createButton(S3DBMapActivity.class));
|
||||||
linearLayout.addView(createButton(ThemeStylerActivity.class));
|
linearLayout.addView(createButton(ThemeStylerActivity.class));
|
||||||
linearLayout.addView(createButton(JeoIndoorMapActivity.class));
|
//linearLayout.addView(createButton(JeoIndoorMapActivity.class));
|
||||||
}
|
}
|
||||||
|
|
||||||
private Button createButton(final Class<?> clazz) {
|
private Button createButton(final Class<?> clazz) {
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2013 Hannes Janetzek
|
* Copyright 2013 Hannes Janetzek
|
||||||
* Copyright 2016 devemux86
|
* Copyright 2016-2017 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).
|
||||||
*
|
*
|
||||||
@@ -42,6 +42,10 @@ public class SimpleMapActivity extends BaseMapActivity {
|
|||||||
public void onCreate(Bundle savedInstanceState) {
|
public void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
|
|
||||||
|
createLayers();
|
||||||
|
}
|
||||||
|
|
||||||
|
void createLayers() {
|
||||||
GroupLayer groupLayer = new GroupLayer(mMap);
|
GroupLayer groupLayer = new GroupLayer(mMap);
|
||||||
groupLayer.layers.add(new BuildingLayer(mMap, mBaseLayer));
|
groupLayer.layers.add(new BuildingLayer(mMap, mBaseLayer));
|
||||||
groupLayer.layers.add(new LabelLayer(mMap, mBaseLayer));
|
groupLayer.layers.add(new LabelLayer(mMap, mBaseLayer));
|
||||||
@@ -64,7 +68,8 @@ public class SimpleMapActivity extends BaseMapActivity {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onDestroy() {
|
protected void onDestroy() {
|
||||||
mapScaleBar.destroy();
|
if (mapScaleBar != null)
|
||||||
|
mapScaleBar.destroy();
|
||||||
|
|
||||||
super.onDestroy();
|
super.onDestroy();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2013 Hannes Janetzek
|
* Copyright 2013 Hannes Janetzek
|
||||||
* Copyright 2016 devemux86
|
* Copyright 2016-2017 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,24 +20,16 @@ package org.oscim.android.test;
|
|||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
|
||||||
import org.oscim.backend.canvas.Color;
|
import org.oscim.backend.canvas.Color;
|
||||||
import org.oscim.layers.TileGridLayer;
|
|
||||||
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.utils.ColorUtil;
|
import org.oscim.utils.ColorUtil;
|
||||||
|
|
||||||
import static org.oscim.tiling.source.bitmap.DefaultSources.STAMEN_TONER;
|
public class VectorLayerMapActivity extends SimpleMapActivity {
|
||||||
|
|
||||||
public class VectorLayerMapActivity extends BitmapTileMapActivity {
|
|
||||||
|
|
||||||
public VectorLayerMapActivity() {
|
|
||||||
super(STAMEN_TONER.build());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onCreate(Bundle savedInstanceState) {
|
public void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
mBitmapLayer.tileRenderer().setBitmapAlpha(0.5f);
|
|
||||||
|
|
||||||
VectorLayer vectorLayer = new VectorLayer(mMap);
|
VectorLayer vectorLayer = new VectorLayer(mMap);
|
||||||
|
|
||||||
@@ -95,7 +87,6 @@ public class VectorLayerMapActivity extends BitmapTileMapActivity {
|
|||||||
vectorLayer.update();
|
vectorLayer.update();
|
||||||
|
|
||||||
mMap.layers().add(vectorLayer);
|
mMap.layers().add(vectorLayer);
|
||||||
mMap.layers().add(new TileGridLayer(mMap, 0xff222222, 1.2f, 1));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2013 Hannes Janetzek
|
* Copyright 2013 Hannes Janetzek
|
||||||
* Copyright 2016 devemux86
|
* Copyright 2016-2017 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).
|
||||||
*
|
*
|
||||||
@@ -42,7 +42,7 @@ public class MainActivity extends AndroidApplication {
|
|||||||
GLAdapter.init(new AndroidGL());
|
GLAdapter.init(new AndroidGL());
|
||||||
|
|
||||||
DisplayMetrics metrics = getResources().getDisplayMetrics();
|
DisplayMetrics metrics = getResources().getDisplayMetrics();
|
||||||
CanvasAdapter.dpi = (int) Math.max(metrics.xdpi, metrics.ydpi);
|
CanvasAdapter.dpi = (int) (metrics.scaledDensity * CanvasAdapter.DEFAULT_DPI);
|
||||||
Tile.SIZE = Tile.calculateTileSize(metrics.scaledDensity);
|
Tile.SIZE = Tile.calculateTileSize(metrics.scaledDensity);
|
||||||
|
|
||||||
AndroidApplicationConfiguration cfg = new AndroidApplicationConfiguration();
|
AndroidApplicationConfiguration cfg = new AndroidApplicationConfiguration();
|
||||||
|
|||||||
@@ -49,13 +49,13 @@ public class MapView extends GLSurfaceView {
|
|||||||
|
|
||||||
static final Logger log = LoggerFactory.getLogger(MapView.class);
|
static final Logger log = LoggerFactory.getLogger(MapView.class);
|
||||||
|
|
||||||
static {
|
private static void init() {
|
||||||
System.loadLibrary("vtm-jni");
|
System.loadLibrary("vtm-jni");
|
||||||
}
|
}
|
||||||
|
|
||||||
protected final AndroidMap mMap;
|
protected AndroidMap mMap;
|
||||||
protected GestureDetector mGestureDetector;
|
protected GestureDetector mGestureDetector;
|
||||||
protected final AndroidMotionEvent mMotionEvent;
|
protected AndroidMotionEvent mMotionEvent;
|
||||||
|
|
||||||
public MapView(Context context) {
|
public MapView(Context context) {
|
||||||
this(context, null);
|
this(context, null);
|
||||||
@@ -64,19 +64,24 @@ public class MapView extends GLSurfaceView {
|
|||||||
public MapView(Context context, AttributeSet attributeSet) {
|
public MapView(Context context, AttributeSet attributeSet) {
|
||||||
super(context, attributeSet);
|
super(context, attributeSet);
|
||||||
|
|
||||||
|
if (isInEditMode())
|
||||||
|
return;
|
||||||
|
|
||||||
|
init();
|
||||||
|
|
||||||
/* Not sure if this makes sense */
|
/* Not sure if this makes sense */
|
||||||
this.setWillNotDraw(true);
|
this.setWillNotDraw(true);
|
||||||
this.setClickable(true);
|
this.setClickable(true);
|
||||||
this.setFocusable(true);
|
this.setFocusable(true);
|
||||||
this.setFocusableInTouchMode(true);
|
this.setFocusableInTouchMode(true);
|
||||||
|
|
||||||
/* Setup android backedn */
|
/* Setup android backend */
|
||||||
AndroidGraphics.init();
|
AndroidGraphics.init();
|
||||||
AndroidAssets.init(context);
|
AndroidAssets.init(context);
|
||||||
GLAdapter.init(new AndroidGL());
|
GLAdapter.init(new AndroidGL());
|
||||||
|
|
||||||
DisplayMetrics metrics = getResources().getDisplayMetrics();
|
DisplayMetrics metrics = getResources().getDisplayMetrics();
|
||||||
CanvasAdapter.dpi = (int) Math.max(metrics.xdpi, metrics.ydpi);
|
CanvasAdapter.dpi = (int) (metrics.scaledDensity * CanvasAdapter.DEFAULT_DPI);
|
||||||
|
|
||||||
/* Initialize the Map */
|
/* Initialize the Map */
|
||||||
mMap = new AndroidMap(this);
|
mMap = new AndroidMap(this);
|
||||||
@@ -138,8 +143,10 @@ public class MapView extends GLSurfaceView {
|
|||||||
|
|
||||||
super.onSizeChanged(width, height, oldWidth, oldHeight);
|
super.onSizeChanged(width, height, oldWidth, oldHeight);
|
||||||
|
|
||||||
if (width > 0 && height > 0)
|
if (!isInEditMode()) {
|
||||||
mMap.viewport().setScreenSize(width, height);
|
if (width > 0 && height > 0)
|
||||||
|
mMap.viewport().setScreenSize(width, height);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public Map map() {
|
public Map map() {
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2013 Hannes Janetzek
|
* Copyright 2013 Hannes Janetzek
|
||||||
* Copyright 2016 devemux86
|
* Copyright 2016-2017 devemux86
|
||||||
|
* Copyright 2017 nebular
|
||||||
|
* 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).
|
||||||
*
|
*
|
||||||
@@ -17,6 +19,7 @@
|
|||||||
*/
|
*/
|
||||||
package org.oscim.android.canvas;
|
package org.oscim.android.canvas;
|
||||||
|
|
||||||
|
import android.graphics.Color;
|
||||||
import android.graphics.PorterDuff;
|
import android.graphics.PorterDuff;
|
||||||
|
|
||||||
import org.oscim.backend.canvas.Bitmap;
|
import org.oscim.backend.canvas.Bitmap;
|
||||||
@@ -62,13 +65,26 @@ public class AndroidCanvas implements Canvas {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void drawLine(int x1, int y1, int x2, int y2, Paint paint) {
|
public void drawBitmapScaled(Bitmap bitmap) {
|
||||||
|
android.graphics.Bitmap scaledBitmap = android.graphics.Bitmap.createScaledBitmap(
|
||||||
|
((AndroidBitmap) bitmap).mBitmap, canvas.getWidth(), canvas.getHeight(), true);
|
||||||
|
canvas.drawBitmap(scaledBitmap, 0, 0, null);
|
||||||
|
scaledBitmap.recycle();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void drawCircle(float x, float y, float radius, Paint paint) {
|
||||||
|
canvas.drawCircle(x, y, radius, ((AndroidPaint) paint).mPaint);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void drawLine(float x1, float y1, float x2, float y2, Paint paint) {
|
||||||
canvas.drawLine(x1, y1, x2, y2, ((AndroidPaint) paint).mPaint);
|
canvas.drawLine(x1, y1, x2, y2, ((AndroidPaint) paint).mPaint);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void fillColor(int color) {
|
public void fillColor(int color) {
|
||||||
canvas.drawColor(color, PorterDuff.Mode.CLEAR);
|
canvas.drawColor(color, color == Color.TRANSPARENT ? PorterDuff.Mode.CLEAR : PorterDuff.Mode.SRC_OVER);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2010, 2011, 2012 mapsforge.org
|
* Copyright 2010, 2011, 2012 mapsforge.org
|
||||||
* Copyright 2016 devemux86
|
* Copyright 2016-2017 devemux86
|
||||||
|
* 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).
|
||||||
*
|
*
|
||||||
@@ -100,8 +101,7 @@ class AndroidPaint implements Paint {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setTextAlign(Align align) {
|
public void setTextAlign(Align align) {
|
||||||
// Align text in text layer
|
mPaint.setTextAlign(android.graphics.Paint.Align.valueOf(align.name()));
|
||||||
//mPaint.setTextAlign(android.graphics.Paint.Align.valueOf(align.name()));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -139,6 +139,16 @@ class AndroidPaint implements Paint {
|
|||||||
return mPaint.getStrokeWidth();
|
return mPaint.getStrokeWidth();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Style getStyle() {
|
||||||
|
switch (mPaint.getStyle()) {
|
||||||
|
case STROKE:
|
||||||
|
return Style.STROKE;
|
||||||
|
default:
|
||||||
|
return Style.FILL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public float getTextHeight(String text) {
|
public float getTextHeight(String text) {
|
||||||
mPaint.getTextBounds(text, 0, text.length(), rect);
|
mPaint.getTextBounds(text, 0, text.length(), rect);
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2010, 2011, 2012 mapsforge.org
|
* Copyright 2010, 2011, 2012 mapsforge.org
|
||||||
* Copyright 2016 devemux86
|
* Copyright 2016-2017 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
|
||||||
@@ -34,7 +34,7 @@ public class AssetsRenderTheme implements ThemeFile {
|
|||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
private final InputStream mInputStream;
|
private final InputStream mInputStream;
|
||||||
private final XmlRenderThemeMenuCallback mMenuCallback;
|
private XmlRenderThemeMenuCallback mMenuCallback;
|
||||||
private final String mRelativePathPrefix;
|
private final String mRelativePathPrefix;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -96,4 +96,9 @@ public class AssetsRenderTheme implements ThemeFile {
|
|||||||
public InputStream getRenderThemeAsStream() throws ThemeException {
|
public InputStream getRenderThemeAsStream() throws ThemeException {
|
||||||
return mInputStream;
|
return mInputStream;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setMenuCallback(XmlRenderThemeMenuCallback menuCallback) {
|
||||||
|
mMenuCallback = menuCallback;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
674
vtm-app/COPYING
@@ -1,674 +0,0 @@
|
|||||||
GNU GENERAL PUBLIC LICENSE
|
|
||||||
Version 3, 29 June 2007
|
|
||||||
|
|
||||||
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
|
|
||||||
Everyone is permitted to copy and distribute verbatim copies
|
|
||||||
of this license document, but changing it is not allowed.
|
|
||||||
|
|
||||||
Preamble
|
|
||||||
|
|
||||||
The GNU General Public License is a free, copyleft license for
|
|
||||||
software and other kinds of works.
|
|
||||||
|
|
||||||
The licenses for most software and other practical works are designed
|
|
||||||
to take away your freedom to share and change the works. By contrast,
|
|
||||||
the GNU General Public License is intended to guarantee your freedom to
|
|
||||||
share and change all versions of a program--to make sure it remains free
|
|
||||||
software for all its users. We, the Free Software Foundation, use the
|
|
||||||
GNU General Public License for most of our software; it applies also to
|
|
||||||
any other work released this way by its authors. You can apply it to
|
|
||||||
your programs, too.
|
|
||||||
|
|
||||||
When we speak of free software, we are referring to freedom, not
|
|
||||||
price. Our General Public Licenses are designed to make sure that you
|
|
||||||
have the freedom to distribute copies of free software (and charge for
|
|
||||||
them if you wish), that you receive source code or can get it if you
|
|
||||||
want it, that you can change the software or use pieces of it in new
|
|
||||||
free programs, and that you know you can do these things.
|
|
||||||
|
|
||||||
To protect your rights, we need to prevent others from denying you
|
|
||||||
these rights or asking you to surrender the rights. Therefore, you have
|
|
||||||
certain responsibilities if you distribute copies of the software, or if
|
|
||||||
you modify it: responsibilities to respect the freedom of others.
|
|
||||||
|
|
||||||
For example, if you distribute copies of such a program, whether
|
|
||||||
gratis or for a fee, you must pass on to the recipients the same
|
|
||||||
freedoms that you received. You must make sure that they, too, receive
|
|
||||||
or can get the source code. And you must show them these terms so they
|
|
||||||
know their rights.
|
|
||||||
|
|
||||||
Developers that use the GNU GPL protect your rights with two steps:
|
|
||||||
(1) assert copyright on the software, and (2) offer you this License
|
|
||||||
giving you legal permission to copy, distribute and/or modify it.
|
|
||||||
|
|
||||||
For the developers' and authors' protection, the GPL clearly explains
|
|
||||||
that there is no warranty for this free software. For both users' and
|
|
||||||
authors' sake, the GPL requires that modified versions be marked as
|
|
||||||
changed, so that their problems will not be attributed erroneously to
|
|
||||||
authors of previous versions.
|
|
||||||
|
|
||||||
Some devices are designed to deny users access to install or run
|
|
||||||
modified versions of the software inside them, although the manufacturer
|
|
||||||
can do so. This is fundamentally incompatible with the aim of
|
|
||||||
protecting users' freedom to change the software. The systematic
|
|
||||||
pattern of such abuse occurs in the area of products for individuals to
|
|
||||||
use, which is precisely where it is most unacceptable. Therefore, we
|
|
||||||
have designed this version of the GPL to prohibit the practice for those
|
|
||||||
products. If such problems arise substantially in other domains, we
|
|
||||||
stand ready to extend this provision to those domains in future versions
|
|
||||||
of the GPL, as needed to protect the freedom of users.
|
|
||||||
|
|
||||||
Finally, every program is threatened constantly by software patents.
|
|
||||||
States should not allow patents to restrict development and use of
|
|
||||||
software on general-purpose computers, but in those that do, we wish to
|
|
||||||
avoid the special danger that patents applied to a free program could
|
|
||||||
make it effectively proprietary. To prevent this, the GPL assures that
|
|
||||||
patents cannot be used to render the program non-free.
|
|
||||||
|
|
||||||
The precise terms and conditions for copying, distribution and
|
|
||||||
modification follow.
|
|
||||||
|
|
||||||
TERMS AND CONDITIONS
|
|
||||||
|
|
||||||
0. Definitions.
|
|
||||||
|
|
||||||
"This License" refers to version 3 of the GNU General Public License.
|
|
||||||
|
|
||||||
"Copyright" also means copyright-like laws that apply to other kinds of
|
|
||||||
works, such as semiconductor masks.
|
|
||||||
|
|
||||||
"The Program" refers to any copyrightable work licensed under this
|
|
||||||
License. Each licensee is addressed as "you". "Licensees" and
|
|
||||||
"recipients" may be individuals or organizations.
|
|
||||||
|
|
||||||
To "modify" a work means to copy from or adapt all or part of the work
|
|
||||||
in a fashion requiring copyright permission, other than the making of an
|
|
||||||
exact copy. The resulting work is called a "modified version" of the
|
|
||||||
earlier work or a work "based on" the earlier work.
|
|
||||||
|
|
||||||
A "covered work" means either the unmodified Program or a work based
|
|
||||||
on the Program.
|
|
||||||
|
|
||||||
To "propagate" a work means to do anything with it that, without
|
|
||||||
permission, would make you directly or secondarily liable for
|
|
||||||
infringement under applicable copyright law, except executing it on a
|
|
||||||
computer or modifying a private copy. Propagation includes copying,
|
|
||||||
distribution (with or without modification), making available to the
|
|
||||||
public, and in some countries other activities as well.
|
|
||||||
|
|
||||||
To "convey" a work means any kind of propagation that enables other
|
|
||||||
parties to make or receive copies. Mere interaction with a user through
|
|
||||||
a computer network, with no transfer of a copy, is not conveying.
|
|
||||||
|
|
||||||
An interactive user interface displays "Appropriate Legal Notices"
|
|
||||||
to the extent that it includes a convenient and prominently visible
|
|
||||||
feature that (1) displays an appropriate copyright notice, and (2)
|
|
||||||
tells the user that there is no warranty for the work (except to the
|
|
||||||
extent that warranties are provided), that licensees may convey the
|
|
||||||
work under this License, and how to view a copy of this License. If
|
|
||||||
the interface presents a list of user commands or options, such as a
|
|
||||||
menu, a prominent item in the list meets this criterion.
|
|
||||||
|
|
||||||
1. Source Code.
|
|
||||||
|
|
||||||
The "source code" for a work means the preferred form of the work
|
|
||||||
for making modifications to it. "Object code" means any non-source
|
|
||||||
form of a work.
|
|
||||||
|
|
||||||
A "Standard Interface" means an interface that either is an official
|
|
||||||
standard defined by a recognized standards body, or, in the case of
|
|
||||||
interfaces specified for a particular programming language, one that
|
|
||||||
is widely used among developers working in that language.
|
|
||||||
|
|
||||||
The "System Libraries" of an executable work include anything, other
|
|
||||||
than the work as a whole, that (a) is included in the normal form of
|
|
||||||
packaging a Major Component, but which is not part of that Major
|
|
||||||
Component, and (b) serves only to enable use of the work with that
|
|
||||||
Major Component, or to implement a Standard Interface for which an
|
|
||||||
implementation is available to the public in source code form. A
|
|
||||||
"Major Component", in this context, means a major essential component
|
|
||||||
(kernel, window system, and so on) of the specific operating system
|
|
||||||
(if any) on which the executable work runs, or a compiler used to
|
|
||||||
produce the work, or an object code interpreter used to run it.
|
|
||||||
|
|
||||||
The "Corresponding Source" for a work in object code form means all
|
|
||||||
the source code needed to generate, install, and (for an executable
|
|
||||||
work) run the object code and to modify the work, including scripts to
|
|
||||||
control those activities. However, it does not include the work's
|
|
||||||
System Libraries, or general-purpose tools or generally available free
|
|
||||||
programs which are used unmodified in performing those activities but
|
|
||||||
which are not part of the work. For example, Corresponding Source
|
|
||||||
includes interface definition files associated with source files for
|
|
||||||
the work, and the source code for shared libraries and dynamically
|
|
||||||
linked subprograms that the work is specifically designed to require,
|
|
||||||
such as by intimate data communication or control flow between those
|
|
||||||
subprograms and other parts of the work.
|
|
||||||
|
|
||||||
The Corresponding Source need not include anything that users
|
|
||||||
can regenerate automatically from other parts of the Corresponding
|
|
||||||
Source.
|
|
||||||
|
|
||||||
The Corresponding Source for a work in source code form is that
|
|
||||||
same work.
|
|
||||||
|
|
||||||
2. Basic Permissions.
|
|
||||||
|
|
||||||
All rights granted under this License are granted for the term of
|
|
||||||
copyright on the Program, and are irrevocable provided the stated
|
|
||||||
conditions are met. This License explicitly affirms your unlimited
|
|
||||||
permission to run the unmodified Program. The output from running a
|
|
||||||
covered work is covered by this License only if the output, given its
|
|
||||||
content, constitutes a covered work. This License acknowledges your
|
|
||||||
rights of fair use or other equivalent, as provided by copyright law.
|
|
||||||
|
|
||||||
You may make, run and propagate covered works that you do not
|
|
||||||
convey, without conditions so long as your license otherwise remains
|
|
||||||
in force. You may convey covered works to others for the sole purpose
|
|
||||||
of having them make modifications exclusively for you, or provide you
|
|
||||||
with facilities for running those works, provided that you comply with
|
|
||||||
the terms of this License in conveying all material for which you do
|
|
||||||
not control copyright. Those thus making or running the covered works
|
|
||||||
for you must do so exclusively on your behalf, under your direction
|
|
||||||
and control, on terms that prohibit them from making any copies of
|
|
||||||
your copyrighted material outside their relationship with you.
|
|
||||||
|
|
||||||
Conveying under any other circumstances is permitted solely under
|
|
||||||
the conditions stated below. Sublicensing is not allowed; section 10
|
|
||||||
makes it unnecessary.
|
|
||||||
|
|
||||||
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
|
||||||
|
|
||||||
No covered work shall be deemed part of an effective technological
|
|
||||||
measure under any applicable law fulfilling obligations under article
|
|
||||||
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
|
||||||
similar laws prohibiting or restricting circumvention of such
|
|
||||||
measures.
|
|
||||||
|
|
||||||
When you convey a covered work, you waive any legal power to forbid
|
|
||||||
circumvention of technological measures to the extent such circumvention
|
|
||||||
is effected by exercising rights under this License with respect to
|
|
||||||
the covered work, and you disclaim any intention to limit operation or
|
|
||||||
modification of the work as a means of enforcing, against the work's
|
|
||||||
users, your or third parties' legal rights to forbid circumvention of
|
|
||||||
technological measures.
|
|
||||||
|
|
||||||
4. Conveying Verbatim Copies.
|
|
||||||
|
|
||||||
You may convey verbatim copies of the Program's source code as you
|
|
||||||
receive it, in any medium, provided that you conspicuously and
|
|
||||||
appropriately publish on each copy an appropriate copyright notice;
|
|
||||||
keep intact all notices stating that this License and any
|
|
||||||
non-permissive terms added in accord with section 7 apply to the code;
|
|
||||||
keep intact all notices of the absence of any warranty; and give all
|
|
||||||
recipients a copy of this License along with the Program.
|
|
||||||
|
|
||||||
You may charge any price or no price for each copy that you convey,
|
|
||||||
and you may offer support or warranty protection for a fee.
|
|
||||||
|
|
||||||
5. Conveying Modified Source Versions.
|
|
||||||
|
|
||||||
You may convey a work based on the Program, or the modifications to
|
|
||||||
produce it from the Program, in the form of source code under the
|
|
||||||
terms of section 4, provided that you also meet all of these conditions:
|
|
||||||
|
|
||||||
a) The work must carry prominent notices stating that you modified
|
|
||||||
it, and giving a relevant date.
|
|
||||||
|
|
||||||
b) The work must carry prominent notices stating that it is
|
|
||||||
released under this License and any conditions added under section
|
|
||||||
7. This requirement modifies the requirement in section 4 to
|
|
||||||
"keep intact all notices".
|
|
||||||
|
|
||||||
c) You must license the entire work, as a whole, under this
|
|
||||||
License to anyone who comes into possession of a copy. This
|
|
||||||
License will therefore apply, along with any applicable section 7
|
|
||||||
additional terms, to the whole of the work, and all its parts,
|
|
||||||
regardless of how they are packaged. This License gives no
|
|
||||||
permission to license the work in any other way, but it does not
|
|
||||||
invalidate such permission if you have separately received it.
|
|
||||||
|
|
||||||
d) If the work has interactive user interfaces, each must display
|
|
||||||
Appropriate Legal Notices; however, if the Program has interactive
|
|
||||||
interfaces that do not display Appropriate Legal Notices, your
|
|
||||||
work need not make them do so.
|
|
||||||
|
|
||||||
A compilation of a covered work with other separate and independent
|
|
||||||
works, which are not by their nature extensions of the covered work,
|
|
||||||
and which are not combined with it such as to form a larger program,
|
|
||||||
in or on a volume of a storage or distribution medium, is called an
|
|
||||||
"aggregate" if the compilation and its resulting copyright are not
|
|
||||||
used to limit the access or legal rights of the compilation's users
|
|
||||||
beyond what the individual works permit. Inclusion of a covered work
|
|
||||||
in an aggregate does not cause this License to apply to the other
|
|
||||||
parts of the aggregate.
|
|
||||||
|
|
||||||
6. Conveying Non-Source Forms.
|
|
||||||
|
|
||||||
You may convey a covered work in object code form under the terms
|
|
||||||
of sections 4 and 5, provided that you also convey the
|
|
||||||
machine-readable Corresponding Source under the terms of this License,
|
|
||||||
in one of these ways:
|
|
||||||
|
|
||||||
a) Convey the object code in, or embodied in, a physical product
|
|
||||||
(including a physical distribution medium), accompanied by the
|
|
||||||
Corresponding Source fixed on a durable physical medium
|
|
||||||
customarily used for software interchange.
|
|
||||||
|
|
||||||
b) Convey the object code in, or embodied in, a physical product
|
|
||||||
(including a physical distribution medium), accompanied by a
|
|
||||||
written offer, valid for at least three years and valid for as
|
|
||||||
long as you offer spare parts or customer support for that product
|
|
||||||
model, to give anyone who possesses the object code either (1) a
|
|
||||||
copy of the Corresponding Source for all the software in the
|
|
||||||
product that is covered by this License, on a durable physical
|
|
||||||
medium customarily used for software interchange, for a price no
|
|
||||||
more than your reasonable cost of physically performing this
|
|
||||||
conveying of source, or (2) access to copy the
|
|
||||||
Corresponding Source from a network server at no charge.
|
|
||||||
|
|
||||||
c) Convey individual copies of the object code with a copy of the
|
|
||||||
written offer to provide the Corresponding Source. This
|
|
||||||
alternative is allowed only occasionally and noncommercially, and
|
|
||||||
only if you received the object code with such an offer, in accord
|
|
||||||
with subsection 6b.
|
|
||||||
|
|
||||||
d) Convey the object code by offering access from a designated
|
|
||||||
place (gratis or for a charge), and offer equivalent access to the
|
|
||||||
Corresponding Source in the same way through the same place at no
|
|
||||||
further charge. You need not require recipients to copy the
|
|
||||||
Corresponding Source along with the object code. If the place to
|
|
||||||
copy the object code is a network server, the Corresponding Source
|
|
||||||
may be on a different server (operated by you or a third party)
|
|
||||||
that supports equivalent copying facilities, provided you maintain
|
|
||||||
clear directions next to the object code saying where to find the
|
|
||||||
Corresponding Source. Regardless of what server hosts the
|
|
||||||
Corresponding Source, you remain obligated to ensure that it is
|
|
||||||
available for as long as needed to satisfy these requirements.
|
|
||||||
|
|
||||||
e) Convey the object code using peer-to-peer transmission, provided
|
|
||||||
you inform other peers where the object code and Corresponding
|
|
||||||
Source of the work are being offered to the general public at no
|
|
||||||
charge under subsection 6d.
|
|
||||||
|
|
||||||
A separable portion of the object code, whose source code is excluded
|
|
||||||
from the Corresponding Source as a System Library, need not be
|
|
||||||
included in conveying the object code work.
|
|
||||||
|
|
||||||
A "User Product" is either (1) a "consumer product", which means any
|
|
||||||
tangible personal property which is normally used for personal, family,
|
|
||||||
or household purposes, or (2) anything designed or sold for incorporation
|
|
||||||
into a dwelling. In determining whether a product is a consumer product,
|
|
||||||
doubtful cases shall be resolved in favor of coverage. For a particular
|
|
||||||
product received by a particular user, "normally used" refers to a
|
|
||||||
typical or common use of that class of product, regardless of the status
|
|
||||||
of the particular user or of the way in which the particular user
|
|
||||||
actually uses, or expects or is expected to use, the product. A product
|
|
||||||
is a consumer product regardless of whether the product has substantial
|
|
||||||
commercial, industrial or non-consumer uses, unless such uses represent
|
|
||||||
the only significant mode of use of the product.
|
|
||||||
|
|
||||||
"Installation Information" for a User Product means any methods,
|
|
||||||
procedures, authorization keys, or other information required to install
|
|
||||||
and execute modified versions of a covered work in that User Product from
|
|
||||||
a modified version of its Corresponding Source. The information must
|
|
||||||
suffice to ensure that the continued functioning of the modified object
|
|
||||||
code is in no case prevented or interfered with solely because
|
|
||||||
modification has been made.
|
|
||||||
|
|
||||||
If you convey an object code work under this section in, or with, or
|
|
||||||
specifically for use in, a User Product, and the conveying occurs as
|
|
||||||
part of a transaction in which the right of possession and use of the
|
|
||||||
User Product is transferred to the recipient in perpetuity or for a
|
|
||||||
fixed term (regardless of how the transaction is characterized), the
|
|
||||||
Corresponding Source conveyed under this section must be accompanied
|
|
||||||
by the Installation Information. But this requirement does not apply
|
|
||||||
if neither you nor any third party retains the ability to install
|
|
||||||
modified object code on the User Product (for example, the work has
|
|
||||||
been installed in ROM).
|
|
||||||
|
|
||||||
The requirement to provide Installation Information does not include a
|
|
||||||
requirement to continue to provide support service, warranty, or updates
|
|
||||||
for a work that has been modified or installed by the recipient, or for
|
|
||||||
the User Product in which it has been modified or installed. Access to a
|
|
||||||
network may be denied when the modification itself materially and
|
|
||||||
adversely affects the operation of the network or violates the rules and
|
|
||||||
protocols for communication across the network.
|
|
||||||
|
|
||||||
Corresponding Source conveyed, and Installation Information provided,
|
|
||||||
in accord with this section must be in a format that is publicly
|
|
||||||
documented (and with an implementation available to the public in
|
|
||||||
source code form), and must require no special password or key for
|
|
||||||
unpacking, reading or copying.
|
|
||||||
|
|
||||||
7. Additional Terms.
|
|
||||||
|
|
||||||
"Additional permissions" are terms that supplement the terms of this
|
|
||||||
License by making exceptions from one or more of its conditions.
|
|
||||||
Additional permissions that are applicable to the entire Program shall
|
|
||||||
be treated as though they were included in this License, to the extent
|
|
||||||
that they are valid under applicable law. If additional permissions
|
|
||||||
apply only to part of the Program, that part may be used separately
|
|
||||||
under those permissions, but the entire Program remains governed by
|
|
||||||
this License without regard to the additional permissions.
|
|
||||||
|
|
||||||
When you convey a copy of a covered work, you may at your option
|
|
||||||
remove any additional permissions from that copy, or from any part of
|
|
||||||
it. (Additional permissions may be written to require their own
|
|
||||||
removal in certain cases when you modify the work.) You may place
|
|
||||||
additional permissions on material, added by you to a covered work,
|
|
||||||
for which you have or can give appropriate copyright permission.
|
|
||||||
|
|
||||||
Notwithstanding any other provision of this License, for material you
|
|
||||||
add to a covered work, you may (if authorized by the copyright holders of
|
|
||||||
that material) supplement the terms of this License with terms:
|
|
||||||
|
|
||||||
a) Disclaiming warranty or limiting liability differently from the
|
|
||||||
terms of sections 15 and 16 of this License; or
|
|
||||||
|
|
||||||
b) Requiring preservation of specified reasonable legal notices or
|
|
||||||
author attributions in that material or in the Appropriate Legal
|
|
||||||
Notices displayed by works containing it; or
|
|
||||||
|
|
||||||
c) Prohibiting misrepresentation of the origin of that material, or
|
|
||||||
requiring that modified versions of such material be marked in
|
|
||||||
reasonable ways as different from the original version; or
|
|
||||||
|
|
||||||
d) Limiting the use for publicity purposes of names of licensors or
|
|
||||||
authors of the material; or
|
|
||||||
|
|
||||||
e) Declining to grant rights under trademark law for use of some
|
|
||||||
trade names, trademarks, or service marks; or
|
|
||||||
|
|
||||||
f) Requiring indemnification of licensors and authors of that
|
|
||||||
material by anyone who conveys the material (or modified versions of
|
|
||||||
it) with contractual assumptions of liability to the recipient, for
|
|
||||||
any liability that these contractual assumptions directly impose on
|
|
||||||
those licensors and authors.
|
|
||||||
|
|
||||||
All other non-permissive additional terms are considered "further
|
|
||||||
restrictions" within the meaning of section 10. If the Program as you
|
|
||||||
received it, or any part of it, contains a notice stating that it is
|
|
||||||
governed by this License along with a term that is a further
|
|
||||||
restriction, you may remove that term. If a license document contains
|
|
||||||
a further restriction but permits relicensing or conveying under this
|
|
||||||
License, you may add to a covered work material governed by the terms
|
|
||||||
of that license document, provided that the further restriction does
|
|
||||||
not survive such relicensing or conveying.
|
|
||||||
|
|
||||||
If you add terms to a covered work in accord with this section, you
|
|
||||||
must place, in the relevant source files, a statement of the
|
|
||||||
additional terms that apply to those files, or a notice indicating
|
|
||||||
where to find the applicable terms.
|
|
||||||
|
|
||||||
Additional terms, permissive or non-permissive, may be stated in the
|
|
||||||
form of a separately written license, or stated as exceptions;
|
|
||||||
the above requirements apply either way.
|
|
||||||
|
|
||||||
8. Termination.
|
|
||||||
|
|
||||||
You may not propagate or modify a covered work except as expressly
|
|
||||||
provided under this License. Any attempt otherwise to propagate or
|
|
||||||
modify it is void, and will automatically terminate your rights under
|
|
||||||
this License (including any patent licenses granted under the third
|
|
||||||
paragraph of section 11).
|
|
||||||
|
|
||||||
However, if you cease all violation of this License, then your
|
|
||||||
license from a particular copyright holder is reinstated (a)
|
|
||||||
provisionally, unless and until the copyright holder explicitly and
|
|
||||||
finally terminates your license, and (b) permanently, if the copyright
|
|
||||||
holder fails to notify you of the violation by some reasonable means
|
|
||||||
prior to 60 days after the cessation.
|
|
||||||
|
|
||||||
Moreover, your license from a particular copyright holder is
|
|
||||||
reinstated permanently if the copyright holder notifies you of the
|
|
||||||
violation by some reasonable means, this is the first time you have
|
|
||||||
received notice of violation of this License (for any work) from that
|
|
||||||
copyright holder, and you cure the violation prior to 30 days after
|
|
||||||
your receipt of the notice.
|
|
||||||
|
|
||||||
Termination of your rights under this section does not terminate the
|
|
||||||
licenses of parties who have received copies or rights from you under
|
|
||||||
this License. If your rights have been terminated and not permanently
|
|
||||||
reinstated, you do not qualify to receive new licenses for the same
|
|
||||||
material under section 10.
|
|
||||||
|
|
||||||
9. Acceptance Not Required for Having Copies.
|
|
||||||
|
|
||||||
You are not required to accept this License in order to receive or
|
|
||||||
run a copy of the Program. Ancillary propagation of a covered work
|
|
||||||
occurring solely as a consequence of using peer-to-peer transmission
|
|
||||||
to receive a copy likewise does not require acceptance. However,
|
|
||||||
nothing other than this License grants you permission to propagate or
|
|
||||||
modify any covered work. These actions infringe copyright if you do
|
|
||||||
not accept this License. Therefore, by modifying or propagating a
|
|
||||||
covered work, you indicate your acceptance of this License to do so.
|
|
||||||
|
|
||||||
10. Automatic Licensing of Downstream Recipients.
|
|
||||||
|
|
||||||
Each time you convey a covered work, the recipient automatically
|
|
||||||
receives a license from the original licensors, to run, modify and
|
|
||||||
propagate that work, subject to this License. You are not responsible
|
|
||||||
for enforcing compliance by third parties with this License.
|
|
||||||
|
|
||||||
An "entity transaction" is a transaction transferring control of an
|
|
||||||
organization, or substantially all assets of one, or subdividing an
|
|
||||||
organization, or merging organizations. If propagation of a covered
|
|
||||||
work results from an entity transaction, each party to that
|
|
||||||
transaction who receives a copy of the work also receives whatever
|
|
||||||
licenses to the work the party's predecessor in interest had or could
|
|
||||||
give under the previous paragraph, plus a right to possession of the
|
|
||||||
Corresponding Source of the work from the predecessor in interest, if
|
|
||||||
the predecessor has it or can get it with reasonable efforts.
|
|
||||||
|
|
||||||
You may not impose any further restrictions on the exercise of the
|
|
||||||
rights granted or affirmed under this License. For example, you may
|
|
||||||
not impose a license fee, royalty, or other charge for exercise of
|
|
||||||
rights granted under this License, and you may not initiate litigation
|
|
||||||
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
|
||||||
any patent claim is infringed by making, using, selling, offering for
|
|
||||||
sale, or importing the Program or any portion of it.
|
|
||||||
|
|
||||||
11. Patents.
|
|
||||||
|
|
||||||
A "contributor" is a copyright holder who authorizes use under this
|
|
||||||
License of the Program or a work on which the Program is based. The
|
|
||||||
work thus licensed is called the contributor's "contributor version".
|
|
||||||
|
|
||||||
A contributor's "essential patent claims" are all patent claims
|
|
||||||
owned or controlled by the contributor, whether already acquired or
|
|
||||||
hereafter acquired, that would be infringed by some manner, permitted
|
|
||||||
by this License, of making, using, or selling its contributor version,
|
|
||||||
but do not include claims that would be infringed only as a
|
|
||||||
consequence of further modification of the contributor version. For
|
|
||||||
purposes of this definition, "control" includes the right to grant
|
|
||||||
patent sublicenses in a manner consistent with the requirements of
|
|
||||||
this License.
|
|
||||||
|
|
||||||
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
|
||||||
patent license under the contributor's essential patent claims, to
|
|
||||||
make, use, sell, offer for sale, import and otherwise run, modify and
|
|
||||||
propagate the contents of its contributor version.
|
|
||||||
|
|
||||||
In the following three paragraphs, a "patent license" is any express
|
|
||||||
agreement or commitment, however denominated, not to enforce a patent
|
|
||||||
(such as an express permission to practice a patent or covenant not to
|
|
||||||
sue for patent infringement). To "grant" such a patent license to a
|
|
||||||
party means to make such an agreement or commitment not to enforce a
|
|
||||||
patent against the party.
|
|
||||||
|
|
||||||
If you convey a covered work, knowingly relying on a patent license,
|
|
||||||
and the Corresponding Source of the work is not available for anyone
|
|
||||||
to copy, free of charge and under the terms of this License, through a
|
|
||||||
publicly available network server or other readily accessible means,
|
|
||||||
then you must either (1) cause the Corresponding Source to be so
|
|
||||||
available, or (2) arrange to deprive yourself of the benefit of the
|
|
||||||
patent license for this particular work, or (3) arrange, in a manner
|
|
||||||
consistent with the requirements of this License, to extend the patent
|
|
||||||
license to downstream recipients. "Knowingly relying" means you have
|
|
||||||
actual knowledge that, but for the patent license, your conveying the
|
|
||||||
covered work in a country, or your recipient's use of the covered work
|
|
||||||
in a country, would infringe one or more identifiable patents in that
|
|
||||||
country that you have reason to believe are valid.
|
|
||||||
|
|
||||||
If, pursuant to or in connection with a single transaction or
|
|
||||||
arrangement, you convey, or propagate by procuring conveyance of, a
|
|
||||||
covered work, and grant a patent license to some of the parties
|
|
||||||
receiving the covered work authorizing them to use, propagate, modify
|
|
||||||
or convey a specific copy of the covered work, then the patent license
|
|
||||||
you grant is automatically extended to all recipients of the covered
|
|
||||||
work and works based on it.
|
|
||||||
|
|
||||||
A patent license is "discriminatory" if it does not include within
|
|
||||||
the scope of its coverage, prohibits the exercise of, or is
|
|
||||||
conditioned on the non-exercise of one or more of the rights that are
|
|
||||||
specifically granted under this License. You may not convey a covered
|
|
||||||
work if you are a party to an arrangement with a third party that is
|
|
||||||
in the business of distributing software, under which you make payment
|
|
||||||
to the third party based on the extent of your activity of conveying
|
|
||||||
the work, and under which the third party grants, to any of the
|
|
||||||
parties who would receive the covered work from you, a discriminatory
|
|
||||||
patent license (a) in connection with copies of the covered work
|
|
||||||
conveyed by you (or copies made from those copies), or (b) primarily
|
|
||||||
for and in connection with specific products or compilations that
|
|
||||||
contain the covered work, unless you entered into that arrangement,
|
|
||||||
or that patent license was granted, prior to 28 March 2007.
|
|
||||||
|
|
||||||
Nothing in this License shall be construed as excluding or limiting
|
|
||||||
any implied license or other defenses to infringement that may
|
|
||||||
otherwise be available to you under applicable patent law.
|
|
||||||
|
|
||||||
12. No Surrender of Others' Freedom.
|
|
||||||
|
|
||||||
If conditions are imposed on you (whether by court order, agreement or
|
|
||||||
otherwise) that contradict the conditions of this License, they do not
|
|
||||||
excuse you from the conditions of this License. If you cannot convey a
|
|
||||||
covered work so as to satisfy simultaneously your obligations under this
|
|
||||||
License and any other pertinent obligations, then as a consequence you may
|
|
||||||
not convey it at all. For example, if you agree to terms that obligate you
|
|
||||||
to collect a royalty for further conveying from those to whom you convey
|
|
||||||
the Program, the only way you could satisfy both those terms and this
|
|
||||||
License would be to refrain entirely from conveying the Program.
|
|
||||||
|
|
||||||
13. Use with the GNU Affero General Public License.
|
|
||||||
|
|
||||||
Notwithstanding any other provision of this License, you have
|
|
||||||
permission to link or combine any covered work with a work licensed
|
|
||||||
under version 3 of the GNU Affero General Public License into a single
|
|
||||||
combined work, and to convey the resulting work. The terms of this
|
|
||||||
License will continue to apply to the part which is the covered work,
|
|
||||||
but the special requirements of the GNU Affero General Public License,
|
|
||||||
section 13, concerning interaction through a network will apply to the
|
|
||||||
combination as such.
|
|
||||||
|
|
||||||
14. Revised Versions of this License.
|
|
||||||
|
|
||||||
The Free Software Foundation may publish revised and/or new versions of
|
|
||||||
the GNU General Public License from time to time. Such new versions will
|
|
||||||
be similar in spirit to the present version, but may differ in detail to
|
|
||||||
address new problems or concerns.
|
|
||||||
|
|
||||||
Each version is given a distinguishing version number. If the
|
|
||||||
Program specifies that a certain numbered version of the GNU General
|
|
||||||
Public License "or any later version" applies to it, you have the
|
|
||||||
option of following the terms and conditions either of that numbered
|
|
||||||
version or of any later version published by the Free Software
|
|
||||||
Foundation. If the Program does not specify a version number of the
|
|
||||||
GNU General Public License, you may choose any version ever published
|
|
||||||
by the Free Software Foundation.
|
|
||||||
|
|
||||||
If the Program specifies that a proxy can decide which future
|
|
||||||
versions of the GNU General Public License can be used, that proxy's
|
|
||||||
public statement of acceptance of a version permanently authorizes you
|
|
||||||
to choose that version for the Program.
|
|
||||||
|
|
||||||
Later license versions may give you additional or different
|
|
||||||
permissions. However, no additional obligations are imposed on any
|
|
||||||
author or copyright holder as a result of your choosing to follow a
|
|
||||||
later version.
|
|
||||||
|
|
||||||
15. Disclaimer of Warranty.
|
|
||||||
|
|
||||||
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
|
||||||
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
|
||||||
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
|
|
||||||
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
|
||||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
|
||||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
|
|
||||||
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
|
|
||||||
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
|
||||||
|
|
||||||
16. Limitation of Liability.
|
|
||||||
|
|
||||||
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
|
||||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
|
|
||||||
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
|
||||||
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
|
|
||||||
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
|
|
||||||
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
|
|
||||||
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
|
|
||||||
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
|
|
||||||
SUCH DAMAGES.
|
|
||||||
|
|
||||||
17. Interpretation of Sections 15 and 16.
|
|
||||||
|
|
||||||
If the disclaimer of warranty and limitation of liability provided
|
|
||||||
above cannot be given local legal effect according to their terms,
|
|
||||||
reviewing courts shall apply local law that most closely approximates
|
|
||||||
an absolute waiver of all civil liability in connection with the
|
|
||||||
Program, unless a warranty or assumption of liability accompanies a
|
|
||||||
copy of the Program in return for a fee.
|
|
||||||
|
|
||||||
END OF TERMS AND CONDITIONS
|
|
||||||
|
|
||||||
How to Apply These Terms to Your New Programs
|
|
||||||
|
|
||||||
If you develop a new program, and you want it to be of the greatest
|
|
||||||
possible use to the public, the best way to achieve this is to make it
|
|
||||||
free software which everyone can redistribute and change under these terms.
|
|
||||||
|
|
||||||
To do so, attach the following notices to the program. It is safest
|
|
||||||
to attach them to the start of each source file to most effectively
|
|
||||||
state the exclusion of warranty; and each file should have at least
|
|
||||||
the "copyright" line and a pointer to where the full notice is found.
|
|
||||||
|
|
||||||
<one line to give the program's name and a brief idea of what it does.>
|
|
||||||
Copyright (C) <year> <name of author>
|
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU 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 General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
|
||||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
Also add information on how to contact you by electronic and paper mail.
|
|
||||||
|
|
||||||
If the program does terminal interaction, make it output a short
|
|
||||||
notice like this when it starts in an interactive mode:
|
|
||||||
|
|
||||||
<program> Copyright (C) <year> <name of author>
|
|
||||||
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
|
||||||
This is free software, and you are welcome to redistribute it
|
|
||||||
under certain conditions; type `show c' for details.
|
|
||||||
|
|
||||||
The hypothetical commands `show w' and `show c' should show the appropriate
|
|
||||||
parts of the General Public License. Of course, your program's commands
|
|
||||||
might be different; for a GUI interface, you would use an "about box".
|
|
||||||
|
|
||||||
You should also get your employer (if you work as a programmer) or school,
|
|
||||||
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
|
||||||
For more information on this, and how to apply and follow the GNU GPL, see
|
|
||||||
<http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
The GNU General Public License does not permit incorporating your program
|
|
||||||
into proprietary programs. If your program is a subroutine library, you
|
|
||||||
may consider it more useful to permit linking proprietary applications with
|
|
||||||
the library. If this is what you want to do, use the GNU Lesser General
|
|
||||||
Public License instead of this License. But first, please read
|
|
||||||
<http://www.gnu.org/philosophy/why-not-lgpl.html>.
|
|
||||||
@@ -1,165 +0,0 @@
|
|||||||
GNU LESSER GENERAL PUBLIC LICENSE
|
|
||||||
Version 3, 29 June 2007
|
|
||||||
|
|
||||||
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
|
|
||||||
Everyone is permitted to copy and distribute verbatim copies
|
|
||||||
of this license document, but changing it is not allowed.
|
|
||||||
|
|
||||||
|
|
||||||
This version of the GNU Lesser General Public License incorporates
|
|
||||||
the terms and conditions of version 3 of the GNU General Public
|
|
||||||
License, supplemented by the additional permissions listed below.
|
|
||||||
|
|
||||||
0. Additional Definitions.
|
|
||||||
|
|
||||||
As used herein, "this License" refers to version 3 of the GNU Lesser
|
|
||||||
General Public License, and the "GNU GPL" refers to version 3 of the GNU
|
|
||||||
General Public License.
|
|
||||||
|
|
||||||
"The Library" refers to a covered work governed by this License,
|
|
||||||
other than an Application or a Combined Work as defined below.
|
|
||||||
|
|
||||||
An "Application" is any work that makes use of an interface provided
|
|
||||||
by the Library, but which is not otherwise based on the Library.
|
|
||||||
Defining a subclass of a class defined by the Library is deemed a mode
|
|
||||||
of using an interface provided by the Library.
|
|
||||||
|
|
||||||
A "Combined Work" is a work produced by combining or linking an
|
|
||||||
Application with the Library. The particular version of the Library
|
|
||||||
with which the Combined Work was made is also called the "Linked
|
|
||||||
Version".
|
|
||||||
|
|
||||||
The "Minimal Corresponding Source" for a Combined Work means the
|
|
||||||
Corresponding Source for the Combined Work, excluding any source code
|
|
||||||
for portions of the Combined Work that, considered in isolation, are
|
|
||||||
based on the Application, and not on the Linked Version.
|
|
||||||
|
|
||||||
The "Corresponding Application Code" for a Combined Work means the
|
|
||||||
object code and/or source code for the Application, including any data
|
|
||||||
and utility programs needed for reproducing the Combined Work from the
|
|
||||||
Application, but excluding the System Libraries of the Combined Work.
|
|
||||||
|
|
||||||
1. Exception to Section 3 of the GNU GPL.
|
|
||||||
|
|
||||||
You may convey a covered work under sections 3 and 4 of this License
|
|
||||||
without being bound by section 3 of the GNU GPL.
|
|
||||||
|
|
||||||
2. Conveying Modified Versions.
|
|
||||||
|
|
||||||
If you modify a copy of the Library, and, in your modifications, a
|
|
||||||
facility refers to a function or data to be supplied by an Application
|
|
||||||
that uses the facility (other than as an argument passed when the
|
|
||||||
facility is invoked), then you may convey a copy of the modified
|
|
||||||
version:
|
|
||||||
|
|
||||||
a) under this License, provided that you make a good faith effort to
|
|
||||||
ensure that, in the event an Application does not supply the
|
|
||||||
function or data, the facility still operates, and performs
|
|
||||||
whatever part of its purpose remains meaningful, or
|
|
||||||
|
|
||||||
b) under the GNU GPL, with none of the additional permissions of
|
|
||||||
this License applicable to that copy.
|
|
||||||
|
|
||||||
3. Object Code Incorporating Material from Library Header Files.
|
|
||||||
|
|
||||||
The object code form of an Application may incorporate material from
|
|
||||||
a header file that is part of the Library. You may convey such object
|
|
||||||
code under terms of your choice, provided that, if the incorporated
|
|
||||||
material is not limited to numerical parameters, data structure
|
|
||||||
layouts and accessors, or small macros, inline functions and templates
|
|
||||||
(ten or fewer lines in length), you do both of the following:
|
|
||||||
|
|
||||||
a) Give prominent notice with each copy of the object code that the
|
|
||||||
Library is used in it and that the Library and its use are
|
|
||||||
covered by this License.
|
|
||||||
|
|
||||||
b) Accompany the object code with a copy of the GNU GPL and this license
|
|
||||||
document.
|
|
||||||
|
|
||||||
4. Combined Works.
|
|
||||||
|
|
||||||
You may convey a Combined Work under terms of your choice that,
|
|
||||||
taken together, effectively do not restrict modification of the
|
|
||||||
portions of the Library contained in the Combined Work and reverse
|
|
||||||
engineering for debugging such modifications, if you also do each of
|
|
||||||
the following:
|
|
||||||
|
|
||||||
a) Give prominent notice with each copy of the Combined Work that
|
|
||||||
the Library is used in it and that the Library and its use are
|
|
||||||
covered by this License.
|
|
||||||
|
|
||||||
b) Accompany the Combined Work with a copy of the GNU GPL and this license
|
|
||||||
document.
|
|
||||||
|
|
||||||
c) For a Combined Work that displays copyright notices during
|
|
||||||
execution, include the copyright notice for the Library among
|
|
||||||
these notices, as well as a reference directing the user to the
|
|
||||||
copies of the GNU GPL and this license document.
|
|
||||||
|
|
||||||
d) Do one of the following:
|
|
||||||
|
|
||||||
0) Convey the Minimal Corresponding Source under the terms of this
|
|
||||||
License, and the Corresponding Application Code in a form
|
|
||||||
suitable for, and under terms that permit, the user to
|
|
||||||
recombine or relink the Application with a modified version of
|
|
||||||
the Linked Version to produce a modified Combined Work, in the
|
|
||||||
manner specified by section 6 of the GNU GPL for conveying
|
|
||||||
Corresponding Source.
|
|
||||||
|
|
||||||
1) Use a suitable shared library mechanism for linking with the
|
|
||||||
Library. A suitable mechanism is one that (a) uses at run time
|
|
||||||
a copy of the Library already present on the user's computer
|
|
||||||
system, and (b) will operate properly with a modified version
|
|
||||||
of the Library that is interface-compatible with the Linked
|
|
||||||
Version.
|
|
||||||
|
|
||||||
e) Provide Installation Information, but only if you would otherwise
|
|
||||||
be required to provide such information under section 6 of the
|
|
||||||
GNU GPL, and only to the extent that such information is
|
|
||||||
necessary to install and execute a modified version of the
|
|
||||||
Combined Work produced by recombining or relinking the
|
|
||||||
Application with a modified version of the Linked Version. (If
|
|
||||||
you use option 4d0, the Installation Information must accompany
|
|
||||||
the Minimal Corresponding Source and Corresponding Application
|
|
||||||
Code. If you use option 4d1, you must provide the Installation
|
|
||||||
Information in the manner specified by section 6 of the GNU GPL
|
|
||||||
for conveying Corresponding Source.)
|
|
||||||
|
|
||||||
5. Combined Libraries.
|
|
||||||
|
|
||||||
You may place library facilities that are a work based on the
|
|
||||||
Library side by side in a single library together with other library
|
|
||||||
facilities that are not Applications and are not covered by this
|
|
||||||
License, and convey such a combined library under terms of your
|
|
||||||
choice, if you do both of the following:
|
|
||||||
|
|
||||||
a) Accompany the combined library with a copy of the same work based
|
|
||||||
on the Library, uncombined with any other library facilities,
|
|
||||||
conveyed under the terms of this License.
|
|
||||||
|
|
||||||
b) Give prominent notice with the combined library that part of it
|
|
||||||
is a work based on the Library, and explaining where to find the
|
|
||||||
accompanying uncombined form of the same work.
|
|
||||||
|
|
||||||
6. Revised Versions of the GNU Lesser General Public License.
|
|
||||||
|
|
||||||
The Free Software Foundation may publish revised and/or new versions
|
|
||||||
of the GNU Lesser General Public License from time to time. Such new
|
|
||||||
versions will be similar in spirit to the present version, but may
|
|
||||||
differ in detail to address new problems or concerns.
|
|
||||||
|
|
||||||
Each version is given a distinguishing version number. If the
|
|
||||||
Library as you received it specifies that a certain numbered version
|
|
||||||
of the GNU Lesser General Public License "or any later version"
|
|
||||||
applies to it, you have the option of following the terms and
|
|
||||||
conditions either of that published version or of any later version
|
|
||||||
published by the Free Software Foundation. If the Library as you
|
|
||||||
received it does not specify a version number of the GNU Lesser
|
|
||||||
General Public License, you may choose any version of the GNU Lesser
|
|
||||||
General Public License ever published by the Free Software Foundation.
|
|
||||||
|
|
||||||
If the Library as you received it specifies that a proxy can decide
|
|
||||||
whether future versions of the GNU Lesser General Public License shall
|
|
||||||
apply, that proxy's public statement of acceptance of any version is
|
|
||||||
permanent authorization for you to choose that version for the
|
|
||||||
Library.
|
|
||||||
@@ -5,7 +5,7 @@ dependencies {
|
|||||||
compile project(':vtm-themes')
|
compile project(':vtm-themes')
|
||||||
compile project(':vtm-extras')
|
compile project(':vtm-extras')
|
||||||
compile 'com.noveogroup.android:android-logger:1.3.6'
|
compile 'com.noveogroup.android:android-logger:1.3.6'
|
||||||
compile 'com.squareup.okhttp3:okhttp:3.6.0'
|
compile 'com.squareup.okhttp3:okhttp:3.8.0'
|
||||||
}
|
}
|
||||||
|
|
||||||
android {
|
android {
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2013 Ahmad Saleem
|
* Copyright 2013 Ahmad Saleem
|
||||||
* Copyright 2013 Hannes Janetzek
|
* Copyright 2013 Hannes Janetzek
|
||||||
* Copyright 2016 devemux86
|
* Copyright 2016-2017 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
|
||||||
@@ -85,6 +85,11 @@ public class Compass extends Layer implements SensorEventListener, Map.UpdateLis
|
|||||||
setEnabled(false);
|
setEnabled(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean hasRotation() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public synchronized float getRotation() {
|
public synchronized float getRotation() {
|
||||||
return mCurRotation;
|
return mCurRotation;
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2013 Hannes Janetzek
|
* Copyright 2013 Hannes Janetzek
|
||||||
* Copyright 2016 devemux86
|
* Copyright 2016-2017 devemux86
|
||||||
* Copyright 2016 Longri
|
* Copyright 2016-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).
|
||||||
*
|
*
|
||||||
@@ -47,7 +47,7 @@ public class AwtBitmap implements Bitmap {
|
|||||||
boolean internal;
|
boolean internal;
|
||||||
|
|
||||||
public AwtBitmap(int width, int height, int format) {
|
public AwtBitmap(int width, int height, int format) {
|
||||||
bitmap = new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB);
|
bitmap = new BufferedImage(width, height, format != 0 ? format : BufferedImage.TYPE_INT_ARGB);
|
||||||
this.width = width;
|
this.width = width;
|
||||||
this.height = height;
|
this.height = height;
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,9 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2010, 2011, 2012, 2013 mapsforge.org
|
* Copyright 2010, 2011, 2012, 2013 mapsforge.org
|
||||||
* Copyright 2013 Hannes Janetzek
|
* Copyright 2013 Hannes Janetzek
|
||||||
* Copyright 2016 devemux86
|
* Copyright 2016-2017 devemux86
|
||||||
|
* Copyright 2017 nebular
|
||||||
|
* 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).
|
||||||
*
|
*
|
||||||
@@ -26,11 +28,13 @@ import org.oscim.backend.canvas.Paint;
|
|||||||
import java.awt.AlphaComposite;
|
import java.awt.AlphaComposite;
|
||||||
import java.awt.Composite;
|
import java.awt.Composite;
|
||||||
import java.awt.Graphics2D;
|
import java.awt.Graphics2D;
|
||||||
|
import java.awt.Image;
|
||||||
import java.awt.RenderingHints;
|
import java.awt.RenderingHints;
|
||||||
import java.awt.Shape;
|
import java.awt.Shape;
|
||||||
import java.awt.font.TextLayout;
|
import java.awt.font.TextLayout;
|
||||||
import java.awt.geom.AffineTransform;
|
import java.awt.geom.AffineTransform;
|
||||||
import java.awt.image.BufferedImage;
|
import java.awt.image.BufferedImage;
|
||||||
|
import java.awt.image.DataBufferInt;
|
||||||
|
|
||||||
public class AwtCanvas implements Canvas {
|
public class AwtCanvas implements Canvas {
|
||||||
|
|
||||||
@@ -126,23 +130,62 @@ public class AwtCanvas implements Canvas {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void drawBitmap(Bitmap bitmap, float x, float y) {
|
public void drawBitmap(Bitmap bitmap, float x, float y) {
|
||||||
this.canvas.drawImage(((AwtBitmap) bitmap).bitmap, (int) x, (int) y, null);
|
BufferedImage src = ((AwtBitmap) bitmap).bitmap;
|
||||||
|
// TODO Need better check
|
||||||
|
if (src.isAlphaPremultiplied()) {
|
||||||
|
int intX = (int) x;
|
||||||
|
int intY = (int) y;
|
||||||
|
int[] srcbuf = ((DataBufferInt) src.getRaster().getDataBuffer()).getData();
|
||||||
|
int[] dstbuf = ((DataBufferInt) this.bitmap.getRaster().getDataBuffer()).getData();
|
||||||
|
int width = intX + src.getWidth() > this.bitmap.getWidth() ? this.getWidth() - intX : src.getWidth();
|
||||||
|
int height = intY + src.getHeight() > this.bitmap.getHeight() ? this.getHeight() - intY : src.getHeight();
|
||||||
|
int dstoffs = intX + intY * this.bitmap.getWidth();
|
||||||
|
int srcoffs = 0;
|
||||||
|
for (int i = 0; i < height; i++, dstoffs += this.bitmap.getWidth(), srcoffs += width)
|
||||||
|
System.arraycopy(srcbuf, srcoffs, dstbuf, dstoffs, width);
|
||||||
|
} else
|
||||||
|
this.canvas.drawImage(src, (int) x, (int) y, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void drawLine(int x1, int y1, int x2, int y2, Paint paint) {
|
public void drawBitmapScaled(Bitmap bitmap) {
|
||||||
|
Image scaledImage = ((AwtBitmap) bitmap).bitmap.getScaledInstance(this.bitmap.getWidth(), this.bitmap.getHeight(), Image.SCALE_DEFAULT);
|
||||||
|
this.canvas.drawImage(scaledImage, 0, 0, this.bitmap.getWidth(), this.bitmap.getHeight(), null);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void drawCircle(float x, float y, float radius, Paint paint) {
|
||||||
AwtPaint awtPaint = (AwtPaint) paint;
|
AwtPaint awtPaint = (AwtPaint) paint;
|
||||||
this.canvas.setColor(awtPaint.color);
|
this.canvas.setColor(awtPaint.color);
|
||||||
if (awtPaint.stroke != null)
|
if (awtPaint.stroke != null)
|
||||||
this.canvas.setStroke(awtPaint.stroke);
|
this.canvas.setStroke(awtPaint.stroke);
|
||||||
this.canvas.drawLine(x1, y1, x2, y2);
|
float doubleRadius = radius * 2;
|
||||||
|
|
||||||
|
Paint.Style style = paint.getStyle();
|
||||||
|
switch (style) {
|
||||||
|
case FILL:
|
||||||
|
this.canvas.fillOval((int) (x - radius), (int) (y - radius), (int) doubleRadius, (int) doubleRadius);
|
||||||
|
break;
|
||||||
|
case STROKE:
|
||||||
|
this.canvas.drawOval((int) (x - radius), (int) (y - radius), (int) doubleRadius, (int) doubleRadius);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void drawLine(float x1, float y1, float x2, float y2, Paint paint) {
|
||||||
|
AwtPaint awtPaint = (AwtPaint) paint;
|
||||||
|
this.canvas.setColor(awtPaint.color);
|
||||||
|
if (awtPaint.stroke != null)
|
||||||
|
this.canvas.setStroke(awtPaint.stroke);
|
||||||
|
this.canvas.drawLine((int) x1, (int) y1, (int) x2, (int) y2);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void fillColor(int color) {
|
public void fillColor(int color) {
|
||||||
java.awt.Color awtColor = color == Color.TRANSPARENT ? TRANSPARENT : new java.awt.Color(color);
|
java.awt.Color awtColor = color == Color.TRANSPARENT ? TRANSPARENT : new java.awt.Color(color);
|
||||||
Composite originalComposite = this.canvas.getComposite();
|
Composite originalComposite = this.canvas.getComposite();
|
||||||
this.canvas.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC));
|
this.canvas.setComposite(AlphaComposite.getInstance(color == Color.TRANSPARENT ? AlphaComposite.CLEAR : AlphaComposite.SRC_OVER));
|
||||||
this.canvas.setColor(awtColor);
|
this.canvas.setColor(awtColor);
|
||||||
this.canvas.fillRect(0, 0, getWidth(), getHeight());
|
this.canvas.fillRect(0, 0, getWidth(), getHeight());
|
||||||
this.canvas.setComposite(originalComposite);
|
this.canvas.setComposite(originalComposite);
|
||||||
|
|||||||
@@ -1,7 +1,8 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2010, 2011, 2012, 2013 mapsforge.org
|
* Copyright 2010, 2011, 2012, 2013 mapsforge.org
|
||||||
* Copyright 2013 Hannes Janetzek
|
* Copyright 2013 Hannes Janetzek
|
||||||
* Copyright 2016 devemux86
|
* Copyright 2016-2017 devemux86
|
||||||
|
* 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).
|
||||||
*
|
*
|
||||||
@@ -100,6 +101,7 @@ public class AwtPaint implements Paint {
|
|||||||
DEFAULT_FONT = new Font("Arial", Font.PLAIN, 14).deriveFont(TEXT_ATTRIBUTES);
|
DEFAULT_FONT = new Font("Arial", Font.PLAIN, 14).deriveFont(TEXT_ATTRIBUTES);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private Align align;
|
||||||
Color color = new Color(0.1f, 0.1f, 0.1f, 1);
|
Color color = new Color(0.1f, 0.1f, 0.1f, 1);
|
||||||
FontMetrics fm;
|
FontMetrics fm;
|
||||||
Font font = DEFAULT_FONT; // new Font("Default", Font.PLAIN, 13);
|
Font font = DEFAULT_FONT; // new Font("Default", Font.PLAIN, 13);
|
||||||
@@ -155,8 +157,8 @@ public class AwtPaint implements Paint {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setTextAlign(Align align) {
|
public void setTextAlign(Align align) {
|
||||||
// Align text in text layer
|
// TODO never read
|
||||||
//this.align = align;
|
this.align = align;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -217,6 +219,11 @@ public class AwtPaint implements Paint {
|
|||||||
return strokeWidth;
|
return strokeWidth;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Style getStyle() {
|
||||||
|
return style;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public float getTextHeight(String text) {
|
public float getTextHeight(String text) {
|
||||||
Graphics2D graphics2d = bufferedImage.createGraphics();
|
Graphics2D graphics2d = bufferedImage.createGraphics();
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2013 Hannes Janetzek
|
* Copyright 2013 Hannes Janetzek
|
||||||
* Copyright 2016 devemux86
|
* Copyright 2016-2017 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).
|
||||||
*
|
*
|
||||||
@@ -40,7 +40,7 @@ public abstract class GdxMap implements ApplicationListener {
|
|||||||
protected Map mMap;
|
protected Map mMap;
|
||||||
protected GestureDetector mGestureDetector;
|
protected GestureDetector mGestureDetector;
|
||||||
|
|
||||||
private MapRenderer mMapRenderer;
|
protected MapRenderer mMapRenderer;
|
||||||
|
|
||||||
public GdxMap() {
|
public GdxMap() {
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2016 devemux86
|
* Copyright 2013 Hannes Janetzek
|
||||||
|
* Copyright 2016-2017 devemux86
|
||||||
|
* 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).
|
||||||
*
|
*
|
||||||
@@ -22,12 +24,17 @@ import com.badlogic.gdx.Input.Buttons;
|
|||||||
import com.badlogic.gdx.InputProcessor;
|
import com.badlogic.gdx.InputProcessor;
|
||||||
|
|
||||||
import org.oscim.layers.GenericLayer;
|
import org.oscim.layers.GenericLayer;
|
||||||
|
import org.oscim.layers.GroupLayer;
|
||||||
|
import org.oscim.layers.Layer;
|
||||||
import org.oscim.layers.TileGridLayer;
|
import org.oscim.layers.TileGridLayer;
|
||||||
|
import org.oscim.layers.tile.buildings.BuildingLayer;
|
||||||
import org.oscim.map.Map;
|
import org.oscim.map.Map;
|
||||||
import org.oscim.map.ViewController;
|
import org.oscim.map.ViewController;
|
||||||
import org.oscim.theme.VtmThemes;
|
import org.oscim.theme.VtmThemes;
|
||||||
import org.oscim.utils.Easing;
|
import org.oscim.utils.Easing;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public class InputHandler implements InputProcessor {
|
public class InputHandler implements InputProcessor {
|
||||||
|
|
||||||
private ViewController mViewport;
|
private ViewController mViewport;
|
||||||
@@ -115,11 +122,16 @@ public class InputHandler implements InputProcessor {
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case Input.Keys.NUM_3:
|
case Input.Keys.NUM_3:
|
||||||
mMap.setTheme(VtmThemes.TRONRENDER);
|
mMap.setTheme(VtmThemes.OSMAGRAY);
|
||||||
mMap.updateMap(false);
|
mMap.updateMap(false);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Input.Keys.NUM_4:
|
case Input.Keys.NUM_4:
|
||||||
|
mMap.setTheme(VtmThemes.TRONRENDER);
|
||||||
|
mMap.updateMap(false);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case Input.Keys.NUM_5:
|
||||||
mMap.setTheme(VtmThemes.NEWTRON);
|
mMap.setTheme(VtmThemes.NEWTRON);
|
||||||
mMap.updateMap(false);
|
mMap.updateMap(false);
|
||||||
break;
|
break;
|
||||||
@@ -140,6 +152,11 @@ public class InputHandler implements InputProcessor {
|
|||||||
}
|
}
|
||||||
mMap.render();
|
mMap.render();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case Input.Keys.B:
|
||||||
|
toggleBuildingLayer(mMap.layers());
|
||||||
|
mMap.render();
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -237,4 +254,18 @@ public class InputHandler implements InputProcessor {
|
|||||||
mMap.updateMap(false);
|
mMap.updateMap(false);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private boolean toggleBuildingLayer(List<Layer> layers) {
|
||||||
|
for (Layer layer : layers) {
|
||||||
|
if (layer instanceof BuildingLayer) {
|
||||||
|
layer.setEnabled(!layer.isEnabled());
|
||||||
|
return true;
|
||||||
|
} else if (layer instanceof GroupLayer) {
|
||||||
|
if (toggleBuildingLayer(((GroupLayer) layer).layers)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ apply plugin: 'maven'
|
|||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
compile project(':vtm')
|
compile project(':vtm')
|
||||||
compile 'com.squareup.okhttp3:okhttp:3.6.0'
|
compile 'com.squareup.okhttp3:okhttp:3.8.0'
|
||||||
}
|
}
|
||||||
|
|
||||||
sourceSets {
|
sourceSets {
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
* Copyright 2014 Charles Greb
|
* Copyright 2014 Charles Greb
|
||||||
* Copyright 2014 Hannes Janetzek
|
* Copyright 2014 Hannes Janetzek
|
||||||
* Copyright 2017 devemux86
|
* Copyright 2017 devemux86
|
||||||
|
* Copyright 2017 Mathieu De Brito
|
||||||
*
|
*
|
||||||
* 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 +24,13 @@ import org.oscim.utils.IOUtils;
|
|||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
import java.io.ByteArrayInputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.io.OutputStream;
|
import java.io.OutputStream;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
import java.util.Map.Entry;
|
import java.util.Map.Entry;
|
||||||
|
|
||||||
import okhttp3.Cache;
|
|
||||||
import okhttp3.OkHttpClient;
|
import okhttp3.OkHttpClient;
|
||||||
import okhttp3.Request;
|
import okhttp3.Request;
|
||||||
import okhttp3.Response;
|
import okhttp3.Response;
|
||||||
@@ -41,27 +42,26 @@ public class OkHttpEngine implements HttpEngine {
|
|||||||
private final OkHttpClient mClient;
|
private final OkHttpClient mClient;
|
||||||
private final UrlTileSource mTileSource;
|
private final UrlTileSource mTileSource;
|
||||||
|
|
||||||
|
private InputStream mInputStream;
|
||||||
|
private byte[] mCachedData;
|
||||||
|
|
||||||
public static class OkHttpFactory implements HttpEngine.Factory {
|
public static class OkHttpFactory implements HttpEngine.Factory {
|
||||||
private final OkHttpClient mClient;
|
private final OkHttpClient.Builder mClientBuilder;
|
||||||
|
|
||||||
public OkHttpFactory() {
|
public OkHttpFactory() {
|
||||||
mClient = new OkHttpClient();
|
mClientBuilder = new OkHttpClient.Builder();
|
||||||
}
|
}
|
||||||
|
|
||||||
public OkHttpFactory(Cache cache) {
|
public OkHttpFactory(OkHttpClient.Builder clientBuilder) {
|
||||||
mClient = new OkHttpClient.Builder()
|
mClientBuilder = clientBuilder;
|
||||||
.cache(cache)
|
|
||||||
.build();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public HttpEngine create(UrlTileSource tileSource) {
|
public HttpEngine create(UrlTileSource tileSource) {
|
||||||
return new OkHttpEngine(mClient, tileSource);
|
return new OkHttpEngine(mClientBuilder.build(), tileSource);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private InputStream inputStream;
|
|
||||||
|
|
||||||
public OkHttpEngine(OkHttpClient client, UrlTileSource tileSource) {
|
public OkHttpEngine(OkHttpClient client, UrlTileSource tileSource) {
|
||||||
mClient = client;
|
mClient = client;
|
||||||
mTileSource = tileSource;
|
mTileSource = tileSource;
|
||||||
@@ -69,7 +69,7 @@ public class OkHttpEngine implements HttpEngine {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public InputStream read() throws IOException {
|
public InputStream read() throws IOException {
|
||||||
return inputStream;
|
return mInputStream;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -85,7 +85,11 @@ public class OkHttpEngine implements HttpEngine {
|
|||||||
builder.addHeader(opt.getKey(), opt.getValue());
|
builder.addHeader(opt.getKey(), opt.getValue());
|
||||||
Request request = builder.build();
|
Request request = builder.build();
|
||||||
Response response = mClient.newCall(request).execute();
|
Response response = mClient.newCall(request).execute();
|
||||||
inputStream = response.body().byteStream();
|
if (mTileSource.tileCache != null) {
|
||||||
|
mCachedData = response.body().bytes();
|
||||||
|
mInputStream = new ByteArrayInputStream(mCachedData);
|
||||||
|
} else
|
||||||
|
mInputStream = response.body().byteStream();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error(e.getMessage(), e);
|
log.error(e.getMessage(), e);
|
||||||
}
|
}
|
||||||
@@ -93,30 +97,28 @@ public class OkHttpEngine implements HttpEngine {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void close() {
|
public void close() {
|
||||||
if (inputStream == null)
|
if (mInputStream == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
final InputStream is = inputStream;
|
IOUtils.closeQuietly(mInputStream);
|
||||||
inputStream = null;
|
mInputStream = null;
|
||||||
new Thread(new Runnable() {
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
IOUtils.closeQuietly(is);
|
|
||||||
}
|
|
||||||
}).start();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* OkHttp cache implemented through {@link OkHttpClient.Builder#cache(Cache)}.
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public void setCache(OutputStream os) {
|
public void setCache(OutputStream os) {
|
||||||
|
if (mTileSource.tileCache != null) {
|
||||||
|
try {
|
||||||
|
os.write(mCachedData);
|
||||||
|
} catch (IOException e) {
|
||||||
|
log.error(e.getMessage(), e);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean requestCompleted(boolean success) {
|
public boolean requestCompleted(boolean success) {
|
||||||
IOUtils.closeQuietly(inputStream);
|
IOUtils.closeQuietly(mInputStream);
|
||||||
inputStream = null;
|
mInputStream = null;
|
||||||
|
|
||||||
return success;
|
return success;
|
||||||
}
|
}
|
||||||
|
|||||||
64
vtm-ios-example/Info.plist.xml
Normal file
@@ -0,0 +1,64 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN"
|
||||||
|
"http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||||
|
<plist version="1.0">
|
||||||
|
<dict>
|
||||||
|
<key>MinimumOSVersion</key>
|
||||||
|
<string>8.0</string>
|
||||||
|
<key>CFBundleDevelopmentRegion</key>
|
||||||
|
<string>en</string>
|
||||||
|
<key>CFBundleDisplayName</key>
|
||||||
|
<string>${app.name}</string>
|
||||||
|
<key>CFBundleExecutable</key>
|
||||||
|
<string>${app.executable}</string>
|
||||||
|
<key>CFBundleIdentifier</key>
|
||||||
|
<string>${app.id}</string>
|
||||||
|
<key>CFBundleInfoDictionaryVersion</key>
|
||||||
|
<string>6.0</string>
|
||||||
|
<key>CFBundleName</key>
|
||||||
|
<string>${app.name}</string>
|
||||||
|
<key>CFBundlePackageType</key>
|
||||||
|
<string>APPL</string>
|
||||||
|
<key>CFBundleShortVersionString</key>
|
||||||
|
<string>${app.version}</string>
|
||||||
|
<key>CFBundleSignature</key>
|
||||||
|
<string>????</string>
|
||||||
|
<key>CFBundleVersion</key>
|
||||||
|
<string>${app.build}</string>
|
||||||
|
<key>LSRequiresIPhoneOS</key>
|
||||||
|
<true />
|
||||||
|
<key>UIStatusBarHidden</key>
|
||||||
|
<true />
|
||||||
|
<key>UIViewControllerBasedStatusBarAppearance</key>
|
||||||
|
<false />
|
||||||
|
<key>UIDeviceFamily</key>
|
||||||
|
<array>
|
||||||
|
<integer>1</integer>
|
||||||
|
<integer>2</integer>
|
||||||
|
</array>
|
||||||
|
<key>UIRequiredDeviceCapabilities</key>
|
||||||
|
<array>
|
||||||
|
<string>armv7</string>
|
||||||
|
</array>
|
||||||
|
<key>UISupportedInterfaceOrientations</key>
|
||||||
|
<array>
|
||||||
|
<string>UIInterfaceOrientationLandscapeLeft</string>
|
||||||
|
<string>UIInterfaceOrientationLandscapeRight</string>
|
||||||
|
</array>
|
||||||
|
<key>UISupportedInterfaceOrientations~ipad</key>
|
||||||
|
<array>
|
||||||
|
<string>UIInterfaceOrientationLandscapeLeft</string>
|
||||||
|
<string>UIInterfaceOrientationLandscapeRight</string>
|
||||||
|
</array>
|
||||||
|
<key>CFBundleIcons</key>
|
||||||
|
<dict>
|
||||||
|
<key>CFBundlePrimaryIcon</key>
|
||||||
|
<dict>
|
||||||
|
<key>CFBundleIconFiles</key>
|
||||||
|
<array>
|
||||||
|
<string>Icon</string>
|
||||||
|
<string>Icon-72</string>
|
||||||
|
</array>
|
||||||
|
</dict>
|
||||||
|
</dict>
|
||||||
|
</dict>
|
||||||
|
</plist>
|
||||||
73
vtm-ios-example/build.gradle
Normal file
@@ -0,0 +1,73 @@
|
|||||||
|
buildscript {
|
||||||
|
repositories {
|
||||||
|
jcenter()
|
||||||
|
maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
|
||||||
|
}
|
||||||
|
dependencies {
|
||||||
|
classpath 'com.mobidevelop.robovm:robovm-gradle-plugin:2.3.1'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
apply plugin: 'java'
|
||||||
|
apply plugin: 'robovm'
|
||||||
|
|
||||||
|
sourceSets.main.java.srcDirs = ["src/"]
|
||||||
|
|
||||||
|
[compileJava, compileTestJava]*.options*.encoding = 'UTF-8'
|
||||||
|
|
||||||
|
ext {
|
||||||
|
roboVMVersion = "2.3.1"
|
||||||
|
}
|
||||||
|
|
||||||
|
launchIPhoneSimulator.dependsOn build
|
||||||
|
launchIPadSimulator.dependsOn build
|
||||||
|
launchIOSDevice.dependsOn build
|
||||||
|
createIPA.dependsOn build
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
compile project(':vtm')
|
||||||
|
compile project(':vtm-gdx')
|
||||||
|
compile project(':vtm-jts')
|
||||||
|
compile project(':vtm-ios')
|
||||||
|
compile "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-ios"
|
||||||
|
compile "com.badlogicgames.gdx:gdx-backend-robovm:$gdxVersion"
|
||||||
|
compile "com.mobidevelop.robovm:robovm-rt:$roboVMVersion"
|
||||||
|
compile "com.mobidevelop.robovm:robovm-cocoatouch:$roboVMVersion"
|
||||||
|
compile "org.slf4j:slf4j-simple:$slf4jVersion"
|
||||||
|
}
|
||||||
|
|
||||||
|
task copyVtmResources(type: Copy) {
|
||||||
|
from("../vtm/resources")
|
||||||
|
into("${buildDir}")
|
||||||
|
}
|
||||||
|
|
||||||
|
task copyVtmThemesResources(type: Copy) {
|
||||||
|
from("../vtm-themes/resources")
|
||||||
|
into("${buildDir}")
|
||||||
|
}
|
||||||
|
|
||||||
|
task copyVtmPlaygroundResources(type: Copy) {
|
||||||
|
from("../vtm-playground/resources")
|
||||||
|
into("${buildDir}/assets/")
|
||||||
|
}
|
||||||
|
|
||||||
|
task copyIosNatives(type: Copy) {
|
||||||
|
from("../vtm-ios/natives")
|
||||||
|
into("${buildDir}/natives/")
|
||||||
|
}
|
||||||
|
|
||||||
|
tasks.withType(JavaCompile) {
|
||||||
|
compileTask -> compileTask.dependsOn copyVtmResources
|
||||||
|
}
|
||||||
|
|
||||||
|
tasks.withType(JavaCompile) {
|
||||||
|
compileTask -> compileTask.dependsOn copyVtmThemesResources
|
||||||
|
}
|
||||||
|
|
||||||
|
tasks.withType(JavaCompile) {
|
||||||
|
compileTask -> compileTask.dependsOn copyVtmPlaygroundResources
|
||||||
|
}
|
||||||
|
|
||||||
|
tasks.withType(JavaCompile) {
|
||||||
|
compileTask -> compileTask.dependsOn copyIosNatives
|
||||||
|
}
|
||||||
BIN
vtm-ios-example/data/Default-568h@2x.png
Normal file
|
After Width: | Height: | Size: 82 KiB |
BIN
vtm-ios-example/data/Default.png
Normal file
|
After Width: | Height: | Size: 29 KiB |
BIN
vtm-ios-example/data/Default@2x.png
Normal file
|
After Width: | Height: | Size: 83 KiB |
BIN
vtm-ios-example/data/Default@2x~ipad.png
Normal file
|
After Width: | Height: | Size: 95 KiB |
BIN
vtm-ios-example/data/Default~ipad.png
Normal file
|
After Width: | Height: | Size: 33 KiB |
BIN
vtm-ios-example/data/Icon-72.png
Normal file
|
After Width: | Height: | Size: 4.3 KiB |
BIN
vtm-ios-example/data/Icon-72@2x.png
Normal file
|
After Width: | Height: | Size: 6.1 KiB |
BIN
vtm-ios-example/data/Icon.png
Normal file
|
After Width: | Height: | Size: 3.9 KiB |
BIN
vtm-ios-example/data/Icon@2x.png
Normal file
|
After Width: | Height: | Size: 5.5 KiB |
8
vtm-ios-example/robovm.properties
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
#
|
||||||
|
#Fri May 31 13:01:40 CEST 2013
|
||||||
|
app.version=1.0
|
||||||
|
app.id=de.longri.libgdx.mapsforge
|
||||||
|
app.mainclass=org.oscim.ios.test.ExampleLauncher
|
||||||
|
app.executable=VtmApp
|
||||||
|
app.build=1
|
||||||
|
app.name=VectorMap
|
||||||
52
vtm-ios-example/robovm.xml
Normal file
@@ -0,0 +1,52 @@
|
|||||||
|
<config>
|
||||||
|
<executableName>${app.executable}</executableName>
|
||||||
|
<mainClass>${app.mainclass}</mainClass>
|
||||||
|
<os>ios</os>
|
||||||
|
<arch>thumbv7</arch>
|
||||||
|
<target>ios</target>
|
||||||
|
<iosInfoPList>Info.plist.xml</iosInfoPList>
|
||||||
|
<resources>
|
||||||
|
<resource>
|
||||||
|
<directory>./build/assets</directory>
|
||||||
|
<includes>
|
||||||
|
<include>**</include>
|
||||||
|
</includes>
|
||||||
|
<skipPngCrush>true</skipPngCrush>
|
||||||
|
</resource>
|
||||||
|
<resource>
|
||||||
|
<directory>data</directory>
|
||||||
|
</resource>
|
||||||
|
</resources>
|
||||||
|
<forceLinkClasses>
|
||||||
|
<pattern>com.badlogic.gdx.scenes.scene2d.ui.*</pattern>
|
||||||
|
<pattern>com.badlogic.gdx.graphics.g3d.particles.**</pattern>
|
||||||
|
<pattern>com.android.okhttp.HttpHandler</pattern>
|
||||||
|
<pattern>com.android.okhttp.HttpsHandler</pattern>
|
||||||
|
<pattern>com.android.org.conscrypt.**</pattern>
|
||||||
|
<pattern>com.android.org.bouncycastle.jce.provider.BouncyCastleProvider</pattern>
|
||||||
|
<pattern>com.android.org.bouncycastle.jcajce.provider.keystore.BC$Mappings</pattern>
|
||||||
|
<pattern>com.android.org.bouncycastle.jcajce.provider.keystore.bc.BcKeyStoreSpi</pattern>
|
||||||
|
<pattern>com.android.org.bouncycastle.jcajce.provider.keystore.bc.BcKeyStoreSpi$Std
|
||||||
|
</pattern>
|
||||||
|
<pattern>com.android.org.bouncycastle.jce.provider.PKIXCertPathValidatorSpi</pattern>
|
||||||
|
<pattern>com.android.org.bouncycastle.crypto.digests.AndroidDigestFactoryOpenSSL</pattern>
|
||||||
|
<pattern>org.apache.harmony.security.provider.cert.DRLCertFactory</pattern>
|
||||||
|
<pattern>org.apache.harmony.security.provider.crypto.CryptoProvider</pattern>
|
||||||
|
</forceLinkClasses>
|
||||||
|
<libs>
|
||||||
|
<lib>build/natives/libvtm-jni.a</lib>
|
||||||
|
</libs>
|
||||||
|
<frameworkPaths>
|
||||||
|
<path>build/natives</path>
|
||||||
|
</frameworkPaths>
|
||||||
|
<frameworks>
|
||||||
|
<framework>SVGgh</framework>
|
||||||
|
<framework>UIKit</framework>
|
||||||
|
<framework>OpenGLES</framework>
|
||||||
|
<framework>QuartzCore</framework>
|
||||||
|
<framework>CoreGraphics</framework>
|
||||||
|
<framework>OpenAL</framework>
|
||||||
|
<framework>AudioToolbox</framework>
|
||||||
|
<framework>AVFoundation</framework>
|
||||||
|
</frameworks>
|
||||||
|
</config>
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2016 Longri
|
* Copyright 2016-2017 Longri
|
||||||
* Copyright 2016 devemux86
|
* Copyright 2016 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
|
||||||
@@ -13,19 +13,20 @@
|
|||||||
* You should have received a copy of the GNU Lesser General Public License along with
|
* 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/>.
|
* this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
package org.oscim.ios;
|
package org.oscim.ios.test;
|
||||||
|
|
||||||
import com.badlogic.gdx.backends.iosrobovm.IOSApplication;
|
import com.badlogic.gdx.backends.iosrobovm.IOSApplication;
|
||||||
import com.badlogic.gdx.backends.iosrobovm.IOSApplicationConfiguration;
|
import com.badlogic.gdx.backends.iosrobovm.IOSApplicationConfiguration;
|
||||||
|
|
||||||
import org.oscim.backend.CanvasAdapter;
|
import org.oscim.backend.CanvasAdapter;
|
||||||
|
import org.oscim.theme.ThemeLoader;
|
||||||
import org.robovm.apple.foundation.NSAutoreleasePool;
|
import org.robovm.apple.foundation.NSAutoreleasePool;
|
||||||
import org.robovm.apple.glkit.GLKViewDrawableStencilFormat;
|
import org.robovm.apple.glkit.GLKViewDrawableStencilFormat;
|
||||||
import org.robovm.apple.uikit.UIApplication;
|
import org.robovm.apple.uikit.UIApplication;
|
||||||
import org.robovm.apple.uikit.UIDevice;
|
import org.robovm.apple.uikit.UIDevice;
|
||||||
import org.robovm.apple.uikit.UIScreen;
|
import org.robovm.apple.uikit.UIScreen;
|
||||||
|
|
||||||
public class RobovmLauncher extends IOSApplication.Delegate {
|
public class ExampleLauncher extends IOSApplication.Delegate {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected IOSApplication createApplication() {
|
protected IOSApplication createApplication() {
|
||||||
@@ -37,8 +38,13 @@ public class RobovmLauncher extends IOSApplication.Delegate {
|
|||||||
float scale = (float) (getIosVersion() >= 8 ? UIScreen.getMainScreen().getNativeScale() : UIScreen.getMainScreen().getScale());
|
float scale = (float) (getIosVersion() >= 8 ? UIScreen.getMainScreen().getNativeScale() : UIScreen.getMainScreen().getScale());
|
||||||
CanvasAdapter.dpi *= scale;
|
CanvasAdapter.dpi *= scale;
|
||||||
|
|
||||||
IOSMapApp iosMapApp = new IOSMapApp();
|
IOSMapApp iosMapApp = new IOSMapApp();
|
||||||
IOSMapApp.init();
|
// IOSLineTexTest iosMapApp = new IOSLineTexTest();
|
||||||
|
// IOSMapAppCluster iosMapApp = new IOSMapAppCluster();
|
||||||
|
|
||||||
|
|
||||||
|
ThemeLoader.POT_TEXTURES = true;
|
||||||
|
iosMapApp.init();
|
||||||
|
|
||||||
return new IOSApplication(iosMapApp, config);
|
return new IOSApplication(iosMapApp, config);
|
||||||
}
|
}
|
||||||
@@ -52,7 +58,7 @@ public class RobovmLauncher extends IOSApplication.Delegate {
|
|||||||
NSAutoreleasePool pool = new NSAutoreleasePool();
|
NSAutoreleasePool pool = new NSAutoreleasePool();
|
||||||
System.setProperty(org.slf4j.impl.SimpleLogger.DEFAULT_LOG_LEVEL_KEY, "TRACE");
|
System.setProperty(org.slf4j.impl.SimpleLogger.DEFAULT_LOG_LEVEL_KEY, "TRACE");
|
||||||
|
|
||||||
UIApplication.main(argv, null, RobovmLauncher.class);
|
UIApplication.main(argv, null, ExampleLauncher.class);
|
||||||
pool.drain();
|
pool.drain();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
136
vtm-ios-example/src/org/oscim/ios/test/IOSLineTexTest.java
Normal file
@@ -0,0 +1,136 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2013 Hannes Janetzek
|
||||||
|
* Copyright 2016-2017 Longri
|
||||||
|
*
|
||||||
|
* This file is part of the OpenScienceMap project (http://www.opensciencemap.org).
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify it under the
|
||||||
|
* terms of the GNU Lesser General Public License as published by the Free Software
|
||||||
|
* Foundation, either version 3 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||||
|
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||||
|
* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public License along with
|
||||||
|
* this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
package org.oscim.ios.test;
|
||||||
|
|
||||||
|
import org.oscim.backend.GLAdapter;
|
||||||
|
import org.oscim.backend.canvas.Color;
|
||||||
|
import org.oscim.core.GeoPoint;
|
||||||
|
import org.oscim.core.MapPosition;
|
||||||
|
import org.oscim.event.Event;
|
||||||
|
import org.oscim.gdx.GdxAssets;
|
||||||
|
import org.oscim.gdx.GdxMap;
|
||||||
|
import org.oscim.ios.backend.IosGL;
|
||||||
|
import org.oscim.ios.backend.IosGraphics;
|
||||||
|
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.layers.vector.PathLayer;
|
||||||
|
import org.oscim.layers.vector.geometries.Style;
|
||||||
|
import org.oscim.map.Map;
|
||||||
|
import org.oscim.renderer.bucket.TextureItem;
|
||||||
|
import org.oscim.theme.VtmThemes;
|
||||||
|
import org.oscim.tiling.source.oscimap4.OSciMap4TileSource;
|
||||||
|
import org.oscim.utils.Utils;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class IOSLineTexTest extends GdxMap {
|
||||||
|
|
||||||
|
public static void init() {
|
||||||
|
// init globals
|
||||||
|
IosGraphics.init();
|
||||||
|
GdxAssets.init("assets/");
|
||||||
|
GLAdapter.init(new IosGL());
|
||||||
|
}
|
||||||
|
|
||||||
|
private static final boolean ANIMATION = false;
|
||||||
|
|
||||||
|
private List<PathLayer> mPathLayers = new ArrayList<>();
|
||||||
|
private TextureItem tex;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void createLayers() {
|
||||||
|
VectorTileLayer l = mMap.setBaseMap(new OSciMap4TileSource());
|
||||||
|
mMap.layers().add(new BuildingLayer(mMap, l));
|
||||||
|
mMap.layers().add(new LabelLayer(mMap, l));
|
||||||
|
mMap.setTheme(VtmThemes.DEFAULT);
|
||||||
|
|
||||||
|
mMap.setMapPosition(0, 0, 1 << 2);
|
||||||
|
|
||||||
|
tex = Utils.loadTexture("", "patterns/pike.png", 0, 0, 100);
|
||||||
|
// tex = new TextureItem(CanvasAdapter.getBitmapAsset("", "patterns/pike.png"));
|
||||||
|
tex.mipmap = true;
|
||||||
|
|
||||||
|
createLayers(1, true);
|
||||||
|
|
||||||
|
if (ANIMATION)
|
||||||
|
mMap.events.bind(new Map.UpdateListener() {
|
||||||
|
@Override
|
||||||
|
public void onMapEvent(Event e, MapPosition mapPosition) {
|
||||||
|
//if (e == Map.UPDATE_EVENT) {
|
||||||
|
long t = System.currentTimeMillis();
|
||||||
|
float pos = t % 20000 / 10000f - 1f;
|
||||||
|
createLayers(pos, false);
|
||||||
|
mMap.updateMap(true);
|
||||||
|
//}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
void createLayers(float pos, boolean init) {
|
||||||
|
|
||||||
|
int i = 0;
|
||||||
|
|
||||||
|
for (double lat = -90; lat <= 90; lat += 5) {
|
||||||
|
List<GeoPoint> pts = new ArrayList<>();
|
||||||
|
|
||||||
|
for (double lon = -180; lon <= 180; lon += 2) {
|
||||||
|
//pts.add(new GeoPoint(lat, lon));
|
||||||
|
// double longitude = lon + (pos * 180);
|
||||||
|
// if (longitude < -180)
|
||||||
|
// longitude += 360;
|
||||||
|
// if (longitude > 180)
|
||||||
|
// longitude -= 360;
|
||||||
|
double longitude = lon;
|
||||||
|
|
||||||
|
double latitude = lat + (pos * 90);
|
||||||
|
if (latitude < -90)
|
||||||
|
latitude += 180;
|
||||||
|
if (latitude > 90)
|
||||||
|
latitude -= 180;
|
||||||
|
|
||||||
|
latitude += Math.sin((Math.abs(pos) * (lon / Math.PI)));
|
||||||
|
|
||||||
|
pts.add(new GeoPoint(latitude, longitude));
|
||||||
|
}
|
||||||
|
PathLayer pathLayer;
|
||||||
|
if (init) {
|
||||||
|
int c = Color.fade(Color.rainbow((float) (lat + 90) / 180), 0.5f);
|
||||||
|
Style style = Style.builder()
|
||||||
|
.stippleColor(c)
|
||||||
|
.stipple(24)
|
||||||
|
.stippleWidth(1)
|
||||||
|
.strokeWidth(12)
|
||||||
|
.strokeColor(c)
|
||||||
|
.fixed(true)
|
||||||
|
.texture(tex)
|
||||||
|
.randomOffset(false)
|
||||||
|
.build();
|
||||||
|
pathLayer = new PathLayer(mMap, style);
|
||||||
|
mMap.layers().add(pathLayer);
|
||||||
|
mPathLayers.add(pathLayer);
|
||||||
|
} else {
|
||||||
|
pathLayer = mPathLayers.get(i++);
|
||||||
|
}
|
||||||
|
|
||||||
|
pathLayer.setPoints(pts);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2013 Hannes Janetzek
|
* Copyright 2013 Hannes Janetzek
|
||||||
* Copyright 2016 Longri
|
* Copyright 2016-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).
|
||||||
*
|
*
|
||||||
@@ -15,7 +15,7 @@
|
|||||||
* You should have received a copy of the GNU Lesser General Public License along with
|
* 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/>.
|
* this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
package org.oscim.ios;
|
package org.oscim.ios.test;
|
||||||
|
|
||||||
import org.oscim.backend.GLAdapter;
|
import org.oscim.backend.GLAdapter;
|
||||||
import org.oscim.gdx.GdxAssets;
|
import org.oscim.gdx.GdxAssets;
|
||||||
@@ -69,7 +69,7 @@ public class IOSMapApp extends GdxMap {
|
|||||||
renderer.setOffset(5, 0);
|
renderer.setOffset(5, 0);
|
||||||
map.layers().add(mapScaleBarLayer);
|
map.layers().add(mapScaleBarLayer);
|
||||||
|
|
||||||
map.setTheme(VtmThemes.DEFAULT);
|
map.setTheme(VtmThemes.OSMARENDER);
|
||||||
map.setMapPosition(53.075, 8.808, 1 << 17);
|
map.setMapPosition(53.075, 8.808, 1 << 17);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,9 +1,10 @@
|
|||||||
buildscript {
|
buildscript {
|
||||||
repositories {
|
repositories {
|
||||||
jcenter()
|
jcenter()
|
||||||
|
maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
|
||||||
}
|
}
|
||||||
dependencies {
|
dependencies {
|
||||||
classpath 'com.mobidevelop.robovm:robovm-gradle-plugin:2.2.0'
|
classpath 'com.mobidevelop.robovm:robovm-gradle-plugin:2.3.1'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -16,9 +17,7 @@ sourceSets.main.java.srcDirs = ["src/"]
|
|||||||
[compileJava, compileTestJava]*.options*.encoding = 'UTF-8'
|
[compileJava, compileTestJava]*.options*.encoding = 'UTF-8'
|
||||||
|
|
||||||
ext {
|
ext {
|
||||||
// Configure your application main class
|
roboVMVersion = "2.3.1"
|
||||||
mainClassName = "org.oscim.ios.RoboVmLauncher"
|
|
||||||
roboVMVersion = "2.3.0"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
launchIPhoneSimulator.dependsOn build
|
launchIPhoneSimulator.dependsOn build
|
||||||
@@ -32,7 +31,6 @@ dependencies {
|
|||||||
compile "com.badlogicgames.gdx:gdx-backend-robovm:$gdxVersion"
|
compile "com.badlogicgames.gdx:gdx-backend-robovm:$gdxVersion"
|
||||||
compile "com.mobidevelop.robovm:robovm-rt:$roboVMVersion"
|
compile "com.mobidevelop.robovm:robovm-rt:$roboVMVersion"
|
||||||
compile "com.mobidevelop.robovm:robovm-cocoatouch:$roboVMVersion"
|
compile "com.mobidevelop.robovm:robovm-cocoatouch:$roboVMVersion"
|
||||||
compile 'org.slf4j:slf4j-simple:1.7.21'
|
|
||||||
}
|
}
|
||||||
|
|
||||||
task copyVtmResources(type: Copy) {
|
task copyVtmResources(type: Copy) {
|
||||||
|
|||||||
BIN
vtm-ios/natives/SVGgh.framework.dSYM/Contents/Resources/DWARF/SVGgh
Executable file → Normal file
@@ -195,7 +195,7 @@ typedef NSUInteger ColorScheme;
|
|||||||
+(CGPathRef) newRoundRectPathForRect:(CGRect)aRect withRadius:(CGFloat) radius CF_RETURNS_RETAINED;
|
+(CGPathRef) newRoundRectPathForRect:(CGRect)aRect withRadius:(CGFloat) radius CF_RETURNS_RETAINED;
|
||||||
|
|
||||||
/*! @brief utility routine to find the location of an SVG document relative to a provided bundle
|
/*! @brief utility routine to find the location of an SVG document relative to a provided bundle
|
||||||
* @param an optional bundle containing the artwork
|
* @param mayBeNil optional bundle containing the artwork
|
||||||
* @param theArtworkPath subpath within a bundle does not include the .svg extension which is assumed.
|
* @param theArtworkPath subpath within a bundle does not include the .svg extension which is assumed.
|
||||||
*/
|
*/
|
||||||
+(nullable NSURL*) locateArtworkForBundle:(nullable NSBundle*)mayBeNil atSubpath:(NSString*)theArtworkPath;
|
+(nullable NSURL*) locateArtworkForBundle:(nullable NSBundle*)mayBeNil atSubpath:(NSString*)theArtworkPath;
|
||||||
@@ -207,8 +207,7 @@ typedef NSUInteger ColorScheme;
|
|||||||
+(nullable NSURL*) locateArtworkForObject:(id<NSObject>)anObject atSubpath:(NSString*)theArtworkPath; // for compatibility
|
+(nullable NSURL*) locateArtworkForObject:(id<NSObject>)anObject atSubpath:(NSString*)theArtworkPath; // for compatibility
|
||||||
|
|
||||||
/*! @brief utility routine to locate a URL inside your project when using Interface Builder's IB_DESIGNABLE service
|
/*! @brief utility routine to locate a URL inside your project when using Interface Builder's IB_DESIGNABLE service
|
||||||
* @param anObject for instance a GHButton
|
* @param artworkSubPath subpath within a bundle does not include the .svg extension which is assumed.
|
||||||
* @param theArtworkPath subpath within a bundle does not include the .svg extension which is assumed.
|
|
||||||
*/
|
*/
|
||||||
+(nullable NSURL*) findInterfaceBuilderArtwork:(NSString*)artworkSubPath;
|
+(nullable NSURL*) findInterfaceBuilderArtwork:(NSString*)artworkSubPath;
|
||||||
|
|
||||||
|
|||||||
@@ -75,6 +75,17 @@ NS_ASSUME_NONNULL_BEGIN
|
|||||||
/*! @brief the value for 'currentColor' at this moment in the process of visiting a document
|
/*! @brief the value for 'currentColor' at this moment in the process of visiting a document
|
||||||
*/
|
*/
|
||||||
-(nullable UIColor*) currentColor;
|
-(nullable UIColor*) currentColor;
|
||||||
|
|
||||||
|
/*! @brief the value for 'opacity' at this moment in the process of visiting a document
|
||||||
|
*/
|
||||||
|
-(CGFloat) opacity;
|
||||||
|
|
||||||
|
/*! @brief opacity is dependent (via inheritence) as you descend an SVG Document. This opacity is the place to keep track of updated opacity.
|
||||||
|
* @param the current opacity (defaults to 1.0)
|
||||||
|
*/
|
||||||
|
-(void) setOpacity:(CGFloat)opacity;
|
||||||
|
|
||||||
|
|
||||||
/*! @brief the active language expected by the user like 'en' or 'sp' or 'zh'
|
/*! @brief the active language expected by the user like 'en' or 'sp' or 'zh'
|
||||||
*/
|
*/
|
||||||
-(nullable NSString*) isoLanguage;
|
-(nullable NSString*) isoLanguage;
|
||||||
@@ -89,7 +100,7 @@ NS_ASSUME_NONNULL_BEGIN
|
|||||||
|
|
||||||
/*! @brief Look through the CSS attributes for a given styling attribute.
|
/*! @brief Look through the CSS attributes for a given styling attribute.
|
||||||
* @param attributeName the name of the attribute like 'line-width'
|
* @param attributeName the name of the attribute like 'line-width'
|
||||||
* @param className the name of the CSS class like 'background' or some other arbitrary item
|
* @param listOfClasses the name of the CSS class like 'background' or some other arbitrary item
|
||||||
* @param entityName the name of the entity like 'rect' or 'polyline'
|
* @param entityName the name of the entity like 'rect' or 'polyline'
|
||||||
*/
|
*/
|
||||||
-(nullable NSString*) attributeNamed:(NSString*)attributeName classes:(nullable NSArray<NSString*>*)listOfClasses entityName:(nullable NSString*)entityName;
|
-(nullable NSString*) attributeNamed:(NSString*)attributeName classes:(nullable NSArray<NSString*>*)listOfClasses entityName:(nullable NSString*)entityName;
|
||||||
|
|||||||
@@ -68,8 +68,8 @@ IB_DESIGNABLE // Cocapods users should add the use_frameworks! directive if this
|
|||||||
@interface SVGDocumentView : UIView
|
@interface SVGDocumentView : UIView
|
||||||
|
|
||||||
/*! @property artworkPath
|
/*! @property artworkPath
|
||||||
* @brief the text contents of an SVG document can be accessed via 'User Defined RuntimeAttributes'
|
* @brief the text contents of an SVG document can be accessed via 'User Defined RuntimeAttributes'. If you are using a .svgz file, include the file extension in the path.
|
||||||
*/
|
*/
|
||||||
@property(nonatomic, strong) IBInspectable NSString* __nullable artworkPath;
|
@property(nonatomic, strong) IBInspectable NSString* __nullable artworkPath;
|
||||||
|
|
||||||
/*! @property defaultColor
|
/*! @property defaultColor
|
||||||
|
|||||||
@@ -42,12 +42,18 @@ NS_ASSUME_NONNULL_BEGIN
|
|||||||
@property(strong, nonatomic, readonly) NSURL* __nullable svgURL;
|
@property(strong, nonatomic, readonly) NSURL* __nullable svgURL;
|
||||||
|
|
||||||
/*! @brief init method which takes a URL reference to a .svg file
|
/*! @brief init method which takes a URL reference to a .svg file
|
||||||
* @param url a reference to a standard .svg file
|
* @param url a reference to a standard .svg or .svgz file
|
||||||
*/
|
*/
|
||||||
-(instancetype)initWithContentsOfURL:(NSURL *)url;
|
-(instancetype)initWithContentsOfURL:(NSURL *)url;
|
||||||
|
|
||||||
|
/*! @brief init method which takes a input stream from a SVG source
|
||||||
|
* @param inputStream a reference to a standard .svg or .svgz file
|
||||||
|
*/
|
||||||
|
-(instancetype)initWithInputStream:(NSInputStream *)inputStream;
|
||||||
|
|
||||||
/*! @brief init method which the name of a resource based SVG
|
/*! @brief init method which the name of a resource based SVG
|
||||||
* @param a string giving the name of the resource
|
* @param resourceName string giving the name of the resource. This may include a file extension, if ommitted `svg` will be used.
|
||||||
|
* @param bundle optional bundle to look in
|
||||||
* @commment might be from XCAsset data
|
* @commment might be from XCAsset data
|
||||||
*/
|
*/
|
||||||
-(nullable instancetype) initWithResourceName:(NSString*)resourceName inBundle:(nullable NSBundle*)bundle;
|
-(nullable instancetype) initWithResourceName:(NSString*)resourceName inBundle:(nullable NSBundle*)bundle;
|
||||||
@@ -66,7 +72,7 @@ NS_ASSUME_NONNULL_BEGIN
|
|||||||
|
|
||||||
/*! @brief not allowing a standard init method
|
/*! @brief not allowing a standard init method
|
||||||
*/
|
*/
|
||||||
-(nullable instancetype) init __attribute__((unavailable("init not available")));
|
-(instancetype) init __attribute__((unavailable("init not available")));
|
||||||
|
|
||||||
/*! @brief method to create a URL relative to the URL used to create this object (assuming use of a URL to create it)
|
/*! @brief method to create a URL relative to the URL used to create this object (assuming use of a URL to create it)
|
||||||
* @param subPath relative path to this parser's svgURL
|
* @param subPath relative path to this parser's svgURL
|
||||||
|
|||||||
406
vtm-ios/natives/SVGgh.framework/_CodeSignature/CodeResources
Normal file
@@ -0,0 +1,406 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||||
|
<plist version="1.0">
|
||||||
|
<dict>
|
||||||
|
<key>files</key>
|
||||||
|
<dict>
|
||||||
|
<key>Headers/GHButton.h</key>
|
||||||
|
<data>
|
||||||
|
Yo70QMvylnV/tGNngg/dxwCC+Es=
|
||||||
|
</data>
|
||||||
|
<key>Headers/GHCSSStyle.h</key>
|
||||||
|
<data>
|
||||||
|
/KLi1TX1SrM6jopjQQBiHZm78/o=
|
||||||
|
</data>
|
||||||
|
<key>Headers/GHControl.h</key>
|
||||||
|
<data>
|
||||||
|
p3mMe9yH8rJD8Wm20c3Jd8lxCME=
|
||||||
|
</data>
|
||||||
|
<key>Headers/GHControlFactory.h</key>
|
||||||
|
<data>
|
||||||
|
a7H0B3wnhh76HiQKYHA2jGl6tk4=
|
||||||
|
</data>
|
||||||
|
<key>Headers/GHImageCache.h</key>
|
||||||
|
<data>
|
||||||
|
L3yqnld65EyxF+ZVm7agQKAwg08=
|
||||||
|
</data>
|
||||||
|
<key>Headers/GHRenderable.h</key>
|
||||||
|
<data>
|
||||||
|
k5uJ1lR+jjohQboiKl361vlWrPU=
|
||||||
|
</data>
|
||||||
|
<key>Headers/GHSegmentedControl.h</key>
|
||||||
|
<data>
|
||||||
|
102VOHKDPJ/8BdnCba45Ido3ES0=
|
||||||
|
</data>
|
||||||
|
<key>Headers/SVGContext.h</key>
|
||||||
|
<data>
|
||||||
|
fYKblLtFBEOZBWKITmzeqxkB3wA=
|
||||||
|
</data>
|
||||||
|
<key>Headers/SVGDocumentView.h</key>
|
||||||
|
<data>
|
||||||
|
rQdMJag3XRMM0BrzxhBRVDCkECI=
|
||||||
|
</data>
|
||||||
|
<key>Headers/SVGParser.h</key>
|
||||||
|
<data>
|
||||||
|
kTsoaz1ZJ15TgzKXvxTFxWzjdOM=
|
||||||
|
</data>
|
||||||
|
<key>Headers/SVGPathGenerator.h</key>
|
||||||
|
<data>
|
||||||
|
mpIHrojH98DFrfoA1ur9U5rUUGE=
|
||||||
|
</data>
|
||||||
|
<key>Headers/SVGPrinter.h</key>
|
||||||
|
<data>
|
||||||
|
8TpTqQL/mSb4Ja8jrSy9CYsrps8=
|
||||||
|
</data>
|
||||||
|
<key>Headers/SVGRenderer.h</key>
|
||||||
|
<data>
|
||||||
|
aVwIN13G4/FxE5oBMAhhVBzpuvk=
|
||||||
|
</data>
|
||||||
|
<key>Headers/SVGRendererLayer.h</key>
|
||||||
|
<data>
|
||||||
|
NYdrKdLUEhBB1Q1faRR/VkukMMY=
|
||||||
|
</data>
|
||||||
|
<key>Headers/SVGTabBarItem.h</key>
|
||||||
|
<data>
|
||||||
|
T6N+3S6IK3TPlToQWW/8fbYToao=
|
||||||
|
</data>
|
||||||
|
<key>Headers/SVGgh.h</key>
|
||||||
|
<data>
|
||||||
|
FhA5aS1gL+U2oztDy+ZAYAMbsQY=
|
||||||
|
</data>
|
||||||
|
<key>Headers/SVGghLoader.h</key>
|
||||||
|
<data>
|
||||||
|
xtYyyVEweMoAbmxnHJ3OLrTpB+c=
|
||||||
|
</data>
|
||||||
|
<key>Headers/SVGtoPDFConverter.h</key>
|
||||||
|
<data>
|
||||||
|
PYmLqlyOd/ZpkVp082ncU6Hhr08=
|
||||||
|
</data>
|
||||||
|
<key>Info.plist</key>
|
||||||
|
<data>
|
||||||
|
Ekf8hDNYwrf/YAzxlZyyfB58pCE=
|
||||||
|
</data>
|
||||||
|
<key>Modules/module.modulemap</key>
|
||||||
|
<data>
|
||||||
|
OvyNeJvLF4DKiaZWfAOhFhapEM8=
|
||||||
|
</data>
|
||||||
|
</dict>
|
||||||
|
<key>files2</key>
|
||||||
|
<dict>
|
||||||
|
<key>Headers/GHButton.h</key>
|
||||||
|
<dict>
|
||||||
|
<key>hash</key>
|
||||||
|
<data>
|
||||||
|
Yo70QMvylnV/tGNngg/dxwCC+Es=
|
||||||
|
</data>
|
||||||
|
<key>hash2</key>
|
||||||
|
<data>
|
||||||
|
e02JL9wz0/bvHZu9Mh0GvmUPm/1CWWkp6AM6AXjTWvw=
|
||||||
|
</data>
|
||||||
|
</dict>
|
||||||
|
<key>Headers/GHCSSStyle.h</key>
|
||||||
|
<dict>
|
||||||
|
<key>hash</key>
|
||||||
|
<data>
|
||||||
|
/KLi1TX1SrM6jopjQQBiHZm78/o=
|
||||||
|
</data>
|
||||||
|
<key>hash2</key>
|
||||||
|
<data>
|
||||||
|
ThA3cD29qgXA7zxdYA4DdFwDV9Lz51HLEmPYwrSSGkQ=
|
||||||
|
</data>
|
||||||
|
</dict>
|
||||||
|
<key>Headers/GHControl.h</key>
|
||||||
|
<dict>
|
||||||
|
<key>hash</key>
|
||||||
|
<data>
|
||||||
|
p3mMe9yH8rJD8Wm20c3Jd8lxCME=
|
||||||
|
</data>
|
||||||
|
<key>hash2</key>
|
||||||
|
<data>
|
||||||
|
wP2cK5Oo1eQAvri8ETIEqUTNmg0lmJ+rARoPs2DdPYQ=
|
||||||
|
</data>
|
||||||
|
</dict>
|
||||||
|
<key>Headers/GHControlFactory.h</key>
|
||||||
|
<dict>
|
||||||
|
<key>hash</key>
|
||||||
|
<data>
|
||||||
|
a7H0B3wnhh76HiQKYHA2jGl6tk4=
|
||||||
|
</data>
|
||||||
|
<key>hash2</key>
|
||||||
|
<data>
|
||||||
|
55SvszA5H4fH9r5fJfkP2hsGBUHP3dgUWeGzTgaqVM0=
|
||||||
|
</data>
|
||||||
|
</dict>
|
||||||
|
<key>Headers/GHImageCache.h</key>
|
||||||
|
<dict>
|
||||||
|
<key>hash</key>
|
||||||
|
<data>
|
||||||
|
L3yqnld65EyxF+ZVm7agQKAwg08=
|
||||||
|
</data>
|
||||||
|
<key>hash2</key>
|
||||||
|
<data>
|
||||||
|
VjCYQ2OKSb5dgzejm1ykbJV99xz0zM0GdYNrBZ36gp4=
|
||||||
|
</data>
|
||||||
|
</dict>
|
||||||
|
<key>Headers/GHRenderable.h</key>
|
||||||
|
<dict>
|
||||||
|
<key>hash</key>
|
||||||
|
<data>
|
||||||
|
k5uJ1lR+jjohQboiKl361vlWrPU=
|
||||||
|
</data>
|
||||||
|
<key>hash2</key>
|
||||||
|
<data>
|
||||||
|
3b3LzhL3i3jVdQDNj2x7O8t9hNnghbkWUhoXw6JWQJQ=
|
||||||
|
</data>
|
||||||
|
</dict>
|
||||||
|
<key>Headers/GHSegmentedControl.h</key>
|
||||||
|
<dict>
|
||||||
|
<key>hash</key>
|
||||||
|
<data>
|
||||||
|
102VOHKDPJ/8BdnCba45Ido3ES0=
|
||||||
|
</data>
|
||||||
|
<key>hash2</key>
|
||||||
|
<data>
|
||||||
|
zNsVaFFe63wL2AaCOhdJ+FzacSKT7fgxQ9K6TMLGL7w=
|
||||||
|
</data>
|
||||||
|
</dict>
|
||||||
|
<key>Headers/SVGContext.h</key>
|
||||||
|
<dict>
|
||||||
|
<key>hash</key>
|
||||||
|
<data>
|
||||||
|
fYKblLtFBEOZBWKITmzeqxkB3wA=
|
||||||
|
</data>
|
||||||
|
<key>hash2</key>
|
||||||
|
<data>
|
||||||
|
7BISlxYEV6x9kQFS15ufHja8Q+26HD5NjXYaTDJyIEI=
|
||||||
|
</data>
|
||||||
|
</dict>
|
||||||
|
<key>Headers/SVGDocumentView.h</key>
|
||||||
|
<dict>
|
||||||
|
<key>hash</key>
|
||||||
|
<data>
|
||||||
|
rQdMJag3XRMM0BrzxhBRVDCkECI=
|
||||||
|
</data>
|
||||||
|
<key>hash2</key>
|
||||||
|
<data>
|
||||||
|
uq16udgICqUPRBxMJr1B1C0sijIlFLtPhngwJeqRntE=
|
||||||
|
</data>
|
||||||
|
</dict>
|
||||||
|
<key>Headers/SVGParser.h</key>
|
||||||
|
<dict>
|
||||||
|
<key>hash</key>
|
||||||
|
<data>
|
||||||
|
kTsoaz1ZJ15TgzKXvxTFxWzjdOM=
|
||||||
|
</data>
|
||||||
|
<key>hash2</key>
|
||||||
|
<data>
|
||||||
|
nL9jnqsL5GmWqqjE8CTk0VM9ysXla1JmKXUhoc9zJew=
|
||||||
|
</data>
|
||||||
|
</dict>
|
||||||
|
<key>Headers/SVGPathGenerator.h</key>
|
||||||
|
<dict>
|
||||||
|
<key>hash</key>
|
||||||
|
<data>
|
||||||
|
mpIHrojH98DFrfoA1ur9U5rUUGE=
|
||||||
|
</data>
|
||||||
|
<key>hash2</key>
|
||||||
|
<data>
|
||||||
|
aCtFKiBFUHUMLTLS9KnMVfuz/JBhq/huj2tIXKT/t6g=
|
||||||
|
</data>
|
||||||
|
</dict>
|
||||||
|
<key>Headers/SVGPrinter.h</key>
|
||||||
|
<dict>
|
||||||
|
<key>hash</key>
|
||||||
|
<data>
|
||||||
|
8TpTqQL/mSb4Ja8jrSy9CYsrps8=
|
||||||
|
</data>
|
||||||
|
<key>hash2</key>
|
||||||
|
<data>
|
||||||
|
WZ3fWe7ZgJl6A8hKCphqIzD7fCdUsYsqi6ju4DSyvmQ=
|
||||||
|
</data>
|
||||||
|
</dict>
|
||||||
|
<key>Headers/SVGRenderer.h</key>
|
||||||
|
<dict>
|
||||||
|
<key>hash</key>
|
||||||
|
<data>
|
||||||
|
aVwIN13G4/FxE5oBMAhhVBzpuvk=
|
||||||
|
</data>
|
||||||
|
<key>hash2</key>
|
||||||
|
<data>
|
||||||
|
1FPgcUwZeZO91+/cpZg2gIHqAb+cOO9n9AcoIDu71QY=
|
||||||
|
</data>
|
||||||
|
</dict>
|
||||||
|
<key>Headers/SVGRendererLayer.h</key>
|
||||||
|
<dict>
|
||||||
|
<key>hash</key>
|
||||||
|
<data>
|
||||||
|
NYdrKdLUEhBB1Q1faRR/VkukMMY=
|
||||||
|
</data>
|
||||||
|
<key>hash2</key>
|
||||||
|
<data>
|
||||||
|
4vLnO1fPqCOatqPuYa+wsiksl1d21S7E2eXzVKeH0mQ=
|
||||||
|
</data>
|
||||||
|
</dict>
|
||||||
|
<key>Headers/SVGTabBarItem.h</key>
|
||||||
|
<dict>
|
||||||
|
<key>hash</key>
|
||||||
|
<data>
|
||||||
|
T6N+3S6IK3TPlToQWW/8fbYToao=
|
||||||
|
</data>
|
||||||
|
<key>hash2</key>
|
||||||
|
<data>
|
||||||
|
FZKHWXa9wHb65sGsLAgVbX/IHlqu7zP4Jc4C6Fz71k0=
|
||||||
|
</data>
|
||||||
|
</dict>
|
||||||
|
<key>Headers/SVGgh.h</key>
|
||||||
|
<dict>
|
||||||
|
<key>hash</key>
|
||||||
|
<data>
|
||||||
|
FhA5aS1gL+U2oztDy+ZAYAMbsQY=
|
||||||
|
</data>
|
||||||
|
<key>hash2</key>
|
||||||
|
<data>
|
||||||
|
K7FvEVgrwXFf8fYXUC1Z28mYShSPC2GIrNE0Q4jvPMs=
|
||||||
|
</data>
|
||||||
|
</dict>
|
||||||
|
<key>Headers/SVGghLoader.h</key>
|
||||||
|
<dict>
|
||||||
|
<key>hash</key>
|
||||||
|
<data>
|
||||||
|
xtYyyVEweMoAbmxnHJ3OLrTpB+c=
|
||||||
|
</data>
|
||||||
|
<key>hash2</key>
|
||||||
|
<data>
|
||||||
|
eAmiKTkaGKhWeYrt4GzqMyXKWxvpJSrJe0aowwF858w=
|
||||||
|
</data>
|
||||||
|
</dict>
|
||||||
|
<key>Headers/SVGtoPDFConverter.h</key>
|
||||||
|
<dict>
|
||||||
|
<key>hash</key>
|
||||||
|
<data>
|
||||||
|
PYmLqlyOd/ZpkVp082ncU6Hhr08=
|
||||||
|
</data>
|
||||||
|
<key>hash2</key>
|
||||||
|
<data>
|
||||||
|
aPPmosLWJKuzNygim1G+NZNMbZ67Jndy3J7vneUEeqQ=
|
||||||
|
</data>
|
||||||
|
</dict>
|
||||||
|
<key>Modules/module.modulemap</key>
|
||||||
|
<dict>
|
||||||
|
<key>hash</key>
|
||||||
|
<data>
|
||||||
|
OvyNeJvLF4DKiaZWfAOhFhapEM8=
|
||||||
|
</data>
|
||||||
|
<key>hash2</key>
|
||||||
|
<data>
|
||||||
|
CmWiPcMFYwuE9f+Q49hr18AoV6Ol0PT3grO8cewWpnc=
|
||||||
|
</data>
|
||||||
|
</dict>
|
||||||
|
</dict>
|
||||||
|
<key>rules</key>
|
||||||
|
<dict>
|
||||||
|
<key>^</key>
|
||||||
|
<true/>
|
||||||
|
<key>^.*\.lproj/</key>
|
||||||
|
<dict>
|
||||||
|
<key>optional</key>
|
||||||
|
<true/>
|
||||||
|
<key>weight</key>
|
||||||
|
<real>1000</real>
|
||||||
|
</dict>
|
||||||
|
<key>^.*\.lproj/locversion.plist$</key>
|
||||||
|
<dict>
|
||||||
|
<key>omit</key>
|
||||||
|
<true/>
|
||||||
|
<key>weight</key>
|
||||||
|
<real>1100</real>
|
||||||
|
</dict>
|
||||||
|
<key>^Base\.lproj/</key>
|
||||||
|
<dict>
|
||||||
|
<key>weight</key>
|
||||||
|
<real>1010</real>
|
||||||
|
</dict>
|
||||||
|
<key>^version.plist$</key>
|
||||||
|
<true/>
|
||||||
|
</dict>
|
||||||
|
<key>rules2</key>
|
||||||
|
<dict>
|
||||||
|
<key>.*\.dSYM($|/)</key>
|
||||||
|
<dict>
|
||||||
|
<key>weight</key>
|
||||||
|
<real>11</real>
|
||||||
|
</dict>
|
||||||
|
<key>^</key>
|
||||||
|
<dict>
|
||||||
|
<key>weight</key>
|
||||||
|
<real>20</real>
|
||||||
|
</dict>
|
||||||
|
<key>^(.*/)?\.DS_Store$</key>
|
||||||
|
<dict>
|
||||||
|
<key>omit</key>
|
||||||
|
<true/>
|
||||||
|
<key>weight</key>
|
||||||
|
<real>2000</real>
|
||||||
|
</dict>
|
||||||
|
<key>^(Frameworks|SharedFrameworks|PlugIns|Plug-ins|XPCServices|Helpers|MacOS|Library/(Automator|Spotlight|LoginItems))/</key>
|
||||||
|
<dict>
|
||||||
|
<key>nested</key>
|
||||||
|
<true/>
|
||||||
|
<key>weight</key>
|
||||||
|
<real>10</real>
|
||||||
|
</dict>
|
||||||
|
<key>^.*</key>
|
||||||
|
<true/>
|
||||||
|
<key>^.*\.lproj/</key>
|
||||||
|
<dict>
|
||||||
|
<key>optional</key>
|
||||||
|
<true/>
|
||||||
|
<key>weight</key>
|
||||||
|
<real>1000</real>
|
||||||
|
</dict>
|
||||||
|
<key>^.*\.lproj/locversion.plist$</key>
|
||||||
|
<dict>
|
||||||
|
<key>omit</key>
|
||||||
|
<true/>
|
||||||
|
<key>weight</key>
|
||||||
|
<real>1100</real>
|
||||||
|
</dict>
|
||||||
|
<key>^Base\.lproj/</key>
|
||||||
|
<dict>
|
||||||
|
<key>weight</key>
|
||||||
|
<real>1010</real>
|
||||||
|
</dict>
|
||||||
|
<key>^Info\.plist$</key>
|
||||||
|
<dict>
|
||||||
|
<key>omit</key>
|
||||||
|
<true/>
|
||||||
|
<key>weight</key>
|
||||||
|
<real>20</real>
|
||||||
|
</dict>
|
||||||
|
<key>^PkgInfo$</key>
|
||||||
|
<dict>
|
||||||
|
<key>omit</key>
|
||||||
|
<true/>
|
||||||
|
<key>weight</key>
|
||||||
|
<real>20</real>
|
||||||
|
</dict>
|
||||||
|
<key>^[^/]+$</key>
|
||||||
|
<dict>
|
||||||
|
<key>nested</key>
|
||||||
|
<true/>
|
||||||
|
<key>weight</key>
|
||||||
|
<real>10</real>
|
||||||
|
</dict>
|
||||||
|
<key>^embedded\.provisionprofile$</key>
|
||||||
|
<dict>
|
||||||
|
<key>weight</key>
|
||||||
|
<real>20</real>
|
||||||
|
</dict>
|
||||||
|
<key>^version\.plist$</key>
|
||||||
|
<dict>
|
||||||
|
<key>weight</key>
|
||||||
|
<real>20</real>
|
||||||
|
</dict>
|
||||||
|
</dict>
|
||||||
|
</dict>
|
||||||
|
</plist>
|
||||||
@@ -46,7 +46,7 @@ public class IosBitmap implements Bitmap {
|
|||||||
|
|
||||||
static final Logger log = LoggerFactory.getLogger(IosBitmap.class);
|
static final Logger log = LoggerFactory.getLogger(IosBitmap.class);
|
||||||
|
|
||||||
final CGBitmapContext cgBitmapContext;
|
CGBitmapContext cgBitmapContext;
|
||||||
final int width;
|
final int width;
|
||||||
final int height;
|
final int height;
|
||||||
private int glInternalFormat = Integer.MIN_VALUE;
|
private int glInternalFormat = Integer.MIN_VALUE;
|
||||||
@@ -158,10 +158,14 @@ public class IosBitmap implements Bitmap {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void recycle() {
|
public void recycle() {
|
||||||
if (this.cgBitmapContext != null) this.cgBitmapContext.release();
|
//CGContext.close() will close the object and release any system resources it holds.
|
||||||
|
if (this.cgBitmapContext != null) {
|
||||||
|
this.cgBitmapContext.close();
|
||||||
|
this.cgBitmapContext = null;
|
||||||
|
}
|
||||||
if (this.directPixelBuffer != null) {
|
if (this.directPixelBuffer != null) {
|
||||||
//cgBitmapContext.release() will also release the directPixelBuffer
|
this.directPixelBuffer.clear();
|
||||||
this.directPixelBuffer = null; //only hint for GC
|
this.directPixelBuffer = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2016 Longri
|
* Copyright 2016-2017 Longri
|
||||||
* Copyright 2016 devemux86
|
* Copyright 2016-2017 devemux86
|
||||||
|
* 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
|
||||||
* 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
|
||||||
@@ -92,8 +93,36 @@ public class IosCanvas implements Canvas {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void drawLine(int x1, int y1, int x2, int y2, Paint paint) {
|
public void drawBitmapScaled(Bitmap bitmap) {
|
||||||
|
CGRect rect = new CGRect(0, 0, this.cgBitmapContext.getWidth(), this.cgBitmapContext.getHeight());
|
||||||
|
this.cgBitmapContext.saveGState();
|
||||||
|
this.cgBitmapContext.translateCTM(0, 0);
|
||||||
|
this.cgBitmapContext.drawImage(rect, ((IosBitmap) bitmap).cgBitmapContext.toImage());
|
||||||
|
this.cgBitmapContext.restoreGState();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void drawCircle(float x, float y, float radius, Paint paint) {
|
||||||
|
CGRect rect = new CGRect(x - radius, y - radius, x + radius, y + radius);
|
||||||
|
|
||||||
|
switch (paint.getStyle()) {
|
||||||
|
case FILL:
|
||||||
|
setFillColor(this.cgBitmapContext, paint.getColor());
|
||||||
|
this.cgBitmapContext.fillEllipseInRect(rect);
|
||||||
|
break;
|
||||||
|
case STROKE:
|
||||||
|
// set Stroke properties
|
||||||
|
this.cgBitmapContext.setLineWidth(((IosPaint) paint).strokeWidth);
|
||||||
|
this.cgBitmapContext.setLineCap(((IosPaint) paint).getIosStrokeCap());
|
||||||
|
this.cgBitmapContext.setLineJoin(((IosPaint) paint).getIosStrokeJoin());
|
||||||
|
setStrokeColor(this.cgBitmapContext, (paint.getColor()));
|
||||||
|
this.cgBitmapContext.strokeEllipseInRect(rect);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void drawLine(float x1, float y1, float x2, float y2, Paint paint) {
|
||||||
//flip Y-axis
|
//flip Y-axis
|
||||||
y1 = (int) (this.cgBitmapContext.getHeight() - y1);
|
y1 = (int) (this.cgBitmapContext.getHeight() - y1);
|
||||||
y2 = (int) (this.cgBitmapContext.getHeight() - y2);
|
y2 = (int) (this.cgBitmapContext.getHeight() - y2);
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2016 Longri
|
* Copyright 2016 Longri
|
||||||
* Copyright 2016 devemux86
|
* Copyright 2016-2017 devemux86
|
||||||
|
* 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
|
||||||
* 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
|
||||||
@@ -64,6 +65,7 @@ public class IosPaint implements Paint {
|
|||||||
private static final String DEFAULT_FONT_NAME_BOLD = UIFont.getSystemFont(1, UIFontWeight.Bold).getFontDescriptor().getPostscriptName();
|
private static final String DEFAULT_FONT_NAME_BOLD = UIFont.getSystemFont(1, UIFontWeight.Bold).getFontDescriptor().getPostscriptName();
|
||||||
private static final String DEFAULT_FONT_NAME_ITALIC = UIFont.getItalicSystemFont(1).getFontDescriptor().getPostscriptName();
|
private static final String DEFAULT_FONT_NAME_ITALIC = UIFont.getItalicSystemFont(1).getFontDescriptor().getPostscriptName();
|
||||||
|
|
||||||
|
private Align align;
|
||||||
private final NSAttributedStringAttributes attribs = new NSAttributedStringAttributes();
|
private final NSAttributedStringAttributes attribs = new NSAttributedStringAttributes();
|
||||||
private CGLineCap cap = CGLineCap.Butt;
|
private CGLineCap cap = CGLineCap.Butt;
|
||||||
private CGLineJoin join = CGLineJoin.Miter;
|
private CGLineJoin join = CGLineJoin.Miter;
|
||||||
@@ -146,8 +148,8 @@ public class IosPaint implements Paint {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setTextAlign(Align align) {
|
public void setTextAlign(Align align) {
|
||||||
// Align text in text layer
|
// TODO never read
|
||||||
//this.align = align;
|
this.align = align;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -342,6 +344,11 @@ public class IosPaint implements Paint {
|
|||||||
return strokeWidth;
|
return strokeWidth;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Style getStyle() {
|
||||||
|
return style;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public float getTextHeight(String text) {
|
public float getTextHeight(String text) {
|
||||||
return this.fontHeight;
|
return this.fontHeight;
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2016 devemux86
|
* Copyright 2014 Hannes Janetzek
|
||||||
|
* Copyright 2016-2017 devemux86
|
||||||
|
* Copyright 2017 Akarsh Seggemu
|
||||||
*
|
*
|
||||||
* This file is part of the OpenScienceMap project (http://www.opensciencemap.org).
|
* This file is part of the OpenScienceMap project (http://www.opensciencemap.org).
|
||||||
*
|
*
|
||||||
@@ -42,13 +44,11 @@ import java.util.HashMap;
|
|||||||
public class OSMIndoorLayer extends JeoVectorLayer {
|
public class OSMIndoorLayer extends JeoVectorLayer {
|
||||||
|
|
||||||
protected TextBucket mTextLayer;
|
protected TextBucket mTextLayer;
|
||||||
protected TextStyle mText = TextStyle.builder()
|
protected TextStyle mText;
|
||||||
.fontSize(16).color(Color.BLACK)
|
|
||||||
.strokeWidth(2.2f).strokeColor(Color.WHITE)
|
|
||||||
.build();
|
|
||||||
|
|
||||||
public OSMIndoorLayer(Map map, VectorDataset data, Style style) {
|
public OSMIndoorLayer(Map map, VectorDataset data, Style style, TextStyle textStyle) {
|
||||||
super(map, data, style);
|
super(map, data, style);
|
||||||
|
mText = textStyle;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean[] activeLevels = new boolean[10];
|
public boolean[] activeLevels = new boolean[10];
|
||||||
@@ -63,7 +63,6 @@ public class OSMIndoorLayer extends JeoVectorLayer {
|
|||||||
|
|
||||||
//render TextItems to a bitmap and prepare vertex buffer data.
|
//render TextItems to a bitmap and prepare vertex buffer data.
|
||||||
mTextLayer.prepare();
|
mTextLayer.prepare();
|
||||||
mTextLayer.clearLabels();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void addLine(Task t, Feature f, Rule rule, Geometry g) {
|
protected void addLine(Task t, Feature f, Rule rule, Geometry g) {
|
||||||
@@ -98,8 +97,8 @@ public class OSMIndoorLayer extends JeoVectorLayer {
|
|||||||
float width = rule.number(f, CartoCSS.LINE_WIDTH, 1.2f);
|
float width = rule.number(f, CartoCSS.LINE_WIDTH, 1.2f);
|
||||||
int color = Color.rainbow((level + 1) / 10f);
|
int color = Color.rainbow((level + 1) / 10f);
|
||||||
|
|
||||||
if (level > -2 && !active)
|
if (/*level > -2 && */!active)
|
||||||
color = Color.fade(color, 0.1f);
|
color = getInactiveColor(color);
|
||||||
|
|
||||||
ll.line = new LineStyle(0, color, width);
|
ll.line = new LineStyle(0, color, width);
|
||||||
ll.heightOffset = level * 4;
|
ll.heightOffset = level * 4;
|
||||||
@@ -109,8 +108,8 @@ public class OSMIndoorLayer extends JeoVectorLayer {
|
|||||||
MeshBucket mesh = t.buckets.getMeshBucket(level * 3);
|
MeshBucket mesh = t.buckets.getMeshBucket(level * 3);
|
||||||
if (mesh.area == null) {
|
if (mesh.area == null) {
|
||||||
int color = JeoUtils.color(rule.color(f, CartoCSS.POLYGON_FILL, RGB.red));
|
int color = JeoUtils.color(rule.color(f, CartoCSS.POLYGON_FILL, RGB.red));
|
||||||
if (level > -2 && !active)
|
if (/*level > -2 && */!active)
|
||||||
color = Color.fade(color, 0.1f);
|
color = getInactiveColor(color);
|
||||||
|
|
||||||
mesh.area = new AreaStyle(color);
|
mesh.area = new AreaStyle(color);
|
||||||
//mesh.area = new Area(Color.fade(Color.DKGRAY, 0.1f));
|
//mesh.area = new Area(Color.fade(Color.DKGRAY, 0.1f));
|
||||||
@@ -125,15 +124,17 @@ public class OSMIndoorLayer extends JeoVectorLayer {
|
|||||||
float x = 0;
|
float x = 0;
|
||||||
float y = 0;
|
float y = 0;
|
||||||
int n = mGeom.index[0];
|
int n = mGeom.index[0];
|
||||||
for (int i = 0; i < n; ) {
|
if (n > 0) {
|
||||||
x += mGeom.points[i++];
|
for (int i = 0; i < n; ) {
|
||||||
y += mGeom.points[i++];
|
x += mGeom.points[i++];
|
||||||
|
y += mGeom.points[i++];
|
||||||
|
}
|
||||||
|
|
||||||
|
TextItem ti = TextItem.pool.get();
|
||||||
|
ti.set(x / (n / 2), y / (n / 2), (String) o, mText);
|
||||||
|
|
||||||
|
mTextLayer.addText(ti);
|
||||||
}
|
}
|
||||||
|
|
||||||
TextItem ti = TextItem.pool.get();
|
|
||||||
ti.set(x / (n / 2) / 8, y / (n / 2) / 8, (String) o, mText);
|
|
||||||
|
|
||||||
mTextLayer.addText(ti);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -143,6 +144,10 @@ public class OSMIndoorLayer extends JeoVectorLayer {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected int getInactiveColor(int color) {
|
||||||
|
return Color.fade(color, 0.1f);
|
||||||
|
}
|
||||||
|
|
||||||
private int getLevel(Feature f) {
|
private int getLevel(Feature f) {
|
||||||
/* not sure if one could match these geojson properties with cartocss */
|
/* not sure if one could match these geojson properties with cartocss */
|
||||||
Object o = f.get("@relations");
|
Object o = f.get("@relations");
|
||||||
@@ -160,7 +165,12 @@ public class OSMIndoorLayer extends JeoVectorLayer {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
o = f.get("level");
|
||||||
|
if (o instanceof String) {
|
||||||
|
return (int) Double.parseDouble((String) o);
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2016 devemux86
|
* Copyright 2014 Hannes Janetzek
|
||||||
|
* Copyright 2016-2017 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).
|
||||||
*
|
*
|
||||||
@@ -32,11 +33,13 @@ import org.jeo.vector.Schema;
|
|||||||
import org.jeo.vector.SchemaBuilder;
|
import org.jeo.vector.SchemaBuilder;
|
||||||
import org.jeo.vector.VectorDataset;
|
import org.jeo.vector.VectorDataset;
|
||||||
import org.jeo.vector.VectorQuery;
|
import org.jeo.vector.VectorQuery;
|
||||||
|
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;
|
||||||
import org.oscim.layers.tile.vector.VectorTileLayer;
|
import org.oscim.layers.tile.vector.VectorTileLayer;
|
||||||
import org.oscim.map.Map;
|
import org.oscim.map.Map;
|
||||||
import org.oscim.renderer.MapRenderer;
|
import org.oscim.renderer.MapRenderer;
|
||||||
|
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.File;
|
||||||
@@ -60,7 +63,12 @@ public class JeoTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Style style = JeoTest.getStyle();
|
Style style = JeoTest.getStyle();
|
||||||
map.layers().add(new OSMIndoorLayer(map, data, style));
|
TextStyle textStyle = TextStyle.builder()
|
||||||
|
.isCaption(true)
|
||||||
|
.fontSize(16).color(Color.BLACK)
|
||||||
|
.strokeWidth(2.2f).strokeColor(Color.WHITE)
|
||||||
|
.build();
|
||||||
|
map.layers().add(new OSMIndoorLayer(map, data, style, textStyle));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Style getStyle() {
|
public static Style getStyle() {
|
||||||
|
|||||||
17
vtm-json/build.gradle
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
apply plugin: 'java'
|
||||||
|
apply plugin: 'maven'
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
compile project(':vtm')
|
||||||
|
compile 'com.fasterxml.jackson.core:jackson-core:2.8.4'
|
||||||
|
}
|
||||||
|
|
||||||
|
sourceSets {
|
||||||
|
main.java.srcDirs = ['src']
|
||||||
|
}
|
||||||
|
|
||||||
|
if (project.hasProperty("SONATYPE_USERNAME")) {
|
||||||
|
afterEvaluate {
|
||||||
|
project.apply from: "${rootProject.projectDir}/deploy.gradle"
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,70 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2014 Hannes Janetzek
|
||||||
|
* Copyright 2017 devemux86
|
||||||
|
*
|
||||||
|
* This file is part of the OpenScienceMap project (http://www.opensciencemap.org).
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify it under the
|
||||||
|
* terms of the GNU Lesser General Public License as published by the Free Software
|
||||||
|
* Foundation, either version 3 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||||
|
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||||
|
* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public License along with
|
||||||
|
* this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
package org.oscim.tiling.source.geojson;
|
||||||
|
|
||||||
|
import org.oscim.core.MapElement;
|
||||||
|
import org.oscim.core.Tag;
|
||||||
|
import org.oscim.tiling.ITileDataSource;
|
||||||
|
import org.oscim.tiling.source.UrlTileDataSource;
|
||||||
|
import org.oscim.tiling.source.UrlTileSource;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
public abstract class GeojsonTileSource extends UrlTileSource {
|
||||||
|
|
||||||
|
protected GeojsonTileSource(Builder<?> builder) {
|
||||||
|
super(builder);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected GeojsonTileSource(String urlString, String tilePath) {
|
||||||
|
super(urlString, tilePath);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected GeojsonTileSource(String urlString, String tilePath, int zoomMin, int zoomMax) {
|
||||||
|
super(urlString, tilePath, zoomMin, zoomMax);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ITileDataSource getDataSource() {
|
||||||
|
return new UrlTileDataSource(this, new TileDecoder(this), getHttpEngine());
|
||||||
|
}
|
||||||
|
|
||||||
|
public Tag getFeatureTag() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* allow overriding tag handling
|
||||||
|
*/
|
||||||
|
public abstract void decodeTags(MapElement mapElement, Map<String, Object> properties);
|
||||||
|
|
||||||
|
public Tag rewriteTag(String key, Object value) {
|
||||||
|
if (value == null)
|
||||||
|
return null;
|
||||||
|
|
||||||
|
String val = (value instanceof String) ? (String) value : String.valueOf(value);
|
||||||
|
|
||||||
|
return new Tag(key, val);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* modify mapElement before process()
|
||||||
|
*/
|
||||||
|
public void postGeomHook(MapElement mapElement) {
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,108 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2017 devemux86
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify it under the
|
||||||
|
* terms of the GNU Lesser General Public License as published by the Free Software
|
||||||
|
* Foundation, either version 3 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||||
|
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||||
|
* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public License along with
|
||||||
|
* this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
package org.oscim.tiling.source.geojson;
|
||||||
|
|
||||||
|
import org.oscim.core.MapElement;
|
||||||
|
import org.oscim.core.Tag;
|
||||||
|
import org.oscim.tiling.source.UrlTileSource;
|
||||||
|
|
||||||
|
import java.util.LinkedHashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
public class MapzenGeojsonTileSource extends GeojsonTileSource {
|
||||||
|
|
||||||
|
private final static String DEFAULT_URL = "https://tile.mapzen.com/mapzen/vector/v1/all";
|
||||||
|
private final static String DEFAULT_PATH = "/{Z}/{X}/{Y}.json";
|
||||||
|
|
||||||
|
public static class Builder<T extends Builder<T>> extends UrlTileSource.Builder<T> {
|
||||||
|
private String locale = "";
|
||||||
|
|
||||||
|
public Builder() {
|
||||||
|
super(DEFAULT_URL, DEFAULT_PATH, 1, 17);
|
||||||
|
}
|
||||||
|
|
||||||
|
public T locale(String locale) {
|
||||||
|
this.locale = locale;
|
||||||
|
return self();
|
||||||
|
}
|
||||||
|
|
||||||
|
public MapzenGeojsonTileSource build() {
|
||||||
|
return new MapzenGeojsonTileSource(this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("rawtypes")
|
||||||
|
public static Builder<?> builder() {
|
||||||
|
return new Builder();
|
||||||
|
}
|
||||||
|
|
||||||
|
private static Map<String, Tag> mappings = new LinkedHashMap<>();
|
||||||
|
|
||||||
|
private static Tag addMapping(String key, String val) {
|
||||||
|
Tag tag = new Tag(key, val);
|
||||||
|
mappings.put(key + "=" + val, tag);
|
||||||
|
return tag;
|
||||||
|
}
|
||||||
|
|
||||||
|
private final String locale;
|
||||||
|
|
||||||
|
public MapzenGeojsonTileSource(Builder<?> builder) {
|
||||||
|
super(builder);
|
||||||
|
this.locale = builder.locale;
|
||||||
|
}
|
||||||
|
|
||||||
|
public MapzenGeojsonTileSource() {
|
||||||
|
this(builder());
|
||||||
|
}
|
||||||
|
|
||||||
|
public MapzenGeojsonTileSource(String urlString) {
|
||||||
|
this(builder().url(urlString));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void decodeTags(MapElement mapElement, Map<String, Object> properties) {
|
||||||
|
boolean hasName = false;
|
||||||
|
String fallbackName = null;
|
||||||
|
|
||||||
|
for (Map.Entry<String, Object> entry : properties.entrySet()) {
|
||||||
|
String key = entry.getKey();
|
||||||
|
Object value = entry.getValue();
|
||||||
|
String val = (value instanceof String) ? (String) value : String.valueOf(value);
|
||||||
|
|
||||||
|
if (key.startsWith(Tag.KEY_NAME)) {
|
||||||
|
int len = key.length();
|
||||||
|
if (len == 4) {
|
||||||
|
fallbackName = val;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (len < 7)
|
||||||
|
continue;
|
||||||
|
if (locale.equals(key.substring(5))) {
|
||||||
|
hasName = true;
|
||||||
|
mapElement.tags.add(new Tag(Tag.KEY_NAME, val, false));
|
||||||
|
}
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
Tag tag = mappings.get(key + "=" + val);
|
||||||
|
if (tag == null)
|
||||||
|
tag = addMapping(key, val);
|
||||||
|
mapElement.tags.add(tag);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!hasName && fallbackName != null)
|
||||||
|
mapElement.tags.add(new Tag(Tag.KEY_NAME, fallbackName, false));
|
||||||
|
}
|
||||||
|
}
|
||||||
342
vtm-json/src/org/oscim/tiling/source/geojson/TileDecoder.java
Normal file
@@ -0,0 +1,342 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2014 Hannes Janetzek
|
||||||
|
* Copyright 2017 devemux86
|
||||||
|
*
|
||||||
|
* This file is part of the OpenScienceMap project (http://www.opensciencemap.org).
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify it under the
|
||||||
|
* terms of the GNU Lesser General Public License as published by the Free Software
|
||||||
|
* Foundation, either version 3 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||||
|
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||||
|
* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public License along with
|
||||||
|
* this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
package org.oscim.tiling.source.geojson;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.core.JsonFactory;
|
||||||
|
import com.fasterxml.jackson.core.JsonParser;
|
||||||
|
import com.fasterxml.jackson.core.JsonToken;
|
||||||
|
|
||||||
|
import org.oscim.core.GeometryBuffer.GeometryType;
|
||||||
|
import org.oscim.core.MapElement;
|
||||||
|
import org.oscim.core.Tag;
|
||||||
|
import org.oscim.core.Tile;
|
||||||
|
import org.oscim.tiling.ITileDataSink;
|
||||||
|
import org.oscim.tiling.source.ITileDecoder;
|
||||||
|
import org.oscim.utils.ArrayUtils;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.InputStream;
|
||||||
|
import java.io.InputStreamReader;
|
||||||
|
import java.util.LinkedHashMap;
|
||||||
|
|
||||||
|
import static com.fasterxml.jackson.core.JsonToken.END_ARRAY;
|
||||||
|
import static com.fasterxml.jackson.core.JsonToken.END_OBJECT;
|
||||||
|
import static com.fasterxml.jackson.core.JsonToken.FIELD_NAME;
|
||||||
|
import static com.fasterxml.jackson.core.JsonToken.START_ARRAY;
|
||||||
|
import static com.fasterxml.jackson.core.JsonToken.START_OBJECT;
|
||||||
|
import static com.fasterxml.jackson.core.JsonToken.VALUE_NUMBER_FLOAT;
|
||||||
|
import static com.fasterxml.jackson.core.JsonToken.VALUE_NUMBER_INT;
|
||||||
|
import static com.fasterxml.jackson.core.JsonToken.VALUE_STRING;
|
||||||
|
import static org.oscim.core.MercatorProjection.latitudeToY;
|
||||||
|
import static org.oscim.core.MercatorProjection.longitudeToX;
|
||||||
|
|
||||||
|
public class TileDecoder implements ITileDecoder {
|
||||||
|
|
||||||
|
private final MapElement mMapElement;
|
||||||
|
private final GeojsonTileSource mTileSource;
|
||||||
|
private final LinkedHashMap<String, Object> mTagMap;
|
||||||
|
private final JsonFactory mJsonFactory;
|
||||||
|
|
||||||
|
private final static char[] FIELD_FEATURES = "features".toCharArray();
|
||||||
|
private final static char[] FIELD_GEOMETRY = "geometry".toCharArray();
|
||||||
|
private final static char[] FIELD_PROPERTIES = "properties".toCharArray();
|
||||||
|
private final static char[] FIELD_COORDINATES = "coordinates".toCharArray();
|
||||||
|
private final static char[] FIELD_TYPE = "type".toCharArray();
|
||||||
|
|
||||||
|
private final static char[] LINESTRING = "LineString".toCharArray();
|
||||||
|
private final static char[] POLYGON = "Polygon".toCharArray();
|
||||||
|
private final static char[] POINT = "Point".toCharArray();
|
||||||
|
private final static char[] MULTI_LINESTRING = "MultiLineString".toCharArray();
|
||||||
|
private final static char[] MULTI_POLYGON = "MultiPolygon".toCharArray();
|
||||||
|
private final static char[] MULTI_POINT = "MultiPoint".toCharArray();
|
||||||
|
|
||||||
|
private ITileDataSink mTileDataSink;
|
||||||
|
|
||||||
|
private double mTileY, mTileX, mTileScale;
|
||||||
|
|
||||||
|
public TileDecoder(GeojsonTileSource tileSource) {
|
||||||
|
mTileSource = tileSource;
|
||||||
|
mTagMap = new LinkedHashMap<>();
|
||||||
|
mJsonFactory = new JsonFactory();
|
||||||
|
|
||||||
|
mMapElement = new MapElement();
|
||||||
|
mMapElement.layer = 5;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean decode(Tile tile, ITileDataSink sink, InputStream is) throws IOException {
|
||||||
|
mTileDataSink = sink;
|
||||||
|
mTileScale = 1 << tile.zoomLevel;
|
||||||
|
mTileX = tile.tileX / mTileScale;
|
||||||
|
mTileY = tile.tileY / mTileScale;
|
||||||
|
mTileScale *= Tile.SIZE;
|
||||||
|
|
||||||
|
JsonParser jp = mJsonFactory.createParser(new InputStreamReader(is));
|
||||||
|
|
||||||
|
Tag layerTag = null;
|
||||||
|
for (JsonToken t; (t = jp.nextToken()) != null; ) {
|
||||||
|
if (t == FIELD_NAME) {
|
||||||
|
if (!match(jp, FIELD_FEATURES) && !match(jp, FIELD_TYPE))
|
||||||
|
layerTag = new Tag("layer", jp.getCurrentName());
|
||||||
|
if (match(jp, FIELD_FEATURES)) {
|
||||||
|
if (jp.nextToken() != START_ARRAY)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
while ((t = jp.nextToken()) != null) {
|
||||||
|
if (t == START_OBJECT)
|
||||||
|
parseFeature(jp, layerTag);
|
||||||
|
|
||||||
|
if (t == END_ARRAY)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void parseFeature(JsonParser jp, Tag layerTag) throws IOException {
|
||||||
|
|
||||||
|
mMapElement.clear();
|
||||||
|
mMapElement.tags.clear();
|
||||||
|
if (layerTag != null)
|
||||||
|
mMapElement.tags.add(layerTag);
|
||||||
|
mTagMap.clear();
|
||||||
|
|
||||||
|
for (JsonToken t; (t = jp.nextToken()) != null; ) {
|
||||||
|
if (t == FIELD_NAME) {
|
||||||
|
if (match(jp, FIELD_GEOMETRY)) {
|
||||||
|
if (jp.nextToken() == START_OBJECT)
|
||||||
|
parseGeometry(jp);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (match(jp, FIELD_PROPERTIES)) {
|
||||||
|
if (jp.nextToken() == START_OBJECT)
|
||||||
|
parseProperties(jp);
|
||||||
|
}
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (t == END_OBJECT)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
//add tag information
|
||||||
|
mTileSource.decodeTags(mMapElement, mTagMap);
|
||||||
|
if (mMapElement.tags.numTags == 0)
|
||||||
|
return;
|
||||||
|
|
||||||
|
mTileSource.postGeomHook(mMapElement);
|
||||||
|
|
||||||
|
if (mMapElement.type == GeometryType.NONE)
|
||||||
|
return;
|
||||||
|
|
||||||
|
//process this element
|
||||||
|
mTileDataSink.process(mMapElement);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void parseProperties(JsonParser jp) throws IOException {
|
||||||
|
for (JsonToken t; (t = jp.nextToken()) != null; ) {
|
||||||
|
if (t == FIELD_NAME) {
|
||||||
|
String text = jp.getCurrentName();
|
||||||
|
|
||||||
|
t = jp.nextToken();
|
||||||
|
if (t == VALUE_STRING) {
|
||||||
|
mTagMap.put(text, jp.getText());
|
||||||
|
} else if (t == VALUE_NUMBER_INT) {
|
||||||
|
mTagMap.put(text, jp.getNumberValue());
|
||||||
|
}
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (t == END_OBJECT)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void parseGeometry(JsonParser jp) throws IOException {
|
||||||
|
|
||||||
|
boolean multi = false;
|
||||||
|
GeometryType type = GeometryType.NONE;
|
||||||
|
|
||||||
|
for (JsonToken t; (t = jp.nextToken()) != null; ) {
|
||||||
|
if (t == FIELD_NAME) {
|
||||||
|
if (match(jp, FIELD_COORDINATES)) {
|
||||||
|
if (jp.nextToken() != START_ARRAY)
|
||||||
|
continue;
|
||||||
|
if (multi) {
|
||||||
|
parseMulti(jp, type);
|
||||||
|
} else {
|
||||||
|
if (type == GeometryType.POLY)
|
||||||
|
parsePolygon(jp);
|
||||||
|
|
||||||
|
if (type == GeometryType.LINE)
|
||||||
|
parseLineString(jp);
|
||||||
|
|
||||||
|
if (type == GeometryType.POINT)
|
||||||
|
parseCoordinate(jp);
|
||||||
|
|
||||||
|
}
|
||||||
|
} else if (match(jp, FIELD_TYPE)) {
|
||||||
|
multi = false;
|
||||||
|
|
||||||
|
jp.nextToken();
|
||||||
|
|
||||||
|
if (match(jp, LINESTRING))
|
||||||
|
type = GeometryType.LINE;
|
||||||
|
else if (match(jp, POLYGON))
|
||||||
|
type = GeometryType.POLY;
|
||||||
|
else if (match(jp, POINT))
|
||||||
|
type = GeometryType.POINT;
|
||||||
|
else if (match(jp, MULTI_LINESTRING)) {
|
||||||
|
type = GeometryType.LINE;
|
||||||
|
multi = true;
|
||||||
|
} else if (match(jp, MULTI_POLYGON)) {
|
||||||
|
type = GeometryType.POLY;
|
||||||
|
multi = true;
|
||||||
|
} else if (match(jp, MULTI_POINT)) {
|
||||||
|
type = GeometryType.POINT;
|
||||||
|
multi = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (type == GeometryType.POINT)
|
||||||
|
mMapElement.startPoints();
|
||||||
|
}
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (t == END_OBJECT)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void parseMulti(JsonParser jp, GeometryType type) throws IOException {
|
||||||
|
|
||||||
|
for (JsonToken t; (t = jp.nextToken()) != null; ) {
|
||||||
|
if (t == END_ARRAY)
|
||||||
|
break;
|
||||||
|
|
||||||
|
if (t == START_ARRAY) {
|
||||||
|
if (type == GeometryType.POLY)
|
||||||
|
parsePolygon(jp);
|
||||||
|
|
||||||
|
else if (type == GeometryType.LINE)
|
||||||
|
parseLineString(jp);
|
||||||
|
|
||||||
|
else if (type == GeometryType.POINT)
|
||||||
|
parseCoordinate(jp);
|
||||||
|
|
||||||
|
} else {
|
||||||
|
//....
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void parsePolygon(JsonParser jp) throws IOException {
|
||||||
|
int ring = 0;
|
||||||
|
|
||||||
|
for (JsonToken t; (t = jp.nextToken()) != null; ) {
|
||||||
|
if (t == START_ARRAY) {
|
||||||
|
if (ring == 0)
|
||||||
|
mMapElement.startPolygon();
|
||||||
|
else
|
||||||
|
mMapElement.startHole();
|
||||||
|
|
||||||
|
ring++;
|
||||||
|
parseCoordSequence(jp);
|
||||||
|
removeLastPoint();
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (t == END_ARRAY)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void removeLastPoint() {
|
||||||
|
mMapElement.pointPos -= 2;
|
||||||
|
mMapElement.index[mMapElement.indexPos] -= 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void parseLineString(JsonParser jp) throws IOException {
|
||||||
|
mMapElement.startLine();
|
||||||
|
parseCoordSequence(jp);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void parseCoordSequence(JsonParser jp) throws IOException {
|
||||||
|
|
||||||
|
for (JsonToken t; (t = jp.nextToken()) != null; ) {
|
||||||
|
|
||||||
|
if (t == START_ARRAY) {
|
||||||
|
parseCoordinate(jp);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (t == END_ARRAY)
|
||||||
|
break;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void parseCoordinate(JsonParser jp) throws IOException {
|
||||||
|
int pos = 0;
|
||||||
|
double x = 0, y = 0; //, z = 0;
|
||||||
|
|
||||||
|
for (JsonToken t; (t = jp.nextToken()) != null; ) {
|
||||||
|
if (t == VALUE_NUMBER_FLOAT || t == VALUE_NUMBER_INT) {
|
||||||
|
|
||||||
|
// avoid String allocation (by getDouble...)
|
||||||
|
char[] val = jp.getTextCharacters();
|
||||||
|
int offset = jp.getTextOffset();
|
||||||
|
int length = jp.getTextLength();
|
||||||
|
double c = ArrayUtils.parseNumber(val, offset, offset + length);
|
||||||
|
|
||||||
|
if (pos == 0)
|
||||||
|
x = c;
|
||||||
|
if (pos == 1)
|
||||||
|
y = c;
|
||||||
|
//if (pos == 2)
|
||||||
|
//z = c;
|
||||||
|
|
||||||
|
pos++;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (t == END_ARRAY)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
mMapElement.addPoint((float) ((longitudeToX(x) - mTileX) * mTileScale),
|
||||||
|
(float) ((latitudeToY(y) - mTileY) * mTileScale));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private static boolean match(JsonParser jp, char[] fieldName) throws IOException {
|
||||||
|
|
||||||
|
int length = jp.getTextLength();
|
||||||
|
if (length != fieldName.length)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
char[] val = jp.getTextCharacters();
|
||||||
|
int offset = jp.getTextOffset();
|
||||||
|
|
||||||
|
for (int i = 0; i < length; i++) {
|
||||||
|
if (fieldName[i] != val[i + offset])
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2012 osmdroid authors: Viesturs Zarins, Martin Pearman
|
* Copyright 2012 osmdroid authors: Viesturs Zarins, Martin Pearman
|
||||||
* Copyright 2012 Hannes Janetzek
|
* Copyright 2012 Hannes Janetzek
|
||||||
* Copyright 2016 devemux86
|
* Copyright 2016-2017 devemux86
|
||||||
* Copyright 2016 Pedinel
|
* Copyright 2016 Pedinel
|
||||||
*
|
*
|
||||||
* This file is part of the OpenScienceMap project (http://www.opensciencemap.org).
|
* This file is part of the OpenScienceMap project (http://www.opensciencemap.org).
|
||||||
@@ -50,6 +50,7 @@ public class PathLayer extends VectorLayer {
|
|||||||
|
|
||||||
public PathLayer(Map map, int lineColor, float lineWidth) {
|
public PathLayer(Map map, int lineColor, float lineWidth) {
|
||||||
this(map, Style.builder()
|
this(map, Style.builder()
|
||||||
|
.fixed(true)
|
||||||
.strokeColor(lineColor)
|
.strokeColor(lineColor)
|
||||||
.strokeWidth(lineWidth)
|
.strokeWidth(lineWidth)
|
||||||
.build());
|
.build());
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2016 devemux86
|
* Copyright 2014 Hannes Janetzek
|
||||||
|
* Copyright 2016-2017 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).
|
||||||
*
|
*
|
||||||
@@ -256,21 +257,20 @@ public class VectorLayer extends AbstractVectorLayer<Drawable> {
|
|||||||
else
|
else
|
||||||
ll = t.buckets.getLineTexBucket(level);
|
ll = t.buckets.getLineTexBucket(level);
|
||||||
if (ll.line == null) {
|
if (ll.line == null) {
|
||||||
if (style.stipple == 0 && style.texture == null)
|
ll.line = LineStyle.builder()
|
||||||
ll.line = new LineStyle(style.strokeColor, style.strokeWidth, style.cap);
|
.reset()
|
||||||
else
|
.cap(style.cap)
|
||||||
ll.line = LineStyle.builder()
|
.color(style.strokeColor)
|
||||||
.cap(style.cap)
|
.fixed(style.fixed)
|
||||||
.color(style.strokeColor)
|
.heightOffset(style.heightOffset)
|
||||||
.fixed(style.fixed)
|
.level(0)
|
||||||
.level(0)
|
.randomOffset(style.randomOffset)
|
||||||
.randomOffset(style.randomOffset)
|
.stipple(style.stipple)
|
||||||
.stipple(style.stipple)
|
.stippleColor(style.stippleColor)
|
||||||
.stippleColor(style.stippleColor)
|
.stippleWidth(style.stippleWidth)
|
||||||
.stippleWidth(style.stippleWidth)
|
.strokeWidth(style.strokeWidth)
|
||||||
.strokeWidth(style.strokeWidth)
|
.texture(style.texture)
|
||||||
.texture(style.texture)
|
.build();
|
||||||
.build();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (style.generalization != Style.GENERALIZATION_NONE) {
|
if (style.generalization != Style.GENERALIZATION_NONE) {
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2016 devemux86
|
* Copyright 2014 Hannes Janetzek
|
||||||
|
* Copyright 2016-2017 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).
|
||||||
*
|
*
|
||||||
@@ -50,6 +51,7 @@ public class Style {
|
|||||||
public final float stippleWidth;
|
public final float stippleWidth;
|
||||||
public final TextureItem texture;
|
public final TextureItem texture;
|
||||||
|
|
||||||
|
public final float heightOffset;
|
||||||
public final boolean randomOffset;
|
public final boolean randomOffset;
|
||||||
|
|
||||||
private Style(Builder builder) {
|
private Style(Builder builder) {
|
||||||
@@ -71,6 +73,7 @@ public class Style {
|
|||||||
stippleWidth = builder.stippleWidth;
|
stippleWidth = builder.stippleWidth;
|
||||||
texture = builder.texture;
|
texture = builder.texture;
|
||||||
|
|
||||||
|
heightOffset = builder.heightOffset;
|
||||||
randomOffset = builder.randomOffset;
|
randomOffset = builder.randomOffset;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -103,6 +106,7 @@ public class Style {
|
|||||||
public float stippleWidth = 1;
|
public float stippleWidth = 1;
|
||||||
public TextureItem texture = null;
|
public TextureItem texture = null;
|
||||||
|
|
||||||
|
public float heightOffset = 0;
|
||||||
public boolean randomOffset = true;
|
public boolean randomOffset = true;
|
||||||
|
|
||||||
protected Builder() {
|
protected Builder() {
|
||||||
@@ -228,6 +232,11 @@ public class Style {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Builder heightOffset(float heightOffset) {
|
||||||
|
this.heightOffset = heightOffset;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
public Builder randomOffset(boolean randomOffset) {
|
public Builder randomOffset(boolean randomOffset) {
|
||||||
this.randomOffset = randomOffset;
|
this.randomOffset = randomOffset;
|
||||||
return this;
|
return this;
|
||||||
|
|||||||
@@ -4,9 +4,10 @@ dependencies {
|
|||||||
compile project(':vtm-desktop')
|
compile project(':vtm-desktop')
|
||||||
compile project(':vtm-extras')
|
compile project(':vtm-extras')
|
||||||
compile project(':vtm-http')
|
compile project(':vtm-http')
|
||||||
compile project(':vtm-jeo')
|
//compile project(':vtm-jeo')
|
||||||
|
compile project(':vtm-json')
|
||||||
compile project(':vtm-jts')
|
compile project(':vtm-jts')
|
||||||
compile 'org.slf4j:slf4j-simple:1.7.21'
|
compile "org.slf4j:slf4j-simple:$slf4jVersion"
|
||||||
}
|
}
|
||||||
|
|
||||||
sourceSets {
|
sourceSets {
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2016 devemux86
|
* Copyright 2016-2017 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
|
||||||
@@ -19,14 +19,16 @@ import org.oscim.backend.CanvasAdapter;
|
|||||||
import org.oscim.backend.canvas.Bitmap;
|
import org.oscim.backend.canvas.Bitmap;
|
||||||
import org.oscim.core.GeoPoint;
|
import org.oscim.core.GeoPoint;
|
||||||
import org.oscim.gdx.GdxMapApp;
|
import org.oscim.gdx.GdxMapApp;
|
||||||
import org.oscim.layers.TileGridLayer;
|
|
||||||
import org.oscim.layers.marker.ItemizedLayer;
|
import org.oscim.layers.marker.ItemizedLayer;
|
||||||
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.buildings.BuildingLayer;
|
||||||
|
import org.oscim.layers.tile.vector.VectorTileLayer;
|
||||||
|
import org.oscim.layers.tile.vector.labeling.LabelLayer;
|
||||||
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.source.bitmap.DefaultSources;
|
import org.oscim.theme.VtmThemes;
|
||||||
|
import org.oscim.tiling.source.oscimap4.OSciMap4TileSource;
|
||||||
import org.oscim.utils.TextureAtlasUtils;
|
import org.oscim.utils.TextureAtlasUtils;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@@ -35,17 +37,18 @@ import java.util.List;
|
|||||||
|
|
||||||
import static org.oscim.layers.marker.MarkerSymbol.HotspotPlace;
|
import static org.oscim.layers.marker.MarkerSymbol.HotspotPlace;
|
||||||
|
|
||||||
public class AtlasMarkerLayerTest extends MarkerLayerTest implements ItemizedLayer.OnItemGestureListener<MarkerItem> {
|
public class AtlasMarkerLayerTest extends MarkerLayerTest {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void createLayers() {
|
public void createLayers() {
|
||||||
BitmapTileLayer bitmapLayer = new BitmapTileLayer(mMap, DefaultSources.STAMEN_TONER.build());
|
|
||||||
bitmapLayer.tileRenderer().setBitmapAlpha(0.5f);
|
|
||||||
mMap.setBaseMap(bitmapLayer);
|
|
||||||
|
|
||||||
// Map events receiver
|
// Map events receiver
|
||||||
mMap.layers().add(new MapEventsReceiver(mMap));
|
mMap.layers().add(new MapEventsReceiver(mMap));
|
||||||
|
|
||||||
|
VectorTileLayer l = mMap.setBaseMap(new OSciMap4TileSource());
|
||||||
|
mMap.layers().add(new BuildingLayer(mMap, l));
|
||||||
|
mMap.layers().add(new LabelLayer(mMap, l));
|
||||||
|
mMap.setTheme(VtmThemes.DEFAULT);
|
||||||
|
|
||||||
mMap.setMapPosition(0, 0, 1 << 2);
|
mMap.setMapPosition(0, 0, 1 << 2);
|
||||||
|
|
||||||
Bitmap bitmapPoi = CanvasAdapter.decodeBitmap(getClass().getResourceAsStream("/res/marker_poi.png"));
|
Bitmap bitmapPoi = CanvasAdapter.decodeBitmap(getClass().getResourceAsStream("/res/marker_poi.png"));
|
||||||
@@ -74,17 +77,15 @@ public class AtlasMarkerLayerTest extends MarkerLayerTest implements ItemizedLay
|
|||||||
else
|
else
|
||||||
mFocusMarker = new MarkerSymbol(regionsMap.get("focus"), HotspotPlace.CENTER, false);
|
mFocusMarker = new MarkerSymbol(regionsMap.get("focus"), HotspotPlace.CENTER, false);
|
||||||
|
|
||||||
ItemizedLayer<MarkerItem> markerLayer = new ItemizedLayer<>(mMap, new ArrayList<MarkerItem>(), symbol, this);
|
mMarkerLayer = new ItemizedLayer<>(mMap, new ArrayList<MarkerItem>(), symbol, this);
|
||||||
mMap.layers().add(markerLayer);
|
mMap.layers().add(mMarkerLayer);
|
||||||
|
|
||||||
List<MarkerItem> pts = new ArrayList<>();
|
List<MarkerItem> 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)));
|
||||||
}
|
}
|
||||||
markerLayer.addItems(pts);
|
mMarkerLayer.addItems(pts);
|
||||||
|
|
||||||
mMap.layers().add(new TileGridLayer(mMap));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
|
|||||||
118
vtm-playground/src/org/oscim/test/AtlasMultiTextureTest.java
Normal file
@@ -0,0 +1,118 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2016-2017 devemux86
|
||||||
|
* Copyright 2017 Longri
|
||||||
|
*
|
||||||
|
* 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.test;
|
||||||
|
|
||||||
|
import org.oscim.backend.CanvasAdapter;
|
||||||
|
import org.oscim.backend.canvas.Bitmap;
|
||||||
|
import org.oscim.backend.canvas.Canvas;
|
||||||
|
import org.oscim.backend.canvas.Color;
|
||||||
|
import org.oscim.backend.canvas.Paint;
|
||||||
|
import org.oscim.core.GeoPoint;
|
||||||
|
import org.oscim.gdx.GdxMapApp;
|
||||||
|
import org.oscim.layers.marker.ItemizedLayer;
|
||||||
|
import org.oscim.layers.marker.MarkerItem;
|
||||||
|
import org.oscim.layers.marker.MarkerSymbol;
|
||||||
|
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.atlas.TextureAtlas;
|
||||||
|
import org.oscim.renderer.atlas.TextureRegion;
|
||||||
|
import org.oscim.theme.VtmThemes;
|
||||||
|
import org.oscim.tiling.source.oscimap4.OSciMap4TileSource;
|
||||||
|
import org.oscim.utils.TextureAtlasUtils;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.LinkedHashMap;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import static org.oscim.layers.marker.MarkerSymbol.HotspotPlace;
|
||||||
|
|
||||||
|
public class AtlasMultiTextureTest extends MarkerLayerTest {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void createLayers() {
|
||||||
|
// Map events receiver
|
||||||
|
mMap.layers().add(new MapEventsReceiver(mMap));
|
||||||
|
|
||||||
|
VectorTileLayer l = mMap.setBaseMap(new OSciMap4TileSource());
|
||||||
|
mMap.layers().add(new BuildingLayer(mMap, l));
|
||||||
|
mMap.layers().add(new LabelLayer(mMap, l));
|
||||||
|
mMap.setTheme(VtmThemes.DEFAULT);
|
||||||
|
|
||||||
|
mMap.setMapPosition(0, 0, 1 << 2);
|
||||||
|
|
||||||
|
// Create Atlas from Bitmaps
|
||||||
|
java.util.Map<Object, Bitmap> inputMap = new LinkedHashMap<>();
|
||||||
|
java.util.Map<Object, TextureRegion> regionsMap = new LinkedHashMap<>();
|
||||||
|
List<TextureAtlas> atlasList = new ArrayList<>();
|
||||||
|
|
||||||
|
Canvas canvas = CanvasAdapter.newCanvas();
|
||||||
|
Paint paint = CanvasAdapter.newPaint();
|
||||||
|
paint.setTypeface(Paint.FontFamily.DEFAULT, Paint.FontStyle.NORMAL);
|
||||||
|
paint.setTextSize(12);
|
||||||
|
paint.setStrokeWidth(2);
|
||||||
|
paint.setColor(Color.BLACK);
|
||||||
|
List<MarkerItem> pts = new ArrayList<>();
|
||||||
|
for (double lat = -90; lat <= 90; lat += 5) {
|
||||||
|
for (double lon = -180; lon <= 180; lon += 5) {
|
||||||
|
String title = lat + "/" + lon;
|
||||||
|
pts.add(new MarkerItem(title, "", new GeoPoint(lat, lon)));
|
||||||
|
|
||||||
|
Bitmap bmp = CanvasAdapter.newBitmap(40, 40, 0);
|
||||||
|
canvas.setBitmap(bmp);
|
||||||
|
canvas.fillColor(Color.GREEN);
|
||||||
|
|
||||||
|
canvas.drawText(Double.toString(lat), 3, 17, paint);
|
||||||
|
canvas.drawText(Double.toString(lon), 3, 35, paint);
|
||||||
|
inputMap.put(title, bmp);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Bitmaps will never used any more
|
||||||
|
// With iOS we must flip the Y-Axis
|
||||||
|
TextureAtlasUtils.createTextureRegions(inputMap, regionsMap, atlasList, true, false);
|
||||||
|
|
||||||
|
mMarkerLayer = new ItemizedLayer<>(mMap, new ArrayList<MarkerItem>(), (MarkerSymbol) null, this);
|
||||||
|
mMap.layers().add(mMarkerLayer);
|
||||||
|
|
||||||
|
mMarkerLayer.addItems(pts);
|
||||||
|
|
||||||
|
// set all markers
|
||||||
|
for (MarkerItem item : pts) {
|
||||||
|
MarkerSymbol markerSymbol = new MarkerSymbol(regionsMap.get(item.getTitle()), HotspotPlace.BOTTOM_CENTER);
|
||||||
|
item.setMarker(markerSymbol);
|
||||||
|
}
|
||||||
|
|
||||||
|
System.out.println("Atlas count: " + atlasList.size());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onItemSingleTapUp(int index, MarkerItem item) {
|
||||||
|
System.out.println("Marker tap " + item.getTitle());
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onItemLongPress(int index, MarkerItem item) {
|
||||||
|
System.out.println("Marker long press " + item.getTitle());
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
GdxMapApp.init();
|
||||||
|
GdxMapApp.run(new AtlasMultiTextureTest());
|
||||||
|
}
|
||||||
|
}
|
||||||
31
vtm-playground/src/org/oscim/test/AtlasThemeMapTest.java
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2017 Longri
|
||||||
|
* Copyright 2017 devemux86
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify it under the
|
||||||
|
* terms of the GNU Lesser General Public License as published by the Free Software
|
||||||
|
* Foundation, either version 3 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||||
|
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||||
|
* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public License along with
|
||||||
|
* this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
package org.oscim.test;
|
||||||
|
|
||||||
|
import org.oscim.gdx.GdxMapApp;
|
||||||
|
import org.oscim.theme.ThemeLoader;
|
||||||
|
|
||||||
|
public class AtlasThemeMapTest extends MapTest {
|
||||||
|
|
||||||
|
private AtlasThemeMapTest() {
|
||||||
|
ThemeLoader.USE_ATLAS = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
GdxMapApp.init();
|
||||||
|
GdxMapApp.run(new AtlasThemeMapTest());
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,86 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2016-2017 devemux86
|
||||||
|
* Copyright 2017 nebular
|
||||||
|
*
|
||||||
|
* 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.test;
|
||||||
|
|
||||||
|
import org.oscim.backend.CanvasAdapter;
|
||||||
|
import org.oscim.backend.canvas.Bitmap;
|
||||||
|
import org.oscim.backend.canvas.Color;
|
||||||
|
import org.oscim.core.GeoPoint;
|
||||||
|
import org.oscim.gdx.GdxMapApp;
|
||||||
|
import org.oscim.layers.marker.ClusterMarkerRenderer;
|
||||||
|
import org.oscim.layers.marker.ItemizedLayer;
|
||||||
|
import org.oscim.layers.marker.MarkerItem;
|
||||||
|
import org.oscim.layers.marker.MarkerSymbol;
|
||||||
|
import org.oscim.layers.tile.buildings.BuildingLayer;
|
||||||
|
import org.oscim.layers.tile.vector.VectorTileLayer;
|
||||||
|
import org.oscim.layers.tile.vector.labeling.LabelLayer;
|
||||||
|
import org.oscim.theme.VtmThemes;
|
||||||
|
import org.oscim.tiling.source.oscimap4.OSciMap4TileSource;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class ClusterMarkerLayerTest extends MarkerLayerTest {
|
||||||
|
|
||||||
|
private static final int COUNT = 5;
|
||||||
|
private static final float STEP = 100f / 110000f; // roughly 100 meters
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void createLayers() {
|
||||||
|
// Map events receiver
|
||||||
|
mMap.layers().add(new MapEventsReceiver(mMap));
|
||||||
|
|
||||||
|
VectorTileLayer l = mMap.setBaseMap(new OSciMap4TileSource());
|
||||||
|
mMap.layers().add(new BuildingLayer(mMap, l));
|
||||||
|
mMap.layers().add(new LabelLayer(mMap, l));
|
||||||
|
mMap.setTheme(VtmThemes.DEFAULT);
|
||||||
|
|
||||||
|
mMap.setMapPosition(53.08, 8.83, 1 << 15);
|
||||||
|
|
||||||
|
Bitmap bitmapPoi = CanvasAdapter.decodeBitmap(getClass().getResourceAsStream("/res/marker_poi.png"));
|
||||||
|
MarkerSymbol symbol;
|
||||||
|
if (BILLBOARDS)
|
||||||
|
symbol = new MarkerSymbol(bitmapPoi, MarkerSymbol.HotspotPlace.BOTTOM_CENTER);
|
||||||
|
else
|
||||||
|
symbol = new MarkerSymbol(bitmapPoi, MarkerSymbol.HotspotPlace.CENTER, false);
|
||||||
|
|
||||||
|
mMarkerLayer = new ItemizedLayer<>(
|
||||||
|
mMap,
|
||||||
|
new ArrayList<MarkerItem>(),
|
||||||
|
ClusterMarkerRenderer.factory(symbol, new ClusterMarkerRenderer.ClusterStyle(Color.WHITE, Color.BLUE)),
|
||||||
|
this);
|
||||||
|
mMap.layers().add(mMarkerLayer);
|
||||||
|
|
||||||
|
// Create some markers spaced STEP degrees
|
||||||
|
List<MarkerItem> pts = new ArrayList<>();
|
||||||
|
GeoPoint center = mMap.getMapPosition().getGeoPoint();
|
||||||
|
for (int x = -COUNT; x < COUNT; x++) {
|
||||||
|
for (int y = -COUNT; y < COUNT; y++) {
|
||||||
|
double random = STEP * Math.random() * 2;
|
||||||
|
MarkerItem item = new MarkerItem(y + ", " + x, "",
|
||||||
|
new GeoPoint(center.getLatitude() + y * STEP + random, center.getLongitude() + x * STEP + random)
|
||||||
|
);
|
||||||
|
pts.add(item);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
mMarkerLayer.addItems(pts);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
GdxMapApp.init();
|
||||||
|
GdxMapApp.run(new ClusterMarkerLayerTest());
|
||||||
|
}
|
||||||
|
}
|
||||||