Compare commits
282 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 | ||
|
|
b3e2385ba5 | ||
|
|
03821e1f51 | ||
|
|
77dc06d650 | ||
|
|
0cd6c48b16 | ||
|
|
8a595fd37f | ||
|
|
967875d6b8 | ||
|
|
d60e2ef575 | ||
|
|
58ecf60d9d | ||
|
|
17356e5a2b | ||
|
|
296fdd3c13 | ||
|
|
735acc520a | ||
|
|
ac115b1f0f | ||
|
|
d2ba6647ea | ||
|
|
0180c40855 | ||
|
|
817bd13d7b | ||
|
|
d22dc79655 | ||
|
|
fc9ef062c0 | ||
|
|
f2dda7c8eb | ||
|
|
fdc793d9ec | ||
|
|
3d24aade21 | ||
|
|
6d93aaf57f | ||
|
|
8fc354c96a | ||
|
|
e30f3f7cc3 | ||
|
|
aff2c77267 | ||
|
|
33365b3f7d | ||
|
|
33fdc938fa | ||
|
|
8397d5a3be | ||
|
|
980e9d5e54 | ||
|
|
bc7c55b1f8 | ||
|
|
120182ec15 | ||
|
|
945b84f04f | ||
|
|
f67c457006 | ||
|
|
a2852b0761 | ||
|
|
ebf5d408bc | ||
|
|
75719eae29 | ||
|
|
5c825ea9eb | ||
|
|
15bc23cadf | ||
|
|
88f3283878 | ||
|
|
80848f9d2d | ||
|
|
f1f5726457 | ||
|
|
2ccf3e4c64 | ||
|
|
c8cbf8e0ce | ||
|
|
6544cc1081 | ||
|
|
4c72831336 | ||
|
|
06ac5142f7 | ||
|
|
feae45f78b | ||
|
|
61b8233b97 | ||
|
|
7acbea88cc | ||
|
|
19109516ae | ||
|
|
c1a5ad7e74 | ||
|
|
1a93e4ae13 | ||
|
|
1de6ca8fb7 | ||
|
|
02db7ca08d | ||
|
|
e9bb7aaae4 | ||
|
|
989e9c2ae8 | ||
|
|
e8f41cd339 | ||
|
|
eabd90d14c | ||
|
|
3e4aad4d51 | ||
|
|
b6dc72bbb6 | ||
|
|
4cd11462da | ||
|
|
6344542b10 | ||
|
|
e0031ae8aa | ||
|
|
229ea0b350 | ||
|
|
0a5d08a908 | ||
|
|
aed54c9a49 | ||
|
|
1a3bf4e4fe | ||
|
|
591ae03667 | ||
|
|
3a191fb513 | ||
|
|
2821d8ddb8 | ||
|
|
71d7b71035 | ||
|
|
85858911fa | ||
|
|
0a92c84668 | ||
|
|
c21d7b4390 | ||
|
|
38a9c71bc2 | ||
|
|
2573e458d5 | ||
|
|
25a9891133 | ||
|
|
8ee4e5fb8c | ||
|
|
a38b054228 | ||
|
|
d9bf94da99 | ||
|
|
77653096f9 | ||
|
|
5f534656ea | ||
|
|
ba93445259 | ||
|
|
71f7c45b21 | ||
|
|
ca5e34e1fb | ||
|
|
d937f3516c | ||
|
|
a8909fca08 | ||
|
|
b39feae045 | ||
|
|
9f4ef47b95 | ||
|
|
25e79bac55 | ||
|
|
311f4c7929 | ||
|
|
557e1858a7 | ||
|
|
16fa42d462 | ||
|
|
1133edb83d | ||
|
|
f6dbeba3d8 | ||
|
|
bf8f0745a6 | ||
|
|
829e45224f | ||
|
|
acde5d565d | ||
|
|
f0a652faf3 | ||
|
|
41867344e2 | ||
|
|
0c39ff8be0 | ||
|
|
6f78f08a04 | ||
|
|
3388e1401f | ||
|
|
308497ffa6 | ||
|
|
bfa5a095f0 | ||
|
|
96be36edb8 | ||
|
|
7c9c3732fb | ||
|
|
add62c9fe8 | ||
|
|
4aaa1ce620 | ||
|
|
aa63b49e5a | ||
|
|
1f1d91202c | ||
|
|
51eae28926 | ||
|
|
58b5f2741b | ||
|
|
d82faad435 | ||
|
|
fc8223bfc8 | ||
|
|
3584c4be1e | ||
|
|
001dbe8447 | ||
|
|
54feb7a25e | ||
|
|
ea2a94f76b | ||
|
|
b6bfbc612a | ||
|
|
1d545fd804 | ||
|
|
3acf77c102 | ||
|
|
6dfe2df2fb | ||
|
|
6cb40e1c15 | ||
|
|
afd03809e8 | ||
|
|
efa3cb0231 | ||
|
|
a709bd2623 | ||
|
|
439f2b20ff | ||
|
|
877d217f31 | ||
|
|
885264ad8c | ||
|
|
e224a7cf5b | ||
|
|
e10a223ea6 | ||
|
|
f85453e60c | ||
|
|
a6b3d7b0c2 | ||
|
|
dc15ba5f34 | ||
|
|
1d7afaf8de | ||
|
|
422d81d665 | ||
|
|
4b55043dcc | ||
|
|
7885529fff | ||
|
|
2c610f5e0b | ||
|
|
64a586dde8 | ||
|
|
c1f65144df | ||
|
|
ad2ee3f40e | ||
|
|
01365686fa | ||
|
|
dece13ddc9 | ||
|
|
05e9e0cdc8 | ||
|
|
a9283dd408 | ||
|
|
53ca77d18a | ||
|
|
97654f0670 | ||
|
|
cbd0ac01df | ||
|
|
ca841f5181 | ||
|
|
a322768f8a | ||
|
|
fc7bb2df9b | ||
|
|
062bb8d573 | ||
|
|
ccdea3b663 | ||
|
|
985bbc3f36 | ||
|
|
aa5fc79681 | ||
|
|
58095f31a4 | ||
|
|
e53523b82a | ||
|
|
e5c62c9bc4 | ||
|
|
3c1091d8e0 |
@@ -6,8 +6,8 @@ android:
|
||||
components:
|
||||
- platform-tools
|
||||
- tools
|
||||
- build-tools-24.0.3
|
||||
- android-24
|
||||
- build-tools-26.0.0
|
||||
- android-26
|
||||
- extra-android-m2repository
|
||||
env:
|
||||
global:
|
||||
|
||||
63
README.md
@@ -1,60 +1,73 @@
|
||||
[](http://search.maven.org/#search%7Cga%7C1%7Cg%3A%22org.mapsforge%22)
|
||||
[](https://travis-ci.org/mapsforge/vtm)
|
||||
[](COPYING.LESSER)
|
||||
[](https://maven-badges.herokuapp.com/maven-central/org.mapsforge/vtm)
|
||||
[](http://www.gnu.org/licenses/lgpl-3.0)
|
||||
|
||||
# V™
|
||||
|
||||
VTM was developed within the [OpenScienceMap](http://opensciencemap.org) project.
|
||||
VTM was developed within the [OpenScienceMap](https://github.com/opensciencemap) project.
|
||||
|
||||
**This fork continues VTM development. And provides compatibility with latest [Mapsforge](https://github.com/mapsforge/mapsforge).**
|
||||
|
||||
If you have any questions or problems, don't hesitate to ask our public [mailing list](https://groups.google.com/group/mapsforge-dev) for help.
|
||||
See the **[integration guide](docs/Integration.md)** and [changelog](docs/Changelog.md). And read through [how to contribute](.github/CONTRIBUTING.md) guidelines.
|
||||
|
||||
See the [integration guide](docs/Integration.md) and [changelog](docs/Changelog.md). And read through [how to contribute](.github/CONTRIBUTING.md) guidelines.
|
||||
If you have any questions or problems, don't hesitate to ask our public [mailing list](https://groups.google.com/group/mapsforge-dev) for help.
|
||||
|
||||
## Features
|
||||
- Java map library
|
||||
- OpenGL vector-tile rendering
|
||||
- Themeable vector layers
|
||||
- Support for multiple tile sources:
|
||||
- primary opensciencemap (.vtm)
|
||||
- mapsforge files
|
||||
- GeoJSON tiles
|
||||
- bitmap: any quadtree-scheme tiles as texture
|
||||
- OpenScienceMap vector tiles
|
||||
- Mapsforge vector maps
|
||||
- Mapbox vector tiles
|
||||
- GeoJSON vector tiles
|
||||
- Raster tiles: any quadtree-scheme tiles as texture
|
||||
- Backends:
|
||||
- Android (optional libGDX)
|
||||
- Android
|
||||
- iOS (using libGDX/RoboVM, [instructions](docs/ios.md))
|
||||
- Desktop (using libGDX/LWJGL)
|
||||
- HTML5/WebGL (using libGDX/GWT)
|
||||
- HTML5/WebGL (using libGDX/GWT, [instructions](docs/web.md))
|
||||
|
||||
### Projects
|
||||
- **vtm** contains the core library
|
||||
- **vtm-android** Android backend (no libGDX required)
|
||||
- **vtm-android-example** provides examples using **vtm-android**
|
||||
- **vtm-android** Android backend
|
||||
- **vtm-android-example** provides examples using vtm-android
|
||||
- **vtm-gdx** common libGDX backend
|
||||
- **vtm-android-gdx** Android backend (with libGDX)
|
||||
- **vtm-desktop** Desktop backend
|
||||
- **vtm-ios** iOS backend
|
||||
- **vtm-ios-example** provides examples using vtm-ios
|
||||
- **vtm-web** HTML5/GWT backend
|
||||
- **vtm-web-app** HTML5/GWT application
|
||||
|
||||
The libGDX backend for GWT is experimental.
|
||||
|
||||
## Applications
|
||||
- VTM is used by many [applications](docs/Applications.md).
|
||||
|
||||
## WebGL Demo
|
||||
[OpenScienceMap](http://opensciencemap.org/s3db/#scale=17,rot=61,tilt=51,lat=53.075,lon=8.807) view of Bremen.
|
||||
- Hold right mouse button to change view direction.
|
||||
|
||||
## Applications
|
||||
- VTM is used by many [applications](docs/Applications.md).
|
||||
|
||||
## Maps
|
||||
- Mapsforge [map providers](docs/Mapsforge-Maps.md).
|
||||
|
||||
## Credits
|
||||
This library contains code from several projects:
|
||||
- **Android**: some Matrix code, TimSort (http://source.android.com)
|
||||
- **libGDX**: AsyncTask, MathUtils and Interpolation classes (https://github.com/libgdx)
|
||||
- **mapsforge**: based on 0.2.4 (https://github.com/mapsforge/mapsforge)
|
||||
- **osmdroid**: some overlay classes (https://github.com/osmdroid/osmdroid)
|
||||
- **tessellate**: (https://github.com/cscheid/tessellate)
|
||||
- **Android** (Apache 2.0): some Matrix code, TimSort (http://source.android.com)
|
||||
- **libGDX** (Apache 2.0): AsyncTask, MathUtils, Interpolation, PixmapPacker (https://github.com/libgdx)
|
||||
- **mapsforge** (LGPL3): based on 0.2.4 (https://github.com/mapsforge/mapsforge)
|
||||
- **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)
|
||||
|
||||
## Screenshots
|
||||

|
||||

|
||||
|
||||
### Android
|
||||

|
||||
|
||||
### iOS
|
||||

|
||||
|
||||
### Desktop
|
||||

|
||||
|
||||
### Browser
|
||||

|
||||
|
||||
13
build.gradle
@@ -3,8 +3,8 @@ buildscript {
|
||||
jcenter()
|
||||
}
|
||||
dependencies {
|
||||
classpath 'com.android.tools.build:gradle:2.2.0'
|
||||
classpath 'com.github.dcendents:android-maven-gradle-plugin:1.4.1'
|
||||
classpath 'com.android.tools.build:gradle:2.3.3'
|
||||
classpath 'com.github.dcendents:android-maven-gradle-plugin:1.5'
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,8 +13,10 @@ allprojects {
|
||||
version = 'master-SNAPSHOT'
|
||||
ext.isReleaseVersion = !version.endsWith("SNAPSHOT")
|
||||
|
||||
ext.androidBuildVersionTools = "24.0.3"
|
||||
ext.gdxVersion = "1.9.4"
|
||||
ext.androidBuildVersionTools = "26.0.0"
|
||||
ext.gdxVersion = "1.9.6"
|
||||
ext.gwtVersion = "2.8.0"
|
||||
ext.slf4jVersion = "1.7.25"
|
||||
|
||||
if (JavaVersion.current().isJava8Compatible()) {
|
||||
tasks.withType(Javadoc) {
|
||||
@@ -25,7 +27,7 @@ allprojects {
|
||||
}
|
||||
}
|
||||
|
||||
def androidCompileSdk() { return 24 }
|
||||
def androidCompileSdk() { return 26 }
|
||||
|
||||
def androidMinSdk() { return 10 }
|
||||
|
||||
@@ -37,7 +39,6 @@ def versionName() { return version }
|
||||
|
||||
subprojects {
|
||||
repositories {
|
||||
maven { url 'https://repo.boundlessgeo.com/main' }
|
||||
jcenter()
|
||||
}
|
||||
|
||||
|
||||
@@ -1,8 +1,17 @@
|
||||
# Applications using VTM software (in lexical order)
|
||||
|
||||
|**Name**|**Type**|**License/Cost**|**Sources**|
|
||||
|--------|--------|----------------|-----------|
|
||||
| [Cachebox 3.0](https://github.com/Longri/cachebox3.0) | Android / Desktop / iOS geocaching application | GPL/Free | Open |
|
||||
| [Cruiser](http://wiki.openstreetmap.org/wiki/Cruiser) | Android / Desktop map and navigation application | Proprietary/Free | Closed |
|
||||
|**Name**|**Type**|**License/Cost**|**Platforms**|**Sources**|
|
||||
|--------|--------|----------------|-------------|-----------|
|
||||
| [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 |
|
||||
| [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 |
|
||||
| [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).
|
||||
|
||||
@@ -1,10 +1,55 @@
|
||||
# Changelog
|
||||
|
||||
## Version 0.6.X
|
||||
## Version 0.8.0 (2017-07-19)
|
||||
|
||||
**Version 0.6.0-rc1 (2016-10-08)**
|
||||
- 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)
|
||||
|
||||
**Revive of VTM vector map library**
|
||||
## Version 0.7.0 (2017-02-26)
|
||||
|
||||
- Mapsforge multiple map files [#208](https://github.com/mapsforge/vtm/issues/208)
|
||||
- Improved gestures implementation [#253](https://github.com/mapsforge/vtm/issues/253)
|
||||
- Polygon label position enhancements [#80](https://github.com/mapsforge/vtm/issues/80)
|
||||
- vtm-web modules update [#51](https://github.com/mapsforge/vtm/issues/51)
|
||||
- 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)
|
||||
- Circle map style [#122](https://github.com/mapsforge/vtm/issues/122)
|
||||
- Oneway arrows in themes [#275](https://github.com/mapsforge/vtm/issues/275)
|
||||
- Texture atlas from bitmaps [#283](https://github.com/mapsforge/vtm/pull/283)
|
||||
- PathLayer (vtm) fix disappearing segments [#108](https://github.com/mapsforge/vtm/issues/108)
|
||||
- House numbers (nodes) fix visibility [#168](https://github.com/mapsforge/vtm/issues/168)
|
||||
- Android fix quick scale vs long press [#250](https://github.com/mapsforge/vtm/issues/250)
|
||||
- Use baseline 160dpi in scaling [#236](https://github.com/mapsforge/vtm/issues/236)
|
||||
- OkHttp3 update [#138](https://github.com/mapsforge/vtm/issues/138)
|
||||
- libGDX double tap zoom [#263](https://github.com/mapsforge/vtm/issues/263)
|
||||
- MapFileTileSource zoom level API enhancements [#219](https://github.com/mapsforge/vtm/issues/219)
|
||||
- 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)
|
||||
- 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)
|
||||
- Many other minor improvements and bug fixes
|
||||
- [Solved issues](https://github.com/mapsforge/vtm/issues?q=is%3Aclosed+milestone%3A0.7.0)
|
||||
|
||||
## Version 0.6.0 (2016-10-28) - VTM revive
|
||||
|
||||
- Render theme SVG resources [#60](https://github.com/mapsforge/vtm/issues/60)
|
||||
- Mapsforge multilingual maps [#34](https://github.com/mapsforge/vtm/issues/34)
|
||||
@@ -13,7 +58,7 @@
|
||||
- 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)
|
||||
- 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)
|
||||
- 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)
|
||||
@@ -25,5 +70,6 @@
|
||||
- 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)
|
||||
- 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
|
||||
- [Solved issues](https://github.com/mapsforge/vtm/issues?q=is%3Aissue+is%3Aclosed+milestone%3A0.6.0)
|
||||
- [Solved issues](https://github.com/mapsforge/vtm/issues?q=is%3Aclosed+milestone%3A0.6.0)
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
# Integration guide
|
||||
|
||||
This article describes how to integrate the library in your project.
|
||||
This article describes how to integrate the library in your project, with Gradle / Maven / Jars or SNAPSHOT builds.
|
||||
|
||||
Current version is [](https://maven-badges.herokuapp.com/maven-central/org.mapsforge/vtm)
|
||||
Current version is [](http://search.maven.org/#search%7Cga%7C1%7Cg%3A%22org.mapsforge%22)
|
||||
|
||||
## Gradle
|
||||
|
||||
@@ -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-v7a'
|
||||
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'
|
||||
```
|
||||
|
||||
@@ -33,19 +57,19 @@ compile 'org.mapsforge:vtm-desktop:[CURRENT-VERSION]'
|
||||
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-windows'
|
||||
compile 'com.badlogicgames.gdx:gdx:1.9.4'
|
||||
compile 'com.badlogicgames.gdx:gdx-platform:1.9.4:natives-desktop'
|
||||
compile 'com.badlogicgames.gdx:gdx-backend-lwjgl:1.9.4'
|
||||
compile 'com.badlogicgames.gdx:gdx:1.9.6'
|
||||
compile 'com.badlogicgames.gdx:gdx-platform:1.9.6:natives-desktop'
|
||||
compile 'com.badlogicgames.gdx:gdx-backend-lwjgl:1.9.6'
|
||||
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-osx'
|
||||
compile 'org.lwjgl.lwjgl:lwjgl-platform:2.9.3:natives-windows'
|
||||
compile 'com.kitfox.svg:svg-salamander:1.0'
|
||||
compile 'com.metsci.ext.com.kitfox.svg:svg-salamander:0.1.19'
|
||||
```
|
||||
|
||||
## 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:
|
||||
```groovy
|
||||
@@ -60,6 +84,13 @@ compile 'org.mapsforge:vtm:master-SNAPSHOT'
|
||||
...
|
||||
```
|
||||
|
||||
For checking latest snapshot on every build:
|
||||
```groovy
|
||||
configurations.all {
|
||||
resolutionStrategy.cacheChangingModulesFor 0, 'seconds'
|
||||
}
|
||||
```
|
||||
|
||||
## Maven
|
||||
|
||||
The dependencies for Maven are declared in a similar way. For example:
|
||||
@@ -74,6 +105,6 @@ The dependencies for Maven are declared in a similar way. For example:
|
||||
|
||||
## Jars
|
||||
|
||||
You can find jars (regular and with dependencies) in Maven Central or Snapshots repositories.
|
||||
You can find release and snapshot jars (regular and with dependencies) in [Maven Central](http://search.maven.org/#search%7Cga%7C1%7Cg%3A%22org.mapsforge%22) and [Sonatype OSS Repository Hosting](https://oss.sonatype.org/content/repositories/snapshots/org/mapsforge/).
|
||||
|
||||
Third party jars can be found at their respective sites or in Maven Central repository.
|
||||
|
||||
10
docs/Mapsforge-Maps.md
Normal file
@@ -0,0 +1,10 @@
|
||||
# Mapsforge map providers (in lexical order)
|
||||
|
||||
- [AndroidMaps](http://www.androidmaps.co.uk/)
|
||||
- [Freizeitkarte](http://www.freizeitkarte-osm.de/android/en/index.html)
|
||||
- [Locusvectormaps](http://www.locusvectormaps.com)
|
||||
- [Mapsforge](http://download.mapsforge.org/)
|
||||
- [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).
|
||||
BIN
docs/images/android.png
Normal file
|
After Width: | Height: | Size: 717 KiB |
BIN
docs/images/browser.png
Normal file
|
After Width: | Height: | Size: 791 KiB |
BIN
docs/images/desktop.png
Normal file
|
After Width: | Height: | Size: 580 KiB |
BIN
docs/images/ios.png
Normal file
|
After Width: | Height: | Size: 450 KiB |
|
Before Width: | Height: | Size: 827 KiB |
|
Before Width: | Height: | Size: 1.1 MiB |
7
docs/web.md
Normal file
@@ -0,0 +1,7 @@
|
||||
### Web implementation
|
||||
|
||||
`./gradlew :vtm-web-app:farmRun` will run standalone web server at port 8080.
|
||||
|
||||
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.
|
||||
@@ -9,7 +9,7 @@
|
||||
|
||||
# Specifies the JVM arguments used for the daemon process.
|
||||
# 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.
|
||||
# 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
|
||||
distributionPath=wrapper/dists
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
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
|
||||
|
||||
@@ -69,7 +69,7 @@
|
||||
|
||||
<xs:simpleType name="src">
|
||||
<xs:restriction base="xs:string">
|
||||
<xs:pattern value="(file|assets):.+" />
|
||||
<xs:pattern value="((file|assets):)?.+" />
|
||||
</xs:restriction>
|
||||
</xs:simpleType>
|
||||
|
||||
@@ -84,6 +84,7 @@
|
||||
<xs:restriction base="xs:string">
|
||||
<xs:enumeration value="ele" />
|
||||
<xs:enumeration value="addr:housenumber" />
|
||||
<xs:enumeration value="addr_housenumber" /> <!-- Mapzen -->
|
||||
<xs:enumeration value="name" />
|
||||
<xs:enumeration value="ref" />
|
||||
</xs:restriction>
|
||||
@@ -124,6 +125,9 @@
|
||||
<xs:attribute name="id" default="0" type="xs:string" use="optional" />
|
||||
<xs:attribute name="use" default="0" type="xs:string" use="optional" />
|
||||
<xs:attribute name="src" type="tns:src" use="optional" />
|
||||
<xs:attribute name="symbol-width" type="xs:positiveInteger" use="optional" />
|
||||
<xs:attribute name="symbol-height" type="xs:positiveInteger" use="optional" />
|
||||
<xs:attribute name="symbol-percent" type="xs:positiveInteger" use="optional" />
|
||||
<xs:attribute name="fill" default="#000000" type="tns:color" use="optional" />
|
||||
<xs:attribute name="stroke" default="#00000000" type="tns:color" use="optional" />
|
||||
<xs:attribute name="stroke-width" default="0" type="tns:nonNegativeFloat" use="optional" />
|
||||
@@ -143,11 +147,15 @@
|
||||
<xs:attribute name="fill" default="#000000" type="tns:color" use="optional" />
|
||||
<xs:attribute name="stroke" default="#000000" type="tns:color" use="optional" />
|
||||
<xs:attribute name="stroke-width" default="0" type="tns:nonNegativeFloat" use="optional" />
|
||||
<!-- polygon area expressed as a ratio to tile area, e.g. 0.1 for 10% of tile area -->
|
||||
<xs:attribute name="area-size" default="0" type="tns:nonNegativeFloat" use="optional" />
|
||||
<!-- priority for label placement, 0 = highest priority -->
|
||||
<xs:attribute name="priority" default="0" type="xs:integer" use="optional" />
|
||||
|
||||
<!-- symbol src name in atlas -->
|
||||
<!-- symbol src name -->
|
||||
<xs:attribute name="symbol" type="tns:src" use="optional" />
|
||||
<xs:attribute name="symbol-width" type="xs:positiveInteger" use="optional" />
|
||||
<xs:attribute name="symbol-height" type="xs:positiveInteger" use="optional" />
|
||||
<xs:attribute name="symbol-percent" type="xs:positiveInteger" use="optional" />
|
||||
</xs:complexType>
|
||||
|
||||
<xs:complexType name="circle">
|
||||
@@ -169,6 +177,9 @@
|
||||
<xs:attribute name="use" default="0" type="xs:string" use="optional" />
|
||||
|
||||
<xs:attribute name="src" type="tns:src" use="optional" />
|
||||
<xs:attribute name="symbol-width" type="xs:positiveInteger" use="optional" />
|
||||
<xs:attribute name="symbol-height" type="xs:positiveInteger" use="optional" />
|
||||
<xs:attribute name="symbol-percent" type="xs:positiveInteger" use="optional" />
|
||||
<xs:attribute name="stroke" default="#000000" type="tns:color" use="optional" />
|
||||
<xs:attribute name="width" default="0" type="xs:float" use="optional" />
|
||||
<!-- minimum scaled width to draw outline -->
|
||||
@@ -193,6 +204,9 @@
|
||||
<xs:attribute name="cat" type="xs:string" use="optional" />
|
||||
<xs:attribute name="name" default="0" type="xs:string" use="optional" />
|
||||
<xs:attribute name="src" type="tns:src" use="optional" />
|
||||
<xs:attribute name="symbol-width" type="xs:positiveInteger" use="optional" />
|
||||
<xs:attribute name="symbol-height" type="xs:positiveInteger" use="optional" />
|
||||
<xs:attribute name="symbol-percent" type="xs:positiveInteger" use="optional" />
|
||||
<xs:attribute name="stroke" default="#000000" type="tns:color" use="optional" />
|
||||
<xs:attribute name="stroke-width" default="0" type="tns:nonNegativeFloat" use="optional" />
|
||||
</xs:complexType>-->
|
||||
@@ -200,6 +214,9 @@
|
||||
<xs:complexType name="lineSymbol">
|
||||
<xs:attribute name="cat" type="xs:string" use="optional" />
|
||||
<xs:attribute name="src" type="tns:src" use="required" />
|
||||
<xs:attribute name="symbol-width" type="xs:positiveInteger" use="optional" />
|
||||
<xs:attribute name="symbol-height" type="xs:positiveInteger" use="optional" />
|
||||
<xs:attribute name="symbol-percent" type="xs:positiveInteger" use="optional" />
|
||||
<xs:attribute name="align-center" default="false" type="xs:boolean" use="optional" />
|
||||
<xs:attribute name="repeat" default="false" type="xs:boolean" use="optional" />
|
||||
</xs:complexType>
|
||||
@@ -219,6 +236,8 @@
|
||||
<xs:attribute name="stroke" default="#000000" type="tns:color" use="optional" />
|
||||
<xs:attribute name="stroke-width" default="0" type="tns:nonNegativeFloat" use="optional" />
|
||||
<xs:attribute name="caption" default="false" type="xs:boolean" use="optional" />
|
||||
<!-- polygon area expressed as a ratio to tile area, e.g. 0.1 for 10% of tile area -->
|
||||
<xs:attribute name="area-size" default="0" type="tns:nonNegativeFloat" use="optional" />
|
||||
<!-- priority for label placement, 0 = highest priority -->
|
||||
<xs:attribute name="priority" default="0" type="xs:integer" use="optional" />
|
||||
</xs:complexType>
|
||||
@@ -226,6 +245,9 @@
|
||||
<xs:complexType name="symbol">
|
||||
<xs:attribute name="cat" type="xs:string" use="optional" />
|
||||
<xs:attribute name="src" type="tns:src" use="required" />
|
||||
<xs:attribute name="symbol-width" type="xs:positiveInteger" use="optional" />
|
||||
<xs:attribute name="symbol-height" type="xs:positiveInteger" use="optional" />
|
||||
<xs:attribute name="symbol-percent" type="xs:positiveInteger" use="optional" />
|
||||
</xs:complexType>
|
||||
|
||||
<xs:complexType name="extrusion">
|
||||
|
||||
@@ -1,19 +1,21 @@
|
||||
rootProject.name = 'vtm-parent'
|
||||
include ':vtm'
|
||||
include ':vtm-http'
|
||||
include ':vtm-jts'
|
||||
include ':vtm-tests'
|
||||
include ':vtm-extras'
|
||||
include ':vtm-android'
|
||||
include ':vtm-android-example'
|
||||
include ':vtm-themes'
|
||||
include ':vtm-gdx'
|
||||
include ':vtm-desktop'
|
||||
include ':vtm-android-gdx'
|
||||
//include ':vtm-web'
|
||||
//include ':vtm-web-app'
|
||||
//include ':vtm-web-js'
|
||||
include ':vtm-jeo'
|
||||
include ':vtm-playground'
|
||||
include ':vtm-ios'
|
||||
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-app'
|
||||
//include ':vtm-web-js'
|
||||
|
||||
@@ -26,24 +26,54 @@
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
<activity
|
||||
android:name=".AtlasMarkerOverlayActivity"
|
||||
android:configChanges="keyboardHidden|orientation|screenSize" />
|
||||
<activity
|
||||
android:name=".AtlasMultiTextureActivity"
|
||||
android:configChanges="keyboardHidden|orientation|screenSize" />
|
||||
<activity
|
||||
android:name=".AtlasThemeActivity"
|
||||
android:configChanges="keyboardHidden|orientation|screenSize" />
|
||||
<activity
|
||||
android:name=".BitmapTileMapActivity"
|
||||
android:configChanges="keyboardHidden|orientation|screenSize" />
|
||||
<activity
|
||||
android:name=".JeoIndoorMapActivity"
|
||||
android:name=".ClusterMarkerOverlayActivity"
|
||||
android:configChanges="keyboardHidden|orientation|screenSize" />
|
||||
<!--<activity
|
||||
android:name=".JeoIndoorMapActivity"
|
||||
android:configChanges="keyboardHidden|orientation|screenSize" />-->
|
||||
<activity
|
||||
android:name=".LayerGroupActivity"
|
||||
android:configChanges="keyboardHidden|orientation|screenSize" />
|
||||
<activity
|
||||
android:name=".LineTexActivity"
|
||||
android:configChanges="keyboardHidden|orientation|screenSize" />
|
||||
<activity
|
||||
android:name=".LocationActivity"
|
||||
android:configChanges="keyboardHidden|orientation|screenSize" />
|
||||
<activity
|
||||
android:name=".MapFragmentActivity"
|
||||
android:configChanges="keyboardHidden|orientation|screenSize" />
|
||||
<activity
|
||||
android:name=".MapPositionActivity"
|
||||
android:configChanges="keyboardHidden|orientation|screenSize" />
|
||||
<activity
|
||||
android:name=".MapsforgeMapActivity"
|
||||
android:configChanges="keyboardHidden|orientation|screenSize" />
|
||||
<activity
|
||||
android:name=".MapsforgeMapActivity$MapFilePicker"
|
||||
android:configChanges="keyboardHidden|orientation|screenSize" />
|
||||
<activity
|
||||
android:name=".MapsforgeStyleActivity"
|
||||
android:configChanges="keyboardHidden|orientation|screenSize" />
|
||||
<activity
|
||||
android:name=".MapzenGeojsonMapActivity"
|
||||
android:configChanges="keyboardHidden|orientation|screenSize" />
|
||||
<activity
|
||||
android:name=".MapzenMvtMapActivity"
|
||||
android:configChanges="keyboardHidden|orientation|screenSize" />
|
||||
<activity
|
||||
android:name=".MarkerOverlayActivity"
|
||||
android:configChanges="keyboardHidden|orientation|screenSize" />
|
||||
@@ -51,11 +81,17 @@
|
||||
android:name=".MultiMapActivity"
|
||||
android:configChanges="keyboardHidden|orientation|screenSize" />
|
||||
<activity
|
||||
android:name=".OsmJsonMapActivity"
|
||||
android:name=".NewGesturesActivity"
|
||||
android:configChanges="keyboardHidden|orientation|screenSize" />
|
||||
<activity
|
||||
android:name=".PathOverlayActivity"
|
||||
android:configChanges="keyboardHidden|orientation|screenSize" />
|
||||
<activity
|
||||
android:name=".POTTextureActivity"
|
||||
android:configChanges="keyboardHidden|orientation|screenSize" />
|
||||
<activity
|
||||
android:name=".RotateMarkerOverlayActivity"
|
||||
android:configChanges="keyboardHidden|orientation|screenSize" />
|
||||
<activity
|
||||
android:name=".S3DBMapActivity"
|
||||
android:configChanges="keyboardHidden|orientation|screenSize" />
|
||||
|
||||
50
vtm-android-example/assets/vtm/stylemenu.xml
Normal file
@@ -0,0 +1,50 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<rendertheme xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" map-background="#fffcfa"
|
||||
version="1" xmlns="http://opensciencemap.org/rendertheme"
|
||||
xsi:schemaLocation="http://opensciencemap.org/rendertheme https://raw.githubusercontent.com/mapsforge/vtm/master/resources/rendertheme.xsd">
|
||||
|
||||
<stylemenu defaultlang="en" defaultvalue="1" id="menu">
|
||||
<layer enabled="true" id="nature">
|
||||
<name lang="de" value="Natur" />
|
||||
<name lang="en" value="Nature" />
|
||||
<name lang="es" value="Naturaleza" />
|
||||
<name lang="fr" value="Nature" />
|
||||
<cat id="nature" />
|
||||
</layer>
|
||||
|
||||
<layer id="base">
|
||||
<cat id="sea" />
|
||||
<cat id="land" />
|
||||
</layer>
|
||||
|
||||
<!-- Show nature layers (enabled by default) -->
|
||||
<layer id="1" parent="base" visible="true">
|
||||
<name lang="de" value="1" />
|
||||
<name lang="en" value="1" />
|
||||
<name lang="es" value="1" />
|
||||
<name lang="fr" value="1" />
|
||||
<overlay id="nature" />
|
||||
</layer>
|
||||
|
||||
<!-- Don't show nature layers -->
|
||||
<layer id="2" parent="base" visible="true">
|
||||
<name lang="de" value="2" />
|
||||
<name lang="en" value="2" />
|
||||
<name lang="es" value="2" />
|
||||
<name lang="fr" value="2" />
|
||||
</layer>
|
||||
</stylemenu>
|
||||
|
||||
<m cat="sea" e="way" k="natural" v="issea|sea">
|
||||
<area fill="#b5d6f1" mesh="true" />
|
||||
</m>
|
||||
|
||||
<m cat="land" e="way" k="natural" v="nosea">
|
||||
<area fill="#f8f8f8" mesh="true" />
|
||||
</m>
|
||||
|
||||
<m cat="nature" e="way" k="natural|landuse" v="forest|wood">
|
||||
<area fill="#83aa5b" />
|
||||
</m>
|
||||
|
||||
</rendertheme>
|
||||
@@ -3,10 +3,15 @@ apply plugin: 'com.android.application'
|
||||
dependencies {
|
||||
compile project(':vtm-android')
|
||||
compile project(':vtm-extras')
|
||||
compile project(':vtm-jeo')
|
||||
compile project(':vtm-http')
|
||||
/*compile(project(':vtm-jeo')) {
|
||||
exclude group: 'com.vividsolutions', module: 'jts'
|
||||
}*/
|
||||
compile project(':vtm-json')
|
||||
compile project(':vtm-jts')
|
||||
compile project(':vtm-themes')
|
||||
compile 'com.noveogroup.android:android-logger:1.3.6'
|
||||
compile 'com.android.support:support-v4:25.3.1'
|
||||
}
|
||||
|
||||
android {
|
||||
|
||||
11
vtm-android-example/res/layout/activity_map_fragment.xml
Normal file
@@ -0,0 +1,11 @@
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/fragment_container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" />
|
||||
|
||||
</LinearLayout>
|
||||
11
vtm-android-example/res/layout/fragment_map.xml
Normal file
@@ -0,0 +1,11 @@
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@android:color/white">
|
||||
|
||||
<org.oscim.android.MapView
|
||||
android:id="@+id/mapView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" />
|
||||
|
||||
</RelativeLayout>
|
||||
@@ -1,7 +0,0 @@
|
||||
<menu xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item
|
||||
android:id="@+id/menu_settings"
|
||||
android:title="@string/menu_settings"
|
||||
android:orderInCategory="100"
|
||||
android:showAsAction="never" />
|
||||
</menu>
|
||||
16
vtm-android-example/res/menu/style_menu.xml
Normal file
@@ -0,0 +1,16 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<menu xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<group
|
||||
android:id="@+id/styles"
|
||||
android:checkableBehavior="single">
|
||||
<item
|
||||
android:id="@+id/style_1"
|
||||
android:checked="true"
|
||||
android:title="@string/style_1" />
|
||||
<item
|
||||
android:id="@+id/style_2"
|
||||
android:title="@string/style_2" />
|
||||
</group>
|
||||
|
||||
</menu>
|
||||
@@ -7,26 +7,24 @@
|
||||
<item
|
||||
android:id="@+id/theme_default"
|
||||
android:checked="true"
|
||||
android:showAsAction="never"
|
||||
android:title="@string/theme_default"></item>
|
||||
<item
|
||||
android:id="@+id/theme_tubes"
|
||||
android:showAsAction="never"
|
||||
android:title="@string/theme_tubes"></item>
|
||||
android:title="@string/theme_default" />
|
||||
<item
|
||||
android:id="@+id/theme_osmarender"
|
||||
android:showAsAction="never"
|
||||
android:title="@string/theme_osmarender"></item>
|
||||
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
|
||||
android:id="@+id/theme_newtron"
|
||||
android:showAsAction="never"
|
||||
android:title="@string/theme_newtron"></item>
|
||||
android:title="@string/theme_newtron" />
|
||||
</group>
|
||||
|
||||
<item
|
||||
android:id="@+id/gridlayer"
|
||||
android:showAsAction="never"
|
||||
android:checkable="true"
|
||||
android:title="@string/menu_gridlayer"></item>
|
||||
android:title="@string/menu_gridlayer" />
|
||||
|
||||
</menu>
|
||||
</menu>
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
<resources>
|
||||
|
||||
<string name="app_name">VTM Samples</string>
|
||||
<string name="menu_settings">Settings</string>
|
||||
<string name="theme_default">Default</string>
|
||||
<string name="theme_tubes">Tubes</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="ok">OK</string>
|
||||
<string name="cancel">Cancel</string>
|
||||
@@ -14,6 +14,8 @@
|
||||
<string name="styler_mode_area">Area</string>
|
||||
<string name="styler_mode_outline">Outline</string>
|
||||
<string name="styler_controls_toggle">Controls</string>
|
||||
<string name="menu_gridlayer">Gridlayer</string>
|
||||
<string name="style_1">Show nature</string>
|
||||
<string name="style_2">Hide nature</string>
|
||||
<string name="menu_gridlayer">Grid</string>
|
||||
|
||||
</resources>
|
||||
|
||||
@@ -0,0 +1,98 @@
|
||||
/*
|
||||
* 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.graphics.drawable.Drawable;
|
||||
|
||||
import org.oscim.backend.canvas.Bitmap;
|
||||
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;
|
||||
|
||||
import static org.oscim.android.canvas.AndroidGraphics.drawableToBitmap;
|
||||
|
||||
public class AtlasMarkerOverlayActivity 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);
|
||||
|
||||
/* directly load bitmap from resources */
|
||||
Bitmap bitmapPoi = drawableToBitmap(getResources(), R.drawable.marker_poi);
|
||||
|
||||
/* another option: use some bitmap drawable */
|
||||
Drawable d = getResources().getDrawable(R.drawable.marker_focus);
|
||||
Bitmap bitmapFocus = drawableToBitmap(d);
|
||||
|
||||
// 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<>();
|
||||
|
||||
inputMap.put("poi", bitmapPoi);
|
||||
inputMap.put("focus", bitmapFocus);
|
||||
|
||||
// Bitmaps will never used any more
|
||||
// With iOS we must flip the Y-Axis
|
||||
TextureAtlasUtils.createTextureRegions(inputMap, regionsMap, atlasList, true, false);
|
||||
|
||||
MarkerSymbol symbol;
|
||||
if (BILLBOARDS)
|
||||
symbol = new MarkerSymbol(regionsMap.get("poi"), HotspotPlace.BOTTOM_CENTER);
|
||||
else
|
||||
symbol = new MarkerSymbol(regionsMap.get("poi"), HotspotPlace.CENTER, false);
|
||||
|
||||
if (BILLBOARDS)
|
||||
mFocusMarker = new MarkerSymbol(regionsMap.get("focus"), HotspotPlace.BOTTOM_CENTER);
|
||||
else
|
||||
mFocusMarker = new MarkerSymbol(regionsMap.get("focus"), HotspotPlace.CENTER, false);
|
||||
|
||||
mMarkerLayer = new ItemizedLayer<>(mMap, new ArrayList<MarkerItem>(), symbol, this);
|
||||
mMap.layers().add(mMarkerLayer);
|
||||
|
||||
List<MarkerItem> pts = new ArrayList<>();
|
||||
|
||||
for (double lat = -90; lat <= 90; lat += 5) {
|
||||
for (double lon = -180; lon <= 180; lon += 5)
|
||||
pts.add(new MarkerItem(lat + "/" + lon, "", new GeoPoint(lat, lon)));
|
||||
}
|
||||
|
||||
mMarkerLayer.addItems(pts);
|
||||
}
|
||||
}
|
||||
@@ -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,5 +1,6 @@
|
||||
/*
|
||||
* Copyright 2013 Hannes Janetzek
|
||||
* Copyright 2016-2017 devemux86
|
||||
*
|
||||
* This file is part of the OpenScienceMap project (http://www.opensciencemap.org).
|
||||
*
|
||||
@@ -85,13 +86,18 @@ public class BaseMapActivity extends MapActivity {
|
||||
item.setChecked(true);
|
||||
return true;
|
||||
|
||||
case R.id.theme_tubes:
|
||||
mMap.setTheme(VtmThemes.TRONRENDER);
|
||||
case R.id.theme_osmarender:
|
||||
mMap.setTheme(VtmThemes.OSMARENDER);
|
||||
item.setChecked(true);
|
||||
return true;
|
||||
|
||||
case R.id.theme_osmarender:
|
||||
mMap.setTheme(VtmThemes.OSMARENDER);
|
||||
case R.id.theme_osmagray:
|
||||
mMap.setTheme(VtmThemes.OSMAGRAY);
|
||||
item.setChecked(true);
|
||||
return true;
|
||||
|
||||
case R.id.theme_tubes:
|
||||
mMap.setTheme(VtmThemes.TRONRENDER);
|
||||
item.setChecked(true);
|
||||
return true;
|
||||
|
||||
@@ -107,7 +113,7 @@ public class BaseMapActivity extends MapActivity {
|
||||
} else {
|
||||
item.setChecked(true);
|
||||
if (mGridLayer == null)
|
||||
mGridLayer = new TileGridLayer(mMap);
|
||||
mGridLayer = new TileGridLayer(mMap, getResources().getDisplayMetrics().density);
|
||||
|
||||
mMap.layers().add(mGridLayer);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
/*
|
||||
* Copyright 2014 Hannes Janetzek
|
||||
* 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
|
||||
@@ -17,10 +18,8 @@ package org.oscim.android.test;
|
||||
import android.os.Bundle;
|
||||
|
||||
import org.oscim.android.cache.TileCache;
|
||||
import org.oscim.backend.canvas.Color;
|
||||
import org.oscim.core.MapPosition;
|
||||
import org.oscim.core.MercatorProjection;
|
||||
import org.oscim.layers.TileGridLayer;
|
||||
import org.oscim.layers.tile.bitmap.BitmapTileLayer;
|
||||
import org.oscim.renderer.MapRenderer;
|
||||
import org.oscim.tiling.source.bitmap.BitmapTileSource;
|
||||
@@ -53,7 +52,6 @@ public class BitmapTileMapActivity extends MapActivity {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
MapRenderer.setBackgroundColor(0xff777777);
|
||||
mMap.layers().add(new TileGridLayer(mMap, Color.GRAY, 1.8f, 8));
|
||||
|
||||
if (mTileSource == null)
|
||||
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
|
||||
*
|
||||
* 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.content.Context;
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
import android.widget.Toast;
|
||||
import android.widget.ToggleButton;
|
||||
|
||||
import org.jeo.map.Style;
|
||||
import org.jeo.vector.VectorDataset;
|
||||
import org.oscim.layers.OSMIndoorLayer;
|
||||
import org.oscim.layers.tile.buildings.BuildingLayer;
|
||||
import org.oscim.layers.tile.vector.labeling.LabelLayer;
|
||||
import org.oscim.test.JeoTest;
|
||||
import org.oscim.theme.VtmThemes;
|
||||
import org.oscim.utils.IOUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.net.URL;
|
||||
import java.net.URLConnection;
|
||||
import java.util.Arrays;
|
||||
|
||||
public class JeoIndoorMapActivity extends BaseMapActivity {
|
||||
public static final Logger log = LoggerFactory.getLogger(JeoIndoorMapActivity.class);
|
||||
|
||||
// from http://overpass-turbo.eu/s/2vp
|
||||
String PATH = "https://gist.github.com/anonymous/8960337/raw/overpass.geojson";
|
||||
//String PATH = "https://gist.github.com/hjanetzek/9280925/raw/overpass.geojson";
|
||||
|
||||
private OSMIndoorLayer mIndoorLayer;
|
||||
|
||||
public JeoIndoorMapActivity() {
|
||||
super(R.layout.jeo_indoor_map);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
mMap.addTask(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
showToast("load data");
|
||||
InputStream is = null;
|
||||
try {
|
||||
// File file = new File(Environment.getExternalStorageDirectory()
|
||||
// .getAbsolutePath(), "osmindoor.json");
|
||||
// is = new FileInputStream(file);
|
||||
|
||||
URL url = new URL(PATH);
|
||||
URLConnection conn = url.openConnection();
|
||||
is = conn.getInputStream();
|
||||
loadJson(is);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
} finally {
|
||||
IOUtils.closeQuietly(is);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
mMap.setTheme(VtmThemes.DEFAULT);
|
||||
|
||||
mMap.layers().add(new BuildingLayer(mMap, mBaseLayer));
|
||||
mMap.layers().add(new LabelLayer(mMap, mBaseLayer));
|
||||
|
||||
// mMap.layers().add(new TileGridLayer(mMap));
|
||||
// String file = Environment.getExternalStorageDirectory().getAbsolutePath();
|
||||
// VectorDataset data = (VectorDataset) JeoTest.getJsonData(file + "/states.json", true);
|
||||
// Style style = JeoTest.getStyle();
|
||||
// mMap.layers().add(new JeoVectorLayer(mMap, data, style));
|
||||
}
|
||||
|
||||
void loadJson(InputStream is) {
|
||||
showToast("got data");
|
||||
|
||||
VectorDataset data = JeoTest.readGeoJson(is);
|
||||
Style style = JeoTest.getStyle();
|
||||
mIndoorLayer = new OSMIndoorLayer(mMap, data, style);
|
||||
mMap.layers().add(mIndoorLayer);
|
||||
|
||||
showToast("data ready");
|
||||
mMap.updateMap(true);
|
||||
|
||||
mIndoorLayer.activeLevels[0] = true;
|
||||
shift();
|
||||
}
|
||||
|
||||
public void showToast(final String text) {
|
||||
final Context ctx = this;
|
||||
runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
Toast toast = Toast.makeText(ctx, text, Toast.LENGTH_SHORT);
|
||||
toast.show();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
boolean mShift = true;
|
||||
|
||||
public void shift() {
|
||||
if (!mShift)
|
||||
return;
|
||||
|
||||
mMap.postDelayed(new Runnable() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
for (int i = 0; i < 10; i++) {
|
||||
if (mIndoorLayer.activeLevels[i]) {
|
||||
mIndoorLayer.activeLevels[i] = false;
|
||||
mIndoorLayer.activeLevels[(i + 1) % 9] = true;
|
||||
mIndoorLayer.update();
|
||||
break;
|
||||
}
|
||||
}
|
||||
shift();
|
||||
}
|
||||
}, 200);
|
||||
|
||||
}
|
||||
|
||||
public void onClick(View v) {
|
||||
mShift = false;
|
||||
|
||||
if (mIndoorLayer == null)
|
||||
return;
|
||||
|
||||
int i = 0;
|
||||
|
||||
if (v instanceof ToggleButton) {
|
||||
ToggleButton b = (ToggleButton) v;
|
||||
i = (b.getTextOn().charAt(0) - '0') + 1;
|
||||
}
|
||||
|
||||
if (i < 0 || i > 9)
|
||||
i = 0;
|
||||
|
||||
mIndoorLayer.activeLevels[i] ^= true;
|
||||
((ToggleButton) v).setChecked(mIndoorLayer.activeLevels[i]);
|
||||
log.debug(Arrays.toString(mIndoorLayer.activeLevels));
|
||||
mIndoorLayer.update();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onStop() {
|
||||
super.onStop();
|
||||
}
|
||||
|
||||
@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);
|
||||
}
|
||||
}
|
||||
///*
|
||||
// * Copyright 2014 Hannes Janetzek
|
||||
// * Copyright 2016-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.android.test;
|
||||
//
|
||||
//import android.content.Context;
|
||||
//import android.os.Bundle;
|
||||
//import android.view.View;
|
||||
//import android.widget.Toast;
|
||||
//import android.widget.ToggleButton;
|
||||
//
|
||||
//import org.jeo.map.Style;
|
||||
//import org.jeo.vector.VectorDataset;
|
||||
//import org.oscim.backend.canvas.Color;
|
||||
//import org.oscim.layers.OSMIndoorLayer;
|
||||
//import org.oscim.layers.tile.buildings.BuildingLayer;
|
||||
//import org.oscim.layers.tile.vector.labeling.LabelLayer;
|
||||
//import org.oscim.test.JeoTest;
|
||||
//import org.oscim.theme.VtmThemes;
|
||||
//import org.oscim.theme.styles.TextStyle;
|
||||
//import org.oscim.utils.IOUtils;
|
||||
//import org.slf4j.Logger;
|
||||
//import org.slf4j.LoggerFactory;
|
||||
//
|
||||
//import java.io.IOException;
|
||||
//import java.io.InputStream;
|
||||
//import java.net.URL;
|
||||
//import java.net.URLConnection;
|
||||
//import java.util.Arrays;
|
||||
//
|
||||
//public class JeoIndoorMapActivity extends BaseMapActivity {
|
||||
// public static final Logger log = LoggerFactory.getLogger(JeoIndoorMapActivity.class);
|
||||
//
|
||||
// // from http://overpass-turbo.eu/s/2vp
|
||||
// String PATH = "https://gist.githubusercontent.com/anonymous/09062103a66844a96048f25626078c8d/raw/1d3af6a5a55e9ea4adc9551fa633a051a44a5a9c/overpass.geojson";
|
||||
//
|
||||
// private OSMIndoorLayer mIndoorLayer;
|
||||
//
|
||||
// public JeoIndoorMapActivity() {
|
||||
// super(R.layout.jeo_indoor_map);
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onCreate(Bundle savedInstanceState) {
|
||||
// super.onCreate(savedInstanceState);
|
||||
//
|
||||
// mMap.addTask(new Runnable() {
|
||||
// @Override
|
||||
// public void run() {
|
||||
// showToast("load data");
|
||||
// InputStream is = null;
|
||||
// try {
|
||||
// // File file = new File(Environment.getExternalStorageDirectory()
|
||||
// // .getAbsolutePath(), "osmindoor.json");
|
||||
// // is = new FileInputStream(file);
|
||||
//
|
||||
// URL url = new URL(PATH);
|
||||
// URLConnection conn = url.openConnection();
|
||||
// is = conn.getInputStream();
|
||||
// loadJson(is);
|
||||
// } catch (IOException e) {
|
||||
// e.printStackTrace();
|
||||
// } finally {
|
||||
// IOUtils.closeQuietly(is);
|
||||
// }
|
||||
// }
|
||||
// });
|
||||
//
|
||||
// mMap.setTheme(VtmThemes.DEFAULT);
|
||||
//
|
||||
// mMap.layers().add(new BuildingLayer(mMap, mBaseLayer));
|
||||
// mMap.layers().add(new LabelLayer(mMap, mBaseLayer));
|
||||
//
|
||||
// // String file = Environment.getExternalStorageDirectory().getAbsolutePath();
|
||||
// // VectorDataset data = (VectorDataset) JeoTest.getJsonData(file + "/states.json", true);
|
||||
// // Style style = JeoTest.getStyle();
|
||||
// // mMap.layers().add(new JeoVectorLayer(mMap, data, style));
|
||||
// }
|
||||
//
|
||||
// void loadJson(InputStream is) {
|
||||
// showToast("got data");
|
||||
//
|
||||
// VectorDataset data = JeoTest.readGeoJson(is);
|
||||
// Style style = JeoTest.getStyle();
|
||||
// float scale = getResources().getDisplayMetrics().density;
|
||||
// TextStyle textStyle = TextStyle.builder()
|
||||
// .isCaption(true)
|
||||
// .fontSize(16 * scale).color(Color.BLACK)
|
||||
// .strokeWidth(2.2f * scale).strokeColor(Color.WHITE)
|
||||
// .build();
|
||||
// mIndoorLayer = new OSMIndoorLayer(mMap, data, style, textStyle);
|
||||
// mMap.layers().add(mIndoorLayer);
|
||||
//
|
||||
// showToast("data ready");
|
||||
// mMap.updateMap(true);
|
||||
//
|
||||
// mIndoorLayer.activeLevels[0] = true;
|
||||
// shift();
|
||||
// }
|
||||
//
|
||||
// public void showToast(final String text) {
|
||||
// final Context ctx = this;
|
||||
// runOnUiThread(new Runnable() {
|
||||
// @Override
|
||||
// public void run() {
|
||||
// Toast toast = Toast.makeText(ctx, text, Toast.LENGTH_SHORT);
|
||||
// toast.show();
|
||||
// }
|
||||
// });
|
||||
// }
|
||||
//
|
||||
// boolean mShift = true;
|
||||
//
|
||||
// public void shift() {
|
||||
// if (!mShift)
|
||||
// return;
|
||||
//
|
||||
// mMap.postDelayed(new Runnable() {
|
||||
//
|
||||
// @Override
|
||||
// public void run() {
|
||||
// for (int i = 0; i < 10; i++) {
|
||||
// if (mIndoorLayer.activeLevels[i]) {
|
||||
// mIndoorLayer.activeLevels[i] = false;
|
||||
// mIndoorLayer.activeLevels[(i + 1) % 9] = true;
|
||||
// mIndoorLayer.update();
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
// shift();
|
||||
// }
|
||||
// }, 200);
|
||||
//
|
||||
// }
|
||||
//
|
||||
// public void onClick(View v) {
|
||||
// mShift = false;
|
||||
//
|
||||
// if (mIndoorLayer == null)
|
||||
// return;
|
||||
//
|
||||
// int i = 0;
|
||||
//
|
||||
// if (v instanceof ToggleButton) {
|
||||
// ToggleButton b = (ToggleButton) v;
|
||||
// i = (b.getTextOn().charAt(0) - '0') + 1;
|
||||
// }
|
||||
//
|
||||
// if (i < 0 || i > 9)
|
||||
// i = 0;
|
||||
//
|
||||
// mIndoorLayer.activeLevels[i] ^= true;
|
||||
// if (v instanceof ToggleButton)
|
||||
// ((ToggleButton) v).setChecked(mIndoorLayer.activeLevels[i]);
|
||||
// log.debug(Arrays.toString(mIndoorLayer.activeLevels));
|
||||
// mIndoorLayer.update();
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// protected void onStop() {
|
||||
// super.onStop();
|
||||
// }
|
||||
//
|
||||
// @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 2016 devemux86
|
||||
* Copyright 2016-2017 devemux86
|
||||
* Copyright 2016 Andrey Novikov
|
||||
*
|
||||
* This file is part of the OpenScienceMap project (http://www.opensciencemap.org).
|
||||
@@ -20,7 +20,6 @@ package org.oscim.android.test;
|
||||
|
||||
import android.os.Bundle;
|
||||
|
||||
import org.oscim.backend.CanvasAdapter;
|
||||
import org.oscim.layers.tile.buildings.BuildingLayer;
|
||||
import org.oscim.layers.tile.vector.labeling.LabelLayer;
|
||||
import org.oscim.map.Layers;
|
||||
@@ -53,7 +52,7 @@ public class LayerGroupActivity extends BaseMapActivity {
|
||||
layers.addGroup(GROUP_LABELS);
|
||||
layers.add(new LabelLayer(mMap, mBaseLayer), GROUP_LABELS);
|
||||
|
||||
mapScaleBar = new DefaultMapScaleBar(mMap, CanvasAdapter.dpi / 160);
|
||||
mapScaleBar = new DefaultMapScaleBar(mMap);
|
||||
mapScaleBar.setScaleBarMode(DefaultMapScaleBar.ScaleBarMode.BOTH);
|
||||
mapScaleBar.setDistanceUnitAdapter(MetricUnitAdapter.INSTANCE);
|
||||
mapScaleBar.setSecondaryDistanceUnitAdapter(ImperialUnitAdapter.INSTANCE);
|
||||
@@ -62,7 +61,7 @@ public class LayerGroupActivity extends BaseMapActivity {
|
||||
MapScaleBarLayer mapScaleBarLayer = new MapScaleBarLayer(mMap, mapScaleBar);
|
||||
BitmapRenderer renderer = mapScaleBarLayer.getRenderer();
|
||||
renderer.setPosition(GLViewport.Position.BOTTOM_LEFT);
|
||||
renderer.setOffset(5 * CanvasAdapter.dpi / 160, 0);
|
||||
renderer.setOffset(5 * getResources().getDisplayMetrics().density, 0);
|
||||
|
||||
layers.addGroup(GROUP_OVERLAYS);
|
||||
layers.add(mapScaleBarLayer, GROUP_OVERLAYS);
|
||||
@@ -72,7 +71,8 @@ public class LayerGroupActivity extends BaseMapActivity {
|
||||
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
mapScaleBar.destroy();
|
||||
if (mapScaleBar != null)
|
||||
mapScaleBar.destroy();
|
||||
|
||||
super.onDestroy();
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Copyright 2014 Hannes Janetzek
|
||||
* Copyright 2016 devemux86
|
||||
* Copyright 2016-2017 devemux86
|
||||
*
|
||||
* 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.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
|
||||
* PathLayers!
|
||||
*/
|
||||
public class LineTexActivity extends BitmapTileMapActivity {
|
||||
public class LineTexActivity extends SimpleMapActivity {
|
||||
|
||||
private static final boolean ANIMATION = false;
|
||||
|
||||
private List<PathLayer> mPathLayers = new ArrayList<>();
|
||||
|
||||
public LineTexActivity() {
|
||||
super(STAMEN_TONER.build());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
mBitmapLayer.tileRenderer().setBitmapAlpha(0.5f);
|
||||
|
||||
TextureItem tex = new TextureItem(CanvasAdapter.getBitmapAsset("", "patterns/pike.png"));
|
||||
tex.mipmap = true;
|
||||
|
||||
@@ -0,0 +1,91 @@
|
||||
/*
|
||||
* Copyright 2016-2017 devemux86
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify it under the
|
||||
* terms of the GNU Lesser General Public License as published by the Free Software
|
||||
* Foundation, either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||
* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License along with
|
||||
* this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package org.oscim.android.test;
|
||||
|
||||
import android.content.Context;
|
||||
import android.location.Location;
|
||||
import android.location.LocationListener;
|
||||
import android.location.LocationManager;
|
||||
import android.os.Bundle;
|
||||
|
||||
import org.oscim.core.MapPosition;
|
||||
import org.oscim.layers.LocationLayer;
|
||||
import org.oscim.renderer.LocationRenderer;
|
||||
|
||||
public class LocationActivity extends SimpleMapActivity implements LocationListener {
|
||||
private LocationLayer locationLayer;
|
||||
private LocationManager locationManager;
|
||||
private final MapPosition mapPosition = new MapPosition();
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
locationManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
|
||||
|
||||
locationLayer = new LocationLayer(mMap);
|
||||
locationLayer.locationRenderer.setShader("location_1_reverse");
|
||||
locationLayer.setEnabled(false);
|
||||
mMap.layers().add(locationLayer);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
|
||||
enableAvailableProviders();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPause() {
|
||||
super.onPause();
|
||||
|
||||
locationManager.removeUpdates(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLocationChanged(Location location) {
|
||||
locationLayer.setEnabled(true);
|
||||
locationLayer.setPosition(location.getLatitude(), location.getLongitude(), location.getAccuracy());
|
||||
|
||||
// Follow location
|
||||
mMap.getMapPosition(mapPosition);
|
||||
mapPosition.setPosition(location.getLatitude(), location.getLongitude());
|
||||
mMap.setMapPosition(mapPosition);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onProviderDisabled(String provider) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onProviderEnabled(String provider) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStatusChanged(String provider, int status, Bundle extras) {
|
||||
}
|
||||
|
||||
private void enableAvailableProviders() {
|
||||
locationManager.removeUpdates(this);
|
||||
|
||||
for (String provider : locationManager.getProviders(true)) {
|
||||
if (LocationManager.GPS_PROVIDER.equals(provider)
|
||||
|| LocationManager.NETWORK_PROVIDER.equals(provider)) {
|
||||
locationManager.requestLocationUpdates(provider, 0, 0, this);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2016 devemux86
|
||||
* Copyright 2016-2017 devemux86
|
||||
*
|
||||
* This file is part of the OpenScienceMap project (http://www.opensciencemap.org).
|
||||
*
|
||||
@@ -61,9 +61,16 @@ public class MapActivity extends Activity {
|
||||
|
||||
@Override
|
||||
protected void onPause() {
|
||||
super.onPause();
|
||||
|
||||
mMapView.onPause();
|
||||
mPrefs.save(mMapView.map());
|
||||
mMapView.onPause();
|
||||
|
||||
super.onPause();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
mMapView.onDestroy();
|
||||
|
||||
super.onDestroy();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,107 @@
|
||||
/*
|
||||
* Copyright 2016 Mathieu De Brito
|
||||
* 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 android.support.annotation.Nullable;
|
||||
import android.support.v4.app.Fragment;
|
||||
import android.support.v4.app.FragmentActivity;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import org.oscim.android.MapPreferences;
|
||||
import org.oscim.android.MapView;
|
||||
import org.oscim.core.MapPosition;
|
||||
import org.oscim.core.Tile;
|
||||
import org.oscim.layers.GroupLayer;
|
||||
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;
|
||||
|
||||
public class MapFragmentActivity extends FragmentActivity {
|
||||
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
Tile.SIZE = Tile.calculateTileSize(getResources().getDisplayMetrics().scaledDensity);
|
||||
setContentView(R.layout.activity_map_fragment);
|
||||
|
||||
setTitle(getClass().getSimpleName());
|
||||
|
||||
MapFragment newFragment = new MapFragment();
|
||||
getSupportFragmentManager()
|
||||
.beginTransaction()
|
||||
.add(R.id.fragment_container, newFragment)
|
||||
.commit();
|
||||
}
|
||||
|
||||
public static class MapFragment extends Fragment {
|
||||
|
||||
private MapView mMapView;
|
||||
private MapPreferences mPrefs;
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||
View contentView = super.onCreateView(inflater, container, savedInstanceState);
|
||||
if (contentView == null) {
|
||||
contentView = inflater.inflate(R.layout.fragment_map, container, false);
|
||||
}
|
||||
return contentView;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
|
||||
super.onViewCreated(view, savedInstanceState);
|
||||
|
||||
mMapView = (MapView) view.findViewById(R.id.mapView);
|
||||
mPrefs = new MapPreferences(MapFragment.class.getName(), getContext());
|
||||
|
||||
VectorTileLayer l = mMapView.map().setBaseMap(new OSciMap4TileSource());
|
||||
|
||||
GroupLayer groupLayer = new GroupLayer(mMapView.map());
|
||||
groupLayer.layers.add(new BuildingLayer(mMapView.map(), l));
|
||||
groupLayer.layers.add(new LabelLayer(mMapView.map(), l));
|
||||
mMapView.map().layers().add(groupLayer);
|
||||
|
||||
mMapView.map().setTheme(VtmThemes.DEFAULT);
|
||||
|
||||
// set initial position on first run
|
||||
MapPosition pos = new MapPosition();
|
||||
mMapView.map().getMapPosition(pos);
|
||||
if (pos.x == 0.5 && pos.y == 0.5)
|
||||
mMapView.map().setMapPosition(53.08, 8.83, Math.pow(2, 16));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
|
||||
mPrefs.load(mMapView.map());
|
||||
mMapView.onResume();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPause() {
|
||||
super.onPause();
|
||||
|
||||
mMapView.onPause();
|
||||
mPrefs.save(mMapView.map());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,88 @@
|
||||
/*
|
||||
* Copyright 2016 Mathieu De Brito
|
||||
* Copyright 2016 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 android.widget.Toast;
|
||||
|
||||
import org.oscim.core.MapPosition;
|
||||
import org.oscim.core.MercatorProjection;
|
||||
|
||||
/**
|
||||
* Test consecutive map position animations.
|
||||
*/
|
||||
public class MapPositionActivity extends SimpleMapActivity {
|
||||
|
||||
// Reuse MapPosition instance
|
||||
private final MapPosition mapPosition = new MapPosition();
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
runTest();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
|
||||
/* ignore saved position */
|
||||
mMap.setMapPosition(0, 0, 1 << 2);
|
||||
}
|
||||
|
||||
private void animateToBearing(final float bearing) {
|
||||
mMap.postDelayed(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
mMap.getMapPosition(mapPosition);
|
||||
mapPosition.setBearing(bearing);
|
||||
mMap.animator().animateTo(1000, mapPosition);
|
||||
}
|
||||
}, 500);
|
||||
}
|
||||
|
||||
private void animateToLocation(final double latitude, final double longitude) {
|
||||
mMap.postDelayed(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
mMap.getMapPosition(true, mapPosition);
|
||||
mapPosition.setPosition(latitude, longitude);
|
||||
mMap.animator().animateTo(1000, mapPosition);
|
||||
}
|
||||
}, 1000);
|
||||
}
|
||||
|
||||
private void runTest() {
|
||||
// 1 - ask for a bearing
|
||||
final float bearing = 180;
|
||||
animateToBearing(bearing);
|
||||
|
||||
// 2 - ask for a new location
|
||||
double latitude = Math.random() * MercatorProjection.LATITUDE_MAX;
|
||||
double longitude = Math.random() * MercatorProjection.LONGITUDE_MAX;
|
||||
animateToLocation(latitude, longitude);
|
||||
|
||||
// If animations were merged, final bearing should be 180°
|
||||
mMap.postDelayed(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
mMap.getMapPosition(mapPosition);
|
||||
Toast.makeText(MapPositionActivity.this, "Bearing expected: " + bearing + ", got: " + mapPosition.getBearing(), Toast.LENGTH_LONG).show();
|
||||
}
|
||||
}, 3000);
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Copyright 2014 Hannes Janetzek
|
||||
* Copyright 2016 devemux86
|
||||
* Copyright 2016-2017 devemux86
|
||||
*
|
||||
* 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.vector.VectorTileLayer;
|
||||
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.tiling.source.mapfile.MapFileTileSource;
|
||||
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 TileGridLayer mGridLayer;
|
||||
private DefaultMapScaleBar mMapScaleBar;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
@@ -48,6 +56,14 @@ public class MapsforgeMapActivity extends MapActivity {
|
||||
SELECT_MAP_FILE);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
if (mMapScaleBar != null)
|
||||
mMapScaleBar.destroy();
|
||||
|
||||
super.onDestroy();
|
||||
}
|
||||
|
||||
public static class MapFilePicker extends FilePicker {
|
||||
public MapFilePicker() {
|
||||
setFileDisplayFilter(new FilterByFileExtension(".map"));
|
||||
@@ -70,13 +86,18 @@ public class MapsforgeMapActivity extends MapActivity {
|
||||
item.setChecked(true);
|
||||
return true;
|
||||
|
||||
case R.id.theme_tubes:
|
||||
mMap.setTheme(VtmThemes.TRONRENDER);
|
||||
case R.id.theme_osmarender:
|
||||
mMap.setTheme(VtmThemes.OSMARENDER);
|
||||
item.setChecked(true);
|
||||
return true;
|
||||
|
||||
case R.id.theme_osmarender:
|
||||
mMap.setTheme(VtmThemes.OSMARENDER);
|
||||
case R.id.theme_osmagray:
|
||||
mMap.setTheme(VtmThemes.OSMAGRAY);
|
||||
item.setChecked(true);
|
||||
return true;
|
||||
|
||||
case R.id.theme_tubes:
|
||||
mMap.setTheme(VtmThemes.TRONRENDER);
|
||||
item.setChecked(true);
|
||||
return true;
|
||||
|
||||
@@ -92,7 +113,7 @@ public class MapsforgeMapActivity extends MapActivity {
|
||||
} else {
|
||||
item.setChecked(true);
|
||||
if (mGridLayer == null)
|
||||
mGridLayer = new TileGridLayer(mMap);
|
||||
mGridLayer = new TileGridLayer(mMap, getResources().getDisplayMetrics().density);
|
||||
|
||||
mMap.layers().add(mGridLayer);
|
||||
}
|
||||
@@ -118,11 +139,23 @@ public class MapsforgeMapActivity extends MapActivity {
|
||||
if (tileSource.setMapFile(file)) {
|
||||
|
||||
VectorTileLayer l = mMap.setBaseMap(tileSource);
|
||||
mMap.setTheme(VtmThemes.DEFAULT);
|
||||
loadTheme(null);
|
||||
|
||||
mMap.layers().add(new BuildingLayer(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();
|
||||
MapPosition pos = new MapPosition();
|
||||
pos.setByBoundingBox(info.boundingBox, Tile.SIZE * 4, Tile.SIZE * 4);
|
||||
@@ -132,4 +165,8 @@ public class MapsforgeMapActivity extends MapActivity {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected void loadTheme(final String styleId) {
|
||||
mMap.setTheme(VtmThemes.DEFAULT);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,89 @@
|
||||
/*
|
||||
* Copyright 2016 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.view.Menu;
|
||||
import android.view.MenuItem;
|
||||
import android.widget.Toast;
|
||||
|
||||
import org.oscim.android.theme.AssetsRenderTheme;
|
||||
import org.oscim.theme.XmlRenderThemeMenuCallback;
|
||||
import org.oscim.theme.XmlRenderThemeStyleLayer;
|
||||
import org.oscim.theme.XmlRenderThemeStyleMenu;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* Load render theme from Android assets folder and show a configuration menu based on stylemenu.
|
||||
*/
|
||||
public class MapsforgeStyleActivity extends MapsforgeMapActivity {
|
||||
|
||||
@Override
|
||||
public boolean onCreateOptionsMenu(Menu menu) {
|
||||
getMenuInflater().inflate(R.menu.style_menu, menu);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
switch (item.getItemId()) {
|
||||
case R.id.style_1:
|
||||
item.setChecked(true);
|
||||
loadTheme("1");
|
||||
mMap.clearMap();
|
||||
Toast.makeText(this, "Show nature layers", Toast.LENGTH_SHORT).show();
|
||||
return true;
|
||||
case R.id.style_2:
|
||||
item.setChecked(true);
|
||||
loadTheme("2");
|
||||
mMap.clearMap();
|
||||
Toast.makeText(this, "Hide nature layers", Toast.LENGTH_SHORT).show();
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void loadTheme(final String styleId) {
|
||||
mMap.setTheme(new AssetsRenderTheme(this, "", "vtm/stylemenu.xml", new XmlRenderThemeMenuCallback() {
|
||||
@Override
|
||||
public Set<String> getCategories(XmlRenderThemeStyleMenu renderThemeStyleMenu) {
|
||||
// Use the selected style or the default
|
||||
String style = styleId != null ? styleId : renderThemeStyleMenu.getDefaultValue();
|
||||
|
||||
// Retrieve the layer from the style id
|
||||
XmlRenderThemeStyleLayer renderThemeStyleLayer = renderThemeStyleMenu.getLayer(style);
|
||||
if (renderThemeStyleLayer == null) {
|
||||
System.err.println("Invalid style " + style);
|
||||
return null;
|
||||
}
|
||||
|
||||
// First get the selected layer's categories that are enabled together
|
||||
Set<String> categories = renderThemeStyleLayer.getCategories();
|
||||
|
||||
// Then add the selected layer's overlays that are enabled individually
|
||||
// Here we use the style menu, but users can use their own preferences
|
||||
for (XmlRenderThemeStyleLayer overlay : renderThemeStyleLayer.getOverlays()) {
|
||||
if (overlay.isEnabled())
|
||||
categories.addAll(overlay.getCategories());
|
||||
}
|
||||
|
||||
// This is the whole categories set to be enabled
|
||||
return categories;
|
||||
}
|
||||
}));
|
||||
}
|
||||
}
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
/*
|
||||
* Copyright 2016-2017 devemux86
|
||||
* Copyright 2017 Mathieu De Brito
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify it under the
|
||||
* terms of the GNU Lesser General Public License as published by the Free Software
|
||||
* Foundation, either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||
* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License along with
|
||||
* this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package org.oscim.android.test;
|
||||
|
||||
import android.os.Bundle;
|
||||
|
||||
import org.oscim.android.cache.TileCache;
|
||||
import org.oscim.layers.TileGridLayer;
|
||||
import org.oscim.layers.tile.buildings.BuildingLayer;
|
||||
import org.oscim.layers.tile.vector.VectorTileLayer;
|
||||
import org.oscim.layers.tile.vector.labeling.LabelLayer;
|
||||
import org.oscim.theme.VtmThemes;
|
||||
import org.oscim.tiling.source.OkHttpEngine;
|
||||
import org.oscim.tiling.source.UrlTileSource;
|
||||
import org.oscim.tiling.source.mvt.MapzenMvtTileSource;
|
||||
|
||||
public class MapzenMvtMapActivity extends MapActivity {
|
||||
|
||||
private static final boolean USE_CACHE = false;
|
||||
|
||||
private TileCache mCache;
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
UrlTileSource tileSource = MapzenMvtTileSource.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,6 +1,6 @@
|
||||
/*
|
||||
* Copyright 2014 Hannes Janetzek
|
||||
* Copyright 2016 devemux86
|
||||
* Copyright 2016-2017 devemux86
|
||||
*
|
||||
* This file is part of the OpenScienceMap project (http://www.opensciencemap.org).
|
||||
*
|
||||
@@ -18,37 +18,46 @@
|
||||
package org.oscim.android.test;
|
||||
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.os.Bundle;
|
||||
import android.widget.Toast;
|
||||
|
||||
import org.oscim.backend.canvas.Bitmap;
|
||||
import org.oscim.core.GeoPoint;
|
||||
import org.oscim.layers.TileGridLayer;
|
||||
import org.oscim.event.Gesture;
|
||||
import org.oscim.event.GestureListener;
|
||||
import org.oscim.event.MotionEvent;
|
||||
import org.oscim.layers.Layer;
|
||||
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.map.Map;
|
||||
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;
|
||||
import static org.oscim.tiling.source.bitmap.DefaultSources.STAMEN_TONER;
|
||||
|
||||
public class MarkerOverlayActivity extends BitmapTileMapActivity
|
||||
public class MarkerOverlayActivity extends SimpleMapActivity
|
||||
implements ItemizedLayer.OnItemGestureListener<MarkerItem> {
|
||||
|
||||
private static final boolean BILLBOARDS = true;
|
||||
private MarkerSymbol mFocusMarker;
|
||||
|
||||
public MarkerOverlayActivity() {
|
||||
super(STAMEN_TONER.build());
|
||||
}
|
||||
static final boolean BILLBOARDS = true;
|
||||
MarkerSymbol mFocusMarker;
|
||||
ItemizedLayer<MarkerItem> mMarkerLayer;
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
mBitmapLayer.tileRenderer().setBitmapAlpha(0.5f);
|
||||
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);
|
||||
|
||||
/* directly load bitmap from resources */
|
||||
Bitmap bitmap = drawableToBitmap(getResources(), R.drawable.marker_poi);
|
||||
@@ -66,11 +75,8 @@ public class MarkerOverlayActivity extends BitmapTileMapActivity
|
||||
else
|
||||
mFocusMarker = new MarkerSymbol(drawableToBitmap(d), HotspotPlace.CENTER, false);
|
||||
|
||||
ItemizedLayer<MarkerItem> markerLayer =
|
||||
new ItemizedLayer<>(mMap, new ArrayList<MarkerItem>(),
|
||||
symbol, this);
|
||||
|
||||
mMap.layers().add(markerLayer);
|
||||
mMarkerLayer = new ItemizedLayer<>(mMap, new ArrayList<MarkerItem>(), symbol, this);
|
||||
mMap.layers().add(mMarkerLayer);
|
||||
|
||||
List<MarkerItem> pts = new ArrayList<>();
|
||||
|
||||
@@ -79,9 +85,7 @@ public class MarkerOverlayActivity extends BitmapTileMapActivity
|
||||
pts.add(new MarkerItem(lat + "/" + lon, "", new GeoPoint(lat, lon)));
|
||||
}
|
||||
|
||||
markerLayer.addItems(pts);
|
||||
|
||||
mMap.layers().add(new TileGridLayer(mMap));
|
||||
mMarkerLayer.addItems(pts);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -99,13 +103,40 @@ public class MarkerOverlayActivity extends BitmapTileMapActivity
|
||||
else
|
||||
item.setMarker(null);
|
||||
|
||||
Toast toast = Toast.makeText(this, item.getTitle(), Toast.LENGTH_SHORT);
|
||||
toast.show();
|
||||
Toast.makeText(this, "Marker tap\n" + item.getTitle(), Toast.LENGTH_SHORT).show();
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onItemLongPress(int index, MarkerItem item) {
|
||||
return false;
|
||||
if (item.getMarker() == null)
|
||||
item.setMarker(mFocusMarker);
|
||||
else
|
||||
item.setMarker(null);
|
||||
|
||||
Toast.makeText(this, "Marker long press\n" + item.getTitle(), Toast.LENGTH_SHORT).show();
|
||||
return true;
|
||||
}
|
||||
|
||||
class MapEventsReceiver extends Layer implements GestureListener {
|
||||
|
||||
MapEventsReceiver(Map map) {
|
||||
super(map);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onGesture(Gesture g, MotionEvent e) {
|
||||
if (g instanceof Gesture.Tap) {
|
||||
GeoPoint p = mMap.viewport().fromScreenPoint(e.getX(), e.getY());
|
||||
Toast.makeText(MarkerOverlayActivity.this, "Map tap\n" + p, Toast.LENGTH_SHORT).show();
|
||||
return true;
|
||||
}
|
||||
if (g instanceof Gesture.LongPress) {
|
||||
GeoPoint p = mMap.viewport().fromScreenPoint(e.getX(), e.getY());
|
||||
Toast.makeText(MarkerOverlayActivity.this, "Map long press\n" + p, Toast.LENGTH_SHORT).show();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
/*
|
||||
* Copyright 2016 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 org.oscim.map.Map;
|
||||
|
||||
public class NewGesturesActivity extends MarkerOverlayActivity {
|
||||
|
||||
public NewGesturesActivity() {
|
||||
super();
|
||||
Map.NEW_GESTURES = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
super.onDestroy();
|
||||
|
||||
// Revert gestures for other activities
|
||||
Map.NEW_GESTURES = false;
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Copyright 2014 Hannes Janetzek
|
||||
* Copyright 2016 devemux86
|
||||
* Copyright 2016-2017 devemux86
|
||||
*
|
||||
* 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 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;
|
||||
@@ -65,8 +64,6 @@ public class OsmJsonMapActivity extends MapActivity {
|
||||
mMap.layers().add(l);
|
||||
mMap.layers().add(new LabelLayer(mMap, l));
|
||||
|
||||
mMap.layers().add(new TileGridLayer(mMap));
|
||||
|
||||
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 2016 devemux86
|
||||
* Copyright 2016-2017 devemux86
|
||||
*
|
||||
* 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.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
|
||||
* PathLayers!
|
||||
*/
|
||||
public class PathOverlayActivity extends BitmapTileMapActivity {
|
||||
public class PathOverlayActivity extends SimpleMapActivity {
|
||||
|
||||
private static final boolean ANIMATION = true;
|
||||
|
||||
private List<PathLayer> mPathLayers = new ArrayList<>();
|
||||
|
||||
public PathOverlayActivity() {
|
||||
super(STAMEN_TONER.build());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
mBitmapLayer.tileRenderer().setBitmapAlpha(0.5f);
|
||||
|
||||
for (double lat = -90; lat <= 90; lat += 5) {
|
||||
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 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).
|
||||
*
|
||||
@@ -21,39 +23,61 @@ package org.oscim.android.test;
|
||||
import android.app.Activity;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.view.Gravity;
|
||||
import android.view.View;
|
||||
import android.view.View.OnClickListener;
|
||||
import android.widget.Button;
|
||||
import android.widget.LinearLayout;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import android.widget.TextView;
|
||||
|
||||
/**
|
||||
* A simple start screen for the sample activities.
|
||||
*/
|
||||
public class Samples extends Activity {
|
||||
public static Logger log = LoggerFactory.getLogger(Samples.class);
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
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(BitmapTileMapActivity.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(AtlasThemeActivity.class));
|
||||
linearLayout.addView(createButton(POTTextureActivity.class));
|
||||
|
||||
linearLayout.addView(createLabel("Raster Maps"));
|
||||
linearLayout.addView(createButton(BitmapTileMapActivity.class));
|
||||
|
||||
linearLayout.addView(createLabel("Overlays"));
|
||||
linearLayout.addView(createButton(MarkerOverlayActivity.class));
|
||||
linearLayout.addView(createButton(RotateMarkerOverlayActivity.class));
|
||||
linearLayout.addView(createButton(AtlasMarkerOverlayActivity.class));
|
||||
linearLayout.addView(createButton(AtlasMultiTextureActivity.class));
|
||||
linearLayout.addView(createButton(ClusterMarkerOverlayActivity.class));
|
||||
linearLayout.addView(createButton(PathOverlayActivity.class));
|
||||
linearLayout.addView(createButton(LineTexActivity.class));
|
||||
linearLayout.addView(createButton(LayerGroupActivity.class));
|
||||
linearLayout.addView(createButton(ThemeStylerActivity.class));
|
||||
linearLayout.addView(createButton(S3DBMapActivity.class));
|
||||
linearLayout.addView(createButton(JeoIndoorMapActivity.class));
|
||||
linearLayout.addView(createButton(OsmJsonMapActivity.class));
|
||||
linearLayout.addView(createButton(VectorLayerMapActivity.class));
|
||||
linearLayout.addView(createButton(LocationActivity.class));
|
||||
|
||||
linearLayout.addView(createLabel("User Interaction"));
|
||||
linearLayout.addView(createButton(NewGesturesActivity.class));
|
||||
linearLayout.addView(createButton(LayerGroupActivity.class));
|
||||
linearLayout.addView(createButton(MapFragmentActivity.class));
|
||||
|
||||
linearLayout.addView(createLabel("Dual Map Views"));
|
||||
linearLayout.addView(createButton(MultiMapActivity.class));
|
||||
|
||||
linearLayout.addView(createLabel("Experiments"));
|
||||
linearLayout.addView(createButton(MapPositionActivity.class));
|
||||
linearLayout.addView(createButton(S3DBMapActivity.class));
|
||||
linearLayout.addView(createButton(ThemeStylerActivity.class));
|
||||
//linearLayout.addView(createButton(JeoIndoorMapActivity.class));
|
||||
}
|
||||
|
||||
private Button createButton(final Class<?> clazz) {
|
||||
@@ -75,4 +99,15 @@ public class Samples extends Activity {
|
||||
});
|
||||
return button;
|
||||
}
|
||||
|
||||
private TextView createLabel(String text) {
|
||||
TextView textView = new TextView(this);
|
||||
textView.setGravity(Gravity.CENTER);
|
||||
if (text == null) {
|
||||
textView.setText("---------------");
|
||||
} else {
|
||||
textView.setText(text);
|
||||
}
|
||||
return textView;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Copyright 2013 Hannes Janetzek
|
||||
* Copyright 2016 devemux86
|
||||
* Copyright 2016-2017 devemux86
|
||||
*
|
||||
* 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 org.oscim.backend.CanvasAdapter;
|
||||
import org.oscim.core.MapPosition;
|
||||
import org.oscim.core.MercatorProjection;
|
||||
import org.oscim.layers.GroupLayer;
|
||||
@@ -43,12 +42,16 @@ public class SimpleMapActivity extends BaseMapActivity {
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
createLayers();
|
||||
}
|
||||
|
||||
void createLayers() {
|
||||
GroupLayer groupLayer = new GroupLayer(mMap);
|
||||
groupLayer.layers.add(new BuildingLayer(mMap, mBaseLayer));
|
||||
groupLayer.layers.add(new LabelLayer(mMap, mBaseLayer));
|
||||
mMap.layers().add(groupLayer);
|
||||
|
||||
mapScaleBar = new DefaultMapScaleBar(mMap, CanvasAdapter.dpi / 160);
|
||||
mapScaleBar = new DefaultMapScaleBar(mMap);
|
||||
mapScaleBar.setScaleBarMode(DefaultMapScaleBar.ScaleBarMode.BOTH);
|
||||
mapScaleBar.setDistanceUnitAdapter(MetricUnitAdapter.INSTANCE);
|
||||
mapScaleBar.setSecondaryDistanceUnitAdapter(ImperialUnitAdapter.INSTANCE);
|
||||
@@ -57,7 +60,7 @@ public class SimpleMapActivity extends BaseMapActivity {
|
||||
MapScaleBarLayer mapScaleBarLayer = new MapScaleBarLayer(mMap, mapScaleBar);
|
||||
BitmapRenderer renderer = mapScaleBarLayer.getRenderer();
|
||||
renderer.setPosition(GLViewport.Position.BOTTOM_LEFT);
|
||||
renderer.setOffset(5 * CanvasAdapter.dpi / 160, 0);
|
||||
renderer.setOffset(5 * getResources().getDisplayMetrics().density, 0);
|
||||
mMap.layers().add(mapScaleBarLayer);
|
||||
|
||||
mMap.setTheme(VtmThemes.DEFAULT);
|
||||
@@ -65,7 +68,8 @@ public class SimpleMapActivity extends BaseMapActivity {
|
||||
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
mapScaleBar.destroy();
|
||||
if (mapScaleBar != null)
|
||||
mapScaleBar.destroy();
|
||||
|
||||
super.onDestroy();
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Copyright 2013 Hannes Janetzek
|
||||
* Copyright 2016 devemux86
|
||||
* Copyright 2016-2017 devemux86
|
||||
*
|
||||
* 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 org.oscim.backend.canvas.Color;
|
||||
import org.oscim.layers.TileGridLayer;
|
||||
import org.oscim.layers.vector.VectorLayer;
|
||||
import org.oscim.layers.vector.geometries.PointDrawable;
|
||||
import org.oscim.layers.vector.geometries.Style;
|
||||
import org.oscim.utils.ColorUtil;
|
||||
|
||||
import static org.oscim.tiling.source.bitmap.DefaultSources.STAMEN_TONER;
|
||||
|
||||
public class VectorLayerMapActivity extends BitmapTileMapActivity {
|
||||
|
||||
public VectorLayerMapActivity() {
|
||||
super(STAMEN_TONER.build());
|
||||
}
|
||||
public class VectorLayerMapActivity extends SimpleMapActivity {
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
mBitmapLayer.tileRenderer().setBitmapAlpha(0.5f);
|
||||
|
||||
VectorLayer vectorLayer = new VectorLayer(mMap);
|
||||
|
||||
@@ -95,7 +87,6 @@ public class VectorLayerMapActivity extends BitmapTileMapActivity {
|
||||
vectorLayer.update();
|
||||
|
||||
mMap.layers().add(vectorLayer);
|
||||
mMap.layers().add(new TileGridLayer(mMap, 0xff222222, 1.2f, 1));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Copyright 2013 Hannes Janetzek
|
||||
* Copyright 2016 devemux86
|
||||
* Copyright 2016-2017 devemux86
|
||||
*
|
||||
* 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());
|
||||
|
||||
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);
|
||||
|
||||
AndroidApplicationConfiguration cfg = new AndroidApplicationConfiguration();
|
||||
@@ -58,7 +58,7 @@ public class MainActivity extends AndroidApplication {
|
||||
@Override
|
||||
public void createLayers() {
|
||||
TileSource ts = new OSciMap4TileSource();
|
||||
initDefaultLayers(ts, true, true, true);
|
||||
initDefaultLayers(ts, true, true, true, getResources().getDisplayMetrics().density);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
/*
|
||||
* Copyright 2012 Hannes Janetzek
|
||||
* Copyright 2016-2017 devemux86
|
||||
*
|
||||
* This file is part of the OpenScienceMap project (http://www.opensciencemap.org).
|
||||
*
|
||||
@@ -48,13 +49,13 @@ public class MapView extends GLSurfaceView {
|
||||
|
||||
static final Logger log = LoggerFactory.getLogger(MapView.class);
|
||||
|
||||
static {
|
||||
private static void init() {
|
||||
System.loadLibrary("vtm-jni");
|
||||
}
|
||||
|
||||
protected final AndroidMap mMap;
|
||||
protected final GestureDetector mGestureDetector;
|
||||
protected final AndroidMotionEvent mMotionEvent;
|
||||
protected AndroidMap mMap;
|
||||
protected GestureDetector mGestureDetector;
|
||||
protected AndroidMotionEvent mMotionEvent;
|
||||
|
||||
public MapView(Context context) {
|
||||
this(context, null);
|
||||
@@ -63,19 +64,24 @@ public class MapView extends GLSurfaceView {
|
||||
public MapView(Context context, AttributeSet attributeSet) {
|
||||
super(context, attributeSet);
|
||||
|
||||
if (isInEditMode())
|
||||
return;
|
||||
|
||||
init();
|
||||
|
||||
/* Not sure if this makes sense */
|
||||
this.setWillNotDraw(true);
|
||||
this.setClickable(true);
|
||||
this.setFocusable(true);
|
||||
this.setFocusableInTouchMode(true);
|
||||
|
||||
/* Setup android backedn */
|
||||
/* Setup android backend */
|
||||
AndroidGraphics.init();
|
||||
AndroidAssets.init(context);
|
||||
GLAdapter.init(new AndroidGL());
|
||||
|
||||
DisplayMetrics metrics = getResources().getDisplayMetrics();
|
||||
CanvasAdapter.dpi = (int) Math.max(metrics.xdpi, metrics.ydpi);
|
||||
CanvasAdapter.dpi = (int) (metrics.scaledDensity * CanvasAdapter.DEFAULT_DPI);
|
||||
|
||||
/* Initialize the Map */
|
||||
mMap = new AndroidMap(this);
|
||||
@@ -94,15 +100,17 @@ public class MapView extends GLSurfaceView {
|
||||
mMap.clearMap();
|
||||
mMap.updateMap(false);
|
||||
|
||||
GestureHandler gestureHandler = new GestureHandler(mMap);
|
||||
mGestureDetector = new GestureDetector(context, gestureHandler);
|
||||
mGestureDetector.setOnDoubleTapListener(gestureHandler);
|
||||
if (!Map.NEW_GESTURES) {
|
||||
GestureHandler gestureHandler = new GestureHandler(mMap);
|
||||
mGestureDetector = new GestureDetector(context, gestureHandler);
|
||||
mGestureDetector.setOnDoubleTapListener(gestureHandler);
|
||||
}
|
||||
|
||||
mMotionEvent = new AndroidMotionEvent();
|
||||
}
|
||||
|
||||
public void onStop() {
|
||||
|
||||
public void onDestroy() {
|
||||
mMap.destroy();
|
||||
}
|
||||
|
||||
public void onPause() {
|
||||
@@ -116,14 +124,16 @@ public class MapView extends GLSurfaceView {
|
||||
@SuppressLint("ClickableViewAccessibility")
|
||||
@Override
|
||||
public boolean onTouchEvent(android.view.MotionEvent motionEvent) {
|
||||
|
||||
if (!isClickable())
|
||||
return false;
|
||||
|
||||
if (mGestureDetector.onTouchEvent(motionEvent))
|
||||
return true;
|
||||
if (mGestureDetector != null) {
|
||||
if (mGestureDetector.onTouchEvent(motionEvent))
|
||||
return true;
|
||||
}
|
||||
|
||||
mMap.input.fire(null, mMotionEvent.wrap(motionEvent));
|
||||
mMotionEvent.recycle();
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -133,8 +143,10 @@ public class MapView extends GLSurfaceView {
|
||||
|
||||
super.onSizeChanged(width, height, oldWidth, oldHeight);
|
||||
|
||||
if (width > 0 && height > 0)
|
||||
mMap.viewport().setScreenSize(width, height);
|
||||
if (!isInEditMode()) {
|
||||
if (width > 0 && height > 0)
|
||||
mMap.viewport().setScreenSize(width, height);
|
||||
}
|
||||
}
|
||||
|
||||
public Map map() {
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
/*
|
||||
* 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).
|
||||
*
|
||||
@@ -17,6 +19,7 @@
|
||||
*/
|
||||
package org.oscim.android.canvas;
|
||||
|
||||
import android.graphics.Color;
|
||||
import android.graphics.PorterDuff;
|
||||
|
||||
import org.oscim.backend.canvas.Bitmap;
|
||||
@@ -62,13 +65,26 @@ public class AndroidCanvas implements Canvas {
|
||||
}
|
||||
|
||||
@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);
|
||||
}
|
||||
|
||||
@Override
|
||||
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
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
/*
|
||||
* Copyright 2010, 2011, 2012 mapsforge.org
|
||||
* Copyright 2016 devemux86
|
||||
* Copyright 2017 Longri
|
||||
*
|
||||
* This file is part of the OpenScienceMap project (http://www.opensciencemap.org).
|
||||
*
|
||||
@@ -23,6 +24,7 @@ import android.graphics.drawable.BitmapDrawable;
|
||||
import android.graphics.drawable.Drawable;
|
||||
|
||||
import org.oscim.backend.CanvasAdapter;
|
||||
import org.oscim.backend.Platform;
|
||||
import org.oscim.backend.canvas.Bitmap;
|
||||
import org.oscim.backend.canvas.Canvas;
|
||||
import org.oscim.backend.canvas.Paint;
|
||||
@@ -36,6 +38,7 @@ public final class AndroidGraphics extends CanvasAdapter {
|
||||
|
||||
public static void init() {
|
||||
CanvasAdapter.init(new AndroidGraphics());
|
||||
CanvasAdapter.platform = Platform.ANDROID;
|
||||
}
|
||||
|
||||
public static android.graphics.Paint getAndroidPaint(Paint paint) {
|
||||
@@ -56,9 +59,9 @@ public final class AndroidGraphics extends CanvasAdapter {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Bitmap decodeSvgBitmapImpl(InputStream inputStream) {
|
||||
public Bitmap decodeSvgBitmapImpl(InputStream inputStream, int width, int height, int percent) {
|
||||
try {
|
||||
return new AndroidSvgBitmap(inputStream);
|
||||
return new AndroidSvgBitmap(inputStream, width, height, percent);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
return null;
|
||||
@@ -66,9 +69,9 @@ public final class AndroidGraphics extends CanvasAdapter {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Bitmap loadBitmapAssetImpl(String relativePathPrefix, String src) {
|
||||
public Bitmap loadBitmapAssetImpl(String relativePathPrefix, String src, int width, int height, int percent) {
|
||||
try {
|
||||
return createBitmap(relativePathPrefix, src);
|
||||
return createBitmap(relativePathPrefix, src, width, height, percent);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
/*
|
||||
* 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).
|
||||
*
|
||||
@@ -100,8 +101,7 @@ class AndroidPaint implements Paint {
|
||||
|
||||
@Override
|
||||
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
|
||||
@@ -134,6 +134,21 @@ class AndroidPaint implements Paint {
|
||||
return Math.abs(fm.bottom);
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getStrokeWidth() {
|
||||
return mPaint.getStrokeWidth();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Style getStyle() {
|
||||
switch (mPaint.getStyle()) {
|
||||
case STROKE:
|
||||
return Style.STROKE;
|
||||
default:
|
||||
return Style.FILL;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getTextHeight(String text) {
|
||||
mPaint.getTextBounds(text, 0, text.length(), rect);
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
/*
|
||||
* Copyright 2016 devemux86
|
||||
* Copyright 2010, 2011, 2012 mapsforge.org
|
||||
* Copyright 2013-2014 Ludwig M Brinckmann
|
||||
* Copyright 2014-2016 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
|
||||
@@ -74,13 +76,13 @@ public class AndroidSvgBitmap extends AndroidBitmap {
|
||||
}
|
||||
}
|
||||
|
||||
private static android.graphics.Bitmap getResourceBitmapImpl(InputStream inputStream) throws IOException {
|
||||
private static android.graphics.Bitmap getResourceBitmapImpl(InputStream inputStream, int width, int height, int percent) throws IOException {
|
||||
synchronized (SVG.getVersion()) {
|
||||
return getResourceBitmap(inputStream, CanvasAdapter.dpi / 160, DEFAULT_SIZE, 0, 0, 100);
|
||||
return getResourceBitmap(inputStream, CanvasAdapter.dpi / CanvasAdapter.DEFAULT_DPI, DEFAULT_SIZE, width, height, percent);
|
||||
}
|
||||
}
|
||||
|
||||
public AndroidSvgBitmap(InputStream inputStream) throws IOException {
|
||||
super(getResourceBitmapImpl(inputStream));
|
||||
public AndroidSvgBitmap(InputStream inputStream, int width, int height, int percent) throws IOException {
|
||||
super(getResourceBitmapImpl(inputStream, width, height, percent));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
/*
|
||||
* Copyright 2013 Hannes Janetzek
|
||||
* Copyright 2016 Andrey Novikov
|
||||
*
|
||||
* This file is part of the OpenScienceMap project (http://www.opensciencemap.org).
|
||||
*
|
||||
@@ -20,10 +21,10 @@ import org.oscim.event.MotionEvent;
|
||||
|
||||
public class AndroidMotionEvent extends MotionEvent {
|
||||
|
||||
android.view.MotionEvent mEvent;
|
||||
private android.view.MotionEvent mEvent;
|
||||
|
||||
public MotionEvent wrap(android.view.MotionEvent e) {
|
||||
mEvent = e;
|
||||
mEvent = android.view.MotionEvent.obtain(e);
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -57,6 +58,16 @@ public class AndroidMotionEvent extends MotionEvent {
|
||||
return mEvent.getPointerCount();
|
||||
}
|
||||
|
||||
@Override
|
||||
public MotionEvent copy() {
|
||||
return new AndroidMotionEvent().wrap(mEvent);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void recycle() {
|
||||
mEvent.recycle();
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getTime() {
|
||||
return mEvent.getEventTime();
|
||||
|
||||
@@ -1,3 +1,20 @@
|
||||
/*
|
||||
* Copyright 2013 Hannes Janetzek
|
||||
* Copyright 2016 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.android.input;
|
||||
|
||||
import android.view.GestureDetector.OnDoubleTapListener;
|
||||
@@ -11,16 +28,18 @@ public class GestureHandler implements OnGestureListener, OnDoubleTapListener {
|
||||
private final AndroidMotionEvent mMotionEvent;
|
||||
private final Map mMap;
|
||||
|
||||
// Quick scale (double tap + swipe)
|
||||
protected boolean quickScale;
|
||||
|
||||
public GestureHandler(Map map) {
|
||||
mMotionEvent = new AndroidMotionEvent();
|
||||
mMap = map;
|
||||
}
|
||||
|
||||
/* GesturListener */
|
||||
/* OnGestureListener */
|
||||
|
||||
@Override
|
||||
public boolean onSingleTapUp(MotionEvent e) {
|
||||
// return mMap.handleGesture(Gesture.TAP, mMotionEvent.wrap(e));
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -35,6 +54,10 @@ public class GestureHandler implements OnGestureListener, OnDoubleTapListener {
|
||||
|
||||
@Override
|
||||
public void onLongPress(MotionEvent e) {
|
||||
// Quick scale (no long press)
|
||||
if (quickScale)
|
||||
return;
|
||||
|
||||
mMap.handleGesture(Gesture.LONG_PRESS, mMotionEvent.wrap(e));
|
||||
}
|
||||
|
||||
@@ -45,10 +68,13 @@ public class GestureHandler implements OnGestureListener, OnDoubleTapListener {
|
||||
|
||||
@Override
|
||||
public boolean onDown(MotionEvent e) {
|
||||
quickScale = false;
|
||||
|
||||
return mMap.handleGesture(Gesture.PRESS, mMotionEvent.wrap(e));
|
||||
}
|
||||
|
||||
/* DoubleTapListener */
|
||||
/* OnDoubleTapListener */
|
||||
|
||||
@Override
|
||||
public boolean onSingleTapConfirmed(MotionEvent e) {
|
||||
return mMap.handleGesture(Gesture.TAP, mMotionEvent.wrap(e));
|
||||
@@ -56,6 +82,11 @@ public class GestureHandler implements OnGestureListener, OnDoubleTapListener {
|
||||
|
||||
@Override
|
||||
public boolean onDoubleTapEvent(MotionEvent e) {
|
||||
int action = e.getActionMasked();
|
||||
|
||||
// Quick scale
|
||||
quickScale = (action == MotionEvent.ACTION_MOVE);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* 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
|
||||
* 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 final InputStream mInputStream;
|
||||
private final XmlRenderThemeMenuCallback mMenuCallback;
|
||||
private XmlRenderThemeMenuCallback mMenuCallback;
|
||||
private final String mRelativePathPrefix;
|
||||
|
||||
/**
|
||||
@@ -96,4 +96,9 @@ public class AssetsRenderTheme implements ThemeFile {
|
||||
public InputStream getRenderThemeAsStream() throws ThemeException {
|
||||
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-extras')
|
||||
compile 'com.noveogroup.android:android-logger:1.3.6'
|
||||
compile 'com.squareup.okhttp:okhttp:2.6.0'
|
||||
compile 'com.squareup.okhttp3:okhttp:3.8.0'
|
||||
}
|
||||
|
||||
android {
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
/*
|
||||
* Copyright 2010, 2011, 2012 mapsforge.org
|
||||
* Copyright 2013 Hannes Janetzek
|
||||
* Copyright 2017 devemux86
|
||||
*
|
||||
* This file is part of the OpenScienceMap project (http://www.opensciencemap.org).
|
||||
*
|
||||
@@ -60,14 +61,12 @@ public abstract class MapActivity extends Activity {
|
||||
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
mMapView.onDestroy();
|
||||
super.onDestroy();
|
||||
mMap.destroy();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPause() {
|
||||
super.onPause();
|
||||
|
||||
Editor editor = getSharedPreferences(PREFERENCES_FILE, MODE_PRIVATE).edit();
|
||||
editor.clear();
|
||||
|
||||
@@ -82,7 +81,9 @@ public abstract class MapActivity extends Activity {
|
||||
editor.putInt(KEY_LONGITUDE, geoPoint.longitudeE6);
|
||||
editor.putFloat(KEY_MAP_SCALE, (float) mapPosition.scale);
|
||||
|
||||
editor.commit();
|
||||
editor.apply();
|
||||
|
||||
super.onPause();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -93,8 +94,8 @@ public abstract class MapActivity extends Activity {
|
||||
|
||||
@Override
|
||||
protected void onStop() {
|
||||
super.onStop();
|
||||
mMapView.onPause();
|
||||
super.onStop();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -148,13 +148,13 @@ public class MapLayers {
|
||||
|
||||
}
|
||||
|
||||
void enableGridOverlay(boolean enable) {
|
||||
void enableGridOverlay(Context context, boolean enable) {
|
||||
if (mGridEnabled == enable)
|
||||
return;
|
||||
|
||||
if (enable) {
|
||||
if (mGridOverlay == null)
|
||||
mGridOverlay = new TileGridLayer(App.map);
|
||||
mGridOverlay = new TileGridLayer(App.map, context.getResources().getDisplayMetrics().density);
|
||||
|
||||
App.map.layers().add(mGridOverlay);
|
||||
} else {
|
||||
|
||||
@@ -205,7 +205,7 @@ public class TileMap extends MapActivity implements MapEventsReceiver {
|
||||
break;
|
||||
|
||||
case R.id.menu_layer_grid:
|
||||
mMapLayers.enableGridOverlay(!mMapLayers.isGridEnabled());
|
||||
mMapLayers.enableGridOverlay(this, !mMapLayers.isGridEnabled());
|
||||
mMap.updateMap(true);
|
||||
break;
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* Copyright 2013 Ahmad Saleem
|
||||
* 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
|
||||
* 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);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasRotation() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public synchronized float getRotation() {
|
||||
return mCurRotation;
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
* Copyright 2010, 2011, 2012 mapsforge.org
|
||||
* Copyright 2013 Hannes Janetzek
|
||||
* Copyright 2013 Ahmad Al-saleem
|
||||
* Copyright 2016 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
|
||||
@@ -31,7 +32,7 @@ import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
public class LocationHandler implements LocationListener {
|
||||
final static Logger log = LoggerFactory.getLogger(LocationHandler.class);
|
||||
private final static Logger log = LoggerFactory.getLogger(LocationHandler.class);
|
||||
|
||||
public enum Mode {
|
||||
OFF,
|
||||
@@ -43,7 +44,7 @@ public class LocationHandler implements LocationListener {
|
||||
private final static int SHOW_LOCATION_ZOOM = 14;
|
||||
|
||||
private final LocationManager mLocationManager;
|
||||
private final LocationOverlay mLocationOverlay;
|
||||
private final LocationLayerImpl mLocationLayer;
|
||||
|
||||
private Mode mMode = Mode.OFF;
|
||||
|
||||
@@ -54,7 +55,7 @@ public class LocationHandler implements LocationListener {
|
||||
mLocationManager = (LocationManager) tileMap
|
||||
.getSystemService(Context.LOCATION_SERVICE);
|
||||
|
||||
mLocationOverlay = new LocationOverlay(App.map, compass);
|
||||
mLocationLayer = new LocationLayerImpl(App.map, compass);
|
||||
|
||||
mMapPosition = new MapPosition();
|
||||
}
|
||||
@@ -115,13 +116,13 @@ public class LocationHandler implements LocationListener {
|
||||
if (location == null)
|
||||
return false;
|
||||
|
||||
mLocationOverlay.setEnabled(true);
|
||||
mLocationOverlay.setPosition(location.getLatitude(),
|
||||
mLocationLayer.setEnabled(true);
|
||||
mLocationLayer.setPosition(location.getLatitude(),
|
||||
location.getLongitude(),
|
||||
location.getAccuracy());
|
||||
|
||||
// FIXME -> implement LayerGroup
|
||||
App.map.layers().add(4, mLocationOverlay);
|
||||
App.map.layers().add(4, mLocationLayer);
|
||||
|
||||
App.map.updateMap(true);
|
||||
return true;
|
||||
@@ -133,9 +134,9 @@ public class LocationHandler implements LocationListener {
|
||||
private boolean disableShowMyLocation() {
|
||||
|
||||
mLocationManager.removeUpdates(this);
|
||||
mLocationOverlay.setEnabled(false);
|
||||
mLocationLayer.setEnabled(false);
|
||||
|
||||
App.map.layers().remove(mLocationOverlay);
|
||||
App.map.layers().remove(mLocationLayer);
|
||||
App.map.updateMap(true);
|
||||
|
||||
return true;
|
||||
@@ -199,7 +200,7 @@ public class LocationHandler implements LocationListener {
|
||||
App.map.setMapPosition(mMapPosition);
|
||||
}
|
||||
|
||||
mLocationOverlay.setPosition(lat, lon, location.getAccuracy());
|
||||
mLocationLayer.setPosition(lat, lon, location.getAccuracy());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
39
vtm-app/src/org/oscim/app/location/LocationLayerImpl.java
Normal file
@@ -0,0 +1,39 @@
|
||||
/*
|
||||
* Copyright 2013 Ahmad Saleem
|
||||
* Copyright 2013 Hannes Janetzek
|
||||
* Copyright 2016 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.app.location;
|
||||
|
||||
import org.oscim.layers.LocationLayer;
|
||||
import org.oscim.map.Map;
|
||||
|
||||
class LocationLayerImpl extends LocationLayer {
|
||||
private final Compass mCompass;
|
||||
|
||||
LocationLayerImpl(Map map, Compass compass) {
|
||||
super(map);
|
||||
mCompass = compass;
|
||||
|
||||
locationRenderer.setCallback(compass);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setEnabled(boolean enabled) {
|
||||
super.setEnabled(enabled);
|
||||
|
||||
if (mCompass != null)
|
||||
mCompass.setEnabled(enabled);
|
||||
}
|
||||
}
|
||||
@@ -2,25 +2,26 @@ package org.osmdroid.utils;
|
||||
|
||||
import android.util.Log;
|
||||
|
||||
import com.squareup.okhttp.OkHttpClient;
|
||||
import com.squareup.okhttp.Request;
|
||||
import com.squareup.okhttp.Response;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import okhttp3.OkHttpClient;
|
||||
import okhttp3.OkHttpClient.Builder;
|
||||
import okhttp3.Request;
|
||||
import okhttp3.Response;
|
||||
|
||||
/**
|
||||
* A "very very simple to use" class for performing http get and post requests.
|
||||
* So many ways to do that, and potential subtle issues.
|
||||
* If complexity should be added to handle even more issues, complexity should be put here and only here.
|
||||
* <p/>
|
||||
* <p>
|
||||
* Typical usage:
|
||||
* <pre>HttpConnection connection = new HttpConnection();
|
||||
* connection.doGet("http://www.google.com");
|
||||
* InputStream stream = connection.getStream();
|
||||
* if (stream != null) {
|
||||
* //use this stream, for buffer reading, or XML SAX parsing, or whatever...
|
||||
* //use this stream, for buffer reading, or XML SAX parsing, or whatever...
|
||||
* }
|
||||
* connection.close();</pre>
|
||||
*/
|
||||
@@ -35,9 +36,14 @@ public class HttpConnection {
|
||||
|
||||
private static OkHttpClient getOkHttpClient() {
|
||||
if (client == null) {
|
||||
client = new OkHttpClient();
|
||||
Builder b = new Builder();
|
||||
b.connectTimeout(TIMEOUT_CONNECTION, TimeUnit.MILLISECONDS);
|
||||
b.readTimeout(TIMEOUT_SOCKET, TimeUnit.MILLISECONDS);
|
||||
client = b.build();
|
||||
/*
|
||||
client.setConnectTimeout(TIMEOUT_CONNECTION, TimeUnit.MILLISECONDS);
|
||||
client.setReadTimeout(TIMEOUT_SOCKET, TimeUnit.MILLISECONDS);
|
||||
*/
|
||||
}
|
||||
return client;
|
||||
}
|
||||
@@ -73,15 +79,10 @@ public class HttpConnection {
|
||||
* @return the opened InputStream, or null if creation failed for any reason.
|
||||
*/
|
||||
public InputStream getStream() {
|
||||
try {
|
||||
if (response == null)
|
||||
return null;
|
||||
stream = response.body().byteStream();
|
||||
return stream;
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
if (response == null)
|
||||
return null;
|
||||
}
|
||||
stream = response.body().byteStream();
|
||||
return stream;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -8,7 +8,7 @@ dependencies {
|
||||
}
|
||||
compile "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-desktop"
|
||||
compile "com.badlogicgames.gdx:gdx-backend-lwjgl:$gdxVersion"
|
||||
compile 'com.kitfox.svg:svg-salamander:1.0'
|
||||
compile 'com.metsci.ext.com.kitfox.svg:svg-salamander:0.1.19'
|
||||
}
|
||||
|
||||
sourceSets {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* Copyright 2013 Hannes Janetzek
|
||||
* Copyright 2016 devemux86
|
||||
* Copyright 2016 Longri
|
||||
* Copyright 2016-2017 devemux86
|
||||
* Copyright 2016-2017 Longri
|
||||
*
|
||||
* This file is part of the OpenScienceMap project (http://www.opensciencemap.org).
|
||||
*
|
||||
@@ -47,7 +47,7 @@ public class AwtBitmap implements Bitmap {
|
||||
boolean internal;
|
||||
|
||||
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.height = height;
|
||||
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
/*
|
||||
* Copyright 2010, 2011, 2012, 2013 mapsforge.org
|
||||
* 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).
|
||||
*
|
||||
@@ -26,11 +28,13 @@ import org.oscim.backend.canvas.Paint;
|
||||
import java.awt.AlphaComposite;
|
||||
import java.awt.Composite;
|
||||
import java.awt.Graphics2D;
|
||||
import java.awt.Image;
|
||||
import java.awt.RenderingHints;
|
||||
import java.awt.Shape;
|
||||
import java.awt.font.TextLayout;
|
||||
import java.awt.geom.AffineTransform;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.awt.image.DataBufferInt;
|
||||
|
||||
public class AwtCanvas implements Canvas {
|
||||
|
||||
@@ -126,23 +130,62 @@ public class AwtCanvas implements Canvas {
|
||||
|
||||
@Override
|
||||
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
|
||||
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;
|
||||
this.canvas.setColor(awtPaint.color);
|
||||
if (awtPaint.stroke != null)
|
||||
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
|
||||
public void fillColor(int color) {
|
||||
java.awt.Color awtColor = color == Color.TRANSPARENT ? TRANSPARENT : new java.awt.Color(color);
|
||||
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.fillRect(0, 0, getWidth(), getHeight());
|
||||
this.canvas.setComposite(originalComposite);
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
/*
|
||||
* Copyright 2013 Hannes Janetzek
|
||||
* Copyright 2016 devemux86
|
||||
* Copyright 2017 Longri
|
||||
*
|
||||
* This file is part of the OpenScienceMap project (http://www.opensciencemap.org).
|
||||
*
|
||||
@@ -18,6 +19,7 @@
|
||||
package org.oscim.awt;
|
||||
|
||||
import org.oscim.backend.CanvasAdapter;
|
||||
import org.oscim.backend.Platform;
|
||||
import org.oscim.backend.canvas.Bitmap;
|
||||
import org.oscim.backend.canvas.Canvas;
|
||||
import org.oscim.backend.canvas.Paint;
|
||||
@@ -29,11 +31,20 @@ import java.awt.RenderingHints;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.util.Locale;
|
||||
|
||||
public class AwtGraphics extends CanvasAdapter {
|
||||
|
||||
public static void init() {
|
||||
CanvasAdapter.init(new AwtGraphics());
|
||||
|
||||
String os = System.getProperty("os.name").toLowerCase(Locale.ENGLISH);
|
||||
if (os.contains("win"))
|
||||
CanvasAdapter.platform = Platform.WINDOWS;
|
||||
else if (os.contains("mac"))
|
||||
CanvasAdapter.platform = Platform.MACOS;
|
||||
else
|
||||
CanvasAdapter.platform = Platform.LINUX;
|
||||
}
|
||||
|
||||
public static BufferedImage getBitmap(Bitmap bitmap) {
|
||||
@@ -103,9 +114,9 @@ public class AwtGraphics extends CanvasAdapter {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Bitmap decodeSvgBitmapImpl(InputStream inputStream) {
|
||||
public Bitmap decodeSvgBitmapImpl(InputStream inputStream, int width, int height, int percent) {
|
||||
try {
|
||||
return new AwtSvgBitmap(inputStream);
|
||||
return new AwtSvgBitmap(inputStream, width, height, percent);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
return null;
|
||||
@@ -113,9 +124,9 @@ public class AwtGraphics extends CanvasAdapter {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Bitmap loadBitmapAssetImpl(String relativePathPrefix, String src) {
|
||||
public Bitmap loadBitmapAssetImpl(String relativePathPrefix, String src, int width, int height, int percent) {
|
||||
try {
|
||||
return createBitmap(relativePathPrefix, src);
|
||||
return createBitmap(relativePathPrefix, src, width, height, percent);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
/*
|
||||
* Copyright 2010, 2011, 2012, 2013 mapsforge.org
|
||||
* 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).
|
||||
*
|
||||
@@ -91,32 +92,33 @@ public class AwtPaint implements Paint {
|
||||
throw new IllegalArgumentException("unknown cap: " + join);
|
||||
}
|
||||
|
||||
static final Font defaultFont;
|
||||
private static final Map<Attribute, Object> textAttributes = new HashMap<>();
|
||||
private static final Font DEFAULT_FONT;
|
||||
private static final Map<Attribute, Object> TEXT_ATTRIBUTES = new HashMap<>();
|
||||
|
||||
static {
|
||||
textAttributes.put(TextAttribute.KERNING, TextAttribute.KERNING_ON);
|
||||
TEXT_ATTRIBUTES.put(TextAttribute.KERNING, TextAttribute.KERNING_ON);
|
||||
|
||||
defaultFont = new Font("Arial", Font.PLAIN, 14).deriveFont(textAttributes);
|
||||
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);
|
||||
FontMetrics fm;
|
||||
Font font = defaultFont; // new Font("Default", Font.PLAIN, 13);
|
||||
Font font = DEFAULT_FONT; // new Font("Default", Font.PLAIN, 13);
|
||||
Stroke stroke;
|
||||
Style style = Style.FILL;
|
||||
private int cap = getCap(Cap.BUTT);
|
||||
private String fontName = defaultFont.getFontName();
|
||||
private int fontStyle = defaultFont.getStyle();
|
||||
private String fontName = DEFAULT_FONT.getFontName();
|
||||
private int fontStyle = DEFAULT_FONT.getStyle();
|
||||
private int join = getJoin(Join.MITER);
|
||||
private float strokeWidth;
|
||||
private float textSize = defaultFont.getSize();
|
||||
private float textSize = DEFAULT_FONT.getSize();
|
||||
|
||||
private final BufferedImage bufferedImage = new BufferedImage(1, 1, BufferedImage.TYPE_INT_ARGB);
|
||||
|
||||
@Override
|
||||
public int getColor() {
|
||||
return 0;
|
||||
return color.getRGB();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -155,8 +157,8 @@ public class AwtPaint implements Paint {
|
||||
|
||||
@Override
|
||||
public void setTextAlign(Align align) {
|
||||
// Align text in text layer
|
||||
//this.align = align;
|
||||
// TODO never read
|
||||
this.align = align;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -169,7 +171,7 @@ public class AwtPaint implements Paint {
|
||||
public void setTypeface(FontFamily fontFamily, FontStyle fontStyle) {
|
||||
this.fontName = getFontName(fontFamily);
|
||||
this.fontStyle = getFontStyle(fontStyle);
|
||||
this.font = new Font(this.fontName, this.fontStyle, (int) this.textSize).deriveFont(this.textAttributes);
|
||||
this.font = new Font(this.fontName, this.fontStyle, (int) this.textSize).deriveFont(this.TEXT_ATTRIBUTES);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -212,6 +214,16 @@ public class AwtPaint implements Paint {
|
||||
stroke = new BasicStroke(strokeWidth, cap, join, join == BasicStroke.JOIN_MITER ? 1.0f : 0, null, 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getStrokeWidth() {
|
||||
return strokeWidth;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Style getStyle() {
|
||||
return style;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getTextHeight(String text) {
|
||||
Graphics2D graphics2d = bufferedImage.createGraphics();
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2016 devemux86
|
||||
* Copyright 2015-2016 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
|
||||
@@ -28,7 +28,7 @@ import java.net.URI;
|
||||
|
||||
public class AwtSvgBitmap extends AwtBitmap {
|
||||
/**
|
||||
* Default size is 20x20px (400px) at 240dpi.
|
||||
* Default size is 20x20px (400px) at 160dpi.
|
||||
*/
|
||||
public static float DEFAULT_SIZE = 400f;
|
||||
|
||||
@@ -77,13 +77,13 @@ public class AwtSvgBitmap extends AwtBitmap {
|
||||
}
|
||||
}
|
||||
|
||||
private static BufferedImage getResourceBitmapImpl(InputStream inputStream) throws IOException {
|
||||
private static BufferedImage getResourceBitmapImpl(InputStream inputStream, int width, int height, int percent) throws IOException {
|
||||
synchronized (SVGCache.getSVGUniverse()) {
|
||||
return getResourceBitmap(inputStream, CanvasAdapter.dpi / 240, DEFAULT_SIZE, 0, 0, 100);
|
||||
return getResourceBitmap(inputStream, CanvasAdapter.dpi / CanvasAdapter.DEFAULT_DPI, DEFAULT_SIZE, width, height, percent);
|
||||
}
|
||||
}
|
||||
|
||||
public AwtSvgBitmap(InputStream inputStream) throws IOException {
|
||||
super(getResourceBitmapImpl(inputStream));
|
||||
public AwtSvgBitmap(InputStream inputStream, int width, int height, int percent) throws IOException {
|
||||
super(getResourceBitmapImpl(inputStream, width, height, percent));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Copyright 2013 Hannes Janetzek
|
||||
* Copyright 2016 devemux86
|
||||
* Copyright 2016-2017 devemux86
|
||||
*
|
||||
* This file is part of the OpenScienceMap project (http://www.opensciencemap.org).
|
||||
*
|
||||
@@ -41,12 +41,11 @@ public class GdxMapApp extends GdxMap {
|
||||
AwtGraphics.init();
|
||||
GdxAssets.init("assets/");
|
||||
GLAdapter.init(new LwjglGL20());
|
||||
GLAdapter.GDX_DESKTOP_QUIRKS = true;
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
init();
|
||||
new LwjglApplication(new GdxMapApp(), getConfig());
|
||||
new LwjglApplication(new GdxMapApp(), getConfig(null));
|
||||
}
|
||||
|
||||
public static void run(GdxMap map) {
|
||||
@@ -56,12 +55,13 @@ public class GdxMapApp extends GdxMap {
|
||||
public static void run(GdxMap map, LwjglApplicationConfiguration config, int tileSize) {
|
||||
Tile.SIZE = FastMath.clamp(tileSize, 128, 512);
|
||||
|
||||
new LwjglApplication(map, (config == null ? getConfig() : config));
|
||||
new LwjglApplication(map, (config == null ? getConfig(map.getClass().getSimpleName()) : config));
|
||||
}
|
||||
|
||||
static protected LwjglApplicationConfiguration getConfig() {
|
||||
protected static LwjglApplicationConfiguration getConfig(String title) {
|
||||
LwjglApplicationConfiguration.disableAudio = true;
|
||||
LwjglApplicationConfiguration cfg = new LwjglApplicationConfiguration();
|
||||
cfg.title = "vtm-gdx";
|
||||
cfg.title = title != null ? title : "vtm-gdx";
|
||||
cfg.width = 800;
|
||||
cfg.height = 600;
|
||||
cfg.stencil = 8;
|
||||
@@ -75,15 +75,8 @@ public class GdxMapApp extends GdxMap {
|
||||
public void createLayers() {
|
||||
TileSource tileSource = new OSciMap4TileSource();
|
||||
|
||||
// TileSource tileSource = new MapFileTileSource();
|
||||
// tileSource.setOption("file", "/home/jeff/germany.map");
|
||||
|
||||
initDefaultLayers(tileSource, false, true, true);
|
||||
|
||||
//mMap.getLayers().add(new BitmapTileLayer(mMap, new ImagicoLandcover(), 20));
|
||||
//mMap.getLayers().add(new BitmapTileLayer(mMap, new OSMTileSource(), 20));
|
||||
//mMap.getLayers().add(new BitmapTileLayer(mMap, new ArcGISWorldShaded(), 20));
|
||||
|
||||
mMap.setMapPosition(0, 0, 1 << 2);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,10 +3,10 @@ apply plugin: 'maven'
|
||||
|
||||
dependencies {
|
||||
compile project(':vtm')
|
||||
compile 'com.fasterxml.jackson.core:jackson-core:2.3.0'
|
||||
compile 'com.google.protobuf:protobuf-java:2.4.1'
|
||||
compile 'com.vividsolutions:jts:1.13'
|
||||
compile 'org.openstreetmap.osmosis:osmosis-osm-binary:0.44.1'
|
||||
compile 'com.fasterxml.jackson.core:jackson-core:2.8.4'
|
||||
compile 'com.google.protobuf:protobuf-java:2.6.1'
|
||||
compile 'com.vividsolutions:jts-core:1.14.0'
|
||||
compile 'org.openstreetmap.osmosis:osmosis-osm-binary:0.45'
|
||||
}
|
||||
|
||||
sourceSets {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Copyright 2013 Hannes Janetzek
|
||||
* Copyright 2016 devemux86
|
||||
* Copyright 2016-2017 devemux86
|
||||
*
|
||||
* This file is part of the OpenScienceMap project (http://www.opensciencemap.org).
|
||||
*
|
||||
@@ -40,13 +40,18 @@ public abstract class GdxMap implements ApplicationListener {
|
||||
protected Map mMap;
|
||||
protected GestureDetector mGestureDetector;
|
||||
|
||||
private MapRenderer mMapRenderer;
|
||||
protected MapRenderer mMapRenderer;
|
||||
|
||||
public GdxMap() {
|
||||
}
|
||||
|
||||
protected void initDefaultLayers(TileSource tileSource, boolean tileGrid, boolean labels,
|
||||
boolean buildings) {
|
||||
initDefaultLayers(tileSource, tileGrid, labels, buildings, 1);
|
||||
}
|
||||
|
||||
protected void initDefaultLayers(TileSource tileSource, boolean tileGrid, boolean labels,
|
||||
boolean buildings, float scale) {
|
||||
Layers layers = mMap.layers();
|
||||
|
||||
if (tileSource != null) {
|
||||
@@ -61,7 +66,7 @@ public abstract class GdxMap implements ApplicationListener {
|
||||
}
|
||||
|
||||
if (tileGrid)
|
||||
layers.add(new TileGridLayer(mMap));
|
||||
layers.add(new TileGridLayer(mMap, scale));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -80,11 +85,11 @@ public abstract class GdxMap implements ApplicationListener {
|
||||
mMapRenderer.onSurfaceChanged(w, h);
|
||||
|
||||
InputMultiplexer mux = new InputMultiplexer();
|
||||
mGestureDetector = new GestureDetector(new LayerHandler(mMap));
|
||||
mux.addProcessor(mGestureDetector);
|
||||
if (!Map.NEW_GESTURES) {
|
||||
mGestureDetector = new GestureDetector(new GestureHandlerImpl(mMap));
|
||||
mux.addProcessor(mGestureDetector);
|
||||
}
|
||||
mux.addProcessor(new InputHandler(this));
|
||||
//mux.addProcessor(new GestureDetector(20, 0.5f, 2, 0.05f,
|
||||
// new MapController(mMap)));
|
||||
mux.addProcessor(new MotionHandler(mMap));
|
||||
|
||||
Gdx.input.setInputProcessor(mux);
|
||||
|
||||
@@ -49,6 +49,15 @@ public class GdxMotionEvent extends MotionEvent {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public MotionEvent copy() {
|
||||
return new GdxMotionEvent(action, x, y, button);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void recycle() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getTime() {
|
||||
return 0;
|
||||
|
||||
@@ -14,28 +14,42 @@
|
||||
*/
|
||||
package org.oscim.gdx;
|
||||
|
||||
import com.badlogic.gdx.Input;
|
||||
import com.badlogic.gdx.input.GestureDetector;
|
||||
|
||||
import org.oscim.event.Gesture;
|
||||
import org.oscim.event.MotionEvent;
|
||||
import org.oscim.map.Map;
|
||||
|
||||
public class LayerHandler extends GestureDetector.GestureAdapter {
|
||||
public class GestureHandlerImpl extends GestureDetector.GestureAdapter {
|
||||
|
||||
private final Map map;
|
||||
|
||||
public LayerHandler(Map map) {
|
||||
public GestureHandlerImpl(Map map) {
|
||||
this.map = map;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean longPress(float x, float y) {
|
||||
// Handle gesture on layers
|
||||
map.handleGesture(Gesture.LONG_PRESS, new GdxMotionEvent(MotionEvent.ACTION_DOWN, x, y));
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean tap(float x, float y, int count, int button) {
|
||||
// Handle double tap zoom
|
||||
if (button == Input.Buttons.LEFT) {
|
||||
if (count == 2) {
|
||||
float pivotX = x - map.getWidth() / 2;
|
||||
float pivotY = y - map.getHeight() / 2;
|
||||
map.animator().animateZoom(300, 2, pivotX, pivotY);
|
||||
map.updateMap(true);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// Handle gesture on layers
|
||||
map.handleGesture(Gesture.TAP, new GdxMotionEvent(MotionEvent.ACTION_UP, x, y, button));
|
||||
return false;
|
||||
}
|
||||
@@ -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).
|
||||
*
|
||||
@@ -22,10 +24,16 @@ import com.badlogic.gdx.Input.Buttons;
|
||||
import com.badlogic.gdx.InputProcessor;
|
||||
|
||||
import org.oscim.layers.GenericLayer;
|
||||
import org.oscim.layers.GroupLayer;
|
||||
import org.oscim.layers.Layer;
|
||||
import org.oscim.layers.TileGridLayer;
|
||||
import org.oscim.layers.tile.buildings.BuildingLayer;
|
||||
import org.oscim.map.Map;
|
||||
import org.oscim.map.ViewController;
|
||||
import org.oscim.theme.VtmThemes;
|
||||
import org.oscim.utils.Easing;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class InputHandler implements InputProcessor {
|
||||
|
||||
@@ -86,35 +94,45 @@ public class InputHandler implements InputProcessor {
|
||||
mViewport.moveMap(50, 0);
|
||||
mMap.updateMap(true);
|
||||
break;
|
||||
case Input.Keys.M:
|
||||
case Input.Keys.D:
|
||||
mViewport.scaleMap(1.05f, 0, 0);
|
||||
mMap.updateMap(true);
|
||||
break;
|
||||
case Input.Keys.N:
|
||||
case Input.Keys.A:
|
||||
mViewport.scaleMap(0.95f, 0, 0);
|
||||
mMap.updateMap(true);
|
||||
break;
|
||||
case Input.Keys.NUM_1:
|
||||
case Input.Keys.S:
|
||||
mMap.animator().animateZoom(500, 0.5, 0, 0);
|
||||
mMap.updateMap(false);
|
||||
break;
|
||||
case Input.Keys.NUM_2:
|
||||
case Input.Keys.W:
|
||||
mMap.animator().animateZoom(500, 2, 0, 0);
|
||||
mMap.updateMap(false);
|
||||
break;
|
||||
|
||||
case Input.Keys.D:
|
||||
case Input.Keys.NUM_1:
|
||||
mMap.setTheme(VtmThemes.DEFAULT);
|
||||
mMap.updateMap(false);
|
||||
break;
|
||||
|
||||
case Input.Keys.T:
|
||||
case Input.Keys.NUM_2:
|
||||
mMap.setTheme(VtmThemes.OSMARENDER);
|
||||
mMap.updateMap(false);
|
||||
break;
|
||||
|
||||
case Input.Keys.NUM_3:
|
||||
mMap.setTheme(VtmThemes.OSMAGRAY);
|
||||
mMap.updateMap(false);
|
||||
break;
|
||||
|
||||
case Input.Keys.NUM_4:
|
||||
mMap.setTheme(VtmThemes.TRONRENDER);
|
||||
mMap.updateMap(false);
|
||||
break;
|
||||
|
||||
case Input.Keys.R:
|
||||
mMap.setTheme(VtmThemes.OSMARENDER);
|
||||
case Input.Keys.NUM_5:
|
||||
mMap.setTheme(VtmThemes.NEWTRON);
|
||||
mMap.updateMap(false);
|
||||
break;
|
||||
|
||||
@@ -134,6 +152,11 @@ public class InputHandler implements InputProcessor {
|
||||
}
|
||||
mMap.render();
|
||||
break;
|
||||
|
||||
case Input.Keys.B:
|
||||
toggleBuildingLayer(mMap.layers());
|
||||
mMap.render();
|
||||
break;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@@ -227,8 +250,22 @@ public class InputHandler implements InputProcessor {
|
||||
public boolean scrolled(int amount) {
|
||||
float fx = mPosX - mMap.getWidth() / 2;
|
||||
float fy = mPosY - mMap.getHeight() / 2;
|
||||
mMap.animator().animateZoom(250, amount > 0 ? 0.75f : 1.333f, fx, fy);
|
||||
mMap.animator().animateZoom(250, amount > 0 ? 0.75f : 1.333f, fx, fy, Easing.Type.LINEAR);
|
||||
mMap.updateMap(false);
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,6 +23,8 @@ import com.badlogic.gdx.InputProcessor;
|
||||
import org.oscim.event.MotionEvent;
|
||||
import org.oscim.map.Map;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
public class MotionHandler extends MotionEvent implements InputProcessor {
|
||||
private final Map mMap;
|
||||
|
||||
@@ -77,6 +79,25 @@ public class MotionHandler extends MotionEvent implements InputProcessor {
|
||||
return mPointerDown;
|
||||
}
|
||||
|
||||
@Override
|
||||
public MotionEvent copy() {
|
||||
MotionHandler handler = new MotionHandler(mMap);
|
||||
handler.mPointerDown = mPointerDown;
|
||||
handler.mDownTime = mDownTime;
|
||||
handler.mType = mType;
|
||||
handler.mPointer = mPointer;
|
||||
handler.mCurX = mCurX;
|
||||
handler.mCurY = mCurY;
|
||||
handler.mPointerX = Arrays.copyOf(mPointerX, 10);
|
||||
handler.mPointerY = Arrays.copyOf(mPointerY, 10);
|
||||
handler.mTime = mTime;
|
||||
return handler;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void recycle() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getTime() {
|
||||
return (long) (mTime / 1000000d);
|
||||
|
||||
@@ -3,7 +3,7 @@ apply plugin: 'maven'
|
||||
|
||||
dependencies {
|
||||
compile project(':vtm')
|
||||
compile 'com.squareup.okhttp:okhttp:1.5.2'
|
||||
compile 'com.squareup.okhttp3:okhttp:3.8.0'
|
||||
}
|
||||
|
||||
sourceSets {
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
/*
|
||||
* Copyright 2014 Charles Greb
|
||||
* Copyright 2014 Hannes Janetzek
|
||||
* Copyright 2017 devemux86
|
||||
* Copyright 2017 Mathieu De Brito
|
||||
*
|
||||
* This file is part of the OpenScienceMap project (http://www.opensciencemap.org).
|
||||
*
|
||||
@@ -17,48 +19,49 @@
|
||||
*/
|
||||
package org.oscim.tiling.source;
|
||||
|
||||
import com.squareup.okhttp.HttpResponseCache;
|
||||
import com.squareup.okhttp.OkHttpClient;
|
||||
|
||||
import org.oscim.core.Tile;
|
||||
import org.oscim.utils.IOUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.net.HttpURLConnection;
|
||||
import java.net.URL;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import okhttp3.OkHttpClient;
|
||||
import okhttp3.Request;
|
||||
import okhttp3.Response;
|
||||
|
||||
public class OkHttpEngine implements HttpEngine {
|
||||
static final Logger log = LoggerFactory.getLogger(OkHttpEngine.class);
|
||||
|
||||
private static final Logger log = LoggerFactory.getLogger(OkHttpEngine.class);
|
||||
|
||||
private final OkHttpClient mClient;
|
||||
private final UrlTileSource mTileSource;
|
||||
|
||||
private InputStream mInputStream;
|
||||
private byte[] mCachedData;
|
||||
|
||||
public static class OkHttpFactory implements HttpEngine.Factory {
|
||||
private final OkHttpClient mClient;
|
||||
private final OkHttpClient.Builder mClientBuilder;
|
||||
|
||||
public OkHttpFactory() {
|
||||
mClient = new OkHttpClient();
|
||||
mClientBuilder = new OkHttpClient.Builder();
|
||||
}
|
||||
|
||||
public OkHttpFactory(HttpResponseCache responseCache) {
|
||||
mClient = new OkHttpClient();
|
||||
mClient.setResponseCache(responseCache);
|
||||
public OkHttpFactory(OkHttpClient.Builder clientBuilder) {
|
||||
mClientBuilder = clientBuilder;
|
||||
}
|
||||
|
||||
@Override
|
||||
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) {
|
||||
mClient = client;
|
||||
mTileSource = tileSource;
|
||||
@@ -66,7 +69,7 @@ public class OkHttpEngine implements HttpEngine {
|
||||
|
||||
@Override
|
||||
public InputStream read() throws IOException {
|
||||
return inputStream;
|
||||
return mInputStream;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -74,44 +77,48 @@ public class OkHttpEngine implements HttpEngine {
|
||||
if (tile == null) {
|
||||
throw new IllegalArgumentException("Tile cannot be null.");
|
||||
}
|
||||
URL url = new URL(mTileSource.getTileUrl(tile));
|
||||
HttpURLConnection conn = mClient.open(url);
|
||||
|
||||
for (Entry<String, String> opt : mTileSource.getRequestHeader().entrySet())
|
||||
conn.addRequestProperty(opt.getKey(), opt.getValue());
|
||||
|
||||
try {
|
||||
inputStream = conn.getInputStream();
|
||||
} catch (FileNotFoundException e) {
|
||||
throw new IOException("ERROR " + conn.getResponseCode()
|
||||
+ ": " + conn.getResponseMessage());
|
||||
URL url = new URL(mTileSource.getTileUrl(tile));
|
||||
Request.Builder builder = new Request.Builder()
|
||||
.url(url);
|
||||
for (Entry<String, String> opt : mTileSource.getRequestHeader().entrySet())
|
||||
builder.addHeader(opt.getKey(), opt.getValue());
|
||||
Request request = builder.build();
|
||||
Response response = mClient.newCall(request).execute();
|
||||
if (mTileSource.tileCache != null) {
|
||||
mCachedData = response.body().bytes();
|
||||
mInputStream = new ByteArrayInputStream(mCachedData);
|
||||
} else
|
||||
mInputStream = response.body().byteStream();
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void close() {
|
||||
if (inputStream == null)
|
||||
if (mInputStream == null)
|
||||
return;
|
||||
|
||||
final InputStream is = inputStream;
|
||||
inputStream = null;
|
||||
new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
IOUtils.closeQuietly(is);
|
||||
}
|
||||
}).start();
|
||||
IOUtils.closeQuietly(mInputStream);
|
||||
mInputStream = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCache(OutputStream os) {
|
||||
// OkHttp cache implented through tileSource setResponseCache
|
||||
if (mTileSource.tileCache != null) {
|
||||
try {
|
||||
os.write(mCachedData);
|
||||
} catch (IOException e) {
|
||||
log.error(e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean requestCompleted(boolean success) {
|
||||
IOUtils.closeQuietly(inputStream);
|
||||
inputStream = null;
|
||||
IOUtils.closeQuietly(mInputStream);
|
||||
mInputStream = null;
|
||||
|
||||
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 |