113 Commits
0.8.0 ... 0.9.0

Author SHA1 Message Date
Emux
49ef4c8e1b 0.9.0 2017-12-03 17:06:59 +02:00
Gustl22
535482025e MapElement: enhance clone (not copy complete buffer) (#451) 2017-12-03 15:28:27 +02:00
Emux
e73ac4acfc Merge pull request #450 from andreynovikov/is-mapsforge-theme
Do not read theme twice if format is predefined
2017-11-27 11:47:38 +02:00
Andrey Novikov
bc20664bc5 Do not read theme twice if format is predefined 2017-11-27 10:22:48 +03:00
Emux
06936fc4ee Mapsforge maps v5 as Beta 2017-11-23 10:25:11 +02:00
Emux
0829098ebb Update Gradle Android plugin 2017-11-22 09:28:45 +02:00
Emux
8ad2036ec1 GeoPointUtils: calculate scale to display a BoundingBox #396 2017-11-20 10:48:16 +02:00
Emux
4f7675d2a8 Render themes: add building parts in all themes #41 2017-11-19 20:36:13 +02:00
Gustl22
8f4e9967f0 Buildings: handle references with id (OpenStreetMap, Mapzen) (#448) 2017-11-18 17:53:42 +02:00
Emux
f884c17195 Update contributing guide 2017-11-18 12:21:26 +02:00
lucaosten
490b932eab Code improvements (#446)
+ reduced memory usage of RenderBucket by making "type" byte instead of int
+ improved code readability in TextItem by renaming variable
+ added latitude/longitude validation methods to GeoPointUtils
+ solved Java double precision problem in GeoPoint
+ made GeoPoint Serializable for easier Android usage
+ made BoundingBox.toString() human readable for better debugging
2017-11-18 11:54:26 +02:00
Gustl22
149353119b Add OSM and S3DB tags (#447) 2017-11-17 20:00:51 +02:00
Emux
9c3f3b8a4c BitmapTileLayer: fix default bitmap alpha #444 2017-11-15 22:08:44 +02:00
Andrey Novikov
f9e06c80ad BitmapTileLayer: fade steps enhancements, support for permanent transparency (#444) 2017-11-14 16:51:56 +02:00
Gustl22
fe2c067272 TagSet: numTags and tag array as private (#439) 2017-11-13 12:24:54 +02:00
Longri
9c3488e107 iOS: add POT textures test (#443) 2017-11-12 12:03:47 +02:00
Longri
df784f6f68 Fix POT textures in render themes (#443) 2017-11-12 12:00:06 +02:00
Schedul Xor
a178357ca8 Added app to Applications.md (#442) 2017-11-11 22:48:35 +02:00
Emux
6627eab8e2 Update Android build tools 2017-11-10 11:31:26 +02:00
Andre Höpfner
0a7638e10d iOS: fix text drawing with stroke width (#441) 2017-11-10 10:38:08 +02:00
lucaosten
f94c665b27 fixed thread safety problem in Viewport (#438)
recycled variables were accessed non synchronized (and therefore non
thread safe) causing errors once multiple threads were used interacting
with the Viewport
2017-11-03 20:04:09 +02:00
Emux
d23bca9c7f Gradle 4 and Android plugin 3 improvements #433, fix #436 2017-10-30 12:28:03 +02:00
Emux
53dbb737fb Gradle 4 and Android plugin 3 improvements #433 2017-10-29 20:23:04 +02:00
Emux
1aa5f24e11 vtm-android-gdx module, fix #435 2017-10-29 18:53:24 +02:00
Emux
1d44057198 libGDX 1.9.7, fix #434 2017-10-29 18:53:13 +02:00
Emux
bcf4cff42b LWJGL 2 desktop exit status #433 2017-10-29 18:53:07 +02:00
Emux
cbdeb58c2f Gradle 4 and Android plugin 3, fix #433 2017-10-29 18:52:55 +02:00
Andrey Novikov
df5bcd583f Enable style categories (#430) 2017-10-24 13:20:18 +03:00
Emux
e2a4ad8a97 Marker clustering: allow custom cluster renderer #312 2017-10-21 19:35:07 +03:00
Emux
795359fb44 Update documentation 2017-10-17 20:12:36 +03:00
Emux
a9a042ea41 Mapsforge maps v5 support improvements #429 2017-10-17 13:15:30 +03:00
Gustl22
cd5a62a2ff Mapsforge maps v5 support (#429) 2017-10-17 11:00:45 +03:00
Andre Höpfner
dfd3a7dcf6 + update SVGgh to version 1.9.2 with iOS 11 compatibility (#426)
+ update RoboVM to version 2.3.2 with iOS  11 compatibility with InteliJ-PlugIn Version 2.3.3-SNAPSHOT and compatibility with Xcode 9.0
2017-10-12 14:54:33 +03:00
Emux
5615604170 Render themes improvements #41 2017-10-12 10:46:26 +03:00
Emux
b3f6899b1f Mapsforge themes: fix default position tag #100 2017-10-12 10:31:01 +03:00
Emux
e3f2f19119 PathLayer, VectorLayer (polygon) overlays touch events #316 #424 (#425) 2017-10-05 20:39:30 +03:00
Emux
126b98ae8c Render themes improvements #41 2017-10-05 20:00:59 +03:00
Emux
9104b746ac ItemizedLayer: use scaling in touch calculations 2017-10-05 15:41:53 +03:00
Emux
fc6bce20bb Update Travis 2017-10-05 13:51:47 +03:00
Emux
76582da497 Render themes: highway ref captions #41 2017-10-04 20:24:29 +03:00
Emux
a06ea5492e Two finger tap zoom out gesture, fix #423 2017-10-04 15:43:01 +03:00
Emux
1d7ece5a65 Render themes: "base-stroke-width", fix #422 2017-10-03 19:42:16 +03:00
Emux
67b911a7df Render themes: add ferries, fix #421 2017-10-03 14:47:39 +03:00
Emux
7947e5c027 Update changelog 2017-10-03 14:27:01 +03:00
Emux
69f7ed7ae0 Update changelog 2017-10-03 13:33:46 +03:00
Gustl22
fa658bd1f0 Support of extrusions in BuildingLayer on Mapzen maps (#419)
+ Tag add "levels"
+ BuildingLayer: support extrusions with height and levels, string unit in meters
+ Support height for Mapzen building_parts
+ Support of building parts in default theme and mapzen
2017-10-03 13:30:23 +03:00
Emux
233f0c4f7e Allow custom tile size instead of the calculated one 2017-09-29 19:37:39 +03:00
Emux
02b29c7584 Samples improvements #32 2017-09-28 21:01:34 +03:00
Emux
cedf3edc61 Render themes improvements #41 2017-09-28 15:05:41 +03:00
Emux
60aa9600d8 Render themes: rule types order, fix #418 2017-09-28 14:47:34 +03:00
Emux
3d92807d26 Render themes: Cap modes, fix #417 2017-09-28 13:00:10 +03:00
Emux
67195bbc0c Mapsforge themes: use tessellation, fix #415 2017-09-27 15:40:29 +03:00
Emux
7ba5984e5f Render themes: store theme origin, fix #414 2017-09-27 15:37:00 +03:00
Emux
27aee33cb9 Do not catch graphics exception too early, fix #413 2017-09-27 14:39:28 +03:00
Andrey Novikov
4a848cc08c Do not catch graphics exception too early (#413) 2017-09-27 14:39:15 +03:00
Emux
75c2841a13 Mapsforge themes 3D buildings, fix #411 2017-09-27 13:18:30 +03:00
Emux
ed8f03122b Update Android libs 2017-09-27 09:51:33 +03:00
Emux
d80e4fdabc Render themes: stroke dash array supports odd entries number #131 2017-09-26 21:35:05 +03:00
Emux
c8817f80c8 Render themes: line symbol improvements #124 2017-09-26 20:58:24 +03:00
Emux
3ee1034f1a Render themes: stroke dash array improvements #131 2017-09-26 20:57:17 +03:00
Emux
3b224d21fc Extrusions default height, fix #409 2017-09-26 19:13:58 +03:00
Emux
0d7d75ccb5 Mapsforge themes: convert "priority" to VTM, fix #408 2017-09-25 15:02:45 +03:00
Emux
324a1c309c Mapsforge themes don't support (-) 'exclusive negation', fix #407 2017-09-24 12:41:53 +03:00
Emux
0046f5c159 Render themes: line symbol, fix #124 2017-09-23 21:03:05 +03:00
Emux
7865867973 Render themes: stroke dash array improvements, fix #131 2017-09-23 18:07:42 +03:00
Emux
7c12c2ae9b Polygon symbol positioning, fix #405 2017-09-19 11:58:22 +03:00
Emux
564435a22a Render themes improvements #41 2017-09-18 09:42:14 +03:00
Emux
607cdeb5db Feature parameters, fix #403 2017-09-16 18:03:28 +03:00
Emux
4903a4b5f4 Update .gitignore 2017-09-16 17:37:59 +03:00
Emux
e5043447e3 PolyLabel samples #402 2017-09-16 17:14:10 +03:00
Emux
4f78fed094 PolyLabel default disabled #402 2017-09-15 21:28:05 +03:00
Emux
0fbce21140 Samples improvements #32 2017-09-15 19:23:36 +03:00
Emux
3a19c2f2f5 Render themes improvements #41 2017-09-14 13:18:56 +03:00
Emux
c694fbc63b VTM map scaling improvements, fix #401 2017-09-14 13:18:56 +03:00
Emux
c4b6d019ff Samples improvements #32 2017-09-14 13:18:56 +03:00
Emux
3603dfef03 ThemeLoader: fix text scaling #92 2017-09-14 09:32:49 +03:00
Emux
35f1e7092c CanvasAdapter: add user scale option #92 2017-09-13 16:32:07 +03:00
Emux
9283b80594 Automatic tile size calculation #92 2017-09-12 20:21:56 +03:00
Emux
f81dff2365 CanvasAdapter: add getScale method #92 2017-09-11 13:05:22 +03:00
Emux
5c2b404b3f Mapsforge Reverse Geocoding #383 (#398)
* Mapsforge Reverse Geocoding #383

* Mapsforge Reverse Geocoding example #383
2017-09-10 17:04:19 +03:00
Emux
095ed65eb3 Core utilities #396 (#397) 2017-09-10 15:59:54 +03:00
Emux
3d7a09c457 OSMIndoorLayer: fix polygon line color parsing #366 2017-09-09 15:56:11 +03:00
Emux
abc1867d7c Fix Point distance 2017-09-08 20:42:33 +03:00
Emux
3449bd86e8 Samples: POI Search example, close #394 2017-09-07 12:02:39 +03:00
Emux
1861ca4a1b Samples improvements #32 2017-09-07 10:32:50 +03:00
Emux
a77d89b8b3 vtm-theme-comparator: use Mapsforge snapshot version #387 2017-09-07 10:09:08 +03:00
Emux
f63c303293 Mapsforge: at large query zoom levels enlarge clip buffer, fixes #231 2017-09-06 11:34:51 +03:00
Emux
f1634e4976 Mapsforge: at large query zoom levels clip everything #231, fixes #391 2017-09-06 11:34:31 +03:00
Emux
b59f20ef49 Fix web modules 2017-09-05 15:45:08 +03:00
Emux
07138f3240 Mapsforge themes compatibility improvements #100, fix #392 2017-09-05 15:24:48 +03:00
Emux
eddfa5a896 vtm-theme-comparator: add 'fatjar' Gradle task #387 2017-09-05 12:30:02 +03:00
Emux
4532e397c0 vtm-theme-comparator: fix application exit #387 2017-09-05 12:29:57 +03:00
Emux
81a270428c Update changelog 2017-09-03 19:15:30 +03:00
Emux
76e73368ab Render themes: line symbol and stroke dash array #124 #131 2017-09-03 18:03:07 +03:00
Emux
f4f8eb8d1c Mapsforge themes compatibility improvements #388 #100 2017-09-03 18:02:55 +03:00
Longri
b695d43fee Mapsforge themes compatibility (#388) #100 2017-09-03 18:02:35 +03:00
Emux
f6d2db4c6f Enable vtm-jeo module #375 2017-08-29 19:48:22 +03:00
Emux
e1db67f099 JTS PathLayer: do not try to calculate zero length great circle path by @andreynovikov #390 2017-08-28 16:56:44 +03:00
Andrey Novikov
7142f3410d PathLayer: do not try to calculate zero length great circle path (#390) 2017-08-28 16:53:54 +03:00
Emux
b110314077 vtm-theme-comparator: use same tile size and synchronize zoom level #387 2017-08-22 19:17:57 +03:00
Emux
1cf4d3a60b vtm-theme-comparator improvements #387 2017-08-21 20:30:28 +03:00
Longri
9c5fd29ff1 vtm-theme-comparator module (#386) #387 2017-08-21 20:24:52 +03:00
Emux
27a39fbfd7 OpenMapTiles theme: enable ocean #385 2017-08-11 22:25:51 +03:00
Emux
d3aa2af73b OpenMapTiles GeoJSON vector tiles #385 2017-08-11 21:33:28 +03:00
Emux
2555fea5da UrlTileSource: customize api key name #49 2017-08-11 21:17:43 +03:00
Emux
8bb63c875f Use Google's Maven repository 2017-07-26 11:02:49 +03:00
Emux
76dcc8b909 Update Android 2017-07-25 09:43:39 +03:00
Wolfgang Schramm
c38975fcba Cluster marker is clipped, fixed by reducing radius (#382)
* fixed cluster marker is clipped by reducing radius

fixed comment, swaped fill <-> outline

* replaced static size with dpi dependent size
2017-07-24 19:16:55 +03:00
Wolfgang Schramm
b90d99f82b ClusterMarkerRenderer: repopulateCluster() is called with different scales (#381)
mScaleSaved is log2 smaller than scale.
This fixes the bug that subsequent calls to populate() will display the markers correctly and will not be clustered to one single cluster.
2017-07-23 18:06:11 +03:00
Andrey Novikov
76d55bb1a0 Do not fling if map move is disabled (#378) 2017-07-19 16:26:37 +03:00
Emux
d9f7638a25 Update changelog 2017-07-19 15:04:19 +03:00
Emux
e7a391e640 LineTexBucket: remove redundant u_scale uniform, fix #376 2017-07-19 15:02:01 +03:00
Andrey Novikov
12fe08884e Enable custom label loader in label layer (#377) 2017-07-19 14:46:25 +03:00
288 changed files with 12866 additions and 3167 deletions

View File

@@ -6,7 +6,7 @@ Before you start working on an unresolved issue or try to implement a new featur
You may also create a new issue on [Github](https://github.com/mapsforge/vtm/issues) or comment on an existing one to describe your ideas. We will then discuss the best way to realize your proposal and figure out how we can help you to get started quickly.
If you are only requesting a small change in the code, you may attach a patch file to the corresponding issue, but it is best to create a pull request on Github. Make sure that your patch is derived from the latest version in our **master** repository, otherwise we might be unable to apply it. Please follow our code and style conventions.
If you are only requesting a small change in the code, you may attach a patch file to the corresponding issue, but it is best to create a pull request on Github. Make sure that your patch is derived from the latest version in our **master** repository, otherwise we might be unable to apply it. Important is to keep pull requests simple with one feature in each. Please follow our code and style conventions.
Also please keep the pull request commits squashed, in order to avoid the clutter in repository and have only the finally changed files together. One way is described [here](http://gitready.com/advanced/2009/02/10/squashing-commits-with-rebase.html).

2
.gitignore vendored
View File

@@ -11,8 +11,10 @@ robovm-build
/vtm-web/war/
/vtm-web/assets/
/vtm-web/gwt-unitCache
/vtm-web-app/war/WEB-INF/
/vtm-web-app/assets/
/vtm-web-app/src/main/webapp/
/vtm-web-js/war/WEB-INF/
/vtm-web-js/assets/
/vtm-web-js/src/main/webapp/
/vtm-spatialite/

View File

@@ -4,11 +4,11 @@ jdk:
- oraclejdk8
android:
components:
- tools
- platform-tools
- tools
- build-tools-26.0.0
- android-26
- extra-android-m2repository
- build-tools-27.0.1
- android-27
env:
global:
- GRADLE_OPTS="-Xmx2048m"
@@ -20,3 +20,9 @@ after_success:
- if [ "$TRAVIS_BRANCH" == "master" ] && [ "$TRAVIS_PULL_REQUEST" == "false" ]; then
./gradlew uploadArchives -PSONATYPE_USERNAME="${SONATYPE_USERNAME}" -PSONATYPE_PASSWORD="${SONATYPE_PASSWORD}";
fi
notifications:
email:
recipients:
- secure: fOInp4SGBqiIMgnsGceQTa0SuFLaAoxAF15W0crhuljGlqSgnbnBjh0xFEF4P5+q3VT3DgDZs53GVVo6S9gEl8AWJy84KGuUX1M/CQKUQC4bwNXJdHfY3MIy6D50da6UfwWeNS4ienKh2Rj6w2TapN9M8C9nJJZk9aJFc9NWZmWTVboHZd4oUDeeRBJ6KSk1Ay7L/mmxv4cMCXaW7pPJixvUFESKNYgK4KAN3zYpym2UijrQ8zf7OVcYnTorcAuXUZDk8EvwdHl3rIAdlbVqvyZ8rmoQ2Da/Q2VlWUL/HrHUVJtCPZ+T+dNUag4a8joIDqWKwcyk76PElmgft3azb7GERb+bkZz1ToQc2IvuOeUk2SsuXWZugoEQImKWl/yWeirWBLrwzieaVh4j04dMSn/Npc1yL5kjX9EuiM6MFHdYPianMpvhFiaYKihjzW0GPV6sfuY7xS8cA9L9DjAsXoHIXIxc/+hRA+bpPUl+qMaQdGjJmNJJ2VPFnOY0XCsDDQDIVa3nZOA6aXMUG2c4H26RJZPe7uvfRiuL86n3KAmkoXSwne9t8WYMgl89LMsU5XxjBvwz2Qa1HqG09tVs6nhB23easrhEYEf/ZsGg0DIIL1FImUHj+wUUfZXeyFmbiE6lD/i2+3a5DqzZGHbXUDCoUIagObMf8fe2z5+0K/Q=
on_success: always
on_failure: always

View File

@@ -29,15 +29,16 @@ If you have any questions or problems, don't hesitate to ask our public [mailing
- HTML5/WebGL (using libGDX/GWT, [instructions](docs/web.md))
### Projects
- **vtm** contains the core library
- **vtm** core library
- **vtm-android** Android backend
- **vtm-android-example** provides examples using vtm-android
- **vtm-android-example** Android examples
- **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-android-gdx** Android libGDX backend
- **vtm-desktop** Desktop libGDX backend
- **vtm-playground** Desktop examples
- **vtm-ios** iOS libGDX backend
- **vtm-ios-example** iOS examples
- **vtm-web** HTML5/GWT libGDX backend
- **vtm-web-app** HTML5/GWT application
## WebGL Demo

View File

@@ -1,10 +1,11 @@
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.3'
classpath 'com.github.dcendents:android-maven-gradle-plugin:1.5'
classpath 'com.android.tools.build:gradle:3.0.1'
classpath 'com.github.dcendents:android-maven-gradle-plugin:2.0'
}
}
@@ -13,8 +14,8 @@ allprojects {
version = 'master-SNAPSHOT'
ext.isReleaseVersion = !version.endsWith("SNAPSHOT")
ext.androidBuildVersionTools = "26.0.0"
ext.gdxVersion = "1.9.6"
ext.androidBuildVersionTools = "27.0.1"
ext.gdxVersion = "1.9.7"
ext.gwtVersion = "2.8.0"
ext.slf4jVersion = "1.7.25"
@@ -27,18 +28,21 @@ allprojects {
}
}
def androidCompileSdk() { return 26 }
static def androidCompileSdk() { return 27 }
def androidMinSdk() { return 10 }
// Minimum API Level by Support Library
static def androidMinSdk() { return 14 }
def androidTargetSdk() { return 22 }
static def androidTargetSdk() { return 22 }
def versionCode() { return 50 }
static def versionCode() { return 1 }
def versionName() { return version }
subprojects {
repositories {
google()
maven { url 'https://repo.boundlessgeo.com/main' }
jcenter()
}

View File

@@ -4,13 +4,11 @@ if (project.hasProperty("android")) {
task sourcesJar(type: Jar) {
classifier = 'sources'
from android.sourceSets.main.java.srcDirs
exclude 'android-logger.properties'
}
task javadoc(type: Javadoc) {
source = android.sourceSets.main.java.srcDirs
classpath += project.files(android.getBootClasspath().join(File.pathSeparator))
exclude 'android-logger.properties'
}
} else {
task sourcesJar(type: Jar) {

View File

@@ -10,6 +10,7 @@
| [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 |
| Tokyo Ogiqvo | Visualize App | Commercial | [Android](https://play.google.com/store/apps/details?id=com.ogiqvo.view.tokyo&hl=ja), [iOS](https://itunes.apple.com/us/app/tokyo-ogiqvo/id1097100677?mt=8) | Closed |
| [topoGuide](http://www.topoguide.gr/index-en.php) | Digital guides for the outdoor | Proprietary/Free and Commercial | Android | Closed |
| [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 |

View File

@@ -1,5 +1,33 @@
# Changelog
## Version 0.9.0 (2017-12-03)
- Mapsforge maps **v5 beta** support [#429](https://github.com/mapsforge/vtm/issues/429)
- Mapsforge themes compatibility [#100](https://github.com/mapsforge/vtm/issues/100)
- Render themes: line symbol [#124](https://github.com/mapsforge/vtm/issues/124)
- Render themes: stroke dash array [#131](https://github.com/mapsforge/vtm/issues/131)
- PathLayer overlay touch events [#316](https://github.com/mapsforge/vtm/issues/316)
- VectorLayer (polygon) overlay touch events [#424](https://github.com/mapsforge/vtm/issues/424)
- Two finger tap zoom out gesture [#423](https://github.com/mapsforge/vtm/issues/423)
- POI Search example [#394](https://github.com/mapsforge/vtm/issues/394)
- Mapsforge Reverse Geocoding [#383](https://github.com/mapsforge/vtm/issues/383)
- Core utilities [#396](https://github.com/mapsforge/vtm/issues/396)
- MercatorProjection.groundResolution renamed to groundResolutionWithScale
- Map scaling improvements [#401](https://github.com/mapsforge/vtm/issues/401)
- Mapsforge fix artifacts zoom >17 [#231](https://github.com/mapsforge/vtm/issues/231)
- Mapzen building extrusions [#419](https://github.com/mapsforge/vtm/issues/419)
- BuildingLayer expects height tags in meters
- Polygon symbol positioning [#405](https://github.com/mapsforge/vtm/issues/405)
- PolyLabel default disabled [#402](https://github.com/mapsforge/vtm/issues/402)
- vtm-theme-comparator module [#387](https://github.com/mapsforge/vtm/issues/387)
- Feature parameters [#403](https://github.com/mapsforge/vtm/issues/403)
- vtm-android-gdx module enhancements [#435](https://github.com/mapsforge/vtm/issues/435)
- Gradle 4 / Android plugin 3 support [#433](https://github.com/mapsforge/vtm/issues/433)
- libGDX 1.9.7 [#434](https://github.com/mapsforge/vtm/issues/434)
- Internal render themes various improvements [#41](https://github.com/mapsforge/vtm/issues/41)
- Many other minor improvements and bug fixes
- [Solved issues](https://github.com/mapsforge/vtm/issues?q=is%3Aclosed+milestone%3A0.9.0)
## Version 0.8.0 (2017-07-19)
- Real time (SVG) texture atlas [#63](https://github.com/mapsforge/vtm/issues/63)
@@ -19,7 +47,8 @@
- 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)
- libGDX 1.9.6 [#333](https://github.com/mapsforge/vtm/issues/333)
- Internal render themes various improvements [#41](https://github.com/mapsforge/vtm/issues/41)
- Many other minor improvements and bug fixes
- [Solved issues](https://github.com/mapsforge/vtm/issues?q=is%3Aclosed+milestone%3A0.8.0)
@@ -45,14 +74,15 @@
- 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)
- libGDX 1.9.5 [#270](https://github.com/mapsforge/vtm/issues/270)
- Internal render themes various improvements [#41](https://github.com/mapsforge/vtm/issues/41)
- Many other minor improvements and bug fixes
- [Solved issues](https://github.com/mapsforge/vtm/issues?q=is%3Aclosed+milestone%3A0.7.0)
## Version 0.6.0 (2016-10-28) - VTM revive
- Mapsforge maps **v4** support [#34](https://github.com/mapsforge/vtm/issues/34)
- Render theme SVG resources [#60](https://github.com/mapsforge/vtm/issues/60)
- Mapsforge multilingual maps [#34](https://github.com/mapsforge/vtm/issues/34)
- Render theme styles [#93](https://github.com/mapsforge/vtm/issues/93)
- vtm-ios module update [#29](https://github.com/mapsforge/vtm/issues/29)
- Native libraries for all platforms [#14](https://github.com/mapsforge/vtm/issues/14)
@@ -67,9 +97,10 @@
- GeoPoint & BoundingBox improvements [#201](https://github.com/mapsforge/vtm/issues/201) [#200](https://github.com/mapsforge/vtm/issues/200)
- vtm-jts module [#53](https://github.com/mapsforge/vtm/issues/53)
- vtm-http module [#140](https://github.com/mapsforge/vtm/issues/140)
- 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)
- SNAPSHOT builds publish to Sonatype OSSRH [#165](https://github.com/mapsforge/vtm/issues/165)
- libGDX 1.9.4 [#164](https://github.com/mapsforge/vtm/issues/164)
- Internal render themes various improvements [#41](https://github.com/mapsforge/vtm/issues/41)
- Many other minor improvements and bug fixes
- [Solved issues](https://github.com/mapsforge/vtm/issues?q=is%3Aclosed+milestone%3A0.6.0)

View File

@@ -8,42 +8,42 @@ Current version is [![Maven Central](https://img.shields.io/maven-central/v/org.
### Core
```groovy
compile 'org.mapsforge:vtm:[CURRENT-VERSION]'
compile 'org.mapsforge:vtm-themes:[CURRENT-VERSION]'
compile 'org.slf4j:slf4j-api:1.7.25'
implementation 'org.mapsforge:vtm:[CURRENT-VERSION]'
implementation 'org.mapsforge:vtm-themes:[CURRENT-VERSION]'
implementation 'org.slf4j:slf4j-api:1.7.25'
```
### Android
```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-mips'
compile 'org.mapsforge:vtm-android:[CURRENT-VERSION]:natives-mips64'
compile 'org.mapsforge:vtm-android:[CURRENT-VERSION]:natives-x86'
compile 'org.mapsforge:vtm-android:[CURRENT-VERSION]:natives-x86_64'
compile 'com.caverock:androidsvg:1.2.2-beta-1'
implementation 'org.mapsforge:vtm-android:[CURRENT-VERSION]'
implementation 'org.mapsforge:vtm-android:[CURRENT-VERSION]:natives-arm64-v8a'
implementation 'org.mapsforge:vtm-android:[CURRENT-VERSION]:natives-armeabi'
implementation 'org.mapsforge:vtm-android:[CURRENT-VERSION]:natives-armeabi-v7a'
implementation 'org.mapsforge:vtm-android:[CURRENT-VERSION]:natives-mips'
implementation 'org.mapsforge:vtm-android:[CURRENT-VERSION]:natives-mips64'
implementation 'org.mapsforge:vtm-android:[CURRENT-VERSION]:natives-x86'
implementation 'org.mapsforge:vtm-android:[CURRENT-VERSION]:natives-x86_64'
implementation 'com.caverock:androidsvg:1.2.2-beta-1'
```
### Android (with libGDX)
```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'
implementation 'org.mapsforge:vtm-android:[CURRENT-VERSION]'
implementation 'org.mapsforge:vtm-android:[CURRENT-VERSION]:natives-arm64-v8a'
implementation 'org.mapsforge:vtm-android:[CURRENT-VERSION]:natives-armeabi'
implementation 'org.mapsforge:vtm-android:[CURRENT-VERSION]:natives-armeabi-v7a'
implementation 'org.mapsforge:vtm-android:[CURRENT-VERSION]:natives-x86'
implementation 'org.mapsforge:vtm-android:[CURRENT-VERSION]:natives-x86_64'
implementation 'org.mapsforge:vtm-gdx:[CURRENT-VERSION]'
implementation 'org.mapsforge:vtm-android-gdx:[CURRENT-VERSION]'
implementation 'org.mapsforge:vtm-android-gdx:[CURRENT-VERSION]:natives-arm64-v8a'
implementation 'org.mapsforge:vtm-android-gdx:[CURRENT-VERSION]:natives-armeabi'
implementation 'org.mapsforge:vtm-android-gdx:[CURRENT-VERSION]:natives-armeabi-v7a'
implementation 'org.mapsforge:vtm-android-gdx:[CURRENT-VERSION]:natives-x86'
implementation 'org.mapsforge:vtm-android-gdx:[CURRENT-VERSION]:natives-x86_64'
implementation 'com.badlogicgames.gdx:gdx:1.9.7'
implementation 'com.badlogicgames.gdx:gdx-backend-android:1.9.7'
implementation 'com.caverock:androidsvg:1.2.2-beta-1'
```
### iOS
@@ -52,19 +52,19 @@ Detailed iOS instructions can be found [here](ios.md).
### Desktop
```groovy
compile 'org.mapsforge:vtm-gdx:[CURRENT-VERSION]'
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.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.metsci.ext.com.kitfox.svg:svg-salamander:0.1.19'
implementation 'org.mapsforge:vtm-gdx:[CURRENT-VERSION]'
implementation 'org.mapsforge:vtm-desktop:[CURRENT-VERSION]'
implementation 'org.mapsforge:vtm-desktop:[CURRENT-VERSION]:natives-linux'
implementation 'org.mapsforge:vtm-desktop:[CURRENT-VERSION]:natives-osx'
implementation 'org.mapsforge:vtm-desktop:[CURRENT-VERSION]:natives-windows'
implementation 'com.badlogicgames.gdx:gdx:1.9.7'
implementation 'com.badlogicgames.gdx:gdx-platform:1.9.7:natives-desktop'
implementation 'com.badlogicgames.gdx:gdx-backend-lwjgl:1.9.7'
implementation 'org.lwjgl.lwjgl:lwjgl:2.9.3'
implementation 'org.lwjgl.lwjgl:lwjgl-platform:2.9.3:natives-linux'
implementation 'org.lwjgl.lwjgl:lwjgl-platform:2.9.3:natives-osx'
implementation 'org.lwjgl.lwjgl:lwjgl-platform:2.9.3:natives-windows'
implementation 'com.metsci.ext.com.kitfox.svg:svg-salamander:0.1.19'
```
## Snapshots
@@ -80,7 +80,7 @@ repositories {
And declare the dependencies like:
```groovy
compile 'org.mapsforge:vtm:master-SNAPSHOT'
implementation 'org.mapsforge:vtm:master-SNAPSHOT'
...
```

View File

@@ -1,6 +1,6 @@
#Fri Mar 03 12:50:23 EET 2017
#Thu Oct 26 11:57:58 EEST 2017
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-3.3-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-all.zip

View File

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

View File

@@ -190,6 +190,8 @@
<xs:attribute name="fade" default="-1" type="xs:integer" use="optional" />
<xs:attribute name="blur" default="-1" type="xs:float" use="optional" />
<xs:attribute name="fix" default="false" type="xs:boolean" use="optional" />
<xs:attribute name="repeat-gap" default="200" type="xs:float" use="optional" />
<xs:attribute name="repeat-start" default="30" type="xs:float" use="optional" />
<!-- stipple repeat in 'pixel' -->
<xs:attribute name="stipple" default="0" type="xs:integer" use="optional" />
@@ -200,27 +202,6 @@
</xs:complexType>
<!--<xs:complexType name="outline">
<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>-->
<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>
<xs:complexType name="text">
<xs:attribute name="cat" type="xs:string" use="optional" />
@@ -255,6 +236,8 @@
<xs:attribute name="line-color" type="tns:color" use="optional" />
<xs:attribute name="side-color" type="tns:color" use="required" />
<xs:attribute name="top-color" type="tns:color" use="required" />
<!-- 12m default -->
<xs:attribute name="default-height" default="12" type="xs:positiveInteger" use="optional" />
</xs:complexType>
<!-- match elements -->
@@ -268,7 +251,7 @@
<xs:element name="circle" type="tns:circle" />
<xs:element name="line" type="tns:line" />
<xs:element name="outline" type="tns:line" />
<xs:element name="lineSymbol" type="tns:lineSymbol" />
<xs:element name="lineSymbol" type="tns:line" />
<xs:element name="text" type="tns:text" />
<xs:element name="extrusion" type="tns:extrusion" />
<xs:element name="symbol" type="tns:symbol" />

View File

@@ -10,11 +10,12 @@ include ':vtm-gdx'
include ':vtm-http'
include ':vtm-ios'
include ':vtm-ios-example'
//include ':vtm-jeo'
include ':vtm-jeo'
include ':vtm-json'
include ':vtm-jts'
include ':vtm-playground'
include ':vtm-tests'
include ':vtm-theme-comparator'
include ':vtm-themes'
include ':vtm-web'
include ':vtm-web-app'

View File

@@ -10,10 +10,6 @@
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-sdk
android:minSdkVersion="10"
android:targetSdkVersion="22" />
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
@@ -41,9 +37,12 @@
<activity
android:name=".ClusterMarkerOverlayActivity"
android:configChanges="keyboardHidden|orientation|screenSize" />
<!--<activity
<activity
android:name=".GdxMapActivity"
android:configChanges="keyboardHidden|orientation|screenSize" />
<activity
android:name=".JeoIndoorMapActivity"
android:configChanges="keyboardHidden|orientation|screenSize" />-->
android:configChanges="keyboardHidden|orientation|screenSize" />
<activity
android:name=".LayerGroupActivity"
android:configChanges="keyboardHidden|orientation|screenSize" />
@@ -53,18 +52,18 @@
<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=".MapsforgeMapActivity$ThemeFilePicker"
android:configChanges="keyboardHidden|orientation|screenSize" />
<activity
android:name=".MapsforgePolyLabelActivity"
android:configChanges="keyboardHidden|orientation|screenSize" />
<activity
android:name=".MapsforgeStyleActivity"
android:configChanges="keyboardHidden|orientation|screenSize" />
@@ -83,12 +82,24 @@
<activity
android:name=".NewGesturesActivity"
android:configChanges="keyboardHidden|orientation|screenSize" />
<activity
android:name=".OpenMapTilesGeojsonMapActivity"
android:configChanges="keyboardHidden|orientation|screenSize" />
<activity
android:name=".PathOverlayActivity"
android:configChanges="keyboardHidden|orientation|screenSize" />
<activity
android:name=".PoiSearchActivity"
android:configChanges="keyboardHidden|orientation|screenSize" />
<activity
android:name=".PoiSearchActivity$PoiFilePicker"
android:configChanges="keyboardHidden|orientation|screenSize" />
<activity
android:name=".POTTextureActivity"
android:configChanges="keyboardHidden|orientation|screenSize" />
<activity
android:name=".ReverseGeocodeActivity"
android:configChanges="keyboardHidden|orientation|screenSize" />
<activity
android:name=".RotateMarkerOverlayActivity"
android:configChanges="keyboardHidden|orientation|screenSize" />

View File

@@ -1,17 +1,32 @@
apply plugin: 'com.android.application'
repositories {
maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
}
dependencies {
compile project(':vtm-android')
compile project(':vtm-extras')
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'
implementation project(':vtm-android')
implementation project(':vtm-http')
implementation project(':vtm-jeo')
implementation project(':vtm-json')
implementation project(':vtm-jts')
implementation project(':vtm-themes')
implementation('org.jeo:jeo:0-SNAPSHOT') {
exclude group: 'org.slf4j', module: 'slf4j-jdk14'
}
implementation('org.jeo:jeo-render:0-SNAPSHOT') {
exclude group: 'org.slf4j', module: 'slf4j-jdk14'
}
implementation "org.slf4j:slf4j-android:$slf4jVersion"
implementation project(':vtm-android-gdx')
implementation project(':vtm-gdx')
implementation "com.badlogicgames.gdx:gdx-backend-android:$gdxVersion"
implementation 'org.mapsforge:mapsforge-poi-android:master-SNAPSHOT'
implementation 'org.mapsforge:spatialite-android:master-SNAPSHOT:natives-armeabi'
implementation 'org.mapsforge:spatialite-android:master-SNAPSHOT:natives-armeabi-v7a'
implementation 'org.mapsforge:spatialite-android:master-SNAPSHOT:natives-x86'
}
android {
@@ -27,6 +42,7 @@ android {
versionCode versionCode()
versionName versionName()
minSdkVersion androidMinSdk()
targetSdkVersion androidTargetSdk()
}
sourceSets {
@@ -39,6 +55,9 @@ android {
file("${rootDir}/vtm-android/natives").eachDir() { dir ->
jniLibs.srcDirs += "${dir.path}/lib"
}
file("${rootDir}/vtm-android-gdx/natives").eachDir() { dir ->
jniLibs.srcDirs += "${dir.path}/lib"
}
}
debug.setRoot('build-types/debug')
release.setRoot('build-types/release')
@@ -51,6 +70,14 @@ android {
exclude 'META-INF/LICENSE'
exclude 'META-INF/NOTICE'
}
buildTypes {
all {
minifyEnabled true
useProguard false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
task run(dependsOn: 'installDebug') {

10
vtm-android-example/proguard-rules.pro vendored Normal file
View File

@@ -0,0 +1,10 @@
-keep class com.** { *; }
-dontwarn com.**
-keep class jsqlite.** { *; }
-dontwarn jsqlite.**
-keep class okhttp3.** { *; }
-dontwarn okhttp3.**
-keep class okio.** { *; }
-dontwarn okio.**
-keep class org.** { *; }
-dontwarn org.**

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

View File

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

View File

@@ -6,6 +6,7 @@
<string name="theme_osmagray">Osmagray</string>
<string name="theme_tubes">Tubes</string>
<string name="theme_newtron">NewTron</string>
<string name="theme_external">External theme</string>
<string name="ok">OK</string>
<string name="cancel">Cancel</string>
<string name="error">Error</string>
@@ -17,5 +18,6 @@
<string name="style_1">Show nature</string>
<string name="style_2">Hide nature</string>
<string name="menu_gridlayer">Grid</string>
<string name="dialog_reverse_geocoding_title">Reverse Geocoding</string>
</resources>

View File

@@ -1 +0,0 @@
root=DEBUG:%logger

View File

@@ -1,6 +1,7 @@
/*
* Copyright 2010, 2011, 2012 mapsforge.org
* Copyright 2016 devemux86
* Copyright 2016-2017 devemux86
* Copyright 2017 Longri
*
* This program is free software: you can redistribute it and/or modify it under the
* terms of the GNU Lesser General Public License as published by the Free Software
@@ -17,10 +18,13 @@ package org.oscim.android.filepicker;
import org.oscim.theme.ExternalRenderTheme;
import org.oscim.theme.ThemeFile;
import org.oscim.theme.ThemeUtils;
import org.oscim.theme.XmlMapsforgeThemeBuilder;
import org.oscim.theme.XmlThemeBuilder;
import org.oscim.tiling.TileSource.OpenResult;
import org.xml.sax.InputSource;
import org.xml.sax.XMLReader;
import org.xml.sax.helpers.DefaultHandler;
import java.io.File;
@@ -34,9 +38,14 @@ public final class ValidRenderTheme implements ValidFileFilter {
@Override
public boolean accept(File file) {
try {
ThemeFile theme = new ExternalRenderTheme(file.getAbsolutePath());
XmlThemeBuilder renderThemeHandler = new XmlThemeBuilder(theme);
DefaultHandler renderThemeHandler;
if (ThemeUtils.isMapsforgeTheme(theme))
renderThemeHandler = new XmlMapsforgeThemeBuilder(theme);
else
renderThemeHandler = new XmlThemeBuilder(theme);
XMLReader xmlReader = SAXParserFactory.newInstance().newSAXParser().getXMLReader();
xmlReader.setContentHandler(renderThemeHandler);
xmlReader.parse(new InputSource(theme.getRenderThemeAsStream()));

View File

@@ -18,8 +18,6 @@
*/
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;
@@ -53,12 +51,8 @@ public class AtlasMarkerOverlayActivity extends MarkerOverlayActivity {
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);
Bitmap bitmapPoi = drawableToBitmap(getResources().getDrawable(R.drawable.marker_poi));
Bitmap bitmapFocus = drawableToBitmap(getResources().getDrawable(R.drawable.marker_focus));
// Create Atlas from Bitmaps
java.util.Map<Object, Bitmap> inputMap = new LinkedHashMap<>();

View File

@@ -17,13 +17,13 @@ package org.oscim.android.test;
import android.os.Bundle;
import org.oscim.theme.ThemeLoader;
import org.oscim.utils.Parameters;
public class AtlasThemeActivity extends SimpleMapActivity {
@Override
public void onCreate(Bundle savedInstanceState) {
ThemeLoader.USE_ATLAS = true;
Parameters.TEXTURE_ATLAS = true;
super.onCreate(savedInstanceState);
}

View File

@@ -21,6 +21,9 @@ 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.MarkerLayer;
import org.oscim.layers.marker.MarkerRenderer;
import org.oscim.layers.marker.MarkerRendererFactory;
import org.oscim.layers.marker.MarkerSymbol;
import org.oscim.layers.tile.buildings.BuildingLayer;
import org.oscim.layers.tile.vector.VectorTileLayer;
@@ -48,17 +51,29 @@ public class ClusterMarkerOverlayActivity extends MarkerOverlayActivity {
mMap.layers().add(new LabelLayer(mMap, l));
mMap.setTheme(VtmThemes.DEFAULT);
Bitmap bitmapPoi = drawableToBitmap(getResources(), R.drawable.marker_poi);
MarkerSymbol symbol;
Bitmap bitmapPoi = drawableToBitmap(getResources().getDrawable(R.drawable.marker_poi));
final MarkerSymbol symbol;
if (BILLBOARDS)
symbol = new MarkerSymbol(bitmapPoi, MarkerSymbol.HotspotPlace.BOTTOM_CENTER);
else
symbol = new MarkerSymbol(bitmapPoi, MarkerSymbol.HotspotPlace.CENTER, false);
MarkerRendererFactory markerRendererFactory = new MarkerRendererFactory() {
@Override
public MarkerRenderer create(MarkerLayer markerLayer) {
return new ClusterMarkerRenderer(markerLayer, symbol, new ClusterMarkerRenderer.ClusterStyle(Color.WHITE, Color.BLUE)) {
@Override
protected Bitmap getClusterBitmap(int size) {
// Can customize cluster bitmap here
return super.getClusterBitmap(size);
}
};
}
};
mMarkerLayer = new ItemizedLayer<>(
mMap,
new ArrayList<MarkerItem>(),
ClusterMarkerRenderer.factory(symbol, new ClusterMarkerRenderer.ClusterStyle(Color.WHITE, Color.BLUE)),
markerRendererFactory,
this);
mMap.layers().add(mMarkerLayer);

View File

@@ -15,7 +15,7 @@
* You should have received a copy of the GNU Lesser General Public License along with
* this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.oscim.gdx;
package org.oscim.android.test;
import android.os.Bundle;
import android.util.DisplayMetrics;
@@ -28,10 +28,13 @@ import org.oscim.android.canvas.AndroidGraphics;
import org.oscim.backend.CanvasAdapter;
import org.oscim.backend.GLAdapter;
import org.oscim.core.Tile;
import org.oscim.gdx.AndroidGL;
import org.oscim.gdx.GdxAssets;
import org.oscim.gdx.GdxMap;
import org.oscim.tiling.TileSource;
import org.oscim.tiling.source.oscimap4.OSciMap4TileSource;
public class MainActivity extends AndroidApplication {
public class GdxMapActivity extends AndroidApplication {
@Override
public void onCreate(Bundle savedInstanceState) {
@@ -43,7 +46,7 @@ public class MainActivity extends AndroidApplication {
DisplayMetrics metrics = getResources().getDisplayMetrics();
CanvasAdapter.dpi = (int) (metrics.scaledDensity * CanvasAdapter.DEFAULT_DPI);
Tile.SIZE = Tile.calculateTileSize(metrics.scaledDensity);
Tile.SIZE = Tile.calculateTileSize();
AndroidApplicationConfiguration cfg = new AndroidApplicationConfiguration();
cfg.stencil = 8;

View File

@@ -1,186 +1,186 @@
///*
// * 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);
// }
//}
/*
* 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);
}
}

View File

@@ -28,6 +28,7 @@ import org.oscim.layers.vector.geometries.Style;
import org.oscim.map.Map;
import org.oscim.renderer.bucket.TextureItem;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
@@ -45,8 +46,13 @@ public class LineTexActivity extends SimpleMapActivity {
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
TextureItem tex = new TextureItem(CanvasAdapter.getBitmapAsset("", "patterns/pike.png"));
tex.mipmap = true;
TextureItem tex = null;
try {
tex = new TextureItem(CanvasAdapter.getBitmapAsset("", "patterns/pike.png"));
tex.mipmap = true;
} catch (IOException e) {
e.printStackTrace();
}
for (double lat = -90; lat <= 90; lat += 5) {
int c = Color.fade(Color.rainbow((float) (lat + 90) / 180), 0.5f);

View File

@@ -21,7 +21,6 @@ import android.os.Bundle;
import org.oscim.android.MapPreferences;
import org.oscim.android.MapView;
import org.oscim.core.Tile;
import org.oscim.map.Map;
public class MapActivity extends Activity {
@@ -41,7 +40,6 @@ public class MapActivity extends Activity {
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Tile.SIZE = Tile.calculateTileSize(getResources().getDisplayMetrics().scaledDensity);
setContentView(mContentView);
setTitle(getClass().getSimpleName());

View File

@@ -1,107 +0,0 @@
/*
* 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());
}
}
}

View File

@@ -1,88 +0,0 @@
/*
* 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);
}
}

View File

@@ -1,6 +1,7 @@
/*
* Copyright 2014 Hannes Janetzek
* Copyright 2016-2017 devemux86
* Copyright 2017 Longri
*
* This file is part of the OpenScienceMap project (http://www.opensciencemap.org).
*
@@ -25,28 +26,46 @@ import android.view.MenuItem;
import org.oscim.android.filepicker.FilePicker;
import org.oscim.android.filepicker.FilterByFileExtension;
import org.oscim.android.filepicker.ValidMapFile;
import org.oscim.android.filepicker.ValidRenderTheme;
import org.oscim.core.MapElement;
import org.oscim.core.MapPosition;
import org.oscim.core.Tag;
import org.oscim.core.Tile;
import org.oscim.layers.TileGridLayer;
import org.oscim.layers.tile.MapTile;
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.renderer.bucket.RenderBuckets;
import org.oscim.scalebar.DefaultMapScaleBar;
import org.oscim.scalebar.ImperialUnitAdapter;
import org.oscim.scalebar.MapScaleBar;
import org.oscim.scalebar.MapScaleBarLayer;
import org.oscim.scalebar.MetricUnitAdapter;
import org.oscim.theme.ExternalRenderTheme;
import org.oscim.theme.ThemeUtils;
import org.oscim.theme.VtmThemes;
import org.oscim.theme.styles.AreaStyle;
import org.oscim.theme.styles.RenderStyle;
import org.oscim.tiling.source.mapfile.MapFileTileSource;
import org.oscim.tiling.source.mapfile.MapInfo;
public class MapsforgeMapActivity extends MapActivity {
private static final int SELECT_MAP_FILE = 0;
static final int SELECT_MAP_FILE = 0;
static final int SELECT_THEME_FILE = SELECT_MAP_FILE + 1;
private static final Tag ISSEA_TAG = new Tag("natural", "issea");
private static final Tag NOSEA_TAG = new Tag("natural", "nosea");
private static final Tag SEA_TAG = new Tag("natural", "sea");
private TileGridLayer mGridLayer;
private DefaultMapScaleBar mMapScaleBar;
private Menu mMenu;
private VectorTileLayer mTileLayer;
MapFileTileSource mTileSource;
@Override
protected void onCreate(Bundle savedInstanceState) {
@@ -71,9 +90,17 @@ public class MapsforgeMapActivity extends MapActivity {
}
}
public static class ThemeFilePicker extends FilePicker {
public ThemeFilePicker() {
setFileDisplayFilter(new FilterByFileExtension(".xml"));
setFileSelectFilter(new ValidRenderTheme());
}
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.theme_menu, menu);
mMenu = menu;
return true;
}
@@ -106,6 +133,11 @@ public class MapsforgeMapActivity extends MapActivity {
item.setChecked(true);
return true;
case R.id.theme_external:
startActivityForResult(new Intent(this, ThemeFilePicker.class),
SELECT_THEME_FILE);
return true;
case R.id.gridlayer:
if (item.isChecked()) {
item.setChecked(false);
@@ -133,16 +165,16 @@ public class MapsforgeMapActivity extends MapActivity {
return;
}
MapFileTileSource tileSource = new MapFileTileSource();
tileSource.setPreferredLanguage("en");
mTileSource = new MapFileTileSource();
//mTileSource.setPreferredLanguage("en");
String file = intent.getStringExtra(FilePicker.SELECTED_FILE);
if (tileSource.setMapFile(file)) {
if (mTileSource.setMapFile(file)) {
VectorTileLayer l = mMap.setBaseMap(tileSource);
mTileLayer = mMap.setBaseMap(mTileSource);
loadTheme(null);
mMap.layers().add(new BuildingLayer(mMap, l));
mMap.layers().add(new LabelLayer(mMap, l));
mMap.layers().add(new BuildingLayer(mMap, mTileLayer));
mMap.layers().add(new LabelLayer(mMap, mTileLayer));
mMapScaleBar = new DefaultMapScaleBar(mMap);
mMapScaleBar.setScaleBarMode(DefaultMapScaleBar.ScaleBarMode.BOTH);
@@ -156,13 +188,41 @@ public class MapsforgeMapActivity extends MapActivity {
renderer.setOffset(5 * getResources().getDisplayMetrics().density, 0);
mMap.layers().add(mapScaleBarLayer);
MapInfo info = tileSource.getMapInfo();
MapInfo info = mTileSource.getMapInfo();
MapPosition pos = new MapPosition();
pos.setByBoundingBox(info.boundingBox, Tile.SIZE * 4, Tile.SIZE * 4);
mMap.setMapPosition(pos);
mPrefs.clear();
}
} else if (requestCode == SELECT_THEME_FILE) {
if (resultCode != RESULT_OK || intent == null || intent.getStringExtra(FilePicker.SELECTED_FILE) == null) {
return;
}
String file = intent.getStringExtra(FilePicker.SELECTED_FILE);
ExternalRenderTheme externalRenderTheme = new ExternalRenderTheme(file);
// Use tessellation with sea and land for Mapsforge themes
if (ThemeUtils.isMapsforgeTheme(externalRenderTheme)) {
mTileLayer.addHook(new VectorTileLayer.TileLoaderThemeHook() {
@Override
public boolean process(MapTile tile, RenderBuckets buckets, MapElement element, RenderStyle style, int level) {
if (element.tags.contains(ISSEA_TAG) || element.tags.contains(SEA_TAG) || element.tags.contains(NOSEA_TAG)) {
if (style instanceof AreaStyle)
((AreaStyle) style).mesh = true;
}
return false;
}
@Override
public void complete(MapTile tile, boolean success) {
}
});
}
mMap.setTheme(externalRenderTheme);
mMenu.findItem(R.id.theme_external).setChecked(true);
}
}

View File

@@ -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.utils.Parameters;
public class MapsforgePolyLabelActivity extends MapsforgeMapActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
Parameters.POLY_LABEL = true;
super.onCreate(savedInstanceState);
}
}

View File

@@ -1,5 +1,5 @@
/*
* 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
@@ -58,7 +58,7 @@ public class MapsforgeStyleActivity extends MapsforgeMapActivity {
@Override
protected void loadTheme(final String styleId) {
mMap.setTheme(new AssetsRenderTheme(this, "", "vtm/stylemenu.xml", new XmlRenderThemeMenuCallback() {
mMap.setTheme(new AssetsRenderTheme(getAssets(), "", "vtm/stylemenu.xml", new XmlRenderThemeMenuCallback() {
@Override
public Set<String> getCategories(XmlRenderThemeStyleMenu renderThemeStyleMenu) {
// Use the selected style or the default

View File

@@ -17,7 +17,6 @@
*/
package org.oscim.android.test;
import android.graphics.drawable.Drawable;
import android.widget.Toast;
import org.oscim.backend.canvas.Bitmap;
@@ -59,21 +58,18 @@ public class MarkerOverlayActivity extends SimpleMapActivity
mMap.layers().add(new LabelLayer(mMap, l));
mMap.setTheme(VtmThemes.DEFAULT);
/* directly load bitmap from resources */
Bitmap bitmap = drawableToBitmap(getResources(), R.drawable.marker_poi);
Bitmap bitmapPoi = drawableToBitmap(getResources().getDrawable(R.drawable.marker_poi));
MarkerSymbol symbol;
if (BILLBOARDS)
symbol = new MarkerSymbol(bitmap, HotspotPlace.BOTTOM_CENTER);
symbol = new MarkerSymbol(bitmapPoi, HotspotPlace.BOTTOM_CENTER);
else
symbol = new MarkerSymbol(bitmap, HotspotPlace.CENTER, false);
symbol = new MarkerSymbol(bitmapPoi, HotspotPlace.CENTER, false);
/* another option: use some bitmap drawable */
Drawable d = getResources().getDrawable(R.drawable.marker_focus);
Bitmap bitmapFocus = drawableToBitmap(getResources().getDrawable(R.drawable.marker_focus));
if (BILLBOARDS)
mFocusMarker = new MarkerSymbol(drawableToBitmap(d), HotspotPlace.BOTTOM_CENTER);
mFocusMarker = new MarkerSymbol(bitmapFocus, HotspotPlace.BOTTOM_CENTER);
else
mFocusMarker = new MarkerSymbol(drawableToBitmap(d), HotspotPlace.CENTER, false);
mFocusMarker = new MarkerSymbol(bitmapFocus, HotspotPlace.CENTER, false);
mMarkerLayer = new ItemizedLayer<>(mMap, new ArrayList<MarkerItem>(), symbol, this);
mMap.layers().add(mMarkerLayer);

View File

@@ -1,6 +1,6 @@
/*
* Copyright 2016 Marvin W
* Copyright 2016 devemux86
* Copyright 2016-2017 devemux86
*
* This file is part of the OpenScienceMap project (http://www.opensciencemap.org).
*
@@ -22,7 +22,6 @@ import android.os.Bundle;
import org.oscim.android.MapPreferences;
import org.oscim.android.MapView;
import org.oscim.core.Tile;
import org.oscim.layers.tile.buildings.BuildingLayer;
import org.oscim.layers.tile.vector.VectorTileLayer;
import org.oscim.layers.tile.vector.labeling.LabelLayer;
@@ -36,7 +35,6 @@ public class MultiMapActivity extends Activity {
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Tile.SIZE = Tile.calculateTileSize(getResources().getDisplayMetrics().scaledDensity);
setContentView(R.layout.activity_map_multi);
setTitle(getClass().getSimpleName());

View File

@@ -1,5 +1,5 @@
/*
* 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
@@ -14,13 +14,13 @@
*/
package org.oscim.android.test;
import org.oscim.map.Map;
import org.oscim.utils.Parameters;
public class NewGesturesActivity extends MarkerOverlayActivity {
public NewGesturesActivity() {
super();
Map.NEW_GESTURES = true;
Parameters.MAP_EVENT_LAYER2 = true;
}
@Override
@@ -28,6 +28,6 @@ public class NewGesturesActivity extends MarkerOverlayActivity {
super.onDestroy();
// Revert gestures for other activities
Map.NEW_GESTURES = false;
Parameters.MAP_EVENT_LAYER2 = false;
}
}

View File

@@ -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.OpenMapTilesGeojsonTileSource;
public class OpenMapTilesGeojsonMapActivity extends MapActivity {
private static final boolean USE_CACHE = false;
private TileCache mCache;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
UrlTileSource tileSource = OpenMapTilesGeojsonTileSource.builder()
.apiKey("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.OPENMAPTILES);
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();
}
}

View File

@@ -1,69 +0,0 @@
/*
* 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.os.Bundle;
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.IRenderTheme;
import org.oscim.theme.ThemeLoader;
import org.oscim.theme.VtmThemes;
import org.oscim.tiling.source.geojson.OsmBuildingJsonTileSource;
import org.oscim.tiling.source.geojson.OsmLanduseJsonTileSource;
import org.oscim.tiling.source.geojson.OsmRoadLabelJsonTileSource;
import org.oscim.tiling.source.geojson.OsmRoadLineJsonTileSource;
import org.oscim.tiling.source.geojson.OsmWaterJsonTileSource;
public class OsmJsonMapActivity extends MapActivity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
IRenderTheme theme = ThemeLoader.load(VtmThemes.DEFAULT);
mMap.setBaseMap(new VectorTileLayer(mMap, new OsmLanduseJsonTileSource()));
mMap.setTheme(theme);
VectorTileLayer l = new VectorTileLayer(mMap, new OsmWaterJsonTileSource());
l.setRenderTheme(theme);
l.tileRenderer().setOverdrawColor(0);
mMap.layers().add(l);
l = new VectorTileLayer(mMap, new OsmRoadLineJsonTileSource());
l.setRenderTheme(theme);
l.tileRenderer().setOverdrawColor(0);
mMap.layers().add(l);
l = new VectorTileLayer(mMap, new OsmBuildingJsonTileSource());
l.setRenderTheme(theme);
l.tileRenderer().setOverdrawColor(0);
mMap.layers().add(l);
mMap.layers().add(new BuildingLayer(mMap, l));
l = new VectorTileLayer(mMap, new OsmRoadLabelJsonTileSource());
l.setRenderTheme(theme);
l.tileRenderer().setOverdrawColor(0);
mMap.layers().add(l);
mMap.layers().add(new LabelLayer(mMap, l));
mMap.setMapPosition(53.08, 8.83, Math.pow(2, 16));
}
}

View File

@@ -16,13 +16,13 @@ package org.oscim.android.test;
import android.os.Bundle;
import org.oscim.theme.ThemeLoader;
import org.oscim.utils.Parameters;
public class POTTextureActivity extends SimpleMapActivity {
@Override
public void onCreate(Bundle savedInstanceState) {
ThemeLoader.POT_TEXTURES = true;
Parameters.POT_TEXTURES = true;
super.onCreate(savedInstanceState);
}

View File

@@ -18,10 +18,14 @@
package org.oscim.android.test;
import android.os.Bundle;
import android.widget.Toast;
import org.oscim.backend.CanvasAdapter;
import org.oscim.backend.canvas.Color;
import org.oscim.core.MapPosition;
import org.oscim.event.Event;
import org.oscim.event.Gesture;
import org.oscim.event.MotionEvent;
import org.oscim.layers.vector.PathLayer;
import org.oscim.map.Map.UpdateListener;
@@ -44,7 +48,18 @@ public class PathOverlayActivity extends SimpleMapActivity {
for (double lat = -90; lat <= 90; lat += 5) {
int c = Color.fade(Color.rainbow((float) (lat + 90) / 180), 0.5f);
PathLayer pathLayer = new PathLayer(mMap, c, 6);
PathLayer pathLayer = new PathLayer(mMap, c, 6 * CanvasAdapter.getScale()) {
@Override
public boolean onGesture(Gesture g, MotionEvent e) {
if (g instanceof Gesture.Tap) {
if (contains(e.getX(), e.getY())) {
Toast.makeText(PathOverlayActivity.this, "PathLayer tap\n" + mMap.viewport().fromScreenPoint(e.getX(), e.getY()), Toast.LENGTH_SHORT).show();
return true;
}
}
return false;
}
};
mMap.layers().add(pathLayer);
mPathLayers.add(pathLayer);
}

View File

@@ -0,0 +1,193 @@
/*
* 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.content.Intent;
import android.os.AsyncTask;
import android.os.Bundle;
import android.view.Menu;
import android.widget.Toast;
import org.mapsforge.poi.android.storage.AndroidPoiPersistenceManagerFactory;
import org.mapsforge.poi.storage.ExactMatchPoiCategoryFilter;
import org.mapsforge.poi.storage.PoiCategoryFilter;
import org.mapsforge.poi.storage.PoiCategoryManager;
import org.mapsforge.poi.storage.PoiPersistenceManager;
import org.mapsforge.poi.storage.PointOfInterest;
import org.oscim.android.filepicker.FilePicker;
import org.oscim.android.filepicker.FilterByFileExtension;
import org.oscim.backend.canvas.Bitmap;
import org.oscim.core.BoundingBox;
import org.oscim.core.GeoPoint;
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.map.Map;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.lang.ref.WeakReference;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import static org.oscim.android.canvas.AndroidGraphics.drawableToBitmap;
/**
* POI search.<br/>
* Long press on map to search inside visible bounding box.<br/>
* Tap on POIs to show their name (in default locale).
*/
public class PoiSearchActivity extends MapsforgeMapActivity implements ItemizedLayer.OnItemGestureListener<MarkerItem> {
private static final Logger log = LoggerFactory.getLogger(PoiSearchActivity.class);
private static String POI_FILE;
private static final String POI_CATEGORY = "Restaurants";
private static final int SELECT_POI_FILE = MapsforgeMapActivity.SELECT_THEME_FILE + 1;
private ItemizedLayer<MarkerItem> mMarkerLayer;
public static class PoiFilePicker extends FilePicker {
public PoiFilePicker() {
setFileDisplayFilter(new FilterByFileExtension(".poi"));
}
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// Map events receiver
mMap.layers().add(new PoiSearchActivity.MapEventsReceiver(mMap));
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
return false;
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent intent) {
super.onActivityResult(requestCode, resultCode, intent);
if (requestCode == SELECT_MAP_FILE) {
if (mTileSource != null)
startActivityForResult(new Intent(this, PoiFilePicker.class),
SELECT_POI_FILE);
else
finish();
} else if (requestCode == SELECT_POI_FILE) {
if (resultCode != RESULT_OK || intent == null || intent.getStringExtra(FilePicker.SELECTED_FILE) == null) {
finish();
return;
}
POI_FILE = intent.getStringExtra(FilePicker.SELECTED_FILE);
Bitmap bitmap = drawableToBitmap(getResources().getDrawable(R.drawable.marker_green));
MarkerSymbol symbol = new MarkerSymbol(bitmap, MarkerSymbol.HotspotPlace.BOTTOM_CENTER);
mMarkerLayer = new ItemizedLayer<>(mMap, new ArrayList<MarkerItem>(), symbol, this);
mMap.layers().add(mMarkerLayer);
}
}
@Override
public boolean onItemSingleTapUp(int index, MarkerItem item) {
Toast.makeText(this, item.getTitle(), Toast.LENGTH_SHORT).show();
return true;
}
@Override
public boolean onItemLongPress(int index, MarkerItem item) {
return false;
}
private class MapEventsReceiver extends Layer implements GestureListener {
MapEventsReceiver(Map map) {
super(map);
}
@Override
public boolean onGesture(Gesture g, MotionEvent e) {
if (g instanceof Gesture.LongPress) {
// Clear overlays
mMarkerLayer.removeAllItems();
mMap.render();
// POI search
new PoiSearchTask(PoiSearchActivity.this, POI_CATEGORY).execute(mMap.getBoundingBox(0));
return true;
}
return false;
}
}
private class PoiSearchTask extends AsyncTask<BoundingBox, Void, Collection<PointOfInterest>> {
private final WeakReference<PoiSearchActivity> weakActivity;
private final String category;
private PoiSearchTask(PoiSearchActivity activity, String category) {
this.weakActivity = new WeakReference<>(activity);
this.category = category;
}
@Override
protected Collection<PointOfInterest> doInBackground(BoundingBox... params) {
// Search POI
PoiPersistenceManager persistenceManager = null;
try {
persistenceManager = AndroidPoiPersistenceManagerFactory.getPoiPersistenceManager(POI_FILE);
PoiCategoryManager categoryManager = persistenceManager.getCategoryManager();
PoiCategoryFilter categoryFilter = new ExactMatchPoiCategoryFilter();
categoryFilter.addCategory(categoryManager.getPoiCategoryByTitle(category));
org.mapsforge.core.model.BoundingBox bb = new org.mapsforge.core.model.BoundingBox(
params[0].getMinLatitude(), params[0].getMinLongitude(),
params[0].getMaxLatitude(), params[0].getMaxLongitude());
return persistenceManager.findInRect(bb, categoryFilter, null, Integer.MAX_VALUE);
} catch (Throwable t) {
log.error(t.getMessage(), t);
} finally {
if (persistenceManager != null) {
persistenceManager.close();
}
}
return null;
}
@Override
protected void onPostExecute(Collection<PointOfInterest> pointOfInterests) {
PoiSearchActivity activity = weakActivity.get();
if (activity == null) {
return;
}
Toast.makeText(activity, category + ": " + (pointOfInterests != null ? pointOfInterests.size() : 0), Toast.LENGTH_SHORT).show();
if (pointOfInterests == null) {
return;
}
// Overlay POI
List<MarkerItem> pts = new ArrayList<>();
for (PointOfInterest pointOfInterest : pointOfInterests)
pts.add(new MarkerItem(pointOfInterest.getName(), "", new GeoPoint(pointOfInterest.getLatitude(), pointOfInterest.getLongitude())));
mMarkerLayer.addItems(pts);
mMap.render();
}
}
}

View File

@@ -0,0 +1,145 @@
/*
* 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.app.AlertDialog;
import android.content.Intent;
import android.os.Bundle;
import android.view.Menu;
import org.oscim.backend.CanvasAdapter;
import org.oscim.core.GeoPoint;
import org.oscim.core.GeometryBuffer;
import org.oscim.core.MercatorProjection;
import org.oscim.core.Point;
import org.oscim.core.Tag;
import org.oscim.core.Tile;
import org.oscim.event.Gesture;
import org.oscim.event.GestureListener;
import org.oscim.event.MotionEvent;
import org.oscim.layers.Layer;
import org.oscim.layers.TileGridLayer;
import org.oscim.map.Map;
import org.oscim.tiling.source.mapfile.MapDatabase;
import org.oscim.tiling.source.mapfile.MapReadResult;
import org.oscim.tiling.source.mapfile.PointOfInterest;
import org.oscim.tiling.source.mapfile.Way;
import org.oscim.utils.GeoPointUtils;
import java.util.List;
/**
* Reverse Geocoding with long press.
* <p/>
* - POI in specified radius.<br/>
* - Ways containing touch point.
*/
public class ReverseGeocodeActivity extends MapsforgeMapActivity {
private static final int TOUCH_RADIUS = 32 / 2;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// Map events receiver
mMap.layers().add(new MapEventsReceiver(mMap));
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
return false;
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent intent) {
super.onActivityResult(requestCode, resultCode, intent);
if (requestCode == SELECT_MAP_FILE) {
// For debug
TileGridLayer gridLayer = new TileGridLayer(mMap, getResources().getDisplayMetrics().density);
mMap.layers().add(gridLayer);
}
}
private class MapEventsReceiver extends Layer implements GestureListener {
MapEventsReceiver(Map map) {
super(map);
}
@Override
public boolean onGesture(Gesture g, MotionEvent e) {
if (g instanceof Gesture.LongPress) {
GeoPoint p = mMap.viewport().fromScreenPoint(e.getX(), e.getY());
// Read all labeled POI and ways for the area covered by the tiles under touch
float touchRadius = TOUCH_RADIUS * CanvasAdapter.getScale();
long mapSize = MercatorProjection.getMapSize((byte) mMap.getMapPosition().getZoomLevel());
double pixelX = MercatorProjection.longitudeToPixelX(p.getLongitude(), mapSize);
double pixelY = MercatorProjection.latitudeToPixelY(p.getLatitude(), mapSize);
int tileXMin = MercatorProjection.pixelXToTileX(pixelX - touchRadius, (byte) mMap.getMapPosition().getZoomLevel());
int tileXMax = MercatorProjection.pixelXToTileX(pixelX + touchRadius, (byte) mMap.getMapPosition().getZoomLevel());
int tileYMin = MercatorProjection.pixelYToTileY(pixelY - touchRadius, (byte) mMap.getMapPosition().getZoomLevel());
int tileYMax = MercatorProjection.pixelYToTileY(pixelY + touchRadius, (byte) mMap.getMapPosition().getZoomLevel());
Tile upperLeft = new Tile(tileXMin, tileYMin, (byte) mMap.getMapPosition().getZoomLevel());
Tile lowerRight = new Tile(tileXMax, tileYMax, (byte) mMap.getMapPosition().getZoomLevel());
MapReadResult mapReadResult = ((MapDatabase) mTileSource.getDataSource()).readLabels(upperLeft, lowerRight);
StringBuilder sb = new StringBuilder();
// Filter POI
sb.append("*** POI ***");
for (PointOfInterest pointOfInterest : mapReadResult.pointOfInterests) {
Point layerXY = new Point();
mMap.viewport().toScreenPoint(pointOfInterest.position, false, layerXY);
Point tapXY = new Point(e.getX(), e.getY());
if (layerXY.distance(tapXY) > touchRadius) {
continue;
}
sb.append("\n");
List<Tag> tags = pointOfInterest.tags;
for (Tag tag : tags) {
sb.append("\n").append(tag.key).append("=").append(tag.value);
}
}
// Filter ways
sb.append("\n\n").append("*** WAYS ***");
for (Way way : mapReadResult.ways) {
if (way.geometryType != GeometryBuffer.GeometryType.POLY
|| !GeoPointUtils.contains(way.geoPoints[0], p)) {
continue;
}
sb.append("\n");
List<Tag> tags = way.tags;
for (Tag tag : tags) {
sb.append("\n").append(tag.key).append("=").append(tag.value);
}
}
AlertDialog.Builder builder = new AlertDialog.Builder(ReverseGeocodeActivity.this);
builder.setIcon(android.R.drawable.ic_menu_search);
builder.setTitle(R.string.dialog_reverse_geocoding_title);
builder.setMessage(sb);
builder.setPositiveButton(R.string.ok, null);
builder.show();
return true;
}
return false;
}
}
}

View File

@@ -22,19 +22,57 @@ package org.oscim.android.test;
import android.app.Activity;
import android.content.Intent;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.view.Gravity;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.LinearLayout;
import android.widget.TextView;
/**
* A simple start screen for the sample activities.
* Start screen for the sample activities.
*/
public class Samples extends Activity {
private Button createButton(Class<?> clazz) {
return this.createButton(clazz, null, null);
}
private Button createButton(final Class<?> clazz, String text, View.OnClickListener customListener) {
Button button = new Button(this);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH)
button.setAllCaps(false);
if (text == null) {
button.setText(clazz.getSimpleName());
} else {
button.setText(text);
}
if (customListener == null) {
button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
startActivity(new Intent(Samples.this, clazz));
}
});
} else {
button.setOnClickListener(customListener);
}
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;
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
@@ -45,9 +83,21 @@ public class Samples extends Activity {
linearLayout.addView(createButton(MapsforgeMapActivity.class));
linearLayout.addView(createButton(MapzenMvtMapActivity.class));
linearLayout.addView(createButton(MapzenGeojsonMapActivity.class));
linearLayout.addView(createButton(OpenMapTilesGeojsonMapActivity.class));
linearLayout.addView(createButton(GdxMapActivity.class));
linearLayout.addView(createLabel("Features"));
linearLayout.addView(createButton(null, "GraphHopper Routing", new View.OnClickListener() {
@Override
public void onClick(View v) {
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("https://github.com/graphhopper/graphhopper/tree/master/android")));
}
}));
linearLayout.addView(createButton(PoiSearchActivity.class));
linearLayout.addView(createLabel("Vector Features"));
linearLayout.addView(createButton(MapsforgeStyleActivity.class));
linearLayout.addView(createButton(MapsforgePolyLabelActivity.class));
linearLayout.addView(createButton(AtlasThemeActivity.class));
linearLayout.addView(createButton(POTTextureActivity.class));
@@ -68,46 +118,14 @@ public class Samples extends Activity {
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(ReverseGeocodeActivity.class));
linearLayout.addView(createButton(S3DBMapActivity.class));
linearLayout.addView(createButton(ThemeStylerActivity.class));
//linearLayout.addView(createButton(JeoIndoorMapActivity.class));
}
private Button createButton(final Class<?> clazz) {
return this.createButton(clazz, null);
}
private Button createButton(final Class<?> clazz, String text) {
Button button = new Button(this);
if (text == null) {
button.setText(clazz.getSimpleName());
} else {
button.setText(text);
}
button.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View view) {
startActivity(new Intent(Samples.this, clazz));
}
});
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;
linearLayout.addView(createButton(JeoIndoorMapActivity.class));
}
}

View File

@@ -1,30 +1,2 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="org.oscim.gdx"
android:installLocation="auto"
android:versionCode="1"
android:versionName="1.0">
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-sdk
android:minSdkVersion="10"
android:targetSdkVersion="22" />
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name">
<activity
android:name=".MainActivity"
android:configChanges="keyboard|keyboardHidden|orientation|screenSize">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
<?xml version="1.0" encoding="UTF-8"?>
<manifest package="org.oscim.gdx" />

View File

@@ -1,11 +1,8 @@
apply plugin: 'com.android.application'
apply plugin: 'com.android.library'
apply plugin: 'com.github.dcendents.android-maven'
dependencies {
compile project(':vtm-android')
compile project(':vtm-gdx')
compile "com.badlogicgames.gdx:gdx-backend-android:$gdxVersion"
compile 'com.noveogroup.android:android-logger:1.3.6'
api project(':vtm')
}
android {
@@ -21,6 +18,7 @@ android {
versionCode versionCode()
versionName versionName()
minSdkVersion androidMinSdk()
targetSdkVersion androidTargetSdk()
}
sourceSets {
@@ -28,14 +26,6 @@ android {
manifest.srcFile 'AndroidManifest.xml'
java.srcDirs = ['src']
resources.srcDirs = ['src']
aidl.srcDirs = ['src', 'assets']
renderscript.srcDirs = ['src', 'assets']
res.srcDirs = ['res']
assets.srcDirs = ['assets']
file('natives').eachDir() { dir ->
jniLibs.srcDirs += "${dir.path}/lib"
jniLibs.srcDirs += "${rootDir}/vtm-android/natives/${dir.name}/lib"
}
}
debug.setRoot('build-types/debug')
release.setRoot('build-types/release')
@@ -44,52 +34,21 @@ android {
lintOptions { abortOnError false }
}
android.applicationVariants.all { variant ->
android.libraryVariants.all { variant ->
def name = variant.buildType.name
if (name.equals("debug")) {
print "Skipping debug jar"
return; // Skip debug builds.
}
if (name == "debug")
return
def jar = project.tasks.create "jar${name.capitalize()}", Jar
jar.dependsOn variant.javaCompile
jar.from variant.javaCompile.destinationDir
jar.exclude 'android-logger.properties'
artifacts.add('archives', jar);
jar.dependsOn variant.javaCompiler
jar.from variant.javaCompiler.destinationDir
artifacts.add('archives', jar)
file('natives').eachDir() { dir ->
def nativesJar = project.tasks.create "nativesJar${name.capitalize()}-${dir.name}", Jar
nativesJar.classifier = "natives-${dir.name}"
nativesJar.from(dir.path)
artifacts.add('archives', nativesJar);
}
def fatJar = project.tasks.create "fatJar${name.capitalize()}", Jar
fatJar.classifier = 'jar-with-dependencies'
fatJar.dependsOn variant.javaCompile
fatJar.from variant.javaCompile.destinationDir
fatJar.from { configurations.compile.collect { it.isDirectory() ? it : zipTree(it) } }
file('natives').eachDir() { dir ->
fatJar.from(dir.path)
fatJar.from("${rootProject.projectDir}/vtm-android/natives/${dir.name}")
}
fatJar.exclude 'android-logger.properties'
artifacts.add('archives', fatJar);
}
afterEvaluate {
configurations.archives.artifacts.removeAll { it.file =~ 'apk' }
}
task run(dependsOn: 'installDebug') {
doFirst {
println(">> adb run...")
String adb = System.getenv()['ANDROID_HOME'] + '/platform-tools/adb'
String cmd = "${adb} shell am start -n org.oscim.gdx/.MainActivity"
def proc = cmd.execute()
proc.in.eachLine { line -> println line }
proc.err.eachLine { line -> System.err.println('ERROR: ' + line) }
proc.waitFor()
artifacts.add('archives', nativesJar)
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 41 KiB

View File

@@ -1,7 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical">
</LinearLayout>

View File

@@ -1,4 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name">VTM GDX</string>
</resources>

View File

@@ -1 +0,0 @@
root=DEBUG:%logger

View File

@@ -2,13 +2,14 @@ apply plugin: 'com.android.library'
apply plugin: 'com.github.dcendents.android-maven'
dependencies {
compile project(':vtm')
compile 'com.caverock:androidsvg:1.2.2-beta-1'
api project(':vtm')
implementation 'com.caverock:androidsvg:1.2.2-beta-1'
implementation "org.slf4j:slf4j-api:$slf4jVersion"
}
android {
compileSdkVersion androidCompileSdk()
buildToolsVersion = "$androidBuildVersionTools"
buildToolsVersion "$androidBuildVersionTools"
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
@@ -19,6 +20,7 @@ android {
versionCode versionCode()
versionName versionName()
minSdkVersion androidMinSdk()
targetSdkVersion androidTargetSdk()
}
sourceSets {
@@ -26,8 +28,6 @@ android {
manifest.srcFile 'AndroidManifest.xml'
java.srcDirs = ['src']
resources.srcDirs = ['src']
res.srcDirs = ['res']
assets.srcDirs = ['assets']
}
debug.setRoot('build-types/debug')
release.setRoot('build-types/release')
@@ -38,32 +38,20 @@ android {
android.libraryVariants.all { variant ->
def name = variant.buildType.name
if (name.equals("debug")) {
print "Skipping debug jar"
return; // Skip debug builds.
}
if (name == "debug")
return
def jar = project.tasks.create "jar${name.capitalize()}", Jar
jar.dependsOn variant.javaCompile
jar.from variant.javaCompile.destinationDir
artifacts.add('archives', jar);
jar.dependsOn variant.javaCompiler
jar.from variant.javaCompiler.destinationDir
artifacts.add('archives', jar)
file('natives').eachDir() { dir ->
def nativesJar = project.tasks.create "nativesJar${name.capitalize()}-${dir.name}", Jar
nativesJar.classifier = "natives-${dir.name}"
nativesJar.from(dir.path)
artifacts.add('archives', nativesJar);
artifacts.add('archives', nativesJar)
}
def fatJar = project.tasks.create "fatJar${name.capitalize()}", Jar
fatJar.classifier = 'jar-with-dependencies'
fatJar.dependsOn variant.javaCompile
fatJar.from variant.javaCompile.destinationDir
fatJar.from { configurations.compile.collect { it.isDirectory() ? it : zipTree(it) } }
file('natives').eachDir() { dir ->
fatJar.from(dir.path)
}
artifacts.add('archives', fatJar);
}
if (project.hasProperty("SONATYPE_USERNAME")) {

View File

@@ -31,7 +31,9 @@ import org.oscim.android.input.AndroidMotionEvent;
import org.oscim.android.input.GestureHandler;
import org.oscim.backend.CanvasAdapter;
import org.oscim.backend.GLAdapter;
import org.oscim.core.Tile;
import org.oscim.map.Map;
import org.oscim.utils.Parameters;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -82,6 +84,8 @@ public class MapView extends GLSurfaceView {
DisplayMetrics metrics = getResources().getDisplayMetrics();
CanvasAdapter.dpi = (int) (metrics.scaledDensity * CanvasAdapter.DEFAULT_DPI);
if (!Parameters.CUSTOM_TILE_SIZE)
Tile.SIZE = Tile.calculateTileSize();
/* Initialize the Map */
mMap = new AndroidMap(this);
@@ -100,7 +104,7 @@ public class MapView extends GLSurfaceView {
mMap.clearMap();
mMap.updateMap(false);
if (!Map.NEW_GESTURES) {
if (!Parameters.MAP_EVENT_LAYER2) {
GestureHandler gestureHandler = new GestureHandler(mMap);
mGestureDetector = new GestureDetector(context, gestureHandler);
mGestureDetector.setOnDoubleTapListener(gestureHandler);

View File

@@ -21,6 +21,7 @@ package org.oscim.android.canvas;
import android.graphics.Color;
import android.graphics.PorterDuff;
import android.graphics.RectF;
import org.oscim.backend.canvas.Bitmap;
import org.oscim.backend.canvas.Canvas;
@@ -87,6 +88,14 @@ public class AndroidCanvas implements Canvas {
canvas.drawColor(color, color == Color.TRANSPARENT ? PorterDuff.Mode.CLEAR : PorterDuff.Mode.SRC_OVER);
}
@Override
public void fillRectangle(float x, float y, float width, float height, int color) {
RectF rect = new RectF(x, y, x + width, y + height);
android.graphics.Paint paint = new android.graphics.Paint();
paint.setColor(color);
canvas.drawRect(rect, paint);
}
@Override
public int getHeight() {
return canvas.getHeight();

View File

@@ -1,6 +1,6 @@
/*
* Copyright 2010, 2011, 2012 mapsforge.org
* Copyright 2016 devemux86
* Copyright 2016-2017 devemux86
* Copyright 2017 Longri
*
* This file is part of the OpenScienceMap project (http://www.opensciencemap.org).
@@ -59,23 +59,13 @@ public final class AndroidGraphics extends CanvasAdapter {
}
@Override
public Bitmap decodeSvgBitmapImpl(InputStream inputStream, int width, int height, int percent) {
try {
return new AndroidSvgBitmap(inputStream, width, height, percent);
} catch (IOException e) {
e.printStackTrace();
return null;
}
public Bitmap decodeSvgBitmapImpl(InputStream inputStream, int width, int height, int percent) throws IOException {
return new AndroidSvgBitmap(inputStream, width, height, percent);
}
@Override
public Bitmap loadBitmapAssetImpl(String relativePathPrefix, String src, int width, int height, int percent) {
try {
return createBitmap(relativePathPrefix, src, width, height, percent);
} catch (IOException e) {
e.printStackTrace();
}
return null;
public Bitmap loadBitmapAssetImpl(String relativePathPrefix, String src, int width, int height, int percent) throws IOException {
return createBitmap(relativePathPrefix, src, width, height, percent);
}
@Override
@@ -112,7 +102,7 @@ public final class AndroidGraphics extends CanvasAdapter {
}
public static Bitmap drawableToBitmap(Resources res, int resId) {
return new AndroidBitmap(res.openRawResource(resId));
return drawableToBitmap(res.getDrawable(resId));
}
/**

View File

@@ -1,7 +1,7 @@
/*
* Copyright 2010, 2011, 2012 mapsforge.org
* Copyright 2013-2014 Ludwig M Brinckmann
* Copyright 2014-2016 devemux86
* Copyright 2014-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
@@ -78,7 +78,7 @@ public class AndroidSvgBitmap extends AndroidBitmap {
private static android.graphics.Bitmap getResourceBitmapImpl(InputStream inputStream, int width, int height, int percent) throws IOException {
synchronized (SVG.getVersion()) {
return getResourceBitmap(inputStream, CanvasAdapter.dpi / CanvasAdapter.DEFAULT_DPI, DEFAULT_SIZE, width, height, percent);
return getResourceBitmap(inputStream, CanvasAdapter.getScale(), DEFAULT_SIZE, width, height, percent);
}
}

View File

@@ -1,6 +1,7 @@
/*
* Copyright 2010, 2011, 2012 mapsforge.org
* Copyright 2016-2017 devemux86
* Copyright 2017 Andrey Novikov
*
* This program is free software: you can redistribute it and/or modify it under the
* terms of the GNU Lesser General Public License as published by the Free Software
@@ -15,11 +16,12 @@
*/
package org.oscim.android.theme;
import android.content.Context;
import android.content.res.AssetManager;
import android.text.TextUtils;
import org.oscim.theme.IRenderTheme.ThemeException;
import org.oscim.theme.ThemeFile;
import org.oscim.theme.ThemeUtils;
import org.oscim.theme.XmlRenderThemeMenuCallback;
import org.oscim.utils.Utils;
@@ -33,36 +35,33 @@ import java.io.InputStream;
public class AssetsRenderTheme implements ThemeFile {
private static final long serialVersionUID = 1L;
private final InputStream mInputStream;
private final AssetManager mAssetManager;
private final String mFileName;
private XmlRenderThemeMenuCallback mMenuCallback;
private final String mRelativePathPrefix;
/**
* @param context the Android context.
* @param assetManager the Android asset manager.
* @param relativePathPrefix the prefix for all relative resource paths.
* @param fileName the path to the XML render theme file.
* @throws ThemeException if an error occurs while reading the render theme XML.
*/
public AssetsRenderTheme(Context context, String relativePathPrefix, String fileName) throws ThemeException {
this(context, relativePathPrefix, fileName, null);
public AssetsRenderTheme(AssetManager assetManager, String relativePathPrefix, String fileName) throws ThemeException {
this(assetManager, relativePathPrefix, fileName, null);
}
/**
* @param context the Android context.
* @param assetManager the Android asset manager.
* @param relativePathPrefix the prefix for all relative resource paths.
* @param fileName the path to the XML render theme file.
* @param menuCallback the interface callback to create a settings menu on the fly.
* @throws ThemeException if an error occurs while reading the render theme XML.
*/
public AssetsRenderTheme(Context context, String relativePathPrefix, String fileName, XmlRenderThemeMenuCallback menuCallback) throws ThemeException {
public AssetsRenderTheme(AssetManager assetManager, String relativePathPrefix, String fileName, XmlRenderThemeMenuCallback menuCallback) throws ThemeException {
mAssetManager = assetManager;
mRelativePathPrefix = relativePathPrefix;
mFileName = fileName;
mMenuCallback = menuCallback;
try {
mInputStream = context.getAssets().open((TextUtils.isEmpty(mRelativePathPrefix) ? "" : mRelativePathPrefix) + fileName);
} catch (IOException e) {
throw new ThemeException(e.getMessage());
}
}
@Override
@@ -73,7 +72,7 @@ public class AssetsRenderTheme implements ThemeFile {
return false;
}
AssetsRenderTheme other = (AssetsRenderTheme) obj;
if (mInputStream != other.mInputStream) {
if (getRenderThemeAsStream() != other.getRenderThemeAsStream()) {
return false;
}
if (!Utils.equals(mRelativePathPrefix, other.mRelativePathPrefix)) {
@@ -94,7 +93,16 @@ public class AssetsRenderTheme implements ThemeFile {
@Override
public InputStream getRenderThemeAsStream() throws ThemeException {
return mInputStream;
try {
return mAssetManager.open((TextUtils.isEmpty(mRelativePathPrefix) ? "" : mRelativePathPrefix) + mFileName);
} catch (IOException e) {
throw new ThemeException(e.getMessage());
}
}
@Override
public boolean isMapsforgeTheme() {
return ThemeUtils.isMapsforgeTheme(this);
}
@Override

View File

@@ -13,10 +13,6 @@
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-sdk
android:minSdkVersion="10"
android:targetSdkVersion="22" />
<application
android:name=".App"
android:allowBackup="true"

View File

@@ -1,11 +1,11 @@
apply plugin: 'com.android.application'
dependencies {
compile project(':vtm-android')
compile project(':vtm-themes')
compile project(':vtm-extras')
compile 'com.noveogroup.android:android-logger:1.3.6'
compile 'com.squareup.okhttp3:okhttp:3.8.0'
implementation project(':vtm-android')
implementation project(':vtm-themes')
implementation project(':vtm-extras')
implementation 'com.squareup.okhttp3:okhttp:3.8.0'
implementation "org.slf4j:slf4j-android:$slf4jVersion"
}
android {
@@ -21,6 +21,7 @@ android {
versionCode versionCode()
versionName versionName()
minSdkVersion androidMinSdk()
targetSdkVersion androidTargetSdk()
}
sourceSets {

View File

@@ -1 +0,0 @@
root=DEBUG:%logger

View File

@@ -1,6 +1,6 @@
/* Copyright 2010, 2011, 2012 mapsforge.org
* Copyright 2012 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
@@ -40,7 +40,6 @@ import org.oscim.app.location.LocationDialog;
import org.oscim.app.location.LocationHandler;
import org.oscim.app.preferences.EditPreferences;
import org.oscim.core.GeoPoint;
import org.oscim.core.Tile;
import org.oscim.overlay.DistanceTouchOverlay;
import org.osmdroid.location.POI;
import org.osmdroid.overlays.MapEventsReceiver;
@@ -74,7 +73,6 @@ public class TileMap extends MapActivity implements MapEventsReceiver {
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Tile.SIZE = Tile.calculateTileSize(getResources().getDisplayMetrics().scaledDensity);
setContentView(R.layout.activity_tilemap);
App.view = (MapView) findViewById(R.id.mapView);
registerMapView(App.view);

View File

@@ -1,14 +1,15 @@
apply plugin: 'java'
apply plugin: 'java-library'
apply plugin: 'maven'
dependencies {
compile project(':vtm-gdx')
api project(':vtm-gdx')
file('natives').eachDir() { dir ->
compile files(dir.path)
api files(dir.path)
}
compile "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-desktop"
compile "com.badlogicgames.gdx:gdx-backend-lwjgl:$gdxVersion"
compile 'com.metsci.ext.com.kitfox.svg:svg-salamander:0.1.19'
implementation "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-desktop"
implementation "com.badlogicgames.gdx:gdx-backend-lwjgl:$gdxVersion"
implementation 'com.metsci.ext.com.kitfox.svg:svg-salamander:0.1.19'
implementation "org.slf4j:slf4j-api:$slf4jVersion"
}
sourceSets {
@@ -28,21 +29,6 @@ file('natives').eachDir() { dir ->
}
}
task fatJar(type: Jar, dependsOn: classes) {
classifier = 'jar-with-dependencies'
from { configurations.compile.collect { it.isDirectory() ? it : zipTree(it) } }
// Natives come from compile configuration
/*file('natives').eachDir() { dir ->
fatJar.from(dir.path)
}*/
exclude 'META-INF/*.DSA', 'META-INF/*.RSA', 'META-INF/*.SF'
with jar
}
artifacts {
archives fatJar
}
if (project.hasProperty("SONATYPE_USERNAME")) {
afterEvaluate {
project.apply from: "${rootProject.projectDir}/deploy.gradle"

View File

@@ -183,11 +183,16 @@ public class AwtCanvas implements Canvas {
@Override
public void fillColor(int color) {
fillRectangle(0, 0, getWidth(), getHeight(), color);
}
@Override
public void fillRectangle(float x, float y, float width, float height, int color) {
java.awt.Color awtColor = color == Color.TRANSPARENT ? TRANSPARENT : new java.awt.Color(color);
Composite originalComposite = this.canvas.getComposite();
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.fillRect((int) x, (int) y, (int) width, (int) height);
this.canvas.setComposite(originalComposite);
}

View File

@@ -104,32 +104,17 @@ public class AwtGraphics extends CanvasAdapter {
}
@Override
public Bitmap decodeBitmapImpl(InputStream inputStream) {
try {
return new AwtBitmap(inputStream);
} catch (IOException e) {
e.printStackTrace();
return null;
}
public Bitmap decodeBitmapImpl(InputStream inputStream) throws IOException {
return new AwtBitmap(inputStream);
}
@Override
public Bitmap decodeSvgBitmapImpl(InputStream inputStream, int width, int height, int percent) {
try {
return new AwtSvgBitmap(inputStream, width, height, percent);
} catch (IOException e) {
e.printStackTrace();
return null;
}
public Bitmap decodeSvgBitmapImpl(InputStream inputStream, int width, int height, int percent) throws IOException {
return new AwtSvgBitmap(inputStream, width, height, percent);
}
@Override
public Bitmap loadBitmapAssetImpl(String relativePathPrefix, String src, int width, int height, int percent) {
try {
return createBitmap(relativePathPrefix, src, width, height, percent);
} catch (IOException e) {
e.printStackTrace();
}
return null;
public Bitmap loadBitmapAssetImpl(String relativePathPrefix, String src, int width, int height, int percent) throws IOException {
return createBitmap(relativePathPrefix, src, width, height, percent);
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2015-2016 devemux86
* Copyright 2015-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
@@ -79,7 +79,7 @@ public class AwtSvgBitmap extends AwtBitmap {
private static BufferedImage getResourceBitmapImpl(InputStream inputStream, int width, int height, int percent) throws IOException {
synchronized (SVGCache.getSVGUniverse()) {
return getResourceBitmap(inputStream, CanvasAdapter.dpi / CanvasAdapter.DEFAULT_DPI, DEFAULT_SIZE, width, height, percent);
return getResourceBitmap(inputStream, CanvasAdapter.getScale(), DEFAULT_SIZE, width, height, percent);
}
}

View File

@@ -68,6 +68,7 @@ public class GdxMapApp extends GdxMap {
cfg.samples = 2;
cfg.foregroundFPS = 30;
cfg.backgroundFPS = 10;
cfg.forceExit = false;
return cfg;
}
@@ -79,4 +80,9 @@ public class GdxMapApp extends GdxMap {
mMap.setMapPosition(0, 0, 1 << 2);
}
@Override
public void dispose() {
System.exit(0);
}
}

View File

@@ -0,0 +1,22 @@
/*
* 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.gdx;
public class GdxMapImpl extends GdxMap {
@Override
public void dispose() {
System.exit(0);
}
}

View File

@@ -1,12 +1,13 @@
apply plugin: 'java'
apply plugin: 'java-library'
apply plugin: 'maven'
dependencies {
compile project(':vtm')
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'
api project(':vtm')
implementation 'com.fasterxml.jackson.core:jackson-core:2.8.4'
implementation 'com.google.protobuf:protobuf-java:2.6.1'
implementation 'com.vividsolutions:jts:1.13'
implementation 'org.openstreetmap.osmosis:osmosis-osm-binary:0.45'
implementation "org.slf4j:slf4j-api:$slf4jVersion"
}
sourceSets {

View File

@@ -135,7 +135,7 @@ public class GeoJsonTileDecoder implements ITileDecoder {
//add tag information
mTileSource.decodeTags(mMapElement, mTagMap);
if (mMapElement.tags.numTags == 0)
if (mMapElement.tags.size() == 0)
return;
mTileSource.postGeomHook(mMapElement);

View File

@@ -27,7 +27,7 @@ public class OsmBuildingJsonTileSource extends GeoJsonTileSource {
super("http://tile.openstreetmap.us/vectiles-buildings");
}
Tag mTagBuilding = new Tag("building", "yes");
Tag mTagBuilding = new Tag(Tag.KEY_BUILDING, Tag.VALUE_YES);
@Override
public void decodeTags(MapElement mapElement, Map<String, Object> properties) {

View File

@@ -27,8 +27,8 @@ public class OsmRoadLineJsonTileSource extends GeoJsonTileSource {
static final Logger log = LoggerFactory.getLogger(OsmRoadLineJsonTileSource.class);
Tag mTagTunnel = new Tag("tunnel", "yes");
Tag mTagBridge = new Tag("bridge", "yes");
Tag mTagTunnel = new Tag("tunnel", Tag.VALUE_YES);
Tag mTagBridge = new Tag("bridge", Tag.VALUE_YES);
public OsmRoadLineJsonTileSource() {
super("http://tile.openstreetmap.us/vectiles-highroad");

View File

@@ -631,7 +631,7 @@
<!--
<m k="historic"> <circle r="3" fill="#4040ff" stroke="#606060"
width="1.5" /> <m zoom-min="17"> <caption
k="name" dy="-10" font-style="bold" font-size="10" fill="#4040ff" stroke="#ffffff"
k="name" dy="10" font-style="bold" font-size="10" fill="#4040ff" stroke="#ffffff"
width="2.0" /> </m> </m>
-->
<!-- house numbers -->
@@ -674,14 +674,14 @@
<m v="station" zoom-min="14">
<circle fill="#ec2d2d" r="6" stroke="#606060" stroke-width="1.5" />
<!--
<caption k="name" dy="-10" font-style="bold" font-size="13" fill="#ec2d2d"
<caption k="name" dy="15" font-style="bold" font-size="13" fill="#ec2d2d"
stroke="#ffffff" stroke-width="2.0" />
-->
</m>
<m v="halt|tram_stop" zoom-min="17">
<circle fill="#ec2d2d" r="4" stroke="#606060" stroke-width="1.5" />
<!--
<caption k="name" dy="-15" font-style="bold" font-size="11" fill="#ec2d2d"
<caption k="name" dy="10" font-style="bold" font-size="11" fill="#ec2d2d"
stroke="#ffffff" stroke-width="2.0" />
-->
</m>

View File

@@ -143,7 +143,7 @@ public class OSciMap2TileSource extends UrlTileSource {
private boolean decodeTileTags() throws IOException {
String tagString = decodeString();
int curTag = mTileTags.numTags;
int curTag = mTileTags.size();
String key = Tags.keys[mSArray[curTag]];
Tag tag;
@@ -261,7 +261,7 @@ public class OSciMap2TileSource extends UrlTileSource {
if (fail || indexCnt == 0) {
log.debug(mTile + " failed reading way: bytes:" + bytes + " index:"
+ (Arrays.toString(index)) + " tag:"
+ (mElem.tags.numTags > 0 ? Arrays.deepToString(mElem.tags.tags) : "null")
+ (mElem.tags.size() > 0 ? Arrays.deepToString(mElem.tags.getTags()) : "null")
+ " " + indexCnt + " " + coordCnt);
return false;
}
@@ -290,7 +290,7 @@ public class OSciMap2TileSource extends UrlTileSource {
int cnt = 0;
int end = position() + bytes;
int max = mTileTags.numTags - 1;
int max = mTileTags.size() - 1;
for (; position() < end; cnt++) {
int tagNum = decodeVarint32();
@@ -315,7 +315,7 @@ public class OSciMap2TileSource extends UrlTileSource {
return false;
}
mElem.tags.add(mTileTags.tags[tagNum]);
mElem.tags.add(mTileTags.get(tagNum));
}
if (cnt == 0) {

View File

@@ -1,10 +1,11 @@
apply plugin: 'java'
apply plugin: 'java-library'
apply plugin: 'maven'
dependencies {
compile project(':vtm')
compile project(':vtm-themes')
compile "com.badlogicgames.gdx:gdx:$gdxVersion"
api project(':vtm')
api project(':vtm-themes')
implementation "com.badlogicgames.gdx:gdx:$gdxVersion"
implementation "org.slf4j:slf4j-api:$slf4jVersion"
}
sourceSets {

View File

@@ -34,6 +34,7 @@ import org.oscim.map.Map;
import org.oscim.renderer.MapRenderer;
import org.oscim.theme.VtmThemes;
import org.oscim.tiling.TileSource;
import org.oscim.utils.Parameters;
public abstract class GdxMap implements ApplicationListener {
@@ -85,7 +86,7 @@ public abstract class GdxMap implements ApplicationListener {
mMapRenderer.onSurfaceChanged(w, h);
InputMultiplexer mux = new InputMultiplexer();
if (!Map.NEW_GESTURES) {
if (!Parameters.MAP_EVENT_LAYER2) {
mGestureDetector = new GestureDetector(new GestureHandlerImpl(mMap));
mux.addProcessor(mGestureDetector);
}

View File

@@ -1,9 +1,10 @@
apply plugin: 'java'
apply plugin: 'java-library'
apply plugin: 'maven'
dependencies {
compile project(':vtm')
compile 'com.squareup.okhttp3:okhttp:3.8.0'
api project(':vtm')
implementation 'com.squareup.okhttp3:okhttp:3.8.0'
implementation "org.slf4j:slf4j-api:$slf4jVersion"
}
sourceSets {

View File

@@ -4,7 +4,7 @@ buildscript {
maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
}
dependencies {
classpath 'com.mobidevelop.robovm:robovm-gradle-plugin:2.3.1'
classpath 'com.mobidevelop.robovm:robovm-gradle-plugin:2.3.3'
}
}
@@ -16,7 +16,7 @@ sourceSets.main.java.srcDirs = ["src/"]
[compileJava, compileTestJava]*.options*.encoding = 'UTF-8'
ext {
roboVMVersion = "2.3.1"
roboVMVersion = "2.3.2"
}
launchIPhoneSimulator.dependsOn build
@@ -25,15 +25,16 @@ 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"
implementation project(':vtm')
implementation project(':vtm-gdx')
implementation project(':vtm-jts')
implementation project(':vtm-ios')
implementation project(':vtm-themes')
implementation "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-ios"
implementation "com.badlogicgames.gdx:gdx-backend-robovm:$gdxVersion"
implementation "com.mobidevelop.robovm:robovm-rt:$roboVMVersion"
implementation "com.mobidevelop.robovm:robovm-cocoatouch:$roboVMVersion"
implementation "org.slf4j:slf4j-simple:$slf4jVersion"
}
task copyVtmResources(type: Copy) {

View File

@@ -1,6 +1,6 @@
/*
* Copyright 2016-2017 Longri
* 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
@@ -19,7 +19,7 @@ import com.badlogic.gdx.backends.iosrobovm.IOSApplication;
import com.badlogic.gdx.backends.iosrobovm.IOSApplicationConfiguration;
import org.oscim.backend.CanvasAdapter;
import org.oscim.theme.ThemeLoader;
import org.oscim.utils.Parameters;
import org.robovm.apple.foundation.NSAutoreleasePool;
import org.robovm.apple.glkit.GLKViewDrawableStencilFormat;
import org.robovm.apple.uikit.UIApplication;
@@ -38,12 +38,13 @@ public class ExampleLauncher extends IOSApplication.Delegate {
float scale = (float) (getIosVersion() >= 8 ? UIScreen.getMainScreen().getNativeScale() : UIScreen.getMainScreen().getScale());
CanvasAdapter.dpi *= scale;
IOSMapApp iosMapApp = new IOSMapApp();
// IOSLineTexTest iosMapApp = new IOSLineTexTest();
// IOSMapAppCluster iosMapApp = new IOSMapAppCluster();
// IOSMapApp iosMapApp = new IOSMapApp();
// IOSPathLayerTest iosMapApp = new IOSPathLayerTest();
IOSLineTexBucketTest iosMapApp = new IOSLineTexBucketTest();
ThemeLoader.POT_TEXTURES = true;
// iOS needs POT textures for drawing lines with texture
Parameters.POT_TEXTURES = true;
iosMapApp.init();
return new IOSApplication(iosMapApp, config);

View File

@@ -0,0 +1,118 @@
/*
* 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.ios.test;
import org.oscim.backend.CanvasAdapter;
import org.oscim.backend.GLAdapter;
import org.oscim.core.GeometryBuffer;
import org.oscim.core.Tag;
import org.oscim.core.TagSet;
import org.oscim.gdx.GdxAssets;
import org.oscim.gdx.GdxMap;
import org.oscim.ios.backend.IosGL;
import org.oscim.ios.backend.IosGraphics;
import org.oscim.layers.GenericLayer;
import org.oscim.renderer.BucketRenderer;
import org.oscim.renderer.GLViewport;
import org.oscim.renderer.MapRenderer;
import org.oscim.renderer.bucket.LineTexBucket;
import org.oscim.renderer.bucket.TextureItem;
import org.oscim.theme.IRenderTheme;
import org.oscim.theme.ThemeLoader;
import org.oscim.theme.VtmThemes;
import org.oscim.theme.styles.LineStyle;
import org.oscim.theme.styles.RenderStyle;
import java.io.IOException;
public class IOSLineTexBucketTest extends GdxMap {
public static void init() {
// init globals
IosGraphics.init();
GdxAssets.init("assets/");
GLAdapter.init(new IosGL());
}
GeometryBuffer mLine = new GeometryBuffer(2, 1);
LineTest l = new LineTest();
@Override
public void createLayers() {
MapRenderer.setBackgroundColor(0xffffffff);
mMap.setMapPosition(0, 0, 1 << 4);
GeometryBuffer g = mLine;
g.startLine();
g.addPoint(-100, 0);
g.addPoint(100, 0);
addLines(l);
mMap.layers().add(new GenericLayer(mMap, l));
}
void addLines(LineTest l) {
GeometryBuffer g = mLine;
LineStyle lineStyle;
TextureItem tex = null;
try {
tex = new TextureItem(CanvasAdapter.getBitmapAsset("", "patterns/pike.png"));
tex.mipmap = true;
} catch (IOException e) {
e.printStackTrace();
}
IRenderTheme t = ThemeLoader.load(VtmThemes.DEFAULT);
TagSet tags = new TagSet();
tags.add(new Tag("highway", null));
tags.add(new Tag("oneway", "yes"));
RenderStyle[] ri = t.matchElement(GeometryBuffer.GeometryType.LINE, tags, 16);
lineStyle = (LineStyle) ri[0];
LineTexBucket lt = l.buckets.getLineTexBucket(20);
lt.line = lineStyle;
lt.addLine(g.translate(0, 10.5f));
}
class LineTest extends BucketRenderer {
public LineTest() {
mMapPosition.scale = 0;
}
@Override
public synchronized void update(GLViewport v) {
if (mMapPosition.scale == 0)
mMapPosition.copy(v.pos);
if (!isReady()) {
compile();
}
}
}
}

View File

@@ -40,7 +40,7 @@ import org.oscim.utils.Utils;
import java.util.ArrayList;
import java.util.List;
public class IOSLineTexTest extends GdxMap {
public class IOSPathLayerTest extends GdxMap {
public static void init() {
// init globals
@@ -91,12 +91,6 @@ public class IOSLineTexTest extends GdxMap {
List<GeoPoint> pts = new ArrayList<>();
for (double lon = -180; lon <= 180; lon += 2) {
//pts.add(new GeoPoint(lat, lon));
// double longitude = lon + (pos * 180);
// if (longitude < -180)
// longitude += 360;
// if (longitude > 180)
// longitude -= 360;
double longitude = lon;
double latitude = lat + (pos * 90);

View File

@@ -4,11 +4,11 @@ buildscript {
maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
}
dependencies {
classpath 'com.mobidevelop.robovm:robovm-gradle-plugin:2.3.1'
classpath 'com.mobidevelop.robovm:robovm-gradle-plugin:2.3.3'
}
}
apply plugin: 'java'
apply plugin: 'java-library'
apply plugin: 'maven'
apply plugin: 'robovm'
@@ -17,7 +17,7 @@ sourceSets.main.java.srcDirs = ["src/"]
[compileJava, compileTestJava]*.options*.encoding = 'UTF-8'
ext {
roboVMVersion = "2.3.1"
roboVMVersion = "2.3.2"
}
launchIPhoneSimulator.dependsOn build
@@ -26,11 +26,12 @@ launchIOSDevice.dependsOn build
createIPA.dependsOn build
dependencies {
compile project(':vtm-gdx')
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"
api project(':vtm-gdx')
implementation "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-ios"
implementation "com.badlogicgames.gdx:gdx-backend-robovm:$gdxVersion"
implementation "com.mobidevelop.robovm:robovm-rt:$roboVMVersion"
implementation "com.mobidevelop.robovm:robovm-cocoatouch:$roboVMVersion"
implementation "org.slf4j:slf4j-api:$slf4jVersion"
}
task copyVtmResources(type: Copy) {
@@ -57,17 +58,8 @@ task nativesJar(type: Jar) {
from('natives')
}
task fatJar(type: Jar, dependsOn: classes) {
classifier = 'jar-with-dependencies'
from { configurations.compile.collect { it.isDirectory() ? it : zipTree(it) } }
from('natives')
exclude 'META-INF/*.DSA', 'META-INF/*.RSA', 'META-INF/*.SF'
with jar
}
artifacts {
archives nativesJar
//archives fatJar
}
if (project.hasProperty("SONATYPE_USERNAME")) {

View File

@@ -81,7 +81,7 @@ NS_ASSUME_NONNULL_BEGIN
-(CGFloat) opacity;
/*! @brief opacity is dependent (via inheritence) as you descend an SVG Document. This opacity is the place to keep track of updated opacity.
* @param the current opacity (defaults to 1.0)
* @param opacity the current opacity (defaults to 1.0)
*/
-(void) setOpacity:(CGFloat)opacity;

View File

@@ -49,4 +49,4 @@
/*! \brief Because views and buttons are dynamically instantiated from Storyboards and Nibs, code for their classes might not link in from a static library. Thus this method to make sure the class gets called at least once from code.
*/
void MakeSureSVGghLinks();
void MakeSureSVGghLinks(void);

View File

@@ -34,7 +34,7 @@
</data>
<key>Headers/SVGContext.h</key>
<data>
fYKblLtFBEOZBWKITmzeqxkB3wA=
nipDZcSdfdoY/A8ur+tBBZ0/+6w=
</data>
<key>Headers/SVGDocumentView.h</key>
<data>
@@ -66,7 +66,7 @@
</data>
<key>Headers/SVGgh.h</key>
<data>
FhA5aS1gL+U2oztDy+ZAYAMbsQY=
cvRfO1GOHm6DU0yYwNOiyIVoduk=
</data>
<key>Headers/SVGghLoader.h</key>
<data>
@@ -78,7 +78,7 @@
</data>
<key>Info.plist</key>
<data>
Ekf8hDNYwrf/YAzxlZyyfB58pCE=
mQCRU5XiOhj4nuJmB5nqUsBIgCw=
</data>
<key>Modules/module.modulemap</key>
<data>
@@ -168,11 +168,11 @@
<dict>
<key>hash</key>
<data>
fYKblLtFBEOZBWKITmzeqxkB3wA=
nipDZcSdfdoY/A8ur+tBBZ0/+6w=
</data>
<key>hash2</key>
<data>
7BISlxYEV6x9kQFS15ufHja8Q+26HD5NjXYaTDJyIEI=
vBXhqJbZ8dvTNO4WmhY8Fa+mEQ1CXgCeY2t8BK9GdEM=
</data>
</dict>
<key>Headers/SVGDocumentView.h</key>
@@ -256,11 +256,11 @@
<dict>
<key>hash</key>
<data>
FhA5aS1gL+U2oztDy+ZAYAMbsQY=
cvRfO1GOHm6DU0yYwNOiyIVoduk=
</data>
<key>hash2</key>
<data>
K7FvEVgrwXFf8fYXUC1Z28mYShSPC2GIrNE0Q4jvPMs=
XU2bmBHIVDePmIgujoxVNix2qbEhCI7bmzLLm2UoioA=
</data>
</dict>
<key>Headers/SVGghLoader.h</key>

View File

@@ -76,8 +76,6 @@ public class IosCanvas implements Canvas {
IosPaint iosFill = (IosPaint) fill;
if (stroke != null) {
IosPaint iosStroke = (IosPaint) stroke;
iosFill.setStrokeWidth(iosStroke.strokeWidth);
iosFill.setStrokeColor(iosStroke.getColor());
iosStroke.drawLine(this.cgBitmapContext, string, x, y);
}
iosFill.drawLine(this.cgBitmapContext, string, x, y);
@@ -150,6 +148,14 @@ public class IosCanvas implements Canvas {
this.cgBitmapContext.fillRect(rect);
}
@Override
public void fillRectangle(float x, float y, float width, float height, int color) {
CGRect rect = new CGRect(x, y, width, height);
setFillColor(this.cgBitmapContext, (color));
this.cgBitmapContext.setBlendMode(CGBlendMode.Normal);
this.cgBitmapContext.fillRect(rect);
}
@Override
public int getHeight() {
return this.cgBitmapContext != null ? (int) this.cgBitmapContext.getHeight() : 0;

View File

@@ -55,32 +55,17 @@ public class IosGraphics extends CanvasAdapter {
}
@Override
protected Bitmap decodeBitmapImpl(InputStream inputStream) {
try {
return new IosBitmap(inputStream);
} catch (IOException e) {
log.error("decodeBitmapImpl", e);
return null;
}
protected Bitmap decodeBitmapImpl(InputStream inputStream) throws IOException {
return new IosBitmap(inputStream);
}
@Override
protected Bitmap decodeSvgBitmapImpl(InputStream inputStream, int width, int height, int percent) {
try {
return new IosSvgBitmap(inputStream, width, height, percent);
} catch (IOException e) {
log.error("decodeSvgBitmapImpl", e);
return null;
}
protected Bitmap decodeSvgBitmapImpl(InputStream inputStream, int width, int height, int percent) throws IOException {
return new IosSvgBitmap(inputStream, width, height, percent);
}
@Override
protected Bitmap loadBitmapAssetImpl(String relativePathPrefix, String src, int width, int height, int percent) {
try {
return createBitmap(relativePathPrefix, src, width, height, percent);
} catch (IOException e) {
log.error("loadBitmapAssetImpl", e);
return null;
}
protected Bitmap loadBitmapAssetImpl(String relativePathPrefix, String src, int width, int height, int percent) throws IOException {
return createBitmap(relativePathPrefix, src, width, height, percent);
}
}

View File

@@ -194,7 +194,7 @@ public class IosPaint implements Paint {
!!!!!
NOTE: The value of NSStrokeWidthAttributeName is interpreted as a percentage of the font point size.
*/
float strokeWidthPercent = -(this.strokeWidth / this.textSize * 50);
float strokeWidthPercent = (this.strokeWidth / this.textSize * 150);
attribs.setStrokeWidth(strokeWidthPercent);
NSAttributedString attributedString = new NSAttributedString(text, attribs);

View File

@@ -1,6 +1,6 @@
/*
* Copyright 2016 Longri
* 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
@@ -90,7 +90,7 @@ public class IosSvgBitmap extends IosBitmap {
}
private static UIImage getResourceBitmapImpl(InputStream inputStream, int width, int height, int percent) {
return getResourceBitmap(inputStream, CanvasAdapter.dpi / CanvasAdapter.DEFAULT_DPI, DEFAULT_SIZE, width, height, percent);
return getResourceBitmap(inputStream, CanvasAdapter.getScale(), DEFAULT_SIZE, width, height, percent);
}
public IosSvgBitmap(InputStream inputStream, int width, int height, int percent) throws IOException {

View File

@@ -1,12 +1,12 @@
apply plugin: 'java'
apply plugin: 'java-library'
apply plugin: 'maven'
dependencies {
compile project(':vtm')
compile('org.jeo:jeo:0-SNAPSHOT') {
api project(':vtm')
implementation('org.jeo:jeo:0-SNAPSHOT') {
exclude group: 'org.slf4j', module: 'slf4j-jdk14'
}
compile('org.jeo:jeo-carto:0-SNAPSHOT') {
implementation('org.jeo:jeo-carto:0-SNAPSHOT') {
exclude group: 'org.slf4j', module: 'slf4j-jdk14'
}
}

View File

@@ -95,7 +95,8 @@ public class OSMIndoorLayer extends JeoVectorLayer {
if (ll.line == null) {
float width = rule.number(f, CartoCSS.LINE_WIDTH, 1.2f);
int color = Color.rainbow((level + 1) / 10f);
//int color = Color.rainbow((level + 1) / 10f);
int color = JeoUtils.color(rule.color(f, CartoCSS.LINE_COLOR, RGB.black));
if (/*level > -2 && */!active)
color = getInactiveColor(color);

View File

@@ -242,6 +242,11 @@ public class RenderTheme implements IRenderTheme {
return mBackground;
}
@Override
public boolean isMapsforgeTheme() {
return false;
}
@Override
public void scaleTextSize(float scaleFactor) {
}
@@ -251,7 +256,7 @@ public class RenderTheme implements IRenderTheme {
MapElement e = new MapElement();
e.startPolygon();
e.tags.add(new Tag("building", "yes"));
e.tags.add(new Tag(Tag.KEY_BUILDING, Tag.VALUE_YES));
t.matchElement(GeometryType.POLY, e.tags, 16);
t.matchElement(GeometryType.POLY, e.tags, 15);

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