Compare commits
422 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9de76897bc | ||
|
|
a67b2f2c91 | ||
|
|
791f054f70 | ||
|
|
7e13586463 | ||
|
|
c3639dcb24 | ||
|
|
49ded685b4 | ||
|
|
9b14865bf3 | ||
|
|
abac84e82a | ||
|
|
0367507dae | ||
|
|
9977061680 | ||
|
|
3cae38040c | ||
|
|
97cdfa119d | ||
|
|
641db3ade0 | ||
|
|
bddf2443b6 | ||
|
|
1404d21838 | ||
|
|
95bbc5ea3e | ||
|
|
f8776ffe5f | ||
|
|
bc1dee49a4 | ||
|
|
d81a6309bf | ||
|
|
9a6da018a9 | ||
|
|
8d639499ba | ||
|
|
a5d7a8f6b0 | ||
|
|
577f1520d2 | ||
|
|
c938533943 | ||
|
|
e3b137e3c4 | ||
|
|
72b72b8029 | ||
|
|
ba68b79e86 | ||
|
|
49ef4c8e1b | ||
|
|
535482025e | ||
|
|
e73ac4acfc | ||
|
|
bc20664bc5 | ||
|
|
06936fc4ee | ||
|
|
0829098ebb | ||
|
|
8ad2036ec1 | ||
|
|
4f7675d2a8 | ||
|
|
8f4e9967f0 | ||
|
|
f884c17195 | ||
|
|
490b932eab | ||
|
|
149353119b | ||
|
|
9c3f3b8a4c | ||
|
|
f9e06c80ad | ||
|
|
fe2c067272 | ||
|
|
9c3488e107 | ||
|
|
df784f6f68 | ||
|
|
a178357ca8 | ||
|
|
6627eab8e2 | ||
|
|
0a7638e10d | ||
|
|
f94c665b27 | ||
|
|
d23bca9c7f | ||
|
|
53dbb737fb | ||
|
|
1aa5f24e11 | ||
|
|
1d44057198 | ||
|
|
bcf4cff42b | ||
|
|
cbdeb58c2f | ||
|
|
df5bcd583f | ||
|
|
e2a4ad8a97 | ||
|
|
795359fb44 | ||
|
|
a9a042ea41 | ||
|
|
cd5a62a2ff | ||
|
|
dfd3a7dcf6 | ||
|
|
5615604170 | ||
|
|
b3f6899b1f | ||
|
|
e3f2f19119 | ||
|
|
126b98ae8c | ||
|
|
9104b746ac | ||
|
|
fc6bce20bb | ||
|
|
76582da497 | ||
|
|
a06ea5492e | ||
|
|
1d7ece5a65 | ||
|
|
67b911a7df | ||
|
|
7947e5c027 | ||
|
|
69f7ed7ae0 | ||
|
|
fa658bd1f0 | ||
|
|
233f0c4f7e | ||
|
|
02b29c7584 | ||
|
|
cedf3edc61 | ||
|
|
60aa9600d8 | ||
|
|
3d92807d26 | ||
|
|
67195bbc0c | ||
|
|
7ba5984e5f | ||
|
|
27aee33cb9 | ||
|
|
4a848cc08c | ||
|
|
75c2841a13 | ||
|
|
ed8f03122b | ||
|
|
d80e4fdabc | ||
|
|
c8817f80c8 | ||
|
|
3ee1034f1a | ||
|
|
3b224d21fc | ||
|
|
0d7d75ccb5 | ||
|
|
324a1c309c | ||
|
|
0046f5c159 | ||
|
|
7865867973 | ||
|
|
7c12c2ae9b | ||
|
|
564435a22a | ||
|
|
607cdeb5db | ||
|
|
4903a4b5f4 | ||
|
|
e5043447e3 | ||
|
|
4f78fed094 | ||
|
|
0fbce21140 | ||
|
|
3a19c2f2f5 | ||
|
|
c694fbc63b | ||
|
|
c4b6d019ff | ||
|
|
3603dfef03 | ||
|
|
35f1e7092c | ||
|
|
9283b80594 | ||
|
|
f81dff2365 | ||
|
|
5c2b404b3f | ||
|
|
095ed65eb3 | ||
|
|
3d7a09c457 | ||
|
|
abc1867d7c | ||
|
|
3449bd86e8 | ||
|
|
1861ca4a1b | ||
|
|
a77d89b8b3 | ||
|
|
f63c303293 | ||
|
|
f1634e4976 | ||
|
|
b59f20ef49 | ||
|
|
07138f3240 | ||
|
|
eddfa5a896 | ||
|
|
4532e397c0 | ||
|
|
81a270428c | ||
|
|
76e73368ab | ||
|
|
f4f8eb8d1c | ||
|
|
b695d43fee | ||
|
|
f6d2db4c6f | ||
|
|
e1db67f099 | ||
|
|
7142f3410d | ||
|
|
b110314077 | ||
|
|
1cf4d3a60b | ||
|
|
9c5fd29ff1 | ||
|
|
27a39fbfd7 | ||
|
|
d3aa2af73b | ||
|
|
2555fea5da | ||
|
|
8bb63c875f | ||
|
|
76dcc8b909 | ||
|
|
c38975fcba | ||
|
|
b90d99f82b | ||
|
|
76d55bb1a0 | ||
|
|
d9f7638a25 | ||
|
|
e7a391e640 | ||
|
|
12fe08884e | ||
|
|
4d9ad3e942 | ||
|
|
ae6ce553b9 | ||
|
|
13c42d509c | ||
|
|
a6aa2b2388 | ||
|
|
9f7fe2577b | ||
|
|
ad2348631a | ||
|
|
2dbad2b16a | ||
|
|
8db30d8537 | ||
|
|
25f0310334 | ||
|
|
3041ab5515 | ||
|
|
27e2c5dde5 | ||
|
|
a386cfea4f | ||
|
|
fe104300ba | ||
|
|
f1ae5c3d68 | ||
|
|
767019ee06 | ||
|
|
3a3a58d273 | ||
|
|
0eb53403d1 | ||
|
|
4938852b40 | ||
|
|
0d14473132 | ||
|
|
34ddf3a005 | ||
|
|
9ca4785701 | ||
|
|
8d2aba9c65 | ||
|
|
2872ce94a3 | ||
|
|
d5ebf43e3d | ||
|
|
223eb120fa | ||
|
|
b94d943247 | ||
|
|
d409aa5b96 | ||
|
|
644c83ed69 | ||
|
|
db871d4a22 | ||
|
|
3f959a3b46 | ||
|
|
903dbad9c6 | ||
|
|
3afca64080 | ||
|
|
16f0d524c5 | ||
|
|
f669022ca3 | ||
|
|
dce7886447 | ||
|
|
f77c46f56d | ||
|
|
45383397bc | ||
|
|
c14e93e25d | ||
|
|
7b7b5a923a | ||
|
|
6b4bb7d8bf | ||
|
|
5d4d630ce0 | ||
|
|
8d121c0798 | ||
|
|
6b362e5125 | ||
|
|
c2eb679adf | ||
|
|
183cb8aafd | ||
|
|
4bf27bc910 | ||
|
|
f0639972b4 | ||
|
|
e1d17321c6 | ||
|
|
b75ac0d647 | ||
|
|
7f81ddf47f | ||
|
|
c580e1d7a5 | ||
|
|
7a28788972 | ||
|
|
36e547d828 | ||
|
|
bd762dae9e | ||
|
|
347c1d31bb | ||
|
|
c6be08a903 | ||
|
|
8ab2195500 | ||
|
|
9fff945978 | ||
|
|
18d8e18bdf | ||
|
|
b32692942f | ||
|
|
9c58d8219c | ||
|
|
32c57a42a4 | ||
|
|
6c004b8be7 | ||
|
|
9a31cc07b5 | ||
|
|
0de27b7354 | ||
|
|
dc340a382e | ||
|
|
4c9354c326 | ||
|
|
d1fdca170e | ||
|
|
d614809df0 | ||
|
|
0c3acfd69c | ||
|
|
da95660c73 | ||
|
|
c8396062ae | ||
|
|
579f49bfd6 | ||
|
|
20f1121d3a | ||
|
|
26253a6104 | ||
|
|
b190211e5a | ||
|
|
edf29d2b0e | ||
|
|
a001f4615c | ||
|
|
5818edc228 | ||
|
|
e562ebdff6 | ||
|
|
d08ef59278 | ||
|
|
bb1d602267 | ||
|
|
c1eca04ab1 | ||
|
|
f6c28dc158 | ||
|
|
b760eadd4d | ||
|
|
7500ca1711 | ||
|
|
808671c1fb | ||
|
|
2d3ab0b6fd | ||
|
|
6461d39357 | ||
|
|
e0c02a83d0 | ||
|
|
ca56e0fe33 | ||
|
|
320ce5b44d | ||
|
|
f061e06d94 | ||
|
|
d1ce52ef52 | ||
|
|
28961caa79 | ||
|
|
4b30ca3242 | ||
|
|
84c45e153a | ||
|
|
d8001e23f6 | ||
|
|
559f4899dd | ||
|
|
04f02d9ae5 | ||
|
|
acb7727234 | ||
|
|
ac0455b1b4 | ||
|
|
5480cd6df8 | ||
|
|
325f848969 | ||
|
|
ea402f77f1 | ||
|
|
759915861e | ||
|
|
bc46217449 | ||
|
|
d8030c1364 | ||
|
|
23d34fa00a | ||
|
|
29322acf87 | ||
|
|
5dcffcc537 | ||
|
|
67afa0b7ab | ||
|
|
a6ecab334c | ||
|
|
edf89ce36b | ||
|
|
4f687e6fec | ||
|
|
cfc036c7ec | ||
|
|
3dbc44e9c2 | ||
|
|
c9e1c81cca | ||
|
|
f7e5544238 | ||
|
|
981536595f | ||
|
|
5aaa2ca96b | ||
|
|
b7a3844aac | ||
|
|
b3e2385ba5 | ||
|
|
03821e1f51 | ||
|
|
77dc06d650 | ||
|
|
0cd6c48b16 | ||
|
|
8a595fd37f | ||
|
|
967875d6b8 | ||
|
|
d60e2ef575 | ||
|
|
58ecf60d9d | ||
|
|
17356e5a2b | ||
|
|
296fdd3c13 | ||
|
|
735acc520a | ||
|
|
ac115b1f0f | ||
|
|
d2ba6647ea | ||
|
|
0180c40855 | ||
|
|
817bd13d7b | ||
|
|
d22dc79655 | ||
|
|
fc9ef062c0 | ||
|
|
f2dda7c8eb | ||
|
|
fdc793d9ec | ||
|
|
3d24aade21 | ||
|
|
6d93aaf57f | ||
|
|
8fc354c96a | ||
|
|
e30f3f7cc3 | ||
|
|
aff2c77267 | ||
|
|
33365b3f7d | ||
|
|
33fdc938fa | ||
|
|
8397d5a3be | ||
|
|
980e9d5e54 | ||
|
|
bc7c55b1f8 | ||
|
|
120182ec15 | ||
|
|
945b84f04f | ||
|
|
f67c457006 | ||
|
|
a2852b0761 | ||
|
|
ebf5d408bc | ||
|
|
75719eae29 | ||
|
|
5c825ea9eb | ||
|
|
15bc23cadf | ||
|
|
88f3283878 | ||
|
|
80848f9d2d | ||
|
|
f1f5726457 | ||
|
|
2ccf3e4c64 | ||
|
|
c8cbf8e0ce | ||
|
|
6544cc1081 | ||
|
|
4c72831336 | ||
|
|
06ac5142f7 | ||
|
|
feae45f78b | ||
|
|
61b8233b97 | ||
|
|
7acbea88cc | ||
|
|
19109516ae | ||
|
|
c1a5ad7e74 | ||
|
|
1a93e4ae13 | ||
|
|
1de6ca8fb7 | ||
|
|
02db7ca08d | ||
|
|
e9bb7aaae4 | ||
|
|
989e9c2ae8 | ||
|
|
e8f41cd339 | ||
|
|
eabd90d14c | ||
|
|
3e4aad4d51 | ||
|
|
b6dc72bbb6 | ||
|
|
4cd11462da | ||
|
|
6344542b10 | ||
|
|
e0031ae8aa | ||
|
|
229ea0b350 | ||
|
|
0a5d08a908 | ||
|
|
aed54c9a49 | ||
|
|
1a3bf4e4fe | ||
|
|
591ae03667 | ||
|
|
3a191fb513 | ||
|
|
2821d8ddb8 | ||
|
|
71d7b71035 | ||
|
|
85858911fa | ||
|
|
0a92c84668 | ||
|
|
c21d7b4390 | ||
|
|
38a9c71bc2 | ||
|
|
2573e458d5 | ||
|
|
25a9891133 | ||
|
|
8ee4e5fb8c | ||
|
|
a38b054228 | ||
|
|
d9bf94da99 | ||
|
|
77653096f9 | ||
|
|
5f534656ea | ||
|
|
ba93445259 | ||
|
|
71f7c45b21 | ||
|
|
ca5e34e1fb | ||
|
|
d937f3516c | ||
|
|
a8909fca08 | ||
|
|
b39feae045 | ||
|
|
9f4ef47b95 | ||
|
|
25e79bac55 | ||
|
|
311f4c7929 | ||
|
|
557e1858a7 | ||
|
|
16fa42d462 | ||
|
|
1133edb83d | ||
|
|
f6dbeba3d8 | ||
|
|
bf8f0745a6 | ||
|
|
829e45224f | ||
|
|
acde5d565d | ||
|
|
f0a652faf3 | ||
|
|
41867344e2 | ||
|
|
0c39ff8be0 | ||
|
|
6f78f08a04 | ||
|
|
3388e1401f | ||
|
|
308497ffa6 | ||
|
|
bfa5a095f0 | ||
|
|
96be36edb8 | ||
|
|
7c9c3732fb | ||
|
|
add62c9fe8 | ||
|
|
4aaa1ce620 | ||
|
|
aa63b49e5a | ||
|
|
1f1d91202c | ||
|
|
51eae28926 | ||
|
|
58b5f2741b | ||
|
|
d82faad435 | ||
|
|
fc8223bfc8 | ||
|
|
3584c4be1e | ||
|
|
001dbe8447 | ||
|
|
54feb7a25e | ||
|
|
ea2a94f76b | ||
|
|
b6bfbc612a | ||
|
|
1d545fd804 | ||
|
|
3acf77c102 | ||
|
|
6dfe2df2fb | ||
|
|
6cb40e1c15 | ||
|
|
afd03809e8 | ||
|
|
efa3cb0231 | ||
|
|
a709bd2623 | ||
|
|
439f2b20ff | ||
|
|
877d217f31 | ||
|
|
885264ad8c | ||
|
|
e224a7cf5b | ||
|
|
e10a223ea6 | ||
|
|
f85453e60c | ||
|
|
a6b3d7b0c2 | ||
|
|
dc15ba5f34 | ||
|
|
1d7afaf8de | ||
|
|
422d81d665 | ||
|
|
4b55043dcc | ||
|
|
7885529fff | ||
|
|
2c610f5e0b | ||
|
|
64a586dde8 | ||
|
|
c1f65144df | ||
|
|
ad2ee3f40e | ||
|
|
01365686fa | ||
|
|
dece13ddc9 | ||
|
|
05e9e0cdc8 | ||
|
|
a9283dd408 | ||
|
|
53ca77d18a | ||
|
|
97654f0670 | ||
|
|
cbd0ac01df | ||
|
|
ca841f5181 | ||
|
|
a322768f8a | ||
|
|
fc7bb2df9b | ||
|
|
062bb8d573 | ||
|
|
ccdea3b663 | ||
|
|
985bbc3f36 | ||
|
|
aa5fc79681 | ||
|
|
58095f31a4 | ||
|
|
e53523b82a | ||
|
|
e5c62c9bc4 | ||
|
|
3c1091d8e0 |
2
.github/CONTRIBUTING.md
vendored
@@ -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.
|
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).
|
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
@@ -11,8 +11,10 @@ robovm-build
|
|||||||
/vtm-web/war/
|
/vtm-web/war/
|
||||||
/vtm-web/assets/
|
/vtm-web/assets/
|
||||||
/vtm-web/gwt-unitCache
|
/vtm-web/gwt-unitCache
|
||||||
|
/vtm-web-app/war/WEB-INF/
|
||||||
/vtm-web-app/assets/
|
/vtm-web-app/assets/
|
||||||
/vtm-web-app/src/main/webapp/
|
/vtm-web-app/src/main/webapp/
|
||||||
|
/vtm-web-js/war/WEB-INF/
|
||||||
/vtm-web-js/assets/
|
/vtm-web-js/assets/
|
||||||
/vtm-web-js/src/main/webapp/
|
/vtm-web-js/src/main/webapp/
|
||||||
/vtm-spatialite/
|
/vtm-spatialite/
|
||||||
|
|||||||
40
.travis.yml
@@ -1,22 +1,32 @@
|
|||||||
sudo: false
|
sudo: false
|
||||||
language: android
|
language: android
|
||||||
jdk:
|
jdk:
|
||||||
- oraclejdk8
|
- oraclejdk8
|
||||||
android:
|
|
||||||
components:
|
|
||||||
- platform-tools
|
|
||||||
- tools
|
|
||||||
- build-tools-24.0.3
|
|
||||||
- android-24
|
|
||||||
- extra-android-m2repository
|
|
||||||
env:
|
env:
|
||||||
global:
|
global:
|
||||||
- GRADLE_OPTS="-Xmx2048m"
|
- ANDROID=27
|
||||||
- secure: sW674wuFZOuoX7jHQHDbX3j8NxL8JxR07cyq+CrrqJ537dU9lxWQmMBRUpOb+p/q7sQ74PUtiKJkmFgKCSJSAKY+nr6GJ8P/q6u5TUKbmUWODSn8znehX2zualfvFwpF4PILok/wUzXBQE62jn4lUua7cMdsHRMNHbLmKqBoVL0meObDDjsaJ/RCbOPuruy3FmgvXPp0+Y4zl1GsklDSyjFzg4LBzjAk9Ryvh1O4zvJBkkyfCgurLKCnOKIPy3v5fPMS9oDfO1aarAVGoZZe416pvTW4hb8cdB6kn9XWYDob4NDFX/sP5k7XIhd/NAIn9LrKFg0sLtATaKLX+BcasF1CgDR/u6+SEeQd5QaRF7Go2Nq5Ltuu4OIFONI2qhEeVDDK6Otf2WSWj9KPno2GHuumBfbg4ypWoJgmZrMXk8JeVV/OP/0jIQz3p/7yfF21X1XBEqYaVHPAMKdEYYkCSa46KfACyOt6LfnkuCHtoTOpFo7sq0omIA2HOtpIx1u3vMBUyAbQqT6cokkKB1b6gNTFwhHc+8ybfLFPljJB8cWshI+V/b06S6fekRmvTNxvDykWNsdlkENBYqc9hMfjcT4hO4K+76SWN62mimQYODvFyfTVMC7WkQ3k/XEnmqUPV5XkbaILbS1d/tA57N148FiJ5/QXtI6Y94imubYyVqU=
|
- ANDROID_BUILD_TOOLS=27.0.3
|
||||||
- secure: AdKSZKA4gMuKXI4X4dQNJqcMv5OmPIHdN8fpy55Y9yoOQPQHZE3Zwc4QDWBh20q298jyEC854tVTPTysdZ7h+2s2FhsprYv1Bt/QNzKIrLpeIMj2quuVGMbdPuk08y55gost94KwVLJv0sIDpRlB/PEQkA7Mg/UDsT9zR8E1Ms5x+ul2C8e1ag0zzNl1wVnT5jY8WCp74uA/XXCcJl/80qT1stUERazCKwbKNo007hi7rdm4HA7YGevORq8e2r67je+WIBZUAwrHT0Zjuo4ibwUii4LdwvjuN3w0Z6e9Wf4x5bBqGgnih0T31uom2yPjNx+U/c2AWI+Nxfy/SEF2U+9bjBEZ3ZhI7F1B9ofXo2mhvvsVDiUrymMBbG2V64C9kAzeUh7xIBTqIrbdtpAEBV9FlLAtF2swVTwtCgZgcVTOt3RKXCi3X3nk3cuH7PAorFa/QGfT4xxVu2011FVAt2Rm7SD0ZWztZTSTz/4Nt/egtGBOJfrCc7oLEygLzDmLqsqCwCROITVQjWLjrtqDyLteaNiSXeNIQMKun3izApbXnHmXB+FV3R3EZocboqk3v5bmPTahnG6Ghc2zknWyyxSx+O9qIfOpHUL8JMJiT82lUQUeibtCn7DCE8wVQ/gYC5i+a+KO/d3NemSzIFlZ8aoUiEPYq18dYlsDXeLXwF0=
|
- GRADLE_OPTS="-Xmx2048m"
|
||||||
|
- secure: sW674wuFZOuoX7jHQHDbX3j8NxL8JxR07cyq+CrrqJ537dU9lxWQmMBRUpOb+p/q7sQ74PUtiKJkmFgKCSJSAKY+nr6GJ8P/q6u5TUKbmUWODSn8znehX2zualfvFwpF4PILok/wUzXBQE62jn4lUua7cMdsHRMNHbLmKqBoVL0meObDDjsaJ/RCbOPuruy3FmgvXPp0+Y4zl1GsklDSyjFzg4LBzjAk9Ryvh1O4zvJBkkyfCgurLKCnOKIPy3v5fPMS9oDfO1aarAVGoZZe416pvTW4hb8cdB6kn9XWYDob4NDFX/sP5k7XIhd/NAIn9LrKFg0sLtATaKLX+BcasF1CgDR/u6+SEeQd5QaRF7Go2Nq5Ltuu4OIFONI2qhEeVDDK6Otf2WSWj9KPno2GHuumBfbg4ypWoJgmZrMXk8JeVV/OP/0jIQz3p/7yfF21X1XBEqYaVHPAMKdEYYkCSa46KfACyOt6LfnkuCHtoTOpFo7sq0omIA2HOtpIx1u3vMBUyAbQqT6cokkKB1b6gNTFwhHc+8ybfLFPljJB8cWshI+V/b06S6fekRmvTNxvDykWNsdlkENBYqc9hMfjcT4hO4K+76SWN62mimQYODvFyfTVMC7WkQ3k/XEnmqUPV5XkbaILbS1d/tA57N148FiJ5/QXtI6Y94imubYyVqU=
|
||||||
|
- secure: AdKSZKA4gMuKXI4X4dQNJqcMv5OmPIHdN8fpy55Y9yoOQPQHZE3Zwc4QDWBh20q298jyEC854tVTPTysdZ7h+2s2FhsprYv1Bt/QNzKIrLpeIMj2quuVGMbdPuk08y55gost94KwVLJv0sIDpRlB/PEQkA7Mg/UDsT9zR8E1Ms5x+ul2C8e1ag0zzNl1wVnT5jY8WCp74uA/XXCcJl/80qT1stUERazCKwbKNo007hi7rdm4HA7YGevORq8e2r67je+WIBZUAwrHT0Zjuo4ibwUii4LdwvjuN3w0Z6e9Wf4x5bBqGgnih0T31uom2yPjNx+U/c2AWI+Nxfy/SEF2U+9bjBEZ3ZhI7F1B9ofXo2mhvvsVDiUrymMBbG2V64C9kAzeUh7xIBTqIrbdtpAEBV9FlLAtF2swVTwtCgZgcVTOt3RKXCi3X3nk3cuH7PAorFa/QGfT4xxVu2011FVAt2Rm7SD0ZWztZTSTz/4Nt/egtGBOJfrCc7oLEygLzDmLqsqCwCROITVQjWLjrtqDyLteaNiSXeNIQMKun3izApbXnHmXB+FV3R3EZocboqk3v5bmPTahnG6Ghc2zknWyyxSx+O9qIfOpHUL8JMJiT82lUQUeibtCn7DCE8wVQ/gYC5i+a+KO/d3NemSzIFlZ8aoUiEPYq18dYlsDXeLXwF0=
|
||||||
|
android:
|
||||||
|
components:
|
||||||
|
- tools
|
||||||
|
- platform-tools
|
||||||
|
- tools
|
||||||
|
- build-tools-$ANDROID_BUILD_TOOLS
|
||||||
|
- android-$ANDROID
|
||||||
|
before_install:
|
||||||
|
- yes | sdkmanager "platforms;android-$ANDROID"
|
||||||
script:
|
script:
|
||||||
- ./gradlew clean build
|
- ./gradlew clean build
|
||||||
after_success:
|
after_success:
|
||||||
- if [ "$TRAVIS_BRANCH" == "master" ] && [ "$TRAVIS_PULL_REQUEST" == "false" ]; then
|
- if [ "$TRAVIS_BRANCH" == "master" ] && [ "$TRAVIS_PULL_REQUEST" == "false" ]; then
|
||||||
./gradlew uploadArchives -PSONATYPE_USERNAME="${SONATYPE_USERNAME}" -PSONATYPE_PASSWORD="${SONATYPE_PASSWORD}";
|
./gradlew uploadArchives -PSONATYPE_USERNAME="${SONATYPE_USERNAME}" -PSONATYPE_PASSWORD="${SONATYPE_PASSWORD}";
|
||||||
fi
|
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
|
||||||
|
|||||||
74
README.md
@@ -1,60 +1,74 @@
|
|||||||
|
[](http://search.maven.org/#search%7Cga%7C1%7Cg%3A%22org.mapsforge%22)
|
||||||
[](https://travis-ci.org/mapsforge/vtm)
|
[](https://travis-ci.org/mapsforge/vtm)
|
||||||
[](COPYING.LESSER)
|
[](http://www.gnu.org/licenses/lgpl-3.0)
|
||||||
[](https://maven-badges.herokuapp.com/maven-central/org.mapsforge/vtm)
|
|
||||||
|
|
||||||
# V™
|
# V™
|
||||||
|
|
||||||
VTM was developed within the [OpenScienceMap](http://opensciencemap.org) project.
|
VTM was developed within the [OpenScienceMap](https://github.com/opensciencemap) project.
|
||||||
|
|
||||||
**This fork continues VTM development. And provides compatibility with latest [Mapsforge](https://github.com/mapsforge/mapsforge).**
|
**This fork continues VTM development. And provides compatibility with latest [Mapsforge](https://github.com/mapsforge/mapsforge).**
|
||||||
|
|
||||||
If you have any questions or problems, don't hesitate to ask our public [mailing list](https://groups.google.com/group/mapsforge-dev) for help.
|
See the **[integration guide](docs/Integration.md)** and [changelog](docs/Changelog.md). And read through [how to contribute](.github/CONTRIBUTING.md) guidelines.
|
||||||
|
|
||||||
See the [integration guide](docs/Integration.md) and [changelog](docs/Changelog.md). And read through [how to contribute](.github/CONTRIBUTING.md) guidelines.
|
If you have any questions or problems, don't hesitate to ask our public [mailing list](https://groups.google.com/group/mapsforge-dev) for help.
|
||||||
|
|
||||||
## Features
|
## Features
|
||||||
- Java map library
|
- Java map library
|
||||||
- OpenGL vector-tile rendering
|
- OpenGL vector-tile rendering
|
||||||
- Themeable vector layers
|
- Themeable vector layers
|
||||||
- Support for multiple tile sources:
|
- Support for multiple tile sources:
|
||||||
- primary opensciencemap (.vtm)
|
- OpenScienceMap vector tiles
|
||||||
- mapsforge files
|
- Mapsforge vector maps
|
||||||
- GeoJSON tiles
|
- Mapbox vector tiles
|
||||||
- bitmap: any quadtree-scheme tiles as texture
|
- GeoJSON vector tiles
|
||||||
|
- Raster tiles: any quadtree-scheme tiles as texture
|
||||||
- Backends:
|
- Backends:
|
||||||
- Android (optional libGDX)
|
- Android
|
||||||
- iOS (using libGDX/RoboVM, [instructions](docs/ios.md))
|
- iOS (using libGDX/RoboVM, [instructions](docs/ios.md))
|
||||||
- Desktop (using libGDX/LWJGL)
|
- Desktop (using libGDX/LWJGL)
|
||||||
- HTML5/WebGL (using libGDX/GWT)
|
- HTML5/WebGL (using libGDX/GWT, [instructions](docs/web.md))
|
||||||
|
|
||||||
### Projects
|
### Projects
|
||||||
- **vtm** contains the core library
|
- **vtm** core library
|
||||||
- **vtm-android** Android backend (no libGDX required)
|
- **vtm-android** Android backend
|
||||||
- **vtm-android-example** provides examples using **vtm-android**
|
- **vtm-android-example** Android examples
|
||||||
- **vtm-gdx** common libGDX backend
|
- **vtm-gdx** common libGDX backend
|
||||||
- **vtm-android-gdx** Android backend (with libGDX)
|
- **vtm-android-gdx** Android libGDX backend
|
||||||
- **vtm-desktop** Desktop backend
|
- **vtm-desktop** Desktop libGDX backend
|
||||||
- **vtm-ios** iOS backend
|
- **vtm-playground** Desktop examples
|
||||||
- **vtm-web** HTML5/GWT backend
|
- **vtm-ios** iOS libGDX backend
|
||||||
|
- **vtm-ios-example** iOS examples
|
||||||
|
- **vtm-web** HTML5/GWT libGDX backend
|
||||||
- **vtm-web-app** HTML5/GWT application
|
- **vtm-web-app** HTML5/GWT application
|
||||||
|
|
||||||
The libGDX backend for GWT is experimental.
|
|
||||||
|
|
||||||
## Applications
|
|
||||||
- VTM is used by many [applications](docs/Applications.md).
|
|
||||||
|
|
||||||
## WebGL Demo
|
## WebGL Demo
|
||||||
[OpenScienceMap](http://opensciencemap.org/s3db/#scale=17,rot=61,tilt=51,lat=53.075,lon=8.807) view of Bremen.
|
[OpenScienceMap](http://opensciencemap.org/s3db/#scale=17,rot=61,tilt=51,lat=53.075,lon=8.807) view of Bremen.
|
||||||
- Hold right mouse button to change view direction.
|
- Hold right mouse button to change view direction.
|
||||||
|
|
||||||
|
## Applications
|
||||||
|
- VTM is used by many [applications](docs/Applications.md).
|
||||||
|
|
||||||
|
## Maps
|
||||||
|
- Mapsforge [map providers](docs/Mapsforge-Maps.md).
|
||||||
|
|
||||||
## Credits
|
## Credits
|
||||||
This library contains code from several projects:
|
This library contains code from several projects:
|
||||||
- **Android**: some Matrix code, TimSort (http://source.android.com)
|
- **Android** (Apache 2.0): some Matrix code, TimSort (http://source.android.com)
|
||||||
- **libGDX**: AsyncTask, MathUtils and Interpolation classes (https://github.com/libgdx)
|
- **libGDX** (Apache 2.0): AsyncTask, MathUtils, Interpolation, PixmapPacker (https://github.com/libgdx)
|
||||||
- **mapsforge**: based on 0.2.4 (https://github.com/mapsforge/mapsforge)
|
- **mapsforge** (LGPL3): based on 0.2.4 (https://github.com/mapsforge/mapsforge)
|
||||||
- **osmdroid**: some overlay classes (https://github.com/osmdroid/osmdroid)
|
- **osmdroid** (Apache 2.0): some overlay classes (https://github.com/osmdroid/osmdroid)
|
||||||
- **tessellate**: (https://github.com/cscheid/tessellate)
|
- **tessellate** (SGI Free Software License B 2.0): (https://github.com/cscheid/tessellate)
|
||||||
|
|
||||||
## Screenshots
|
## Screenshots
|
||||||

|
|
||||||

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

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

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

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

|
||||||
|
|||||||
21
build.gradle
@@ -1,10 +1,11 @@
|
|||||||
buildscript {
|
buildscript {
|
||||||
repositories {
|
repositories {
|
||||||
|
google()
|
||||||
jcenter()
|
jcenter()
|
||||||
}
|
}
|
||||||
dependencies {
|
dependencies {
|
||||||
classpath 'com.android.tools.build:gradle:2.2.0'
|
classpath 'com.android.tools.build:gradle:3.0.1'
|
||||||
classpath 'com.github.dcendents:android-maven-gradle-plugin:1.4.1'
|
classpath 'com.github.dcendents:android-maven-gradle-plugin:2.0'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -13,8 +14,10 @@ allprojects {
|
|||||||
version = 'master-SNAPSHOT'
|
version = 'master-SNAPSHOT'
|
||||||
ext.isReleaseVersion = !version.endsWith("SNAPSHOT")
|
ext.isReleaseVersion = !version.endsWith("SNAPSHOT")
|
||||||
|
|
||||||
ext.androidBuildVersionTools = "24.0.3"
|
ext.androidBuildVersionTools = "27.0.3"
|
||||||
ext.gdxVersion = "1.9.4"
|
ext.gdxVersion = "1.9.8"
|
||||||
|
ext.gwtVersion = "2.8.0"
|
||||||
|
ext.slf4jVersion = "1.7.25"
|
||||||
|
|
||||||
if (JavaVersion.current().isJava8Compatible()) {
|
if (JavaVersion.current().isJava8Compatible()) {
|
||||||
tasks.withType(Javadoc) {
|
tasks.withType(Javadoc) {
|
||||||
@@ -25,18 +28,20 @@ allprojects {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
def androidCompileSdk() { return 24 }
|
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 }
|
def versionName() { return version }
|
||||||
|
|
||||||
subprojects {
|
subprojects {
|
||||||
repositories {
|
repositories {
|
||||||
|
google()
|
||||||
maven { url 'https://repo.boundlessgeo.com/main' }
|
maven { url 'https://repo.boundlessgeo.com/main' }
|
||||||
jcenter()
|
jcenter()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,13 +4,11 @@ if (project.hasProperty("android")) {
|
|||||||
task sourcesJar(type: Jar) {
|
task sourcesJar(type: Jar) {
|
||||||
classifier = 'sources'
|
classifier = 'sources'
|
||||||
from android.sourceSets.main.java.srcDirs
|
from android.sourceSets.main.java.srcDirs
|
||||||
exclude 'android-logger.properties'
|
|
||||||
}
|
}
|
||||||
|
|
||||||
task javadoc(type: Javadoc) {
|
task javadoc(type: Javadoc) {
|
||||||
source = android.sourceSets.main.java.srcDirs
|
source = android.sourceSets.main.java.srcDirs
|
||||||
classpath += project.files(android.getBootClasspath().join(File.pathSeparator))
|
classpath += project.files(android.getBootClasspath().join(File.pathSeparator))
|
||||||
exclude 'android-logger.properties'
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
task sourcesJar(type: Jar) {
|
task sourcesJar(type: Jar) {
|
||||||
|
|||||||
@@ -1,8 +1,18 @@
|
|||||||
# Applications using VTM software (in lexical order)
|
# Applications using VTM software (in lexical order)
|
||||||
|
|
||||||
|**Name**|**Type**|**License/Cost**|**Sources**|
|
|**Name**|**Type**|**License/Cost**|**Platforms**|**Sources**|
|
||||||
|--------|--------|----------------|-----------|
|
|--------|--------|----------------|-------------|-----------|
|
||||||
| [Cachebox 3.0](https://github.com/Longri/cachebox3.0) | Android / Desktop / iOS geocaching application | GPL/Free | Open |
|
| [Cachebox 3.0](https://github.com/Longri/cachebox3.0) | Geocaching application | Apache 2.0/Free | Android, Desktop, iOS | Open |
|
||||||
| [Cruiser](http://wiki.openstreetmap.org/wiki/Cruiser) | Android / Desktop map and navigation application | Proprietary/Free | Closed |
|
| [Cruiser](http://wiki.openstreetmap.org/wiki/Cruiser) | Map and navigation application | Proprietary/Free | Android, Desktop | Closed |
|
||||||
|
| [GCDroid](https://play.google.com/store/apps/details?id=com.gcdroid) | Geocaching App | Proprietary/Free and Commercial | Android | Closed |
|
||||||
|
| [Hunt Cyprus](https://play.google.com/store/apps/developer?id=Talent+S.A.) | Map and navigation application for hunters | Proprietary/Free and Commercial | Android | Closed |
|
||||||
|
| [Kurviger](https://kurviger.de/en) | Route planner specialized on motorcyclists | Proprietary/Free and Commercial | Android | Closed |
|
||||||
|
| [MapTrek](http://maptrek.mobi) | Application for outdoor activities | GPL3/Free and Commercial | Android | Open |
|
||||||
|
| [MyTourbook](http://mytourbook.sourceforge.net/mytourbook/) | Visualize and analyze tours | GPL2/Free | Desktop | Open |
|
||||||
|
| [Navi Cyprus](https://play.google.com/store/apps/developer?id=Talent+S.A.) | Map and navigation application | Proprietary/Free and Commercial | Android | Closed |
|
||||||
|
| 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 |
|
||||||
|
|
||||||
You know an application that is missing here? Please inform us by sending a message via our public [mailing list](https://groups.google.com/group/mapsforge-dev).
|
You know an application that is missing here? Please inform us by sending a message via our public [mailing list](https://groups.google.com/group/mapsforge-dev).
|
||||||
|
|||||||
@@ -1,19 +1,107 @@
|
|||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
## Version 0.6.X
|
## Version 0.9.2 (2018-01-04)
|
||||||
|
|
||||||
**Version 0.6.0-rc1 (2016-10-08)**
|
- Gradle fix transitive dependencies [#433](https://github.com/mapsforge/vtm/issues/433)
|
||||||
|
- libGDX 1.9.8 [#464](https://github.com/mapsforge/vtm/issues/464)
|
||||||
|
- [Solved issues](https://github.com/mapsforge/vtm/issues?q=is%3Aclosed+milestone%3A0.9.2)
|
||||||
|
|
||||||
**Revive of VTM vector map library**
|
## Version 0.9.1 (2017-12-29)
|
||||||
|
|
||||||
|
- LwHttp engine fix http headers [#460](https://github.com/mapsforge/vtm/issues/460)
|
||||||
|
- S3DBLayer renamed to S3DBTileLayer [#452](https://github.com/mapsforge/vtm/issues/452)
|
||||||
|
- Many other minor improvements and bug fixes
|
||||||
|
- [Solved issues](https://github.com/mapsforge/vtm/issues?q=is%3Aclosed+milestone%3A0.9.1)
|
||||||
|
|
||||||
|
## 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)
|
||||||
|
- Marker clustering [#312](https://github.com/mapsforge/vtm/issues/312)
|
||||||
|
- Osmagray theme [#300](https://github.com/mapsforge/vtm/issues/300)
|
||||||
|
- Symbol rotation [#294](https://github.com/mapsforge/vtm/issues/294)
|
||||||
|
- Location renderer improvements [#317](https://github.com/mapsforge/vtm/issues/317)
|
||||||
|
- POT textures [#334](https://github.com/mapsforge/vtm/issues/334)
|
||||||
|
- OkHttp external cache [#135](https://github.com/mapsforge/vtm/issues/135)
|
||||||
|
- Texture atlas improvements [#301](https://github.com/mapsforge/vtm/pull/301) [#304](https://github.com/mapsforge/vtm/pull/304)
|
||||||
|
- vtm-json module [#367](https://github.com/mapsforge/vtm/issues/367)
|
||||||
|
- Mapzen GeoJSON vector tiles [#55](https://github.com/mapsforge/vtm/issues/55)
|
||||||
|
- vtm-ios-example module [#326](https://github.com/mapsforge/vtm/issues/326)
|
||||||
|
- Handle layers enabled state [#342](https://github.com/mapsforge/vtm/issues/342)
|
||||||
|
- Fix coord scale short overflow [#343](https://github.com/mapsforge/vtm/issues/343)
|
||||||
|
- Mapsforge map read improvements [#357](https://github.com/mapsforge/vtm/issues/357) [#370](https://github.com/mapsforge/vtm/issues/370)
|
||||||
|
- Improve canvas DPI setting [#349](https://github.com/mapsforge/vtm/issues/349)
|
||||||
|
- OSM indoor layer enhancements [#366](https://github.com/mapsforge/vtm/issues/366)
|
||||||
|
- Gretty plugin at web modules [#338](https://github.com/mapsforge/vtm/issues/338)
|
||||||
|
- 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)
|
||||||
|
|
||||||
|
## Version 0.7.0 (2017-02-26)
|
||||||
|
|
||||||
|
- Mapsforge multiple map files [#208](https://github.com/mapsforge/vtm/issues/208)
|
||||||
|
- Improved gestures implementation [#253](https://github.com/mapsforge/vtm/issues/253)
|
||||||
|
- Polygon label position enhancements [#80](https://github.com/mapsforge/vtm/issues/80)
|
||||||
|
- vtm-web modules update [#51](https://github.com/mapsforge/vtm/issues/51)
|
||||||
|
- Mapzen MVT vector tiles [#57](https://github.com/mapsforge/vtm/issues/57)
|
||||||
|
- SVG resources scaling in themes [#214](https://github.com/mapsforge/vtm/issues/214)
|
||||||
|
- Circle map style [#122](https://github.com/mapsforge/vtm/issues/122)
|
||||||
|
- Oneway arrows in themes [#275](https://github.com/mapsforge/vtm/issues/275)
|
||||||
|
- Texture atlas from bitmaps [#283](https://github.com/mapsforge/vtm/pull/283)
|
||||||
|
- PathLayer (vtm) fix disappearing segments [#108](https://github.com/mapsforge/vtm/issues/108)
|
||||||
|
- House numbers (nodes) fix visibility [#168](https://github.com/mapsforge/vtm/issues/168)
|
||||||
|
- Android fix quick scale vs long press [#250](https://github.com/mapsforge/vtm/issues/250)
|
||||||
|
- Use baseline 160dpi in scaling [#236](https://github.com/mapsforge/vtm/issues/236)
|
||||||
|
- OkHttp3 update [#138](https://github.com/mapsforge/vtm/issues/138)
|
||||||
|
- libGDX double tap zoom [#263](https://github.com/mapsforge/vtm/issues/263)
|
||||||
|
- MapFileTileSource zoom level API enhancements [#219](https://github.com/mapsforge/vtm/issues/219)
|
||||||
|
- Animator enhancements with easing functions [#246](https://github.com/mapsforge/vtm/issues/246)
|
||||||
|
- Tile grid layer scaling [#238](https://github.com/mapsforge/vtm/issues/238)
|
||||||
|
- Internal render themes new SVG resources [#251](https://github.com/mapsforge/vtm/issues/251)
|
||||||
|
- Fix theme parsing in non-Latin locales [#297](https://github.com/mapsforge/vtm/issues/297)
|
||||||
|
- 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)
|
- 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)
|
- Render theme styles [#93](https://github.com/mapsforge/vtm/issues/93)
|
||||||
- vtm-ios module update [#29](https://github.com/mapsforge/vtm/issues/29)
|
- 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)
|
- Native libraries for all platforms [#14](https://github.com/mapsforge/vtm/issues/14)
|
||||||
- Line stipple and texture rendering [#105](https://github.com/mapsforge/vtm/issues/105)
|
- Line stipple and texture rendering [#105](https://github.com/mapsforge/vtm/issues/105)
|
||||||
- Layer groups [#99](https://github.com/mapsforge/vtm/issues/99) [#103](https://github.com/mapsforge/vtm/issues/103)
|
- Layer groups [#99](https://github.com/mapsforge/vtm/issues/99) [#103](https://github.com/mapsforge/vtm/issues/103)
|
||||||
- Location renderer [#171](https://github.com/mapsforge/vtm/issues/171)
|
- Location renderer and layer [#171](https://github.com/mapsforge/vtm/issues/171)
|
||||||
- Map scale bar [#84](https://github.com/mapsforge/vtm/issues/84)
|
- Map scale bar [#84](https://github.com/mapsforge/vtm/issues/84)
|
||||||
- Tile size based on scale factor [#183](https://github.com/mapsforge/vtm/issues/183)
|
- Tile size based on scale factor [#183](https://github.com/mapsforge/vtm/issues/183)
|
||||||
- libGDX layer gestures [#151](https://github.com/mapsforge/vtm/issues/151)
|
- libGDX layer gestures [#151](https://github.com/mapsforge/vtm/issues/151)
|
||||||
@@ -22,8 +110,10 @@
|
|||||||
- GeoPoint & BoundingBox improvements [#201](https://github.com/mapsforge/vtm/issues/201) [#200](https://github.com/mapsforge/vtm/issues/200)
|
- GeoPoint & BoundingBox improvements [#201](https://github.com/mapsforge/vtm/issues/201) [#200](https://github.com/mapsforge/vtm/issues/200)
|
||||||
- vtm-jts module [#53](https://github.com/mapsforge/vtm/issues/53)
|
- vtm-jts module [#53](https://github.com/mapsforge/vtm/issues/53)
|
||||||
- vtm-http module [#140](https://github.com/mapsforge/vtm/issues/140)
|
- 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)
|
- LWJGL desktop libGDX backend [#129](https://github.com/mapsforge/vtm/issues/129)
|
||||||
|
- 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)
|
- 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
|
- Many other minor improvements and bug fixes
|
||||||
- [Solved issues](https://github.com/mapsforge/vtm/issues?q=is%3Aissue+is%3Aclosed+milestone%3A0.6.0)
|
- [Solved issues](https://github.com/mapsforge/vtm/issues?q=is%3Aclosed+milestone%3A0.6.0)
|
||||||
|
|||||||
@@ -1,25 +1,49 @@
|
|||||||
# Integration guide
|
# Integration guide
|
||||||
|
|
||||||
This article describes how to integrate the library in your project.
|
This article describes how to integrate the library in your project, with Gradle / Maven / Jars or SNAPSHOT builds.
|
||||||
|
|
||||||
Current version is [](https://maven-badges.herokuapp.com/maven-central/org.mapsforge/vtm)
|
Current version is [](http://search.maven.org/#search%7Cga%7C1%7Cg%3A%22org.mapsforge%22)
|
||||||
|
|
||||||
## Gradle
|
## Gradle
|
||||||
|
|
||||||
### Core
|
### Core
|
||||||
```groovy
|
```groovy
|
||||||
compile 'org.mapsforge:vtm:[CURRENT-VERSION]'
|
implementation 'org.mapsforge:vtm:[CURRENT-VERSION]'
|
||||||
compile 'org.mapsforge:vtm-themes:[CURRENT-VERSION]'
|
implementation 'org.mapsforge:vtm-themes:[CURRENT-VERSION]'
|
||||||
compile 'org.slf4j:slf4j-api:1.7.21'
|
implementation 'org.slf4j:slf4j-api:1.7.25'
|
||||||
```
|
```
|
||||||
|
|
||||||
### Android
|
### Android
|
||||||
```groovy
|
```groovy
|
||||||
compile 'org.mapsforge:vtm-android:[CURRENT-VERSION]'
|
implementation 'org.mapsforge:vtm-android:[CURRENT-VERSION]'
|
||||||
compile 'org.mapsforge:vtm-android:[CURRENT-VERSION]:natives-armeabi'
|
implementation 'org.mapsforge:vtm-android:[CURRENT-VERSION]:natives-arm64-v8a'
|
||||||
compile 'org.mapsforge:vtm-android:[CURRENT-VERSION]:natives-armeabi-v7a'
|
implementation 'org.mapsforge:vtm-android:[CURRENT-VERSION]:natives-armeabi'
|
||||||
compile 'org.mapsforge:vtm-android:[CURRENT-VERSION]:natives-x86'
|
implementation 'org.mapsforge:vtm-android:[CURRENT-VERSION]:natives-armeabi-v7a'
|
||||||
compile 'com.caverock:androidsvg:1.2.2-beta-1'
|
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
|
||||||
|
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.8'
|
||||||
|
implementation 'com.badlogicgames.gdx:gdx-backend-android:1.9.8'
|
||||||
|
implementation 'com.caverock:androidsvg:1.2.2-beta-1'
|
||||||
```
|
```
|
||||||
|
|
||||||
### iOS
|
### iOS
|
||||||
@@ -28,24 +52,50 @@ Detailed iOS instructions can be found [here](ios.md).
|
|||||||
|
|
||||||
### Desktop
|
### Desktop
|
||||||
```groovy
|
```groovy
|
||||||
compile 'org.mapsforge:vtm-gdx:[CURRENT-VERSION]'
|
implementation 'org.mapsforge:vtm-gdx:[CURRENT-VERSION]'
|
||||||
compile 'org.mapsforge:vtm-desktop:[CURRENT-VERSION]'
|
implementation 'org.mapsforge:vtm-desktop:[CURRENT-VERSION]'
|
||||||
compile 'org.mapsforge:vtm-desktop:[CURRENT-VERSION]:natives-linux'
|
implementation 'org.mapsforge:vtm-desktop:[CURRENT-VERSION]:natives-linux'
|
||||||
compile 'org.mapsforge:vtm-desktop:[CURRENT-VERSION]:natives-osx'
|
implementation 'org.mapsforge:vtm-desktop:[CURRENT-VERSION]:natives-osx'
|
||||||
compile 'org.mapsforge:vtm-desktop:[CURRENT-VERSION]:natives-windows'
|
implementation 'org.mapsforge:vtm-desktop:[CURRENT-VERSION]:natives-windows'
|
||||||
compile 'com.badlogicgames.gdx:gdx:1.9.4'
|
implementation 'com.badlogicgames.gdx:gdx:1.9.8'
|
||||||
compile 'com.badlogicgames.gdx:gdx-platform:1.9.4:natives-desktop'
|
implementation 'com.badlogicgames.gdx:gdx-platform:1.9.8:natives-desktop'
|
||||||
compile 'com.badlogicgames.gdx:gdx-backend-lwjgl:1.9.4'
|
implementation 'com.badlogicgames.gdx:gdx-backend-lwjgl:1.9.8'
|
||||||
compile 'org.lwjgl.lwjgl:lwjgl:2.9.3'
|
implementation 'org.lwjgl.lwjgl:lwjgl:2.9.3'
|
||||||
compile 'org.lwjgl.lwjgl:lwjgl-platform:2.9.3:natives-linux'
|
implementation 'org.lwjgl.lwjgl:lwjgl-platform:2.9.3:natives-linux'
|
||||||
compile 'org.lwjgl.lwjgl:lwjgl-platform:2.9.3:natives-osx'
|
implementation 'org.lwjgl.lwjgl:lwjgl-platform:2.9.3:natives-osx'
|
||||||
compile 'org.lwjgl.lwjgl:lwjgl-platform:2.9.3:natives-windows'
|
implementation 'org.lwjgl.lwjgl:lwjgl-platform:2.9.3:natives-windows'
|
||||||
compile 'com.kitfox.svg:svg-salamander:1.0'
|
implementation 'com.metsci.ext.com.kitfox.svg:svg-salamander:0.1.19'
|
||||||
|
```
|
||||||
|
|
||||||
|
### Optional
|
||||||
|
|
||||||
|
- JTS geometries
|
||||||
|
|
||||||
|
```groovy
|
||||||
|
implementation 'org.mapsforge:vtm-jts:[CURRENT-VERSION]'
|
||||||
|
implementation 'com.vividsolutions:jts:1.13'
|
||||||
|
```
|
||||||
|
|
||||||
|
- Online tiles
|
||||||
|
|
||||||
|
```groovy
|
||||||
|
implementation 'org.mapsforge:vtm-http:[CURRENT-VERSION]'
|
||||||
|
implementation 'com.squareup.okhttp3:okhttp:3.8.0'
|
||||||
|
implementation 'com.squareup.okio:okio:1.13.0'
|
||||||
|
```
|
||||||
|
|
||||||
|
- GeoJSON tiles
|
||||||
|
|
||||||
|
```groovy
|
||||||
|
implementation 'org.mapsforge:vtm-json:[CURRENT-VERSION]'
|
||||||
|
implementation 'com.fasterxml.jackson.core:jackson-annotations:2.8.4'
|
||||||
|
implementation 'com.fasterxml.jackson.core:jackson-core:2.8.4'
|
||||||
|
implementation 'com.fasterxml.jackson.core:jackson-databind:2.8.4'
|
||||||
```
|
```
|
||||||
|
|
||||||
## Snapshots
|
## Snapshots
|
||||||
|
|
||||||
We publish regularly SNAPSHOT builds to Sonatype OSS Repository Hosting.
|
We publish SNAPSHOT builds to Sonatype OSS Repository Hosting.
|
||||||
|
|
||||||
You need to add the repository:
|
You need to add the repository:
|
||||||
```groovy
|
```groovy
|
||||||
@@ -56,10 +106,17 @@ repositories {
|
|||||||
|
|
||||||
And declare the dependencies like:
|
And declare the dependencies like:
|
||||||
```groovy
|
```groovy
|
||||||
compile 'org.mapsforge:vtm:master-SNAPSHOT'
|
implementation 'org.mapsforge:vtm:master-SNAPSHOT'
|
||||||
...
|
...
|
||||||
```
|
```
|
||||||
|
|
||||||
|
For checking latest snapshot on every build:
|
||||||
|
```groovy
|
||||||
|
configurations.all {
|
||||||
|
resolutionStrategy.cacheChangingModulesFor 0, 'seconds'
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
## Maven
|
## Maven
|
||||||
|
|
||||||
The dependencies for Maven are declared in a similar way. For example:
|
The dependencies for Maven are declared in a similar way. For example:
|
||||||
@@ -74,6 +131,6 @@ The dependencies for Maven are declared in a similar way. For example:
|
|||||||
|
|
||||||
## Jars
|
## Jars
|
||||||
|
|
||||||
You can find jars (regular and with dependencies) in Maven Central or Snapshots repositories.
|
You can find release and snapshot jars (regular and with dependencies) in [Maven Central](http://search.maven.org/#search%7Cga%7C1%7Cg%3A%22org.mapsforge%22) and [Sonatype OSS Repository Hosting](https://oss.sonatype.org/content/repositories/snapshots/org/mapsforge/).
|
||||||
|
|
||||||
Third party jars can be found at their respective sites or in Maven Central repository.
|
Third party jars can be found at their respective sites or in Maven Central repository.
|
||||||
|
|||||||
11
docs/Mapsforge-Maps.md
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
# Mapsforge map providers (in lexical order)
|
||||||
|
|
||||||
|
- [AndroidMaps](http://www.androidmaps.co.uk/)
|
||||||
|
- [Freizeitkarte](http://www.freizeitkarte-osm.de/android/en/index.html)
|
||||||
|
- [Kurviger](https://offline-maps.kurviger.de/)
|
||||||
|
- [Locusvectormaps](http://www.locusvectormaps.com)
|
||||||
|
- [Mapsforge](http://download.mapsforge.org/)
|
||||||
|
- [OpenAndroMaps](http://www.openandromaps.org/en/)
|
||||||
|
- [OpenMaps](http://openmaps.eu/)
|
||||||
|
|
||||||
|
You know a Mapsforge map provider that is missing here? Please inform us by sending a message via our public [mailing list](https://groups.google.com/group/mapsforge-dev).
|
||||||
BIN
docs/images/android.png
Normal file
|
After Width: | Height: | Size: 717 KiB |
BIN
docs/images/browser.png
Normal file
|
After Width: | Height: | Size: 791 KiB |
BIN
docs/images/desktop.png
Normal file
|
After Width: | Height: | Size: 580 KiB |
BIN
docs/images/ios.png
Normal file
|
After Width: | Height: | Size: 450 KiB |
|
Before Width: | Height: | Size: 827 KiB |
|
Before Width: | Height: | Size: 1.1 MiB |
7
docs/web.md
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
### Web implementation
|
||||||
|
|
||||||
|
`./gradlew :vtm-web-app:farmRun` will run standalone web server at port 8080.
|
||||||
|
|
||||||
|
Then go to [http://localhost:8080/vtm-web-app](http://localhost:8080/vtm-web-app) in the web browser to see the map.
|
||||||
|
|
||||||
|
Hold right mouse button to change view direction.
|
||||||
@@ -9,7 +9,7 @@
|
|||||||
|
|
||||||
# Specifies the JVM arguments used for the daemon process.
|
# Specifies the JVM arguments used for the daemon process.
|
||||||
# The setting is particularly useful for tweaking memory settings.
|
# The setting is particularly useful for tweaking memory settings.
|
||||||
# org.gradle.jvmargs=-Xmx1536m
|
org.gradle.jvmargs=-Xmx1536m
|
||||||
|
|
||||||
# When configured, Gradle will run in incubating parallel mode.
|
# When configured, Gradle will run in incubating parallel mode.
|
||||||
# This option should only be used with decoupled projects. More details, visit
|
# This option should only be used with decoupled projects. More details, visit
|
||||||
|
|||||||
4
gradle/wrapper/gradle-wrapper.properties
vendored
@@ -1,6 +1,6 @@
|
|||||||
#Tue Aug 16 13:14:49 EEST 2016
|
#Thu Oct 26 11:57:58 EEST 2017
|
||||||
distributionBase=GRADLE_USER_HOME
|
distributionBase=GRADLE_USER_HOME
|
||||||
distributionPath=wrapper/dists
|
distributionPath=wrapper/dists
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
zipStorePath=wrapper/dists
|
zipStorePath=wrapper/dists
|
||||||
distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-all.zip
|
distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-all.zip
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
apply plugin: 'java'
|
apply plugin: 'java-library'
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
compile "com.badlogicgames.gdx:gdx-jnigen:$gdxVersion"
|
api "com.badlogicgames.gdx:gdx-jnigen:$gdxVersion"
|
||||||
}
|
}
|
||||||
|
|
||||||
sourceSets {
|
sourceSets {
|
||||||
|
|||||||
@@ -69,7 +69,7 @@
|
|||||||
|
|
||||||
<xs:simpleType name="src">
|
<xs:simpleType name="src">
|
||||||
<xs:restriction base="xs:string">
|
<xs:restriction base="xs:string">
|
||||||
<xs:pattern value="(file|assets):.+" />
|
<xs:pattern value="((file|assets):)?.+" />
|
||||||
</xs:restriction>
|
</xs:restriction>
|
||||||
</xs:simpleType>
|
</xs:simpleType>
|
||||||
|
|
||||||
@@ -84,6 +84,7 @@
|
|||||||
<xs:restriction base="xs:string">
|
<xs:restriction base="xs:string">
|
||||||
<xs:enumeration value="ele" />
|
<xs:enumeration value="ele" />
|
||||||
<xs:enumeration value="addr:housenumber" />
|
<xs:enumeration value="addr:housenumber" />
|
||||||
|
<xs:enumeration value="addr_housenumber" /> <!-- Mapzen -->
|
||||||
<xs:enumeration value="name" />
|
<xs:enumeration value="name" />
|
||||||
<xs:enumeration value="ref" />
|
<xs:enumeration value="ref" />
|
||||||
</xs:restriction>
|
</xs:restriction>
|
||||||
@@ -124,6 +125,9 @@
|
|||||||
<xs:attribute name="id" default="0" type="xs:string" use="optional" />
|
<xs:attribute name="id" default="0" type="xs:string" use="optional" />
|
||||||
<xs:attribute name="use" default="0" type="xs:string" use="optional" />
|
<xs:attribute name="use" default="0" type="xs:string" use="optional" />
|
||||||
<xs:attribute name="src" type="tns:src" use="optional" />
|
<xs:attribute name="src" type="tns:src" use="optional" />
|
||||||
|
<xs:attribute name="symbol-width" type="xs:positiveInteger" use="optional" />
|
||||||
|
<xs:attribute name="symbol-height" type="xs:positiveInteger" use="optional" />
|
||||||
|
<xs:attribute name="symbol-percent" type="xs:positiveInteger" use="optional" />
|
||||||
<xs:attribute name="fill" default="#000000" type="tns:color" use="optional" />
|
<xs:attribute name="fill" default="#000000" type="tns:color" use="optional" />
|
||||||
<xs:attribute name="stroke" default="#00000000" type="tns:color" use="optional" />
|
<xs:attribute name="stroke" default="#00000000" type="tns:color" use="optional" />
|
||||||
<xs:attribute name="stroke-width" default="0" type="tns:nonNegativeFloat" use="optional" />
|
<xs:attribute name="stroke-width" default="0" type="tns:nonNegativeFloat" use="optional" />
|
||||||
@@ -143,11 +147,15 @@
|
|||||||
<xs:attribute name="fill" default="#000000" type="tns:color" use="optional" />
|
<xs:attribute name="fill" default="#000000" type="tns:color" use="optional" />
|
||||||
<xs:attribute name="stroke" default="#000000" type="tns:color" use="optional" />
|
<xs:attribute name="stroke" default="#000000" type="tns:color" use="optional" />
|
||||||
<xs:attribute name="stroke-width" default="0" type="tns:nonNegativeFloat" use="optional" />
|
<xs:attribute name="stroke-width" default="0" type="tns:nonNegativeFloat" use="optional" />
|
||||||
|
<!-- polygon area expressed as a ratio to tile area, e.g. 0.1 for 10% of tile area -->
|
||||||
|
<xs:attribute name="area-size" default="0" type="tns:nonNegativeFloat" use="optional" />
|
||||||
<!-- priority for label placement, 0 = highest priority -->
|
<!-- priority for label placement, 0 = highest priority -->
|
||||||
<xs:attribute name="priority" default="0" type="xs:integer" use="optional" />
|
<xs:attribute name="priority" default="0" type="xs:integer" use="optional" />
|
||||||
|
<!-- symbol src name -->
|
||||||
<!-- symbol src name in atlas -->
|
|
||||||
<xs:attribute name="symbol" type="tns:src" use="optional" />
|
<xs:attribute name="symbol" type="tns:src" use="optional" />
|
||||||
|
<xs:attribute name="symbol-width" type="xs:positiveInteger" use="optional" />
|
||||||
|
<xs:attribute name="symbol-height" type="xs:positiveInteger" use="optional" />
|
||||||
|
<xs:attribute name="symbol-percent" type="xs:positiveInteger" use="optional" />
|
||||||
</xs:complexType>
|
</xs:complexType>
|
||||||
|
|
||||||
<xs:complexType name="circle">
|
<xs:complexType name="circle">
|
||||||
@@ -169,6 +177,9 @@
|
|||||||
<xs:attribute name="use" default="0" type="xs:string" use="optional" />
|
<xs:attribute name="use" default="0" type="xs:string" use="optional" />
|
||||||
|
|
||||||
<xs:attribute name="src" type="tns:src" use="optional" />
|
<xs:attribute name="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" default="#000000" type="tns:color" use="optional" />
|
||||||
<xs:attribute name="width" default="0" type="xs:float" use="optional" />
|
<xs:attribute name="width" default="0" type="xs:float" use="optional" />
|
||||||
<!-- minimum scaled width to draw outline -->
|
<!-- minimum scaled width to draw outline -->
|
||||||
@@ -179,6 +190,8 @@
|
|||||||
<xs:attribute name="fade" default="-1" type="xs:integer" use="optional" />
|
<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="blur" default="-1" type="xs:float" use="optional" />
|
||||||
<xs:attribute name="fix" default="false" type="xs:boolean" 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' -->
|
<!-- stipple repeat in 'pixel' -->
|
||||||
<xs:attribute name="stipple" default="0" type="xs:integer" use="optional" />
|
<xs:attribute name="stipple" default="0" type="xs:integer" use="optional" />
|
||||||
@@ -189,21 +202,6 @@
|
|||||||
|
|
||||||
</xs:complexType>
|
</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="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="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:complexType name="text">
|
||||||
<xs:attribute name="cat" type="xs:string" use="optional" />
|
<xs:attribute name="cat" type="xs:string" use="optional" />
|
||||||
|
|
||||||
@@ -219,6 +217,8 @@
|
|||||||
<xs:attribute name="stroke" default="#000000" type="tns:color" use="optional" />
|
<xs:attribute name="stroke" default="#000000" type="tns:color" use="optional" />
|
||||||
<xs:attribute name="stroke-width" default="0" type="tns:nonNegativeFloat" use="optional" />
|
<xs:attribute name="stroke-width" default="0" type="tns:nonNegativeFloat" use="optional" />
|
||||||
<xs:attribute name="caption" default="false" type="xs:boolean" use="optional" />
|
<xs:attribute name="caption" default="false" type="xs:boolean" use="optional" />
|
||||||
|
<!-- polygon area expressed as a ratio to tile area, e.g. 0.1 for 10% of tile area -->
|
||||||
|
<xs:attribute name="area-size" default="0" type="tns:nonNegativeFloat" use="optional" />
|
||||||
<!-- priority for label placement, 0 = highest priority -->
|
<!-- priority for label placement, 0 = highest priority -->
|
||||||
<xs:attribute name="priority" default="0" type="xs:integer" use="optional" />
|
<xs:attribute name="priority" default="0" type="xs:integer" use="optional" />
|
||||||
</xs:complexType>
|
</xs:complexType>
|
||||||
@@ -226,6 +226,9 @@
|
|||||||
<xs:complexType name="symbol">
|
<xs:complexType name="symbol">
|
||||||
<xs:attribute name="cat" type="xs:string" use="optional" />
|
<xs:attribute name="cat" type="xs:string" use="optional" />
|
||||||
<xs:attribute name="src" type="tns:src" use="required" />
|
<xs:attribute name="src" type="tns:src" use="required" />
|
||||||
|
<xs:attribute name="symbol-width" type="xs:positiveInteger" use="optional" />
|
||||||
|
<xs:attribute name="symbol-height" type="xs:positiveInteger" use="optional" />
|
||||||
|
<xs:attribute name="symbol-percent" type="xs:positiveInteger" use="optional" />
|
||||||
</xs:complexType>
|
</xs:complexType>
|
||||||
|
|
||||||
<xs:complexType name="extrusion">
|
<xs:complexType name="extrusion">
|
||||||
@@ -233,6 +236,8 @@
|
|||||||
<xs:attribute name="line-color" type="tns:color" use="optional" />
|
<xs:attribute name="line-color" type="tns:color" use="optional" />
|
||||||
<xs:attribute name="side-color" type="tns:color" use="required" />
|
<xs:attribute name="side-color" type="tns:color" use="required" />
|
||||||
<xs:attribute name="top-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>
|
</xs:complexType>
|
||||||
|
|
||||||
<!-- match elements -->
|
<!-- match elements -->
|
||||||
@@ -246,7 +251,7 @@
|
|||||||
<xs:element name="circle" type="tns:circle" />
|
<xs:element name="circle" type="tns:circle" />
|
||||||
<xs:element name="line" type="tns:line" />
|
<xs:element name="line" type="tns:line" />
|
||||||
<xs:element name="outline" 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="text" type="tns:text" />
|
||||||
<xs:element name="extrusion" type="tns:extrusion" />
|
<xs:element name="extrusion" type="tns:extrusion" />
|
||||||
<xs:element name="symbol" type="tns:symbol" />
|
<xs:element name="symbol" type="tns:symbol" />
|
||||||
|
|||||||
@@ -1,19 +1,22 @@
|
|||||||
rootProject.name = 'vtm-parent'
|
rootProject.name = 'vtm-parent'
|
||||||
include ':vtm'
|
include ':vtm'
|
||||||
include ':vtm-http'
|
|
||||||
include ':vtm-jts'
|
|
||||||
include ':vtm-tests'
|
|
||||||
include ':vtm-extras'
|
|
||||||
include ':vtm-android'
|
include ':vtm-android'
|
||||||
include ':vtm-android-example'
|
include ':vtm-android-example'
|
||||||
include ':vtm-themes'
|
|
||||||
include ':vtm-gdx'
|
|
||||||
include ':vtm-desktop'
|
|
||||||
include ':vtm-android-gdx'
|
include ':vtm-android-gdx'
|
||||||
//include ':vtm-web'
|
|
||||||
//include ':vtm-web-app'
|
|
||||||
//include ':vtm-web-js'
|
|
||||||
include ':vtm-jeo'
|
|
||||||
include ':vtm-playground'
|
|
||||||
include ':vtm-ios'
|
|
||||||
include ':vtm-app'
|
include ':vtm-app'
|
||||||
|
include ':vtm-desktop'
|
||||||
|
include ':vtm-extras'
|
||||||
|
include ':vtm-gdx'
|
||||||
|
include ':vtm-http'
|
||||||
|
include ':vtm-ios'
|
||||||
|
include ':vtm-ios-example'
|
||||||
|
include ':vtm-jeo'
|
||||||
|
include ':vtm-json'
|
||||||
|
include ':vtm-jts'
|
||||||
|
include ':vtm-playground'
|
||||||
|
include ':vtm-tests'
|
||||||
|
include ':vtm-theme-comparator'
|
||||||
|
include ':vtm-themes'
|
||||||
|
include ':vtm-web'
|
||||||
|
include ':vtm-web-app'
|
||||||
|
//include ':vtm-web-js'
|
||||||
|
|||||||
@@ -10,10 +10,6 @@
|
|||||||
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
|
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
|
||||||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
|
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
|
||||||
|
|
||||||
<uses-sdk
|
|
||||||
android:minSdkVersion="10"
|
|
||||||
android:targetSdkVersion="22" />
|
|
||||||
|
|
||||||
<application
|
<application
|
||||||
android:allowBackup="true"
|
android:allowBackup="true"
|
||||||
android:icon="@drawable/ic_launcher"
|
android:icon="@drawable/ic_launcher"
|
||||||
@@ -26,9 +22,24 @@
|
|||||||
<category android:name="android.intent.category.LAUNCHER" />
|
<category android:name="android.intent.category.LAUNCHER" />
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
</activity>
|
</activity>
|
||||||
|
<activity
|
||||||
|
android:name=".AtlasMarkerOverlayActivity"
|
||||||
|
android:configChanges="keyboardHidden|orientation|screenSize" />
|
||||||
|
<activity
|
||||||
|
android:name=".AtlasMultiTextureActivity"
|
||||||
|
android:configChanges="keyboardHidden|orientation|screenSize" />
|
||||||
|
<activity
|
||||||
|
android:name=".AtlasThemeActivity"
|
||||||
|
android:configChanges="keyboardHidden|orientation|screenSize" />
|
||||||
<activity
|
<activity
|
||||||
android:name=".BitmapTileMapActivity"
|
android:name=".BitmapTileMapActivity"
|
||||||
android:configChanges="keyboardHidden|orientation|screenSize" />
|
android:configChanges="keyboardHidden|orientation|screenSize" />
|
||||||
|
<activity
|
||||||
|
android:name=".ClusterMarkerOverlayActivity"
|
||||||
|
android:configChanges="keyboardHidden|orientation|screenSize" />
|
||||||
|
<activity
|
||||||
|
android:name=".GdxMapActivity"
|
||||||
|
android:configChanges="keyboardHidden|orientation|screenSize" />
|
||||||
<activity
|
<activity
|
||||||
android:name=".JeoIndoorMapActivity"
|
android:name=".JeoIndoorMapActivity"
|
||||||
android:configChanges="keyboardHidden|orientation|screenSize" />
|
android:configChanges="keyboardHidden|orientation|screenSize" />
|
||||||
@@ -38,12 +49,30 @@
|
|||||||
<activity
|
<activity
|
||||||
android:name=".LineTexActivity"
|
android:name=".LineTexActivity"
|
||||||
android:configChanges="keyboardHidden|orientation|screenSize" />
|
android:configChanges="keyboardHidden|orientation|screenSize" />
|
||||||
|
<activity
|
||||||
|
android:name=".LocationActivity"
|
||||||
|
android:configChanges="keyboardHidden|orientation|screenSize" />
|
||||||
<activity
|
<activity
|
||||||
android:name=".MapsforgeMapActivity"
|
android:name=".MapsforgeMapActivity"
|
||||||
android:configChanges="keyboardHidden|orientation|screenSize" />
|
android:configChanges="keyboardHidden|orientation|screenSize" />
|
||||||
<activity
|
<activity
|
||||||
android:name=".MapsforgeMapActivity$MapFilePicker"
|
android:name=".MapsforgeMapActivity$MapFilePicker"
|
||||||
android:configChanges="keyboardHidden|orientation|screenSize" />
|
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" />
|
||||||
|
<activity
|
||||||
|
android:name=".MapzenGeojsonMapActivity"
|
||||||
|
android:configChanges="keyboardHidden|orientation|screenSize" />
|
||||||
|
<activity
|
||||||
|
android:name=".MapzenMvtMapActivity"
|
||||||
|
android:configChanges="keyboardHidden|orientation|screenSize" />
|
||||||
<activity
|
<activity
|
||||||
android:name=".MarkerOverlayActivity"
|
android:name=".MarkerOverlayActivity"
|
||||||
android:configChanges="keyboardHidden|orientation|screenSize" />
|
android:configChanges="keyboardHidden|orientation|screenSize" />
|
||||||
@@ -51,13 +80,31 @@
|
|||||||
android:name=".MultiMapActivity"
|
android:name=".MultiMapActivity"
|
||||||
android:configChanges="keyboardHidden|orientation|screenSize" />
|
android:configChanges="keyboardHidden|orientation|screenSize" />
|
||||||
<activity
|
<activity
|
||||||
android:name=".OsmJsonMapActivity"
|
android:name=".NewGesturesActivity"
|
||||||
|
android:configChanges="keyboardHidden|orientation|screenSize" />
|
||||||
|
<activity
|
||||||
|
android:name=".OpenMapTilesGeojsonMapActivity"
|
||||||
|
android:configChanges="keyboardHidden|orientation|screenSize" />
|
||||||
|
<activity
|
||||||
|
android:name=".OSciMapS3DBMapActivity"
|
||||||
android:configChanges="keyboardHidden|orientation|screenSize" />
|
android:configChanges="keyboardHidden|orientation|screenSize" />
|
||||||
<activity
|
<activity
|
||||||
android:name=".PathOverlayActivity"
|
android:name=".PathOverlayActivity"
|
||||||
android:configChanges="keyboardHidden|orientation|screenSize" />
|
android:configChanges="keyboardHidden|orientation|screenSize" />
|
||||||
<activity
|
<activity
|
||||||
android:name=".S3DBMapActivity"
|
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" />
|
android:configChanges="keyboardHidden|orientation|screenSize" />
|
||||||
<activity
|
<activity
|
||||||
android:name=".SimpleMapActivity"
|
android:name=".SimpleMapActivity"
|
||||||
|
|||||||
50
vtm-android-example/assets/vtm/stylemenu.xml
Normal file
@@ -0,0 +1,50 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<rendertheme xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" map-background="#fffcfa"
|
||||||
|
version="1" xmlns="http://opensciencemap.org/rendertheme"
|
||||||
|
xsi:schemaLocation="http://opensciencemap.org/rendertheme https://raw.githubusercontent.com/mapsforge/vtm/master/resources/rendertheme.xsd">
|
||||||
|
|
||||||
|
<stylemenu defaultlang="en" defaultvalue="1" id="menu">
|
||||||
|
<layer enabled="true" id="nature">
|
||||||
|
<name lang="de" value="Natur" />
|
||||||
|
<name lang="en" value="Nature" />
|
||||||
|
<name lang="es" value="Naturaleza" />
|
||||||
|
<name lang="fr" value="Nature" />
|
||||||
|
<cat id="nature" />
|
||||||
|
</layer>
|
||||||
|
|
||||||
|
<layer id="base">
|
||||||
|
<cat id="sea" />
|
||||||
|
<cat id="land" />
|
||||||
|
</layer>
|
||||||
|
|
||||||
|
<!-- Show nature layers (enabled by default) -->
|
||||||
|
<layer id="1" parent="base" visible="true">
|
||||||
|
<name lang="de" value="1" />
|
||||||
|
<name lang="en" value="1" />
|
||||||
|
<name lang="es" value="1" />
|
||||||
|
<name lang="fr" value="1" />
|
||||||
|
<overlay id="nature" />
|
||||||
|
</layer>
|
||||||
|
|
||||||
|
<!-- Don't show nature layers -->
|
||||||
|
<layer id="2" parent="base" visible="true">
|
||||||
|
<name lang="de" value="2" />
|
||||||
|
<name lang="en" value="2" />
|
||||||
|
<name lang="es" value="2" />
|
||||||
|
<name lang="fr" value="2" />
|
||||||
|
</layer>
|
||||||
|
</stylemenu>
|
||||||
|
|
||||||
|
<m cat="sea" e="way" k="natural" v="issea|sea">
|
||||||
|
<area fill="#b5d6f1" mesh="true" />
|
||||||
|
</m>
|
||||||
|
|
||||||
|
<m cat="land" e="way" k="natural" v="nosea">
|
||||||
|
<area fill="#f8f8f8" mesh="true" />
|
||||||
|
</m>
|
||||||
|
|
||||||
|
<m cat="nature" e="way" k="natural|landuse" v="forest|wood">
|
||||||
|
<area fill="#83aa5b" />
|
||||||
|
</m>
|
||||||
|
|
||||||
|
</rendertheme>
|
||||||
@@ -1,12 +1,26 @@
|
|||||||
apply plugin: 'com.android.application'
|
apply plugin: 'com.android.application'
|
||||||
|
|
||||||
|
repositories {
|
||||||
|
maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
|
||||||
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
compile project(':vtm-android')
|
implementation project(':vtm-android')
|
||||||
compile project(':vtm-extras')
|
implementation project(':vtm-http')
|
||||||
compile project(':vtm-jeo')
|
implementation project(':vtm-jeo')
|
||||||
compile project(':vtm-jts')
|
implementation project(':vtm-json')
|
||||||
compile project(':vtm-themes')
|
implementation project(':vtm-jts')
|
||||||
compile 'com.noveogroup.android:android-logger:1.3.6'
|
implementation project(':vtm-themes')
|
||||||
|
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 {
|
android {
|
||||||
@@ -22,6 +36,7 @@ android {
|
|||||||
versionCode versionCode()
|
versionCode versionCode()
|
||||||
versionName versionName()
|
versionName versionName()
|
||||||
minSdkVersion androidMinSdk()
|
minSdkVersion androidMinSdk()
|
||||||
|
targetSdkVersion androidTargetSdk()
|
||||||
}
|
}
|
||||||
|
|
||||||
sourceSets {
|
sourceSets {
|
||||||
@@ -34,6 +49,9 @@ android {
|
|||||||
file("${rootDir}/vtm-android/natives").eachDir() { dir ->
|
file("${rootDir}/vtm-android/natives").eachDir() { dir ->
|
||||||
jniLibs.srcDirs += "${dir.path}/lib"
|
jniLibs.srcDirs += "${dir.path}/lib"
|
||||||
}
|
}
|
||||||
|
file("${rootDir}/vtm-android-gdx/natives").eachDir() { dir ->
|
||||||
|
jniLibs.srcDirs += "${dir.path}/lib"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
debug.setRoot('build-types/debug')
|
debug.setRoot('build-types/debug')
|
||||||
release.setRoot('build-types/release')
|
release.setRoot('build-types/release')
|
||||||
|
|||||||
BIN
vtm-android-example/res/drawable-hdpi/marker_green.png
Normal file
|
After Width: | Height: | Size: 3.2 KiB |
BIN
vtm-android-example/res/drawable-hdpi/marker_red.png
Normal file
|
After Width: | Height: | Size: 3.5 KiB |
BIN
vtm-android-example/res/drawable-mdpi/marker_green.png
Normal file
|
After Width: | Height: | Size: 1.9 KiB |
BIN
vtm-android-example/res/drawable-mdpi/marker_red.png
Normal file
|
After Width: | Height: | Size: 2.1 KiB |
11
vtm-android-example/res/layout/activity_map_fragment.xml
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:orientation="vertical">
|
||||||
|
|
||||||
|
<FrameLayout
|
||||||
|
android:id="@+id/fragment_container"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
11
vtm-android-example/res/layout/fragment_map.xml
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:background="@android:color/white">
|
||||||
|
|
||||||
|
<org.oscim.android.MapView
|
||||||
|
android:id="@+id/mapView"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent" />
|
||||||
|
|
||||||
|
</RelativeLayout>
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
<menu xmlns:android="http://schemas.android.com/apk/res/android">
|
|
||||||
<item
|
|
||||||
android:id="@+id/menu_settings"
|
|
||||||
android:title="@string/menu_settings"
|
|
||||||
android:orderInCategory="100"
|
|
||||||
android:showAsAction="never" />
|
|
||||||
</menu>
|
|
||||||
16
vtm-android-example/res/menu/style_menu.xml
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<menu xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
|
||||||
|
<group
|
||||||
|
android:id="@+id/styles"
|
||||||
|
android:checkableBehavior="single">
|
||||||
|
<item
|
||||||
|
android:id="@+id/style_1"
|
||||||
|
android:checked="true"
|
||||||
|
android:title="@string/style_1" />
|
||||||
|
<item
|
||||||
|
android:id="@+id/style_2"
|
||||||
|
android:title="@string/style_2" />
|
||||||
|
</group>
|
||||||
|
|
||||||
|
</menu>
|
||||||
@@ -7,26 +7,27 @@
|
|||||||
<item
|
<item
|
||||||
android:id="@+id/theme_default"
|
android:id="@+id/theme_default"
|
||||||
android:checked="true"
|
android:checked="true"
|
||||||
android:showAsAction="never"
|
android:title="@string/theme_default" />
|
||||||
android:title="@string/theme_default"></item>
|
|
||||||
<item
|
|
||||||
android:id="@+id/theme_tubes"
|
|
||||||
android:showAsAction="never"
|
|
||||||
android:title="@string/theme_tubes"></item>
|
|
||||||
<item
|
<item
|
||||||
android:id="@+id/theme_osmarender"
|
android:id="@+id/theme_osmarender"
|
||||||
android:showAsAction="never"
|
android:title="@string/theme_osmarender" />
|
||||||
android:title="@string/theme_osmarender"></item>
|
<item
|
||||||
|
android:id="@+id/theme_osmagray"
|
||||||
|
android:title="@string/theme_osmagray" />
|
||||||
|
<item
|
||||||
|
android:id="@+id/theme_tubes"
|
||||||
|
android:title="@string/theme_tubes" />
|
||||||
<item
|
<item
|
||||||
android:id="@+id/theme_newtron"
|
android:id="@+id/theme_newtron"
|
||||||
android:showAsAction="never"
|
android:title="@string/theme_newtron" />
|
||||||
android:title="@string/theme_newtron"></item>
|
<item
|
||||||
|
android:id="@+id/theme_external"
|
||||||
|
android:title="@string/theme_external" />
|
||||||
</group>
|
</group>
|
||||||
|
|
||||||
<item
|
<item
|
||||||
android:id="@+id/gridlayer"
|
android:id="@+id/gridlayer"
|
||||||
android:showAsAction="never"
|
|
||||||
android:checkable="true"
|
android:checkable="true"
|
||||||
android:title="@string/menu_gridlayer"></item>
|
android:title="@string/menu_gridlayer" />
|
||||||
|
|
||||||
</menu>
|
</menu>
|
||||||
|
|||||||
@@ -1,11 +1,12 @@
|
|||||||
<resources>
|
<resources>
|
||||||
|
|
||||||
<string name="app_name">VTM Samples</string>
|
<string name="app_name">VTM Samples</string>
|
||||||
<string name="menu_settings">Settings</string>
|
|
||||||
<string name="theme_default">Default</string>
|
<string name="theme_default">Default</string>
|
||||||
<string name="theme_tubes">Tubes</string>
|
|
||||||
<string name="theme_osmarender">Osmarender</string>
|
<string name="theme_osmarender">Osmarender</string>
|
||||||
|
<string name="theme_osmagray">Osmagray</string>
|
||||||
|
<string name="theme_tubes">Tubes</string>
|
||||||
<string name="theme_newtron">NewTron</string>
|
<string name="theme_newtron">NewTron</string>
|
||||||
|
<string name="theme_external">External theme</string>
|
||||||
<string name="ok">OK</string>
|
<string name="ok">OK</string>
|
||||||
<string name="cancel">Cancel</string>
|
<string name="cancel">Cancel</string>
|
||||||
<string name="error">Error</string>
|
<string name="error">Error</string>
|
||||||
@@ -14,6 +15,9 @@
|
|||||||
<string name="styler_mode_area">Area</string>
|
<string name="styler_mode_area">Area</string>
|
||||||
<string name="styler_mode_outline">Outline</string>
|
<string name="styler_mode_outline">Outline</string>
|
||||||
<string name="styler_controls_toggle">Controls</string>
|
<string name="styler_controls_toggle">Controls</string>
|
||||||
<string name="menu_gridlayer">Gridlayer</string>
|
<string name="style_1">Show nature</string>
|
||||||
|
<string name="style_2">Hide nature</string>
|
||||||
|
<string name="menu_gridlayer">Grid</string>
|
||||||
|
<string name="dialog_reverse_geocoding_title">Reverse Geocoding</string>
|
||||||
|
|
||||||
</resources>
|
</resources>
|
||||||
|
|||||||
@@ -1 +0,0 @@
|
|||||||
root=DEBUG:%logger
|
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2010, 2011, 2012 mapsforge.org
|
* Copyright 2010, 2011, 2012 mapsforge.org
|
||||||
* Copyright 2016 devemux86
|
* Copyright 2016-2017 devemux86
|
||||||
|
* Copyright 2017 Longri
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify it under the
|
* This program is free software: you can redistribute it and/or modify it under the
|
||||||
* terms of the GNU Lesser General Public License as published by the Free Software
|
* terms of the GNU Lesser General Public License as published by the Free Software
|
||||||
@@ -17,10 +18,13 @@ package org.oscim.android.filepicker;
|
|||||||
|
|
||||||
import org.oscim.theme.ExternalRenderTheme;
|
import org.oscim.theme.ExternalRenderTheme;
|
||||||
import org.oscim.theme.ThemeFile;
|
import org.oscim.theme.ThemeFile;
|
||||||
|
import org.oscim.theme.ThemeUtils;
|
||||||
|
import org.oscim.theme.XmlMapsforgeThemeBuilder;
|
||||||
import org.oscim.theme.XmlThemeBuilder;
|
import org.oscim.theme.XmlThemeBuilder;
|
||||||
import org.oscim.tiling.TileSource.OpenResult;
|
import org.oscim.tiling.TileSource.OpenResult;
|
||||||
import org.xml.sax.InputSource;
|
import org.xml.sax.InputSource;
|
||||||
import org.xml.sax.XMLReader;
|
import org.xml.sax.XMLReader;
|
||||||
|
import org.xml.sax.helpers.DefaultHandler;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
|
||||||
@@ -34,9 +38,14 @@ public final class ValidRenderTheme implements ValidFileFilter {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean accept(File file) {
|
public boolean accept(File file) {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
ThemeFile theme = new ExternalRenderTheme(file.getAbsolutePath());
|
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 xmlReader = SAXParserFactory.newInstance().newSAXParser().getXMLReader();
|
||||||
xmlReader.setContentHandler(renderThemeHandler);
|
xmlReader.setContentHandler(renderThemeHandler);
|
||||||
xmlReader.parse(new InputSource(theme.getRenderThemeAsStream()));
|
xmlReader.parse(new InputSource(theme.getRenderThemeAsStream()));
|
||||||
|
|||||||
@@ -0,0 +1,97 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2014 Hannes Janetzek
|
||||||
|
* Copyright 2016-2017 devemux86
|
||||||
|
* Copyright 2017 Longri
|
||||||
|
*
|
||||||
|
* This file is part of the OpenScienceMap project (http://www.opensciencemap.org).
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify it under the
|
||||||
|
* terms of the GNU Lesser General Public License as published by the Free Software
|
||||||
|
* Foundation, either version 3 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||||
|
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||||
|
* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public License along with
|
||||||
|
* this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
package org.oscim.android.test;
|
||||||
|
|
||||||
|
import org.oscim.backend.canvas.Bitmap;
|
||||||
|
import org.oscim.core.GeoPoint;
|
||||||
|
import org.oscim.layers.marker.ItemizedLayer;
|
||||||
|
import org.oscim.layers.marker.MarkerItem;
|
||||||
|
import org.oscim.layers.marker.MarkerSymbol;
|
||||||
|
import org.oscim.layers.marker.MarkerSymbol.HotspotPlace;
|
||||||
|
import org.oscim.layers.tile.buildings.BuildingLayer;
|
||||||
|
import org.oscim.layers.tile.vector.VectorTileLayer;
|
||||||
|
import org.oscim.layers.tile.vector.labeling.LabelLayer;
|
||||||
|
import org.oscim.renderer.atlas.TextureAtlas;
|
||||||
|
import org.oscim.renderer.atlas.TextureRegion;
|
||||||
|
import org.oscim.theme.VtmThemes;
|
||||||
|
import org.oscim.tiling.TileSource;
|
||||||
|
import org.oscim.tiling.source.OkHttpEngine;
|
||||||
|
import org.oscim.tiling.source.oscimap4.OSciMap4TileSource;
|
||||||
|
import org.oscim.utils.TextureAtlasUtils;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.LinkedHashMap;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import static org.oscim.android.canvas.AndroidGraphics.drawableToBitmap;
|
||||||
|
|
||||||
|
public class AtlasMarkerOverlayActivity extends MarkerOverlayActivity {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
void createLayers() {
|
||||||
|
// Map events receiver
|
||||||
|
mMap.layers().add(new MapEventsReceiver(mMap));
|
||||||
|
|
||||||
|
TileSource tileSource = OSciMap4TileSource.builder()
|
||||||
|
.httpFactory(new OkHttpEngine.OkHttpFactory())
|
||||||
|
.build();
|
||||||
|
VectorTileLayer l = mMap.setBaseMap(tileSource);
|
||||||
|
mMap.layers().add(new BuildingLayer(mMap, l));
|
||||||
|
mMap.layers().add(new LabelLayer(mMap, l));
|
||||||
|
mMap.setTheme(VtmThemes.DEFAULT);
|
||||||
|
|
||||||
|
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<>();
|
||||||
|
java.util.Map<Object, TextureRegion> regionsMap = new LinkedHashMap<>();
|
||||||
|
List<TextureAtlas> atlasList = new ArrayList<>();
|
||||||
|
|
||||||
|
inputMap.put("poi", bitmapPoi);
|
||||||
|
inputMap.put("focus", bitmapFocus);
|
||||||
|
|
||||||
|
// Bitmaps will never used any more
|
||||||
|
// With iOS we must flip the Y-Axis
|
||||||
|
TextureAtlasUtils.createTextureRegions(inputMap, regionsMap, atlasList, true, false);
|
||||||
|
|
||||||
|
MarkerSymbol symbol;
|
||||||
|
if (BILLBOARDS)
|
||||||
|
symbol = new MarkerSymbol(regionsMap.get("poi"), HotspotPlace.BOTTOM_CENTER);
|
||||||
|
else
|
||||||
|
symbol = new MarkerSymbol(regionsMap.get("poi"), HotspotPlace.CENTER, false);
|
||||||
|
|
||||||
|
if (BILLBOARDS)
|
||||||
|
mFocusMarker = new MarkerSymbol(regionsMap.get("focus"), HotspotPlace.BOTTOM_CENTER);
|
||||||
|
else
|
||||||
|
mFocusMarker = new MarkerSymbol(regionsMap.get("focus"), HotspotPlace.CENTER, false);
|
||||||
|
|
||||||
|
mMarkerLayer = new ItemizedLayer<>(mMap, new ArrayList<MarkerItem>(), symbol, this);
|
||||||
|
mMap.layers().add(mMarkerLayer);
|
||||||
|
|
||||||
|
List<MarkerItem> pts = new ArrayList<>();
|
||||||
|
|
||||||
|
for (double lat = -90; lat <= 90; lat += 5) {
|
||||||
|
for (double lon = -180; lon <= 180; lon += 5)
|
||||||
|
pts.add(new MarkerItem(lat + "/" + lon, "", new GeoPoint(lat, lon)));
|
||||||
|
}
|
||||||
|
|
||||||
|
mMarkerLayer.addItems(pts);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,120 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2014 Hannes Janetzek
|
||||||
|
* Copyright 2016-2017 devemux86
|
||||||
|
* Copyright 2017 Longri
|
||||||
|
*
|
||||||
|
* This file is part of the OpenScienceMap project (http://www.opensciencemap.org).
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify it under the
|
||||||
|
* terms of the GNU Lesser General Public License as published by the Free Software
|
||||||
|
* Foundation, either version 3 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||||
|
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||||
|
* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public License along with
|
||||||
|
* this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
package org.oscim.android.test;
|
||||||
|
|
||||||
|
import android.widget.Toast;
|
||||||
|
|
||||||
|
import org.oscim.backend.CanvasAdapter;
|
||||||
|
import org.oscim.backend.canvas.Bitmap;
|
||||||
|
import org.oscim.backend.canvas.Canvas;
|
||||||
|
import org.oscim.backend.canvas.Color;
|
||||||
|
import org.oscim.backend.canvas.Paint;
|
||||||
|
import org.oscim.core.GeoPoint;
|
||||||
|
import org.oscim.layers.marker.ItemizedLayer;
|
||||||
|
import org.oscim.layers.marker.MarkerItem;
|
||||||
|
import org.oscim.layers.marker.MarkerSymbol;
|
||||||
|
import org.oscim.layers.marker.MarkerSymbol.HotspotPlace;
|
||||||
|
import org.oscim.layers.tile.buildings.BuildingLayer;
|
||||||
|
import org.oscim.layers.tile.vector.VectorTileLayer;
|
||||||
|
import org.oscim.layers.tile.vector.labeling.LabelLayer;
|
||||||
|
import org.oscim.renderer.atlas.TextureAtlas;
|
||||||
|
import org.oscim.renderer.atlas.TextureRegion;
|
||||||
|
import org.oscim.theme.VtmThemes;
|
||||||
|
import org.oscim.tiling.TileSource;
|
||||||
|
import org.oscim.tiling.source.OkHttpEngine;
|
||||||
|
import org.oscim.tiling.source.oscimap4.OSciMap4TileSource;
|
||||||
|
import org.oscim.utils.TextureAtlasUtils;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.LinkedHashMap;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class AtlasMultiTextureActivity extends MarkerOverlayActivity {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
void createLayers() {
|
||||||
|
// Map events receiver
|
||||||
|
mMap.layers().add(new MapEventsReceiver(mMap));
|
||||||
|
|
||||||
|
TileSource tileSource = OSciMap4TileSource.builder()
|
||||||
|
.httpFactory(new OkHttpEngine.OkHttpFactory())
|
||||||
|
.build();
|
||||||
|
VectorTileLayer l = mMap.setBaseMap(tileSource);
|
||||||
|
mMap.layers().add(new BuildingLayer(mMap, l));
|
||||||
|
mMap.layers().add(new LabelLayer(mMap, l));
|
||||||
|
mMap.setTheme(VtmThemes.DEFAULT);
|
||||||
|
|
||||||
|
// Create Atlas from Bitmaps
|
||||||
|
java.util.Map<Object, Bitmap> inputMap = new LinkedHashMap<>();
|
||||||
|
java.util.Map<Object, TextureRegion> regionsMap = new LinkedHashMap<>();
|
||||||
|
List<TextureAtlas> atlasList = new ArrayList<>();
|
||||||
|
|
||||||
|
float scale = getResources().getDisplayMetrics().density;
|
||||||
|
Canvas canvas = CanvasAdapter.newCanvas();
|
||||||
|
Paint paint = CanvasAdapter.newPaint();
|
||||||
|
paint.setTypeface(Paint.FontFamily.DEFAULT, Paint.FontStyle.NORMAL);
|
||||||
|
paint.setTextSize(12 * scale);
|
||||||
|
paint.setStrokeWidth(2 * scale);
|
||||||
|
paint.setColor(Color.BLACK);
|
||||||
|
List<MarkerItem> pts = new ArrayList<>();
|
||||||
|
for (double lat = -90; lat <= 90; lat += 10) {
|
||||||
|
for (double lon = -180; lon <= 180; lon += 10) {
|
||||||
|
String title = lat + "/" + lon;
|
||||||
|
pts.add(new MarkerItem(title, "", new GeoPoint(lat, lon)));
|
||||||
|
|
||||||
|
Bitmap bmp = CanvasAdapter.newBitmap((int) (40 * scale), (int) (40 * scale), 0);
|
||||||
|
canvas.setBitmap(bmp);
|
||||||
|
canvas.fillColor(Color.GREEN);
|
||||||
|
|
||||||
|
canvas.drawText(Double.toString(lat), 3 * scale, 17 * scale, paint);
|
||||||
|
canvas.drawText(Double.toString(lon), 3 * scale, 35 * scale, paint);
|
||||||
|
inputMap.put(title, bmp);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Bitmaps will never used any more
|
||||||
|
// With iOS we must flip the Y-Axis
|
||||||
|
TextureAtlasUtils.createTextureRegions(inputMap, regionsMap, atlasList, true, false);
|
||||||
|
|
||||||
|
mMarkerLayer = new ItemizedLayer<>(mMap, new ArrayList<MarkerItem>(), (MarkerSymbol) null, this);
|
||||||
|
mMap.layers().add(mMarkerLayer);
|
||||||
|
|
||||||
|
mMarkerLayer.addItems(pts);
|
||||||
|
|
||||||
|
// set all markers
|
||||||
|
for (MarkerItem item : pts) {
|
||||||
|
MarkerSymbol markerSymbol = new MarkerSymbol(regionsMap.get(item.getTitle()), HotspotPlace.BOTTOM_CENTER);
|
||||||
|
item.setMarker(markerSymbol);
|
||||||
|
}
|
||||||
|
|
||||||
|
Toast.makeText(this, "Atlas count: " + atlasList.size(), Toast.LENGTH_SHORT).show();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onItemSingleTapUp(int index, MarkerItem item) {
|
||||||
|
Toast.makeText(this, "Marker tap\n" + item.getTitle(), Toast.LENGTH_SHORT).show();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onItemLongPress(int index, MarkerItem item) {
|
||||||
|
Toast.makeText(this, "Marker long press\n" + item.getTitle(), Toast.LENGTH_SHORT).show();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,30 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2017 Longri
|
||||||
|
* Copyright 2017 devemux86
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify it under the
|
||||||
|
* terms of the GNU Lesser General Public License as published by the Free Software
|
||||||
|
* Foundation, either version 3 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||||
|
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||||
|
* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public License along with
|
||||||
|
* this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
package org.oscim.android.test;
|
||||||
|
|
||||||
|
import android.os.Bundle;
|
||||||
|
|
||||||
|
import org.oscim.utils.Parameters;
|
||||||
|
|
||||||
|
public class AtlasThemeActivity extends SimpleMapActivity {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onCreate(Bundle savedInstanceState) {
|
||||||
|
Parameters.TEXTURE_ATLAS = true;
|
||||||
|
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2013 Hannes Janetzek
|
* Copyright 2013 Hannes Janetzek
|
||||||
|
* Copyright 2016-2017 devemux86
|
||||||
*
|
*
|
||||||
* This file is part of the OpenScienceMap project (http://www.opensciencemap.org).
|
* This file is part of the OpenScienceMap project (http://www.opensciencemap.org).
|
||||||
*
|
*
|
||||||
@@ -26,6 +27,7 @@ import org.oscim.layers.TileGridLayer;
|
|||||||
import org.oscim.layers.tile.vector.VectorTileLayer;
|
import org.oscim.layers.tile.vector.VectorTileLayer;
|
||||||
import org.oscim.theme.VtmThemes;
|
import org.oscim.theme.VtmThemes;
|
||||||
import org.oscim.tiling.TileSource;
|
import org.oscim.tiling.TileSource;
|
||||||
|
import org.oscim.tiling.source.OkHttpEngine;
|
||||||
import org.oscim.tiling.source.oscimap4.OSciMap4TileSource;
|
import org.oscim.tiling.source.oscimap4.OSciMap4TileSource;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
@@ -52,7 +54,9 @@ public class BaseMapActivity extends MapActivity {
|
|||||||
public void onCreate(Bundle savedInstanceState) {
|
public void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
|
|
||||||
mTileSource = new OSciMap4TileSource();
|
mTileSource = OSciMap4TileSource.builder()
|
||||||
|
.httpFactory(new OkHttpEngine.OkHttpFactory())
|
||||||
|
.build();
|
||||||
|
|
||||||
if (USE_CACHE) {
|
if (USE_CACHE) {
|
||||||
mCache = new TileCache(this, null, "tile.db");
|
mCache = new TileCache(this, null, "tile.db");
|
||||||
@@ -85,13 +89,18 @@ public class BaseMapActivity extends MapActivity {
|
|||||||
item.setChecked(true);
|
item.setChecked(true);
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
case R.id.theme_tubes:
|
case R.id.theme_osmarender:
|
||||||
mMap.setTheme(VtmThemes.TRONRENDER);
|
mMap.setTheme(VtmThemes.OSMARENDER);
|
||||||
item.setChecked(true);
|
item.setChecked(true);
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
case R.id.theme_osmarender:
|
case R.id.theme_osmagray:
|
||||||
mMap.setTheme(VtmThemes.OSMARENDER);
|
mMap.setTheme(VtmThemes.OSMAGRAY);
|
||||||
|
item.setChecked(true);
|
||||||
|
return true;
|
||||||
|
|
||||||
|
case R.id.theme_tubes:
|
||||||
|
mMap.setTheme(VtmThemes.TRONRENDER);
|
||||||
item.setChecked(true);
|
item.setChecked(true);
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
@@ -107,7 +116,7 @@ public class BaseMapActivity extends MapActivity {
|
|||||||
} else {
|
} else {
|
||||||
item.setChecked(true);
|
item.setChecked(true);
|
||||||
if (mGridLayer == null)
|
if (mGridLayer == null)
|
||||||
mGridLayer = new TileGridLayer(mMap);
|
mGridLayer = new TileGridLayer(mMap, getResources().getDisplayMetrics().density);
|
||||||
|
|
||||||
mMap.layers().add(mGridLayer);
|
mMap.layers().add(mGridLayer);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2014 Hannes Janetzek
|
* Copyright 2014 Hannes Janetzek
|
||||||
|
* Copyright 2017 devemux86
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify it under the
|
* This program is free software: you can redistribute it and/or modify it under the
|
||||||
* terms of the GNU Lesser General Public License as published by the Free Software
|
* terms of the GNU Lesser General Public License as published by the Free Software
|
||||||
@@ -17,10 +18,8 @@ package org.oscim.android.test;
|
|||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
|
||||||
import org.oscim.android.cache.TileCache;
|
import org.oscim.android.cache.TileCache;
|
||||||
import org.oscim.backend.canvas.Color;
|
|
||||||
import org.oscim.core.MapPosition;
|
import org.oscim.core.MapPosition;
|
||||||
import org.oscim.core.MercatorProjection;
|
import org.oscim.core.MercatorProjection;
|
||||||
import org.oscim.layers.TileGridLayer;
|
|
||||||
import org.oscim.layers.tile.bitmap.BitmapTileLayer;
|
import org.oscim.layers.tile.bitmap.BitmapTileLayer;
|
||||||
import org.oscim.renderer.MapRenderer;
|
import org.oscim.renderer.MapRenderer;
|
||||||
import org.oscim.tiling.source.bitmap.BitmapTileSource;
|
import org.oscim.tiling.source.bitmap.BitmapTileSource;
|
||||||
@@ -53,7 +52,6 @@ public class BitmapTileMapActivity extends MapActivity {
|
|||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
|
|
||||||
MapRenderer.setBackgroundColor(0xff777777);
|
MapRenderer.setBackgroundColor(0xff777777);
|
||||||
mMap.layers().add(new TileGridLayer(mMap, Color.GRAY, 1.8f, 8));
|
|
||||||
|
|
||||||
if (mTileSource == null)
|
if (mTileSource == null)
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -0,0 +1,107 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2016-2017 devemux86
|
||||||
|
* Copyright 2017 nebular
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify it under the
|
||||||
|
* terms of the GNU Lesser General Public License as published by the Free Software
|
||||||
|
* Foundation, either version 3 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||||
|
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||||
|
* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public License along with
|
||||||
|
* this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
package org.oscim.android.test;
|
||||||
|
|
||||||
|
import org.oscim.backend.canvas.Bitmap;
|
||||||
|
import org.oscim.backend.canvas.Color;
|
||||||
|
import org.oscim.core.GeoPoint;
|
||||||
|
import org.oscim.layers.marker.ClusterMarkerRenderer;
|
||||||
|
import org.oscim.layers.marker.ItemizedLayer;
|
||||||
|
import org.oscim.layers.marker.MarkerItem;
|
||||||
|
import org.oscim.layers.marker.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;
|
||||||
|
import org.oscim.layers.tile.vector.labeling.LabelLayer;
|
||||||
|
import org.oscim.theme.VtmThemes;
|
||||||
|
import org.oscim.tiling.TileSource;
|
||||||
|
import org.oscim.tiling.source.OkHttpEngine;
|
||||||
|
import org.oscim.tiling.source.oscimap4.OSciMap4TileSource;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import static org.oscim.android.canvas.AndroidGraphics.drawableToBitmap;
|
||||||
|
|
||||||
|
public class ClusterMarkerOverlayActivity extends MarkerOverlayActivity {
|
||||||
|
|
||||||
|
private static final int COUNT = 5;
|
||||||
|
private static final float STEP = 100f / 110000f; // roughly 100 meters
|
||||||
|
|
||||||
|
@Override
|
||||||
|
void createLayers() {
|
||||||
|
// Map events receiver
|
||||||
|
mMap.layers().add(new MapEventsReceiver(mMap));
|
||||||
|
|
||||||
|
TileSource tileSource = OSciMap4TileSource.builder()
|
||||||
|
.httpFactory(new OkHttpEngine.OkHttpFactory())
|
||||||
|
.build();
|
||||||
|
VectorTileLayer l = mMap.setBaseMap(tileSource);
|
||||||
|
mMap.layers().add(new BuildingLayer(mMap, l));
|
||||||
|
mMap.layers().add(new LabelLayer(mMap, l));
|
||||||
|
mMap.setTheme(VtmThemes.DEFAULT);
|
||||||
|
|
||||||
|
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>(),
|
||||||
|
markerRendererFactory,
|
||||||
|
this);
|
||||||
|
mMap.layers().add(mMarkerLayer);
|
||||||
|
|
||||||
|
// Create some markers spaced STEP degrees
|
||||||
|
List<MarkerItem> pts = new ArrayList<>();
|
||||||
|
GeoPoint center = mMap.getMapPosition().getGeoPoint();
|
||||||
|
for (int x = -COUNT; x < COUNT; x++) {
|
||||||
|
for (int y = -COUNT; y < COUNT; y++) {
|
||||||
|
double random = STEP * Math.random() * 2;
|
||||||
|
MarkerItem item = new MarkerItem(y + ", " + x, "",
|
||||||
|
new GeoPoint(center.getLatitude() + y * STEP + random, center.getLongitude() + x * STEP + random)
|
||||||
|
);
|
||||||
|
pts.add(item);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
mMarkerLayer.addItems(pts);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onResume() {
|
||||||
|
super.onResume();
|
||||||
|
|
||||||
|
/* ignore saved position */
|
||||||
|
mMap.setMapPosition(53.08, 8.83, 1 << 15);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2013 Hannes Janetzek
|
* Copyright 2013 Hannes Janetzek
|
||||||
* Copyright 2016 devemux86
|
* Copyright 2016-2017 devemux86
|
||||||
*
|
*
|
||||||
* This file is part of the OpenScienceMap project (http://www.opensciencemap.org).
|
* This file is part of the OpenScienceMap project (http://www.opensciencemap.org).
|
||||||
*
|
*
|
||||||
@@ -15,7 +15,7 @@
|
|||||||
* You should have received a copy of the GNU Lesser General Public License along with
|
* You should have received a copy of the GNU Lesser General Public License along with
|
||||||
* this program. If not, see <http://www.gnu.org/licenses/>.
|
* this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
package org.oscim.gdx;
|
package org.oscim.android.test;
|
||||||
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.util.DisplayMetrics;
|
import android.util.DisplayMetrics;
|
||||||
@@ -28,10 +28,14 @@ import org.oscim.android.canvas.AndroidGraphics;
|
|||||||
import org.oscim.backend.CanvasAdapter;
|
import org.oscim.backend.CanvasAdapter;
|
||||||
import org.oscim.backend.GLAdapter;
|
import org.oscim.backend.GLAdapter;
|
||||||
import org.oscim.core.Tile;
|
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.TileSource;
|
||||||
|
import org.oscim.tiling.source.OkHttpEngine;
|
||||||
import org.oscim.tiling.source.oscimap4.OSciMap4TileSource;
|
import org.oscim.tiling.source.oscimap4.OSciMap4TileSource;
|
||||||
|
|
||||||
public class MainActivity extends AndroidApplication {
|
public class GdxMapActivity extends AndroidApplication {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onCreate(Bundle savedInstanceState) {
|
public void onCreate(Bundle savedInstanceState) {
|
||||||
@@ -42,8 +46,8 @@ public class MainActivity extends AndroidApplication {
|
|||||||
GLAdapter.init(new AndroidGL());
|
GLAdapter.init(new AndroidGL());
|
||||||
|
|
||||||
DisplayMetrics metrics = getResources().getDisplayMetrics();
|
DisplayMetrics metrics = getResources().getDisplayMetrics();
|
||||||
CanvasAdapter.dpi = (int) Math.max(metrics.xdpi, metrics.ydpi);
|
CanvasAdapter.dpi = (int) (metrics.scaledDensity * CanvasAdapter.DEFAULT_DPI);
|
||||||
Tile.SIZE = Tile.calculateTileSize(metrics.scaledDensity);
|
Tile.SIZE = Tile.calculateTileSize();
|
||||||
|
|
||||||
AndroidApplicationConfiguration cfg = new AndroidApplicationConfiguration();
|
AndroidApplicationConfiguration cfg = new AndroidApplicationConfiguration();
|
||||||
cfg.stencil = 8;
|
cfg.stencil = 8;
|
||||||
@@ -57,8 +61,10 @@ public class MainActivity extends AndroidApplication {
|
|||||||
class GdxMapAndroid extends GdxMap {
|
class GdxMapAndroid extends GdxMap {
|
||||||
@Override
|
@Override
|
||||||
public void createLayers() {
|
public void createLayers() {
|
||||||
TileSource ts = new OSciMap4TileSource();
|
TileSource ts = OSciMap4TileSource.builder()
|
||||||
initDefaultLayers(ts, true, true, true);
|
.httpFactory(new OkHttpEngine.OkHttpFactory())
|
||||||
|
.build();
|
||||||
|
initDefaultLayers(ts, true, true, true, getResources().getDisplayMetrics().density);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2016 devemux86
|
* Copyright 2014 Hannes Janetzek
|
||||||
|
* Copyright 2016-2017 devemux86
|
||||||
*
|
*
|
||||||
* This file is part of the OpenScienceMap project (http://www.opensciencemap.org).
|
* This file is part of the OpenScienceMap project (http://www.opensciencemap.org).
|
||||||
*
|
*
|
||||||
@@ -24,11 +25,13 @@ import android.widget.ToggleButton;
|
|||||||
|
|
||||||
import org.jeo.map.Style;
|
import org.jeo.map.Style;
|
||||||
import org.jeo.vector.VectorDataset;
|
import org.jeo.vector.VectorDataset;
|
||||||
|
import org.oscim.backend.canvas.Color;
|
||||||
import org.oscim.layers.OSMIndoorLayer;
|
import org.oscim.layers.OSMIndoorLayer;
|
||||||
import org.oscim.layers.tile.buildings.BuildingLayer;
|
import org.oscim.layers.tile.buildings.BuildingLayer;
|
||||||
import org.oscim.layers.tile.vector.labeling.LabelLayer;
|
import org.oscim.layers.tile.vector.labeling.LabelLayer;
|
||||||
import org.oscim.test.JeoTest;
|
import org.oscim.test.JeoTest;
|
||||||
import org.oscim.theme.VtmThemes;
|
import org.oscim.theme.VtmThemes;
|
||||||
|
import org.oscim.theme.styles.TextStyle;
|
||||||
import org.oscim.utils.IOUtils;
|
import org.oscim.utils.IOUtils;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
@@ -43,8 +46,7 @@ public class JeoIndoorMapActivity extends BaseMapActivity {
|
|||||||
public static final Logger log = LoggerFactory.getLogger(JeoIndoorMapActivity.class);
|
public static final Logger log = LoggerFactory.getLogger(JeoIndoorMapActivity.class);
|
||||||
|
|
||||||
// from http://overpass-turbo.eu/s/2vp
|
// from http://overpass-turbo.eu/s/2vp
|
||||||
String PATH = "https://gist.github.com/anonymous/8960337/raw/overpass.geojson";
|
String PATH = "https://gist.githubusercontent.com/anonymous/09062103a66844a96048f25626078c8d/raw/1d3af6a5a55e9ea4adc9551fa633a051a44a5a9c/overpass.geojson";
|
||||||
//String PATH = "https://gist.github.com/hjanetzek/9280925/raw/overpass.geojson";
|
|
||||||
|
|
||||||
private OSMIndoorLayer mIndoorLayer;
|
private OSMIndoorLayer mIndoorLayer;
|
||||||
|
|
||||||
@@ -83,7 +85,6 @@ public class JeoIndoorMapActivity extends BaseMapActivity {
|
|||||||
mMap.layers().add(new BuildingLayer(mMap, mBaseLayer));
|
mMap.layers().add(new BuildingLayer(mMap, mBaseLayer));
|
||||||
mMap.layers().add(new LabelLayer(mMap, mBaseLayer));
|
mMap.layers().add(new LabelLayer(mMap, mBaseLayer));
|
||||||
|
|
||||||
// mMap.layers().add(new TileGridLayer(mMap));
|
|
||||||
// String file = Environment.getExternalStorageDirectory().getAbsolutePath();
|
// String file = Environment.getExternalStorageDirectory().getAbsolutePath();
|
||||||
// VectorDataset data = (VectorDataset) JeoTest.getJsonData(file + "/states.json", true);
|
// VectorDataset data = (VectorDataset) JeoTest.getJsonData(file + "/states.json", true);
|
||||||
// Style style = JeoTest.getStyle();
|
// Style style = JeoTest.getStyle();
|
||||||
@@ -95,7 +96,13 @@ public class JeoIndoorMapActivity extends BaseMapActivity {
|
|||||||
|
|
||||||
VectorDataset data = JeoTest.readGeoJson(is);
|
VectorDataset data = JeoTest.readGeoJson(is);
|
||||||
Style style = JeoTest.getStyle();
|
Style style = JeoTest.getStyle();
|
||||||
mIndoorLayer = new OSMIndoorLayer(mMap, data, style);
|
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);
|
mMap.layers().add(mIndoorLayer);
|
||||||
|
|
||||||
showToast("data ready");
|
showToast("data ready");
|
||||||
@@ -157,7 +164,8 @@ public class JeoIndoorMapActivity extends BaseMapActivity {
|
|||||||
i = 0;
|
i = 0;
|
||||||
|
|
||||||
mIndoorLayer.activeLevels[i] ^= true;
|
mIndoorLayer.activeLevels[i] ^= true;
|
||||||
((ToggleButton) v).setChecked(mIndoorLayer.activeLevels[i]);
|
if (v instanceof ToggleButton)
|
||||||
|
((ToggleButton) v).setChecked(mIndoorLayer.activeLevels[i]);
|
||||||
log.debug(Arrays.toString(mIndoorLayer.activeLevels));
|
log.debug(Arrays.toString(mIndoorLayer.activeLevels));
|
||||||
mIndoorLayer.update();
|
mIndoorLayer.update();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2013 Hannes Janetzek
|
* Copyright 2013 Hannes Janetzek
|
||||||
* Copyright 2016 devemux86
|
* Copyright 2016-2017 devemux86
|
||||||
* Copyright 2016 Andrey Novikov
|
* Copyright 2016 Andrey Novikov
|
||||||
*
|
*
|
||||||
* This file is part of the OpenScienceMap project (http://www.opensciencemap.org).
|
* This file is part of the OpenScienceMap project (http://www.opensciencemap.org).
|
||||||
@@ -20,7 +20,6 @@ package org.oscim.android.test;
|
|||||||
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
|
||||||
import org.oscim.backend.CanvasAdapter;
|
|
||||||
import org.oscim.layers.tile.buildings.BuildingLayer;
|
import org.oscim.layers.tile.buildings.BuildingLayer;
|
||||||
import org.oscim.layers.tile.vector.labeling.LabelLayer;
|
import org.oscim.layers.tile.vector.labeling.LabelLayer;
|
||||||
import org.oscim.map.Layers;
|
import org.oscim.map.Layers;
|
||||||
@@ -53,7 +52,7 @@ public class LayerGroupActivity extends BaseMapActivity {
|
|||||||
layers.addGroup(GROUP_LABELS);
|
layers.addGroup(GROUP_LABELS);
|
||||||
layers.add(new LabelLayer(mMap, mBaseLayer), GROUP_LABELS);
|
layers.add(new LabelLayer(mMap, mBaseLayer), GROUP_LABELS);
|
||||||
|
|
||||||
mapScaleBar = new DefaultMapScaleBar(mMap, CanvasAdapter.dpi / 160);
|
mapScaleBar = new DefaultMapScaleBar(mMap);
|
||||||
mapScaleBar.setScaleBarMode(DefaultMapScaleBar.ScaleBarMode.BOTH);
|
mapScaleBar.setScaleBarMode(DefaultMapScaleBar.ScaleBarMode.BOTH);
|
||||||
mapScaleBar.setDistanceUnitAdapter(MetricUnitAdapter.INSTANCE);
|
mapScaleBar.setDistanceUnitAdapter(MetricUnitAdapter.INSTANCE);
|
||||||
mapScaleBar.setSecondaryDistanceUnitAdapter(ImperialUnitAdapter.INSTANCE);
|
mapScaleBar.setSecondaryDistanceUnitAdapter(ImperialUnitAdapter.INSTANCE);
|
||||||
@@ -62,7 +61,7 @@ public class LayerGroupActivity extends BaseMapActivity {
|
|||||||
MapScaleBarLayer mapScaleBarLayer = new MapScaleBarLayer(mMap, mapScaleBar);
|
MapScaleBarLayer mapScaleBarLayer = new MapScaleBarLayer(mMap, mapScaleBar);
|
||||||
BitmapRenderer renderer = mapScaleBarLayer.getRenderer();
|
BitmapRenderer renderer = mapScaleBarLayer.getRenderer();
|
||||||
renderer.setPosition(GLViewport.Position.BOTTOM_LEFT);
|
renderer.setPosition(GLViewport.Position.BOTTOM_LEFT);
|
||||||
renderer.setOffset(5 * CanvasAdapter.dpi / 160, 0);
|
renderer.setOffset(5 * getResources().getDisplayMetrics().density, 0);
|
||||||
|
|
||||||
layers.addGroup(GROUP_OVERLAYS);
|
layers.addGroup(GROUP_OVERLAYS);
|
||||||
layers.add(mapScaleBarLayer, GROUP_OVERLAYS);
|
layers.add(mapScaleBarLayer, GROUP_OVERLAYS);
|
||||||
@@ -72,7 +71,8 @@ public class LayerGroupActivity extends BaseMapActivity {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onDestroy() {
|
protected void onDestroy() {
|
||||||
mapScaleBar.destroy();
|
if (mapScaleBar != null)
|
||||||
|
mapScaleBar.destroy();
|
||||||
|
|
||||||
super.onDestroy();
|
super.onDestroy();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2014 Hannes Janetzek
|
* Copyright 2014 Hannes Janetzek
|
||||||
* Copyright 2016 devemux86
|
* Copyright 2016-2017 devemux86
|
||||||
*
|
*
|
||||||
* This file is part of the OpenScienceMap project (http://www.opensciencemap.org).
|
* This file is part of the OpenScienceMap project (http://www.opensciencemap.org).
|
||||||
*
|
*
|
||||||
@@ -28,32 +28,31 @@ import org.oscim.layers.vector.geometries.Style;
|
|||||||
import org.oscim.map.Map;
|
import org.oscim.map.Map;
|
||||||
import org.oscim.renderer.bucket.TextureItem;
|
import org.oscim.renderer.bucket.TextureItem;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import static org.oscim.tiling.source.bitmap.DefaultSources.STAMEN_TONER;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This is a very INEFFICIENT and somewhat less useful example for how to use
|
* This is a very INEFFICIENT and somewhat less useful example for how to use
|
||||||
* PathLayers!
|
* PathLayers!
|
||||||
*/
|
*/
|
||||||
public class LineTexActivity extends BitmapTileMapActivity {
|
public class LineTexActivity extends SimpleMapActivity {
|
||||||
|
|
||||||
private static final boolean ANIMATION = false;
|
private static final boolean ANIMATION = false;
|
||||||
|
|
||||||
private List<PathLayer> mPathLayers = new ArrayList<>();
|
private List<PathLayer> mPathLayers = new ArrayList<>();
|
||||||
|
|
||||||
public LineTexActivity() {
|
|
||||||
super(STAMEN_TONER.build());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onCreate(Bundle savedInstanceState) {
|
public void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
mBitmapLayer.tileRenderer().setBitmapAlpha(0.5f);
|
|
||||||
|
|
||||||
TextureItem tex = new TextureItem(CanvasAdapter.getBitmapAsset("", "patterns/pike.png"));
|
TextureItem tex = null;
|
||||||
tex.mipmap = true;
|
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) {
|
for (double lat = -90; lat <= 90; lat += 5) {
|
||||||
int c = Color.fade(Color.rainbow((float) (lat + 90) / 180), 0.5f);
|
int c = Color.fade(Color.rainbow((float) (lat + 90) / 180), 0.5f);
|
||||||
|
|||||||
@@ -0,0 +1,91 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2016-2017 devemux86
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify it under the
|
||||||
|
* terms of the GNU Lesser General Public License as published by the Free Software
|
||||||
|
* Foundation, either version 3 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||||
|
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||||
|
* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public License along with
|
||||||
|
* this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
package org.oscim.android.test;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import android.location.Location;
|
||||||
|
import android.location.LocationListener;
|
||||||
|
import android.location.LocationManager;
|
||||||
|
import android.os.Bundle;
|
||||||
|
|
||||||
|
import org.oscim.core.MapPosition;
|
||||||
|
import org.oscim.layers.LocationLayer;
|
||||||
|
import org.oscim.renderer.LocationRenderer;
|
||||||
|
|
||||||
|
public class LocationActivity extends SimpleMapActivity implements LocationListener {
|
||||||
|
private LocationLayer locationLayer;
|
||||||
|
private LocationManager locationManager;
|
||||||
|
private final MapPosition mapPosition = new MapPosition();
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onCreate(Bundle savedInstanceState) {
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
|
||||||
|
locationManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
|
||||||
|
|
||||||
|
locationLayer = new LocationLayer(mMap);
|
||||||
|
locationLayer.locationRenderer.setShader("location_1_reverse");
|
||||||
|
locationLayer.setEnabled(false);
|
||||||
|
mMap.layers().add(locationLayer);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onResume() {
|
||||||
|
super.onResume();
|
||||||
|
|
||||||
|
enableAvailableProviders();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onPause() {
|
||||||
|
super.onPause();
|
||||||
|
|
||||||
|
locationManager.removeUpdates(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onLocationChanged(Location location) {
|
||||||
|
locationLayer.setEnabled(true);
|
||||||
|
locationLayer.setPosition(location.getLatitude(), location.getLongitude(), location.getAccuracy());
|
||||||
|
|
||||||
|
// Follow location
|
||||||
|
mMap.getMapPosition(mapPosition);
|
||||||
|
mapPosition.setPosition(location.getLatitude(), location.getLongitude());
|
||||||
|
mMap.setMapPosition(mapPosition);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onProviderDisabled(String provider) {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onProviderEnabled(String provider) {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onStatusChanged(String provider, int status, Bundle extras) {
|
||||||
|
}
|
||||||
|
|
||||||
|
private void enableAvailableProviders() {
|
||||||
|
locationManager.removeUpdates(this);
|
||||||
|
|
||||||
|
for (String provider : locationManager.getProviders(true)) {
|
||||||
|
if (LocationManager.GPS_PROVIDER.equals(provider)
|
||||||
|
|| LocationManager.NETWORK_PROVIDER.equals(provider)) {
|
||||||
|
locationManager.requestLocationUpdates(provider, 0, 0, this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2016 devemux86
|
* Copyright 2016-2017 devemux86
|
||||||
*
|
*
|
||||||
* This file is part of the OpenScienceMap project (http://www.opensciencemap.org).
|
* This file is part of the OpenScienceMap project (http://www.opensciencemap.org).
|
||||||
*
|
*
|
||||||
@@ -21,7 +21,6 @@ import android.os.Bundle;
|
|||||||
|
|
||||||
import org.oscim.android.MapPreferences;
|
import org.oscim.android.MapPreferences;
|
||||||
import org.oscim.android.MapView;
|
import org.oscim.android.MapView;
|
||||||
import org.oscim.core.Tile;
|
|
||||||
import org.oscim.map.Map;
|
import org.oscim.map.Map;
|
||||||
|
|
||||||
public class MapActivity extends Activity {
|
public class MapActivity extends Activity {
|
||||||
@@ -41,7 +40,6 @@ public class MapActivity extends Activity {
|
|||||||
|
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
Tile.SIZE = Tile.calculateTileSize(getResources().getDisplayMetrics().scaledDensity);
|
|
||||||
setContentView(mContentView);
|
setContentView(mContentView);
|
||||||
|
|
||||||
setTitle(getClass().getSimpleName());
|
setTitle(getClass().getSimpleName());
|
||||||
@@ -61,9 +59,16 @@ public class MapActivity extends Activity {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onPause() {
|
protected void onPause() {
|
||||||
super.onPause();
|
|
||||||
|
|
||||||
mMapView.onPause();
|
|
||||||
mPrefs.save(mMapView.map());
|
mPrefs.save(mMapView.map());
|
||||||
|
mMapView.onPause();
|
||||||
|
|
||||||
|
super.onPause();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onDestroy() {
|
||||||
|
mMapView.onDestroy();
|
||||||
|
|
||||||
|
super.onDestroy();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2014 Hannes Janetzek
|
* Copyright 2014 Hannes Janetzek
|
||||||
* Copyright 2016 devemux86
|
* Copyright 2016-2017 devemux86
|
||||||
|
* Copyright 2017 Longri
|
||||||
*
|
*
|
||||||
* This file is part of the OpenScienceMap project (http://www.opensciencemap.org).
|
* This file is part of the OpenScienceMap project (http://www.opensciencemap.org).
|
||||||
*
|
*
|
||||||
@@ -25,20 +26,46 @@ import android.view.MenuItem;
|
|||||||
import org.oscim.android.filepicker.FilePicker;
|
import org.oscim.android.filepicker.FilePicker;
|
||||||
import org.oscim.android.filepicker.FilterByFileExtension;
|
import org.oscim.android.filepicker.FilterByFileExtension;
|
||||||
import org.oscim.android.filepicker.ValidMapFile;
|
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.MapPosition;
|
||||||
|
import org.oscim.core.Tag;
|
||||||
import org.oscim.core.Tile;
|
import org.oscim.core.Tile;
|
||||||
import org.oscim.layers.TileGridLayer;
|
import org.oscim.layers.TileGridLayer;
|
||||||
|
import org.oscim.layers.tile.MapTile;
|
||||||
import org.oscim.layers.tile.buildings.BuildingLayer;
|
import org.oscim.layers.tile.buildings.BuildingLayer;
|
||||||
import org.oscim.layers.tile.vector.VectorTileLayer;
|
import org.oscim.layers.tile.vector.VectorTileLayer;
|
||||||
import org.oscim.layers.tile.vector.labeling.LabelLayer;
|
import org.oscim.layers.tile.vector.labeling.LabelLayer;
|
||||||
|
import org.oscim.renderer.BitmapRenderer;
|
||||||
|
import org.oscim.renderer.GLViewport;
|
||||||
|
import org.oscim.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.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.MapFileTileSource;
|
||||||
import org.oscim.tiling.source.mapfile.MapInfo;
|
import org.oscim.tiling.source.mapfile.MapInfo;
|
||||||
|
|
||||||
public class MapsforgeMapActivity extends MapActivity {
|
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 TileGridLayer mGridLayer;
|
||||||
|
private DefaultMapScaleBar mMapScaleBar;
|
||||||
|
private Menu mMenu;
|
||||||
|
private VectorTileLayer mTileLayer;
|
||||||
|
MapFileTileSource mTileSource;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
@@ -48,6 +75,14 @@ public class MapsforgeMapActivity extends MapActivity {
|
|||||||
SELECT_MAP_FILE);
|
SELECT_MAP_FILE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onDestroy() {
|
||||||
|
if (mMapScaleBar != null)
|
||||||
|
mMapScaleBar.destroy();
|
||||||
|
|
||||||
|
super.onDestroy();
|
||||||
|
}
|
||||||
|
|
||||||
public static class MapFilePicker extends FilePicker {
|
public static class MapFilePicker extends FilePicker {
|
||||||
public MapFilePicker() {
|
public MapFilePicker() {
|
||||||
setFileDisplayFilter(new FilterByFileExtension(".map"));
|
setFileDisplayFilter(new FilterByFileExtension(".map"));
|
||||||
@@ -55,9 +90,17 @@ public class MapsforgeMapActivity extends MapActivity {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static class ThemeFilePicker extends FilePicker {
|
||||||
|
public ThemeFilePicker() {
|
||||||
|
setFileDisplayFilter(new FilterByFileExtension(".xml"));
|
||||||
|
setFileSelectFilter(new ValidRenderTheme());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onCreateOptionsMenu(Menu menu) {
|
public boolean onCreateOptionsMenu(Menu menu) {
|
||||||
getMenuInflater().inflate(R.menu.theme_menu, menu);
|
getMenuInflater().inflate(R.menu.theme_menu, menu);
|
||||||
|
mMenu = menu;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -70,13 +113,18 @@ public class MapsforgeMapActivity extends MapActivity {
|
|||||||
item.setChecked(true);
|
item.setChecked(true);
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
case R.id.theme_tubes:
|
case R.id.theme_osmarender:
|
||||||
mMap.setTheme(VtmThemes.TRONRENDER);
|
mMap.setTheme(VtmThemes.OSMARENDER);
|
||||||
item.setChecked(true);
|
item.setChecked(true);
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
case R.id.theme_osmarender:
|
case R.id.theme_osmagray:
|
||||||
mMap.setTheme(VtmThemes.OSMARENDER);
|
mMap.setTheme(VtmThemes.OSMAGRAY);
|
||||||
|
item.setChecked(true);
|
||||||
|
return true;
|
||||||
|
|
||||||
|
case R.id.theme_tubes:
|
||||||
|
mMap.setTheme(VtmThemes.TRONRENDER);
|
||||||
item.setChecked(true);
|
item.setChecked(true);
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
@@ -85,6 +133,11 @@ public class MapsforgeMapActivity extends MapActivity {
|
|||||||
item.setChecked(true);
|
item.setChecked(true);
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
case R.id.theme_external:
|
||||||
|
startActivityForResult(new Intent(this, ThemeFilePicker.class),
|
||||||
|
SELECT_THEME_FILE);
|
||||||
|
return true;
|
||||||
|
|
||||||
case R.id.gridlayer:
|
case R.id.gridlayer:
|
||||||
if (item.isChecked()) {
|
if (item.isChecked()) {
|
||||||
item.setChecked(false);
|
item.setChecked(false);
|
||||||
@@ -92,7 +145,7 @@ public class MapsforgeMapActivity extends MapActivity {
|
|||||||
} else {
|
} else {
|
||||||
item.setChecked(true);
|
item.setChecked(true);
|
||||||
if (mGridLayer == null)
|
if (mGridLayer == null)
|
||||||
mGridLayer = new TileGridLayer(mMap);
|
mGridLayer = new TileGridLayer(mMap, getResources().getDisplayMetrics().density);
|
||||||
|
|
||||||
mMap.layers().add(mGridLayer);
|
mMap.layers().add(mGridLayer);
|
||||||
}
|
}
|
||||||
@@ -112,24 +165,68 @@ public class MapsforgeMapActivity extends MapActivity {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
MapFileTileSource tileSource = new MapFileTileSource();
|
mTileSource = new MapFileTileSource();
|
||||||
tileSource.setPreferredLanguage("en");
|
//mTileSource.setPreferredLanguage("en");
|
||||||
String file = intent.getStringExtra(FilePicker.SELECTED_FILE);
|
String file = intent.getStringExtra(FilePicker.SELECTED_FILE);
|
||||||
if (tileSource.setMapFile(file)) {
|
if (mTileSource.setMapFile(file)) {
|
||||||
|
|
||||||
VectorTileLayer l = mMap.setBaseMap(tileSource);
|
mTileLayer = mMap.setBaseMap(mTileSource);
|
||||||
mMap.setTheme(VtmThemes.DEFAULT);
|
loadTheme(null);
|
||||||
|
|
||||||
mMap.layers().add(new BuildingLayer(mMap, l));
|
mMap.layers().add(new BuildingLayer(mMap, mTileLayer));
|
||||||
mMap.layers().add(new LabelLayer(mMap, l));
|
mMap.layers().add(new LabelLayer(mMap, mTileLayer));
|
||||||
|
|
||||||
MapInfo info = tileSource.getMapInfo();
|
mMapScaleBar = new DefaultMapScaleBar(mMap);
|
||||||
|
mMapScaleBar.setScaleBarMode(DefaultMapScaleBar.ScaleBarMode.BOTH);
|
||||||
|
mMapScaleBar.setDistanceUnitAdapter(MetricUnitAdapter.INSTANCE);
|
||||||
|
mMapScaleBar.setSecondaryDistanceUnitAdapter(ImperialUnitAdapter.INSTANCE);
|
||||||
|
mMapScaleBar.setScaleBarPosition(MapScaleBar.ScaleBarPosition.BOTTOM_LEFT);
|
||||||
|
|
||||||
|
MapScaleBarLayer mapScaleBarLayer = new MapScaleBarLayer(mMap, mMapScaleBar);
|
||||||
|
BitmapRenderer renderer = mapScaleBarLayer.getRenderer();
|
||||||
|
renderer.setPosition(GLViewport.Position.BOTTOM_LEFT);
|
||||||
|
renderer.setOffset(5 * getResources().getDisplayMetrics().density, 0);
|
||||||
|
mMap.layers().add(mapScaleBarLayer);
|
||||||
|
|
||||||
|
MapInfo info = mTileSource.getMapInfo();
|
||||||
MapPosition pos = new MapPosition();
|
MapPosition pos = new MapPosition();
|
||||||
pos.setByBoundingBox(info.boundingBox, Tile.SIZE * 4, Tile.SIZE * 4);
|
pos.setByBoundingBox(info.boundingBox, Tile.SIZE * 4, Tile.SIZE * 4);
|
||||||
mMap.setMapPosition(pos);
|
mMap.setMapPosition(pos);
|
||||||
|
|
||||||
mPrefs.clear();
|
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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected void loadTheme(final String styleId) {
|
||||||
|
mMap.setTheme(VtmThemes.DEFAULT);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,89 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2016-2017 devemux86
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify it under the
|
||||||
|
* terms of the GNU Lesser General Public License as published by the Free Software
|
||||||
|
* Foundation, either version 3 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||||
|
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||||
|
* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public License along with
|
||||||
|
* this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
package org.oscim.android.test;
|
||||||
|
|
||||||
|
import android.view.Menu;
|
||||||
|
import android.view.MenuItem;
|
||||||
|
import android.widget.Toast;
|
||||||
|
|
||||||
|
import org.oscim.android.theme.AssetsRenderTheme;
|
||||||
|
import org.oscim.theme.XmlRenderThemeMenuCallback;
|
||||||
|
import org.oscim.theme.XmlRenderThemeStyleLayer;
|
||||||
|
import org.oscim.theme.XmlRenderThemeStyleMenu;
|
||||||
|
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Load render theme from Android assets folder and show a configuration menu based on stylemenu.
|
||||||
|
*/
|
||||||
|
public class MapsforgeStyleActivity extends MapsforgeMapActivity {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onCreateOptionsMenu(Menu menu) {
|
||||||
|
getMenuInflater().inflate(R.menu.style_menu, menu);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onOptionsItemSelected(MenuItem item) {
|
||||||
|
switch (item.getItemId()) {
|
||||||
|
case R.id.style_1:
|
||||||
|
item.setChecked(true);
|
||||||
|
loadTheme("1");
|
||||||
|
mMap.clearMap();
|
||||||
|
Toast.makeText(this, "Show nature layers", Toast.LENGTH_SHORT).show();
|
||||||
|
return true;
|
||||||
|
case R.id.style_2:
|
||||||
|
item.setChecked(true);
|
||||||
|
loadTheme("2");
|
||||||
|
mMap.clearMap();
|
||||||
|
Toast.makeText(this, "Hide nature layers", Toast.LENGTH_SHORT).show();
|
||||||
|
return true;
|
||||||
|
default:
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void loadTheme(final String styleId) {
|
||||||
|
mMap.setTheme(new AssetsRenderTheme(getAssets(), "", "vtm/stylemenu.xml", new XmlRenderThemeMenuCallback() {
|
||||||
|
@Override
|
||||||
|
public Set<String> getCategories(XmlRenderThemeStyleMenu renderThemeStyleMenu) {
|
||||||
|
// Use the selected style or the default
|
||||||
|
String style = styleId != null ? styleId : renderThemeStyleMenu.getDefaultValue();
|
||||||
|
|
||||||
|
// Retrieve the layer from the style id
|
||||||
|
XmlRenderThemeStyleLayer renderThemeStyleLayer = renderThemeStyleMenu.getLayer(style);
|
||||||
|
if (renderThemeStyleLayer == null) {
|
||||||
|
System.err.println("Invalid style " + style);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
// First get the selected layer's categories that are enabled together
|
||||||
|
Set<String> categories = renderThemeStyleLayer.getCategories();
|
||||||
|
|
||||||
|
// Then add the selected layer's overlays that are enabled individually
|
||||||
|
// Here we use the style menu, but users can use their own preferences
|
||||||
|
for (XmlRenderThemeStyleLayer overlay : renderThemeStyleLayer.getOverlays()) {
|
||||||
|
if (overlay.isEnabled())
|
||||||
|
categories.addAll(overlay.getCategories());
|
||||||
|
}
|
||||||
|
|
||||||
|
// This is the whole categories set to be enabled
|
||||||
|
return categories;
|
||||||
|
}
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,68 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2017 devemux86
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify it under the
|
||||||
|
* terms of the GNU Lesser General Public License as published by the Free Software
|
||||||
|
* Foundation, either version 3 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||||
|
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||||
|
* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public License along with
|
||||||
|
* this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
package org.oscim.android.test;
|
||||||
|
|
||||||
|
import android.os.Bundle;
|
||||||
|
|
||||||
|
import org.oscim.android.cache.TileCache;
|
||||||
|
import org.oscim.layers.TileGridLayer;
|
||||||
|
import org.oscim.layers.tile.buildings.BuildingLayer;
|
||||||
|
import org.oscim.layers.tile.vector.VectorTileLayer;
|
||||||
|
import org.oscim.layers.tile.vector.labeling.LabelLayer;
|
||||||
|
import org.oscim.theme.VtmThemes;
|
||||||
|
import org.oscim.tiling.source.OkHttpEngine;
|
||||||
|
import org.oscim.tiling.source.UrlTileSource;
|
||||||
|
import org.oscim.tiling.source.geojson.MapzenGeojsonTileSource;
|
||||||
|
|
||||||
|
public class MapzenGeojsonMapActivity extends MapActivity {
|
||||||
|
|
||||||
|
private static final boolean USE_CACHE = false;
|
||||||
|
|
||||||
|
private TileCache mCache;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onCreate(Bundle savedInstanceState) {
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
|
||||||
|
UrlTileSource tileSource = MapzenGeojsonTileSource.builder()
|
||||||
|
.apiKey("mapzen-xxxxxxx") // Put a proper API key
|
||||||
|
.httpFactory(new OkHttpEngine.OkHttpFactory())
|
||||||
|
//.locale("en")
|
||||||
|
.build();
|
||||||
|
|
||||||
|
if (USE_CACHE) {
|
||||||
|
// Cache the tiles into a local SQLite database
|
||||||
|
mCache = new TileCache(this, null, "tile.db");
|
||||||
|
mCache.setCacheSize(512 * (1 << 10));
|
||||||
|
tileSource.setCache(mCache);
|
||||||
|
}
|
||||||
|
|
||||||
|
VectorTileLayer l = mMap.setBaseMap(tileSource);
|
||||||
|
mMap.setTheme(VtmThemes.MAPZEN);
|
||||||
|
|
||||||
|
mMap.layers().add(new BuildingLayer(mMap, l));
|
||||||
|
mMap.layers().add(new LabelLayer(mMap, l));
|
||||||
|
|
||||||
|
mMap.layers().add(new TileGridLayer(mMap, getResources().getDisplayMetrics().density));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onDestroy() {
|
||||||
|
super.onDestroy();
|
||||||
|
|
||||||
|
if (mCache != null)
|
||||||
|
mCache.dispose();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,69 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2016-2017 devemux86
|
||||||
|
* Copyright 2017 Mathieu De Brito
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify it under the
|
||||||
|
* terms of the GNU Lesser General Public License as published by the Free Software
|
||||||
|
* Foundation, either version 3 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||||
|
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||||
|
* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public License along with
|
||||||
|
* this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
package org.oscim.android.test;
|
||||||
|
|
||||||
|
import android.os.Bundle;
|
||||||
|
|
||||||
|
import org.oscim.android.cache.TileCache;
|
||||||
|
import org.oscim.layers.TileGridLayer;
|
||||||
|
import org.oscim.layers.tile.buildings.BuildingLayer;
|
||||||
|
import org.oscim.layers.tile.vector.VectorTileLayer;
|
||||||
|
import org.oscim.layers.tile.vector.labeling.LabelLayer;
|
||||||
|
import org.oscim.theme.VtmThemes;
|
||||||
|
import org.oscim.tiling.source.OkHttpEngine;
|
||||||
|
import org.oscim.tiling.source.UrlTileSource;
|
||||||
|
import org.oscim.tiling.source.mvt.MapzenMvtTileSource;
|
||||||
|
|
||||||
|
public class MapzenMvtMapActivity extends MapActivity {
|
||||||
|
|
||||||
|
private static final boolean USE_CACHE = false;
|
||||||
|
|
||||||
|
private TileCache mCache;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onCreate(Bundle savedInstanceState) {
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
|
||||||
|
UrlTileSource tileSource = MapzenMvtTileSource.builder()
|
||||||
|
.apiKey("mapzen-xxxxxxx") // Put a proper API key
|
||||||
|
.httpFactory(new OkHttpEngine.OkHttpFactory())
|
||||||
|
//.locale("en")
|
||||||
|
.build();
|
||||||
|
|
||||||
|
if (USE_CACHE) {
|
||||||
|
// Cache the tiles into a local SQLite database
|
||||||
|
mCache = new TileCache(this, null, "tile.db");
|
||||||
|
mCache.setCacheSize(512 * (1 << 10));
|
||||||
|
tileSource.setCache(mCache);
|
||||||
|
}
|
||||||
|
|
||||||
|
VectorTileLayer l = mMap.setBaseMap(tileSource);
|
||||||
|
mMap.setTheme(VtmThemes.MAPZEN);
|
||||||
|
|
||||||
|
mMap.layers().add(new BuildingLayer(mMap, l));
|
||||||
|
mMap.layers().add(new LabelLayer(mMap, l));
|
||||||
|
|
||||||
|
mMap.layers().add(new TileGridLayer(mMap, getResources().getDisplayMetrics().density));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onDestroy() {
|
||||||
|
super.onDestroy();
|
||||||
|
|
||||||
|
if (mCache != null)
|
||||||
|
mCache.dispose();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2014 Hannes Janetzek
|
* Copyright 2014 Hannes Janetzek
|
||||||
* Copyright 2016 devemux86
|
* Copyright 2016-2017 devemux86
|
||||||
*
|
*
|
||||||
* This file is part of the OpenScienceMap project (http://www.opensciencemap.org).
|
* This file is part of the OpenScienceMap project (http://www.opensciencemap.org).
|
||||||
*
|
*
|
||||||
@@ -17,60 +17,67 @@
|
|||||||
*/
|
*/
|
||||||
package org.oscim.android.test;
|
package org.oscim.android.test;
|
||||||
|
|
||||||
import android.graphics.drawable.Drawable;
|
|
||||||
import android.os.Bundle;
|
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
import org.oscim.backend.canvas.Bitmap;
|
import org.oscim.backend.canvas.Bitmap;
|
||||||
import org.oscim.core.GeoPoint;
|
import org.oscim.core.GeoPoint;
|
||||||
import org.oscim.layers.TileGridLayer;
|
import org.oscim.event.Gesture;
|
||||||
|
import org.oscim.event.GestureListener;
|
||||||
|
import org.oscim.event.MotionEvent;
|
||||||
|
import org.oscim.layers.Layer;
|
||||||
import org.oscim.layers.marker.ItemizedLayer;
|
import org.oscim.layers.marker.ItemizedLayer;
|
||||||
import org.oscim.layers.marker.MarkerItem;
|
import org.oscim.layers.marker.MarkerItem;
|
||||||
import org.oscim.layers.marker.MarkerSymbol;
|
import org.oscim.layers.marker.MarkerSymbol;
|
||||||
import org.oscim.layers.marker.MarkerSymbol.HotspotPlace;
|
import org.oscim.layers.marker.MarkerSymbol.HotspotPlace;
|
||||||
|
import org.oscim.layers.tile.buildings.BuildingLayer;
|
||||||
|
import org.oscim.layers.tile.vector.VectorTileLayer;
|
||||||
|
import org.oscim.layers.tile.vector.labeling.LabelLayer;
|
||||||
|
import org.oscim.map.Map;
|
||||||
|
import org.oscim.theme.VtmThemes;
|
||||||
|
import org.oscim.tiling.TileSource;
|
||||||
|
import org.oscim.tiling.source.OkHttpEngine;
|
||||||
|
import org.oscim.tiling.source.oscimap4.OSciMap4TileSource;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import static org.oscim.android.canvas.AndroidGraphics.drawableToBitmap;
|
import static org.oscim.android.canvas.AndroidGraphics.drawableToBitmap;
|
||||||
import static org.oscim.tiling.source.bitmap.DefaultSources.STAMEN_TONER;
|
|
||||||
|
|
||||||
public class MarkerOverlayActivity extends BitmapTileMapActivity
|
public class MarkerOverlayActivity extends SimpleMapActivity
|
||||||
implements ItemizedLayer.OnItemGestureListener<MarkerItem> {
|
implements ItemizedLayer.OnItemGestureListener<MarkerItem> {
|
||||||
|
|
||||||
private static final boolean BILLBOARDS = true;
|
static final boolean BILLBOARDS = true;
|
||||||
private MarkerSymbol mFocusMarker;
|
MarkerSymbol mFocusMarker;
|
||||||
|
ItemizedLayer<MarkerItem> mMarkerLayer;
|
||||||
public MarkerOverlayActivity() {
|
|
||||||
super(STAMEN_TONER.build());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onCreate(Bundle savedInstanceState) {
|
void createLayers() {
|
||||||
super.onCreate(savedInstanceState);
|
// Map events receiver
|
||||||
mBitmapLayer.tileRenderer().setBitmapAlpha(0.5f);
|
mMap.layers().add(new MapEventsReceiver(mMap));
|
||||||
|
|
||||||
/* directly load bitmap from resources */
|
TileSource tileSource = OSciMap4TileSource.builder()
|
||||||
Bitmap bitmap = drawableToBitmap(getResources(), R.drawable.marker_poi);
|
.httpFactory(new OkHttpEngine.OkHttpFactory())
|
||||||
|
.build();
|
||||||
|
VectorTileLayer l = mMap.setBaseMap(tileSource);
|
||||||
|
mMap.layers().add(new BuildingLayer(mMap, l));
|
||||||
|
mMap.layers().add(new LabelLayer(mMap, l));
|
||||||
|
mMap.setTheme(VtmThemes.DEFAULT);
|
||||||
|
|
||||||
|
Bitmap bitmapPoi = drawableToBitmap(getResources().getDrawable(R.drawable.marker_poi));
|
||||||
MarkerSymbol symbol;
|
MarkerSymbol symbol;
|
||||||
if (BILLBOARDS)
|
if (BILLBOARDS)
|
||||||
symbol = new MarkerSymbol(bitmap, HotspotPlace.BOTTOM_CENTER);
|
symbol = new MarkerSymbol(bitmapPoi, HotspotPlace.BOTTOM_CENTER);
|
||||||
else
|
else
|
||||||
symbol = new MarkerSymbol(bitmap, HotspotPlace.CENTER, false);
|
symbol = new MarkerSymbol(bitmapPoi, HotspotPlace.CENTER, false);
|
||||||
|
|
||||||
/* another option: use some bitmap drawable */
|
Bitmap bitmapFocus = drawableToBitmap(getResources().getDrawable(R.drawable.marker_focus));
|
||||||
Drawable d = getResources().getDrawable(R.drawable.marker_focus);
|
|
||||||
if (BILLBOARDS)
|
if (BILLBOARDS)
|
||||||
mFocusMarker = new MarkerSymbol(drawableToBitmap(d), HotspotPlace.BOTTOM_CENTER);
|
mFocusMarker = new MarkerSymbol(bitmapFocus, HotspotPlace.BOTTOM_CENTER);
|
||||||
else
|
else
|
||||||
mFocusMarker = new MarkerSymbol(drawableToBitmap(d), HotspotPlace.CENTER, false);
|
mFocusMarker = new MarkerSymbol(bitmapFocus, HotspotPlace.CENTER, false);
|
||||||
|
|
||||||
ItemizedLayer<MarkerItem> markerLayer =
|
mMarkerLayer = new ItemizedLayer<>(mMap, new ArrayList<MarkerItem>(), symbol, this);
|
||||||
new ItemizedLayer<>(mMap, new ArrayList<MarkerItem>(),
|
mMap.layers().add(mMarkerLayer);
|
||||||
symbol, this);
|
|
||||||
|
|
||||||
mMap.layers().add(markerLayer);
|
|
||||||
|
|
||||||
List<MarkerItem> pts = new ArrayList<>();
|
List<MarkerItem> pts = new ArrayList<>();
|
||||||
|
|
||||||
@@ -79,9 +86,7 @@ public class MarkerOverlayActivity extends BitmapTileMapActivity
|
|||||||
pts.add(new MarkerItem(lat + "/" + lon, "", new GeoPoint(lat, lon)));
|
pts.add(new MarkerItem(lat + "/" + lon, "", new GeoPoint(lat, lon)));
|
||||||
}
|
}
|
||||||
|
|
||||||
markerLayer.addItems(pts);
|
mMarkerLayer.addItems(pts);
|
||||||
|
|
||||||
mMap.layers().add(new TileGridLayer(mMap));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -99,13 +104,40 @@ public class MarkerOverlayActivity extends BitmapTileMapActivity
|
|||||||
else
|
else
|
||||||
item.setMarker(null);
|
item.setMarker(null);
|
||||||
|
|
||||||
Toast toast = Toast.makeText(this, item.getTitle(), Toast.LENGTH_SHORT);
|
Toast.makeText(this, "Marker tap\n" + item.getTitle(), Toast.LENGTH_SHORT).show();
|
||||||
toast.show();
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onItemLongPress(int index, MarkerItem item) {
|
public boolean onItemLongPress(int index, MarkerItem item) {
|
||||||
return false;
|
if (item.getMarker() == null)
|
||||||
|
item.setMarker(mFocusMarker);
|
||||||
|
else
|
||||||
|
item.setMarker(null);
|
||||||
|
|
||||||
|
Toast.makeText(this, "Marker long press\n" + item.getTitle(), Toast.LENGTH_SHORT).show();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
class MapEventsReceiver extends Layer implements GestureListener {
|
||||||
|
|
||||||
|
MapEventsReceiver(Map map) {
|
||||||
|
super(map);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onGesture(Gesture g, MotionEvent e) {
|
||||||
|
if (g instanceof Gesture.Tap) {
|
||||||
|
GeoPoint p = mMap.viewport().fromScreenPoint(e.getX(), e.getY());
|
||||||
|
Toast.makeText(MarkerOverlayActivity.this, "Map tap\n" + p, Toast.LENGTH_SHORT).show();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (g instanceof Gesture.LongPress) {
|
||||||
|
GeoPoint p = mMap.viewport().fromScreenPoint(e.getX(), e.getY());
|
||||||
|
Toast.makeText(MarkerOverlayActivity.this, "Map long press\n" + p, Toast.LENGTH_SHORT).show();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2016 Marvin W
|
* Copyright 2016 Marvin W
|
||||||
* Copyright 2016 devemux86
|
* Copyright 2016-2017 devemux86
|
||||||
*
|
*
|
||||||
* This file is part of the OpenScienceMap project (http://www.opensciencemap.org).
|
* This file is part of the OpenScienceMap project (http://www.opensciencemap.org).
|
||||||
*
|
*
|
||||||
@@ -22,12 +22,13 @@ import android.os.Bundle;
|
|||||||
|
|
||||||
import org.oscim.android.MapPreferences;
|
import org.oscim.android.MapPreferences;
|
||||||
import org.oscim.android.MapView;
|
import org.oscim.android.MapView;
|
||||||
import org.oscim.core.Tile;
|
|
||||||
import org.oscim.layers.tile.buildings.BuildingLayer;
|
import org.oscim.layers.tile.buildings.BuildingLayer;
|
||||||
import org.oscim.layers.tile.vector.VectorTileLayer;
|
import org.oscim.layers.tile.vector.VectorTileLayer;
|
||||||
import org.oscim.layers.tile.vector.labeling.LabelLayer;
|
import org.oscim.layers.tile.vector.labeling.LabelLayer;
|
||||||
import org.oscim.map.Map;
|
import org.oscim.map.Map;
|
||||||
import org.oscim.theme.VtmThemes;
|
import org.oscim.theme.VtmThemes;
|
||||||
|
import org.oscim.tiling.TileSource;
|
||||||
|
import org.oscim.tiling.source.OkHttpEngine;
|
||||||
import org.oscim.tiling.source.oscimap4.OSciMap4TileSource;
|
import org.oscim.tiling.source.oscimap4.OSciMap4TileSource;
|
||||||
|
|
||||||
public class MultiMapActivity extends Activity {
|
public class MultiMapActivity extends Activity {
|
||||||
@@ -36,7 +37,6 @@ public class MultiMapActivity extends Activity {
|
|||||||
|
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
Tile.SIZE = Tile.calculateTileSize(getResources().getDisplayMetrics().scaledDensity);
|
|
||||||
setContentView(R.layout.activity_map_multi);
|
setContentView(R.layout.activity_map_multi);
|
||||||
|
|
||||||
setTitle(getClass().getSimpleName());
|
setTitle(getClass().getSimpleName());
|
||||||
@@ -45,7 +45,10 @@ public class MultiMapActivity extends Activity {
|
|||||||
mMapView1 = (MapView) findViewById(R.id.mapView1);
|
mMapView1 = (MapView) findViewById(R.id.mapView1);
|
||||||
Map map1 = mMapView1.map();
|
Map map1 = mMapView1.map();
|
||||||
mPrefs1 = new MapPreferences(MultiMapActivity.class.getName() + "1", this);
|
mPrefs1 = new MapPreferences(MultiMapActivity.class.getName() + "1", this);
|
||||||
VectorTileLayer baseLayer1 = map1.setBaseMap(new OSciMap4TileSource());
|
TileSource tileSource1 = OSciMap4TileSource.builder()
|
||||||
|
.httpFactory(new OkHttpEngine.OkHttpFactory())
|
||||||
|
.build();
|
||||||
|
VectorTileLayer baseLayer1 = map1.setBaseMap(tileSource1);
|
||||||
map1.layers().add(new BuildingLayer(map1, baseLayer1));
|
map1.layers().add(new BuildingLayer(map1, baseLayer1));
|
||||||
map1.layers().add(new LabelLayer(map1, baseLayer1));
|
map1.layers().add(new LabelLayer(map1, baseLayer1));
|
||||||
map1.setTheme(VtmThemes.DEFAULT);
|
map1.setTheme(VtmThemes.DEFAULT);
|
||||||
@@ -54,7 +57,10 @@ public class MultiMapActivity extends Activity {
|
|||||||
mMapView2 = (MapView) findViewById(R.id.mapView2);
|
mMapView2 = (MapView) findViewById(R.id.mapView2);
|
||||||
Map map2 = mMapView2.map();
|
Map map2 = mMapView2.map();
|
||||||
mPrefs2 = new MapPreferences(MultiMapActivity.class.getName() + "2", this);
|
mPrefs2 = new MapPreferences(MultiMapActivity.class.getName() + "2", this);
|
||||||
VectorTileLayer baseLayer2 = map2.setBaseMap(new OSciMap4TileSource());
|
TileSource tileSource2 = OSciMap4TileSource.builder()
|
||||||
|
.httpFactory(new OkHttpEngine.OkHttpFactory())
|
||||||
|
.build();
|
||||||
|
VectorTileLayer baseLayer2 = map2.setBaseMap(tileSource2);
|
||||||
map2.layers().add(new BuildingLayer(map2, baseLayer2));
|
map2.layers().add(new BuildingLayer(map2, baseLayer2));
|
||||||
map2.layers().add(new LabelLayer(map2, baseLayer2));
|
map2.layers().add(new LabelLayer(map2, baseLayer2));
|
||||||
map2.setTheme(VtmThemes.DEFAULT);
|
map2.setTheme(VtmThemes.DEFAULT);
|
||||||
|
|||||||
@@ -0,0 +1,33 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2016-2017 devemux86
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify it under the
|
||||||
|
* terms of the GNU Lesser General Public License as published by the Free Software
|
||||||
|
* Foundation, either version 3 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||||
|
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||||
|
* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public License along with
|
||||||
|
* this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
package org.oscim.android.test;
|
||||||
|
|
||||||
|
import org.oscim.utils.Parameters;
|
||||||
|
|
||||||
|
public class NewGesturesActivity extends MarkerOverlayActivity {
|
||||||
|
|
||||||
|
public NewGesturesActivity() {
|
||||||
|
super();
|
||||||
|
Parameters.MAP_EVENT_LAYER2 = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onDestroy() {
|
||||||
|
super.onDestroy();
|
||||||
|
|
||||||
|
// Revert gestures for other activities
|
||||||
|
Parameters.MAP_EVENT_LAYER2 = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2016 devemux86
|
* Copyright 2016-2017 devemux86
|
||||||
*
|
*
|
||||||
* This file is part of the OpenScienceMap project (http://www.opensciencemap.org).
|
* This file is part of the OpenScienceMap project (http://www.opensciencemap.org).
|
||||||
*
|
*
|
||||||
@@ -20,13 +20,14 @@ import android.os.Bundle;
|
|||||||
|
|
||||||
import org.oscim.android.cache.TileCache;
|
import org.oscim.android.cache.TileCache;
|
||||||
import org.oscim.layers.tile.TileLayer;
|
import org.oscim.layers.tile.TileLayer;
|
||||||
import org.oscim.layers.tile.buildings.S3DBLayer;
|
import org.oscim.layers.tile.buildings.S3DBTileLayer;
|
||||||
import org.oscim.layers.tile.vector.labeling.LabelLayer;
|
import org.oscim.layers.tile.vector.labeling.LabelLayer;
|
||||||
import org.oscim.theme.VtmThemes;
|
import org.oscim.theme.VtmThemes;
|
||||||
import org.oscim.tiling.TileSource;
|
import org.oscim.tiling.TileSource;
|
||||||
|
import org.oscim.tiling.source.OkHttpEngine;
|
||||||
import org.oscim.tiling.source.oscimap4.OSciMap4TileSource;
|
import org.oscim.tiling.source.oscimap4.OSciMap4TileSource;
|
||||||
|
|
||||||
public class S3DBMapActivity extends BaseMapActivity {
|
public class OSciMapS3DBMapActivity extends BaseMapActivity {
|
||||||
|
|
||||||
TileCache mS3dbCache;
|
TileCache mS3dbCache;
|
||||||
|
|
||||||
@@ -37,6 +38,7 @@ public class S3DBMapActivity extends BaseMapActivity {
|
|||||||
mMap.setTheme(VtmThemes.DEFAULT);
|
mMap.setTheme(VtmThemes.DEFAULT);
|
||||||
|
|
||||||
TileSource ts = OSciMap4TileSource.builder()
|
TileSource ts = OSciMap4TileSource.builder()
|
||||||
|
.httpFactory(new OkHttpEngine.OkHttpFactory())
|
||||||
.url("http://opensciencemap.org/tiles/s3db")
|
.url("http://opensciencemap.org/tiles/s3db")
|
||||||
.zoomMin(16)
|
.zoomMin(16)
|
||||||
.zoomMax(16)
|
.zoomMax(16)
|
||||||
@@ -47,7 +49,7 @@ public class S3DBMapActivity extends BaseMapActivity {
|
|||||||
mS3dbCache.setCacheSize(512 * (1 << 10));
|
mS3dbCache.setCacheSize(512 * (1 << 10));
|
||||||
ts.setCache(mS3dbCache);
|
ts.setCache(mS3dbCache);
|
||||||
}
|
}
|
||||||
TileLayer tl = new S3DBLayer(mMap, ts, true, false);
|
TileLayer tl = new S3DBTileLayer(mMap, ts, true, false);
|
||||||
mMap.layers().add(tl);
|
mMap.layers().add(tl);
|
||||||
mMap.layers().add(new LabelLayer(mMap, mBaseLayer));
|
mMap.layers().add(new LabelLayer(mMap, mBaseLayer));
|
||||||
}
|
}
|
||||||
@@ -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();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,72 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright 2014 Hannes Janetzek
|
|
||||||
* Copyright 2016 devemux86
|
|
||||||
*
|
|
||||||
* This file is part of the OpenScienceMap project (http://www.opensciencemap.org).
|
|
||||||
*
|
|
||||||
* This program is free software: you can redistribute it and/or modify it under the
|
|
||||||
* terms of the GNU Lesser General Public License as published by the Free Software
|
|
||||||
* Foundation, either version 3 of the License, or (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful, but WITHOUT ANY
|
|
||||||
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
|
||||||
* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Lesser General Public License along with
|
|
||||||
* this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
package org.oscim.android.test;
|
|
||||||
|
|
||||||
import android.os.Bundle;
|
|
||||||
|
|
||||||
import org.oscim.layers.TileGridLayer;
|
|
||||||
import org.oscim.layers.tile.buildings.BuildingLayer;
|
|
||||||
import org.oscim.layers.tile.vector.VectorTileLayer;
|
|
||||||
import org.oscim.layers.tile.vector.labeling.LabelLayer;
|
|
||||||
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.layers().add(new TileGridLayer(mMap));
|
|
||||||
|
|
||||||
mMap.setMapPosition(53.08, 8.83, Math.pow(2, 16));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2017 devemux86
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify it under the
|
||||||
|
* terms of the GNU Lesser General Public License as published by the Free Software
|
||||||
|
* Foundation, either version 3 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||||
|
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||||
|
* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public License along with
|
||||||
|
* this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
package org.oscim.android.test;
|
||||||
|
|
||||||
|
import android.os.Bundle;
|
||||||
|
|
||||||
|
import org.oscim.utils.Parameters;
|
||||||
|
|
||||||
|
public class POTTextureActivity extends SimpleMapActivity {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onCreate(Bundle savedInstanceState) {
|
||||||
|
Parameters.POT_TEXTURES = true;
|
||||||
|
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2014 Hannes Janetzek
|
* Copyright 2014 Hannes Janetzek
|
||||||
* Copyright 2016 devemux86
|
* Copyright 2016-2017 devemux86
|
||||||
*
|
*
|
||||||
* This file is part of the OpenScienceMap project (http://www.opensciencemap.org).
|
* This file is part of the OpenScienceMap project (http://www.opensciencemap.org).
|
||||||
*
|
*
|
||||||
@@ -18,40 +18,48 @@
|
|||||||
package org.oscim.android.test;
|
package org.oscim.android.test;
|
||||||
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
import android.widget.Toast;
|
||||||
|
|
||||||
|
import org.oscim.backend.CanvasAdapter;
|
||||||
import org.oscim.backend.canvas.Color;
|
import org.oscim.backend.canvas.Color;
|
||||||
import org.oscim.core.MapPosition;
|
import org.oscim.core.MapPosition;
|
||||||
import org.oscim.event.Event;
|
import org.oscim.event.Event;
|
||||||
|
import org.oscim.event.Gesture;
|
||||||
|
import org.oscim.event.MotionEvent;
|
||||||
import org.oscim.layers.vector.PathLayer;
|
import org.oscim.layers.vector.PathLayer;
|
||||||
import org.oscim.map.Map.UpdateListener;
|
import org.oscim.map.Map.UpdateListener;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import static org.oscim.tiling.source.bitmap.DefaultSources.STAMEN_TONER;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This is a very INEFFICIENT and somewhat less useful example for how to use
|
* This is a very INEFFICIENT and somewhat less useful example for how to use
|
||||||
* PathLayers!
|
* PathLayers!
|
||||||
*/
|
*/
|
||||||
public class PathOverlayActivity extends BitmapTileMapActivity {
|
public class PathOverlayActivity extends SimpleMapActivity {
|
||||||
|
|
||||||
private static final boolean ANIMATION = true;
|
private static final boolean ANIMATION = true;
|
||||||
|
|
||||||
private List<PathLayer> mPathLayers = new ArrayList<>();
|
private List<PathLayer> mPathLayers = new ArrayList<>();
|
||||||
|
|
||||||
public PathOverlayActivity() {
|
|
||||||
super(STAMEN_TONER.build());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onCreate(Bundle savedInstanceState) {
|
public void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
mBitmapLayer.tileRenderer().setBitmapAlpha(0.5f);
|
|
||||||
|
|
||||||
for (double lat = -90; lat <= 90; lat += 5) {
|
for (double lat = -90; lat <= 90; lat += 5) {
|
||||||
int c = Color.fade(Color.rainbow((float) (lat + 90) / 180), 0.5f);
|
int c = Color.fade(Color.rainbow((float) (lat + 90) / 180), 0.5f);
|
||||||
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);
|
mMap.layers().add(pathLayer);
|
||||||
mPathLayers.add(pathLayer);
|
mPathLayers.add(pathLayer);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,78 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2014 Hannes Janetzek
|
||||||
|
* Copyright 2016-2017 devemux86
|
||||||
|
* Copyright 2017 Longri
|
||||||
|
*
|
||||||
|
* This file is part of the OpenScienceMap project (http://www.opensciencemap.org).
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify it under the
|
||||||
|
* terms of the GNU Lesser General Public License as published by the Free Software
|
||||||
|
* Foundation, either version 3 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||||
|
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||||
|
* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public License along with
|
||||||
|
* this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
package org.oscim.android.test;
|
||||||
|
|
||||||
|
import android.widget.Toast;
|
||||||
|
|
||||||
|
import org.oscim.layers.marker.MarkerItem;
|
||||||
|
|
||||||
|
import java.util.Timer;
|
||||||
|
import java.util.TimerTask;
|
||||||
|
import java.util.concurrent.atomic.AtomicInteger;
|
||||||
|
|
||||||
|
public class RotateMarkerOverlayActivity extends MarkerOverlayActivity {
|
||||||
|
|
||||||
|
private Timer timer;
|
||||||
|
private int markerCount = 0;
|
||||||
|
|
||||||
|
private void itemEvent(final MarkerItem item) {
|
||||||
|
if (item.getMarker() == null) {
|
||||||
|
item.setMarker(mFocusMarker);
|
||||||
|
markerCount++;
|
||||||
|
final AtomicInteger rotValue = new AtomicInteger(0);
|
||||||
|
if (timer != null)
|
||||||
|
timer.cancel();
|
||||||
|
timer = new Timer();
|
||||||
|
TimerTask timerTask = new TimerTask() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
float value = (float) (rotValue.incrementAndGet() * 10);
|
||||||
|
item.setRotation(value);
|
||||||
|
if (rotValue.get() > 36)
|
||||||
|
rotValue.set(0);
|
||||||
|
mMarkerLayer.update();
|
||||||
|
mMap.updateMap(true);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
timer.schedule(timerTask, 1000, 1000);
|
||||||
|
|
||||||
|
} else {
|
||||||
|
item.setMarker(null);
|
||||||
|
markerCount--;
|
||||||
|
if (timer != null && markerCount == 0)
|
||||||
|
timer.cancel();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onItemSingleTapUp(int index, MarkerItem item) {
|
||||||
|
itemEvent(item);
|
||||||
|
|
||||||
|
Toast.makeText(this, "Marker tap\n" + item.getTitle(), Toast.LENGTH_SHORT).show();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onItemLongPress(int index, MarkerItem item) {
|
||||||
|
itemEvent(item);
|
||||||
|
|
||||||
|
Toast.makeText(this, "Marker long press\n" + item.getTitle(), Toast.LENGTH_SHORT).show();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,7 +1,9 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2010, 2011, 2012, 2013 mapsforge.org
|
* Copyright 2010, 2011, 2012, 2013 mapsforge.org
|
||||||
* Copyright 2013 Hannes Janetzek
|
* Copyright 2013 Hannes Janetzek
|
||||||
* Copyright 2016 devemux86
|
* Copyright 2016-2017 devemux86
|
||||||
|
* Copyright 2017 Longri
|
||||||
|
* Copyright 2017 nebular
|
||||||
*
|
*
|
||||||
* This file is part of the OpenScienceMap project (http://www.opensciencemap.org).
|
* This file is part of the OpenScienceMap project (http://www.opensciencemap.org).
|
||||||
*
|
*
|
||||||
@@ -20,59 +22,110 @@ package org.oscim.android.test;
|
|||||||
|
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
|
import android.net.Uri;
|
||||||
|
import android.os.Build;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
import android.view.Gravity;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.View.OnClickListener;
|
|
||||||
import android.widget.Button;
|
import android.widget.Button;
|
||||||
import android.widget.LinearLayout;
|
import android.widget.LinearLayout;
|
||||||
|
import android.widget.TextView;
|
||||||
import org.slf4j.Logger;
|
|
||||||
import org.slf4j.LoggerFactory;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A simple start screen for the sample activities.
|
* Start screen for the sample activities.
|
||||||
*/
|
*/
|
||||||
public class Samples extends Activity {
|
public class Samples extends Activity {
|
||||||
public static Logger log = LoggerFactory.getLogger(Samples.class);
|
|
||||||
|
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
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
|
|
||||||
setContentView(R.layout.activity_samples);
|
setContentView(R.layout.activity_samples);
|
||||||
LinearLayout linearLayout = (LinearLayout) findViewById(R.id.samples);
|
LinearLayout linearLayout = findViewById(R.id.samples);
|
||||||
linearLayout.addView(createButton(SimpleMapActivity.class));
|
linearLayout.addView(createButton(SimpleMapActivity.class));
|
||||||
linearLayout.addView(createButton(BitmapTileMapActivity.class));
|
|
||||||
linearLayout.addView(createButton(MapsforgeMapActivity.class));
|
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));
|
||||||
|
|
||||||
|
linearLayout.addView(createLabel("Raster Maps"));
|
||||||
|
linearLayout.addView(createButton(BitmapTileMapActivity.class));
|
||||||
|
|
||||||
|
linearLayout.addView(createLabel("Overlays"));
|
||||||
linearLayout.addView(createButton(MarkerOverlayActivity.class));
|
linearLayout.addView(createButton(MarkerOverlayActivity.class));
|
||||||
|
linearLayout.addView(createButton(RotateMarkerOverlayActivity.class));
|
||||||
|
linearLayout.addView(createButton(AtlasMarkerOverlayActivity.class));
|
||||||
|
linearLayout.addView(createButton(AtlasMultiTextureActivity.class));
|
||||||
|
linearLayout.addView(createButton(ClusterMarkerOverlayActivity.class));
|
||||||
linearLayout.addView(createButton(PathOverlayActivity.class));
|
linearLayout.addView(createButton(PathOverlayActivity.class));
|
||||||
linearLayout.addView(createButton(LineTexActivity.class));
|
linearLayout.addView(createButton(LineTexActivity.class));
|
||||||
linearLayout.addView(createButton(LayerGroupActivity.class));
|
|
||||||
linearLayout.addView(createButton(ThemeStylerActivity.class));
|
|
||||||
linearLayout.addView(createButton(S3DBMapActivity.class));
|
|
||||||
linearLayout.addView(createButton(JeoIndoorMapActivity.class));
|
|
||||||
linearLayout.addView(createButton(OsmJsonMapActivity.class));
|
|
||||||
linearLayout.addView(createButton(VectorLayerMapActivity.class));
|
linearLayout.addView(createButton(VectorLayerMapActivity.class));
|
||||||
|
linearLayout.addView(createButton(LocationActivity.class));
|
||||||
|
|
||||||
|
linearLayout.addView(createLabel("User Interaction"));
|
||||||
|
linearLayout.addView(createButton(NewGesturesActivity.class));
|
||||||
|
linearLayout.addView(createButton(LayerGroupActivity.class));
|
||||||
|
|
||||||
|
linearLayout.addView(createLabel("Dual Map Views"));
|
||||||
linearLayout.addView(createButton(MultiMapActivity.class));
|
linearLayout.addView(createButton(MultiMapActivity.class));
|
||||||
}
|
|
||||||
|
|
||||||
private Button createButton(final Class<?> clazz) {
|
linearLayout.addView(createLabel("Experiments"));
|
||||||
return this.createButton(clazz, null);
|
linearLayout.addView(createButton(ReverseGeocodeActivity.class));
|
||||||
}
|
linearLayout.addView(createButton(OSciMapS3DBMapActivity.class));
|
||||||
|
linearLayout.addView(createButton(ThemeStylerActivity.class));
|
||||||
private Button createButton(final Class<?> clazz, String text) {
|
linearLayout.addView(createButton(JeoIndoorMapActivity.class));
|
||||||
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;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2013 Hannes Janetzek
|
* Copyright 2013 Hannes Janetzek
|
||||||
* Copyright 2016 devemux86
|
* Copyright 2016-2017 devemux86
|
||||||
*
|
*
|
||||||
* This file is part of the OpenScienceMap project (http://www.opensciencemap.org).
|
* This file is part of the OpenScienceMap project (http://www.opensciencemap.org).
|
||||||
*
|
*
|
||||||
@@ -19,7 +19,6 @@ package org.oscim.android.test;
|
|||||||
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
|
||||||
import org.oscim.backend.CanvasAdapter;
|
|
||||||
import org.oscim.core.MapPosition;
|
import org.oscim.core.MapPosition;
|
||||||
import org.oscim.core.MercatorProjection;
|
import org.oscim.core.MercatorProjection;
|
||||||
import org.oscim.layers.GroupLayer;
|
import org.oscim.layers.GroupLayer;
|
||||||
@@ -43,12 +42,16 @@ public class SimpleMapActivity extends BaseMapActivity {
|
|||||||
public void onCreate(Bundle savedInstanceState) {
|
public void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
|
|
||||||
|
createLayers();
|
||||||
|
}
|
||||||
|
|
||||||
|
void createLayers() {
|
||||||
GroupLayer groupLayer = new GroupLayer(mMap);
|
GroupLayer groupLayer = new GroupLayer(mMap);
|
||||||
groupLayer.layers.add(new BuildingLayer(mMap, mBaseLayer));
|
groupLayer.layers.add(new BuildingLayer(mMap, mBaseLayer));
|
||||||
groupLayer.layers.add(new LabelLayer(mMap, mBaseLayer));
|
groupLayer.layers.add(new LabelLayer(mMap, mBaseLayer));
|
||||||
mMap.layers().add(groupLayer);
|
mMap.layers().add(groupLayer);
|
||||||
|
|
||||||
mapScaleBar = new DefaultMapScaleBar(mMap, CanvasAdapter.dpi / 160);
|
mapScaleBar = new DefaultMapScaleBar(mMap);
|
||||||
mapScaleBar.setScaleBarMode(DefaultMapScaleBar.ScaleBarMode.BOTH);
|
mapScaleBar.setScaleBarMode(DefaultMapScaleBar.ScaleBarMode.BOTH);
|
||||||
mapScaleBar.setDistanceUnitAdapter(MetricUnitAdapter.INSTANCE);
|
mapScaleBar.setDistanceUnitAdapter(MetricUnitAdapter.INSTANCE);
|
||||||
mapScaleBar.setSecondaryDistanceUnitAdapter(ImperialUnitAdapter.INSTANCE);
|
mapScaleBar.setSecondaryDistanceUnitAdapter(ImperialUnitAdapter.INSTANCE);
|
||||||
@@ -57,7 +60,7 @@ public class SimpleMapActivity extends BaseMapActivity {
|
|||||||
MapScaleBarLayer mapScaleBarLayer = new MapScaleBarLayer(mMap, mapScaleBar);
|
MapScaleBarLayer mapScaleBarLayer = new MapScaleBarLayer(mMap, mapScaleBar);
|
||||||
BitmapRenderer renderer = mapScaleBarLayer.getRenderer();
|
BitmapRenderer renderer = mapScaleBarLayer.getRenderer();
|
||||||
renderer.setPosition(GLViewport.Position.BOTTOM_LEFT);
|
renderer.setPosition(GLViewport.Position.BOTTOM_LEFT);
|
||||||
renderer.setOffset(5 * CanvasAdapter.dpi / 160, 0);
|
renderer.setOffset(5 * getResources().getDisplayMetrics().density, 0);
|
||||||
mMap.layers().add(mapScaleBarLayer);
|
mMap.layers().add(mapScaleBarLayer);
|
||||||
|
|
||||||
mMap.setTheme(VtmThemes.DEFAULT);
|
mMap.setTheme(VtmThemes.DEFAULT);
|
||||||
@@ -65,7 +68,8 @@ public class SimpleMapActivity extends BaseMapActivity {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onDestroy() {
|
protected void onDestroy() {
|
||||||
mapScaleBar.destroy();
|
if (mapScaleBar != null)
|
||||||
|
mapScaleBar.destroy();
|
||||||
|
|
||||||
super.onDestroy();
|
super.onDestroy();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2013 Hannes Janetzek
|
* Copyright 2013 Hannes Janetzek
|
||||||
* Copyright 2016 devemux86
|
* Copyright 2016-2017 devemux86
|
||||||
*
|
*
|
||||||
* This file is part of the OpenScienceMap project (http://www.opensciencemap.org).
|
* This file is part of the OpenScienceMap project (http://www.opensciencemap.org).
|
||||||
*
|
*
|
||||||
@@ -20,24 +20,16 @@ package org.oscim.android.test;
|
|||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
|
||||||
import org.oscim.backend.canvas.Color;
|
import org.oscim.backend.canvas.Color;
|
||||||
import org.oscim.layers.TileGridLayer;
|
|
||||||
import org.oscim.layers.vector.VectorLayer;
|
import org.oscim.layers.vector.VectorLayer;
|
||||||
import org.oscim.layers.vector.geometries.PointDrawable;
|
import org.oscim.layers.vector.geometries.PointDrawable;
|
||||||
import org.oscim.layers.vector.geometries.Style;
|
import org.oscim.layers.vector.geometries.Style;
|
||||||
import org.oscim.utils.ColorUtil;
|
import org.oscim.utils.ColorUtil;
|
||||||
|
|
||||||
import static org.oscim.tiling.source.bitmap.DefaultSources.STAMEN_TONER;
|
public class VectorLayerMapActivity extends SimpleMapActivity {
|
||||||
|
|
||||||
public class VectorLayerMapActivity extends BitmapTileMapActivity {
|
|
||||||
|
|
||||||
public VectorLayerMapActivity() {
|
|
||||||
super(STAMEN_TONER.build());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onCreate(Bundle savedInstanceState) {
|
public void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
mBitmapLayer.tileRenderer().setBitmapAlpha(0.5f);
|
|
||||||
|
|
||||||
VectorLayer vectorLayer = new VectorLayer(mMap);
|
VectorLayer vectorLayer = new VectorLayer(mMap);
|
||||||
|
|
||||||
@@ -95,7 +87,6 @@ public class VectorLayerMapActivity extends BitmapTileMapActivity {
|
|||||||
vectorLayer.update();
|
vectorLayer.update();
|
||||||
|
|
||||||
mMap.layers().add(vectorLayer);
|
mMap.layers().add(vectorLayer);
|
||||||
mMap.layers().add(new TileGridLayer(mMap, 0xff222222, 1.2f, 1));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -1,30 +1,2 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
<manifest package="org.oscim.gdx" />
|
||||||
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>
|
|
||||||
|
|||||||
@@ -1,11 +1,8 @@
|
|||||||
apply plugin: 'com.android.application'
|
apply plugin: 'com.android.library'
|
||||||
apply plugin: 'com.github.dcendents.android-maven'
|
apply plugin: 'com.github.dcendents.android-maven'
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
compile project(':vtm-android')
|
api project(':vtm')
|
||||||
compile project(':vtm-gdx')
|
|
||||||
compile "com.badlogicgames.gdx:gdx-backend-android:$gdxVersion"
|
|
||||||
compile 'com.noveogroup.android:android-logger:1.3.6'
|
|
||||||
}
|
}
|
||||||
|
|
||||||
android {
|
android {
|
||||||
@@ -21,6 +18,7 @@ android {
|
|||||||
versionCode versionCode()
|
versionCode versionCode()
|
||||||
versionName versionName()
|
versionName versionName()
|
||||||
minSdkVersion androidMinSdk()
|
minSdkVersion androidMinSdk()
|
||||||
|
targetSdkVersion androidTargetSdk()
|
||||||
}
|
}
|
||||||
|
|
||||||
sourceSets {
|
sourceSets {
|
||||||
@@ -28,14 +26,6 @@ android {
|
|||||||
manifest.srcFile 'AndroidManifest.xml'
|
manifest.srcFile 'AndroidManifest.xml'
|
||||||
java.srcDirs = ['src']
|
java.srcDirs = ['src']
|
||||||
resources.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')
|
debug.setRoot('build-types/debug')
|
||||||
release.setRoot('build-types/release')
|
release.setRoot('build-types/release')
|
||||||
@@ -44,52 +34,21 @@ android {
|
|||||||
lintOptions { abortOnError false }
|
lintOptions { abortOnError false }
|
||||||
}
|
}
|
||||||
|
|
||||||
android.applicationVariants.all { variant ->
|
android.libraryVariants.all { variant ->
|
||||||
def name = variant.buildType.name
|
def name = variant.buildType.name
|
||||||
if (name.equals("debug")) {
|
if (name == "debug")
|
||||||
print "Skipping debug jar"
|
return
|
||||||
return; // Skip debug builds.
|
|
||||||
}
|
|
||||||
|
|
||||||
def jar = project.tasks.create "jar${name.capitalize()}", Jar
|
def jar = project.tasks.create "jar${name.capitalize()}", Jar
|
||||||
jar.dependsOn variant.javaCompile
|
jar.dependsOn variant.javaCompiler
|
||||||
jar.from variant.javaCompile.destinationDir
|
jar.from variant.javaCompiler.destinationDir
|
||||||
jar.exclude 'android-logger.properties'
|
artifacts.add('archives', jar)
|
||||||
artifacts.add('archives', jar);
|
|
||||||
|
|
||||||
file('natives').eachDir() { dir ->
|
file('natives').eachDir() { dir ->
|
||||||
def nativesJar = project.tasks.create "nativesJar${name.capitalize()}-${dir.name}", Jar
|
def nativesJar = project.tasks.create "nativesJar${name.capitalize()}-${dir.name}", Jar
|
||||||
nativesJar.classifier = "natives-${dir.name}"
|
nativesJar.classifier = "natives-${dir.name}"
|
||||||
nativesJar.from(dir.path)
|
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)
|
|
||||||
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()
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 41 KiB |
@@ -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>
|
|
||||||
@@ -1,4 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<resources>
|
|
||||||
<string name="app_name">VTM GDX</string>
|
|
||||||
</resources>
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
root=DEBUG:%logger
|
|
||||||
@@ -2,13 +2,13 @@ apply plugin: 'com.android.library'
|
|||||||
apply plugin: 'com.github.dcendents.android-maven'
|
apply plugin: 'com.github.dcendents.android-maven'
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
compile project(':vtm')
|
api project(':vtm')
|
||||||
compile 'com.caverock:androidsvg:1.2.2-beta-1'
|
api 'com.caverock:androidsvg:1.2.2-beta-1'
|
||||||
}
|
}
|
||||||
|
|
||||||
android {
|
android {
|
||||||
compileSdkVersion androidCompileSdk()
|
compileSdkVersion androidCompileSdk()
|
||||||
buildToolsVersion = "$androidBuildVersionTools"
|
buildToolsVersion "$androidBuildVersionTools"
|
||||||
|
|
||||||
compileOptions {
|
compileOptions {
|
||||||
sourceCompatibility JavaVersion.VERSION_1_7
|
sourceCompatibility JavaVersion.VERSION_1_7
|
||||||
@@ -19,6 +19,7 @@ android {
|
|||||||
versionCode versionCode()
|
versionCode versionCode()
|
||||||
versionName versionName()
|
versionName versionName()
|
||||||
minSdkVersion androidMinSdk()
|
minSdkVersion androidMinSdk()
|
||||||
|
targetSdkVersion androidTargetSdk()
|
||||||
}
|
}
|
||||||
|
|
||||||
sourceSets {
|
sourceSets {
|
||||||
@@ -26,8 +27,6 @@ android {
|
|||||||
manifest.srcFile 'AndroidManifest.xml'
|
manifest.srcFile 'AndroidManifest.xml'
|
||||||
java.srcDirs = ['src']
|
java.srcDirs = ['src']
|
||||||
resources.srcDirs = ['src']
|
resources.srcDirs = ['src']
|
||||||
res.srcDirs = ['res']
|
|
||||||
assets.srcDirs = ['assets']
|
|
||||||
}
|
}
|
||||||
debug.setRoot('build-types/debug')
|
debug.setRoot('build-types/debug')
|
||||||
release.setRoot('build-types/release')
|
release.setRoot('build-types/release')
|
||||||
@@ -38,32 +37,20 @@ android {
|
|||||||
|
|
||||||
android.libraryVariants.all { variant ->
|
android.libraryVariants.all { variant ->
|
||||||
def name = variant.buildType.name
|
def name = variant.buildType.name
|
||||||
if (name.equals("debug")) {
|
if (name == "debug")
|
||||||
print "Skipping debug jar"
|
return
|
||||||
return; // Skip debug builds.
|
|
||||||
}
|
|
||||||
|
|
||||||
def jar = project.tasks.create "jar${name.capitalize()}", Jar
|
def jar = project.tasks.create "jar${name.capitalize()}", Jar
|
||||||
jar.dependsOn variant.javaCompile
|
jar.dependsOn variant.javaCompiler
|
||||||
jar.from variant.javaCompile.destinationDir
|
jar.from variant.javaCompiler.destinationDir
|
||||||
artifacts.add('archives', jar);
|
artifacts.add('archives', jar)
|
||||||
|
|
||||||
file('natives').eachDir() { dir ->
|
file('natives').eachDir() { dir ->
|
||||||
def nativesJar = project.tasks.create "nativesJar${name.capitalize()}-${dir.name}", Jar
|
def nativesJar = project.tasks.create "nativesJar${name.capitalize()}-${dir.name}", Jar
|
||||||
nativesJar.classifier = "natives-${dir.name}"
|
nativesJar.classifier = "natives-${dir.name}"
|
||||||
nativesJar.from(dir.path)
|
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")) {
|
if (project.hasProperty("SONATYPE_USERNAME")) {
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2012 Hannes Janetzek
|
* Copyright 2012 Hannes Janetzek
|
||||||
|
* Copyright 2016-2017 devemux86
|
||||||
*
|
*
|
||||||
* This file is part of the OpenScienceMap project (http://www.opensciencemap.org).
|
* This file is part of the OpenScienceMap project (http://www.opensciencemap.org).
|
||||||
*
|
*
|
||||||
@@ -30,7 +31,9 @@ import org.oscim.android.input.AndroidMotionEvent;
|
|||||||
import org.oscim.android.input.GestureHandler;
|
import org.oscim.android.input.GestureHandler;
|
||||||
import org.oscim.backend.CanvasAdapter;
|
import org.oscim.backend.CanvasAdapter;
|
||||||
import org.oscim.backend.GLAdapter;
|
import org.oscim.backend.GLAdapter;
|
||||||
|
import org.oscim.core.Tile;
|
||||||
import org.oscim.map.Map;
|
import org.oscim.map.Map;
|
||||||
|
import org.oscim.utils.Parameters;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
@@ -48,13 +51,13 @@ public class MapView extends GLSurfaceView {
|
|||||||
|
|
||||||
static final Logger log = LoggerFactory.getLogger(MapView.class);
|
static final Logger log = LoggerFactory.getLogger(MapView.class);
|
||||||
|
|
||||||
static {
|
private static void init() {
|
||||||
System.loadLibrary("vtm-jni");
|
System.loadLibrary("vtm-jni");
|
||||||
}
|
}
|
||||||
|
|
||||||
protected final AndroidMap mMap;
|
protected AndroidMap mMap;
|
||||||
protected final GestureDetector mGestureDetector;
|
protected GestureDetector mGestureDetector;
|
||||||
protected final AndroidMotionEvent mMotionEvent;
|
protected AndroidMotionEvent mMotionEvent;
|
||||||
|
|
||||||
public MapView(Context context) {
|
public MapView(Context context) {
|
||||||
this(context, null);
|
this(context, null);
|
||||||
@@ -63,19 +66,26 @@ public class MapView extends GLSurfaceView {
|
|||||||
public MapView(Context context, AttributeSet attributeSet) {
|
public MapView(Context context, AttributeSet attributeSet) {
|
||||||
super(context, attributeSet);
|
super(context, attributeSet);
|
||||||
|
|
||||||
|
if (isInEditMode())
|
||||||
|
return;
|
||||||
|
|
||||||
|
init();
|
||||||
|
|
||||||
/* Not sure if this makes sense */
|
/* Not sure if this makes sense */
|
||||||
this.setWillNotDraw(true);
|
this.setWillNotDraw(true);
|
||||||
this.setClickable(true);
|
this.setClickable(true);
|
||||||
this.setFocusable(true);
|
this.setFocusable(true);
|
||||||
this.setFocusableInTouchMode(true);
|
this.setFocusableInTouchMode(true);
|
||||||
|
|
||||||
/* Setup android backedn */
|
/* Setup android backend */
|
||||||
AndroidGraphics.init();
|
AndroidGraphics.init();
|
||||||
AndroidAssets.init(context);
|
AndroidAssets.init(context);
|
||||||
GLAdapter.init(new AndroidGL());
|
GLAdapter.init(new AndroidGL());
|
||||||
|
|
||||||
DisplayMetrics metrics = getResources().getDisplayMetrics();
|
DisplayMetrics metrics = getResources().getDisplayMetrics();
|
||||||
CanvasAdapter.dpi = (int) Math.max(metrics.xdpi, metrics.ydpi);
|
CanvasAdapter.dpi = (int) (metrics.scaledDensity * CanvasAdapter.DEFAULT_DPI);
|
||||||
|
if (!Parameters.CUSTOM_TILE_SIZE)
|
||||||
|
Tile.SIZE = Tile.calculateTileSize();
|
||||||
|
|
||||||
/* Initialize the Map */
|
/* Initialize the Map */
|
||||||
mMap = new AndroidMap(this);
|
mMap = new AndroidMap(this);
|
||||||
@@ -94,15 +104,17 @@ public class MapView extends GLSurfaceView {
|
|||||||
mMap.clearMap();
|
mMap.clearMap();
|
||||||
mMap.updateMap(false);
|
mMap.updateMap(false);
|
||||||
|
|
||||||
GestureHandler gestureHandler = new GestureHandler(mMap);
|
if (!Parameters.MAP_EVENT_LAYER2) {
|
||||||
mGestureDetector = new GestureDetector(context, gestureHandler);
|
GestureHandler gestureHandler = new GestureHandler(mMap);
|
||||||
mGestureDetector.setOnDoubleTapListener(gestureHandler);
|
mGestureDetector = new GestureDetector(context, gestureHandler);
|
||||||
|
mGestureDetector.setOnDoubleTapListener(gestureHandler);
|
||||||
|
}
|
||||||
|
|
||||||
mMotionEvent = new AndroidMotionEvent();
|
mMotionEvent = new AndroidMotionEvent();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onStop() {
|
public void onDestroy() {
|
||||||
|
mMap.destroy();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onPause() {
|
public void onPause() {
|
||||||
@@ -116,14 +128,16 @@ public class MapView extends GLSurfaceView {
|
|||||||
@SuppressLint("ClickableViewAccessibility")
|
@SuppressLint("ClickableViewAccessibility")
|
||||||
@Override
|
@Override
|
||||||
public boolean onTouchEvent(android.view.MotionEvent motionEvent) {
|
public boolean onTouchEvent(android.view.MotionEvent motionEvent) {
|
||||||
|
|
||||||
if (!isClickable())
|
if (!isClickable())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (mGestureDetector.onTouchEvent(motionEvent))
|
if (mGestureDetector != null) {
|
||||||
return true;
|
if (mGestureDetector.onTouchEvent(motionEvent))
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
mMap.input.fire(null, mMotionEvent.wrap(motionEvent));
|
mMap.input.fire(null, mMotionEvent.wrap(motionEvent));
|
||||||
|
mMotionEvent.recycle();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -133,8 +147,10 @@ public class MapView extends GLSurfaceView {
|
|||||||
|
|
||||||
super.onSizeChanged(width, height, oldWidth, oldHeight);
|
super.onSizeChanged(width, height, oldWidth, oldHeight);
|
||||||
|
|
||||||
if (width > 0 && height > 0)
|
if (!isInEditMode()) {
|
||||||
mMap.viewport().setScreenSize(width, height);
|
if (width > 0 && height > 0)
|
||||||
|
mMap.viewport().setScreenSize(width, height);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public Map map() {
|
public Map map() {
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2013 Hannes Janetzek
|
* Copyright 2013 Hannes Janetzek
|
||||||
* Copyright 2016 devemux86
|
* Copyright 2016-2017 devemux86
|
||||||
|
* Copyright 2017 nebular
|
||||||
|
* Copyright 2017 Longri
|
||||||
*
|
*
|
||||||
* This file is part of the OpenScienceMap project (http://www.opensciencemap.org).
|
* This file is part of the OpenScienceMap project (http://www.opensciencemap.org).
|
||||||
*
|
*
|
||||||
@@ -17,7 +19,9 @@
|
|||||||
*/
|
*/
|
||||||
package org.oscim.android.canvas;
|
package org.oscim.android.canvas;
|
||||||
|
|
||||||
|
import android.graphics.Color;
|
||||||
import android.graphics.PorterDuff;
|
import android.graphics.PorterDuff;
|
||||||
|
import android.graphics.RectF;
|
||||||
|
|
||||||
import org.oscim.backend.canvas.Bitmap;
|
import org.oscim.backend.canvas.Bitmap;
|
||||||
import org.oscim.backend.canvas.Canvas;
|
import org.oscim.backend.canvas.Canvas;
|
||||||
@@ -62,13 +66,34 @@ public class AndroidCanvas implements Canvas {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void drawLine(int x1, int y1, int x2, int y2, Paint paint) {
|
public void drawBitmapScaled(Bitmap bitmap) {
|
||||||
|
android.graphics.Bitmap scaledBitmap = android.graphics.Bitmap.createScaledBitmap(
|
||||||
|
((AndroidBitmap) bitmap).mBitmap, canvas.getWidth(), canvas.getHeight(), true);
|
||||||
|
canvas.drawBitmap(scaledBitmap, 0, 0, null);
|
||||||
|
scaledBitmap.recycle();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void drawCircle(float x, float y, float radius, Paint paint) {
|
||||||
|
canvas.drawCircle(x, y, radius, ((AndroidPaint) paint).mPaint);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void drawLine(float x1, float y1, float x2, float y2, Paint paint) {
|
||||||
canvas.drawLine(x1, y1, x2, y2, ((AndroidPaint) paint).mPaint);
|
canvas.drawLine(x1, y1, x2, y2, ((AndroidPaint) paint).mPaint);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void fillColor(int color) {
|
public void fillColor(int color) {
|
||||||
canvas.drawColor(color, PorterDuff.Mode.CLEAR);
|
canvas.drawColor(color, color == Color.TRANSPARENT ? PorterDuff.Mode.CLEAR : PorterDuff.Mode.SRC_OVER);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
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
|
@Override
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2010, 2011, 2012 mapsforge.org
|
* Copyright 2010, 2011, 2012 mapsforge.org
|
||||||
* Copyright 2016 devemux86
|
* Copyright 2016-2017 devemux86
|
||||||
|
* Copyright 2017 Longri
|
||||||
*
|
*
|
||||||
* This file is part of the OpenScienceMap project (http://www.opensciencemap.org).
|
* This file is part of the OpenScienceMap project (http://www.opensciencemap.org).
|
||||||
*
|
*
|
||||||
@@ -23,6 +24,7 @@ import android.graphics.drawable.BitmapDrawable;
|
|||||||
import android.graphics.drawable.Drawable;
|
import android.graphics.drawable.Drawable;
|
||||||
|
|
||||||
import org.oscim.backend.CanvasAdapter;
|
import org.oscim.backend.CanvasAdapter;
|
||||||
|
import org.oscim.backend.Platform;
|
||||||
import org.oscim.backend.canvas.Bitmap;
|
import org.oscim.backend.canvas.Bitmap;
|
||||||
import org.oscim.backend.canvas.Canvas;
|
import org.oscim.backend.canvas.Canvas;
|
||||||
import org.oscim.backend.canvas.Paint;
|
import org.oscim.backend.canvas.Paint;
|
||||||
@@ -36,6 +38,7 @@ public final class AndroidGraphics extends CanvasAdapter {
|
|||||||
|
|
||||||
public static void init() {
|
public static void init() {
|
||||||
CanvasAdapter.init(new AndroidGraphics());
|
CanvasAdapter.init(new AndroidGraphics());
|
||||||
|
CanvasAdapter.platform = Platform.ANDROID;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static android.graphics.Paint getAndroidPaint(Paint paint) {
|
public static android.graphics.Paint getAndroidPaint(Paint paint) {
|
||||||
@@ -56,23 +59,13 @@ public final class AndroidGraphics extends CanvasAdapter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Bitmap decodeSvgBitmapImpl(InputStream inputStream) {
|
public Bitmap decodeSvgBitmapImpl(InputStream inputStream, int width, int height, int percent) throws IOException {
|
||||||
try {
|
return new AndroidSvgBitmap(inputStream, width, height, percent);
|
||||||
return new AndroidSvgBitmap(inputStream);
|
|
||||||
} catch (IOException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Bitmap loadBitmapAssetImpl(String relativePathPrefix, String src) {
|
public Bitmap loadBitmapAssetImpl(String relativePathPrefix, String src, int width, int height, int percent) throws IOException {
|
||||||
try {
|
return createBitmap(relativePathPrefix, src, width, height, percent);
|
||||||
return createBitmap(relativePathPrefix, src);
|
|
||||||
} catch (IOException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -109,7 +102,7 @@ public final class AndroidGraphics extends CanvasAdapter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static Bitmap drawableToBitmap(Resources res, int resId) {
|
public static Bitmap drawableToBitmap(Resources res, int resId) {
|
||||||
return new AndroidBitmap(res.openRawResource(resId));
|
return drawableToBitmap(res.getDrawable(resId));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2010, 2011, 2012 mapsforge.org
|
* Copyright 2010, 2011, 2012 mapsforge.org
|
||||||
* Copyright 2016 devemux86
|
* Copyright 2016-2017 devemux86
|
||||||
|
* Copyright 2017 nebular
|
||||||
*
|
*
|
||||||
* This file is part of the OpenScienceMap project (http://www.opensciencemap.org).
|
* This file is part of the OpenScienceMap project (http://www.opensciencemap.org).
|
||||||
*
|
*
|
||||||
@@ -100,8 +101,7 @@ class AndroidPaint implements Paint {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setTextAlign(Align align) {
|
public void setTextAlign(Align align) {
|
||||||
// Align text in text layer
|
mPaint.setTextAlign(android.graphics.Paint.Align.valueOf(align.name()));
|
||||||
//mPaint.setTextAlign(android.graphics.Paint.Align.valueOf(align.name()));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -134,6 +134,21 @@ class AndroidPaint implements Paint {
|
|||||||
return Math.abs(fm.bottom);
|
return Math.abs(fm.bottom);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public float getStrokeWidth() {
|
||||||
|
return mPaint.getStrokeWidth();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Style getStyle() {
|
||||||
|
switch (mPaint.getStyle()) {
|
||||||
|
case STROKE:
|
||||||
|
return Style.STROKE;
|
||||||
|
default:
|
||||||
|
return Style.FILL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public float getTextHeight(String text) {
|
public float getTextHeight(String text) {
|
||||||
mPaint.getTextBounds(text, 0, text.length(), rect);
|
mPaint.getTextBounds(text, 0, text.length(), rect);
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2016 devemux86
|
* Copyright 2010, 2011, 2012 mapsforge.org
|
||||||
|
* Copyright 2013-2014 Ludwig M Brinckmann
|
||||||
|
* Copyright 2014-2017 devemux86
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify it under the
|
* This program is free software: you can redistribute it and/or modify it under the
|
||||||
* terms of the GNU Lesser General Public License as published by the Free Software
|
* terms of the GNU Lesser General Public License as published by the Free Software
|
||||||
@@ -74,13 +76,13 @@ public class AndroidSvgBitmap extends AndroidBitmap {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static android.graphics.Bitmap getResourceBitmapImpl(InputStream inputStream) throws IOException {
|
private static android.graphics.Bitmap getResourceBitmapImpl(InputStream inputStream, int width, int height, int percent) throws IOException {
|
||||||
synchronized (SVG.getVersion()) {
|
synchronized (SVG.getVersion()) {
|
||||||
return getResourceBitmap(inputStream, CanvasAdapter.dpi / 160, DEFAULT_SIZE, 0, 0, 100);
|
return getResourceBitmap(inputStream, CanvasAdapter.getScale(), DEFAULT_SIZE, width, height, percent);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public AndroidSvgBitmap(InputStream inputStream) throws IOException {
|
public AndroidSvgBitmap(InputStream inputStream, int width, int height, int percent) throws IOException {
|
||||||
super(getResourceBitmapImpl(inputStream));
|
super(getResourceBitmapImpl(inputStream, width, height, percent));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2013 Hannes Janetzek
|
* Copyright 2013 Hannes Janetzek
|
||||||
|
* Copyright 2016 Andrey Novikov
|
||||||
*
|
*
|
||||||
* This file is part of the OpenScienceMap project (http://www.opensciencemap.org).
|
* This file is part of the OpenScienceMap project (http://www.opensciencemap.org).
|
||||||
*
|
*
|
||||||
@@ -20,10 +21,10 @@ import org.oscim.event.MotionEvent;
|
|||||||
|
|
||||||
public class AndroidMotionEvent extends MotionEvent {
|
public class AndroidMotionEvent extends MotionEvent {
|
||||||
|
|
||||||
android.view.MotionEvent mEvent;
|
private android.view.MotionEvent mEvent;
|
||||||
|
|
||||||
public MotionEvent wrap(android.view.MotionEvent e) {
|
public MotionEvent wrap(android.view.MotionEvent e) {
|
||||||
mEvent = e;
|
mEvent = android.view.MotionEvent.obtain(e);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -57,6 +58,16 @@ public class AndroidMotionEvent extends MotionEvent {
|
|||||||
return mEvent.getPointerCount();
|
return mEvent.getPointerCount();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public MotionEvent copy() {
|
||||||
|
return new AndroidMotionEvent().wrap(mEvent);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void recycle() {
|
||||||
|
mEvent.recycle();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public long getTime() {
|
public long getTime() {
|
||||||
return mEvent.getEventTime();
|
return mEvent.getEventTime();
|
||||||
|
|||||||
@@ -1,3 +1,20 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2013 Hannes Janetzek
|
||||||
|
* Copyright 2016 devemux86
|
||||||
|
*
|
||||||
|
* This file is part of the OpenScienceMap project (http://www.opensciencemap.org).
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify it under the
|
||||||
|
* terms of the GNU Lesser General Public License as published by the Free Software
|
||||||
|
* Foundation, either version 3 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||||
|
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||||
|
* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public License along with
|
||||||
|
* this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
package org.oscim.android.input;
|
package org.oscim.android.input;
|
||||||
|
|
||||||
import android.view.GestureDetector.OnDoubleTapListener;
|
import android.view.GestureDetector.OnDoubleTapListener;
|
||||||
@@ -11,16 +28,18 @@ public class GestureHandler implements OnGestureListener, OnDoubleTapListener {
|
|||||||
private final AndroidMotionEvent mMotionEvent;
|
private final AndroidMotionEvent mMotionEvent;
|
||||||
private final Map mMap;
|
private final Map mMap;
|
||||||
|
|
||||||
|
// Quick scale (double tap + swipe)
|
||||||
|
protected boolean quickScale;
|
||||||
|
|
||||||
public GestureHandler(Map map) {
|
public GestureHandler(Map map) {
|
||||||
mMotionEvent = new AndroidMotionEvent();
|
mMotionEvent = new AndroidMotionEvent();
|
||||||
mMap = map;
|
mMap = map;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* GesturListener */
|
/* OnGestureListener */
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onSingleTapUp(MotionEvent e) {
|
public boolean onSingleTapUp(MotionEvent e) {
|
||||||
// return mMap.handleGesture(Gesture.TAP, mMotionEvent.wrap(e));
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -35,6 +54,10 @@ public class GestureHandler implements OnGestureListener, OnDoubleTapListener {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onLongPress(MotionEvent e) {
|
public void onLongPress(MotionEvent e) {
|
||||||
|
// Quick scale (no long press)
|
||||||
|
if (quickScale)
|
||||||
|
return;
|
||||||
|
|
||||||
mMap.handleGesture(Gesture.LONG_PRESS, mMotionEvent.wrap(e));
|
mMap.handleGesture(Gesture.LONG_PRESS, mMotionEvent.wrap(e));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -45,10 +68,13 @@ public class GestureHandler implements OnGestureListener, OnDoubleTapListener {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onDown(MotionEvent e) {
|
public boolean onDown(MotionEvent e) {
|
||||||
|
quickScale = false;
|
||||||
|
|
||||||
return mMap.handleGesture(Gesture.PRESS, mMotionEvent.wrap(e));
|
return mMap.handleGesture(Gesture.PRESS, mMotionEvent.wrap(e));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* DoubleTapListener */
|
/* OnDoubleTapListener */
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onSingleTapConfirmed(MotionEvent e) {
|
public boolean onSingleTapConfirmed(MotionEvent e) {
|
||||||
return mMap.handleGesture(Gesture.TAP, mMotionEvent.wrap(e));
|
return mMap.handleGesture(Gesture.TAP, mMotionEvent.wrap(e));
|
||||||
@@ -56,6 +82,11 @@ public class GestureHandler implements OnGestureListener, OnDoubleTapListener {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onDoubleTapEvent(MotionEvent e) {
|
public boolean onDoubleTapEvent(MotionEvent e) {
|
||||||
|
int action = e.getActionMasked();
|
||||||
|
|
||||||
|
// Quick scale
|
||||||
|
quickScale = (action == MotionEvent.ACTION_MOVE);
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2010, 2011, 2012 mapsforge.org
|
* Copyright 2010, 2011, 2012 mapsforge.org
|
||||||
* Copyright 2016 devemux86
|
* Copyright 2016-2017 devemux86
|
||||||
|
* Copyright 2017 Andrey Novikov
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify it under the
|
* This program is free software: you can redistribute it and/or modify it under the
|
||||||
* terms of the GNU Lesser General Public License as published by the Free Software
|
* terms of the GNU Lesser General Public License as published by the Free Software
|
||||||
@@ -15,11 +16,12 @@
|
|||||||
*/
|
*/
|
||||||
package org.oscim.android.theme;
|
package org.oscim.android.theme;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.res.AssetManager;
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
|
|
||||||
import org.oscim.theme.IRenderTheme.ThemeException;
|
import org.oscim.theme.IRenderTheme.ThemeException;
|
||||||
import org.oscim.theme.ThemeFile;
|
import org.oscim.theme.ThemeFile;
|
||||||
|
import org.oscim.theme.ThemeUtils;
|
||||||
import org.oscim.theme.XmlRenderThemeMenuCallback;
|
import org.oscim.theme.XmlRenderThemeMenuCallback;
|
||||||
import org.oscim.utils.Utils;
|
import org.oscim.utils.Utils;
|
||||||
|
|
||||||
@@ -33,36 +35,33 @@ import java.io.InputStream;
|
|||||||
public class AssetsRenderTheme implements ThemeFile {
|
public class AssetsRenderTheme implements ThemeFile {
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
private final InputStream mInputStream;
|
private final AssetManager mAssetManager;
|
||||||
private final XmlRenderThemeMenuCallback mMenuCallback;
|
private final String mFileName;
|
||||||
|
private XmlRenderThemeMenuCallback mMenuCallback;
|
||||||
private final String mRelativePathPrefix;
|
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 relativePathPrefix the prefix for all relative resource paths.
|
||||||
* @param fileName the path to the XML render theme file.
|
* @param fileName the path to the XML render theme file.
|
||||||
* @throws ThemeException if an error occurs while reading the render theme XML.
|
* @throws ThemeException if an error occurs while reading the render theme XML.
|
||||||
*/
|
*/
|
||||||
public AssetsRenderTheme(Context context, String relativePathPrefix, String fileName) throws ThemeException {
|
public AssetsRenderTheme(AssetManager assetManager, String relativePathPrefix, String fileName) throws ThemeException {
|
||||||
this(context, relativePathPrefix, fileName, null);
|
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 relativePathPrefix the prefix for all relative resource paths.
|
||||||
* @param fileName the path to the XML render theme file.
|
* @param fileName the path to the XML render theme file.
|
||||||
* @param menuCallback the interface callback to create a settings menu on the fly.
|
* @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.
|
* @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;
|
mRelativePathPrefix = relativePathPrefix;
|
||||||
|
mFileName = fileName;
|
||||||
mMenuCallback = menuCallback;
|
mMenuCallback = menuCallback;
|
||||||
|
|
||||||
try {
|
|
||||||
mInputStream = context.getAssets().open((TextUtils.isEmpty(mRelativePathPrefix) ? "" : mRelativePathPrefix) + fileName);
|
|
||||||
} catch (IOException e) {
|
|
||||||
throw new ThemeException(e.getMessage());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -73,7 +72,7 @@ public class AssetsRenderTheme implements ThemeFile {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
AssetsRenderTheme other = (AssetsRenderTheme) obj;
|
AssetsRenderTheme other = (AssetsRenderTheme) obj;
|
||||||
if (mInputStream != other.mInputStream) {
|
if (getRenderThemeAsStream() != other.getRenderThemeAsStream()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!Utils.equals(mRelativePathPrefix, other.mRelativePathPrefix)) {
|
if (!Utils.equals(mRelativePathPrefix, other.mRelativePathPrefix)) {
|
||||||
@@ -94,6 +93,20 @@ public class AssetsRenderTheme implements ThemeFile {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public InputStream getRenderThemeAsStream() throws ThemeException {
|
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
|
||||||
|
public void setMenuCallback(XmlRenderThemeMenuCallback menuCallback) {
|
||||||
|
mMenuCallback = menuCallback;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,10 +13,6 @@
|
|||||||
<uses-permission android:name="android.permission.WAKE_LOCK" />
|
<uses-permission android:name="android.permission.WAKE_LOCK" />
|
||||||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
|
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
|
||||||
|
|
||||||
<uses-sdk
|
|
||||||
android:minSdkVersion="10"
|
|
||||||
android:targetSdkVersion="22" />
|
|
||||||
|
|
||||||
<application
|
<application
|
||||||
android:name=".App"
|
android:name=".App"
|
||||||
android:allowBackup="true"
|
android:allowBackup="true"
|
||||||
|
|||||||
674
vtm-app/COPYING
@@ -1,674 +0,0 @@
|
|||||||
GNU GENERAL PUBLIC LICENSE
|
|
||||||
Version 3, 29 June 2007
|
|
||||||
|
|
||||||
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
|
|
||||||
Everyone is permitted to copy and distribute verbatim copies
|
|
||||||
of this license document, but changing it is not allowed.
|
|
||||||
|
|
||||||
Preamble
|
|
||||||
|
|
||||||
The GNU General Public License is a free, copyleft license for
|
|
||||||
software and other kinds of works.
|
|
||||||
|
|
||||||
The licenses for most software and other practical works are designed
|
|
||||||
to take away your freedom to share and change the works. By contrast,
|
|
||||||
the GNU General Public License is intended to guarantee your freedom to
|
|
||||||
share and change all versions of a program--to make sure it remains free
|
|
||||||
software for all its users. We, the Free Software Foundation, use the
|
|
||||||
GNU General Public License for most of our software; it applies also to
|
|
||||||
any other work released this way by its authors. You can apply it to
|
|
||||||
your programs, too.
|
|
||||||
|
|
||||||
When we speak of free software, we are referring to freedom, not
|
|
||||||
price. Our General Public Licenses are designed to make sure that you
|
|
||||||
have the freedom to distribute copies of free software (and charge for
|
|
||||||
them if you wish), that you receive source code or can get it if you
|
|
||||||
want it, that you can change the software or use pieces of it in new
|
|
||||||
free programs, and that you know you can do these things.
|
|
||||||
|
|
||||||
To protect your rights, we need to prevent others from denying you
|
|
||||||
these rights or asking you to surrender the rights. Therefore, you have
|
|
||||||
certain responsibilities if you distribute copies of the software, or if
|
|
||||||
you modify it: responsibilities to respect the freedom of others.
|
|
||||||
|
|
||||||
For example, if you distribute copies of such a program, whether
|
|
||||||
gratis or for a fee, you must pass on to the recipients the same
|
|
||||||
freedoms that you received. You must make sure that they, too, receive
|
|
||||||
or can get the source code. And you must show them these terms so they
|
|
||||||
know their rights.
|
|
||||||
|
|
||||||
Developers that use the GNU GPL protect your rights with two steps:
|
|
||||||
(1) assert copyright on the software, and (2) offer you this License
|
|
||||||
giving you legal permission to copy, distribute and/or modify it.
|
|
||||||
|
|
||||||
For the developers' and authors' protection, the GPL clearly explains
|
|
||||||
that there is no warranty for this free software. For both users' and
|
|
||||||
authors' sake, the GPL requires that modified versions be marked as
|
|
||||||
changed, so that their problems will not be attributed erroneously to
|
|
||||||
authors of previous versions.
|
|
||||||
|
|
||||||
Some devices are designed to deny users access to install or run
|
|
||||||
modified versions of the software inside them, although the manufacturer
|
|
||||||
can do so. This is fundamentally incompatible with the aim of
|
|
||||||
protecting users' freedom to change the software. The systematic
|
|
||||||
pattern of such abuse occurs in the area of products for individuals to
|
|
||||||
use, which is precisely where it is most unacceptable. Therefore, we
|
|
||||||
have designed this version of the GPL to prohibit the practice for those
|
|
||||||
products. If such problems arise substantially in other domains, we
|
|
||||||
stand ready to extend this provision to those domains in future versions
|
|
||||||
of the GPL, as needed to protect the freedom of users.
|
|
||||||
|
|
||||||
Finally, every program is threatened constantly by software patents.
|
|
||||||
States should not allow patents to restrict development and use of
|
|
||||||
software on general-purpose computers, but in those that do, we wish to
|
|
||||||
avoid the special danger that patents applied to a free program could
|
|
||||||
make it effectively proprietary. To prevent this, the GPL assures that
|
|
||||||
patents cannot be used to render the program non-free.
|
|
||||||
|
|
||||||
The precise terms and conditions for copying, distribution and
|
|
||||||
modification follow.
|
|
||||||
|
|
||||||
TERMS AND CONDITIONS
|
|
||||||
|
|
||||||
0. Definitions.
|
|
||||||
|
|
||||||
"This License" refers to version 3 of the GNU General Public License.
|
|
||||||
|
|
||||||
"Copyright" also means copyright-like laws that apply to other kinds of
|
|
||||||
works, such as semiconductor masks.
|
|
||||||
|
|
||||||
"The Program" refers to any copyrightable work licensed under this
|
|
||||||
License. Each licensee is addressed as "you". "Licensees" and
|
|
||||||
"recipients" may be individuals or organizations.
|
|
||||||
|
|
||||||
To "modify" a work means to copy from or adapt all or part of the work
|
|
||||||
in a fashion requiring copyright permission, other than the making of an
|
|
||||||
exact copy. The resulting work is called a "modified version" of the
|
|
||||||
earlier work or a work "based on" the earlier work.
|
|
||||||
|
|
||||||
A "covered work" means either the unmodified Program or a work based
|
|
||||||
on the Program.
|
|
||||||
|
|
||||||
To "propagate" a work means to do anything with it that, without
|
|
||||||
permission, would make you directly or secondarily liable for
|
|
||||||
infringement under applicable copyright law, except executing it on a
|
|
||||||
computer or modifying a private copy. Propagation includes copying,
|
|
||||||
distribution (with or without modification), making available to the
|
|
||||||
public, and in some countries other activities as well.
|
|
||||||
|
|
||||||
To "convey" a work means any kind of propagation that enables other
|
|
||||||
parties to make or receive copies. Mere interaction with a user through
|
|
||||||
a computer network, with no transfer of a copy, is not conveying.
|
|
||||||
|
|
||||||
An interactive user interface displays "Appropriate Legal Notices"
|
|
||||||
to the extent that it includes a convenient and prominently visible
|
|
||||||
feature that (1) displays an appropriate copyright notice, and (2)
|
|
||||||
tells the user that there is no warranty for the work (except to the
|
|
||||||
extent that warranties are provided), that licensees may convey the
|
|
||||||
work under this License, and how to view a copy of this License. If
|
|
||||||
the interface presents a list of user commands or options, such as a
|
|
||||||
menu, a prominent item in the list meets this criterion.
|
|
||||||
|
|
||||||
1. Source Code.
|
|
||||||
|
|
||||||
The "source code" for a work means the preferred form of the work
|
|
||||||
for making modifications to it. "Object code" means any non-source
|
|
||||||
form of a work.
|
|
||||||
|
|
||||||
A "Standard Interface" means an interface that either is an official
|
|
||||||
standard defined by a recognized standards body, or, in the case of
|
|
||||||
interfaces specified for a particular programming language, one that
|
|
||||||
is widely used among developers working in that language.
|
|
||||||
|
|
||||||
The "System Libraries" of an executable work include anything, other
|
|
||||||
than the work as a whole, that (a) is included in the normal form of
|
|
||||||
packaging a Major Component, but which is not part of that Major
|
|
||||||
Component, and (b) serves only to enable use of the work with that
|
|
||||||
Major Component, or to implement a Standard Interface for which an
|
|
||||||
implementation is available to the public in source code form. A
|
|
||||||
"Major Component", in this context, means a major essential component
|
|
||||||
(kernel, window system, and so on) of the specific operating system
|
|
||||||
(if any) on which the executable work runs, or a compiler used to
|
|
||||||
produce the work, or an object code interpreter used to run it.
|
|
||||||
|
|
||||||
The "Corresponding Source" for a work in object code form means all
|
|
||||||
the source code needed to generate, install, and (for an executable
|
|
||||||
work) run the object code and to modify the work, including scripts to
|
|
||||||
control those activities. However, it does not include the work's
|
|
||||||
System Libraries, or general-purpose tools or generally available free
|
|
||||||
programs which are used unmodified in performing those activities but
|
|
||||||
which are not part of the work. For example, Corresponding Source
|
|
||||||
includes interface definition files associated with source files for
|
|
||||||
the work, and the source code for shared libraries and dynamically
|
|
||||||
linked subprograms that the work is specifically designed to require,
|
|
||||||
such as by intimate data communication or control flow between those
|
|
||||||
subprograms and other parts of the work.
|
|
||||||
|
|
||||||
The Corresponding Source need not include anything that users
|
|
||||||
can regenerate automatically from other parts of the Corresponding
|
|
||||||
Source.
|
|
||||||
|
|
||||||
The Corresponding Source for a work in source code form is that
|
|
||||||
same work.
|
|
||||||
|
|
||||||
2. Basic Permissions.
|
|
||||||
|
|
||||||
All rights granted under this License are granted for the term of
|
|
||||||
copyright on the Program, and are irrevocable provided the stated
|
|
||||||
conditions are met. This License explicitly affirms your unlimited
|
|
||||||
permission to run the unmodified Program. The output from running a
|
|
||||||
covered work is covered by this License only if the output, given its
|
|
||||||
content, constitutes a covered work. This License acknowledges your
|
|
||||||
rights of fair use or other equivalent, as provided by copyright law.
|
|
||||||
|
|
||||||
You may make, run and propagate covered works that you do not
|
|
||||||
convey, without conditions so long as your license otherwise remains
|
|
||||||
in force. You may convey covered works to others for the sole purpose
|
|
||||||
of having them make modifications exclusively for you, or provide you
|
|
||||||
with facilities for running those works, provided that you comply with
|
|
||||||
the terms of this License in conveying all material for which you do
|
|
||||||
not control copyright. Those thus making or running the covered works
|
|
||||||
for you must do so exclusively on your behalf, under your direction
|
|
||||||
and control, on terms that prohibit them from making any copies of
|
|
||||||
your copyrighted material outside their relationship with you.
|
|
||||||
|
|
||||||
Conveying under any other circumstances is permitted solely under
|
|
||||||
the conditions stated below. Sublicensing is not allowed; section 10
|
|
||||||
makes it unnecessary.
|
|
||||||
|
|
||||||
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
|
||||||
|
|
||||||
No covered work shall be deemed part of an effective technological
|
|
||||||
measure under any applicable law fulfilling obligations under article
|
|
||||||
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
|
||||||
similar laws prohibiting or restricting circumvention of such
|
|
||||||
measures.
|
|
||||||
|
|
||||||
When you convey a covered work, you waive any legal power to forbid
|
|
||||||
circumvention of technological measures to the extent such circumvention
|
|
||||||
is effected by exercising rights under this License with respect to
|
|
||||||
the covered work, and you disclaim any intention to limit operation or
|
|
||||||
modification of the work as a means of enforcing, against the work's
|
|
||||||
users, your or third parties' legal rights to forbid circumvention of
|
|
||||||
technological measures.
|
|
||||||
|
|
||||||
4. Conveying Verbatim Copies.
|
|
||||||
|
|
||||||
You may convey verbatim copies of the Program's source code as you
|
|
||||||
receive it, in any medium, provided that you conspicuously and
|
|
||||||
appropriately publish on each copy an appropriate copyright notice;
|
|
||||||
keep intact all notices stating that this License and any
|
|
||||||
non-permissive terms added in accord with section 7 apply to the code;
|
|
||||||
keep intact all notices of the absence of any warranty; and give all
|
|
||||||
recipients a copy of this License along with the Program.
|
|
||||||
|
|
||||||
You may charge any price or no price for each copy that you convey,
|
|
||||||
and you may offer support or warranty protection for a fee.
|
|
||||||
|
|
||||||
5. Conveying Modified Source Versions.
|
|
||||||
|
|
||||||
You may convey a work based on the Program, or the modifications to
|
|
||||||
produce it from the Program, in the form of source code under the
|
|
||||||
terms of section 4, provided that you also meet all of these conditions:
|
|
||||||
|
|
||||||
a) The work must carry prominent notices stating that you modified
|
|
||||||
it, and giving a relevant date.
|
|
||||||
|
|
||||||
b) The work must carry prominent notices stating that it is
|
|
||||||
released under this License and any conditions added under section
|
|
||||||
7. This requirement modifies the requirement in section 4 to
|
|
||||||
"keep intact all notices".
|
|
||||||
|
|
||||||
c) You must license the entire work, as a whole, under this
|
|
||||||
License to anyone who comes into possession of a copy. This
|
|
||||||
License will therefore apply, along with any applicable section 7
|
|
||||||
additional terms, to the whole of the work, and all its parts,
|
|
||||||
regardless of how they are packaged. This License gives no
|
|
||||||
permission to license the work in any other way, but it does not
|
|
||||||
invalidate such permission if you have separately received it.
|
|
||||||
|
|
||||||
d) If the work has interactive user interfaces, each must display
|
|
||||||
Appropriate Legal Notices; however, if the Program has interactive
|
|
||||||
interfaces that do not display Appropriate Legal Notices, your
|
|
||||||
work need not make them do so.
|
|
||||||
|
|
||||||
A compilation of a covered work with other separate and independent
|
|
||||||
works, which are not by their nature extensions of the covered work,
|
|
||||||
and which are not combined with it such as to form a larger program,
|
|
||||||
in or on a volume of a storage or distribution medium, is called an
|
|
||||||
"aggregate" if the compilation and its resulting copyright are not
|
|
||||||
used to limit the access or legal rights of the compilation's users
|
|
||||||
beyond what the individual works permit. Inclusion of a covered work
|
|
||||||
in an aggregate does not cause this License to apply to the other
|
|
||||||
parts of the aggregate.
|
|
||||||
|
|
||||||
6. Conveying Non-Source Forms.
|
|
||||||
|
|
||||||
You may convey a covered work in object code form under the terms
|
|
||||||
of sections 4 and 5, provided that you also convey the
|
|
||||||
machine-readable Corresponding Source under the terms of this License,
|
|
||||||
in one of these ways:
|
|
||||||
|
|
||||||
a) Convey the object code in, or embodied in, a physical product
|
|
||||||
(including a physical distribution medium), accompanied by the
|
|
||||||
Corresponding Source fixed on a durable physical medium
|
|
||||||
customarily used for software interchange.
|
|
||||||
|
|
||||||
b) Convey the object code in, or embodied in, a physical product
|
|
||||||
(including a physical distribution medium), accompanied by a
|
|
||||||
written offer, valid for at least three years and valid for as
|
|
||||||
long as you offer spare parts or customer support for that product
|
|
||||||
model, to give anyone who possesses the object code either (1) a
|
|
||||||
copy of the Corresponding Source for all the software in the
|
|
||||||
product that is covered by this License, on a durable physical
|
|
||||||
medium customarily used for software interchange, for a price no
|
|
||||||
more than your reasonable cost of physically performing this
|
|
||||||
conveying of source, or (2) access to copy the
|
|
||||||
Corresponding Source from a network server at no charge.
|
|
||||||
|
|
||||||
c) Convey individual copies of the object code with a copy of the
|
|
||||||
written offer to provide the Corresponding Source. This
|
|
||||||
alternative is allowed only occasionally and noncommercially, and
|
|
||||||
only if you received the object code with such an offer, in accord
|
|
||||||
with subsection 6b.
|
|
||||||
|
|
||||||
d) Convey the object code by offering access from a designated
|
|
||||||
place (gratis or for a charge), and offer equivalent access to the
|
|
||||||
Corresponding Source in the same way through the same place at no
|
|
||||||
further charge. You need not require recipients to copy the
|
|
||||||
Corresponding Source along with the object code. If the place to
|
|
||||||
copy the object code is a network server, the Corresponding Source
|
|
||||||
may be on a different server (operated by you or a third party)
|
|
||||||
that supports equivalent copying facilities, provided you maintain
|
|
||||||
clear directions next to the object code saying where to find the
|
|
||||||
Corresponding Source. Regardless of what server hosts the
|
|
||||||
Corresponding Source, you remain obligated to ensure that it is
|
|
||||||
available for as long as needed to satisfy these requirements.
|
|
||||||
|
|
||||||
e) Convey the object code using peer-to-peer transmission, provided
|
|
||||||
you inform other peers where the object code and Corresponding
|
|
||||||
Source of the work are being offered to the general public at no
|
|
||||||
charge under subsection 6d.
|
|
||||||
|
|
||||||
A separable portion of the object code, whose source code is excluded
|
|
||||||
from the Corresponding Source as a System Library, need not be
|
|
||||||
included in conveying the object code work.
|
|
||||||
|
|
||||||
A "User Product" is either (1) a "consumer product", which means any
|
|
||||||
tangible personal property which is normally used for personal, family,
|
|
||||||
or household purposes, or (2) anything designed or sold for incorporation
|
|
||||||
into a dwelling. In determining whether a product is a consumer product,
|
|
||||||
doubtful cases shall be resolved in favor of coverage. For a particular
|
|
||||||
product received by a particular user, "normally used" refers to a
|
|
||||||
typical or common use of that class of product, regardless of the status
|
|
||||||
of the particular user or of the way in which the particular user
|
|
||||||
actually uses, or expects or is expected to use, the product. A product
|
|
||||||
is a consumer product regardless of whether the product has substantial
|
|
||||||
commercial, industrial or non-consumer uses, unless such uses represent
|
|
||||||
the only significant mode of use of the product.
|
|
||||||
|
|
||||||
"Installation Information" for a User Product means any methods,
|
|
||||||
procedures, authorization keys, or other information required to install
|
|
||||||
and execute modified versions of a covered work in that User Product from
|
|
||||||
a modified version of its Corresponding Source. The information must
|
|
||||||
suffice to ensure that the continued functioning of the modified object
|
|
||||||
code is in no case prevented or interfered with solely because
|
|
||||||
modification has been made.
|
|
||||||
|
|
||||||
If you convey an object code work under this section in, or with, or
|
|
||||||
specifically for use in, a User Product, and the conveying occurs as
|
|
||||||
part of a transaction in which the right of possession and use of the
|
|
||||||
User Product is transferred to the recipient in perpetuity or for a
|
|
||||||
fixed term (regardless of how the transaction is characterized), the
|
|
||||||
Corresponding Source conveyed under this section must be accompanied
|
|
||||||
by the Installation Information. But this requirement does not apply
|
|
||||||
if neither you nor any third party retains the ability to install
|
|
||||||
modified object code on the User Product (for example, the work has
|
|
||||||
been installed in ROM).
|
|
||||||
|
|
||||||
The requirement to provide Installation Information does not include a
|
|
||||||
requirement to continue to provide support service, warranty, or updates
|
|
||||||
for a work that has been modified or installed by the recipient, or for
|
|
||||||
the User Product in which it has been modified or installed. Access to a
|
|
||||||
network may be denied when the modification itself materially and
|
|
||||||
adversely affects the operation of the network or violates the rules and
|
|
||||||
protocols for communication across the network.
|
|
||||||
|
|
||||||
Corresponding Source conveyed, and Installation Information provided,
|
|
||||||
in accord with this section must be in a format that is publicly
|
|
||||||
documented (and with an implementation available to the public in
|
|
||||||
source code form), and must require no special password or key for
|
|
||||||
unpacking, reading or copying.
|
|
||||||
|
|
||||||
7. Additional Terms.
|
|
||||||
|
|
||||||
"Additional permissions" are terms that supplement the terms of this
|
|
||||||
License by making exceptions from one or more of its conditions.
|
|
||||||
Additional permissions that are applicable to the entire Program shall
|
|
||||||
be treated as though they were included in this License, to the extent
|
|
||||||
that they are valid under applicable law. If additional permissions
|
|
||||||
apply only to part of the Program, that part may be used separately
|
|
||||||
under those permissions, but the entire Program remains governed by
|
|
||||||
this License without regard to the additional permissions.
|
|
||||||
|
|
||||||
When you convey a copy of a covered work, you may at your option
|
|
||||||
remove any additional permissions from that copy, or from any part of
|
|
||||||
it. (Additional permissions may be written to require their own
|
|
||||||
removal in certain cases when you modify the work.) You may place
|
|
||||||
additional permissions on material, added by you to a covered work,
|
|
||||||
for which you have or can give appropriate copyright permission.
|
|
||||||
|
|
||||||
Notwithstanding any other provision of this License, for material you
|
|
||||||
add to a covered work, you may (if authorized by the copyright holders of
|
|
||||||
that material) supplement the terms of this License with terms:
|
|
||||||
|
|
||||||
a) Disclaiming warranty or limiting liability differently from the
|
|
||||||
terms of sections 15 and 16 of this License; or
|
|
||||||
|
|
||||||
b) Requiring preservation of specified reasonable legal notices or
|
|
||||||
author attributions in that material or in the Appropriate Legal
|
|
||||||
Notices displayed by works containing it; or
|
|
||||||
|
|
||||||
c) Prohibiting misrepresentation of the origin of that material, or
|
|
||||||
requiring that modified versions of such material be marked in
|
|
||||||
reasonable ways as different from the original version; or
|
|
||||||
|
|
||||||
d) Limiting the use for publicity purposes of names of licensors or
|
|
||||||
authors of the material; or
|
|
||||||
|
|
||||||
e) Declining to grant rights under trademark law for use of some
|
|
||||||
trade names, trademarks, or service marks; or
|
|
||||||
|
|
||||||
f) Requiring indemnification of licensors and authors of that
|
|
||||||
material by anyone who conveys the material (or modified versions of
|
|
||||||
it) with contractual assumptions of liability to the recipient, for
|
|
||||||
any liability that these contractual assumptions directly impose on
|
|
||||||
those licensors and authors.
|
|
||||||
|
|
||||||
All other non-permissive additional terms are considered "further
|
|
||||||
restrictions" within the meaning of section 10. If the Program as you
|
|
||||||
received it, or any part of it, contains a notice stating that it is
|
|
||||||
governed by this License along with a term that is a further
|
|
||||||
restriction, you may remove that term. If a license document contains
|
|
||||||
a further restriction but permits relicensing or conveying under this
|
|
||||||
License, you may add to a covered work material governed by the terms
|
|
||||||
of that license document, provided that the further restriction does
|
|
||||||
not survive such relicensing or conveying.
|
|
||||||
|
|
||||||
If you add terms to a covered work in accord with this section, you
|
|
||||||
must place, in the relevant source files, a statement of the
|
|
||||||
additional terms that apply to those files, or a notice indicating
|
|
||||||
where to find the applicable terms.
|
|
||||||
|
|
||||||
Additional terms, permissive or non-permissive, may be stated in the
|
|
||||||
form of a separately written license, or stated as exceptions;
|
|
||||||
the above requirements apply either way.
|
|
||||||
|
|
||||||
8. Termination.
|
|
||||||
|
|
||||||
You may not propagate or modify a covered work except as expressly
|
|
||||||
provided under this License. Any attempt otherwise to propagate or
|
|
||||||
modify it is void, and will automatically terminate your rights under
|
|
||||||
this License (including any patent licenses granted under the third
|
|
||||||
paragraph of section 11).
|
|
||||||
|
|
||||||
However, if you cease all violation of this License, then your
|
|
||||||
license from a particular copyright holder is reinstated (a)
|
|
||||||
provisionally, unless and until the copyright holder explicitly and
|
|
||||||
finally terminates your license, and (b) permanently, if the copyright
|
|
||||||
holder fails to notify you of the violation by some reasonable means
|
|
||||||
prior to 60 days after the cessation.
|
|
||||||
|
|
||||||
Moreover, your license from a particular copyright holder is
|
|
||||||
reinstated permanently if the copyright holder notifies you of the
|
|
||||||
violation by some reasonable means, this is the first time you have
|
|
||||||
received notice of violation of this License (for any work) from that
|
|
||||||
copyright holder, and you cure the violation prior to 30 days after
|
|
||||||
your receipt of the notice.
|
|
||||||
|
|
||||||
Termination of your rights under this section does not terminate the
|
|
||||||
licenses of parties who have received copies or rights from you under
|
|
||||||
this License. If your rights have been terminated and not permanently
|
|
||||||
reinstated, you do not qualify to receive new licenses for the same
|
|
||||||
material under section 10.
|
|
||||||
|
|
||||||
9. Acceptance Not Required for Having Copies.
|
|
||||||
|
|
||||||
You are not required to accept this License in order to receive or
|
|
||||||
run a copy of the Program. Ancillary propagation of a covered work
|
|
||||||
occurring solely as a consequence of using peer-to-peer transmission
|
|
||||||
to receive a copy likewise does not require acceptance. However,
|
|
||||||
nothing other than this License grants you permission to propagate or
|
|
||||||
modify any covered work. These actions infringe copyright if you do
|
|
||||||
not accept this License. Therefore, by modifying or propagating a
|
|
||||||
covered work, you indicate your acceptance of this License to do so.
|
|
||||||
|
|
||||||
10. Automatic Licensing of Downstream Recipients.
|
|
||||||
|
|
||||||
Each time you convey a covered work, the recipient automatically
|
|
||||||
receives a license from the original licensors, to run, modify and
|
|
||||||
propagate that work, subject to this License. You are not responsible
|
|
||||||
for enforcing compliance by third parties with this License.
|
|
||||||
|
|
||||||
An "entity transaction" is a transaction transferring control of an
|
|
||||||
organization, or substantially all assets of one, or subdividing an
|
|
||||||
organization, or merging organizations. If propagation of a covered
|
|
||||||
work results from an entity transaction, each party to that
|
|
||||||
transaction who receives a copy of the work also receives whatever
|
|
||||||
licenses to the work the party's predecessor in interest had or could
|
|
||||||
give under the previous paragraph, plus a right to possession of the
|
|
||||||
Corresponding Source of the work from the predecessor in interest, if
|
|
||||||
the predecessor has it or can get it with reasonable efforts.
|
|
||||||
|
|
||||||
You may not impose any further restrictions on the exercise of the
|
|
||||||
rights granted or affirmed under this License. For example, you may
|
|
||||||
not impose a license fee, royalty, or other charge for exercise of
|
|
||||||
rights granted under this License, and you may not initiate litigation
|
|
||||||
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
|
||||||
any patent claim is infringed by making, using, selling, offering for
|
|
||||||
sale, or importing the Program or any portion of it.
|
|
||||||
|
|
||||||
11. Patents.
|
|
||||||
|
|
||||||
A "contributor" is a copyright holder who authorizes use under this
|
|
||||||
License of the Program or a work on which the Program is based. The
|
|
||||||
work thus licensed is called the contributor's "contributor version".
|
|
||||||
|
|
||||||
A contributor's "essential patent claims" are all patent claims
|
|
||||||
owned or controlled by the contributor, whether already acquired or
|
|
||||||
hereafter acquired, that would be infringed by some manner, permitted
|
|
||||||
by this License, of making, using, or selling its contributor version,
|
|
||||||
but do not include claims that would be infringed only as a
|
|
||||||
consequence of further modification of the contributor version. For
|
|
||||||
purposes of this definition, "control" includes the right to grant
|
|
||||||
patent sublicenses in a manner consistent with the requirements of
|
|
||||||
this License.
|
|
||||||
|
|
||||||
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
|
||||||
patent license under the contributor's essential patent claims, to
|
|
||||||
make, use, sell, offer for sale, import and otherwise run, modify and
|
|
||||||
propagate the contents of its contributor version.
|
|
||||||
|
|
||||||
In the following three paragraphs, a "patent license" is any express
|
|
||||||
agreement or commitment, however denominated, not to enforce a patent
|
|
||||||
(such as an express permission to practice a patent or covenant not to
|
|
||||||
sue for patent infringement). To "grant" such a patent license to a
|
|
||||||
party means to make such an agreement or commitment not to enforce a
|
|
||||||
patent against the party.
|
|
||||||
|
|
||||||
If you convey a covered work, knowingly relying on a patent license,
|
|
||||||
and the Corresponding Source of the work is not available for anyone
|
|
||||||
to copy, free of charge and under the terms of this License, through a
|
|
||||||
publicly available network server or other readily accessible means,
|
|
||||||
then you must either (1) cause the Corresponding Source to be so
|
|
||||||
available, or (2) arrange to deprive yourself of the benefit of the
|
|
||||||
patent license for this particular work, or (3) arrange, in a manner
|
|
||||||
consistent with the requirements of this License, to extend the patent
|
|
||||||
license to downstream recipients. "Knowingly relying" means you have
|
|
||||||
actual knowledge that, but for the patent license, your conveying the
|
|
||||||
covered work in a country, or your recipient's use of the covered work
|
|
||||||
in a country, would infringe one or more identifiable patents in that
|
|
||||||
country that you have reason to believe are valid.
|
|
||||||
|
|
||||||
If, pursuant to or in connection with a single transaction or
|
|
||||||
arrangement, you convey, or propagate by procuring conveyance of, a
|
|
||||||
covered work, and grant a patent license to some of the parties
|
|
||||||
receiving the covered work authorizing them to use, propagate, modify
|
|
||||||
or convey a specific copy of the covered work, then the patent license
|
|
||||||
you grant is automatically extended to all recipients of the covered
|
|
||||||
work and works based on it.
|
|
||||||
|
|
||||||
A patent license is "discriminatory" if it does not include within
|
|
||||||
the scope of its coverage, prohibits the exercise of, or is
|
|
||||||
conditioned on the non-exercise of one or more of the rights that are
|
|
||||||
specifically granted under this License. You may not convey a covered
|
|
||||||
work if you are a party to an arrangement with a third party that is
|
|
||||||
in the business of distributing software, under which you make payment
|
|
||||||
to the third party based on the extent of your activity of conveying
|
|
||||||
the work, and under which the third party grants, to any of the
|
|
||||||
parties who would receive the covered work from you, a discriminatory
|
|
||||||
patent license (a) in connection with copies of the covered work
|
|
||||||
conveyed by you (or copies made from those copies), or (b) primarily
|
|
||||||
for and in connection with specific products or compilations that
|
|
||||||
contain the covered work, unless you entered into that arrangement,
|
|
||||||
or that patent license was granted, prior to 28 March 2007.
|
|
||||||
|
|
||||||
Nothing in this License shall be construed as excluding or limiting
|
|
||||||
any implied license or other defenses to infringement that may
|
|
||||||
otherwise be available to you under applicable patent law.
|
|
||||||
|
|
||||||
12. No Surrender of Others' Freedom.
|
|
||||||
|
|
||||||
If conditions are imposed on you (whether by court order, agreement or
|
|
||||||
otherwise) that contradict the conditions of this License, they do not
|
|
||||||
excuse you from the conditions of this License. If you cannot convey a
|
|
||||||
covered work so as to satisfy simultaneously your obligations under this
|
|
||||||
License and any other pertinent obligations, then as a consequence you may
|
|
||||||
not convey it at all. For example, if you agree to terms that obligate you
|
|
||||||
to collect a royalty for further conveying from those to whom you convey
|
|
||||||
the Program, the only way you could satisfy both those terms and this
|
|
||||||
License would be to refrain entirely from conveying the Program.
|
|
||||||
|
|
||||||
13. Use with the GNU Affero General Public License.
|
|
||||||
|
|
||||||
Notwithstanding any other provision of this License, you have
|
|
||||||
permission to link or combine any covered work with a work licensed
|
|
||||||
under version 3 of the GNU Affero General Public License into a single
|
|
||||||
combined work, and to convey the resulting work. The terms of this
|
|
||||||
License will continue to apply to the part which is the covered work,
|
|
||||||
but the special requirements of the GNU Affero General Public License,
|
|
||||||
section 13, concerning interaction through a network will apply to the
|
|
||||||
combination as such.
|
|
||||||
|
|
||||||
14. Revised Versions of this License.
|
|
||||||
|
|
||||||
The Free Software Foundation may publish revised and/or new versions of
|
|
||||||
the GNU General Public License from time to time. Such new versions will
|
|
||||||
be similar in spirit to the present version, but may differ in detail to
|
|
||||||
address new problems or concerns.
|
|
||||||
|
|
||||||
Each version is given a distinguishing version number. If the
|
|
||||||
Program specifies that a certain numbered version of the GNU General
|
|
||||||
Public License "or any later version" applies to it, you have the
|
|
||||||
option of following the terms and conditions either of that numbered
|
|
||||||
version or of any later version published by the Free Software
|
|
||||||
Foundation. If the Program does not specify a version number of the
|
|
||||||
GNU General Public License, you may choose any version ever published
|
|
||||||
by the Free Software Foundation.
|
|
||||||
|
|
||||||
If the Program specifies that a proxy can decide which future
|
|
||||||
versions of the GNU General Public License can be used, that proxy's
|
|
||||||
public statement of acceptance of a version permanently authorizes you
|
|
||||||
to choose that version for the Program.
|
|
||||||
|
|
||||||
Later license versions may give you additional or different
|
|
||||||
permissions. However, no additional obligations are imposed on any
|
|
||||||
author or copyright holder as a result of your choosing to follow a
|
|
||||||
later version.
|
|
||||||
|
|
||||||
15. Disclaimer of Warranty.
|
|
||||||
|
|
||||||
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
|
||||||
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
|
||||||
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
|
|
||||||
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
|
||||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
|
||||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
|
|
||||||
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
|
|
||||||
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
|
||||||
|
|
||||||
16. Limitation of Liability.
|
|
||||||
|
|
||||||
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
|
||||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
|
|
||||||
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
|
||||||
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
|
|
||||||
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
|
|
||||||
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
|
|
||||||
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
|
|
||||||
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
|
|
||||||
SUCH DAMAGES.
|
|
||||||
|
|
||||||
17. Interpretation of Sections 15 and 16.
|
|
||||||
|
|
||||||
If the disclaimer of warranty and limitation of liability provided
|
|
||||||
above cannot be given local legal effect according to their terms,
|
|
||||||
reviewing courts shall apply local law that most closely approximates
|
|
||||||
an absolute waiver of all civil liability in connection with the
|
|
||||||
Program, unless a warranty or assumption of liability accompanies a
|
|
||||||
copy of the Program in return for a fee.
|
|
||||||
|
|
||||||
END OF TERMS AND CONDITIONS
|
|
||||||
|
|
||||||
How to Apply These Terms to Your New Programs
|
|
||||||
|
|
||||||
If you develop a new program, and you want it to be of the greatest
|
|
||||||
possible use to the public, the best way to achieve this is to make it
|
|
||||||
free software which everyone can redistribute and change under these terms.
|
|
||||||
|
|
||||||
To do so, attach the following notices to the program. It is safest
|
|
||||||
to attach them to the start of each source file to most effectively
|
|
||||||
state the exclusion of warranty; and each file should have at least
|
|
||||||
the "copyright" line and a pointer to where the full notice is found.
|
|
||||||
|
|
||||||
<one line to give the program's name and a brief idea of what it does.>
|
|
||||||
Copyright (C) <year> <name of author>
|
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU General Public License as published by
|
|
||||||
the Free Software Foundation, either version 3 of the License, or
|
|
||||||
(at your option) any later version.
|
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
|
||||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
Also add information on how to contact you by electronic and paper mail.
|
|
||||||
|
|
||||||
If the program does terminal interaction, make it output a short
|
|
||||||
notice like this when it starts in an interactive mode:
|
|
||||||
|
|
||||||
<program> Copyright (C) <year> <name of author>
|
|
||||||
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
|
||||||
This is free software, and you are welcome to redistribute it
|
|
||||||
under certain conditions; type `show c' for details.
|
|
||||||
|
|
||||||
The hypothetical commands `show w' and `show c' should show the appropriate
|
|
||||||
parts of the General Public License. Of course, your program's commands
|
|
||||||
might be different; for a GUI interface, you would use an "about box".
|
|
||||||
|
|
||||||
You should also get your employer (if you work as a programmer) or school,
|
|
||||||
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
|
||||||
For more information on this, and how to apply and follow the GNU GPL, see
|
|
||||||
<http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
The GNU General Public License does not permit incorporating your program
|
|
||||||
into proprietary programs. If your program is a subroutine library, you
|
|
||||||
may consider it more useful to permit linking proprietary applications with
|
|
||||||
the library. If this is what you want to do, use the GNU Lesser General
|
|
||||||
Public License instead of this License. But first, please read
|
|
||||||
<http://www.gnu.org/philosophy/why-not-lgpl.html>.
|
|
||||||
@@ -1,165 +0,0 @@
|
|||||||
GNU LESSER GENERAL PUBLIC LICENSE
|
|
||||||
Version 3, 29 June 2007
|
|
||||||
|
|
||||||
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
|
|
||||||
Everyone is permitted to copy and distribute verbatim copies
|
|
||||||
of this license document, but changing it is not allowed.
|
|
||||||
|
|
||||||
|
|
||||||
This version of the GNU Lesser General Public License incorporates
|
|
||||||
the terms and conditions of version 3 of the GNU General Public
|
|
||||||
License, supplemented by the additional permissions listed below.
|
|
||||||
|
|
||||||
0. Additional Definitions.
|
|
||||||
|
|
||||||
As used herein, "this License" refers to version 3 of the GNU Lesser
|
|
||||||
General Public License, and the "GNU GPL" refers to version 3 of the GNU
|
|
||||||
General Public License.
|
|
||||||
|
|
||||||
"The Library" refers to a covered work governed by this License,
|
|
||||||
other than an Application or a Combined Work as defined below.
|
|
||||||
|
|
||||||
An "Application" is any work that makes use of an interface provided
|
|
||||||
by the Library, but which is not otherwise based on the Library.
|
|
||||||
Defining a subclass of a class defined by the Library is deemed a mode
|
|
||||||
of using an interface provided by the Library.
|
|
||||||
|
|
||||||
A "Combined Work" is a work produced by combining or linking an
|
|
||||||
Application with the Library. The particular version of the Library
|
|
||||||
with which the Combined Work was made is also called the "Linked
|
|
||||||
Version".
|
|
||||||
|
|
||||||
The "Minimal Corresponding Source" for a Combined Work means the
|
|
||||||
Corresponding Source for the Combined Work, excluding any source code
|
|
||||||
for portions of the Combined Work that, considered in isolation, are
|
|
||||||
based on the Application, and not on the Linked Version.
|
|
||||||
|
|
||||||
The "Corresponding Application Code" for a Combined Work means the
|
|
||||||
object code and/or source code for the Application, including any data
|
|
||||||
and utility programs needed for reproducing the Combined Work from the
|
|
||||||
Application, but excluding the System Libraries of the Combined Work.
|
|
||||||
|
|
||||||
1. Exception to Section 3 of the GNU GPL.
|
|
||||||
|
|
||||||
You may convey a covered work under sections 3 and 4 of this License
|
|
||||||
without being bound by section 3 of the GNU GPL.
|
|
||||||
|
|
||||||
2. Conveying Modified Versions.
|
|
||||||
|
|
||||||
If you modify a copy of the Library, and, in your modifications, a
|
|
||||||
facility refers to a function or data to be supplied by an Application
|
|
||||||
that uses the facility (other than as an argument passed when the
|
|
||||||
facility is invoked), then you may convey a copy of the modified
|
|
||||||
version:
|
|
||||||
|
|
||||||
a) under this License, provided that you make a good faith effort to
|
|
||||||
ensure that, in the event an Application does not supply the
|
|
||||||
function or data, the facility still operates, and performs
|
|
||||||
whatever part of its purpose remains meaningful, or
|
|
||||||
|
|
||||||
b) under the GNU GPL, with none of the additional permissions of
|
|
||||||
this License applicable to that copy.
|
|
||||||
|
|
||||||
3. Object Code Incorporating Material from Library Header Files.
|
|
||||||
|
|
||||||
The object code form of an Application may incorporate material from
|
|
||||||
a header file that is part of the Library. You may convey such object
|
|
||||||
code under terms of your choice, provided that, if the incorporated
|
|
||||||
material is not limited to numerical parameters, data structure
|
|
||||||
layouts and accessors, or small macros, inline functions and templates
|
|
||||||
(ten or fewer lines in length), you do both of the following:
|
|
||||||
|
|
||||||
a) Give prominent notice with each copy of the object code that the
|
|
||||||
Library is used in it and that the Library and its use are
|
|
||||||
covered by this License.
|
|
||||||
|
|
||||||
b) Accompany the object code with a copy of the GNU GPL and this license
|
|
||||||
document.
|
|
||||||
|
|
||||||
4. Combined Works.
|
|
||||||
|
|
||||||
You may convey a Combined Work under terms of your choice that,
|
|
||||||
taken together, effectively do not restrict modification of the
|
|
||||||
portions of the Library contained in the Combined Work and reverse
|
|
||||||
engineering for debugging such modifications, if you also do each of
|
|
||||||
the following:
|
|
||||||
|
|
||||||
a) Give prominent notice with each copy of the Combined Work that
|
|
||||||
the Library is used in it and that the Library and its use are
|
|
||||||
covered by this License.
|
|
||||||
|
|
||||||
b) Accompany the Combined Work with a copy of the GNU GPL and this license
|
|
||||||
document.
|
|
||||||
|
|
||||||
c) For a Combined Work that displays copyright notices during
|
|
||||||
execution, include the copyright notice for the Library among
|
|
||||||
these notices, as well as a reference directing the user to the
|
|
||||||
copies of the GNU GPL and this license document.
|
|
||||||
|
|
||||||
d) Do one of the following:
|
|
||||||
|
|
||||||
0) Convey the Minimal Corresponding Source under the terms of this
|
|
||||||
License, and the Corresponding Application Code in a form
|
|
||||||
suitable for, and under terms that permit, the user to
|
|
||||||
recombine or relink the Application with a modified version of
|
|
||||||
the Linked Version to produce a modified Combined Work, in the
|
|
||||||
manner specified by section 6 of the GNU GPL for conveying
|
|
||||||
Corresponding Source.
|
|
||||||
|
|
||||||
1) Use a suitable shared library mechanism for linking with the
|
|
||||||
Library. A suitable mechanism is one that (a) uses at run time
|
|
||||||
a copy of the Library already present on the user's computer
|
|
||||||
system, and (b) will operate properly with a modified version
|
|
||||||
of the Library that is interface-compatible with the Linked
|
|
||||||
Version.
|
|
||||||
|
|
||||||
e) Provide Installation Information, but only if you would otherwise
|
|
||||||
be required to provide such information under section 6 of the
|
|
||||||
GNU GPL, and only to the extent that such information is
|
|
||||||
necessary to install and execute a modified version of the
|
|
||||||
Combined Work produced by recombining or relinking the
|
|
||||||
Application with a modified version of the Linked Version. (If
|
|
||||||
you use option 4d0, the Installation Information must accompany
|
|
||||||
the Minimal Corresponding Source and Corresponding Application
|
|
||||||
Code. If you use option 4d1, you must provide the Installation
|
|
||||||
Information in the manner specified by section 6 of the GNU GPL
|
|
||||||
for conveying Corresponding Source.)
|
|
||||||
|
|
||||||
5. Combined Libraries.
|
|
||||||
|
|
||||||
You may place library facilities that are a work based on the
|
|
||||||
Library side by side in a single library together with other library
|
|
||||||
facilities that are not Applications and are not covered by this
|
|
||||||
License, and convey such a combined library under terms of your
|
|
||||||
choice, if you do both of the following:
|
|
||||||
|
|
||||||
a) Accompany the combined library with a copy of the same work based
|
|
||||||
on the Library, uncombined with any other library facilities,
|
|
||||||
conveyed under the terms of this License.
|
|
||||||
|
|
||||||
b) Give prominent notice with the combined library that part of it
|
|
||||||
is a work based on the Library, and explaining where to find the
|
|
||||||
accompanying uncombined form of the same work.
|
|
||||||
|
|
||||||
6. Revised Versions of the GNU Lesser General Public License.
|
|
||||||
|
|
||||||
The Free Software Foundation may publish revised and/or new versions
|
|
||||||
of the GNU Lesser General Public License from time to time. Such new
|
|
||||||
versions will be similar in spirit to the present version, but may
|
|
||||||
differ in detail to address new problems or concerns.
|
|
||||||
|
|
||||||
Each version is given a distinguishing version number. If the
|
|
||||||
Library as you received it specifies that a certain numbered version
|
|
||||||
of the GNU Lesser General Public License "or any later version"
|
|
||||||
applies to it, you have the option of following the terms and
|
|
||||||
conditions either of that published version or of any later version
|
|
||||||
published by the Free Software Foundation. If the Library as you
|
|
||||||
received it does not specify a version number of the GNU Lesser
|
|
||||||
General Public License, you may choose any version of the GNU Lesser
|
|
||||||
General Public License ever published by the Free Software Foundation.
|
|
||||||
|
|
||||||
If the Library as you received it specifies that a proxy can decide
|
|
||||||
whether future versions of the GNU Lesser General Public License shall
|
|
||||||
apply, that proxy's public statement of acceptance of any version is
|
|
||||||
permanent authorization for you to choose that version for the
|
|
||||||
Library.
|
|
||||||
@@ -1,11 +1,11 @@
|
|||||||
apply plugin: 'com.android.application'
|
apply plugin: 'com.android.application'
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
compile project(':vtm-android')
|
implementation project(':vtm-android')
|
||||||
compile project(':vtm-themes')
|
implementation project(':vtm-extras')
|
||||||
compile project(':vtm-extras')
|
implementation project(':vtm-themes')
|
||||||
compile 'com.noveogroup.android:android-logger:1.3.6'
|
implementation 'com.squareup.okhttp3:okhttp:3.8.0'
|
||||||
compile 'com.squareup.okhttp:okhttp:2.6.0'
|
implementation "org.slf4j:slf4j-android:$slf4jVersion"
|
||||||
}
|
}
|
||||||
|
|
||||||
android {
|
android {
|
||||||
@@ -21,6 +21,7 @@ android {
|
|||||||
versionCode versionCode()
|
versionCode versionCode()
|
||||||
versionName versionName()
|
versionName versionName()
|
||||||
minSdkVersion androidMinSdk()
|
minSdkVersion androidMinSdk()
|
||||||
|
targetSdkVersion androidTargetSdk()
|
||||||
}
|
}
|
||||||
|
|
||||||
sourceSets {
|
sourceSets {
|
||||||
|
|||||||
@@ -1 +0,0 @@
|
|||||||
root=DEBUG:%logger
|
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2010, 2011, 2012 mapsforge.org
|
* Copyright 2010, 2011, 2012 mapsforge.org
|
||||||
* Copyright 2013 Hannes Janetzek
|
* Copyright 2013 Hannes Janetzek
|
||||||
|
* Copyright 2017 devemux86
|
||||||
*
|
*
|
||||||
* This file is part of the OpenScienceMap project (http://www.opensciencemap.org).
|
* This file is part of the OpenScienceMap project (http://www.opensciencemap.org).
|
||||||
*
|
*
|
||||||
@@ -60,14 +61,12 @@ public abstract class MapActivity extends Activity {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onDestroy() {
|
protected void onDestroy() {
|
||||||
|
mMapView.onDestroy();
|
||||||
super.onDestroy();
|
super.onDestroy();
|
||||||
mMap.destroy();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onPause() {
|
protected void onPause() {
|
||||||
super.onPause();
|
|
||||||
|
|
||||||
Editor editor = getSharedPreferences(PREFERENCES_FILE, MODE_PRIVATE).edit();
|
Editor editor = getSharedPreferences(PREFERENCES_FILE, MODE_PRIVATE).edit();
|
||||||
editor.clear();
|
editor.clear();
|
||||||
|
|
||||||
@@ -82,7 +81,9 @@ public abstract class MapActivity extends Activity {
|
|||||||
editor.putInt(KEY_LONGITUDE, geoPoint.longitudeE6);
|
editor.putInt(KEY_LONGITUDE, geoPoint.longitudeE6);
|
||||||
editor.putFloat(KEY_MAP_SCALE, (float) mapPosition.scale);
|
editor.putFloat(KEY_MAP_SCALE, (float) mapPosition.scale);
|
||||||
|
|
||||||
editor.commit();
|
editor.apply();
|
||||||
|
|
||||||
|
super.onPause();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -93,8 +94,8 @@ public abstract class MapActivity extends Activity {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onStop() {
|
protected void onStop() {
|
||||||
super.onStop();
|
|
||||||
mMapView.onPause();
|
mMapView.onPause();
|
||||||
|
super.onStop();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -148,13 +148,13 @@ public class MapLayers {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void enableGridOverlay(boolean enable) {
|
void enableGridOverlay(Context context, boolean enable) {
|
||||||
if (mGridEnabled == enable)
|
if (mGridEnabled == enable)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (enable) {
|
if (enable) {
|
||||||
if (mGridOverlay == null)
|
if (mGridOverlay == null)
|
||||||
mGridOverlay = new TileGridLayer(App.map);
|
mGridOverlay = new TileGridLayer(App.map, context.getResources().getDisplayMetrics().density);
|
||||||
|
|
||||||
App.map.layers().add(mGridOverlay);
|
App.map.layers().add(mGridOverlay);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/* Copyright 2010, 2011, 2012 mapsforge.org
|
/* Copyright 2010, 2011, 2012 mapsforge.org
|
||||||
* Copyright 2012 Hannes Janetzek
|
* 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
|
* This program is free software: you can redistribute it and/or modify it under the
|
||||||
* terms of the GNU Lesser General Public License as published by the Free Software
|
* terms of the GNU Lesser General Public License as published by the Free Software
|
||||||
@@ -40,7 +40,6 @@ import org.oscim.app.location.LocationDialog;
|
|||||||
import org.oscim.app.location.LocationHandler;
|
import org.oscim.app.location.LocationHandler;
|
||||||
import org.oscim.app.preferences.EditPreferences;
|
import org.oscim.app.preferences.EditPreferences;
|
||||||
import org.oscim.core.GeoPoint;
|
import org.oscim.core.GeoPoint;
|
||||||
import org.oscim.core.Tile;
|
|
||||||
import org.oscim.overlay.DistanceTouchOverlay;
|
import org.oscim.overlay.DistanceTouchOverlay;
|
||||||
import org.osmdroid.location.POI;
|
import org.osmdroid.location.POI;
|
||||||
import org.osmdroid.overlays.MapEventsReceiver;
|
import org.osmdroid.overlays.MapEventsReceiver;
|
||||||
@@ -74,7 +73,6 @@ public class TileMap extends MapActivity implements MapEventsReceiver {
|
|||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
|
|
||||||
Tile.SIZE = Tile.calculateTileSize(getResources().getDisplayMetrics().scaledDensity);
|
|
||||||
setContentView(R.layout.activity_tilemap);
|
setContentView(R.layout.activity_tilemap);
|
||||||
App.view = (MapView) findViewById(R.id.mapView);
|
App.view = (MapView) findViewById(R.id.mapView);
|
||||||
registerMapView(App.view);
|
registerMapView(App.view);
|
||||||
@@ -205,7 +203,7 @@ public class TileMap extends MapActivity implements MapEventsReceiver {
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case R.id.menu_layer_grid:
|
case R.id.menu_layer_grid:
|
||||||
mMapLayers.enableGridOverlay(!mMapLayers.isGridEnabled());
|
mMapLayers.enableGridOverlay(this, !mMapLayers.isGridEnabled());
|
||||||
mMap.updateMap(true);
|
mMap.updateMap(true);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2013 Ahmad Saleem
|
* Copyright 2013 Ahmad Saleem
|
||||||
* Copyright 2013 Hannes Janetzek
|
* Copyright 2013 Hannes Janetzek
|
||||||
* Copyright 2016 devemux86
|
* Copyright 2016-2017 devemux86
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify it under the
|
* This program is free software: you can redistribute it and/or modify it under the
|
||||||
* terms of the GNU Lesser General Public License as published by the Free Software
|
* terms of the GNU Lesser General Public License as published by the Free Software
|
||||||
@@ -85,6 +85,11 @@ public class Compass extends Layer implements SensorEventListener, Map.UpdateLis
|
|||||||
setEnabled(false);
|
setEnabled(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean hasRotation() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public synchronized float getRotation() {
|
public synchronized float getRotation() {
|
||||||
return mCurRotation;
|
return mCurRotation;
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
* Copyright 2010, 2011, 2012 mapsforge.org
|
* Copyright 2010, 2011, 2012 mapsforge.org
|
||||||
* Copyright 2013 Hannes Janetzek
|
* Copyright 2013 Hannes Janetzek
|
||||||
* Copyright 2013 Ahmad Al-saleem
|
* Copyright 2013 Ahmad Al-saleem
|
||||||
|
* Copyright 2016 devemux86
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify it under the
|
* This program is free software: you can redistribute it and/or modify it under the
|
||||||
* terms of the GNU Lesser General Public License as published by the Free Software
|
* terms of the GNU Lesser General Public License as published by the Free Software
|
||||||
@@ -31,7 +32,7 @@ import org.slf4j.Logger;
|
|||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
public class LocationHandler implements LocationListener {
|
public class LocationHandler implements LocationListener {
|
||||||
final static Logger log = LoggerFactory.getLogger(LocationHandler.class);
|
private final static Logger log = LoggerFactory.getLogger(LocationHandler.class);
|
||||||
|
|
||||||
public enum Mode {
|
public enum Mode {
|
||||||
OFF,
|
OFF,
|
||||||
@@ -43,7 +44,7 @@ public class LocationHandler implements LocationListener {
|
|||||||
private final static int SHOW_LOCATION_ZOOM = 14;
|
private final static int SHOW_LOCATION_ZOOM = 14;
|
||||||
|
|
||||||
private final LocationManager mLocationManager;
|
private final LocationManager mLocationManager;
|
||||||
private final LocationOverlay mLocationOverlay;
|
private final LocationLayerImpl mLocationLayer;
|
||||||
|
|
||||||
private Mode mMode = Mode.OFF;
|
private Mode mMode = Mode.OFF;
|
||||||
|
|
||||||
@@ -54,7 +55,7 @@ public class LocationHandler implements LocationListener {
|
|||||||
mLocationManager = (LocationManager) tileMap
|
mLocationManager = (LocationManager) tileMap
|
||||||
.getSystemService(Context.LOCATION_SERVICE);
|
.getSystemService(Context.LOCATION_SERVICE);
|
||||||
|
|
||||||
mLocationOverlay = new LocationOverlay(App.map, compass);
|
mLocationLayer = new LocationLayerImpl(App.map, compass);
|
||||||
|
|
||||||
mMapPosition = new MapPosition();
|
mMapPosition = new MapPosition();
|
||||||
}
|
}
|
||||||
@@ -115,13 +116,13 @@ public class LocationHandler implements LocationListener {
|
|||||||
if (location == null)
|
if (location == null)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
mLocationOverlay.setEnabled(true);
|
mLocationLayer.setEnabled(true);
|
||||||
mLocationOverlay.setPosition(location.getLatitude(),
|
mLocationLayer.setPosition(location.getLatitude(),
|
||||||
location.getLongitude(),
|
location.getLongitude(),
|
||||||
location.getAccuracy());
|
location.getAccuracy());
|
||||||
|
|
||||||
// FIXME -> implement LayerGroup
|
// FIXME -> implement LayerGroup
|
||||||
App.map.layers().add(4, mLocationOverlay);
|
App.map.layers().add(4, mLocationLayer);
|
||||||
|
|
||||||
App.map.updateMap(true);
|
App.map.updateMap(true);
|
||||||
return true;
|
return true;
|
||||||
@@ -133,9 +134,9 @@ public class LocationHandler implements LocationListener {
|
|||||||
private boolean disableShowMyLocation() {
|
private boolean disableShowMyLocation() {
|
||||||
|
|
||||||
mLocationManager.removeUpdates(this);
|
mLocationManager.removeUpdates(this);
|
||||||
mLocationOverlay.setEnabled(false);
|
mLocationLayer.setEnabled(false);
|
||||||
|
|
||||||
App.map.layers().remove(mLocationOverlay);
|
App.map.layers().remove(mLocationLayer);
|
||||||
App.map.updateMap(true);
|
App.map.updateMap(true);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@@ -199,7 +200,7 @@ public class LocationHandler implements LocationListener {
|
|||||||
App.map.setMapPosition(mMapPosition);
|
App.map.setMapPosition(mMapPosition);
|
||||||
}
|
}
|
||||||
|
|
||||||
mLocationOverlay.setPosition(lat, lon, location.getAccuracy());
|
mLocationLayer.setPosition(lat, lon, location.getAccuracy());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
39
vtm-app/src/org/oscim/app/location/LocationLayerImpl.java
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2013 Ahmad Saleem
|
||||||
|
* Copyright 2013 Hannes Janetzek
|
||||||
|
* Copyright 2016 devemux86
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify it under the
|
||||||
|
* terms of the GNU Lesser General Public License as published by the Free Software
|
||||||
|
* Foundation, either version 3 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||||
|
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||||
|
* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public License along with
|
||||||
|
* this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
package org.oscim.app.location;
|
||||||
|
|
||||||
|
import org.oscim.layers.LocationLayer;
|
||||||
|
import org.oscim.map.Map;
|
||||||
|
|
||||||
|
class LocationLayerImpl extends LocationLayer {
|
||||||
|
private final Compass mCompass;
|
||||||
|
|
||||||
|
LocationLayerImpl(Map map, Compass compass) {
|
||||||
|
super(map);
|
||||||
|
mCompass = compass;
|
||||||
|
|
||||||
|
locationRenderer.setCallback(compass);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setEnabled(boolean enabled) {
|
||||||
|
super.setEnabled(enabled);
|
||||||
|
|
||||||
|
if (mCompass != null)
|
||||||
|
mCompass.setEnabled(enabled);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -2,25 +2,26 @@ package org.osmdroid.utils;
|
|||||||
|
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
|
||||||
import com.squareup.okhttp.OkHttpClient;
|
|
||||||
import com.squareup.okhttp.Request;
|
|
||||||
import com.squareup.okhttp.Response;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
|
import okhttp3.OkHttpClient;
|
||||||
|
import okhttp3.OkHttpClient.Builder;
|
||||||
|
import okhttp3.Request;
|
||||||
|
import okhttp3.Response;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A "very very simple to use" class for performing http get and post requests.
|
* A "very very simple to use" class for performing http get and post requests.
|
||||||
* So many ways to do that, and potential subtle issues.
|
* So many ways to do that, and potential subtle issues.
|
||||||
* If complexity should be added to handle even more issues, complexity should be put here and only here.
|
* If complexity should be added to handle even more issues, complexity should be put here and only here.
|
||||||
* <p/>
|
* <p>
|
||||||
* Typical usage:
|
* Typical usage:
|
||||||
* <pre>HttpConnection connection = new HttpConnection();
|
* <pre>HttpConnection connection = new HttpConnection();
|
||||||
* connection.doGet("http://www.google.com");
|
* connection.doGet("http://www.google.com");
|
||||||
* InputStream stream = connection.getStream();
|
* InputStream stream = connection.getStream();
|
||||||
* if (stream != null) {
|
* if (stream != null) {
|
||||||
* //use this stream, for buffer reading, or XML SAX parsing, or whatever...
|
* //use this stream, for buffer reading, or XML SAX parsing, or whatever...
|
||||||
* }
|
* }
|
||||||
* connection.close();</pre>
|
* connection.close();</pre>
|
||||||
*/
|
*/
|
||||||
@@ -35,9 +36,14 @@ public class HttpConnection {
|
|||||||
|
|
||||||
private static OkHttpClient getOkHttpClient() {
|
private static OkHttpClient getOkHttpClient() {
|
||||||
if (client == null) {
|
if (client == null) {
|
||||||
client = new OkHttpClient();
|
Builder b = new Builder();
|
||||||
|
b.connectTimeout(TIMEOUT_CONNECTION, TimeUnit.MILLISECONDS);
|
||||||
|
b.readTimeout(TIMEOUT_SOCKET, TimeUnit.MILLISECONDS);
|
||||||
|
client = b.build();
|
||||||
|
/*
|
||||||
client.setConnectTimeout(TIMEOUT_CONNECTION, TimeUnit.MILLISECONDS);
|
client.setConnectTimeout(TIMEOUT_CONNECTION, TimeUnit.MILLISECONDS);
|
||||||
client.setReadTimeout(TIMEOUT_SOCKET, TimeUnit.MILLISECONDS);
|
client.setReadTimeout(TIMEOUT_SOCKET, TimeUnit.MILLISECONDS);
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
return client;
|
return client;
|
||||||
}
|
}
|
||||||
@@ -73,15 +79,10 @@ public class HttpConnection {
|
|||||||
* @return the opened InputStream, or null if creation failed for any reason.
|
* @return the opened InputStream, or null if creation failed for any reason.
|
||||||
*/
|
*/
|
||||||
public InputStream getStream() {
|
public InputStream getStream() {
|
||||||
try {
|
if (response == null)
|
||||||
if (response == null)
|
|
||||||
return null;
|
|
||||||
stream = response.body().byteStream();
|
|
||||||
return stream;
|
|
||||||
} catch (IOException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
return null;
|
return null;
|
||||||
}
|
stream = response.body().byteStream();
|
||||||
|
return stream;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||