Compare commits
27 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 |
36
.travis.yml
36
.travis.yml
@@ -1,28 +1,32 @@
|
||||
sudo: false
|
||||
language: android
|
||||
jdk:
|
||||
- oraclejdk8
|
||||
android:
|
||||
components:
|
||||
- tools
|
||||
- platform-tools
|
||||
- tools
|
||||
- build-tools-27.0.1
|
||||
- android-27
|
||||
- oraclejdk8
|
||||
env:
|
||||
global:
|
||||
- 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=27
|
||||
- ANDROID_BUILD_TOOLS=27.0.3
|
||||
- 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:
|
||||
- ./gradlew clean build
|
||||
- ./gradlew clean build
|
||||
after_success:
|
||||
- if [ "$TRAVIS_BRANCH" == "master" ] && [ "$TRAVIS_PULL_REQUEST" == "false" ]; then
|
||||
./gradlew uploadArchives -PSONATYPE_USERNAME="${SONATYPE_USERNAME}" -PSONATYPE_PASSWORD="${SONATYPE_PASSWORD}";
|
||||
fi
|
||||
- if [ "$TRAVIS_BRANCH" == "master" ] && [ "$TRAVIS_PULL_REQUEST" == "false" ]; then
|
||||
./gradlew uploadArchives -PSONATYPE_USERNAME="${SONATYPE_USERNAME}" -PSONATYPE_PASSWORD="${SONATYPE_PASSWORD}";
|
||||
fi
|
||||
notifications:
|
||||
email:
|
||||
recipients:
|
||||
- secure: fOInp4SGBqiIMgnsGceQTa0SuFLaAoxAF15W0crhuljGlqSgnbnBjh0xFEF4P5+q3VT3DgDZs53GVVo6S9gEl8AWJy84KGuUX1M/CQKUQC4bwNXJdHfY3MIy6D50da6UfwWeNS4ienKh2Rj6w2TapN9M8C9nJJZk9aJFc9NWZmWTVboHZd4oUDeeRBJ6KSk1Ay7L/mmxv4cMCXaW7pPJixvUFESKNYgK4KAN3zYpym2UijrQ8zf7OVcYnTorcAuXUZDk8EvwdHl3rIAdlbVqvyZ8rmoQ2Da/Q2VlWUL/HrHUVJtCPZ+T+dNUag4a8joIDqWKwcyk76PElmgft3azb7GERb+bkZz1ToQc2IvuOeUk2SsuXWZugoEQImKWl/yWeirWBLrwzieaVh4j04dMSn/Npc1yL5kjX9EuiM6MFHdYPianMpvhFiaYKihjzW0GPV6sfuY7xS8cA9L9DjAsXoHIXIxc/+hRA+bpPUl+qMaQdGjJmNJJ2VPFnOY0XCsDDQDIVa3nZOA6aXMUG2c4H26RJZPe7uvfRiuL86n3KAmkoXSwne9t8WYMgl89LMsU5XxjBvwz2Qa1HqG09tVs6nhB23easrhEYEf/ZsGg0DIIL1FImUHj+wUUfZXeyFmbiE6lD/i2+3a5DqzZGHbXUDCoUIagObMf8fe2z5+0K/Q=
|
||||
- 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
|
||||
|
||||
@@ -14,8 +14,8 @@ allprojects {
|
||||
version = 'master-SNAPSHOT'
|
||||
ext.isReleaseVersion = !version.endsWith("SNAPSHOT")
|
||||
|
||||
ext.androidBuildVersionTools = "27.0.1"
|
||||
ext.gdxVersion = "1.9.7"
|
||||
ext.androidBuildVersionTools = "27.0.3"
|
||||
ext.gdxVersion = "1.9.8"
|
||||
ext.gwtVersion = "2.8.0"
|
||||
ext.slf4jVersion = "1.7.25"
|
||||
|
||||
|
||||
@@ -1,5 +1,18 @@
|
||||
# Changelog
|
||||
|
||||
## Version 0.9.2 (2018-01-04)
|
||||
|
||||
- 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)
|
||||
|
||||
## 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)
|
||||
|
||||
@@ -41,8 +41,8 @@ implementation 'org.mapsforge:vtm-android-gdx:[CURRENT-VERSION]:natives-armeabi'
|
||||
implementation 'org.mapsforge:vtm-android-gdx:[CURRENT-VERSION]:natives-armeabi-v7a'
|
||||
implementation 'org.mapsforge:vtm-android-gdx:[CURRENT-VERSION]:natives-x86'
|
||||
implementation 'org.mapsforge:vtm-android-gdx:[CURRENT-VERSION]:natives-x86_64'
|
||||
implementation 'com.badlogicgames.gdx:gdx:1.9.7'
|
||||
implementation 'com.badlogicgames.gdx:gdx-backend-android:1.9.7'
|
||||
implementation 'com.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'
|
||||
```
|
||||
|
||||
@@ -57,9 +57,9 @@ implementation 'org.mapsforge:vtm-desktop:[CURRENT-VERSION]'
|
||||
implementation 'org.mapsforge:vtm-desktop:[CURRENT-VERSION]:natives-linux'
|
||||
implementation 'org.mapsforge:vtm-desktop:[CURRENT-VERSION]:natives-osx'
|
||||
implementation 'org.mapsforge:vtm-desktop:[CURRENT-VERSION]:natives-windows'
|
||||
implementation 'com.badlogicgames.gdx:gdx:1.9.7'
|
||||
implementation 'com.badlogicgames.gdx:gdx-platform:1.9.7:natives-desktop'
|
||||
implementation 'com.badlogicgames.gdx:gdx-backend-lwjgl:1.9.7'
|
||||
implementation 'com.badlogicgames.gdx:gdx:1.9.8'
|
||||
implementation 'com.badlogicgames.gdx:gdx-platform:1.9.8:natives-desktop'
|
||||
implementation 'com.badlogicgames.gdx:gdx-backend-lwjgl:1.9.8'
|
||||
implementation 'org.lwjgl.lwjgl:lwjgl:2.9.3'
|
||||
implementation 'org.lwjgl.lwjgl:lwjgl-platform:2.9.3:natives-linux'
|
||||
implementation 'org.lwjgl.lwjgl:lwjgl-platform:2.9.3:natives-osx'
|
||||
@@ -67,6 +67,32 @@ implementation 'org.lwjgl.lwjgl:lwjgl-platform:2.9.3:natives-windows'
|
||||
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
|
||||
|
||||
We publish SNAPSHOT builds to Sonatype OSS Repository Hosting.
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
- [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/)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
apply plugin: 'java-library'
|
||||
|
||||
dependencies {
|
||||
implementation "com.badlogicgames.gdx:gdx-jnigen:$gdxVersion"
|
||||
api "com.badlogicgames.gdx:gdx-jnigen:$gdxVersion"
|
||||
}
|
||||
|
||||
sourceSets {
|
||||
|
||||
@@ -85,6 +85,9 @@
|
||||
<activity
|
||||
android:name=".OpenMapTilesGeojsonMapActivity"
|
||||
android:configChanges="keyboardHidden|orientation|screenSize" />
|
||||
<activity
|
||||
android:name=".OSciMapS3DBMapActivity"
|
||||
android:configChanges="keyboardHidden|orientation|screenSize" />
|
||||
<activity
|
||||
android:name=".PathOverlayActivity"
|
||||
android:configChanges="keyboardHidden|orientation|screenSize" />
|
||||
@@ -103,9 +106,6 @@
|
||||
<activity
|
||||
android:name=".RotateMarkerOverlayActivity"
|
||||
android:configChanges="keyboardHidden|orientation|screenSize" />
|
||||
<activity
|
||||
android:name=".S3DBMapActivity"
|
||||
android:configChanges="keyboardHidden|orientation|screenSize" />
|
||||
<activity
|
||||
android:name=".SimpleMapActivity"
|
||||
android:configChanges="keyboardHidden|orientation|screenSize" />
|
||||
|
||||
@@ -11,12 +11,6 @@ dependencies {
|
||||
implementation project(':vtm-json')
|
||||
implementation project(':vtm-jts')
|
||||
implementation project(':vtm-themes')
|
||||
implementation('org.jeo:jeo:0-SNAPSHOT') {
|
||||
exclude group: 'org.slf4j', module: 'slf4j-jdk14'
|
||||
}
|
||||
implementation('org.jeo:jeo-render:0-SNAPSHOT') {
|
||||
exclude group: 'org.slf4j', module: 'slf4j-jdk14'
|
||||
}
|
||||
implementation "org.slf4j:slf4j-android:$slf4jVersion"
|
||||
|
||||
implementation project(':vtm-android-gdx')
|
||||
@@ -70,14 +64,6 @@ android {
|
||||
exclude 'META-INF/LICENSE'
|
||||
exclude 'META-INF/NOTICE'
|
||||
}
|
||||
|
||||
buildTypes {
|
||||
all {
|
||||
minifyEnabled true
|
||||
useProguard false
|
||||
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
task run(dependsOn: 'installDebug') {
|
||||
|
||||
10
vtm-android-example/proguard-rules.pro
vendored
10
vtm-android-example/proguard-rules.pro
vendored
@@ -1,10 +0,0 @@
|
||||
-keep class com.** { *; }
|
||||
-dontwarn com.**
|
||||
-keep class jsqlite.** { *; }
|
||||
-dontwarn jsqlite.**
|
||||
-keep class okhttp3.** { *; }
|
||||
-dontwarn okhttp3.**
|
||||
-keep class okio.** { *; }
|
||||
-dontwarn okio.**
|
||||
-keep class org.** { *; }
|
||||
-dontwarn org.**
|
||||
@@ -30,6 +30,8 @@ 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;
|
||||
|
||||
@@ -46,7 +48,10 @@ public class AtlasMarkerOverlayActivity extends MarkerOverlayActivity {
|
||||
// Map events receiver
|
||||
mMap.layers().add(new MapEventsReceiver(mMap));
|
||||
|
||||
VectorTileLayer l = mMap.setBaseMap(new OSciMap4TileSource());
|
||||
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);
|
||||
|
||||
@@ -36,6 +36,8 @@ 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;
|
||||
|
||||
@@ -50,7 +52,10 @@ public class AtlasMultiTextureActivity extends MarkerOverlayActivity {
|
||||
// Map events receiver
|
||||
mMap.layers().add(new MapEventsReceiver(mMap));
|
||||
|
||||
VectorTileLayer l = mMap.setBaseMap(new OSciMap4TileSource());
|
||||
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);
|
||||
|
||||
@@ -27,6 +27,7 @@ import org.oscim.layers.TileGridLayer;
|
||||
import org.oscim.layers.tile.vector.VectorTileLayer;
|
||||
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.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
@@ -53,7 +54,9 @@ public class BaseMapActivity extends MapActivity {
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
mTileSource = new OSciMap4TileSource();
|
||||
mTileSource = OSciMap4TileSource.builder()
|
||||
.httpFactory(new OkHttpEngine.OkHttpFactory())
|
||||
.build();
|
||||
|
||||
if (USE_CACHE) {
|
||||
mCache = new TileCache(this, null, "tile.db");
|
||||
|
||||
@@ -29,6 +29,8 @@ 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;
|
||||
@@ -46,7 +48,10 @@ public class ClusterMarkerOverlayActivity extends MarkerOverlayActivity {
|
||||
// Map events receiver
|
||||
mMap.layers().add(new MapEventsReceiver(mMap));
|
||||
|
||||
VectorTileLayer l = mMap.setBaseMap(new OSciMap4TileSource());
|
||||
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);
|
||||
|
||||
@@ -32,6 +32,7 @@ import org.oscim.gdx.AndroidGL;
|
||||
import org.oscim.gdx.GdxAssets;
|
||||
import org.oscim.gdx.GdxMap;
|
||||
import org.oscim.tiling.TileSource;
|
||||
import org.oscim.tiling.source.OkHttpEngine;
|
||||
import org.oscim.tiling.source.oscimap4.OSciMap4TileSource;
|
||||
|
||||
public class GdxMapActivity extends AndroidApplication {
|
||||
@@ -60,7 +61,9 @@ public class GdxMapActivity extends AndroidApplication {
|
||||
class GdxMapAndroid extends GdxMap {
|
||||
@Override
|
||||
public void createLayers() {
|
||||
TileSource ts = new OSciMap4TileSource();
|
||||
TileSource ts = OSciMap4TileSource.builder()
|
||||
.httpFactory(new OkHttpEngine.OkHttpFactory())
|
||||
.build();
|
||||
initDefaultLayers(ts, true, true, true, getResources().getDisplayMetrics().density);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -34,6 +34,8 @@ 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;
|
||||
@@ -53,7 +55,10 @@ public class MarkerOverlayActivity extends SimpleMapActivity
|
||||
// Map events receiver
|
||||
mMap.layers().add(new MapEventsReceiver(mMap));
|
||||
|
||||
VectorTileLayer l = mMap.setBaseMap(new OSciMap4TileSource());
|
||||
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);
|
||||
|
||||
@@ -27,6 +27,8 @@ 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;
|
||||
|
||||
public class MultiMapActivity extends Activity {
|
||||
@@ -43,7 +45,10 @@ public class MultiMapActivity extends Activity {
|
||||
mMapView1 = (MapView) findViewById(R.id.mapView1);
|
||||
Map map1 = mMapView1.map();
|
||||
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 LabelLayer(map1, baseLayer1));
|
||||
map1.setTheme(VtmThemes.DEFAULT);
|
||||
@@ -52,7 +57,10 @@ public class MultiMapActivity extends Activity {
|
||||
mMapView2 = (MapView) findViewById(R.id.mapView2);
|
||||
Map map2 = mMapView2.map();
|
||||
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 LabelLayer(map2, baseLayer2));
|
||||
map2.setTheme(VtmThemes.DEFAULT);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2016 devemux86
|
||||
* Copyright 2016-2017 devemux86
|
||||
*
|
||||
* 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.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.theme.VtmThemes;
|
||||
import org.oscim.tiling.TileSource;
|
||||
import org.oscim.tiling.source.OkHttpEngine;
|
||||
import org.oscim.tiling.source.oscimap4.OSciMap4TileSource;
|
||||
|
||||
public class S3DBMapActivity extends BaseMapActivity {
|
||||
public class OSciMapS3DBMapActivity extends BaseMapActivity {
|
||||
|
||||
TileCache mS3dbCache;
|
||||
|
||||
@@ -37,6 +38,7 @@ public class S3DBMapActivity extends BaseMapActivity {
|
||||
mMap.setTheme(VtmThemes.DEFAULT);
|
||||
|
||||
TileSource ts = OSciMap4TileSource.builder()
|
||||
.httpFactory(new OkHttpEngine.OkHttpFactory())
|
||||
.url("http://opensciencemap.org/tiles/s3db")
|
||||
.zoomMin(16)
|
||||
.zoomMax(16)
|
||||
@@ -47,7 +49,7 @@ public class S3DBMapActivity extends BaseMapActivity {
|
||||
mS3dbCache.setCacheSize(512 * (1 << 10));
|
||||
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(new LabelLayer(mMap, mBaseLayer));
|
||||
}
|
||||
@@ -124,7 +124,7 @@ public class Samples extends Activity {
|
||||
|
||||
linearLayout.addView(createLabel("Experiments"));
|
||||
linearLayout.addView(createButton(ReverseGeocodeActivity.class));
|
||||
linearLayout.addView(createButton(S3DBMapActivity.class));
|
||||
linearLayout.addView(createButton(OSciMapS3DBMapActivity.class));
|
||||
linearLayout.addView(createButton(ThemeStylerActivity.class));
|
||||
linearLayout.addView(createButton(JeoIndoorMapActivity.class));
|
||||
}
|
||||
|
||||
@@ -3,8 +3,7 @@ apply plugin: 'com.github.dcendents.android-maven'
|
||||
|
||||
dependencies {
|
||||
api project(':vtm')
|
||||
implementation 'com.caverock:androidsvg:1.2.2-beta-1'
|
||||
implementation "org.slf4j:slf4j-api:$slf4jVersion"
|
||||
api 'com.caverock:androidsvg:1.2.2-beta-1'
|
||||
}
|
||||
|
||||
android {
|
||||
|
||||
@@ -2,8 +2,8 @@ apply plugin: 'com.android.application'
|
||||
|
||||
dependencies {
|
||||
implementation project(':vtm-android')
|
||||
implementation project(':vtm-themes')
|
||||
implementation project(':vtm-extras')
|
||||
implementation project(':vtm-themes')
|
||||
implementation 'com.squareup.okhttp3:okhttp:3.8.0'
|
||||
implementation "org.slf4j:slf4j-android:$slf4jVersion"
|
||||
}
|
||||
|
||||
@@ -3,13 +3,8 @@ apply plugin: 'maven'
|
||||
|
||||
dependencies {
|
||||
api project(':vtm-gdx')
|
||||
file('natives').eachDir() { dir ->
|
||||
api files(dir.path)
|
||||
}
|
||||
implementation "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-desktop"
|
||||
implementation "com.badlogicgames.gdx:gdx-backend-lwjgl:$gdxVersion"
|
||||
implementation 'com.metsci.ext.com.kitfox.svg:svg-salamander:0.1.19'
|
||||
implementation "org.slf4j:slf4j-api:$slf4jVersion"
|
||||
api "com.badlogicgames.gdx:gdx-backend-lwjgl:$gdxVersion"
|
||||
api 'com.metsci.ext.com.kitfox.svg:svg-salamander:0.1.19'
|
||||
}
|
||||
|
||||
sourceSets {
|
||||
|
||||
@@ -3,11 +3,10 @@ apply plugin: 'maven'
|
||||
|
||||
dependencies {
|
||||
api project(':vtm')
|
||||
implementation 'com.fasterxml.jackson.core:jackson-core:2.8.4'
|
||||
implementation 'com.google.protobuf:protobuf-java:2.6.1'
|
||||
implementation 'com.vividsolutions:jts:1.13'
|
||||
implementation 'org.openstreetmap.osmosis:osmosis-osm-binary:0.45'
|
||||
implementation "org.slf4j:slf4j-api:$slf4jVersion"
|
||||
api 'com.fasterxml.jackson.core:jackson-core:2.8.4'
|
||||
api 'com.google.protobuf:protobuf-java:2.6.1'
|
||||
api 'com.vividsolutions:jts:1.13'
|
||||
api 'org.openstreetmap.osmosis:osmosis-osm-binary:0.45'
|
||||
}
|
||||
|
||||
sourceSets {
|
||||
|
||||
@@ -269,8 +269,8 @@ public class GeoJsonTileDecoder implements ITileDecoder {
|
||||
}
|
||||
|
||||
private void removeLastPoint() {
|
||||
mMapElement.pointPos -= 2;
|
||||
mMapElement.index[mMapElement.indexPos] -= 2;
|
||||
mMapElement.pointNextPos -= 2;
|
||||
mMapElement.index[mMapElement.indexCurrentPos] -= 2;
|
||||
}
|
||||
|
||||
private void parseLineString(JsonParser jp)
|
||||
|
||||
@@ -484,8 +484,8 @@ public class TileDecoder extends PbfDecoder {
|
||||
|
||||
// only add last point if it is di
|
||||
int ppos = cnt * 2;
|
||||
if (elem.points[elem.pointPos - ppos] != curX
|
||||
|| elem.points[elem.pointPos - ppos + 1] != curY)
|
||||
if (elem.points[elem.pointNextPos - ppos] != curX
|
||||
|| elem.points[elem.pointNextPos - ppos + 1] != curY)
|
||||
elem.addPoint(curX / mScale, curY / mScale);
|
||||
|
||||
lastClip = false;
|
||||
@@ -525,10 +525,10 @@ public class TileDecoder extends PbfDecoder {
|
||||
if (isPoly && isOuter && simplify && !testBBox(xmax - xmin, ymax - ymin)) {
|
||||
//log.debug("skip small poly "+ elem.indexPos + " > "
|
||||
// + (xmax - xmin) * (ymax - ymin));
|
||||
elem.pointPos -= elem.index[elem.indexPos];
|
||||
if (elem.indexPos > 0) {
|
||||
elem.indexPos -= 2;
|
||||
elem.index[elem.indexPos + 1] = -1;
|
||||
elem.pointNextPos -= elem.index[elem.indexCurrentPos];
|
||||
if (elem.indexCurrentPos > 0) {
|
||||
elem.indexCurrentPos -= 2;
|
||||
elem.index[elem.indexCurrentPos + 1] = -1;
|
||||
} else {
|
||||
elem.type = GeometryType.NONE;
|
||||
}
|
||||
|
||||
@@ -4,8 +4,7 @@ apply plugin: 'maven'
|
||||
dependencies {
|
||||
api project(':vtm')
|
||||
api project(':vtm-themes')
|
||||
implementation "com.badlogicgames.gdx:gdx:$gdxVersion"
|
||||
implementation "org.slf4j:slf4j-api:$slf4jVersion"
|
||||
api "com.badlogicgames.gdx:gdx:$gdxVersion"
|
||||
}
|
||||
|
||||
sourceSets {
|
||||
|
||||
@@ -3,8 +3,7 @@ apply plugin: 'maven'
|
||||
|
||||
dependencies {
|
||||
api project(':vtm')
|
||||
implementation 'com.squareup.okhttp3:okhttp:3.8.0'
|
||||
implementation "org.slf4j:slf4j-api:$slf4jVersion"
|
||||
api 'com.squareup.okhttp3:okhttp:3.8.0'
|
||||
}
|
||||
|
||||
sourceSets {
|
||||
|
||||
@@ -16,7 +16,7 @@ sourceSets.main.java.srcDirs = ["src/"]
|
||||
[compileJava, compileTestJava]*.options*.encoding = 'UTF-8'
|
||||
|
||||
ext {
|
||||
roboVMVersion = "2.3.2"
|
||||
roboVMVersion = "2.3.3"
|
||||
}
|
||||
|
||||
launchIPhoneSimulator.dependsOn build
|
||||
@@ -25,15 +25,8 @@ launchIOSDevice.dependsOn build
|
||||
createIPA.dependsOn build
|
||||
|
||||
dependencies {
|
||||
implementation project(':vtm')
|
||||
implementation project(':vtm-gdx')
|
||||
implementation project(':vtm-jts')
|
||||
implementation project(':vtm-ios')
|
||||
implementation project(':vtm-themes')
|
||||
implementation "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-ios"
|
||||
implementation "com.badlogicgames.gdx:gdx-backend-robovm:$gdxVersion"
|
||||
implementation "com.mobidevelop.robovm:robovm-rt:$roboVMVersion"
|
||||
implementation "com.mobidevelop.robovm:robovm-cocoatouch:$roboVMVersion"
|
||||
implementation project(':vtm-jts')
|
||||
implementation "org.slf4j:slf4j-simple:$slf4jVersion"
|
||||
}
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@ sourceSets.main.java.srcDirs = ["src/"]
|
||||
[compileJava, compileTestJava]*.options*.encoding = 'UTF-8'
|
||||
|
||||
ext {
|
||||
roboVMVersion = "2.3.2"
|
||||
roboVMVersion = "2.3.3"
|
||||
}
|
||||
|
||||
launchIPhoneSimulator.dependsOn build
|
||||
@@ -27,11 +27,10 @@ createIPA.dependsOn build
|
||||
|
||||
dependencies {
|
||||
api project(':vtm-gdx')
|
||||
implementation "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-ios"
|
||||
implementation "com.badlogicgames.gdx:gdx-backend-robovm:$gdxVersion"
|
||||
implementation "com.mobidevelop.robovm:robovm-rt:$roboVMVersion"
|
||||
implementation "com.mobidevelop.robovm:robovm-cocoatouch:$roboVMVersion"
|
||||
implementation "org.slf4j:slf4j-api:$slf4jVersion"
|
||||
api "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-ios"
|
||||
api "com.badlogicgames.gdx:gdx-backend-robovm:$gdxVersion"
|
||||
api "com.mobidevelop.robovm:robovm-cocoatouch:$roboVMVersion"
|
||||
api "com.mobidevelop.robovm:robovm-rt:$roboVMVersion"
|
||||
}
|
||||
|
||||
task copyVtmResources(type: Copy) {
|
||||
|
||||
@@ -3,10 +3,10 @@ apply plugin: 'maven'
|
||||
|
||||
dependencies {
|
||||
api project(':vtm')
|
||||
implementation('org.jeo:jeo:0-SNAPSHOT') {
|
||||
api('org.jeo:jeo:0-SNAPSHOT') {
|
||||
exclude group: 'org.slf4j', module: 'slf4j-jdk14'
|
||||
}
|
||||
implementation('org.jeo:jeo-carto:0-SNAPSHOT') {
|
||||
api('org.jeo:jeo-carto:0-SNAPSHOT') {
|
||||
exclude group: 'org.slf4j', module: 'slf4j-jdk14'
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@ apply plugin: 'maven'
|
||||
|
||||
dependencies {
|
||||
api project(':vtm')
|
||||
implementation 'com.fasterxml.jackson.core:jackson-core:2.8.4'
|
||||
api 'com.fasterxml.jackson.core:jackson-core:2.8.4'
|
||||
}
|
||||
|
||||
sourceSets {
|
||||
|
||||
@@ -266,8 +266,8 @@ public class TileDecoder implements ITileDecoder {
|
||||
}
|
||||
|
||||
private void removeLastPoint() {
|
||||
mMapElement.pointPos -= 2;
|
||||
mMapElement.index[mMapElement.indexPos] -= 2;
|
||||
mMapElement.pointNextPos -= 2;
|
||||
mMapElement.index[mMapElement.indexCurrentPos] -= 2;
|
||||
}
|
||||
|
||||
private void parseLineString(JsonParser jp) throws IOException {
|
||||
|
||||
@@ -3,8 +3,7 @@ apply plugin: 'maven'
|
||||
|
||||
dependencies {
|
||||
api project(':vtm')
|
||||
implementation 'com.vividsolutions:jts:1.13'
|
||||
implementation "org.slf4j:slf4j-api:$slf4jVersion"
|
||||
api 'com.vividsolutions:jts:1.13'
|
||||
}
|
||||
|
||||
sourceSets {
|
||||
|
||||
@@ -2,16 +2,14 @@ apply plugin: 'application'
|
||||
|
||||
dependencies {
|
||||
implementation project(':vtm-desktop')
|
||||
implementation project(':vtm-extras')
|
||||
file("${rootDir}/vtm-desktop/natives").eachDir() { dir ->
|
||||
implementation files(dir.path)
|
||||
}
|
||||
implementation project(':vtm-http')
|
||||
implementation project(':vtm-jeo')
|
||||
implementation project(':vtm-json')
|
||||
implementation project(':vtm-jts')
|
||||
implementation "com.badlogicgames.gdx:gdx:$gdxVersion"
|
||||
implementation "com.badlogicgames.gdx:gdx-backend-lwjgl:$gdxVersion"
|
||||
implementation 'com.squareup.okhttp3:okhttp:3.8.0'
|
||||
implementation 'org.jeo:jeo:0-SNAPSHOT'
|
||||
implementation 'org.jeo:jeo-render:0-SNAPSHOT'
|
||||
implementation "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-desktop"
|
||||
implementation "org.slf4j:slf4j-jdk14:$slf4jVersion"
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2016 devemux86
|
||||
* Copyright 2016-2017 devemux86
|
||||
*
|
||||
* This file is part of the OpenScienceMap project (http://www.opensciencemap.org).
|
||||
*
|
||||
@@ -22,6 +22,7 @@ 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.oscimap4.OSciMap4TileSource;
|
||||
|
||||
@@ -30,6 +31,7 @@ public class MapzenTest extends GdxMapImpl {
|
||||
@Override
|
||||
public void createLayers() {
|
||||
UrlTileSource tileSource = OSciMap4TileSource.builder()
|
||||
.httpFactory(new OkHttpEngine.OkHttpFactory())
|
||||
.url("https://vector.mapzen.com/osm/v0.8/all")
|
||||
.apiKey("vector-tiles-xxxxxxx") // Put a proper API key
|
||||
.build();
|
||||
|
||||
@@ -1,3 +1,20 @@
|
||||
/*
|
||||
* Copyright 2014 Hannes Janetzek
|
||||
* Copyright 2017 devemux86
|
||||
*
|
||||
* This file is part of the OpenScienceMap project (http://www.opensciencemap.org).
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify it under the
|
||||
* terms of the GNU Lesser General Public License as published by the Free Software
|
||||
* Foundation, either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||
* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License along with
|
||||
* this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package org.oscim.test;
|
||||
|
||||
import com.badlogic.gdx.Input;
|
||||
@@ -7,6 +24,7 @@ import org.oscim.gdx.GdxMapApp;
|
||||
import org.oscim.gdx.GdxMapImpl;
|
||||
import org.oscim.renderer.MapRenderer;
|
||||
import org.oscim.tiling.TileSource;
|
||||
import org.oscim.tiling.source.OkHttpEngine;
|
||||
import org.oscim.tiling.source.oscimap4.OSciMap4TileSource;
|
||||
|
||||
public class AnimatorTest extends GdxMapImpl {
|
||||
@@ -15,7 +33,9 @@ public class AnimatorTest extends GdxMapImpl {
|
||||
public void createLayers() {
|
||||
MapRenderer.setBackgroundColor(0xff000000);
|
||||
|
||||
TileSource ts = new OSciMap4TileSource();
|
||||
TileSource ts = OSciMap4TileSource.builder()
|
||||
.httpFactory(new OkHttpEngine.OkHttpFactory())
|
||||
.build();
|
||||
initDefaultLayers(ts, false, false, false);
|
||||
|
||||
mMap.setMapPosition(0, 0, 1 << 4);
|
||||
|
||||
@@ -28,6 +28,8 @@ 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;
|
||||
|
||||
@@ -46,7 +48,10 @@ public class AtlasMarkerLayerTest extends MarkerLayerTest {
|
||||
// Map events receiver
|
||||
mMap.layers().add(new MapEventsReceiver(mMap));
|
||||
|
||||
VectorTileLayer l = mMap.setBaseMap(new OSciMap4TileSource());
|
||||
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);
|
||||
|
||||
@@ -31,6 +31,8 @@ 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;
|
||||
|
||||
@@ -47,7 +49,10 @@ public class AtlasMultiTextureTest extends MarkerLayerTest {
|
||||
// Map events receiver
|
||||
mMap.layers().add(new MapEventsReceiver(mMap));
|
||||
|
||||
VectorTileLayer l = mMap.setBaseMap(new OSciMap4TileSource());
|
||||
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);
|
||||
|
||||
@@ -31,6 +31,8 @@ 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.io.IOException;
|
||||
@@ -48,7 +50,10 @@ public class ClusterMarkerLayerTest extends MarkerLayerTest {
|
||||
// Map events receiver
|
||||
mMap.layers().add(new MapEventsReceiver(mMap));
|
||||
|
||||
VectorTileLayer l = mMap.setBaseMap(new OSciMap4TileSource());
|
||||
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);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2016 devemux86
|
||||
* Copyright 2016-2017 devemux86
|
||||
*
|
||||
* This file is part of the OpenScienceMap project (http://www.opensciencemap.org).
|
||||
*
|
||||
@@ -62,7 +62,9 @@ public class ExternalRenderThemeTest extends GdxMapImpl {
|
||||
public void createLayers() {
|
||||
mMap.setMapPosition(53.08, 8.83, 1 << 14);
|
||||
|
||||
// TileSource tileSource = new OSciMap4TileSource();
|
||||
/*TileSource tileSource = OSciMap4TileSource.builder()
|
||||
.httpFactory(new OkHttpEngine.OkHttpFactory())
|
||||
.build();*/
|
||||
|
||||
MapFileTileSource tileSource = new MapFileTileSource();
|
||||
// tileSource.setMapFile("/home/jeff/src/vtm/Freizeitkarte_DEU_NW.map");
|
||||
|
||||
@@ -32,6 +32,7 @@ import org.oscim.gdx.GdxMapImpl;
|
||||
import org.oscim.renderer.GLState;
|
||||
import org.oscim.renderer.MapRenderer;
|
||||
import org.oscim.tiling.TileSource;
|
||||
import org.oscim.tiling.source.OkHttpEngine;
|
||||
import org.oscim.tiling.source.oscimap4.OSciMap4TileSource;
|
||||
|
||||
import static org.oscim.backend.GLAdapter.gl;
|
||||
@@ -49,7 +50,9 @@ public class GdxSpriteBatchTest extends GdxMapImpl {
|
||||
|
||||
@Override
|
||||
protected void createLayers() {
|
||||
TileSource tileSource = new OSciMap4TileSource();
|
||||
TileSource tileSource = OSciMap4TileSource.builder()
|
||||
.httpFactory(new OkHttpEngine.OkHttpFactory())
|
||||
.build();
|
||||
initDefaultLayers(tileSource, false, true, false);
|
||||
mMap.setMapPosition(latitude, longitude, scale);
|
||||
|
||||
|
||||
@@ -48,7 +48,9 @@ public class LineRenderTest extends GdxMapImpl {
|
||||
public void createLayers() {
|
||||
MapRenderer.setBackgroundColor(0xff000000);
|
||||
|
||||
// TileSource ts = new OSciMap4TileSource();
|
||||
/*TileSource ts = OSciMap4TileSource.builder()
|
||||
.httpFactory(new OkHttpEngine.OkHttpFactory())
|
||||
.build();*/
|
||||
// ts.setOption("url", "http://opensciencemap.org/tiles/vtm");
|
||||
// initDefaultLayers(ts, false, false, false);
|
||||
|
||||
|
||||
@@ -31,6 +31,8 @@ import org.oscim.layers.vector.geometries.Style;
|
||||
import org.oscim.map.Map;
|
||||
import org.oscim.renderer.bucket.TextureItem;
|
||||
import org.oscim.theme.VtmThemes;
|
||||
import org.oscim.tiling.TileSource;
|
||||
import org.oscim.tiling.source.OkHttpEngine;
|
||||
import org.oscim.tiling.source.oscimap4.OSciMap4TileSource;
|
||||
|
||||
import java.io.IOException;
|
||||
@@ -46,7 +48,10 @@ public class LineTexTest extends GdxMapApp {
|
||||
|
||||
@Override
|
||||
public void createLayers() {
|
||||
VectorTileLayer l = mMap.setBaseMap(new OSciMap4TileSource());
|
||||
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);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2016 devemux86
|
||||
* Copyright 2016-2017 devemux86
|
||||
*
|
||||
* This file is part of the OpenScienceMap project (http://www.opensciencemap.org).
|
||||
*
|
||||
@@ -30,6 +30,8 @@ import org.oscim.scalebar.MapScaleBar;
|
||||
import org.oscim.scalebar.MapScaleBarLayer;
|
||||
import org.oscim.scalebar.MetricUnitAdapter;
|
||||
import org.oscim.theme.VtmThemes;
|
||||
import org.oscim.tiling.TileSource;
|
||||
import org.oscim.tiling.source.OkHttpEngine;
|
||||
import org.oscim.tiling.source.oscimap4.OSciMap4TileSource;
|
||||
|
||||
public class MapTest extends GdxMapApp {
|
||||
@@ -38,7 +40,10 @@ public class MapTest extends GdxMapApp {
|
||||
public void createLayers() {
|
||||
Map map = getMap();
|
||||
|
||||
VectorTileLayer l = map.setBaseMap(new OSciMap4TileSource());
|
||||
TileSource tileSource = OSciMap4TileSource.builder()
|
||||
.httpFactory(new OkHttpEngine.OkHttpFactory())
|
||||
.build();
|
||||
VectorTileLayer l = map.setBaseMap(tileSource);
|
||||
|
||||
GroupLayer groupLayer = new GroupLayer(mMap);
|
||||
groupLayer.layers.add(new BuildingLayer(map, l));
|
||||
|
||||
@@ -30,6 +30,8 @@ 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.io.IOException;
|
||||
@@ -50,7 +52,10 @@ public class MarkerLayerTest extends GdxMapApp implements ItemizedLayer.OnItemGe
|
||||
// Map events receiver
|
||||
mMap.layers().add(new MapEventsReceiver(mMap));
|
||||
|
||||
VectorTileLayer l = mMap.setBaseMap(new OSciMap4TileSource());
|
||||
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);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2016 devemux86
|
||||
* Copyright 2016-2017 devemux86
|
||||
*
|
||||
* This file is part of the OpenScienceMap project (http://www.opensciencemap.org).
|
||||
*
|
||||
@@ -17,24 +17,30 @@
|
||||
package org.oscim.test;
|
||||
|
||||
import org.oscim.gdx.GdxMapApp;
|
||||
import org.oscim.layers.tile.buildings.S3DBLayer;
|
||||
import org.oscim.layers.tile.buildings.S3DBTileLayer;
|
||||
import org.oscim.theme.VtmThemes;
|
||||
import org.oscim.tiling.TileSource;
|
||||
import org.oscim.tiling.source.OkHttpEngine;
|
||||
import org.oscim.tiling.source.oscimap4.OSciMap4TileSource;
|
||||
|
||||
public class S3DBLayerTest extends GdxMapApp {
|
||||
public class OSciMapS3DBTest extends GdxMapApp {
|
||||
|
||||
@Override
|
||||
public void createLayers() {
|
||||
mMap.setBaseMap(new OSciMap4TileSource());
|
||||
TileSource tileSource = OSciMap4TileSource.builder()
|
||||
.httpFactory(new OkHttpEngine.OkHttpFactory())
|
||||
.build();
|
||||
mMap.setBaseMap(tileSource);
|
||||
mMap.setTheme(VtmThemes.DEFAULT);
|
||||
|
||||
TileSource ts = OSciMap4TileSource
|
||||
.builder()
|
||||
TileSource ts = OSciMap4TileSource.builder()
|
||||
.httpFactory(new OkHttpEngine.OkHttpFactory())
|
||||
.url("http://opensciencemap.org/tiles/s3db")
|
||||
.zoomMin(16)
|
||||
.zoomMax(16)
|
||||
.build();
|
||||
|
||||
S3DBLayer tl = new S3DBLayer(mMap, ts);
|
||||
S3DBTileLayer tl = new S3DBTileLayer(mMap, ts);
|
||||
mMap.layers().add(tl);
|
||||
|
||||
mMap.setMapPosition(53.08, 8.82, 1 << 17);
|
||||
@@ -43,6 +49,6 @@ public class S3DBLayerTest extends GdxMapApp {
|
||||
|
||||
public static void main(String[] args) {
|
||||
init();
|
||||
run(new S3DBLayerTest());
|
||||
run(new OSciMapS3DBTest());
|
||||
}
|
||||
}
|
||||
@@ -29,6 +29,8 @@ import org.oscim.layers.tile.vector.labeling.LabelLayer;
|
||||
import org.oscim.layers.vector.PathLayer;
|
||||
import org.oscim.map.Map.UpdateListener;
|
||||
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;
|
||||
@@ -42,7 +44,10 @@ public class PathLayerTest extends GdxMapApp {
|
||||
|
||||
@Override
|
||||
public void createLayers() {
|
||||
VectorTileLayer l = mMap.setBaseMap(new OSciMap4TileSource());
|
||||
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);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2016 devemux86
|
||||
* Copyright 2016-2017 devemux86
|
||||
*
|
||||
* This file is part of the OpenScienceMap project (http://www.opensciencemap.org).
|
||||
*
|
||||
@@ -32,6 +32,7 @@ import org.oscim.theme.styles.LineStyle;
|
||||
import org.oscim.theme.styles.LineStyle.LineBuilder;
|
||||
import org.oscim.theme.styles.RenderStyle;
|
||||
import org.oscim.tiling.TileSource;
|
||||
import org.oscim.tiling.source.OkHttpEngine;
|
||||
import org.oscim.tiling.source.oscimap4.OSciMap4TileSource;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
@@ -71,7 +72,9 @@ public class RuleVisitorTest extends GdxMapImpl {
|
||||
public void createLayers() {
|
||||
MapRenderer.setBackgroundColor(0xf0f0f0);
|
||||
|
||||
TileSource ts = new OSciMap4TileSource();
|
||||
TileSource ts = OSciMap4TileSource.builder()
|
||||
.httpFactory(new OkHttpEngine.OkHttpFactory())
|
||||
.build();
|
||||
VectorTileLayer l = mMap.setBaseMap(ts);
|
||||
|
||||
mMap.setTheme(VtmThemes.DEFAULT);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2016 devemux86
|
||||
* Copyright 2016-2017 devemux86
|
||||
*
|
||||
* This file is part of the OpenScienceMap project (http://www.opensciencemap.org).
|
||||
*
|
||||
@@ -23,14 +23,12 @@ import org.oscim.gdx.GdxMapImpl;
|
||||
import org.oscim.layers.tile.vector.VectorTileLayer;
|
||||
import org.oscim.layers.tile.vector.labeling.LabelLayer;
|
||||
import org.oscim.theme.RenderTheme;
|
||||
import org.oscim.tiling.TileSource;
|
||||
import org.oscim.tiling.source.OkHttpEngine;
|
||||
import org.oscim.tiling.source.oscimap4.OSciMap4TileSource;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
public class ThemeBuilderTest extends GdxMapImpl {
|
||||
|
||||
final Logger log = LoggerFactory.getLogger(S3DBLayerTest.class);
|
||||
|
||||
static class MyTheme extends ThemeBuilder {
|
||||
public MyTheme() {
|
||||
rules(
|
||||
@@ -57,7 +55,10 @@ public class ThemeBuilderTest extends GdxMapImpl {
|
||||
@Override
|
||||
public void createLayers() {
|
||||
|
||||
VectorTileLayer l = mMap.setBaseMap(new OSciMap4TileSource());
|
||||
TileSource tileSource = OSciMap4TileSource.builder()
|
||||
.httpFactory(new OkHttpEngine.OkHttpFactory())
|
||||
.build();
|
||||
VectorTileLayer l = mMap.setBaseMap(tileSource);
|
||||
|
||||
RenderTheme t = new MyTheme().build();
|
||||
|
||||
|
||||
@@ -36,6 +36,7 @@ import org.oscim.renderer.MapRenderer;
|
||||
import org.oscim.theme.VtmThemes;
|
||||
import org.oscim.tiling.QueryResult;
|
||||
import org.oscim.tiling.TileSource;
|
||||
import org.oscim.tiling.source.OkHttpEngine;
|
||||
import org.oscim.tiling.source.oscimap4.OSciMap4TileSource;
|
||||
|
||||
public class TileRenderTest extends GdxMapApp {
|
||||
@@ -92,7 +93,9 @@ public class TileRenderTest extends GdxMapApp {
|
||||
TestVectorTileLayer tileLayer = new TestVectorTileLayer(mMap, tileManager);
|
||||
tileLoader[0] = tileLayer.getTileLoader();
|
||||
|
||||
TileSource tileSource = new OSciMap4TileSource();
|
||||
TileSource tileSource = OSciMap4TileSource.builder()
|
||||
.httpFactory(new OkHttpEngine.OkHttpFactory())
|
||||
.build();
|
||||
//TileSource tileSource = new TestTileSource();
|
||||
|
||||
tileLayer.setTileSource(tileSource);
|
||||
|
||||
@@ -25,6 +25,8 @@ import org.oscim.layers.vector.VectorLayer;
|
||||
import org.oscim.layers.vector.geometries.PointDrawable;
|
||||
import org.oscim.layers.vector.geometries.Style;
|
||||
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.ColorUtil;
|
||||
|
||||
@@ -32,7 +34,10 @@ public class VectorLayerTest extends GdxMapApp {
|
||||
|
||||
@Override
|
||||
public void createLayers() {
|
||||
VectorTileLayer l = mMap.setBaseMap(new OSciMap4TileSource());
|
||||
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);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2016 devemux86
|
||||
* Copyright 2016-2017 devemux86
|
||||
*
|
||||
* This file is part of the OpenScienceMap project (http://www.opensciencemap.org).
|
||||
*
|
||||
@@ -24,6 +24,7 @@ import org.oscim.layers.tile.vector.labeling.LabelLayer;
|
||||
import org.oscim.renderer.MapRenderer;
|
||||
import org.oscim.theme.VtmThemes;
|
||||
import org.oscim.tiling.TileSource;
|
||||
import org.oscim.tiling.source.OkHttpEngine;
|
||||
import org.oscim.tiling.source.oscimap4.OSciMap4TileSource;
|
||||
|
||||
public class Gdx3DTest extends GdxMapImpl {
|
||||
@@ -34,7 +35,9 @@ public class Gdx3DTest extends GdxMapImpl {
|
||||
|
||||
mMap.setMapPosition(53.1, 8.8, 1 << 15);
|
||||
|
||||
TileSource ts = new OSciMap4TileSource();
|
||||
TileSource ts = OSciMap4TileSource.builder()
|
||||
.httpFactory(new OkHttpEngine.OkHttpFactory())
|
||||
.build();
|
||||
// initDefaultLayers(ts, false, false, false);
|
||||
|
||||
VectorTileLayer mMapLayer = mMap.setBaseMap(ts);
|
||||
|
||||
@@ -20,6 +20,7 @@ import org.oscim.gdx.GdxMapApp;
|
||||
import org.oscim.layers.tile.vector.VectorTileLayer;
|
||||
import org.oscim.renderer.MapRenderer;
|
||||
import org.oscim.theme.carto.RenderTheme;
|
||||
import org.oscim.tiling.source.OkHttpEngine;
|
||||
import org.oscim.tiling.source.UrlTileSource;
|
||||
import org.oscim.tiling.source.oscimap4.OSciMap4TileSource;
|
||||
|
||||
@@ -32,7 +33,9 @@ public class ThemeTest extends GdxMapApp {
|
||||
|
||||
@Override
|
||||
public void createLayers() {
|
||||
UrlTileSource ts = new OSciMap4TileSource();
|
||||
UrlTileSource ts = OSciMap4TileSource.builder()
|
||||
.httpFactory(new OkHttpEngine.OkHttpFactory())
|
||||
.build();
|
||||
|
||||
VectorTileLayer l = mMap.setBaseMap(ts);
|
||||
|
||||
|
||||
@@ -1,2 +0,0 @@
|
||||
org.slf4j.simpleLogger.defaultLogLevel=debug
|
||||
#org.slf4j.simpleLogger.showThreadName=true
|
||||
@@ -2,7 +2,6 @@ apply plugin: 'java'
|
||||
|
||||
dependencies {
|
||||
implementation project(':vtm-http')
|
||||
implementation 'com.squareup.okhttp3:okhttp:3.8.0'
|
||||
testImplementation 'com.squareup.okhttp3:mockwebserver:3.8.0'
|
||||
testImplementation 'junit:junit:4.12'
|
||||
testImplementation 'org.easytesting:fest-assert-core:2.0M10'
|
||||
|
||||
@@ -6,9 +6,11 @@ repositories {
|
||||
|
||||
dependencies {
|
||||
implementation project(':vtm-desktop')
|
||||
file("${rootDir}/vtm-desktop/natives").eachDir() { dir ->
|
||||
implementation files(dir.path)
|
||||
}
|
||||
implementation 'ch.qos.logback:logback-classic:1.2.3'
|
||||
implementation "com.badlogicgames.gdx:gdx:$gdxVersion"
|
||||
implementation "com.badlogicgames.gdx:gdx-backend-lwjgl:$gdxVersion"
|
||||
implementation "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-desktop"
|
||||
implementation 'com.fifesoft:rsyntaxtextarea:2.6.1'
|
||||
implementation 'com.jtattoo:JTattoo:1.6.11'
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ buildscript {
|
||||
}
|
||||
dependencies {
|
||||
classpath 'de.richsource.gradle.plugins:gwt-gradle-plugin:0.6'
|
||||
classpath 'org.akhikhl.gretty:gretty:1.4.2'
|
||||
classpath 'org.akhikhl.gretty:gretty:2.0.0'
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,10 +18,6 @@ sourceSets {
|
||||
|
||||
dependencies {
|
||||
providedCompile project(':vtm-web')
|
||||
providedCompile "com.badlogicgames.gdx:gdx:$gdxVersion:sources"
|
||||
providedCompile "com.badlogicgames.gdx:gdx-backend-gwt:$gdxVersion:sources"
|
||||
providedCompile "com.badlogicgames.gdx:gdx-backend-gwt:$gdxVersion"
|
||||
providedCompile "org.slf4j:slf4j-api:$slf4jVersion"
|
||||
providedCompile 'ru.finam:slf4j-gwt:1.7.7.1'
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,68 @@
|
||||
/*
|
||||
* Copyright 2017 Izumi Kawashima
|
||||
*
|
||||
* 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.web.client;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.HashSet;
|
||||
|
||||
public class BuildingSolutionControl {
|
||||
private final String divQuerySelector;
|
||||
public final int MAX_VALUE = 65536;
|
||||
private Collection<ValueChangeListener> listeners = new HashSet<>();
|
||||
|
||||
public BuildingSolutionControl(String divQuerySelector) {
|
||||
this.divQuerySelector = divQuerySelector;
|
||||
}
|
||||
|
||||
public void init() {
|
||||
initNative(divQuerySelector);
|
||||
refresh();
|
||||
}
|
||||
|
||||
private native void initNative(String divQuerySelector)/*-{
|
||||
var bsc = $doc.querySelector(divQuerySelector);
|
||||
var that = this;
|
||||
function onUpdate(val){
|
||||
that.@org.oscim.web.client.BuildingSolutionControl::fireValueChangeListeners(I)(val);
|
||||
}
|
||||
bsc.addEventListener("input",function(){onUpdate(this.value);});
|
||||
bsc.addEventListener("change",function(){onUpdate(this.value);});
|
||||
}-*/;
|
||||
|
||||
private native void refresh()/*-{
|
||||
|
||||
}-*/;
|
||||
|
||||
public void addValueChangeListener(ValueChangeListener l) {
|
||||
this.listeners.add(l);
|
||||
}
|
||||
|
||||
public void removeValueChangeListener(ValueChangeListener l) {
|
||||
this.listeners.remove(l);
|
||||
}
|
||||
|
||||
private void fireValueChangeListeners(int val) {
|
||||
for (ValueChangeListener l : this.listeners) {
|
||||
l.onValueChange(val, MAX_VALUE);
|
||||
}
|
||||
}
|
||||
|
||||
public interface ValueChangeListener {
|
||||
void onValueChange(int val, int max);
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Copyright 2013 Hannes Janetzek
|
||||
* Copyright 2016 Izumi Kawashima
|
||||
* Copyright 2016-2017 Izumi Kawashima
|
||||
* Copyright 2017 devemux86
|
||||
*
|
||||
* This file is part of the OpenScienceMap project (http://www.opensciencemap.org).
|
||||
@@ -33,9 +33,10 @@ import org.oscim.gdx.client.MapConfig;
|
||||
import org.oscim.gdx.client.MapUrl;
|
||||
import org.oscim.layers.tile.bitmap.BitmapTileLayer;
|
||||
import org.oscim.layers.tile.buildings.BuildingLayer;
|
||||
import org.oscim.layers.tile.buildings.S3DBLayer;
|
||||
import org.oscim.layers.tile.buildings.S3DBTileLayer;
|
||||
import org.oscim.layers.tile.vector.VectorTileLayer;
|
||||
import org.oscim.layers.tile.vector.labeling.LabelLayer;
|
||||
import org.oscim.renderer.ExtrusionRenderer;
|
||||
import org.oscim.renderer.MapRenderer;
|
||||
import org.oscim.theme.StreamRenderTheme;
|
||||
import org.oscim.theme.VtmThemes;
|
||||
@@ -49,6 +50,8 @@ import org.slf4j.LoggerFactory;
|
||||
class GwtMap extends GdxMap {
|
||||
static final Logger log = LoggerFactory.getLogger(GwtMap.class);
|
||||
|
||||
BuildingLayer mBuildingLayer;
|
||||
BuildingSolutionControl mBuildingSolutionControl;
|
||||
SearchBox mSearchBox;
|
||||
|
||||
@Override
|
||||
@@ -138,24 +141,40 @@ class GwtMap extends GdxMap {
|
||||
.zoomMin(16)
|
||||
.zoomMax(16)
|
||||
.build();
|
||||
mMap.layers().add(new S3DBLayer(mMap, ts));
|
||||
mMap.layers().add(new S3DBTileLayer(mMap, ts));
|
||||
}
|
||||
if (l != null) {
|
||||
boolean nolabels = mapUrl.params.containsKey("nolabels");
|
||||
boolean nobuildings = mapUrl.params.containsKey("nobuildings");
|
||||
|
||||
if (!nobuildings && !s3db)
|
||||
mMap.layers().add(new BuildingLayer(mMap, l));
|
||||
if (!nobuildings && !s3db) {
|
||||
mBuildingLayer = new BuildingLayer(mMap, l);
|
||||
((ExtrusionRenderer) mBuildingLayer.getRenderer()).setZLimit((float) 65536 / 10);
|
||||
mMap.layers().add(mBuildingLayer);
|
||||
}
|
||||
|
||||
if (!nolabels)
|
||||
mMap.layers().add(new LabelLayer(mMap, l));
|
||||
}
|
||||
|
||||
mSearchBox = new SearchBox(mMap);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void createLayers() {
|
||||
mBuildingSolutionControl = new BuildingSolutionControl("#building-solution-input");
|
||||
mBuildingSolutionControl.addValueChangeListener(new BuildingSolutionControl.ValueChangeListener() {
|
||||
@Override
|
||||
public void onValueChange(int val, int max) {
|
||||
if (mBuildingLayer == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
((ExtrusionRenderer) mBuildingLayer.getRenderer()).setZLimit((float) val / 10);
|
||||
|
||||
mMap.updateMap(true);
|
||||
}
|
||||
});
|
||||
mBuildingSolutionControl.init();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -104,3 +104,17 @@ html,body {
|
||||
background-color: #DDDDDD;
|
||||
opacity: 0.5;
|
||||
}
|
||||
|
||||
#building-solution{
|
||||
z-index: 20001;
|
||||
position: absolute;
|
||||
top: 40px;
|
||||
left: 0px;
|
||||
}
|
||||
input[type=range][orient=vertical]{
|
||||
writing-mode: bt-lr; /* IE */
|
||||
-webkit-appearance: slider-vertical; /* WebKit */
|
||||
width: 8px;
|
||||
height: 175px;
|
||||
padding: 0 5px;
|
||||
}
|
||||
|
||||
@@ -73,5 +73,8 @@
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
<div id="building-solution">
|
||||
<input type="range" orient="vertical" id="building-solution-input" min="0" max="65536" value="65536"/>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -4,7 +4,7 @@ buildscript {
|
||||
}
|
||||
dependencies {
|
||||
classpath 'de.richsource.gradle.plugins:gwt-gradle-plugin:0.6'
|
||||
classpath 'org.akhikhl.gretty:gretty:1.4.2'
|
||||
classpath 'org.akhikhl.gretty:gretty:2.0.0'
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,11 +18,6 @@ sourceSets {
|
||||
|
||||
dependencies {
|
||||
providedCompile project(':vtm-web')
|
||||
providedCompile project(':vtm-extras')
|
||||
providedCompile "com.badlogicgames.gdx:gdx:$gdxVersion:sources"
|
||||
providedCompile "com.badlogicgames.gdx:gdx-backend-gwt:$gdxVersion:sources"
|
||||
providedCompile "com.badlogicgames.gdx:gdx-backend-gwt:$gdxVersion"
|
||||
providedCompile "org.slf4j:slf4j-api:$slf4jVersion"
|
||||
providedCompile 'org.timepedia.exporter:gwtexporter:2.5.1'
|
||||
providedCompile 'ru.finam:slf4j-gwt:1.7.7.1'
|
||||
}
|
||||
|
||||
@@ -17,12 +17,9 @@ sourceSets {
|
||||
|
||||
dependencies {
|
||||
api project(':vtm-gdx')
|
||||
api project(':vtm-extras')
|
||||
implementation "com.badlogicgames.gdx:gdx:$gdxVersion:sources"
|
||||
implementation "com.badlogicgames.gdx:gdx-backend-gwt:$gdxVersion:sources"
|
||||
implementation "com.badlogicgames.gdx:gdx-backend-gwt:$gdxVersion"
|
||||
implementation "org.slf4j:slf4j-api:$slf4jVersion"
|
||||
implementation 'ru.finam:slf4j-gwt:1.7.7.1'
|
||||
api "com.badlogicgames.gdx:gdx:$gdxVersion:sources"
|
||||
api "com.badlogicgames.gdx:gdx-backend-gwt:$gdxVersion"
|
||||
api "com.badlogicgames.gdx:gdx-backend-gwt:$gdxVersion:sources"
|
||||
}
|
||||
|
||||
// explicit dependencies for org.gradle.configureondemand=true
|
||||
|
||||
@@ -2,7 +2,7 @@ apply plugin: 'java-library'
|
||||
apply plugin: 'maven'
|
||||
|
||||
dependencies {
|
||||
implementation "org.slf4j:slf4j-api:$slf4jVersion"
|
||||
api "org.slf4j:slf4j-api:$slf4jVersion"
|
||||
compileOnly 'com.google.code.findbugs:jsr305:3.0.1'
|
||||
}
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@ uniform mat4 u_mvp;
|
||||
uniform vec4 u_color[4];
|
||||
uniform int u_mode;
|
||||
uniform float u_alpha;
|
||||
uniform float u_zlimit;
|
||||
attribute vec4 a_pos;
|
||||
attribute vec2 a_light;
|
||||
varying vec4 color;
|
||||
@@ -13,7 +14,11 @@ const float ff = 255.0;
|
||||
void
|
||||
main(){
|
||||
// change height by u_alpha
|
||||
gl_Position = u_mvp * vec4(a_pos.xy, a_pos.z * u_alpha, 1.0);
|
||||
float height = a_pos.z * u_alpha;
|
||||
if (height > u_zlimit) {
|
||||
height = u_zlimit;
|
||||
}
|
||||
gl_Position = u_mvp * vec4(a_pos.xy, height, 1.0);
|
||||
// depth = gl_Position.z;
|
||||
if (u_mode == -1) {
|
||||
;
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
/*
|
||||
* Copyright 2013 Hannes Janetzek
|
||||
* Copyright 2016 Andrey Novikov
|
||||
* Copyright 2017 Gustl22
|
||||
*
|
||||
* This file is part of the OpenScienceMap project (http://www.opensciencemap.org).
|
||||
*
|
||||
@@ -17,6 +18,8 @@
|
||||
*/
|
||||
package org.oscim.core;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
/* TODO
|
||||
* - check indexPos < Short.Max
|
||||
* - should make internals private, maybe
|
||||
@@ -56,23 +59,35 @@ public class GeometryBuffer {
|
||||
|
||||
/**
|
||||
* The points.
|
||||
* <p>
|
||||
* POLY/LINE: store point in order of polygon with
|
||||
* points[2 * n + 0] = x; points[2 * n + 1] = y; n is a N.
|
||||
* <p>
|
||||
* MESH: store points anywhere with
|
||||
* points[3 * n + 0] = x; points[3 * n + 1] = y; points[3 * n + 2] = z; n ∈ ℕ0.
|
||||
*/
|
||||
public float[] points;
|
||||
|
||||
/**
|
||||
* The indexes.
|
||||
* <p>
|
||||
* POLY/LINE: store 2 * number of points of each polygon / line. Point is (x, y).
|
||||
* <p>
|
||||
* MESH: store point indices of triangle (p1, p2, p3) with
|
||||
* index[3 * n + 0] = p1; index[3 * n + 1] = p2; index[3 * n + 2] = p3; n ∈ ℕ0.
|
||||
* Point p is (x, y, z).
|
||||
*/
|
||||
public int[] index;
|
||||
|
||||
/**
|
||||
* The current index position.
|
||||
*/
|
||||
public int indexPos;
|
||||
public int indexCurrentPos;
|
||||
|
||||
/**
|
||||
* The current position in points array.
|
||||
* The next position to insert a point in points array (equal to array size).
|
||||
*/
|
||||
public int pointPos;
|
||||
public int pointNextPos;
|
||||
|
||||
/**
|
||||
* The current geometry type.
|
||||
@@ -111,11 +126,27 @@ public class GeometryBuffer {
|
||||
this.points = points;
|
||||
this.index = index;
|
||||
this.type = GeometryType.NONE;
|
||||
this.indexPos = 0;
|
||||
this.pointPos = 0;
|
||||
this.indexCurrentPos = 0;
|
||||
this.pointNextPos = 0;
|
||||
this.pointLimit = points.length - 2;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param buffer the buffer to copy
|
||||
*/
|
||||
public GeometryBuffer(GeometryBuffer buffer) {
|
||||
int indexSize = 0;
|
||||
while (indexSize < buffer.index.length && buffer.index[indexSize] != -1) {
|
||||
indexSize++;
|
||||
}
|
||||
this.points = Arrays.copyOf(buffer.points, buffer.pointNextPos);
|
||||
this.index = Arrays.copyOf(buffer.index, indexSize);
|
||||
|
||||
this.pointNextPos = buffer.pointNextPos;
|
||||
this.indexCurrentPos = buffer.indexCurrentPos;
|
||||
this.type = buffer.type;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param out PointF to set coordinates to.
|
||||
* @return when out is null a temporary PointF is
|
||||
@@ -145,7 +176,7 @@ public class GeometryBuffer {
|
||||
}
|
||||
|
||||
public int getNumPoints() {
|
||||
return pointPos >> 1;
|
||||
return pointNextPos >> 1;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -153,8 +184,8 @@ public class GeometryBuffer {
|
||||
*/
|
||||
public GeometryBuffer clear() {
|
||||
index[0] = 0;
|
||||
indexPos = 0;
|
||||
pointPos = 0;
|
||||
indexCurrentPos = 0;
|
||||
pointNextPos = 0;
|
||||
type = GeometryType.NONE;
|
||||
return this;
|
||||
}
|
||||
@@ -166,13 +197,13 @@ public class GeometryBuffer {
|
||||
* @param y the y ordinate
|
||||
*/
|
||||
public GeometryBuffer addPoint(float x, float y) {
|
||||
if (pointPos > pointLimit)
|
||||
ensurePointSize((pointPos >> 1) + 1, true);
|
||||
if (pointNextPos > pointLimit)
|
||||
ensurePointSize((pointNextPos >> 1) + 1, true);
|
||||
|
||||
points[pointPos++] = x;
|
||||
points[pointPos++] = y;
|
||||
points[pointNextPos++] = x;
|
||||
points[pointNextPos++] = y;
|
||||
|
||||
index[indexPos] += 2;
|
||||
index[indexCurrentPos] += 2;
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -188,6 +219,10 @@ public class GeometryBuffer {
|
||||
return type == GeometryType.POINT;
|
||||
}
|
||||
|
||||
public boolean isTris() {
|
||||
return type == GeometryType.TRIS;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the point x,y at position pos.
|
||||
*
|
||||
@@ -214,19 +249,19 @@ public class GeometryBuffer {
|
||||
setOrCheckMode(GeometryType.LINE);
|
||||
|
||||
/* ignore */
|
||||
if (index[indexPos] > 0) {
|
||||
if (index[indexCurrentPos] > 0) {
|
||||
|
||||
/* start next */
|
||||
if ((index[0] >= 0) && (++indexPos >= index.length))
|
||||
ensureIndexSize(indexPos, true);
|
||||
if ((index[0] >= 0) && (++indexCurrentPos >= index.length))
|
||||
ensureIndexSize(indexCurrentPos, true);
|
||||
|
||||
/* initialize with zero points */
|
||||
index[indexPos] = 0;
|
||||
index[indexCurrentPos] = 0;
|
||||
}
|
||||
|
||||
/* set new end marker */
|
||||
if (index.length > indexPos + 1)
|
||||
index[indexPos + 1] = -1;
|
||||
if (index.length > indexCurrentPos + 1)
|
||||
index[indexCurrentPos + 1] = -1;
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -237,23 +272,23 @@ public class GeometryBuffer {
|
||||
boolean start = (type == GeometryType.NONE);
|
||||
setOrCheckMode(GeometryType.POLY);
|
||||
|
||||
if ((indexPos + 3) > index.length)
|
||||
ensureIndexSize(indexPos + 2, true);
|
||||
if ((indexCurrentPos + 3) > index.length)
|
||||
ensureIndexSize(indexCurrentPos + 2, true);
|
||||
|
||||
if (!start && index[indexPos] != 0) {
|
||||
if (!start && index[indexCurrentPos] != 0) {
|
||||
/* end polygon */
|
||||
index[++indexPos] = 0;
|
||||
index[++indexCurrentPos] = 0;
|
||||
|
||||
/* next polygon start */
|
||||
indexPos++;
|
||||
indexCurrentPos++;
|
||||
}
|
||||
|
||||
/* initialize with zero points */
|
||||
index[indexPos] = 0;
|
||||
index[indexCurrentPos] = 0;
|
||||
|
||||
/* set new end marker */
|
||||
if (index.length > indexPos + 1)
|
||||
index[indexPos + 1] = -1;
|
||||
if (index.length > indexCurrentPos + 1)
|
||||
index[indexCurrentPos + 1] = -1;
|
||||
|
||||
return this;
|
||||
}
|
||||
@@ -264,19 +299,19 @@ public class GeometryBuffer {
|
||||
public void startHole() {
|
||||
checkMode(GeometryType.POLY);
|
||||
|
||||
if ((indexPos + 2) > index.length)
|
||||
ensureIndexSize(indexPos + 1, true);
|
||||
if ((indexCurrentPos + 2) > index.length)
|
||||
ensureIndexSize(indexCurrentPos + 1, true);
|
||||
|
||||
/* initialize with zero points */
|
||||
index[++indexPos] = 0;
|
||||
index[++indexCurrentPos] = 0;
|
||||
|
||||
/* set new end marker */
|
||||
if (index.length > indexPos + 1)
|
||||
index[indexPos + 1] = -1;
|
||||
if (index.length > indexCurrentPos + 1)
|
||||
index[indexCurrentPos + 1] = -1;
|
||||
}
|
||||
|
||||
public GeometryBuffer translate(float dx, float dy) {
|
||||
for (int i = 0; i < pointPos; i += 2) {
|
||||
for (int i = 0; i < pointNextPos; i += 2) {
|
||||
points[i] += dx;
|
||||
points[i + 1] += dy;
|
||||
}
|
||||
@@ -284,7 +319,7 @@ public class GeometryBuffer {
|
||||
}
|
||||
|
||||
public GeometryBuffer scale(float scaleX, float scaleY) {
|
||||
for (int i = 0; i < pointPos; i += 2) {
|
||||
for (int i = 0; i < pointNextPos; i += 2) {
|
||||
points[i] *= scaleX;
|
||||
points[i + 1] *= scaleY;
|
||||
}
|
||||
@@ -439,24 +474,43 @@ public class GeometryBuffer {
|
||||
for (int i = 0; i < index.length; i++) {
|
||||
if (index[i] < 0)
|
||||
break;
|
||||
if (index[i] == 0)
|
||||
continue;
|
||||
sb.append(":");
|
||||
sb.append(index[i]);
|
||||
sb.append('\n');
|
||||
|
||||
for (int j = 0; j < index[i]; j += 2) {
|
||||
sb.append('[')
|
||||
.append(points[o + j])
|
||||
.append(',')
|
||||
.append(points[o + j + 1])
|
||||
if (!isTris()) {
|
||||
if (index[i] == 0)
|
||||
continue;
|
||||
sb.append("POLY (")
|
||||
.append(i)
|
||||
.append(") { ");
|
||||
|
||||
for (int j = 0; j < index[i]; j += 2) {
|
||||
sb.append('[')
|
||||
.append(points[o + j])
|
||||
.append(", ")
|
||||
.append(points[o + j + 1])
|
||||
.append(']');
|
||||
|
||||
if (j % 4 == 0)
|
||||
sb.append('\n');
|
||||
}
|
||||
sb.append(" } \tnumPoints:")
|
||||
.append(index[i])
|
||||
.append('\n');
|
||||
o += index[i];
|
||||
} else {
|
||||
if (i % 3 == 0)
|
||||
sb.append("TRIS { ");
|
||||
sb.append('\t')
|
||||
.append(index[i])
|
||||
.append('[')
|
||||
.append(points[3 * index[i]])
|
||||
.append(", ")
|
||||
.append(points[3 * index[i] + 1])
|
||||
.append(", ")
|
||||
.append(points[3 * index[i] + 2])
|
||||
.append(']');
|
||||
|
||||
if (j % 4 == 0)
|
||||
sb.append('\n');
|
||||
if (i % 3 == 2)
|
||||
sb.append(" }\n");
|
||||
}
|
||||
sb.append('\n');
|
||||
o += index[i];
|
||||
}
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
@@ -18,15 +18,13 @@
|
||||
*/
|
||||
package org.oscim.core;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
/**
|
||||
* The MapElement class is a reusable containter for a geometry
|
||||
* The MapElement class is a reusable container for a geometry
|
||||
* with tags.
|
||||
* MapElement is created by TileDataSource(s) and passed to
|
||||
* MapTileLoader via ITileDataSink.process().
|
||||
* This is just a buffer that belongs to TileDataSource,
|
||||
* so dont keep a reference to it when passed as parameter.
|
||||
* so don't keep a reference to it when passed as parameter.
|
||||
*/
|
||||
public class MapElement extends GeometryBuffer {
|
||||
|
||||
@@ -51,6 +49,16 @@ public class MapElement extends GeometryBuffer {
|
||||
super(points, index);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param element the map element to copy
|
||||
*/
|
||||
public MapElement(MapElement element) {
|
||||
super(element);
|
||||
this.tags.set(element.tags.asArray());
|
||||
this.labelPosition = element.labelPosition;
|
||||
this.setLayer(element.layer);
|
||||
}
|
||||
|
||||
public void setLabelPosition(float x, float y) {
|
||||
labelPosition = new PointF(x, y);
|
||||
}
|
||||
@@ -68,32 +76,6 @@ public class MapElement extends GeometryBuffer {
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
|
||||
return tags.toString() + '\n' + super.toString() + '\n';
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @return a deep copy of this MapElement
|
||||
*/
|
||||
public MapElement clone() {
|
||||
int indexSize = this.indexPos + 1;
|
||||
for (int i = 0; i < this.index.length; i++) {
|
||||
if (this.index[i] == -1) {
|
||||
indexSize = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
float[] copyPoints = Arrays.copyOf(this.points, this.pointPos);
|
||||
int[] copyIndex = Arrays.copyOf(this.index, indexSize);
|
||||
|
||||
MapElement copy = new MapElement(copyPoints, copyIndex);
|
||||
copy.tags.set(this.tags.asArray());
|
||||
copy.pointPos = this.pointPos;
|
||||
copy.labelPosition = this.labelPosition;
|
||||
copy.setLayer(this.layer);
|
||||
copy.indexPos = this.indexPos;
|
||||
copy.type = this.type;
|
||||
return copy;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -70,10 +70,13 @@ public class Tag {
|
||||
public static final String KEY_MATERIAL = "material";
|
||||
public static final String KEY_MIN_HEIGHT = "min_height";
|
||||
public static final String KEY_ROOF = "roof";
|
||||
public static final String KEY_ROOF_ANGLE = "roof:angle";
|
||||
public static final String KEY_ROOF_COLOR = "roof:colour";
|
||||
public static final String KEY_ROOF_DIRECTION = "roof:direction";
|
||||
public static final String KEY_ROOF_HEIGHT = "roof:height";
|
||||
public static final String KEY_ROOF_LEVELS = "roof:levels";
|
||||
public static final String KEY_ROOF_MATERIAL = "roof:material";
|
||||
public static final String KEY_ROOF_ORIENTATION = "roof:orientation";
|
||||
public static final String KEY_ROOF_SHAPE = "roof:shape";
|
||||
public static final String KEY_VOLUME = "volume";
|
||||
|
||||
@@ -89,7 +92,9 @@ public class Tag {
|
||||
public static final String VALUE_PYRAMIDAL = "pyramidal";
|
||||
public static final String VALUE_ROUND = "round";
|
||||
public static final String VALUE_SALTBOX = "saltbox";
|
||||
public static final String VALUE_SKILLON = "skillion";
|
||||
public static final String VALUE_SKILLION = "skillion";
|
||||
|
||||
public static final String VALUE_ACROSS = "across"; // orientation across
|
||||
|
||||
/**
|
||||
* The key of this tag.
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
*/
|
||||
package org.oscim.layers.tile;
|
||||
|
||||
import org.oscim.core.MercatorProjection;
|
||||
import org.oscim.core.Tile;
|
||||
import org.oscim.layers.tile.vector.VectorTileLoader;
|
||||
import org.oscim.layers.tile.vector.labeling.LabelTileLoaderHook;
|
||||
@@ -340,6 +341,15 @@ public class MapTile extends Tile {
|
||||
return ((t.tileX % 4) + (t.tileY % 4 * 4) + 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the corresponding ground scale
|
||||
*/
|
||||
public float getGroundScale() {
|
||||
double lat = MercatorProjection.toLatitude(this.y);
|
||||
return (float) MercatorProjection
|
||||
.groundResolutionWithScale(lat, 1 << this.zoomLevel);
|
||||
}
|
||||
|
||||
public MapTile getProxyChild(int id, byte state) {
|
||||
if ((proxy & (1 << id)) == 0)
|
||||
return null;
|
||||
|
||||
@@ -20,7 +20,6 @@
|
||||
package org.oscim.layers.tile.buildings;
|
||||
|
||||
import org.oscim.core.MapElement;
|
||||
import org.oscim.core.MercatorProjection;
|
||||
import org.oscim.core.Tag;
|
||||
import org.oscim.layers.Layer;
|
||||
import org.oscim.layers.tile.MapTile;
|
||||
@@ -29,12 +28,10 @@ import org.oscim.layers.tile.vector.VectorTileLayer.TileLoaderThemeHook;
|
||||
import org.oscim.map.Map;
|
||||
import org.oscim.renderer.OffscreenRenderer;
|
||||
import org.oscim.renderer.OffscreenRenderer.Mode;
|
||||
import org.oscim.renderer.bucket.ExtrusionBucket;
|
||||
import org.oscim.renderer.bucket.ExtrusionBuckets;
|
||||
import org.oscim.renderer.bucket.RenderBuckets;
|
||||
import org.oscim.theme.styles.ExtrusionStyle;
|
||||
import org.oscim.theme.styles.RenderStyle;
|
||||
import org.oscim.utils.pool.Inlist;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
@@ -49,12 +46,12 @@ public class BuildingLayer extends Layer implements TileLoaderThemeHook {
|
||||
private final static int MIN_ZOOM = 17;
|
||||
private final static int MAX_ZOOM = 17;
|
||||
|
||||
private final static boolean POST_AA = false;
|
||||
public static boolean POST_AA = false;
|
||||
public static boolean TRANSLUCENT = true;
|
||||
|
||||
private static final Object BUILDING_DATA = BuildingLayer.class.getName();
|
||||
|
||||
// Can replace with Multimap in Java 8
|
||||
// Can be replaced with Multimap in Java 8
|
||||
private HashMap<Integer, List<BuildingElement>> mBuildings = new HashMap<>();
|
||||
|
||||
class BuildingElement {
|
||||
@@ -70,10 +67,14 @@ public class BuildingLayer extends Layer implements TileLoaderThemeHook {
|
||||
}
|
||||
|
||||
public BuildingLayer(Map map, VectorTileLayer tileLayer) {
|
||||
this(map, tileLayer, MIN_ZOOM, MAX_ZOOM);
|
||||
this(map, tileLayer, MIN_ZOOM, MAX_ZOOM, false);
|
||||
}
|
||||
|
||||
public BuildingLayer(Map map, VectorTileLayer tileLayer, int zoomMin, int zoomMax) {
|
||||
public BuildingLayer(Map map, VectorTileLayer tileLayer, boolean mesh) {
|
||||
this(map, tileLayer, MIN_ZOOM, MAX_ZOOM, mesh);
|
||||
}
|
||||
|
||||
public BuildingLayer(Map map, VectorTileLayer tileLayer, int zoomMin, int zoomMax, boolean mesh) {
|
||||
|
||||
super(map);
|
||||
|
||||
@@ -81,7 +82,7 @@ public class BuildingLayer extends Layer implements TileLoaderThemeHook {
|
||||
|
||||
mRenderer = new BuildingRenderer(tileLayer.tileRenderer(),
|
||||
zoomMin, zoomMax,
|
||||
false, TRANSLUCENT);
|
||||
mesh, !mesh && TRANSLUCENT); // alpha must be disabled for mesh renderer
|
||||
if (POST_AA)
|
||||
mRenderer = new OffscreenRenderer(Mode.SSAO_FXAA, mRenderer);
|
||||
}
|
||||
@@ -109,7 +110,7 @@ public class BuildingLayer extends Layer implements TileLoaderThemeHook {
|
||||
buildingElements = new ArrayList<>();
|
||||
mBuildings.put(tile.hashCode(), buildingElements);
|
||||
}
|
||||
element = element.clone(); // Deep copy, because element will be cleared
|
||||
element = new MapElement(element); // Deep copy, because element will be cleared
|
||||
buildingElements.add(new BuildingElement(element, extrusion, isBuildingPart));
|
||||
return true;
|
||||
}
|
||||
@@ -153,23 +154,7 @@ public class BuildingLayer extends Layer implements TileLoaderThemeHook {
|
||||
height = extrusion.defaultHeight * 100;
|
||||
|
||||
ExtrusionBuckets ebs = get(tile);
|
||||
|
||||
for (ExtrusionBucket b = ebs.buckets; b != null; b = b.next()) {
|
||||
if (b.colors == extrusion.colors) {
|
||||
b.add(element, height, minHeight);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
double lat = MercatorProjection.toLatitude(tile.y);
|
||||
float groundScale = (float) MercatorProjection
|
||||
.groundResolutionWithScale(lat, 1 << tile.zoomLevel);
|
||||
|
||||
ebs.buckets = Inlist.push(ebs.buckets,
|
||||
new ExtrusionBucket(0, groundScale,
|
||||
extrusion.colors));
|
||||
|
||||
ebs.buckets.add(element, height, minHeight);
|
||||
ebs.addPolyElement(element, tile.getGroundScale(), extrusion.colors, height, minHeight);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -211,13 +196,17 @@ public class BuildingLayer extends Layer implements TileLoaderThemeHook {
|
||||
mBuildings.remove(tile.hashCode());
|
||||
}
|
||||
|
||||
/**
|
||||
* @param tile the MapTile
|
||||
* @return ExtrusionBuckets of the tile
|
||||
*/
|
||||
public static ExtrusionBuckets get(MapTile tile) {
|
||||
ExtrusionBuckets eb = (ExtrusionBuckets) tile.getData(BUILDING_DATA);
|
||||
if (eb == null) {
|
||||
eb = new ExtrusionBuckets(tile);
|
||||
tile.addData(BUILDING_DATA, eb);
|
||||
ExtrusionBuckets ebs = (ExtrusionBuckets) tile.getData(BUILDING_DATA);
|
||||
if (ebs == null) {
|
||||
ebs = new ExtrusionBuckets(tile);
|
||||
tile.addData(BUILDING_DATA, ebs);
|
||||
}
|
||||
return eb;
|
||||
return ebs;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -226,7 +215,7 @@ public class BuildingLayer extends Layer implements TileLoaderThemeHook {
|
||||
processElements(tile);
|
||||
get(tile).prepare();
|
||||
} else
|
||||
get(tile).setBuckets(null);
|
||||
get(tile).resetBuckets(null);
|
||||
}
|
||||
|
||||
// private int multi;
|
||||
|
||||
98
vtm/src/org/oscim/layers/tile/buildings/S3DBTileLayer.java
Normal file
98
vtm/src/org/oscim/layers/tile/buildings/S3DBTileLayer.java
Normal file
@@ -0,0 +1,98 @@
|
||||
/*
|
||||
* Copyright 2013 Hannes Janetzek
|
||||
*
|
||||
* 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.layers.tile.buildings;
|
||||
|
||||
import org.oscim.layers.tile.TileLayer;
|
||||
import org.oscim.layers.tile.TileManager;
|
||||
import org.oscim.layers.tile.TileRenderer;
|
||||
import org.oscim.map.Map;
|
||||
import org.oscim.renderer.GLViewport;
|
||||
import org.oscim.renderer.LayerRenderer;
|
||||
import org.oscim.renderer.OffscreenRenderer;
|
||||
import org.oscim.renderer.OffscreenRenderer.Mode;
|
||||
import org.oscim.tiling.TileSource;
|
||||
|
||||
public class S3DBTileLayer extends TileLayer {
|
||||
|
||||
private final static int MAX_CACHE = 32;
|
||||
|
||||
private final static int MIN_ZOOM = 16;
|
||||
private final static int MAX_ZOOM = 16;
|
||||
|
||||
private final TileSource mTileSource;
|
||||
|
||||
public S3DBTileLayer(Map map, TileSource tileSource) {
|
||||
this(map, tileSource, true, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Simple-3D-Buildings OSCIM4 Tile Layer
|
||||
*
|
||||
* @param map Stored map workaround
|
||||
* @param tileSource Source of loaded tiles in {@link org.oscim.layers.tile.vector.VectorTileLayer}
|
||||
* @param fxaa Switch on Fast Approximate Anti-Aliasing
|
||||
* @param ssao Switch on Screen Space Ambient Occlusion
|
||||
*/
|
||||
public S3DBTileLayer(Map map, TileSource tileSource, boolean fxaa, boolean ssao) {
|
||||
super(map, new TileManager(map, MAX_CACHE));
|
||||
setRenderer(new S3DBTileRenderer(fxaa, ssao));
|
||||
|
||||
mTileManager.setZoomLevel(MIN_ZOOM, MAX_ZOOM);
|
||||
mTileSource = tileSource;
|
||||
initLoader(2);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected S3DBTileLoader createLoader() {
|
||||
return new S3DBTileLoader(getManager(), mTileSource);
|
||||
}
|
||||
|
||||
public static class S3DBTileRenderer extends TileRenderer {
|
||||
LayerRenderer mRenderer;
|
||||
|
||||
public S3DBTileRenderer(boolean fxaa, boolean ssao) {
|
||||
mRenderer = new BuildingRenderer(this, MIN_ZOOM, MAX_ZOOM, true, false);
|
||||
|
||||
if (fxaa || ssao) {
|
||||
Mode mode = Mode.FXAA;
|
||||
if (fxaa && ssao)
|
||||
mode = Mode.SSAO_FXAA;
|
||||
else if (ssao)
|
||||
mode = Mode.SSAO;
|
||||
mRenderer = new OffscreenRenderer(mode, mRenderer);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public synchronized void update(GLViewport v) {
|
||||
super.update(v);
|
||||
mRenderer.update(v);
|
||||
setReady(mRenderer.isReady());
|
||||
}
|
||||
|
||||
@Override
|
||||
public synchronized void render(GLViewport v) {
|
||||
mRenderer.render(v);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean setup() {
|
||||
mRenderer.setup();
|
||||
return super.setup();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -21,7 +21,6 @@ import org.oscim.backend.canvas.Color;
|
||||
import org.oscim.core.GeometryBuffer;
|
||||
import org.oscim.core.GeometryBuffer.GeometryType;
|
||||
import org.oscim.core.MapElement;
|
||||
import org.oscim.core.MercatorProjection;
|
||||
import org.oscim.core.Tag;
|
||||
import org.oscim.layers.tile.MapTile;
|
||||
import org.oscim.layers.tile.TileLoader;
|
||||
@@ -96,9 +95,7 @@ class S3DBTileLoader extends TileLoader {
|
||||
}
|
||||
|
||||
private void initTile(MapTile tile) {
|
||||
double lat = MercatorProjection.toLatitude(tile.y);
|
||||
mGroundScale = (float) MercatorProjection
|
||||
.groundResolutionWithScale(lat, 1 << mTile.zoomLevel);
|
||||
mGroundScale = tile.getGroundScale();
|
||||
|
||||
mRoofs = new ExtrusionBucket(0, mGroundScale, Color.get(247, 249, 250));
|
||||
|
||||
@@ -106,7 +103,7 @@ class S3DBTileLoader extends TileLoader {
|
||||
//mRoofs = new ExtrusionLayer(0, mGroundScale, Color.get(207, 209, 210));
|
||||
mRoofs.next = mParts;
|
||||
|
||||
BuildingLayer.get(tile).setBuckets(mRoofs);
|
||||
BuildingLayer.get(tile).resetBuckets(mRoofs);
|
||||
|
||||
process(mTilePlane);
|
||||
}
|
||||
@@ -128,26 +125,27 @@ class S3DBTileLoader extends TileLoader {
|
||||
|
||||
int c = 0;
|
||||
if (element.tags.containsKey(OSCIM4_KEY_COLOR)) {
|
||||
c = S3DBLayer.getColor(element.tags.getValue(OSCIM4_KEY_COLOR), isRoof);
|
||||
c = S3DBUtils.getColor(element.tags.getValue(OSCIM4_KEY_COLOR), isRoof);
|
||||
}
|
||||
|
||||
if (c == 0 && element.tags.containsKey(OSCIM4_KEY_MATERIAL)) {
|
||||
c = S3DBLayer.getMaterialColor(element.tags.getValue(OSCIM4_KEY_MATERIAL), isRoof);
|
||||
c = S3DBUtils.getMaterialColor(element.tags.getValue(OSCIM4_KEY_MATERIAL), isRoof);
|
||||
}
|
||||
|
||||
if (c == 0) {
|
||||
String roofShape = element.tags.getValue(Tag.KEY_ROOF_SHAPE);
|
||||
|
||||
if (isRoof && (roofShape == null || Tag.VALUE_FLAT.equals(roofShape)))
|
||||
mRoofs.add(element);
|
||||
mRoofs.addMesh(element);
|
||||
else
|
||||
mParts.add(element);
|
||||
mParts.addMesh(element);
|
||||
return;
|
||||
}
|
||||
|
||||
// May replace with ExtrusionBucket.addMeshElement()
|
||||
for (ExtrusionBucket l = mParts; l != null; l = l.next()) {
|
||||
if (l.color == c) {
|
||||
l.add(element);
|
||||
if (l.getColor() == c) {
|
||||
l.addMesh(element);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -156,7 +154,7 @@ class S3DBTileLoader extends TileLoader {
|
||||
l.next = mParts.next;
|
||||
mParts.next = l;
|
||||
|
||||
l.add(element);
|
||||
l.addMesh(element);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
/*
|
||||
* Copyright 2013 Hannes Janetzek
|
||||
* Copyright 2017 Gustl22
|
||||
*
|
||||
* This file is part of the OpenScienceMap project (http://www.opensciencemap.org).
|
||||
*
|
||||
@@ -17,96 +18,27 @@
|
||||
package org.oscim.layers.tile.buildings;
|
||||
|
||||
import org.oscim.backend.canvas.Color;
|
||||
import org.oscim.layers.tile.TileLayer;
|
||||
import org.oscim.layers.tile.TileManager;
|
||||
import org.oscim.layers.tile.TileRenderer;
|
||||
import org.oscim.map.Map;
|
||||
import org.oscim.renderer.GLViewport;
|
||||
import org.oscim.renderer.LayerRenderer;
|
||||
import org.oscim.renderer.OffscreenRenderer;
|
||||
import org.oscim.renderer.OffscreenRenderer.Mode;
|
||||
import org.oscim.tiling.TileSource;
|
||||
import org.oscim.utils.ColorUtil;
|
||||
import org.oscim.utils.ColorsCSS;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
public class S3DBLayer extends TileLayer {
|
||||
static final Logger log = LoggerFactory.getLogger(S3DBLayer.class);
|
||||
|
||||
private final static int MAX_CACHE = 32;
|
||||
|
||||
private final static int MIN_ZOOM = 16;
|
||||
private final static int MAX_ZOOM = 16;
|
||||
/**
|
||||
* Provides utils for S3DB layers.
|
||||
*/
|
||||
public final class S3DBUtils {
|
||||
private static final Logger log = LoggerFactory.getLogger(S3DBUtils.class);
|
||||
|
||||
/* TODO get from theme */
|
||||
private final static double HSV_S = 0.7;
|
||||
private final static double HSV_V = 1.2;
|
||||
|
||||
private final TileSource mTileSource;
|
||||
|
||||
public S3DBLayer(Map map, TileSource tileSource) {
|
||||
this(map, tileSource, true, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Simple-3D-Buildings OSCIM4 Tile Layer
|
||||
*
|
||||
* @param map Stored map workaround
|
||||
* @param tileSource Source of loaded tiles in {@link org.oscim.layers.tile.vector.VectorTileLayer}
|
||||
* @param fxaa Switch on Fast Approximate Anti-Aliasing
|
||||
* @param ssao Switch on Screen Space Ambient Occlusion
|
||||
* @param color the color as string (see http://wiki.openstreetmap.org/wiki/Key:colour)
|
||||
* @param roof declare if color is used for roofs
|
||||
* @return the color as integer (8 bit each a, r, g, b)
|
||||
*/
|
||||
public S3DBLayer(Map map, TileSource tileSource, boolean fxaa, boolean ssao) {
|
||||
super(map, new TileManager(map, MAX_CACHE));
|
||||
setRenderer(new S3DBRenderer(fxaa, ssao));
|
||||
|
||||
mTileManager.setZoomLevel(MIN_ZOOM, MAX_ZOOM);
|
||||
mTileSource = tileSource;
|
||||
initLoader(2);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected S3DBTileLoader createLoader() {
|
||||
return new S3DBTileLoader(getManager(), mTileSource);
|
||||
}
|
||||
|
||||
public static class S3DBRenderer extends TileRenderer {
|
||||
LayerRenderer mRenderer;
|
||||
|
||||
public S3DBRenderer(boolean fxaa, boolean ssao) {
|
||||
mRenderer = new BuildingRenderer(this, MIN_ZOOM, MAX_ZOOM, true, false);
|
||||
|
||||
if (fxaa || ssao) {
|
||||
Mode mode = Mode.FXAA;
|
||||
if (fxaa && ssao)
|
||||
mode = Mode.SSAO_FXAA;
|
||||
else if (ssao)
|
||||
mode = Mode.SSAO;
|
||||
mRenderer = new OffscreenRenderer(mode, mRenderer);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public synchronized void update(GLViewport v) {
|
||||
super.update(v);
|
||||
mRenderer.update(v);
|
||||
setReady(mRenderer.isReady());
|
||||
}
|
||||
|
||||
@Override
|
||||
public synchronized void render(GLViewport v) {
|
||||
mRenderer.render(v);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean setup() {
|
||||
mRenderer.setup();
|
||||
return super.setup();
|
||||
}
|
||||
}
|
||||
|
||||
static int getColor(String color, boolean roof) {
|
||||
public static int getColor(String color, boolean roof) {
|
||||
|
||||
if (color.charAt(0) == '#') {
|
||||
int c = Color.parseColor(color, Color.CYAN);
|
||||
@@ -155,7 +87,12 @@ public class S3DBLayer extends TileLayer {
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int getMaterialColor(String material, boolean roof) {
|
||||
/**
|
||||
* @param material the material as string (see http://wiki.openstreetmap.org/wiki/Key:material and following pages)
|
||||
* @param roof declare if material is used for roofs
|
||||
* @return the color as integer (8 bit each a, r, g, b)
|
||||
*/
|
||||
public static int getMaterialColor(String material, boolean roof) {
|
||||
|
||||
if (roof) {
|
||||
if ("glass".equals(material))
|
||||
@@ -210,4 +147,7 @@ public class S3DBLayer extends TileLayer {
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
private S3DBUtils() {
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,7 @@
|
||||
/*
|
||||
* Copyright 2013 Hannes Janetzek
|
||||
* Copyright 2017 Izumi Kawashima
|
||||
* Copyright 2017 devemux86
|
||||
*
|
||||
* This file is part of the OpenScienceMap project (http://www.opensciencemap.org).
|
||||
*
|
||||
@@ -38,13 +40,15 @@ public abstract class ExtrusionRenderer extends LayerRenderer {
|
||||
protected int mBucketsCnt;
|
||||
protected float mAlpha = 1;
|
||||
|
||||
private float mZLimit = Float.MAX_VALUE;
|
||||
|
||||
public ExtrusionRenderer(boolean mesh, boolean alpha) {
|
||||
mMode = mesh ? 1 : 0;
|
||||
mTranslucent = alpha;
|
||||
}
|
||||
|
||||
public static class Shader extends GLShader {
|
||||
int uMVP, uColor, uAlpha, uMode, aPos, aLight;
|
||||
int uMVP, uColor, uAlpha, uMode, aPos, aLight, uZLimit;
|
||||
|
||||
public Shader(String shader) {
|
||||
if (!create(shader))
|
||||
@@ -54,6 +58,7 @@ public abstract class ExtrusionRenderer extends LayerRenderer {
|
||||
uColor = getUniform("u_color");
|
||||
uAlpha = getUniform("u_alpha");
|
||||
uMode = getUniform("u_mode");
|
||||
uZLimit = getUniform("u_zlimit");
|
||||
aPos = getAttrib("a_pos");
|
||||
aLight = getAttrib("a_light");
|
||||
}
|
||||
@@ -95,7 +100,7 @@ public abstract class ExtrusionRenderer extends LayerRenderer {
|
||||
@Override
|
||||
public void render(GLViewport v) {
|
||||
|
||||
float[] currentColor = null;
|
||||
float[] currentColors = null;
|
||||
float currentAlpha = 0;
|
||||
|
||||
gl.depthMask(true);
|
||||
@@ -114,6 +119,7 @@ public abstract class ExtrusionRenderer extends LayerRenderer {
|
||||
|
||||
gl.depthFunc(GL.LESS);
|
||||
gl.uniform1f(s.uAlpha, mAlpha);
|
||||
gl.uniform1f(s.uZLimit, mZLimit);
|
||||
|
||||
ExtrusionBuckets[] ebs = mExtrusionBucketSet;
|
||||
|
||||
@@ -171,11 +177,11 @@ public abstract class ExtrusionRenderer extends LayerRenderer {
|
||||
|
||||
for (; eb != null; eb = eb.next()) {
|
||||
|
||||
if (eb.colors != currentColor) {
|
||||
currentColor = eb.colors;
|
||||
if (eb.getColors() != currentColors) {
|
||||
currentColors = eb.getColors();
|
||||
GLUtils.glUniform4fv(s.uColor,
|
||||
mMode == 0 ? 4 : 1,
|
||||
eb.colors);
|
||||
currentColors);
|
||||
}
|
||||
|
||||
gl.vertexAttribPointer(s.aPos, 3, GL.SHORT,
|
||||
@@ -268,4 +274,8 @@ public abstract class ExtrusionRenderer extends LayerRenderer {
|
||||
}
|
||||
v.mvp.setAsUniform(s.uMVP);
|
||||
}
|
||||
|
||||
public void setZLimit(float zLimit) {
|
||||
mZLimit = zLimit;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
/*
|
||||
* Copyright 2012, 2013 Hannes Janetzek
|
||||
* Copyright 2017 Gustl22
|
||||
*
|
||||
* This file is part of the OpenScienceMap project (http://www.opensciencemap.org).
|
||||
*
|
||||
@@ -18,8 +19,6 @@ package org.oscim.renderer.bucket;
|
||||
|
||||
import org.oscim.backend.canvas.Color;
|
||||
import org.oscim.core.GeometryBuffer;
|
||||
import org.oscim.core.GeometryBuffer.GeometryType;
|
||||
import org.oscim.core.MapElement;
|
||||
import org.oscim.core.Tile;
|
||||
import org.oscim.utils.FastMath;
|
||||
import org.oscim.utils.KeyMap;
|
||||
@@ -43,13 +42,14 @@ public class ExtrusionBucket extends RenderBucket {
|
||||
/**
|
||||
* 16 floats rgba for top, even-side, odd-sides and outline
|
||||
*/
|
||||
public final float[] colors;
|
||||
public final int color;
|
||||
private final float[] colors;
|
||||
private final int color;
|
||||
|
||||
/**
|
||||
* indices for: 0. even sides, 1. odd sides, 2. roof, 3. roof outline
|
||||
*/
|
||||
public int idx[] = {0, 0, 0, 0, 0};
|
||||
|
||||
/**
|
||||
* indices offsets in bytes
|
||||
*/
|
||||
@@ -90,7 +90,7 @@ public class ExtrusionBucket extends RenderBucket {
|
||||
}
|
||||
|
||||
/**
|
||||
* ExtrusionLayer for triangle geometries.
|
||||
* ExtrusionLayer for triangle geometries / meshes.
|
||||
*/
|
||||
public ExtrusionBucket(int level, float groundResolution, int color) {
|
||||
super(RenderBucket.EXTRUSION, true, false);
|
||||
@@ -98,7 +98,7 @@ public class ExtrusionBucket extends RenderBucket {
|
||||
this.color = color;
|
||||
|
||||
float a = Color.aToFloat(color);
|
||||
colors = new float[4];
|
||||
colors = new float[4]; // Why not 16?
|
||||
colors[0] = a * Color.rToFloat(color);
|
||||
colors[1] = a * Color.gToFloat(color);
|
||||
colors[2] = a * Color.bToFloat(color);
|
||||
@@ -152,8 +152,13 @@ public class ExtrusionBucket extends RenderBucket {
|
||||
}
|
||||
}
|
||||
|
||||
public void add(MapElement element) {
|
||||
if (element.type != GeometryType.TRIS)
|
||||
/**
|
||||
* Add MapElement which provides meshes
|
||||
*
|
||||
* @param element the map element to add
|
||||
*/
|
||||
public void addMesh(GeometryBuffer element) {
|
||||
if (!element.isTris())
|
||||
return;
|
||||
|
||||
int[] index = element.index;
|
||||
@@ -165,6 +170,7 @@ public class ExtrusionBucket extends RenderBucket {
|
||||
Vertex key = vertexPool.get();
|
||||
double scale = COORD_SCALE * Tile.SIZE / 4096;
|
||||
|
||||
// n is introduced if length increases while processing
|
||||
for (int k = 0, n = index.length; k < n; ) {
|
||||
if (index[k] < 0)
|
||||
break;
|
||||
@@ -173,6 +179,7 @@ public class ExtrusionBucket extends RenderBucket {
|
||||
if (vertexCnt >= 1 << 16)
|
||||
break;
|
||||
|
||||
// Get position of points for each polygon (which always has 3 points)
|
||||
int vtx1 = index[k++] * 3;
|
||||
int vtx2 = index[k++] * 3;
|
||||
int vtx3 = index[k++] * 3;
|
||||
@@ -189,6 +196,7 @@ public class ExtrusionBucket extends RenderBucket {
|
||||
float vy3 = points[vtx3 + 1];
|
||||
float vz3 = points[vtx3 + 2];
|
||||
|
||||
// Calculate normal for color gradient
|
||||
float ax = vx2 - vx1;
|
||||
float ay = vy2 - vy1;
|
||||
float az = vz2 - vz1;
|
||||
@@ -197,6 +205,7 @@ public class ExtrusionBucket extends RenderBucket {
|
||||
float by = vy3 - vy1;
|
||||
float bz = vz3 - vz1;
|
||||
|
||||
// Vector product (c is at right angle to a and b)
|
||||
float cx = ay * bz - az * by;
|
||||
float cy = az * bx - ax * bz;
|
||||
float cz = ax * by - ay * bx;
|
||||
@@ -225,11 +234,11 @@ public class ExtrusionBucket extends RenderBucket {
|
||||
|
||||
if (vertex == null) {
|
||||
key.id = vertexCnt++;
|
||||
addIndex(key, true);
|
||||
addMeshIndex(key, true);
|
||||
key = vertexPool.get();
|
||||
} else {
|
||||
//numIndexHits++;
|
||||
addIndex(vertex, false);
|
||||
addMeshIndex(vertex, false);
|
||||
}
|
||||
|
||||
key.set((short) (vx2 * scale),
|
||||
@@ -241,11 +250,11 @@ public class ExtrusionBucket extends RenderBucket {
|
||||
|
||||
if (vertex == null) {
|
||||
key.id = vertexCnt++;
|
||||
addIndex(key, true);
|
||||
addMeshIndex(key, true);
|
||||
key = vertexPool.get();
|
||||
} else {
|
||||
//numIndexHits++;
|
||||
addIndex(vertex, false);
|
||||
addMeshIndex(vertex, false);
|
||||
}
|
||||
|
||||
key.set((short) (vx3 * scale),
|
||||
@@ -256,11 +265,11 @@ public class ExtrusionBucket extends RenderBucket {
|
||||
vertex = mVertexMap.put(key, false);
|
||||
if (vertex == null) {
|
||||
key.id = vertexCnt++;
|
||||
addIndex(key, true);
|
||||
addMeshIndex(key, true);
|
||||
key = vertexPool.get();
|
||||
} else {
|
||||
//numIndexHits++;
|
||||
addIndex(vertex, false);
|
||||
addMeshIndex(vertex, false);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -269,7 +278,7 @@ public class ExtrusionBucket extends RenderBucket {
|
||||
numVertices = vertexCnt;
|
||||
}
|
||||
|
||||
private void addIndex(Vertex v, boolean addVertex) {
|
||||
private void addMeshIndex(Vertex v, boolean addVertex) {
|
||||
if (addVertex)
|
||||
vertexItems.add(v.x, v.y, v.z, v.n);
|
||||
|
||||
@@ -339,7 +348,14 @@ public class ExtrusionBucket extends RenderBucket {
|
||||
// sumVertices += (vertexCnt / 3);
|
||||
//}
|
||||
|
||||
public void add(MapElement element, float height, float minHeight) {
|
||||
/**
|
||||
* Add MapElement which provides polygons
|
||||
*
|
||||
* @param element the map element to add
|
||||
* @param height the maximum height of element
|
||||
* @param minHeight the minimum height of element
|
||||
*/
|
||||
public void addPoly(GeometryBuffer element, float height, float minHeight) {
|
||||
|
||||
int[] index = element.index;
|
||||
float[] points = element.points;
|
||||
@@ -383,7 +399,7 @@ public class ExtrusionBucket extends RenderBucket {
|
||||
log.debug("explicit closed poly " + len);
|
||||
}
|
||||
|
||||
/* need at least three points */
|
||||
/* need at least three points (x and y) */
|
||||
if (len < 6)
|
||||
continue;
|
||||
|
||||
@@ -429,6 +445,7 @@ public class ExtrusionBucket extends RenderBucket {
|
||||
int numRings = 0;
|
||||
|
||||
/* get sum of points in polygon */
|
||||
// n is introduced if length increases while processing
|
||||
for (int i = ipos, n = index.length; i < n && index[i] > 0; i++) {
|
||||
numPoints += index[i];
|
||||
numRings++;
|
||||
@@ -615,6 +632,20 @@ public class ExtrusionBucket extends RenderBucket {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the polygon colors (top, side, side, line)
|
||||
*/
|
||||
public float[] getColors() {
|
||||
return colors;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the mesh color
|
||||
*/
|
||||
public int getColor() {
|
||||
return color;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void prepare() {
|
||||
mClipper = null;
|
||||
|
||||
@@ -1,10 +1,29 @@
|
||||
/*
|
||||
* Copyright 2014 Hannes Janetzek
|
||||
* Copyright 2017 Gustl22
|
||||
*
|
||||
* 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.renderer.bucket;
|
||||
|
||||
import org.oscim.backend.GL;
|
||||
import org.oscim.core.GeometryBuffer;
|
||||
import org.oscim.layers.tile.MapTile;
|
||||
import org.oscim.layers.tile.MapTile.TileData;
|
||||
import org.oscim.renderer.BufferObject;
|
||||
import org.oscim.renderer.MapRenderer;
|
||||
import org.oscim.utils.pool.Inlist;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
@@ -33,22 +52,71 @@ public class ExtrusionBuckets extends TileData {
|
||||
}
|
||||
|
||||
/**
|
||||
* Set new ExtrusionLayers and clear previous.
|
||||
* Add mesh element to corresponding ExtrusionBucket
|
||||
*
|
||||
* @param element the MapElement as mesh
|
||||
* @param groundScale the scale of ground
|
||||
* @param color the color of element
|
||||
*/
|
||||
public void setBuckets(ExtrusionBucket el) {
|
||||
public void addMeshElement(GeometryBuffer element, float groundScale, int color) {
|
||||
// Add to bucket which has same color
|
||||
for (ExtrusionBucket eb = this.buckets; eb != null; eb = eb.next()) {
|
||||
if (eb.getColor() == color) {
|
||||
eb.addMesh(element);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// Add to new bucket with different color
|
||||
ExtrusionBucket eb = new ExtrusionBucket(0, groundScale, color);
|
||||
this.buckets = Inlist.push(this.buckets, eb);
|
||||
this.buckets.addMesh(element);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add poly element to corresponding ExtrusionBucket
|
||||
*
|
||||
* @param element the MapElement as polygon
|
||||
* @param groundScale the scale of ground
|
||||
* @param colors the colors (top, side, side, line) of element
|
||||
* @param height the height of extrusion
|
||||
* @param minHeight the minimum height of extrusion
|
||||
*/
|
||||
public void addPolyElement(GeometryBuffer element, float groundScale, float[] colors, int height, int minHeight) {
|
||||
// Add to bucket which has same color
|
||||
for (ExtrusionBucket eb = this.buckets; eb != null; eb = eb.next()) {
|
||||
if (eb.getColors() == colors) {
|
||||
eb.addPoly(element, height, minHeight);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// Add to new bucket with different color
|
||||
ExtrusionBucket eb = new ExtrusionBucket(0, groundScale, colors);
|
||||
this.buckets = Inlist.push(this.buckets, eb);
|
||||
this.buckets.addPoly(element, height, minHeight);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set new ExtrusionBuckets and clear previous.
|
||||
*/
|
||||
public void resetBuckets(ExtrusionBucket el) {
|
||||
for (RenderBucket b = buckets; b != null; b = b.next)
|
||||
b.clear();
|
||||
|
||||
buckets = el;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get root bucket
|
||||
*/
|
||||
public ExtrusionBucket buckets() {
|
||||
return buckets;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void dispose() {
|
||||
setBuckets(null);
|
||||
resetBuckets(null);
|
||||
|
||||
if (compiled) {
|
||||
ibo = BufferObject.release(ibo);
|
||||
|
||||
@@ -53,7 +53,7 @@ public class MeshBucket extends RenderBucket {
|
||||
}
|
||||
|
||||
public void addMesh(GeometryBuffer geom) {
|
||||
numPoints += geom.pointPos;
|
||||
numPoints += geom.pointNextPos;
|
||||
if (tess == null)
|
||||
tess = new TessJNI(8);
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
/*
|
||||
* Copyright 2013 Hannes Janetzek
|
||||
* Copyright 2017 ale5000
|
||||
*
|
||||
* This file is part of the OpenScienceMap project (http://www.opensciencemap.org).
|
||||
*
|
||||
@@ -97,19 +98,19 @@ public class LwHttp implements HttpEngine {
|
||||
|
||||
StringBuilder sb = new StringBuilder()
|
||||
.append(" HTTP/1.1")
|
||||
.append("\nUser-Agent: vtm/0.5.9")
|
||||
.append("\nHost: ")
|
||||
.append("\r\nUser-Agent: vtm/0.5.9")
|
||||
.append("\r\nHost: ")
|
||||
.append(mHost)
|
||||
.append("\nConnection: Keep-Alive");
|
||||
.append("\r\nConnection: Keep-Alive");
|
||||
|
||||
for (Entry<String, String> l : tileSource.getRequestHeader().entrySet()) {
|
||||
String key = l.getKey();
|
||||
String val = l.getValue();
|
||||
//if ("Accept-Encoding".equals(key) && "gzip".equals(val))
|
||||
// mUseGZIP = true;
|
||||
sb.append('\n').append(key).append(": ").append(val);
|
||||
sb.append("\r\n").append(key).append(": ").append(val);
|
||||
}
|
||||
sb.append("\n\n");
|
||||
sb.append("\r\n\r\n");
|
||||
|
||||
REQUEST_GET_END = sb.toString().getBytes();
|
||||
|
||||
|
||||
@@ -244,7 +244,7 @@ public abstract class PbfDecoder implements ITileDecoder {
|
||||
|
||||
bufferPos = pos;
|
||||
|
||||
geom.pointPos = cnt;
|
||||
geom.pointNextPos = cnt;
|
||||
|
||||
// return number of points read
|
||||
return (cnt >> 1);
|
||||
|
||||
@@ -723,8 +723,8 @@ public class MapDatabase implements ITileDataSource {
|
||||
int[] buffer = mIntBuffer;
|
||||
mReadBuffer.readSignedInt(buffer, length);
|
||||
|
||||
float[] outBuffer = e.ensurePointSize(e.pointPos + length, true);
|
||||
int outPos = e.pointPos;
|
||||
float[] outBuffer = e.ensurePointSize(e.pointNextPos + length, true);
|
||||
int outPos = e.pointNextPos;
|
||||
int lat, lon;
|
||||
|
||||
/* first node latitude single-delta offset */
|
||||
@@ -772,7 +772,7 @@ public class MapDatabase implements ITileDataSource {
|
||||
}
|
||||
}
|
||||
|
||||
e.pointPos = outPos;
|
||||
e.pointNextPos = outPos;
|
||||
|
||||
return cnt;
|
||||
}
|
||||
|
||||
@@ -328,7 +328,7 @@ public class TileDecoder extends PbfDecoder {
|
||||
Integer.valueOf(cnt));
|
||||
fail = true;
|
||||
}
|
||||
mElem.pointPos = cnt;
|
||||
mElem.pointNextPos = cnt;
|
||||
} else {
|
||||
mElem.ensurePointSize(coordCnt, false);
|
||||
int cnt = decodeInterleavedPoints(mElem, mScaleFactor);
|
||||
|
||||
@@ -54,12 +54,12 @@ public class SimplifyVW {
|
||||
|
||||
size = 0;
|
||||
|
||||
if (heap.length < geom.pointPos >> 1)
|
||||
heap = new Item[geom.pointPos >> 1];
|
||||
if (heap.length < geom.pointNextPos >> 1)
|
||||
heap = new Item[geom.pointNextPos >> 1];
|
||||
|
||||
first = prev = push(0, Float.MAX_VALUE);
|
||||
|
||||
for (int i = 2; i < geom.pointPos - 2; i += 2) {
|
||||
for (int i = 2; i < geom.pointNextPos - 2; i += 2) {
|
||||
it = push(i, area(geom.points, i - 2, i, i + 2));
|
||||
prev.next = it;
|
||||
it.prev = prev;
|
||||
@@ -67,7 +67,7 @@ public class SimplifyVW {
|
||||
prev = it;
|
||||
}
|
||||
|
||||
Item last = push(geom.pointPos - 2, Float.MAX_VALUE);
|
||||
Item last = push(geom.pointNextPos - 2, Float.MAX_VALUE);
|
||||
|
||||
// sorter.doSort(heap, DistanceComparator, 0, size);
|
||||
// for (int i = 0; i < size; i++)
|
||||
@@ -102,8 +102,8 @@ public class SimplifyVW {
|
||||
first.prev = null;
|
||||
it = first;
|
||||
|
||||
float[] points = new float[geom.pointPos];
|
||||
System.arraycopy(geom.points, 0, points, 0, geom.pointPos);
|
||||
float[] points = new float[geom.pointNextPos];
|
||||
System.arraycopy(geom.points, 0, points, 0, geom.pointNextPos);
|
||||
|
||||
geom.clear();
|
||||
geom.startPolygon();
|
||||
|
||||
@@ -68,7 +68,7 @@ public class TileClipper {
|
||||
|
||||
clipEdge(out, geom, LineClipper.BOTTOM);
|
||||
|
||||
if ((geom.indexPos == 0) && (geom.index[0] < 6))
|
||||
if ((geom.indexCurrentPos == 0) && (geom.index[0] < 6))
|
||||
return false;
|
||||
} else if (geom.isLine()) {
|
||||
|
||||
@@ -81,12 +81,12 @@ public class TileClipper {
|
||||
System.arraycopy(out.index, 0, idx, 0, numLines);
|
||||
geom.index[numLines] = -1;
|
||||
|
||||
float pts[] = geom.ensurePointSize(out.pointPos >> 1, false);
|
||||
System.arraycopy(out.points, 0, pts, 0, out.pointPos);
|
||||
geom.indexPos = out.indexPos;
|
||||
geom.pointPos = out.pointPos;
|
||||
float pts[] = geom.ensurePointSize(out.pointNextPos >> 1, false);
|
||||
System.arraycopy(out.points, 0, pts, 0, out.pointNextPos);
|
||||
geom.indexCurrentPos = out.indexCurrentPos;
|
||||
geom.pointNextPos = out.pointNextPos;
|
||||
|
||||
if ((geom.indexPos == 0) && (geom.index[0] < 4))
|
||||
if ((geom.indexCurrentPos == 0) && (geom.index[0] < 4))
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
||||
Reference in New Issue
Block a user