Compare commits
49 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
055cd54beb | ||
|
|
3eaad42903 | ||
|
|
6ab98419df | ||
|
|
a9e18a2add | ||
|
|
83aed13683 | ||
|
|
5779d10632 | ||
|
|
85e818d788 | ||
|
|
cc1d4cf6d9 | ||
|
|
0404effca3 | ||
|
|
eef1a8c779 | ||
|
|
527fc3d42d | ||
|
|
53b262f190 | ||
|
|
dcb7b0d10c | ||
|
|
e6137163b9 | ||
|
|
2cf9a4a472 | ||
|
|
55d8797f37 | ||
|
|
653c6489b9 | ||
|
|
c19e06b718 | ||
|
|
5de4c6b7ab | ||
|
|
900448f8d3 | ||
|
|
4be42dbc0f | ||
|
|
72ba3d6429 | ||
|
|
f5815203c4 | ||
|
|
0c050c7405 | ||
|
|
71bf1390f6 | ||
|
|
368cf1ff4a | ||
|
|
c526599e20 | ||
|
|
fcf7272f2e | ||
|
|
cf2bdb251b | ||
|
|
551c0231a0 | ||
|
|
70741d8f5b | ||
|
|
9209afba01 | ||
|
|
9e81473d36 | ||
|
|
ffeaf1b81c | ||
|
|
efab21f4f2 | ||
|
|
a6ce05034a | ||
|
|
634d67a206 | ||
|
|
30ae0fb48f | ||
|
|
5740290a9b | ||
|
|
149d5d9057 | ||
|
|
fe2d806d73 | ||
|
|
63ccf0dcfa | ||
|
|
5f1c3c3186 | ||
|
|
b98505c815 | ||
|
|
5979161611 | ||
|
|
d6e55edd8e | ||
|
|
431eadaa87 | ||
|
|
df82ebfaa6 | ||
|
|
b5ee7c1b46 |
@@ -4,8 +4,8 @@ jdk:
|
||||
- openjdk8
|
||||
env:
|
||||
global:
|
||||
- ANDROID=28
|
||||
- ANDROID_BUILD_TOOLS=28.0.3
|
||||
- ANDROID=29
|
||||
- ANDROID_BUILD_TOOLS=29.0.2
|
||||
- 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=
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
VTM (Vector Tile Map) was developed within the [OpenScienceMap](https://github.com/opensciencemap) project.
|
||||
|
||||
**This fork continues VTM development and provides compatibility with latest [Mapsforge](https://github.com/mapsforge/mapsforge).**
|
||||
**This fork continues VTM development and provides compatibility with [Mapsforge](https://github.com/mapsforge/mapsforge).**
|
||||
|
||||
See the **[integration guide](docs/Integration.md)** and [changelog](docs/Changelog.md). And read through [how to contribute](docs/CONTRIBUTING.md) guidelines.
|
||||
|
||||
@@ -21,6 +21,7 @@ If you have any questions or problems, don't hesitate to ask our public [forum](
|
||||
- Support for multiple tile sources:
|
||||
- OpenScienceMap vector tiles
|
||||
- Mapsforge vector maps
|
||||
- MBTiles vector & raster maps
|
||||
- Mapbox vector tiles (e.g. Mapilion, Mapzen, Nextzen, OpenMapTiles)
|
||||
- GeoJSON vector tiles (e.g. Mapzen, Nextzen)
|
||||
- Raster tiles: any quadtree-scheme tiles as texture
|
||||
@@ -37,6 +38,8 @@ If you have any questions or problems, don't hesitate to ask our public [forum](
|
||||
- **vtm-gdx** common libGDX backend
|
||||
- **vtm-android-gdx** Android libGDX backend
|
||||
- **vtm-desktop** Desktop libGDX backend
|
||||
- **vtm-desktop-lwjgl** Desktop LWJGL backend
|
||||
- **vtm-desktop-lwjgl3** Desktop LWJGL 3 backend
|
||||
- **vtm-playground** Desktop examples
|
||||
- **vtm-ios** iOS libGDX backend
|
||||
- **vtm-ios-example** iOS examples
|
||||
|
||||
12
build.gradle
12
build.gradle
@@ -4,7 +4,7 @@ buildscript {
|
||||
jcenter()
|
||||
}
|
||||
dependencies {
|
||||
classpath 'com.android.tools.build:gradle:3.3.2'
|
||||
classpath 'com.android.tools.build:gradle:3.5.0'
|
||||
classpath 'com.github.dcendents:android-maven-gradle-plugin:2.1'
|
||||
}
|
||||
}
|
||||
@@ -14,9 +14,9 @@ allprojects {
|
||||
version = 'master-SNAPSHOT'
|
||||
ext.isReleaseVersion = !version.endsWith("SNAPSHOT")
|
||||
|
||||
ext.androidBuildVersionTools = "28.0.3"
|
||||
ext.gdxVersion = "1.9.9"
|
||||
ext.gwtVersion = "2.8.0"
|
||||
ext.androidBuildVersionTools = "29.0.2"
|
||||
ext.gdxVersion = "1.9.10"
|
||||
ext.gwtVersion = "2.8.2"
|
||||
ext.slf4jVersion = "1.7.25"
|
||||
|
||||
if (JavaVersion.current().isJava8Compatible()) {
|
||||
@@ -28,12 +28,12 @@ allprojects {
|
||||
}
|
||||
}
|
||||
|
||||
static def androidCompileSdk() { return 28 }
|
||||
static def androidCompileSdk() { return 29 }
|
||||
|
||||
// 14 for Support Library, 16 for sqlite-android
|
||||
static def androidMinSdk() { return 16 }
|
||||
|
||||
static def androidTargetSdk() { return 22 }
|
||||
static def androidTargetSdk() { return 29 }
|
||||
|
||||
static def versionCode() { return 1 }
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
| [Cachebox 3.0](https://github.com/Longri/cachebox3.0) | Geocaching application | Apache 2.0/Free | Android, Desktop, iOS | Open |
|
||||
| [Cruiser](http://wiki.openstreetmap.org/wiki/Cruiser) | Map and navigation application | Proprietary/Free | Android, Desktop | Closed |
|
||||
| [GCDroid](https://play.google.com/store/apps/details?id=com.gcdroid) | Geocaching App | Proprietary/Free and Commercial | Android | Closed |
|
||||
| [GPSLogger II](https://play.google.com/store/apps/details?id=com.emacberry.gpslogger) | Map and navigation, Fitness & Cycling application | Proprietary/Free | Android | Closed |
|
||||
| [Hunt Cyprus](https://play.google.com/store/apps/developer?id=Talent+S.A.) | Map and navigation application for hunters | Proprietary/Free and Commercial | Android | Closed |
|
||||
| [Kurviger](https://kurviger.de/en) | Route planner specialized on motorcyclists | Proprietary/Free and Commercial | Android | Closed |
|
||||
| [MapTrek](http://maptrek.mobi) | Application for outdoor activities | GPL3/Free and Commercial | Android | Open |
|
||||
|
||||
@@ -1,5 +1,22 @@
|
||||
# Changelog
|
||||
|
||||
## Version 0.12.0 (2019-09-17)
|
||||
|
||||
- MBTiles vector tile source (Android) [#740](https://github.com/mapsforge/vtm/pull/740)
|
||||
- vtm-android-mvt module
|
||||
- Render themes: text background color [#737](https://github.com/mapsforge/vtm/pull/737)
|
||||
- vtm-desktop-lwjgl module [#714](https://github.com/mapsforge/vtm/pull/714)
|
||||
- vtm-desktop-lwjgl3 module [#717](https://github.com/mapsforge/vtm/pull/717)
|
||||
- Fix marker touch events [#723](https://github.com/mapsforge/vtm/issues/723)
|
||||
- Calculation of centroids for all polygons [#734](https://github.com/mapsforge/vtm/pull/734)
|
||||
- `Parameters.POLY_CENTROID`
|
||||
- Disable optimal placement of labels or symbols on polygons
|
||||
- `Parameters.POLY_LABEL`
|
||||
- Android 10 compatibility [#728](https://github.com/mapsforge/vtm/issues/728)
|
||||
- libGDX 1.9.10 [#731](https://github.com/mapsforge/vtm/issues/731)
|
||||
- Many other minor improvements and bug fixes
|
||||
- [Solved issues](https://github.com/mapsforge/vtm/issues?q=is%3Aclosed+milestone%3A0.12.0)
|
||||
|
||||
## Version 0.11.1 (2019-04-12)
|
||||
|
||||
- MBTiles raster tile source (Android) [#708](https://github.com/mapsforge/vtm/pull/708)
|
||||
@@ -173,7 +190,8 @@
|
||||
- vtm-ios module update [#29](https://github.com/mapsforge/vtm/issues/29)
|
||||
- Native libraries for all platforms [#14](https://github.com/mapsforge/vtm/issues/14)
|
||||
- Line stipple and texture rendering [#105](https://github.com/mapsforge/vtm/issues/105)
|
||||
- Layer groups [#99](https://github.com/mapsforge/vtm/issues/99) [#103](https://github.com/mapsforge/vtm/issues/103)
|
||||
- Group layer implementation [#99](https://github.com/mapsforge/vtm/issues/99)
|
||||
- Layer groups implementation [#103](https://github.com/mapsforge/vtm/issues/103)
|
||||
- Location renderer and layer [#171](https://github.com/mapsforge/vtm/issues/171)
|
||||
- Map scale bar [#84](https://github.com/mapsforge/vtm/issues/84)
|
||||
- Tile size based on scale factor [#183](https://github.com/mapsforge/vtm/issues/183)
|
||||
|
||||
@@ -1,5 +1 @@
|
||||
For questions or discussion please always use our Forum first and make sure you read our Contributing Guide.
|
||||
|
||||
- Forum: https://groups.google.com/group/mapsforge-dev
|
||||
|
||||
- Contributing Guide: https://github.com/mapsforge/vtm/blob/master/docs/CONTRIBUTING.md
|
||||
For questions, reports and discussion please always use the [forum](https://groups.google.com/group/mapsforge-dev).
|
||||
|
||||
@@ -36,8 +36,8 @@ implementation 'org.mapsforge:vtm-android-gdx:[CURRENT-VERSION]:natives-armeabi-
|
||||
implementation 'org.mapsforge:vtm-android-gdx:[CURRENT-VERSION]:natives-arm64-v8a'
|
||||
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.9'
|
||||
implementation 'com.badlogicgames.gdx:gdx-backend-android:1.9.9'
|
||||
implementation 'com.badlogicgames.gdx:gdx:1.9.10'
|
||||
implementation 'com.badlogicgames.gdx:gdx-backend-android:1.9.10'
|
||||
implementation 'com.caverock:androidsvg:1.3'
|
||||
```
|
||||
|
||||
@@ -56,14 +56,27 @@ 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.9'
|
||||
implementation 'com.badlogicgames.gdx:gdx-platform:1.9.9:natives-desktop'
|
||||
implementation 'com.badlogicgames.gdx:gdx-backend-lwjgl:1.9.9'
|
||||
implementation 'org.mapsforge:vtm-desktop-lwjgl:[CURRENT-VERSION]'
|
||||
implementation 'com.badlogicgames.gdx:gdx:1.9.10'
|
||||
implementation 'com.badlogicgames.gdx:gdx-platform:1.9.10:natives-desktop'
|
||||
implementation 'com.badlogicgames.gdx:gdx-backend-lwjgl:1.9.10'
|
||||
implementation 'com.github.blackears:svgSalamander:v1.1.1'
|
||||
```
|
||||
|
||||
### Desktop (LWJGL)
|
||||
```groovy
|
||||
implementation 'org.lwjgl.lwjgl:lwjgl:2.9.3'
|
||||
implementation 'org.lwjgl.lwjgl:lwjgl-platform:2.9.3:natives-linux'
|
||||
implementation 'org.lwjgl.lwjgl:lwjgl-platform:2.9.3:natives-osx'
|
||||
implementation 'org.lwjgl.lwjgl:lwjgl-platform:2.9.3:natives-windows'
|
||||
implementation 'com.github.blackears:svgSalamander:v1.1.1'
|
||||
```
|
||||
|
||||
### Desktop (LWJGL 3)
|
||||
```groovy
|
||||
implementation 'org.lwjgl:lwjgl:3.2.1'
|
||||
implementation 'org.lwjgl:lwjgl:3.2.1:natives-linux'
|
||||
implementation 'org.lwjgl:lwjgl:3.2.1:natives-macos'
|
||||
implementation 'org.lwjgl:lwjgl:3.2.1:natives-windows'
|
||||
```
|
||||
|
||||
### JTS geometries
|
||||
@@ -81,6 +94,16 @@ implementation 'com.squareup.okhttp3:okhttp:3.8.0'
|
||||
implementation 'com.squareup.okio:okio:1.13.0'
|
||||
```
|
||||
|
||||
### MBTiles (Android)
|
||||
|
||||
```groovy
|
||||
implementation 'org.mapsforge:vtm-android-mvt:[CURRENT-VERSION]'
|
||||
implementation 'org.mapsforge:vtm-mvt:[CURRENT-VERSION]'
|
||||
implementation 'com.google.protobuf:protobuf-java:3.5.1'
|
||||
implementation 'com.wdtinc:mapbox-vector-tile:3.0.0'
|
||||
implementation 'org.locationtech.jts:jts-core:1.15.0'
|
||||
```
|
||||
|
||||
### Mapbox vector tiles
|
||||
|
||||
```groovy
|
||||
|
||||
@@ -15,3 +15,5 @@ The jar file can be found in `build/libs` folder. Depending on the main class, p
|
||||
```
|
||||
java -jar vtm-playground-master-SNAPSHOT-jar-with-dependencies.jar /path/to/map
|
||||
```
|
||||
|
||||
To change the libGDX backend can replace the dependency: `vtm-desktop-lwjgl` or `vtm-desktop-lwjgl3`.
|
||||
|
||||
@@ -11,3 +11,9 @@ org.gradle.jvmargs=-Xmx1536m
|
||||
# This option should only be used with decoupled projects. More details, visit
|
||||
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
|
||||
# org.gradle.parallel=true
|
||||
# AndroidX package structure to make it clearer which packages are bundled with the
|
||||
# Android operating system, and which are packaged with your app's APK
|
||||
# https://developer.android.com/topic/libraries/support-library/androidx-rn
|
||||
android.useAndroidX=true
|
||||
# Automatically convert third-party libraries to use AndroidX
|
||||
android.enableJetifier=true
|
||||
|
||||
2
gradle/wrapper/gradle-wrapper.properties
vendored
2
gradle/wrapper/gradle-wrapper.properties
vendored
@@ -1,5 +1,5 @@
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.1-all.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-all.zip
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
|
||||
@@ -150,6 +150,7 @@
|
||||
<xs:attribute name="font-family" default="default" type="tns:fontFamily" use="optional" />
|
||||
<xs:attribute name="style" default="normal" type="tns:fontStyle" use="optional" />
|
||||
<xs:attribute name="size" default="0" type="tns:nonNegativeFloat" use="optional" />
|
||||
<xs:attribute name="bg-fill" default="#00000000" type="tns:color" use="optional" />
|
||||
<xs:attribute name="fill" default="#000000" type="tns:color" use="optional" />
|
||||
<xs:attribute name="stroke" default="#000000" type="tns:color" use="optional" />
|
||||
<xs:attribute name="stroke-width" default="0" type="tns:nonNegativeFloat" use="optional" />
|
||||
@@ -219,6 +220,7 @@
|
||||
<xs:attribute name="font-family" default="default" type="tns:fontFamily" use="optional" />
|
||||
<xs:attribute name="style" default="normal" type="tns:fontStyle" use="optional" />
|
||||
<xs:attribute name="size" default="0" type="tns:nonNegativeFloat" use="optional" />
|
||||
<xs:attribute name="bg-fill" default="#00000000" type="tns:color" use="optional" />
|
||||
<xs:attribute name="fill" default="#000000" type="tns:color" use="optional" />
|
||||
<xs:attribute name="stroke" default="#000000" type="tns:color" use="optional" />
|
||||
<xs:attribute name="stroke-width" default="0" type="tns:nonNegativeFloat" use="optional" />
|
||||
|
||||
@@ -3,8 +3,11 @@ include ':vtm'
|
||||
include ':vtm-android'
|
||||
include ':vtm-android-example'
|
||||
include ':vtm-android-gdx'
|
||||
include ':vtm-android-mvt'
|
||||
include ':vtm-app'
|
||||
include ':vtm-desktop'
|
||||
include ':vtm-desktop-lwjgl'
|
||||
include ':vtm-desktop-lwjgl3'
|
||||
include ':vtm-extras'
|
||||
include ':vtm-gdx'
|
||||
include ':vtm-gdx-poi3d'
|
||||
|
||||
@@ -7,7 +7,6 @@
|
||||
|
||||
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
|
||||
<uses-permission android:name="android.permission.INTERNET" />
|
||||
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
|
||||
|
||||
<application
|
||||
android:allowBackup="true"
|
||||
@@ -22,15 +21,9 @@
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
<activity
|
||||
android:name=".AtlasMarkerOverlayActivity"
|
||||
android:configChanges="keyboardHidden|orientation|screenSize" />
|
||||
<activity
|
||||
android:name=".AtlasMultiTextureActivity"
|
||||
android:configChanges="keyboardHidden|orientation|screenSize" />
|
||||
<activity
|
||||
android:name=".AtlasThemeActivity"
|
||||
android:configChanges="keyboardHidden|orientation|screenSize" />
|
||||
<activity
|
||||
android:name=".BitmapTileActivity"
|
||||
android:configChanges="keyboardHidden|orientation|screenSize" />
|
||||
@@ -49,9 +42,6 @@
|
||||
<activity
|
||||
android:name=".JeoIndoorActivity"
|
||||
android:configChanges="keyboardHidden|orientation|screenSize" />
|
||||
<activity
|
||||
android:name=".LayerGroupActivity"
|
||||
android:configChanges="keyboardHidden|orientation|screenSize" />
|
||||
<activity
|
||||
android:name=".LineTexActivity"
|
||||
android:configChanges="keyboardHidden|orientation|screenSize" />
|
||||
@@ -61,9 +51,6 @@
|
||||
<activity
|
||||
android:name=".LocationTextureActivity"
|
||||
android:configChanges="keyboardHidden|orientation|screenSize" />
|
||||
<activity
|
||||
android:name=".MapEventLayer2Activity"
|
||||
android:configChanges="keyboardHidden|orientation|screenSize" />
|
||||
<activity
|
||||
android:name=".MapilionMvtActivity"
|
||||
android:configChanges="keyboardHidden|orientation|screenSize" />
|
||||
@@ -92,10 +79,10 @@
|
||||
android:name=".MarkerOverlayActivity"
|
||||
android:configChanges="keyboardHidden|orientation|screenSize" />
|
||||
<activity
|
||||
android:name=".MBTilesBitmapTileActivity"
|
||||
android:name=".MBTilesBitmapActivity"
|
||||
android:configChanges="keyboardHidden|orientation|screenSize" />
|
||||
<activity
|
||||
android:name=".MultiMapViewActivity"
|
||||
android:name=".MBTilesMvtActivity"
|
||||
android:configChanges="keyboardHidden|orientation|screenSize" />
|
||||
<activity
|
||||
android:name=".NextzenGeojsonActivity"
|
||||
@@ -106,9 +93,6 @@
|
||||
<activity
|
||||
android:name=".OpenMapTilesMvtActivity"
|
||||
android:configChanges="keyboardHidden|orientation|screenSize" />
|
||||
<activity
|
||||
android:name=".OSciMapS3DBActivity"
|
||||
android:configChanges="keyboardHidden|orientation|screenSize" />
|
||||
<activity
|
||||
android:name=".OverpassActivity"
|
||||
android:configChanges="keyboardHidden|orientation|screenSize" />
|
||||
@@ -121,15 +105,9 @@
|
||||
<activity
|
||||
android:name=".PoiSearchActivity$PoiFilePicker"
|
||||
android:configChanges="keyboardHidden|orientation|screenSize" />
|
||||
<activity
|
||||
android:name=".POTTextureActivity"
|
||||
android:configChanges="keyboardHidden|orientation|screenSize" />
|
||||
<activity
|
||||
android:name=".ReverseGeocodeActivity"
|
||||
android:configChanges="keyboardHidden|orientation|screenSize" />
|
||||
<activity
|
||||
android:name=".RotateMarkerOverlayActivity"
|
||||
android:configChanges="keyboardHidden|orientation|screenSize" />
|
||||
<activity
|
||||
android:name=".ShadowActivity"
|
||||
android:configChanges="keyboardHidden|orientation|screenSize" />
|
||||
|
||||
@@ -9,6 +9,7 @@ configurations.all {
|
||||
|
||||
dependencies {
|
||||
implementation project(':vtm-android')
|
||||
implementation project(':vtm-android-mvt')
|
||||
implementation project(':vtm-extras')
|
||||
implementation project(':vtm-http')
|
||||
implementation project(':vtm-jeo')
|
||||
@@ -39,8 +40,8 @@ android {
|
||||
}
|
||||
|
||||
defaultConfig {
|
||||
versionCode versionCode()
|
||||
versionName versionName()
|
||||
versionCode project.versionCode()
|
||||
versionName project.versionName()
|
||||
minSdkVersion androidMinSdk()
|
||||
targetSdkVersion androidTargetSdk()
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
<string name="search_value">void or value</string>
|
||||
<string name="now">Now</string>
|
||||
<string name="warning">Warning</string>
|
||||
<string name="startup_message_mbtiles">To run this sample activity, you need any MBTiles with filename test.mbtiles installed on storage.\n\nadb push file.mbtiles /sdcard/test.mbtiles</string>
|
||||
<string name="startup_message_mbtiles">To run this sample activity, you need an MBTiles database installed on storage.\n\nadb push %s %s</string>
|
||||
<string name="exit">Exit</string>
|
||||
|
||||
</resources>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Copyright 2010, 2011, 2012 mapsforge.org
|
||||
* Copyright 2016 devemux86
|
||||
* Copyright 2016-2019 devemux86
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify it under the
|
||||
* terms of the GNU Lesser General Public License as published by the Free Software
|
||||
@@ -22,11 +22,9 @@ import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.content.SharedPreferences.Editor;
|
||||
import android.os.Bundle;
|
||||
import android.os.Environment;
|
||||
import android.view.View;
|
||||
import android.widget.AdapterView;
|
||||
import android.widget.GridView;
|
||||
|
||||
import org.oscim.android.test.R;
|
||||
|
||||
import java.io.File;
|
||||
@@ -60,7 +58,6 @@ public class FilePicker extends Activity implements AdapterView.OnItemClickListe
|
||||
|
||||
private static final String PREFERENCES_FILE = "FilePicker";
|
||||
private static final String CURRENT_DIRECTORY = "currentDirectory";
|
||||
private static final String DEFAULT_DIRECTORY = Environment.getExternalStorageDirectory().getAbsolutePath();
|
||||
private static final int DIALOG_FILE_INVALID = 0;
|
||||
|
||||
// private static final int DIALOG_FILE_SELECT = 1;
|
||||
@@ -122,6 +119,7 @@ public class FilePicker extends Activity implements AdapterView.OnItemClickListe
|
||||
};
|
||||
}
|
||||
|
||||
private String mDefaultDirectory;
|
||||
private File mDirectory;
|
||||
private FilePickerIconAdapter mFilePickerIconAdapter;
|
||||
private File[] mFiles;
|
||||
@@ -164,7 +162,7 @@ public class FilePicker extends Activity implements AdapterView.OnItemClickListe
|
||||
}
|
||||
|
||||
// if a parent directory exists, add it at the first position
|
||||
if (mDirectory.getParentFile() != null) {
|
||||
if (mDirectory.getParentFile() != null && mDirectory.getParentFile().canRead()) {
|
||||
mFilesWithParentFolder = new File[mFiles.length + 1];
|
||||
mFilesWithParentFolder[0] = mDirectory.getParentFile();
|
||||
System.arraycopy(mFiles, 0, mFilesWithParentFolder, 1,
|
||||
@@ -182,6 +180,7 @@ public class FilePicker extends Activity implements AdapterView.OnItemClickListe
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_file_picker);
|
||||
|
||||
mDefaultDirectory = getExternalFilesDir(null) != null ? getExternalFilesDir(null).getAbsolutePath() : "/sdcard/";
|
||||
mFilePickerIconAdapter = new FilePickerIconAdapter(this);
|
||||
GridView gridView = (GridView) findViewById(R.id.filePickerView);
|
||||
gridView.setOnItemClickListener(this);
|
||||
@@ -239,10 +238,9 @@ public class FilePicker extends Activity implements AdapterView.OnItemClickListe
|
||||
// restore the current directory
|
||||
SharedPreferences preferences = getSharedPreferences(PREFERENCES_FILE,
|
||||
MODE_PRIVATE);
|
||||
mDirectory = new File(preferences.getString(CURRENT_DIRECTORY,
|
||||
DEFAULT_DIRECTORY));
|
||||
mDirectory = new File(preferences.getString(CURRENT_DIRECTORY, mDefaultDirectory));
|
||||
if (!mDirectory.exists() || !mDirectory.canRead()) {
|
||||
mDirectory = new File(DEFAULT_DIRECTORY);
|
||||
mDirectory = new File(mDefaultDirectory);
|
||||
}
|
||||
browseToCurrentDirectory();
|
||||
}
|
||||
|
||||
@@ -1,91 +0,0 @@
|
||||
/*
|
||||
* Copyright 2014 Hannes Janetzek
|
||||
* Copyright 2016-2018 devemux86
|
||||
* Copyright 2017 Longri
|
||||
*
|
||||
* This file is part of the OpenScienceMap project (http://www.opensciencemap.org).
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify it under the
|
||||
* terms of the GNU Lesser General Public License as published by the Free Software
|
||||
* Foundation, either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||
* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License along with
|
||||
* this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package org.oscim.android.test;
|
||||
|
||||
import org.oscim.backend.canvas.Bitmap;
|
||||
import org.oscim.core.GeoPoint;
|
||||
import org.oscim.layers.marker.ItemizedLayer;
|
||||
import org.oscim.layers.marker.MarkerItem;
|
||||
import org.oscim.layers.marker.MarkerSymbol;
|
||||
import org.oscim.layers.marker.MarkerSymbol.HotspotPlace;
|
||||
import org.oscim.layers.tile.bitmap.BitmapTileLayer;
|
||||
import org.oscim.renderer.atlas.TextureAtlas;
|
||||
import org.oscim.renderer.atlas.TextureRegion;
|
||||
import org.oscim.tiling.TileSource;
|
||||
import org.oscim.tiling.source.OkHttpEngine;
|
||||
import org.oscim.tiling.source.bitmap.DefaultSources;
|
||||
import org.oscim.utils.TextureAtlasUtils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
|
||||
import static org.oscim.android.canvas.AndroidGraphics.drawableToBitmap;
|
||||
|
||||
public class AtlasMarkerOverlayActivity extends MarkerOverlayActivity {
|
||||
|
||||
@Override
|
||||
void createLayers() {
|
||||
// Map events receiver
|
||||
mMap.layers().add(new MapEventsReceiver(mMap));
|
||||
|
||||
TileSource tileSource = DefaultSources.OPENSTREETMAP
|
||||
.httpFactory(new OkHttpEngine.OkHttpFactory())
|
||||
.build();
|
||||
mMap.layers().add(new BitmapTileLayer(mMap, tileSource));
|
||||
|
||||
Bitmap bitmapPoi = drawableToBitmap(getResources().getDrawable(R.drawable.marker_poi));
|
||||
Bitmap bitmapFocus = drawableToBitmap(getResources().getDrawable(R.drawable.marker_focus));
|
||||
|
||||
// Create Atlas from Bitmaps
|
||||
java.util.Map<Object, Bitmap> inputMap = new LinkedHashMap<>();
|
||||
java.util.Map<Object, TextureRegion> regionsMap = new LinkedHashMap<>();
|
||||
List<TextureAtlas> atlasList = new ArrayList<>();
|
||||
|
||||
inputMap.put("poi", bitmapPoi);
|
||||
inputMap.put("focus", bitmapFocus);
|
||||
|
||||
// Bitmaps will never used any more
|
||||
// With iOS we must flip the Y-Axis
|
||||
TextureAtlasUtils.createTextureRegions(inputMap, regionsMap, atlasList, true, false);
|
||||
|
||||
MarkerSymbol symbol;
|
||||
if (BILLBOARDS)
|
||||
symbol = new MarkerSymbol(regionsMap.get("poi"), HotspotPlace.BOTTOM_CENTER);
|
||||
else
|
||||
symbol = new MarkerSymbol(regionsMap.get("poi"), HotspotPlace.CENTER, false);
|
||||
|
||||
if (BILLBOARDS)
|
||||
mFocusMarker = new MarkerSymbol(regionsMap.get("focus"), HotspotPlace.BOTTOM_CENTER);
|
||||
else
|
||||
mFocusMarker = new MarkerSymbol(regionsMap.get("focus"), HotspotPlace.CENTER, false);
|
||||
|
||||
mMarkerLayer = new ItemizedLayer<>(mMap, new ArrayList<MarkerItem>(), symbol, this);
|
||||
mMap.layers().add(mMarkerLayer);
|
||||
|
||||
List<MarkerItem> pts = new ArrayList<>();
|
||||
|
||||
for (double lat = -90; lat <= 90; lat += 5) {
|
||||
for (double lon = -180; lon <= 180; lon += 5)
|
||||
pts.add(new MarkerItem(lat + "/" + lon, "", new GeoPoint(lat, lon)));
|
||||
}
|
||||
|
||||
mMarkerLayer.addItems(pts);
|
||||
}
|
||||
}
|
||||
@@ -16,8 +16,6 @@ package org.oscim.android.test;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.os.Bundle;
|
||||
import android.os.Environment;
|
||||
|
||||
import org.oscim.android.MapView;
|
||||
import org.oscim.backend.CanvasAdapter;
|
||||
import org.oscim.layers.tile.buildings.BuildingLayer;
|
||||
@@ -35,7 +33,8 @@ import java.io.File;
|
||||
/**
|
||||
* A very basic Android app example.
|
||||
* <p>
|
||||
* You'll need a map with filename berlin.map from download.mapsforge.org in device storage.
|
||||
* You'll need a map with filename berlin.map from download.mapsforge.org in device storage:
|
||||
* /sdcard/Android/data/org.oscim.android.test/files/
|
||||
*/
|
||||
public class GettingStarted extends Activity {
|
||||
|
||||
@@ -55,7 +54,7 @@ public class GettingStarted extends Activity {
|
||||
|
||||
// Tile source
|
||||
MapFileTileSource tileSource = new MapFileTileSource();
|
||||
String mapPath = new File(Environment.getExternalStorageDirectory(), MAP_FILE).getAbsolutePath();
|
||||
String mapPath = new File(getExternalFilesDir(null), MAP_FILE).getAbsolutePath();
|
||||
if (tileSource.setMapFile(mapPath)) {
|
||||
// Vector layer
|
||||
VectorTileLayer tileLayer = mapView.map().setBaseMap(tileSource);
|
||||
|
||||
@@ -1,80 +0,0 @@
|
||||
/*
|
||||
* Copyright 2013 Hannes Janetzek
|
||||
* Copyright 2016-2018 devemux86
|
||||
* Copyright 2016 Andrey Novikov
|
||||
*
|
||||
* This file is part of the OpenScienceMap project (http://www.opensciencemap.org).
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify it under the
|
||||
* terms of the GNU Lesser General Public License as published by the Free Software
|
||||
* Foundation, either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||
* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License along with
|
||||
* this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package org.oscim.android.test;
|
||||
|
||||
import android.os.Bundle;
|
||||
|
||||
import org.oscim.backend.CanvasAdapter;
|
||||
import org.oscim.layers.tile.buildings.BuildingLayer;
|
||||
import org.oscim.layers.tile.vector.labeling.LabelLayer;
|
||||
import org.oscim.map.Layers;
|
||||
import org.oscim.renderer.BitmapRenderer;
|
||||
import org.oscim.renderer.GLViewport;
|
||||
import org.oscim.scalebar.DefaultMapScaleBar;
|
||||
import org.oscim.scalebar.ImperialUnitAdapter;
|
||||
import org.oscim.scalebar.MapScaleBar;
|
||||
import org.oscim.scalebar.MapScaleBarLayer;
|
||||
import org.oscim.scalebar.MetricUnitAdapter;
|
||||
import org.oscim.theme.VtmThemes;
|
||||
|
||||
public class LayerGroupActivity extends BaseMapActivity {
|
||||
|
||||
private static final int GROUP_3D_OBJECTS = 1;
|
||||
private static final int GROUP_LABELS = 2;
|
||||
private static final int GROUP_OVERLAYS = 3;
|
||||
|
||||
private DefaultMapScaleBar mapScaleBar;
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
Layers layers = mMap.layers();
|
||||
|
||||
layers.addGroup(GROUP_3D_OBJECTS);
|
||||
layers.add(new BuildingLayer(mMap, mBaseLayer), GROUP_3D_OBJECTS);
|
||||
|
||||
layers.addGroup(GROUP_LABELS);
|
||||
layers.add(new LabelLayer(mMap, mBaseLayer), GROUP_LABELS);
|
||||
|
||||
mapScaleBar = new DefaultMapScaleBar(mMap);
|
||||
mapScaleBar.setScaleBarMode(DefaultMapScaleBar.ScaleBarMode.BOTH);
|
||||
mapScaleBar.setDistanceUnitAdapter(MetricUnitAdapter.INSTANCE);
|
||||
mapScaleBar.setSecondaryDistanceUnitAdapter(ImperialUnitAdapter.INSTANCE);
|
||||
mapScaleBar.setScaleBarPosition(MapScaleBar.ScaleBarPosition.BOTTOM_LEFT);
|
||||
|
||||
MapScaleBarLayer mapScaleBarLayer = new MapScaleBarLayer(mMap, mapScaleBar);
|
||||
BitmapRenderer renderer = mapScaleBarLayer.getRenderer();
|
||||
renderer.setPosition(GLViewport.Position.BOTTOM_LEFT);
|
||||
renderer.setOffset(5 * CanvasAdapter.getScale(), 0);
|
||||
|
||||
layers.addGroup(GROUP_OVERLAYS);
|
||||
layers.add(mapScaleBarLayer, GROUP_OVERLAYS);
|
||||
|
||||
mMap.setTheme(VtmThemes.DEFAULT);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
if (mapScaleBar != null)
|
||||
mapScaleBar.destroy();
|
||||
|
||||
super.onDestroy();
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Copyright 2014 Hannes Janetzek
|
||||
* Copyright 2016-2018 devemux86
|
||||
* Copyright 2016-2019 devemux86
|
||||
*
|
||||
* This file is part of the OpenScienceMap project (http://www.opensciencemap.org).
|
||||
*
|
||||
@@ -18,7 +18,6 @@
|
||||
package org.oscim.android.test;
|
||||
|
||||
import android.os.Bundle;
|
||||
|
||||
import org.oscim.backend.CanvasAdapter;
|
||||
import org.oscim.backend.canvas.Color;
|
||||
import org.oscim.core.MapPosition;
|
||||
@@ -38,7 +37,7 @@ import java.util.List;
|
||||
*/
|
||||
public class LineTexActivity extends BitmapTileActivity {
|
||||
|
||||
private static final boolean ANIMATION = false;
|
||||
private static final boolean ANIMATION = true;
|
||||
|
||||
private List<PathLayer> mPathLayers = new ArrayList<>();
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2016-2018 devemux86
|
||||
* Copyright 2016-2019 devemux86
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify it under the
|
||||
* terms of the GNU Lesser General Public License as published by the Free Software
|
||||
@@ -14,12 +14,14 @@
|
||||
*/
|
||||
package org.oscim.android.test;
|
||||
|
||||
import android.Manifest;
|
||||
import android.content.Context;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.location.Location;
|
||||
import android.location.LocationListener;
|
||||
import android.location.LocationManager;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
|
||||
import org.oscim.core.MapPosition;
|
||||
import org.oscim.layers.LocationLayer;
|
||||
|
||||
@@ -41,17 +43,25 @@ public class LocationActivity extends BitmapTileActivity implements LocationList
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
public void onRequestPermissionsResult(final int requestCode, final String[] permissions, final int[] grantResults) {
|
||||
if (requestCode == 0) {
|
||||
if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED)
|
||||
enableAvailableProviders();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStart() {
|
||||
super.onStart();
|
||||
|
||||
enableAvailableProviders();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPause() {
|
||||
super.onPause();
|
||||
|
||||
public void onStop() {
|
||||
locationManager.removeUpdates(this);
|
||||
|
||||
super.onStop();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -78,6 +88,13 @@ public class LocationActivity extends BitmapTileActivity implements LocationList
|
||||
}
|
||||
|
||||
private void enableAvailableProviders() {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
||||
if (checkSelfPermission(Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED) {
|
||||
requestPermissions(new String[]{Manifest.permission.ACCESS_FINE_LOCATION}, 0);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
locationManager.removeUpdates(this);
|
||||
|
||||
for (String provider : locationManager.getProviders(true)) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2016-2018 devemux86
|
||||
* Copyright 2016-2019 devemux86
|
||||
* Copyright 2018 Longri
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify it under the
|
||||
@@ -15,12 +15,14 @@
|
||||
*/
|
||||
package org.oscim.android.test;
|
||||
|
||||
import android.Manifest;
|
||||
import android.content.Context;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.location.Location;
|
||||
import android.location.LocationListener;
|
||||
import android.location.LocationManager;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
|
||||
import org.oscim.backend.CanvasAdapter;
|
||||
import org.oscim.backend.canvas.Bitmap;
|
||||
import org.oscim.backend.canvas.Color;
|
||||
@@ -78,17 +80,25 @@ public class LocationTextureActivity extends BitmapTileActivity implements Locat
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
public void onRequestPermissionsResult(final int requestCode, final String[] permissions, final int[] grantResults) {
|
||||
if (requestCode == 0) {
|
||||
if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED)
|
||||
enableAvailableProviders();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStart() {
|
||||
super.onStart();
|
||||
|
||||
enableAvailableProviders();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPause() {
|
||||
super.onPause();
|
||||
|
||||
public void onStop() {
|
||||
locationManager.removeUpdates(this);
|
||||
|
||||
super.onStop();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -115,6 +125,13 @@ public class LocationTextureActivity extends BitmapTileActivity implements Locat
|
||||
}
|
||||
|
||||
private void enableAvailableProviders() {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
||||
if (checkSelfPermission(Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED) {
|
||||
requestPermissions(new String[]{Manifest.permission.ACCESS_FINE_LOCATION}, 0);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
locationManager.removeUpdates(this);
|
||||
|
||||
for (String provider : locationManager.getProviders(true)) {
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
/*
|
||||
* Copyright 2019 Andrea Antonello
|
||||
* Copyright 2019 devemux86
|
||||
* Copyright 2019 Kostas Tzounopoulos
|
||||
*
|
||||
* 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
|
||||
@@ -18,8 +19,8 @@ package org.oscim.android.test;
|
||||
import android.app.AlertDialog;
|
||||
import android.content.DialogInterface;
|
||||
import android.os.Bundle;
|
||||
import android.os.Environment;
|
||||
import org.oscim.android.tiling.source.mbtiles.MBTilesBitmapTileSource;
|
||||
import org.oscim.android.tiling.source.mbtiles.MBTilesTileSource;
|
||||
import org.oscim.core.BoundingBox;
|
||||
import org.oscim.core.MapPosition;
|
||||
import org.oscim.core.Tile;
|
||||
@@ -28,19 +29,19 @@ import org.oscim.layers.tile.bitmap.BitmapTileLayer;
|
||||
import java.io.File;
|
||||
|
||||
/**
|
||||
* An example activity making use of MBTiles.
|
||||
* An example activity making use of raster MBTiles.
|
||||
*/
|
||||
public class MBTilesBitmapTileActivity extends BitmapTileActivity {
|
||||
public class MBTilesBitmapActivity extends BitmapTileActivity {
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
File file = new File(Environment.getExternalStorageDirectory(), "test.mbtiles");
|
||||
File file = new File(getExternalFilesDir(null), "raster.mbtiles");
|
||||
if (!file.exists()) {
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(this)
|
||||
.setTitle(R.string.warning)
|
||||
.setMessage(R.string.startup_message_mbtiles)
|
||||
.setMessage(getResources().getString(R.string.startup_message_mbtiles, file.getName(), file.getAbsolutePath()))
|
||||
.setPositiveButton(R.string.exit, new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
@@ -51,7 +52,8 @@ public class MBTilesBitmapTileActivity extends BitmapTileActivity {
|
||||
return;
|
||||
}
|
||||
|
||||
MBTilesBitmapTileSource tileSource = new MBTilesBitmapTileSource(file.getAbsolutePath(), 128, null);
|
||||
MBTilesTileSource tileSource = new MBTilesBitmapTileSource(file.getAbsolutePath(), 128, null);
|
||||
|
||||
BitmapTileLayer bitmapLayer = new BitmapTileLayer(mMap, tileSource);
|
||||
mMap.layers().add(bitmapLayer);
|
||||
|
||||
@@ -59,7 +61,7 @@ public class MBTilesBitmapTileActivity extends BitmapTileActivity {
|
||||
MapPosition pos = new MapPosition();
|
||||
mMap.getMapPosition(pos);
|
||||
if (pos.x == 0.5 && pos.y == 0.5) {
|
||||
BoundingBox bbox = tileSource.getBounds();
|
||||
BoundingBox bbox = tileSource.getDataSource().getBounds();
|
||||
if (bbox != null) {
|
||||
pos.setByBoundingBox(bbox, Tile.SIZE * 4, Tile.SIZE * 4);
|
||||
mMap.setMapPosition(pos);
|
||||
@@ -0,0 +1,93 @@
|
||||
/*
|
||||
* Copyright 2019 Andrea Antonello
|
||||
* Copyright 2019 devemux86
|
||||
* Copyright 2019 Kostas Tzounopoulos
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify it under the
|
||||
* terms of the GNU Lesser General Public License as published by the Free Software
|
||||
* Foundation, either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||
* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License along with
|
||||
* this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package org.oscim.android.test;
|
||||
|
||||
import android.app.AlertDialog;
|
||||
import android.content.DialogInterface;
|
||||
import android.os.Bundle;
|
||||
import org.oscim.android.mvt.tiling.source.mbtiles.MBTilesMvtTileSource;
|
||||
import org.oscim.android.tiling.source.mbtiles.MBTilesTileSource;
|
||||
import org.oscim.android.tiling.source.mbtiles.MBTilesUnsupportedException;
|
||||
import org.oscim.core.BoundingBox;
|
||||
import org.oscim.core.MapPosition;
|
||||
import org.oscim.core.Tile;
|
||||
import org.oscim.layers.tile.buildings.BuildingLayer;
|
||||
import org.oscim.layers.tile.vector.VectorTileLayer;
|
||||
import org.oscim.layers.tile.vector.labeling.LabelLayer;
|
||||
import org.oscim.theme.VtmThemes;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
/**
|
||||
* An example activity making use of vector MBTiles.
|
||||
*/
|
||||
public class MBTilesMvtActivity extends MapActivity {
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
File file = new File(getExternalFilesDir(null), "vector.mbtiles");
|
||||
if (!file.exists()) {
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(this)
|
||||
.setTitle(R.string.warning)
|
||||
.setMessage(getResources().getString(R.string.startup_message_mbtiles, file.getName(), file.getAbsolutePath()))
|
||||
.setPositiveButton(R.string.exit, new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
finish();
|
||||
}
|
||||
});
|
||||
builder.show();
|
||||
return;
|
||||
}
|
||||
|
||||
MBTilesTileSource tileSource;
|
||||
try {
|
||||
tileSource = new MBTilesMvtTileSource(file.getAbsolutePath(), "en");
|
||||
} catch (MBTilesUnsupportedException e) {
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(this)
|
||||
.setTitle(R.string.warning)
|
||||
.setMessage(e.getMessage())
|
||||
.setPositiveButton(R.string.exit, new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
finish();
|
||||
}
|
||||
});
|
||||
builder.show();
|
||||
return;
|
||||
}
|
||||
|
||||
VectorTileLayer l = mMap.setBaseMap(tileSource);
|
||||
mMap.setTheme(VtmThemes.OPENMAPTILES);
|
||||
|
||||
mMap.layers().add(new BuildingLayer(mMap, l));
|
||||
mMap.layers().add(new LabelLayer(mMap, l));
|
||||
|
||||
/* set initial position on first run */
|
||||
MapPosition pos = new MapPosition();
|
||||
mMap.getMapPosition(pos);
|
||||
if (pos.x == 0.5 && pos.y == 0.5) {
|
||||
BoundingBox bbox = tileSource.getDataSource().getBounds();
|
||||
if (bbox != null) {
|
||||
pos.setByBoundingBox(bbox, Tile.SIZE * 4, Tile.SIZE * 4);
|
||||
mMap.setMapPosition(pos);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,32 +0,0 @@
|
||||
/*
|
||||
* Copyright 2016-2017 devemux86
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify it under the
|
||||
* terms of the GNU Lesser General Public License as published by the Free Software
|
||||
* Foundation, either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||
* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License along with
|
||||
* this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package org.oscim.android.test;
|
||||
|
||||
import org.oscim.utils.Parameters;
|
||||
|
||||
public class MapEventLayer2Activity extends MarkerOverlayActivity {
|
||||
|
||||
public MapEventLayer2Activity() {
|
||||
super();
|
||||
Parameters.MAP_EVENT_LAYER2 = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
super.onDestroy();
|
||||
|
||||
Parameters.MAP_EVENT_LAYER2 = false;
|
||||
}
|
||||
}
|
||||
@@ -1,91 +0,0 @@
|
||||
/*
|
||||
* Copyright 2016 Marvin W
|
||||
* Copyright 2016-2017 devemux86
|
||||
*
|
||||
* This file is part of the OpenScienceMap project (http://www.opensciencemap.org).
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify it under the
|
||||
* terms of the GNU Lesser General Public License as published by the Free Software
|
||||
* Foundation, either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||
* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License along with
|
||||
* this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package org.oscim.android.test;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.os.Bundle;
|
||||
|
||||
import org.oscim.android.MapPreferences;
|
||||
import org.oscim.android.MapView;
|
||||
import org.oscim.layers.tile.buildings.BuildingLayer;
|
||||
import org.oscim.layers.tile.vector.VectorTileLayer;
|
||||
import org.oscim.layers.tile.vector.labeling.LabelLayer;
|
||||
import org.oscim.map.Map;
|
||||
import org.oscim.theme.VtmThemes;
|
||||
import org.oscim.tiling.TileSource;
|
||||
import org.oscim.tiling.source.OkHttpEngine;
|
||||
import org.oscim.tiling.source.oscimap4.OSciMap4TileSource;
|
||||
|
||||
public class MultiMapViewActivity extends Activity {
|
||||
private MapView mMapView1, mMapView2;
|
||||
private MapPreferences mPrefs1, mPrefs2;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_map_multi);
|
||||
|
||||
setTitle(getClass().getSimpleName());
|
||||
|
||||
// 1st map view
|
||||
mMapView1 = (MapView) findViewById(R.id.mapView1);
|
||||
Map map1 = mMapView1.map();
|
||||
mPrefs1 = new MapPreferences(MultiMapViewActivity.class.getName() + "1", this);
|
||||
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);
|
||||
|
||||
// 2nd map view
|
||||
mMapView2 = (MapView) findViewById(R.id.mapView2);
|
||||
Map map2 = mMapView2.map();
|
||||
mPrefs2 = new MapPreferences(MultiMapViewActivity.class.getName() + "2", this);
|
||||
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);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
|
||||
mPrefs1.load(mMapView1.map());
|
||||
mMapView1.onResume();
|
||||
|
||||
mPrefs2.load(mMapView2.map());
|
||||
mMapView2.onResume();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPause() {
|
||||
super.onPause();
|
||||
|
||||
mMapView1.onPause();
|
||||
mPrefs1.save(mMapView1.map());
|
||||
|
||||
mMapView2.onPause();
|
||||
mPrefs2.save(mMapView2.map());
|
||||
}
|
||||
}
|
||||
@@ -1,72 +0,0 @@
|
||||
/*
|
||||
* Copyright 2016-2017 devemux86
|
||||
*
|
||||
* This file is part of the OpenScienceMap project (http://www.opensciencemap.org).
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify it under the
|
||||
* terms of the GNU Lesser General Public License as published by the Free Software
|
||||
* Foundation, either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||
* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License along with
|
||||
* this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package org.oscim.android.test;
|
||||
|
||||
import android.os.Bundle;
|
||||
|
||||
import org.oscim.android.cache.TileCache;
|
||||
import org.oscim.layers.tile.TileLayer;
|
||||
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 OSciMapS3DBActivity extends BaseMapActivity {
|
||||
|
||||
TileCache mS3dbCache;
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
mMap.setTheme(VtmThemes.DEFAULT);
|
||||
|
||||
TileSource ts = OSciMap4TileSource.builder()
|
||||
.httpFactory(new OkHttpEngine.OkHttpFactory())
|
||||
.url("http://opensciencemap.org/tiles/s3db")
|
||||
.zoomMin(16)
|
||||
.zoomMax(16)
|
||||
.build();
|
||||
|
||||
if (USE_CACHE) {
|
||||
mS3dbCache = new TileCache(this, null, "s3db.db");
|
||||
mS3dbCache.setCacheSize(512 * (1 << 10));
|
||||
ts.setCache(mS3dbCache);
|
||||
}
|
||||
TileLayer tl = new S3DBTileLayer(mMap, ts, true, false);
|
||||
mMap.layers().add(tl);
|
||||
mMap.layers().add(new LabelLayer(mMap, mBaseLayer));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
super.onDestroy();
|
||||
|
||||
if (mS3dbCache != null)
|
||||
mS3dbCache.dispose();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
|
||||
/* ignore saved position */
|
||||
mMap.setMapPosition(53.5620092, 9.9866457, 1 << 16);
|
||||
}
|
||||
}
|
||||
@@ -1,36 +0,0 @@
|
||||
/*
|
||||
* Copyright 2017-2018 devemux86
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify it under the
|
||||
* terms of the GNU Lesser General Public License as published by the Free Software
|
||||
* Foundation, either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||
* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License along with
|
||||
* this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package org.oscim.android.test;
|
||||
|
||||
import android.os.Bundle;
|
||||
|
||||
import org.oscim.utils.Parameters;
|
||||
|
||||
public class POTTextureActivity extends SimpleMapActivity {
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
Parameters.POT_TEXTURES = true;
|
||||
|
||||
super.onCreate(savedInstanceState);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
super.onDestroy();
|
||||
|
||||
Parameters.POT_TEXTURES = false;
|
||||
}
|
||||
}
|
||||
@@ -1,78 +0,0 @@
|
||||
/*
|
||||
* Copyright 2014 Hannes Janetzek
|
||||
* Copyright 2016-2017 devemux86
|
||||
* Copyright 2017 Longri
|
||||
*
|
||||
* This file is part of the OpenScienceMap project (http://www.opensciencemap.org).
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify it under the
|
||||
* terms of the GNU Lesser General Public License as published by the Free Software
|
||||
* Foundation, either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||
* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License along with
|
||||
* this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package org.oscim.android.test;
|
||||
|
||||
import android.widget.Toast;
|
||||
|
||||
import org.oscim.layers.marker.MarkerItem;
|
||||
|
||||
import java.util.Timer;
|
||||
import java.util.TimerTask;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
|
||||
public class RotateMarkerOverlayActivity extends MarkerOverlayActivity {
|
||||
|
||||
private Timer timer;
|
||||
private int markerCount = 0;
|
||||
|
||||
private void itemEvent(final MarkerItem item) {
|
||||
if (item.getMarker() == null) {
|
||||
item.setMarker(mFocusMarker);
|
||||
markerCount++;
|
||||
final AtomicInteger rotValue = new AtomicInteger(0);
|
||||
if (timer != null)
|
||||
timer.cancel();
|
||||
timer = new Timer();
|
||||
TimerTask timerTask = new TimerTask() {
|
||||
@Override
|
||||
public void run() {
|
||||
float value = (float) (rotValue.incrementAndGet() * 10);
|
||||
item.setRotation(value);
|
||||
if (rotValue.get() > 36)
|
||||
rotValue.set(0);
|
||||
mMarkerLayer.update();
|
||||
mMap.updateMap(true);
|
||||
}
|
||||
};
|
||||
timer.schedule(timerTask, 1000, 1000);
|
||||
|
||||
} else {
|
||||
item.setMarker(null);
|
||||
markerCount--;
|
||||
if (timer != null && markerCount == 0)
|
||||
timer.cancel();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onItemSingleTapUp(int index, MarkerItem item) {
|
||||
itemEvent(item);
|
||||
|
||||
Toast.makeText(this, "Marker tap\n" + item.getTitle(), Toast.LENGTH_SHORT).show();
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onItemLongPress(int index, MarkerItem item) {
|
||||
itemEvent(item);
|
||||
|
||||
Toast.makeText(this, "Marker long press\n" + item.getTitle(), Toast.LENGTH_SHORT).show();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -9,6 +9,7 @@
|
||||
* Copyright 2018 boldtrn
|
||||
* Copyright 2018-2019 Gustl22
|
||||
* Copyright 2019 Andrea Antonello
|
||||
* Copyright 2019 Kostas Tzounopoulos
|
||||
*
|
||||
* This file is part of the OpenScienceMap project (http://www.opensciencemap.org).
|
||||
*
|
||||
@@ -88,12 +89,13 @@ public class Samples extends Activity {
|
||||
linearLayout.addView(createLabel(null));
|
||||
linearLayout.addView(createButton(SimpleMapActivity.class));
|
||||
linearLayout.addView(createButton(MapsforgeActivity.class));
|
||||
linearLayout.addView(createButton(MBTilesMvtActivity.class));
|
||||
linearLayout.addView(createButton(MapilionMvtActivity.class));
|
||||
/*linearLayout.addView(createButton(MapzenMvtActivity.class));
|
||||
linearLayout.addView(createButton(MapzenGeojsonActivity.class));*/
|
||||
linearLayout.addView(createButton(MapzenGeojsonActivity.class));
|
||||
linearLayout.addView(createButton(NextzenMvtActivity.class));
|
||||
linearLayout.addView(createButton(NextzenGeojsonActivity.class));
|
||||
linearLayout.addView(createButton(OpenMapTilesMvtActivity.class));
|
||||
linearLayout.addView(createButton(OpenMapTilesMvtActivity.class));*/
|
||||
linearLayout.addView(createButton(GdxActivity.class));
|
||||
|
||||
linearLayout.addView(createLabel("Features"));
|
||||
@@ -110,37 +112,25 @@ public class Samples extends Activity {
|
||||
linearLayout.addView(createLabel("Vector Features"));
|
||||
linearLayout.addView(createButton(MapsforgeStyleActivity.class));
|
||||
linearLayout.addView(createButton(MapsforgeS3DBActivity.class));
|
||||
linearLayout.addView(createButton(AtlasThemeActivity.class));
|
||||
linearLayout.addView(createButton(POTTextureActivity.class));
|
||||
linearLayout.addView(createButton(ShadowActivity.class));
|
||||
|
||||
linearLayout.addView(createLabel("Raster Maps"));
|
||||
linearLayout.addView(createButton(BitmapTileActivity.class));
|
||||
linearLayout.addView(createButton(MBTilesBitmapTileActivity.class));
|
||||
linearLayout.addView(createButton(MBTilesBitmapActivity.class));
|
||||
|
||||
linearLayout.addView(createLabel("Overlays"));
|
||||
linearLayout.addView(createButton(MarkerOverlayActivity.class));
|
||||
linearLayout.addView(createButton(RotateMarkerOverlayActivity.class));
|
||||
linearLayout.addView(createButton(AtlasMarkerOverlayActivity.class));
|
||||
linearLayout.addView(createButton(AtlasMultiTextureActivity.class));
|
||||
linearLayout.addView(createButton(ClusterMarkerOverlayActivity.class));
|
||||
linearLayout.addView(createButton(PathOverlayActivity.class));
|
||||
linearLayout.addView(createButton(LineTexActivity.class));
|
||||
linearLayout.addView(createButton(VectorLayerActivity.class));
|
||||
|
||||
linearLayout.addView(createLabel("User Interaction"));
|
||||
linearLayout.addView(createButton(MapEventLayer2Activity.class));
|
||||
linearLayout.addView(createButton(LayerGroupActivity.class));
|
||||
|
||||
linearLayout.addView(createLabel("Dual Map Views"));
|
||||
linearLayout.addView(createButton(MultiMapViewActivity.class));
|
||||
linearLayout.addView(createButton(AtlasMultiTextureActivity.class));
|
||||
|
||||
linearLayout.addView(createLabel("Experiments"));
|
||||
linearLayout.addView(createButton(ReverseGeocodeActivity.class));
|
||||
linearLayout.addView(createButton(OSciMapS3DBActivity.class));
|
||||
linearLayout.addView(createButton(ThemeStylerActivity.class));
|
||||
linearLayout.addView(createButton(JeoIndoorActivity.class));
|
||||
linearLayout.addView(createButton(GdxPoi3DActivity.class));
|
||||
linearLayout.addView(createButton(OverpassActivity.class));
|
||||
linearLayout.addView(createButton(ClusterMarkerOverlayActivity.class));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,8 +16,8 @@ android {
|
||||
}
|
||||
|
||||
defaultConfig {
|
||||
versionCode versionCode()
|
||||
versionName versionName()
|
||||
versionCode project.versionCode()
|
||||
versionName project.versionName()
|
||||
minSdkVersion androidMinSdk()
|
||||
targetSdkVersion androidTargetSdk()
|
||||
}
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
2
vtm-android-mvt/AndroidManifest.xml
Normal file
2
vtm-android-mvt/AndroidManifest.xml
Normal file
@@ -0,0 +1,2 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<manifest package="org.oscim.android.mvt" />
|
||||
55
vtm-android-mvt/build.gradle
Normal file
55
vtm-android-mvt/build.gradle
Normal file
@@ -0,0 +1,55 @@
|
||||
apply plugin: 'com.android.library'
|
||||
apply plugin: 'com.github.dcendents.android-maven'
|
||||
|
||||
dependencies {
|
||||
api project(':vtm-android')
|
||||
api project(':vtm-mvt')
|
||||
}
|
||||
|
||||
android {
|
||||
compileSdkVersion androidCompileSdk()
|
||||
buildToolsVersion "$androidBuildVersionTools"
|
||||
|
||||
compileOptions {
|
||||
sourceCompatibility JavaVersion.VERSION_1_7
|
||||
targetCompatibility JavaVersion.VERSION_1_7
|
||||
}
|
||||
|
||||
defaultConfig {
|
||||
versionCode project.versionCode()
|
||||
versionName project.versionName()
|
||||
minSdkVersion androidMinSdk()
|
||||
targetSdkVersion androidTargetSdk()
|
||||
}
|
||||
|
||||
sourceSets {
|
||||
main {
|
||||
manifest.srcFile 'AndroidManifest.xml'
|
||||
java.srcDirs = ['src']
|
||||
}
|
||||
debug.setRoot('build-types/debug')
|
||||
release.setRoot('build-types/release')
|
||||
}
|
||||
|
||||
lintOptions { abortOnError false }
|
||||
}
|
||||
|
||||
android.libraryVariants.all { variant ->
|
||||
def name = variant.buildType.name
|
||||
if (name == "debug")
|
||||
return
|
||||
|
||||
def jar = project.tasks.create "jar${name.capitalize()}", Jar
|
||||
jar.dependsOn variant.javaCompileProvider
|
||||
jar.exclude '**/BuildConfig.class'
|
||||
jar.exclude '**/R.class'
|
||||
jar.exclude '**/R$*.class'
|
||||
jar.from variant.javaCompileProvider.get().destinationDir
|
||||
artifacts.add('archives', jar)
|
||||
}
|
||||
|
||||
if (project.hasProperty("SONATYPE_USERNAME")) {
|
||||
afterEvaluate {
|
||||
project.apply from: "${rootProject.projectDir}/deploy.gradle"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,144 @@
|
||||
/*
|
||||
* Copyright 2019 Kostas Tzounopoulos
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify it under the
|
||||
* terms of the GNU Lesser General Public License as published by the Free Software
|
||||
* Foundation, either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||
* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License along with
|
||||
* this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package org.oscim.android.mvt.tiling.source.mbtiles;
|
||||
|
||||
import android.database.Cursor;
|
||||
import org.oscim.android.tiling.source.mbtiles.MBTilesTileDataSource;
|
||||
import org.oscim.android.tiling.source.mbtiles.MBTilesUnsupportedException;
|
||||
import org.oscim.core.MercatorProjection;
|
||||
import org.oscim.layers.tile.MapTile;
|
||||
import org.oscim.tiling.ITileDataSink;
|
||||
import org.oscim.tiling.OverzoomDataSink;
|
||||
import org.oscim.tiling.QueryResult;
|
||||
import org.oscim.tiling.source.mvt.MvtTileDecoder;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.IOException;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.zip.GZIPInputStream;
|
||||
|
||||
/**
|
||||
* A tile data source for MBTiles vector databases.
|
||||
*/
|
||||
public class MBTilesMvtTileDataSource extends MBTilesTileDataSource {
|
||||
|
||||
private static final Logger log = LoggerFactory.getLogger(MBTilesMvtTileDataSource.class);
|
||||
|
||||
private static final List<String> SUPPORTED_FORMATS = Collections.singletonList("pbf");
|
||||
private static final String WHERE_FORMAT = "zoom_level=%d AND tile_column=%d AND tile_row=%d";
|
||||
|
||||
private final String mLanguage;
|
||||
|
||||
private final ThreadLocal<MvtTileDecoder> mThreadLocalDecoders = new ThreadLocal<MvtTileDecoder>() {
|
||||
@Override
|
||||
protected MvtTileDecoder initialValue() {
|
||||
return new MvtTileDecoder(mLanguage);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Create a tile data source for MBTiles vector databases.
|
||||
*
|
||||
* @param path the path to the MBTiles database.
|
||||
* @param language the language to use when rendering the MBTiles.
|
||||
*/
|
||||
public MBTilesMvtTileDataSource(String path, String language) {
|
||||
super(path);
|
||||
mLanguage = language != null ? language : "en";
|
||||
|
||||
try {
|
||||
assertDatabaseFormat();
|
||||
} catch (MBTilesUnsupportedException e) {
|
||||
log.error("Invalid MBTiles database", e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void cancel() {
|
||||
// do nothing
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dispose() {
|
||||
if (mDatabase != null && mDatabase.isOpen())
|
||||
mDatabase.close();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getSupportedFormats() {
|
||||
return SUPPORTED_FORMATS;
|
||||
}
|
||||
|
||||
private MapTile mapTile(Cursor cursor) {
|
||||
int tileX = cursor.getInt(cursor.getColumnIndexOrThrow("tile_column"));
|
||||
int tileY = cursor.getInt(cursor.getColumnIndexOrThrow("tile_row"));
|
||||
int zoomLevel = cursor.getInt(cursor.getColumnIndexOrThrow("zoom_level"));
|
||||
long tmsTileY = MercatorProjection.tileYToTMS(tileY, (byte) zoomLevel);
|
||||
return new MapTile(tileX, (int) tmsTileY, zoomLevel);
|
||||
}
|
||||
|
||||
/**
|
||||
* Overzoom on the DB layer: generate a query for all tiles with lower zoomLevel than the one requested.
|
||||
*/
|
||||
private String overzoomQuery(MapTile tile) {
|
||||
long tmsTileY = MercatorProjection.tileYToTMS(tile.tileY, tile.zoomLevel);
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("(");
|
||||
for (int zoomLevel = tile.zoomLevel - 1; zoomLevel > 0; zoomLevel--) {
|
||||
int diff = tile.zoomLevel - zoomLevel;
|
||||
sb.append(String.format(Locale.US, WHERE_FORMAT, zoomLevel, tile.tileX >> diff, tmsTileY >> diff));
|
||||
if (zoomLevel > 1) // Not the last iteration
|
||||
sb.append(") OR (");
|
||||
}
|
||||
sb.append(")");
|
||||
return String.format(SELECT_TILES_FORMAT, sb.toString());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void query(MapTile requestTile, ITileDataSink requestDataSink) {
|
||||
Cursor cursor = null;
|
||||
ITileDataSink responseDataSink = requestDataSink;
|
||||
try {
|
||||
long tmsTileY = MercatorProjection.tileYToTMS(requestTile.tileY, requestTile.zoomLevel);
|
||||
cursor = mDatabase.rawQuery(String.format(SELECT_TILES_FORMAT, String.format(Locale.US, WHERE_FORMAT, requestTile.zoomLevel, requestTile.tileX, tmsTileY)), null);
|
||||
|
||||
if (cursor.getCount() == 0) {
|
||||
cursor.close();
|
||||
cursor = mDatabase.rawQuery(overzoomQuery(requestTile), null);
|
||||
}
|
||||
|
||||
if (cursor.moveToFirst()) {
|
||||
byte[] bytes = cursor.getBlob(cursor.getColumnIndexOrThrow("tile_data"));
|
||||
|
||||
MapTile responseTile = mapTile(cursor);
|
||||
if (requestTile.zoomLevel != responseTile.zoomLevel)
|
||||
responseDataSink = new OverzoomDataSink(requestDataSink, responseTile, requestTile);
|
||||
|
||||
boolean success = mThreadLocalDecoders.get().decode(responseTile, responseDataSink, new GZIPInputStream(new ByteArrayInputStream(bytes)));
|
||||
responseDataSink.completed(success ? QueryResult.SUCCESS : QueryResult.FAILED);
|
||||
} else
|
||||
responseDataSink.completed(QueryResult.TILE_NOT_FOUND);
|
||||
} catch (IOException e) {
|
||||
responseDataSink.completed(QueryResult.FAILED);
|
||||
} finally {
|
||||
if (cursor != null)
|
||||
cursor.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
/*
|
||||
* Copyright 2019 Kostas Tzounopoulos
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify it under the
|
||||
* terms of the GNU Lesser General Public License as published by the Free Software
|
||||
* Foundation, either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||
* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License along with
|
||||
* this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package org.oscim.android.mvt.tiling.source.mbtiles;
|
||||
|
||||
import org.oscim.android.tiling.source.mbtiles.MBTilesTileSource;
|
||||
|
||||
/**
|
||||
* A tile source for MBTiles vector databases.
|
||||
*/
|
||||
public class MBTilesMvtTileSource extends MBTilesTileSource {
|
||||
|
||||
/**
|
||||
* Create a tile source for MBTiles vector databases.
|
||||
*
|
||||
* @param path the path to the MBTiles database.
|
||||
*/
|
||||
public MBTilesMvtTileSource(String path) {
|
||||
this(path, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a tile source for MBTiles vector databases.
|
||||
*
|
||||
* @param path the path to the MBTiles database.
|
||||
* @param language the language to use when rendering the MBTiles.
|
||||
*/
|
||||
public MBTilesMvtTileSource(String path, String language) {
|
||||
super(new MBTilesMvtTileDataSource(path, language));
|
||||
}
|
||||
}
|
||||
@@ -16,8 +16,8 @@ android {
|
||||
}
|
||||
|
||||
defaultConfig {
|
||||
versionCode versionCode()
|
||||
versionName versionName()
|
||||
versionCode project.versionCode()
|
||||
versionName project.versionName()
|
||||
minSdkVersion androidMinSdk()
|
||||
targetSdkVersion androidTargetSdk()
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Copyright 2013 Hannes Janetzek
|
||||
* Copyright 2016-2017 devemux86
|
||||
* Copyright 2016-2019 devemux86
|
||||
* Copyright 2017 nebular
|
||||
* Copyright 2017 Longri
|
||||
*
|
||||
@@ -21,8 +21,8 @@ package org.oscim.android.canvas;
|
||||
|
||||
import android.graphics.Color;
|
||||
import android.graphics.PorterDuff;
|
||||
import android.graphics.PorterDuffXfermode;
|
||||
import android.graphics.RectF;
|
||||
|
||||
import org.oscim.backend.canvas.Bitmap;
|
||||
import org.oscim.backend.canvas.Canvas;
|
||||
import org.oscim.backend.canvas.Paint;
|
||||
@@ -93,6 +93,7 @@ public class AndroidCanvas implements Canvas {
|
||||
RectF rect = new RectF(x, y, x + width, y + height);
|
||||
android.graphics.Paint paint = new android.graphics.Paint();
|
||||
paint.setColor(color);
|
||||
paint.setXfermode(new PorterDuffXfermode(color == Color.TRANSPARENT ? PorterDuff.Mode.CLEAR : PorterDuff.Mode.SRC_OVER));
|
||||
canvas.drawRect(rect, paint);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
/*
|
||||
* Copyright 2019 Andrea Antonello
|
||||
* Copyright 2019 devemux86
|
||||
* Copyright 2019 Kostas Tzounopoulos
|
||||
*
|
||||
* 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
|
||||
@@ -16,144 +17,70 @@
|
||||
package org.oscim.android.tiling.source.mbtiles;
|
||||
|
||||
import android.database.Cursor;
|
||||
import android.database.sqlite.SQLiteDatabase;
|
||||
import android.graphics.BitmapFactory;
|
||||
import android.graphics.Canvas;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.Paint;
|
||||
import org.oscim.backend.CanvasAdapter;
|
||||
import org.oscim.backend.canvas.Bitmap;
|
||||
import org.oscim.core.BoundingBox;
|
||||
import org.oscim.core.MercatorProjection;
|
||||
import org.oscim.layers.tile.MapTile;
|
||||
import org.oscim.map.Viewport;
|
||||
import org.oscim.tiling.ITileDataSink;
|
||||
import org.oscim.tiling.ITileDataSource;
|
||||
import org.oscim.tiling.QueryResult;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* A tile data source for MBTiles raster databases.
|
||||
*/
|
||||
public class MBTilesBitmapTileDataSource implements ITileDataSource {
|
||||
public class MBTilesBitmapTileDataSource extends MBTilesTileDataSource {
|
||||
|
||||
private static final Logger log = LoggerFactory.getLogger(MBTilesBitmapTileDataSource.class);
|
||||
|
||||
private static final String TABLE_TILES = "tiles";
|
||||
private static final String COL_TILES_ZOOM_LEVEL = "zoom_level";
|
||||
private static final String COL_TILES_TILE_COLUMN = "tile_column";
|
||||
private static final String COL_TILES_TILE_ROW = "tile_row";
|
||||
private static final String COL_TILES_TILE_DATA = "tile_data";
|
||||
private static final String SELECT_TILES = "SELECT " + COL_TILES_TILE_DATA + " from " + TABLE_TILES + " where "
|
||||
+ COL_TILES_ZOOM_LEVEL + "=? AND " + COL_TILES_TILE_COLUMN + "=? AND " + COL_TILES_TILE_ROW + "=?";
|
||||
|
||||
private static final String TABLE_METADATA = "metadata";
|
||||
private static final String COL_METADATA_NAME = "name";
|
||||
private static final String COL_METADATA_VALUE = "value";
|
||||
private static final String SELECT_METADATA = "select " + COL_METADATA_NAME + "," + COL_METADATA_VALUE + " from "
|
||||
+ TABLE_METADATA;
|
||||
private static final List<String> SUPPORTED_FORMATS = Arrays.asList("png", "jpg", "jpeg");
|
||||
|
||||
private final Integer mAlpha;
|
||||
private final SQLiteDatabase mDatabase;
|
||||
private Map<String, String> mMetadata;
|
||||
private final Integer mTransparentColor;
|
||||
|
||||
/**
|
||||
* Create a MBTiles tile data source.
|
||||
* Create a tile data source for MBTiles raster databases.
|
||||
*
|
||||
* @param path the path to the MBTiles database.
|
||||
* @param alpha an optional alpha value [0-255] to make the tiles transparent.
|
||||
* @param transparentColor an optional color that will be made transparent in the bitmap.
|
||||
*/
|
||||
MBTilesBitmapTileDataSource(String path, Integer alpha, Integer transparentColor) {
|
||||
mDatabase = SQLiteDatabase.openDatabase(path, null, SQLiteDatabase.OPEN_READONLY);
|
||||
public MBTilesBitmapTileDataSource(String path, Integer alpha, Integer transparentColor) {
|
||||
super(path);
|
||||
mAlpha = alpha;
|
||||
mTransparentColor = transparentColor;
|
||||
|
||||
try {
|
||||
assertDatabaseFormat();
|
||||
} catch (MBTilesUnsupportedException e) {
|
||||
log.error("Invalid MBTiles database", e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void cancel() {
|
||||
if (mDatabase != null && mDatabase.isOpen())
|
||||
mDatabase.close();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dispose() {
|
||||
if (mDatabase != null && mDatabase.isOpen())
|
||||
mDatabase.close();
|
||||
}
|
||||
|
||||
String getAttribution() {
|
||||
return getMetadata().get("attribution");
|
||||
}
|
||||
|
||||
BoundingBox getBounds() {
|
||||
String bounds = getMetadata().get("bounds");
|
||||
if (bounds != null) {
|
||||
String[] split = bounds.split(",");
|
||||
double w = Double.parseDouble(split[0]);
|
||||
double s = Double.parseDouble(split[1]);
|
||||
double e = Double.parseDouble(split[2]);
|
||||
double n = Double.parseDouble(split[3]);
|
||||
return new BoundingBox(s, w, n, e);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return getMetadata().get("description");
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the image format (jpg, png)
|
||||
*/
|
||||
public String getFormat() {
|
||||
return getMetadata().get("format");
|
||||
}
|
||||
|
||||
int getMaxZoom() {
|
||||
String maxZoom = getMetadata().get("maxzoom");
|
||||
if (maxZoom != null)
|
||||
return Integer.parseInt(maxZoom);
|
||||
return Viewport.MAX_ZOOM_LEVEL;
|
||||
}
|
||||
|
||||
private Map<String, String> getMetadata() {
|
||||
if (mMetadata == null) {
|
||||
mMetadata = new HashMap<>();
|
||||
Cursor cursor = null;
|
||||
try {
|
||||
cursor = mDatabase.rawQuery(SELECT_METADATA, null);
|
||||
while (cursor.moveToNext()) {
|
||||
String key = cursor.getString(0);
|
||||
String value = cursor.getString(1);
|
||||
mMetadata.put(key, value);
|
||||
}
|
||||
} finally {
|
||||
if (cursor != null)
|
||||
cursor.close();
|
||||
}
|
||||
}
|
||||
return mMetadata;
|
||||
}
|
||||
|
||||
int getMinZoom() {
|
||||
String minZoom = getMetadata().get("minzoom");
|
||||
if (minZoom != null)
|
||||
return Integer.parseInt(minZoom);
|
||||
return Viewport.MIN_ZOOM_LEVEL;
|
||||
}
|
||||
|
||||
String getName() {
|
||||
return getMetadata().get("name");
|
||||
}
|
||||
|
||||
public String getVersion() {
|
||||
return getMetadata().get("version");
|
||||
@Override
|
||||
public List<String> getSupportedFormats() {
|
||||
return SUPPORTED_FORMATS;
|
||||
}
|
||||
|
||||
private static android.graphics.Bitmap processAlpha(android.graphics.Bitmap bitmap, int alpha) {
|
||||
@@ -216,9 +143,9 @@ public class MBTilesBitmapTileDataSource implements ITileDataSource {
|
||||
Cursor cursor = null;
|
||||
try {
|
||||
long tmsTileY = MercatorProjection.tileYToTMS(tileY, zoomLevel);
|
||||
cursor = mDatabase.rawQuery(SELECT_TILES, new String[]{String.valueOf(zoomLevel), String.valueOf(tileX), String.valueOf(tmsTileY)});
|
||||
cursor = mDatabase.rawQuery(String.format(MBTilesTileDataSource.SELECT_TILES_FORMAT, MBTilesTileDataSource.WHERE_FORMAT), new String[]{String.valueOf(zoomLevel), String.valueOf(tileX), String.valueOf(tmsTileY)});
|
||||
if (cursor.moveToFirst())
|
||||
return cursor.getBlob(0);
|
||||
return cursor.getBlob(cursor.getColumnIndexOrThrow("tile_data"));
|
||||
} finally {
|
||||
if (cursor != null)
|
||||
cursor.close();
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
/*
|
||||
* Copyright 2019 Andrea Antonello
|
||||
* Copyright 2019 devemux86
|
||||
* Copyright 2019 Kostas Tzounopoulos
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify it under the
|
||||
* terms of the GNU Lesser General Public License as published by the Free Software
|
||||
@@ -15,19 +16,13 @@
|
||||
*/
|
||||
package org.oscim.android.tiling.source.mbtiles;
|
||||
|
||||
import org.oscim.core.BoundingBox;
|
||||
import org.oscim.tiling.ITileDataSource;
|
||||
import org.oscim.tiling.TileSource;
|
||||
|
||||
/**
|
||||
* A tile source for MBTiles raster databases.
|
||||
*/
|
||||
public class MBTilesBitmapTileSource extends TileSource {
|
||||
|
||||
private final MBTilesBitmapTileDataSource mTileDataSource;
|
||||
public class MBTilesBitmapTileSource extends MBTilesTileSource {
|
||||
|
||||
/**
|
||||
* Create a MBTiles tile source.
|
||||
* Create a tile source for MBTiles raster databases.
|
||||
*
|
||||
* @param path the path to the MBTiles database.
|
||||
*/
|
||||
@@ -36,64 +31,13 @@ public class MBTilesBitmapTileSource extends TileSource {
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a MBTiles tile source.
|
||||
* Create a tile source for MBTiles raster databases.
|
||||
*
|
||||
* @param path the path to the MBTiles database.
|
||||
* @param alpha an optional alpha value [0-255] to make the tiles transparent.
|
||||
* @param transparentColor an optional color that will be made transparent in the bitmap.
|
||||
*/
|
||||
public MBTilesBitmapTileSource(String path, Integer alpha, Integer transparentColor) {
|
||||
mTileDataSource = new MBTilesBitmapTileDataSource(path, alpha, transparentColor);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void close() {
|
||||
mTileDataSource.dispose();
|
||||
}
|
||||
|
||||
|
||||
public String getAttribution() {
|
||||
return mTileDataSource.getAttribution();
|
||||
}
|
||||
|
||||
public BoundingBox getBounds() {
|
||||
return mTileDataSource.getBounds();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ITileDataSource getDataSource() {
|
||||
return mTileDataSource;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return mTileDataSource.getDescription();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the image format (jpg, png)
|
||||
*/
|
||||
public String getFormat() {
|
||||
return mTileDataSource.getFormat();
|
||||
}
|
||||
|
||||
public int getMaxZoom() {
|
||||
return mTileDataSource.getMaxZoom();
|
||||
}
|
||||
|
||||
public int getMinZoom() {
|
||||
return mTileDataSource.getMinZoom();
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return mTileDataSource.getName();
|
||||
}
|
||||
|
||||
public String getVersion() {
|
||||
return mTileDataSource.getVersion();
|
||||
}
|
||||
|
||||
@Override
|
||||
public OpenResult open() {
|
||||
return OpenResult.SUCCESS;
|
||||
super(new MBTilesBitmapTileDataSource(path, alpha, transparentColor));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,154 @@
|
||||
/*
|
||||
* Copyright 2019 Andrea Antonello
|
||||
* Copyright 2019 devemux86
|
||||
* Copyright 2019 Kostas Tzounopoulos
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify it under the
|
||||
* terms of the GNU Lesser General Public License as published by the Free Software
|
||||
* Foundation, either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||
* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License along with
|
||||
* this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package org.oscim.android.tiling.source.mbtiles;
|
||||
|
||||
import android.database.Cursor;
|
||||
import android.database.sqlite.SQLiteDatabase;
|
||||
import android.text.TextUtils;
|
||||
import org.oscim.core.BoundingBox;
|
||||
import org.oscim.core.MapPosition;
|
||||
import org.oscim.map.Viewport;
|
||||
import org.oscim.tiling.ITileDataSource;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* A tile data source for MBTiles databases.
|
||||
*/
|
||||
public abstract class MBTilesTileDataSource implements ITileDataSource {
|
||||
|
||||
private static final String SELECT_METADATA = "SELECT name, value FROM metadata";
|
||||
protected static final String SELECT_TILES_FORMAT =
|
||||
"SELECT zoom_level, tile_column, tile_row, tile_data " +
|
||||
"FROM tiles " +
|
||||
"WHERE %s " +
|
||||
"ORDER BY zoom_level DESC " +
|
||||
"LIMIT 1";
|
||||
static final String WHERE_FORMAT = "zoom_level=? AND tile_column=? AND tile_row=?";
|
||||
|
||||
protected final SQLiteDatabase mDatabase;
|
||||
private Map<String, String> mMetadata;
|
||||
|
||||
public MBTilesTileDataSource(String path) {
|
||||
mDatabase = SQLiteDatabase.openDatabase(path, null, SQLiteDatabase.OPEN_READONLY);
|
||||
}
|
||||
|
||||
protected void assertDatabaseFormat() {
|
||||
String format = getFormat();
|
||||
|
||||
if (format == null)
|
||||
throw new RuntimeException("'metadata.format' field was not found. Is this an MBTiles database?");
|
||||
|
||||
List<String> supportedFormats = getSupportedFormats();
|
||||
if (!supportedFormats.contains(format))
|
||||
throw new MBTilesUnsupportedException(String.format("Unsupported MBTiles 'metadata.format: %s'. Supported format(s) are: %s", format, TextUtils.join(", ", supportedFormats)));
|
||||
}
|
||||
|
||||
public String getAttribution() {
|
||||
return getMetadata().get("attribution");
|
||||
}
|
||||
|
||||
public BoundingBox getBounds() {
|
||||
String bounds = getMetadata().get("bounds");
|
||||
if (bounds == null)
|
||||
return null;
|
||||
String[] split = bounds.split(",");
|
||||
double w = Double.parseDouble(split[0]);
|
||||
double s = Double.parseDouble(split[1]);
|
||||
double e = Double.parseDouble(split[2]);
|
||||
double n = Double.parseDouble(split[3]);
|
||||
return new BoundingBox(s, w, n, e);
|
||||
}
|
||||
|
||||
public MapPosition getCenter() {
|
||||
String center = getMetadata().get("center");
|
||||
if (center == null)
|
||||
return null;
|
||||
String[] split = center.split(",");
|
||||
double latitude = Double.parseDouble(split[1]);
|
||||
double longitude = Double.parseDouble(split[0]);
|
||||
int zoomLevel = Integer.parseInt(split[2]);
|
||||
return new MapPosition(latitude, longitude, 1 << zoomLevel);
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return getMetadata().get("description");
|
||||
}
|
||||
|
||||
public String getFormat() {
|
||||
return getMetadata().get("format");
|
||||
}
|
||||
|
||||
public String getId() {
|
||||
return getMetadata().get("id");
|
||||
}
|
||||
|
||||
public String getJson() {
|
||||
return getMetadata().get("json");
|
||||
}
|
||||
|
||||
public int getMaxZoom() {
|
||||
String maxZoom = getMetadata().get("maxzoom");
|
||||
return maxZoom != null ? Integer.parseInt(maxZoom) : Viewport.MAX_ZOOM_LEVEL;
|
||||
}
|
||||
|
||||
private Map<String, String> getMetadata() {
|
||||
if (mMetadata == null) {
|
||||
mMetadata = new HashMap<>();
|
||||
Cursor cursor = null;
|
||||
try {
|
||||
cursor = mDatabase.rawQuery(SELECT_METADATA, null);
|
||||
while (cursor.moveToNext()) {
|
||||
String key = cursor.getString(0);
|
||||
String value = cursor.getString(1);
|
||||
mMetadata.put(key, value);
|
||||
}
|
||||
} finally {
|
||||
if (cursor != null)
|
||||
cursor.close();
|
||||
}
|
||||
}
|
||||
return mMetadata;
|
||||
}
|
||||
|
||||
public int getMinZoom() {
|
||||
String minZoom = getMetadata().get("minzoom");
|
||||
return minZoom != null ? Integer.parseInt(minZoom) : Viewport.MIN_ZOOM_LEVEL;
|
||||
}
|
||||
|
||||
public Long getMTime() {
|
||||
String mTime = getMetadata().get("mtime");
|
||||
return mTime != null ? Long.parseLong(mTime) : null;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return getMetadata().get("name");
|
||||
}
|
||||
|
||||
public Integer getPixelScale() {
|
||||
String pixelScale = getMetadata().get("pixel_scale");
|
||||
return pixelScale != null ? Integer.parseInt(pixelScale) : null;
|
||||
}
|
||||
|
||||
abstract public List<String> getSupportedFormats();
|
||||
|
||||
public String getVersion() {
|
||||
return getMetadata().get("version");
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
/*
|
||||
* Copyright 2017 Longri
|
||||
* Copyright 2017-2018 devemux86
|
||||
* Copyright 2019 Andrea Antonello
|
||||
* Copyright 2019 devemux86
|
||||
* Copyright 2019 Kostas Tzounopoulos
|
||||
*
|
||||
* 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
|
||||
@@ -13,25 +14,33 @@
|
||||
* You should have received a copy of the GNU Lesser General Public License along with
|
||||
* this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package org.oscim.android.test;
|
||||
package org.oscim.android.tiling.source.mbtiles;
|
||||
|
||||
import android.os.Bundle;
|
||||
import org.oscim.tiling.TileSource;
|
||||
|
||||
import org.oscim.utils.Parameters;
|
||||
/**
|
||||
* A tile source for MBTiles databases.
|
||||
*/
|
||||
public abstract class MBTilesTileSource extends TileSource {
|
||||
|
||||
public class AtlasThemeActivity extends SimpleMapActivity {
|
||||
private final MBTilesTileDataSource mTileDataSource;
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
Parameters.TEXTURE_ATLAS = true;
|
||||
|
||||
super.onCreate(savedInstanceState);
|
||||
public MBTilesTileSource(MBTilesTileDataSource tileDataSource) {
|
||||
mTileDataSource = tileDataSource;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
super.onDestroy();
|
||||
public void close() {
|
||||
getDataSource().dispose();
|
||||
}
|
||||
|
||||
Parameters.TEXTURE_ATLAS = false;
|
||||
@Override
|
||||
public MBTilesTileDataSource getDataSource() {
|
||||
return mTileDataSource;
|
||||
}
|
||||
|
||||
@Override
|
||||
public OpenResult open() {
|
||||
return OpenResult.SUCCESS;
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2016-2017 devemux86
|
||||
* Copyright 2019 Kostas Tzounopoulos
|
||||
*
|
||||
* 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
|
||||
@@ -12,17 +12,10 @@
|
||||
* 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;
|
||||
package org.oscim.android.tiling.source.mbtiles;
|
||||
|
||||
import org.oscim.gdx.GdxMapApp;
|
||||
import org.oscim.utils.Parameters;
|
||||
|
||||
public class MapEventLayer2Test extends MarkerLayerTest {
|
||||
|
||||
public static void main(String[] args) {
|
||||
Parameters.MAP_EVENT_LAYER2 = true;
|
||||
|
||||
GdxMapApp.init();
|
||||
GdxMapApp.run(new MapEventLayer2Test());
|
||||
public class MBTilesUnsupportedException extends RuntimeException {
|
||||
public MBTilesUnsupportedException(String message) {
|
||||
super(message);
|
||||
}
|
||||
}
|
||||
@@ -9,7 +9,6 @@
|
||||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
|
||||
<uses-permission android:name="android.permission.INTERNET" />
|
||||
<uses-permission android:name="android.permission.VIBRATE" />
|
||||
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
|
||||
|
||||
<application
|
||||
android:name=".App"
|
||||
|
||||
@@ -18,8 +18,8 @@ android {
|
||||
}
|
||||
|
||||
defaultConfig {
|
||||
versionCode versionCode()
|
||||
versionName versionName()
|
||||
versionCode project.versionCode()
|
||||
versionName project.versionName()
|
||||
minSdkVersion androidMinSdk()
|
||||
targetSdkVersion androidTargetSdk()
|
||||
}
|
||||
|
||||
@@ -19,9 +19,7 @@ package org.oscim.app;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.SharedPreferences;
|
||||
import android.os.Environment;
|
||||
import android.preference.PreferenceManager;
|
||||
|
||||
import org.oscim.android.cache.TileCache;
|
||||
import org.oscim.layers.GenericLayer;
|
||||
import org.oscim.layers.Layer;
|
||||
@@ -67,7 +65,7 @@ public class MapLayers {
|
||||
@Override
|
||||
TileSource init() {
|
||||
return new MapFileTileSource().setOption("file",
|
||||
new File(Environment.getExternalStorageDirectory(), "berlin.map").getAbsolutePath());
|
||||
new File("/sdcard/berlin.map").getAbsolutePath());
|
||||
}
|
||||
}, new Config("MAPNIK_VECTOR") {
|
||||
@Override
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* Copyright 2010, 2011, 2012 mapsforge.org
|
||||
* Copyright 2012 Hannes Janetzek
|
||||
* Copyright 2016-2017 devemux86
|
||||
* Copyright 2016-2019 devemux86
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify it under the
|
||||
* terms of the GNU Lesser General Public License as published by the Free Software
|
||||
@@ -15,11 +15,13 @@
|
||||
*/
|
||||
package org.oscim.app;
|
||||
|
||||
import android.Manifest;
|
||||
import android.app.AlertDialog;
|
||||
import android.app.Dialog;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.net.Uri;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
@@ -73,6 +75,11 @@ public class TileMap extends MapActivity implements MapEventsReceiver {
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
||||
if (checkSelfPermission(Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED)
|
||||
requestPermissions(new String[]{Manifest.permission.ACCESS_FINE_LOCATION}, 0);
|
||||
}
|
||||
|
||||
setContentView(R.layout.activity_tilemap);
|
||||
App.view = (MapView) findViewById(R.id.mapView);
|
||||
registerMapView(App.view);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Copyright 2010, 2011, 2012 mapsforge.org
|
||||
* Copyright 2016 devemux86
|
||||
* Copyright 2016-2019 devemux86
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify it under the
|
||||
* terms of the GNU Lesser General Public License as published by the Free Software
|
||||
@@ -24,11 +24,9 @@ import android.content.SharedPreferences;
|
||||
import android.content.SharedPreferences.Editor;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.os.Environment;
|
||||
import android.view.View;
|
||||
import android.widget.AdapterView;
|
||||
import android.widget.GridView;
|
||||
|
||||
import org.oscim.app.R;
|
||||
import org.oscim.app.filefilter.ValidFileFilter;
|
||||
|
||||
@@ -62,7 +60,6 @@ public class FilePicker extends Activity implements AdapterView.OnItemClickListe
|
||||
public static final String SELECTED_FILE = "selectedFile";
|
||||
|
||||
private static final String CURRENT_DIRECTORY = "currentDirectory";
|
||||
private static final String DEFAULT_DIRECTORY = Environment.getExternalStorageDirectory().getAbsolutePath();
|
||||
private static final int DIALOG_FILE_INVALID = 0;
|
||||
// private static final int DIALOG_FILE_SELECT = 1;
|
||||
private static Comparator<File> fileComparator = getDefaultFileComparator();
|
||||
@@ -125,6 +122,7 @@ public class FilePicker extends Activity implements AdapterView.OnItemClickListe
|
||||
}
|
||||
|
||||
private File currentDirectory;
|
||||
private String defaultDirectory;
|
||||
private FilePickerIconAdapter filePickerIconAdapter;
|
||||
private File[] files;
|
||||
private File[] filesWithParentFolder;
|
||||
@@ -166,7 +164,7 @@ public class FilePicker extends Activity implements AdapterView.OnItemClickListe
|
||||
}
|
||||
|
||||
// if a parent directory exists, add it at the first position
|
||||
if (this.currentDirectory.getParentFile() != null) {
|
||||
if (this.currentDirectory.getParentFile() != null && this.currentDirectory.getParentFile().canRead()) {
|
||||
this.filesWithParentFolder = new File[this.files.length + 1];
|
||||
this.filesWithParentFolder[0] = this.currentDirectory.getParentFile();
|
||||
System.arraycopy(this.files, 0, this.filesWithParentFolder, 1,
|
||||
@@ -184,6 +182,7 @@ public class FilePicker extends Activity implements AdapterView.OnItemClickListe
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_file_picker);
|
||||
|
||||
defaultDirectory = getExternalFilesDir(null) != null ? getExternalFilesDir(null).getAbsolutePath() : "/sdcard/";
|
||||
this.filePickerIconAdapter = new FilePickerIconAdapter(this);
|
||||
GridView gridView = (GridView) findViewById(R.id.filePickerView);
|
||||
gridView.setOnItemClickListener(this);
|
||||
@@ -254,10 +253,9 @@ public class FilePicker extends Activity implements AdapterView.OnItemClickListe
|
||||
// restore the current directory
|
||||
SharedPreferences preferences = getSharedPreferences(PREFERENCES_FILE,
|
||||
MODE_PRIVATE);
|
||||
this.currentDirectory = new File(preferences.getString(CURRENT_DIRECTORY,
|
||||
DEFAULT_DIRECTORY));
|
||||
this.currentDirectory = new File(preferences.getString(CURRENT_DIRECTORY, defaultDirectory));
|
||||
if (!this.currentDirectory.exists() || !this.currentDirectory.canRead()) {
|
||||
this.currentDirectory = new File(DEFAULT_DIRECTORY);
|
||||
this.currentDirectory = new File(defaultDirectory);
|
||||
}
|
||||
browseToCurrentDirectory();
|
||||
}
|
||||
|
||||
19
vtm-desktop-lwjgl/build.gradle
Normal file
19
vtm-desktop-lwjgl/build.gradle
Normal file
@@ -0,0 +1,19 @@
|
||||
apply plugin: 'java-library'
|
||||
apply plugin: 'maven'
|
||||
|
||||
dependencies {
|
||||
api project(':vtm-desktop')
|
||||
api "com.badlogicgames.gdx:gdx-backend-lwjgl:$gdxVersion"
|
||||
}
|
||||
|
||||
sourceSets {
|
||||
main {
|
||||
java.srcDirs = ['src']
|
||||
}
|
||||
}
|
||||
|
||||
if (project.hasProperty("SONATYPE_USERNAME")) {
|
||||
afterEvaluate {
|
||||
project.apply from: "${rootProject.projectDir}/deploy.gradle"
|
||||
}
|
||||
}
|
||||
@@ -23,7 +23,6 @@ import com.badlogic.gdx.backends.lwjgl.LwjglApplication;
|
||||
import com.badlogic.gdx.backends.lwjgl.LwjglApplicationConfiguration;
|
||||
import com.badlogic.gdx.graphics.glutils.GLVersion;
|
||||
import com.badlogic.gdx.utils.SharedLibraryLoader;
|
||||
|
||||
import org.oscim.awt.AwtGraphics;
|
||||
import org.oscim.backend.DateTime;
|
||||
import org.oscim.backend.DateTimeAdapter;
|
||||
@@ -66,7 +65,7 @@ public class GdxMapApp extends GdxMap {
|
||||
protected static LwjglApplicationConfiguration getConfig(String title) {
|
||||
LwjglApplicationConfiguration.disableAudio = true;
|
||||
LwjglApplicationConfiguration cfg = new LwjglApplicationConfiguration();
|
||||
cfg.title = title != null ? title : "vtm-gdx";
|
||||
cfg.title = title != null ? title : "vtm-gdx-lwjgl";
|
||||
|
||||
int[] sizes = new int[]{128, 64, 32, 16};
|
||||
for (int size : sizes) {
|
||||
@@ -33,23 +33,11 @@
|
||||
package org.oscim.gdx;
|
||||
|
||||
import com.badlogic.gdx.utils.GdxRuntimeException;
|
||||
|
||||
import org.lwjgl.BufferUtils;
|
||||
import org.lwjgl.opengl.EXTFramebufferObject;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import org.lwjgl.opengl.GL13;
|
||||
import org.lwjgl.opengl.GL14;
|
||||
import org.lwjgl.opengl.GL15;
|
||||
import org.lwjgl.opengl.GL20;
|
||||
import org.lwjgl.opengl.*;
|
||||
import org.oscim.backend.GL;
|
||||
|
||||
import java.nio.Buffer;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.ByteOrder;
|
||||
import java.nio.DoubleBuffer;
|
||||
import java.nio.FloatBuffer;
|
||||
import java.nio.IntBuffer;
|
||||
import java.nio.ShortBuffer;
|
||||
import java.nio.*;
|
||||
|
||||
/**
|
||||
* An implementation of the {@link GL20} interface based on LWJGL. Note that LWJGL shaders and OpenGL ES shaders will not be 100%
|
||||
@@ -17,32 +17,14 @@
|
||||
package org.oscim.gdx;
|
||||
|
||||
import com.badlogic.gdx.utils.GdxRuntimeException;
|
||||
import org.lwjgl.opengl.*;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import org.lwjgl.opengl.GL12;
|
||||
import org.lwjgl.opengl.GL15;
|
||||
import org.lwjgl.opengl.GL20;
|
||||
import org.lwjgl.opengl.GL21;
|
||||
import org.lwjgl.opengl.GL31;
|
||||
import org.lwjgl.opengl.GL32;
|
||||
import org.lwjgl.opengl.GL33;
|
||||
import org.lwjgl.opengl.GL40;
|
||||
import org.lwjgl.opengl.GL41;
|
||||
import org.lwjgl.opengl.GL43;
|
||||
import org.oscim.backend.GL30;
|
||||
|
||||
import java.nio.Buffer;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.DoubleBuffer;
|
||||
import java.nio.FloatBuffer;
|
||||
import java.nio.IntBuffer;
|
||||
import java.nio.LongBuffer;
|
||||
import java.nio.ShortBuffer;
|
||||
import java.nio.*;
|
||||
|
||||
/**
|
||||
* See https://github.com/libgdx/libgdx/blob/master/backends/gdx-backend-lwjgl3/src/com/badlogic/gdx/backends/lwjgl3/Lwjgl3GL30.java
|
||||
* See https://github.com/libgdx/libgdx/blob/master/backends/gdx-backend-lwjgl/src/com/badlogic/gdx/backends/lwjgl/LwjglGL30.java
|
||||
*/
|
||||
public class LwjglGL30 extends LwjglGL20 implements GL30 {
|
||||
public class LwjglGL30 extends LwjglGL20 implements org.oscim.backend.GL30 {
|
||||
@Override
|
||||
public void readBuffer(int mode) {
|
||||
GL11.glReadBuffer(mode);
|
||||
@@ -222,246 +204,246 @@ public class LwjglGL30 extends LwjglGL20 implements GL30 {
|
||||
@Override
|
||||
public void blitFramebuffer(int srcX0, int srcY0, int srcX1, int srcY1, int dstX0, int dstY0, int dstX1, int dstY1,
|
||||
int mask, int filter) {
|
||||
org.lwjgl.opengl.GL30.glBlitFramebuffer(srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, mask, filter);
|
||||
GL30.glBlitFramebuffer(srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, mask, filter);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void bindFramebuffer(int target, int framebuffer) {
|
||||
org.lwjgl.opengl.GL30.glBindFramebuffer(target, framebuffer);
|
||||
GL30.glBindFramebuffer(target, framebuffer);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void bindRenderbuffer(int target, int renderbuffer) {
|
||||
org.lwjgl.opengl.GL30.glBindRenderbuffer(target, renderbuffer);
|
||||
GL30.glBindRenderbuffer(target, renderbuffer);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int checkFramebufferStatus(int target) {
|
||||
return org.lwjgl.opengl.GL30.glCheckFramebufferStatus(target);
|
||||
return GL30.glCheckFramebufferStatus(target);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteFramebuffers(int n, IntBuffer framebuffers) {
|
||||
org.lwjgl.opengl.GL30.glDeleteFramebuffers(framebuffers);
|
||||
GL30.glDeleteFramebuffers(framebuffers);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteFramebuffer(int framebuffer) {
|
||||
org.lwjgl.opengl.GL30.glDeleteFramebuffers(framebuffer);
|
||||
GL30.glDeleteFramebuffers(framebuffer);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteRenderbuffers(int n, IntBuffer renderbuffers) {
|
||||
org.lwjgl.opengl.GL30.glDeleteRenderbuffers(renderbuffers);
|
||||
GL30.glDeleteRenderbuffers(renderbuffers);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteRenderbuffer(int renderbuffer) {
|
||||
org.lwjgl.opengl.GL30.glDeleteRenderbuffers(renderbuffer);
|
||||
GL30.glDeleteRenderbuffers(renderbuffer);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void generateMipmap(int target) {
|
||||
org.lwjgl.opengl.GL30.glGenerateMipmap(target);
|
||||
GL30.glGenerateMipmap(target);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void genFramebuffers(int n, IntBuffer framebuffers) {
|
||||
org.lwjgl.opengl.GL30.glGenFramebuffers(framebuffers);
|
||||
GL30.glGenFramebuffers(framebuffers);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int genFramebuffer() {
|
||||
return org.lwjgl.opengl.GL30.glGenFramebuffers();
|
||||
return GL30.glGenFramebuffers();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void genRenderbuffers(int n, IntBuffer renderbuffers) {
|
||||
org.lwjgl.opengl.GL30.glGenRenderbuffers(renderbuffers);
|
||||
GL30.glGenRenderbuffers(renderbuffers);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int genRenderbuffer() {
|
||||
return org.lwjgl.opengl.GL30.glGenRenderbuffers();
|
||||
return GL30.glGenRenderbuffers();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getRenderbufferParameteriv(int target, int pname, IntBuffer params) {
|
||||
org.lwjgl.opengl.GL30.glGetRenderbufferParameter(target, pname, params);
|
||||
GL30.glGetRenderbufferParameter(target, pname, params);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isFramebuffer(int framebuffer) {
|
||||
return org.lwjgl.opengl.GL30.glIsFramebuffer(framebuffer);
|
||||
return GL30.glIsFramebuffer(framebuffer);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isRenderbuffer(int renderbuffer) {
|
||||
return org.lwjgl.opengl.GL30.glIsRenderbuffer(renderbuffer);
|
||||
return GL30.glIsRenderbuffer(renderbuffer);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderbufferStorage(int target, int internalformat, int width, int height) {
|
||||
org.lwjgl.opengl.GL30.glRenderbufferStorage(target, internalformat, width, height);
|
||||
GL30.glRenderbufferStorage(target, internalformat, width, height);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderbufferStorageMultisample(int target, int samples, int internalformat, int width, int height) {
|
||||
org.lwjgl.opengl.GL30.glRenderbufferStorageMultisample(target, samples, internalformat, width, height);
|
||||
GL30.glRenderbufferStorageMultisample(target, samples, internalformat, width, height);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void framebufferTexture2D(int target, int attachment, int textarget, int texture, int level) {
|
||||
org.lwjgl.opengl.GL30.glFramebufferTexture2D(target, attachment, textarget, texture, level);
|
||||
GL30.glFramebufferTexture2D(target, attachment, textarget, texture, level);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void framebufferRenderbuffer(int target, int attachment, int renderbuffertarget, int renderbuffer) {
|
||||
org.lwjgl.opengl.GL30.glFramebufferRenderbuffer(target, attachment, renderbuffertarget, renderbuffer);
|
||||
GL30.glFramebufferRenderbuffer(target, attachment, renderbuffertarget, renderbuffer);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void framebufferTextureLayer(int target, int attachment, int texture, int level, int layer) {
|
||||
org.lwjgl.opengl.GL30.glFramebufferTextureLayer(target, attachment, texture, level, layer);
|
||||
GL30.glFramebufferTextureLayer(target, attachment, texture, level, layer);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void flushMappedBufferRange(int target, int offset, int length) {
|
||||
org.lwjgl.opengl.GL30.glFlushMappedBufferRange(target, offset, length);
|
||||
GL30.glFlushMappedBufferRange(target, offset, length);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void bindVertexArray(int array) {
|
||||
org.lwjgl.opengl.GL30.glBindVertexArray(array);
|
||||
GL30.glBindVertexArray(array);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteVertexArrays(int n, int[] arrays, int offset) {
|
||||
for (int i = offset; i < offset + n; i++) {
|
||||
org.lwjgl.opengl.GL30.glDeleteVertexArrays(arrays[i]);
|
||||
GL30.glDeleteVertexArrays(arrays[i]);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteVertexArrays(int n, IntBuffer arrays) {
|
||||
org.lwjgl.opengl.GL30.glDeleteVertexArrays(arrays);
|
||||
GL30.glDeleteVertexArrays(arrays);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void genVertexArrays(int n, int[] arrays, int offset) {
|
||||
for (int i = offset; i < offset + n; i++) {
|
||||
arrays[i] = org.lwjgl.opengl.GL30.glGenVertexArrays();
|
||||
arrays[i] = GL30.glGenVertexArrays();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void genVertexArrays(int n, IntBuffer arrays) {
|
||||
org.lwjgl.opengl.GL30.glGenVertexArrays(arrays);
|
||||
GL30.glGenVertexArrays(arrays);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isVertexArray(int array) {
|
||||
return org.lwjgl.opengl.GL30.glIsVertexArray(array);
|
||||
return GL30.glIsVertexArray(array);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void beginTransformFeedback(int primitiveMode) {
|
||||
org.lwjgl.opengl.GL30.glBeginTransformFeedback(primitiveMode);
|
||||
GL30.glBeginTransformFeedback(primitiveMode);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void endTransformFeedback() {
|
||||
org.lwjgl.opengl.GL30.glEndTransformFeedback();
|
||||
GL30.glEndTransformFeedback();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void bindBufferRange(int target, int index, int buffer, int offset, int size) {
|
||||
org.lwjgl.opengl.GL30.glBindBufferRange(target, index, buffer, offset, size);
|
||||
GL30.glBindBufferRange(target, index, buffer, offset, size);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void bindBufferBase(int target, int index, int buffer) {
|
||||
org.lwjgl.opengl.GL30.glBindBufferBase(target, index, buffer);
|
||||
GL30.glBindBufferBase(target, index, buffer);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void transformFeedbackVaryings(int program, String[] varyings, int bufferMode) {
|
||||
org.lwjgl.opengl.GL30.glTransformFeedbackVaryings(program, varyings, bufferMode);
|
||||
GL30.glTransformFeedbackVaryings(program, varyings, bufferMode);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void vertexAttribIPointer(int index, int size, int type, int stride, int offset) {
|
||||
org.lwjgl.opengl.GL30.glVertexAttribIPointer(index, size, type, stride, offset);
|
||||
GL30.glVertexAttribIPointer(index, size, type, stride, offset);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getVertexAttribIiv(int index, int pname, IntBuffer params) {
|
||||
org.lwjgl.opengl.GL30.glGetVertexAttribI(index, pname, params);
|
||||
GL30.glGetVertexAttribI(index, pname, params);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getVertexAttribIuiv(int index, int pname, IntBuffer params) {
|
||||
org.lwjgl.opengl.GL30.glGetVertexAttribIu(index, pname, params);
|
||||
GL30.glGetVertexAttribIu(index, pname, params);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void vertexAttribI4i(int index, int x, int y, int z, int w) {
|
||||
org.lwjgl.opengl.GL30.glVertexAttribI4i(index, x, y, z, w);
|
||||
GL30.glVertexAttribI4i(index, x, y, z, w);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void vertexAttribI4ui(int index, int x, int y, int z, int w) {
|
||||
org.lwjgl.opengl.GL30.glVertexAttribI4ui(index, x, y, z, w);
|
||||
GL30.glVertexAttribI4ui(index, x, y, z, w);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getUniformuiv(int program, int location, IntBuffer params) {
|
||||
org.lwjgl.opengl.GL30.glGetUniformu(program, location, params);
|
||||
GL30.glGetUniformu(program, location, params);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getFragDataLocation(int program, String name) {
|
||||
return org.lwjgl.opengl.GL30.glGetFragDataLocation(program, name);
|
||||
return GL30.glGetFragDataLocation(program, name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void uniform1uiv(int location, int count, IntBuffer value) {
|
||||
org.lwjgl.opengl.GL30.glUniform1u(location, value);
|
||||
GL30.glUniform1u(location, value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void uniform3uiv(int location, int count, IntBuffer value) {
|
||||
org.lwjgl.opengl.GL30.glUniform3u(location, value);
|
||||
GL30.glUniform3u(location, value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void uniform4uiv(int location, int count, IntBuffer value) {
|
||||
org.lwjgl.opengl.GL30.glUniform4u(location, value);
|
||||
GL30.glUniform4u(location, value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clearBufferiv(int buffer, int drawbuffer, IntBuffer value) {
|
||||
org.lwjgl.opengl.GL30.glClearBuffer(buffer, drawbuffer, value);
|
||||
GL30.glClearBuffer(buffer, drawbuffer, value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clearBufferuiv(int buffer, int drawbuffer, IntBuffer value) {
|
||||
org.lwjgl.opengl.GL30.glClearBufferu(buffer, drawbuffer, value);
|
||||
GL30.glClearBufferu(buffer, drawbuffer, value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clearBufferfv(int buffer, int drawbuffer, FloatBuffer value) {
|
||||
org.lwjgl.opengl.GL30.glClearBuffer(buffer, drawbuffer, value);
|
||||
GL30.glClearBuffer(buffer, drawbuffer, value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clearBufferfi(int buffer, int drawbuffer, float depth, int stencil) {
|
||||
org.lwjgl.opengl.GL30.glClearBufferfi(buffer, drawbuffer, depth, stencil);
|
||||
GL30.glClearBufferfi(buffer, drawbuffer, depth, stencil);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getStringi(int name, int index) {
|
||||
return org.lwjgl.opengl.GL30.glGetStringi(name, index);
|
||||
return GL30.glGetStringi(name, index);
|
||||
}
|
||||
|
||||
@Override
|
||||
19
vtm-desktop-lwjgl3/build.gradle
Normal file
19
vtm-desktop-lwjgl3/build.gradle
Normal file
@@ -0,0 +1,19 @@
|
||||
apply plugin: 'java-library'
|
||||
apply plugin: 'maven'
|
||||
|
||||
dependencies {
|
||||
api project(':vtm-desktop')
|
||||
api "com.badlogicgames.gdx:gdx-backend-lwjgl3:$gdxVersion"
|
||||
}
|
||||
|
||||
sourceSets {
|
||||
main {
|
||||
java.srcDirs = ['src']
|
||||
}
|
||||
}
|
||||
|
||||
if (project.hasProperty("SONATYPE_USERNAME")) {
|
||||
afterEvaluate {
|
||||
project.apply from: "${rootProject.projectDir}/deploy.gradle"
|
||||
}
|
||||
}
|
||||
105
vtm-desktop-lwjgl3/src/org/oscim/gdx/GdxMapApp.java
Normal file
105
vtm-desktop-lwjgl3/src/org/oscim/gdx/GdxMapApp.java
Normal file
@@ -0,0 +1,105 @@
|
||||
/*
|
||||
* Copyright 2013 Hannes Janetzek
|
||||
* Copyright 2016-2018 devemux86
|
||||
* Copyright 2018-2019 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.gdx;
|
||||
|
||||
import com.badlogic.gdx.Files;
|
||||
import com.badlogic.gdx.backends.lwjgl3.Lwjgl3Application;
|
||||
import com.badlogic.gdx.backends.lwjgl3.Lwjgl3ApplicationConfiguration;
|
||||
import com.badlogic.gdx.graphics.glutils.GLVersion;
|
||||
import com.badlogic.gdx.utils.SharedLibraryLoader;
|
||||
import org.oscim.awt.AwtGraphics;
|
||||
import org.oscim.backend.DateTime;
|
||||
import org.oscim.backend.DateTimeAdapter;
|
||||
import org.oscim.backend.GLAdapter;
|
||||
import org.oscim.core.Tile;
|
||||
import org.oscim.tiling.TileSource;
|
||||
import org.oscim.tiling.source.oscimap4.OSciMap4TileSource;
|
||||
import org.oscim.utils.FastMath;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
public class GdxMapApp extends GdxMap {
|
||||
|
||||
public static final Logger log = LoggerFactory.getLogger(GdxMapApp.class);
|
||||
|
||||
public static void init() {
|
||||
// load native library
|
||||
new SharedLibraryLoader().load("vtm-jni");
|
||||
// init globals
|
||||
AwtGraphics.init();
|
||||
GdxAssets.init("assets/");
|
||||
DateTimeAdapter.init(new DateTime());
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
init();
|
||||
new Lwjgl3Application(new GdxMapApp(), getConfig(null));
|
||||
}
|
||||
|
||||
public static void run(GdxMap map) {
|
||||
run(map, null, Tile.SIZE);
|
||||
}
|
||||
|
||||
public static void run(GdxMap map, Lwjgl3ApplicationConfiguration config, int tileSize) {
|
||||
Tile.SIZE = FastMath.clamp(tileSize, 128, 512);
|
||||
|
||||
new Lwjgl3Application(map, (config == null ? getConfig(map.getClass().getSimpleName()) : config));
|
||||
}
|
||||
|
||||
protected static Lwjgl3ApplicationConfiguration getConfig(String title) {
|
||||
Lwjgl3ApplicationConfiguration cfg = new Lwjgl3ApplicationConfiguration();
|
||||
cfg.disableAudio(true);
|
||||
cfg.setTitle(title != null ? title : "vtm-gdx-lwjgl3");
|
||||
|
||||
int[] sizes = new int[]{128, 64, 32, 16};
|
||||
String[] paths = new String[sizes.length];
|
||||
for (int i = 0; i < paths.length; i++)
|
||||
paths[i] = "res/ic_vtm_" + sizes[i] + ".png";
|
||||
cfg.setWindowIcon(Files.FileType.Internal, paths);
|
||||
|
||||
cfg.setWindowedMode(1024, 768);
|
||||
cfg.setBackBufferConfig(8, 8, 8, 8, 16, 8, /*2*/0);
|
||||
//cfg.useOpenGL3(true, 3, 2);
|
||||
cfg.setIdleFPS(10);
|
||||
//cfg.forceExit = false;
|
||||
return cfg;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initGLAdapter(GLVersion version) {
|
||||
if (version.getMajorVersion() >= 3)
|
||||
GLAdapter.init(new Lwjgl3GL30());
|
||||
else
|
||||
GLAdapter.init(new Lwjgl3GL20());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void createLayers() {
|
||||
TileSource tileSource = new OSciMap4TileSource();
|
||||
|
||||
initDefaultLayers(tileSource, false, true, true);
|
||||
|
||||
mMap.setMapPosition(0, 0, 1 << 2);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dispose() {
|
||||
System.exit(0);
|
||||
}
|
||||
}
|
||||
997
vtm-desktop-lwjgl3/src/org/oscim/gdx/Lwjgl3GL20.java
Normal file
997
vtm-desktop-lwjgl3/src/org/oscim/gdx/Lwjgl3GL20.java
Normal file
@@ -0,0 +1,997 @@
|
||||
/*******************************************************************************
|
||||
* Copyright 2011 See AUTHORS file.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
******************************************************************************/
|
||||
|
||||
package org.oscim.gdx;
|
||||
|
||||
import com.badlogic.gdx.utils.GdxRuntimeException;
|
||||
import org.lwjgl.BufferUtils;
|
||||
import org.lwjgl.opengl.*;
|
||||
import org.oscim.backend.GL;
|
||||
|
||||
import java.nio.*;
|
||||
|
||||
/**
|
||||
* See https://github.com/libgdx/libgdx/blob/master/backends/gdx-backend-lwjgl3/src/com/badlogic/gdx/backends/lwjgl3/Lwjgl3GL20.java
|
||||
*/
|
||||
public class Lwjgl3GL20 implements GL {
|
||||
private ByteBuffer buffer = null;
|
||||
private FloatBuffer floatBuffer = null;
|
||||
private IntBuffer intBuffer = null;
|
||||
|
||||
private void ensureBufferCapacity(int numBytes) {
|
||||
if (buffer == null || buffer.capacity() < numBytes) {
|
||||
buffer = com.badlogic.gdx.utils.BufferUtils.newByteBuffer(numBytes);
|
||||
floatBuffer = buffer.asFloatBuffer();
|
||||
intBuffer = buffer.asIntBuffer();
|
||||
}
|
||||
}
|
||||
|
||||
private FloatBuffer toFloatBuffer(float v[], int offset, int count) {
|
||||
ensureBufferCapacity(count << 2);
|
||||
floatBuffer.clear();
|
||||
floatBuffer.limit(count);
|
||||
floatBuffer.put(v, offset, count);
|
||||
floatBuffer.position(0);
|
||||
return floatBuffer;
|
||||
}
|
||||
|
||||
private IntBuffer toIntBuffer(int v[], int offset, int count) {
|
||||
ensureBufferCapacity(count << 2);
|
||||
intBuffer.clear();
|
||||
intBuffer.limit(count);
|
||||
intBuffer.put(v, offset, count);
|
||||
intBuffer.position(0);
|
||||
return intBuffer;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void activeTexture(int texture) {
|
||||
GL13.glActiveTexture(texture);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void attachShader(int program, int shader) {
|
||||
GL20.glAttachShader(program, shader);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void bindAttribLocation(int program, int index, String name) {
|
||||
GL20.glBindAttribLocation(program, index, name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void bindBuffer(int target, int buffer) {
|
||||
GL15.glBindBuffer(target, buffer);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void bindFramebuffer(int target, int framebuffer) {
|
||||
EXTFramebufferObject.glBindFramebufferEXT(target, framebuffer);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void bindRenderbuffer(int target, int renderbuffer) {
|
||||
EXTFramebufferObject.glBindRenderbufferEXT(target, renderbuffer);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void bindTexture(int target, int texture) {
|
||||
GL11.glBindTexture(target, texture);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void blendColor(float red, float green, float blue, float alpha) {
|
||||
GL14.glBlendColor(red, green, blue, alpha);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void blendEquation(int mode) {
|
||||
GL14.glBlendEquation(mode);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void blendEquationSeparate(int modeRGB, int modeAlpha) {
|
||||
GL20.glBlendEquationSeparate(modeRGB, modeAlpha);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void blendFunc(int sfactor, int dfactor) {
|
||||
GL11.glBlendFunc(sfactor, dfactor);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void blendFuncSeparate(int srcRGB, int dstRGB, int srcAlpha, int dstAlpha) {
|
||||
GL14.glBlendFuncSeparate(srcRGB, dstRGB, srcAlpha, dstAlpha);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void bufferData(int target, int size, Buffer data, int usage) {
|
||||
if (data == null)
|
||||
GL15.glBufferData(target, size, usage);
|
||||
else if (data instanceof ByteBuffer)
|
||||
GL15.glBufferData(target, (ByteBuffer) data, usage);
|
||||
else if (data instanceof IntBuffer)
|
||||
GL15.glBufferData(target, (IntBuffer) data, usage);
|
||||
else if (data instanceof FloatBuffer)
|
||||
GL15.glBufferData(target, (FloatBuffer) data, usage);
|
||||
else if (data instanceof DoubleBuffer)
|
||||
GL15.glBufferData(target, (DoubleBuffer) data, usage);
|
||||
else if (data instanceof ShortBuffer) //
|
||||
GL15.glBufferData(target, (ShortBuffer) data, usage);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void bufferSubData(int target, int offset, int size, Buffer data) {
|
||||
if (data == null)
|
||||
throw new GdxRuntimeException("Using null for the data not possible, blame LWJGL");
|
||||
else if (data instanceof ByteBuffer)
|
||||
GL15.glBufferSubData(target, offset, (ByteBuffer) data);
|
||||
else if (data instanceof IntBuffer)
|
||||
GL15.glBufferSubData(target, offset, (IntBuffer) data);
|
||||
else if (data instanceof FloatBuffer)
|
||||
GL15.glBufferSubData(target, offset, (FloatBuffer) data);
|
||||
else if (data instanceof DoubleBuffer)
|
||||
GL15.glBufferSubData(target, offset, (DoubleBuffer) data);
|
||||
else if (data instanceof ShortBuffer) //
|
||||
GL15.glBufferSubData(target, offset, (ShortBuffer) data);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int checkFramebufferStatus(int target) {
|
||||
return EXTFramebufferObject.glCheckFramebufferStatusEXT(target);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clear(int mask) {
|
||||
GL11.glClear(mask);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clearColor(float red, float green, float blue, float alpha) {
|
||||
GL11.glClearColor(red, green, blue, alpha);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clearDepthf(float depth) {
|
||||
GL11.glClearDepth(depth);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clearStencil(int s) {
|
||||
GL11.glClearStencil(s);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void colorMask(boolean red, boolean green, boolean blue, boolean alpha) {
|
||||
GL11.glColorMask(red, green, blue, alpha);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void compileShader(int shader) {
|
||||
GL20.glCompileShader(shader);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void compressedTexImage2D(int target, int level, int internalformat, int width, int height, int border,
|
||||
int imageSize, Buffer data) {
|
||||
if (data instanceof ByteBuffer) {
|
||||
GL13.glCompressedTexImage2D(target, level, internalformat, width, height, border, (ByteBuffer) data);
|
||||
} else {
|
||||
throw new GdxRuntimeException("Can't use " + data.getClass().getName() + " with this method. Use ByteBuffer instead.");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void compressedTexSubImage2D(int target, int level, int xoffset, int yoffset, int width, int height, int format,
|
||||
int imageSize, Buffer data) {
|
||||
throw new GdxRuntimeException("not implemented");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void copyTexImage2D(int target, int level, int internalformat, int x, int y, int width, int height, int border) {
|
||||
GL11.glCopyTexImage2D(target, level, internalformat, x, y, width, height, border);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void copyTexSubImage2D(int target, int level, int xoffset, int yoffset, int x, int y, int width, int height) {
|
||||
GL11.glCopyTexSubImage2D(target, level, xoffset, yoffset, x, y, width, height);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int createProgram() {
|
||||
return GL20.glCreateProgram();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int createShader(int type) {
|
||||
return GL20.glCreateShader(type);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void cullFace(int mode) {
|
||||
GL11.glCullFace(mode);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteBuffers(int n, IntBuffer buffers) {
|
||||
GL15.glDeleteBuffers(buffers);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteBuffer(int buffer) {
|
||||
GL15.glDeleteBuffers(buffer);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteFramebuffers(int n, IntBuffer framebuffers) {
|
||||
EXTFramebufferObject.glDeleteFramebuffersEXT(framebuffers);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteFramebuffer(int framebuffer) {
|
||||
EXTFramebufferObject.glDeleteFramebuffersEXT(framebuffer);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteProgram(int program) {
|
||||
GL20.glDeleteProgram(program);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteRenderbuffers(int n, IntBuffer renderbuffers) {
|
||||
EXTFramebufferObject.glDeleteRenderbuffersEXT(renderbuffers);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteRenderbuffer(int renderbuffer) {
|
||||
EXTFramebufferObject.glDeleteRenderbuffersEXT(renderbuffer);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteShader(int shader) {
|
||||
GL20.glDeleteShader(shader);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteTextures(int n, IntBuffer textures) {
|
||||
GL11.glDeleteTextures(textures);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteTexture(int texture) {
|
||||
GL11.glDeleteTextures(texture);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void depthFunc(int func) {
|
||||
GL11.glDepthFunc(func);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void depthMask(boolean flag) {
|
||||
GL11.glDepthMask(flag);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void depthRangef(float zNear, float zFar) {
|
||||
GL11.glDepthRange(zNear, zFar);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void detachShader(int program, int shader) {
|
||||
GL20.glDetachShader(program, shader);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void disable(int cap) {
|
||||
GL11.glDisable(cap);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void disableVertexAttribArray(int index) {
|
||||
GL20.glDisableVertexAttribArray(index);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawArrays(int mode, int first, int count) {
|
||||
GL11.glDrawArrays(mode, first, count);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawElements(int mode, int count, int type, Buffer indices) {
|
||||
if (indices instanceof ShortBuffer && type == com.badlogic.gdx.graphics.GL20.GL_UNSIGNED_SHORT)
|
||||
GL11.glDrawElements(mode, (ShortBuffer) indices);
|
||||
else if (indices instanceof ByteBuffer && type == com.badlogic.gdx.graphics.GL20.GL_UNSIGNED_SHORT)
|
||||
GL11.glDrawElements(mode, ((ByteBuffer) indices).asShortBuffer());
|
||||
else if (indices instanceof ByteBuffer && type == com.badlogic.gdx.graphics.GL20.GL_UNSIGNED_BYTE)
|
||||
GL11.glDrawElements(mode, (ByteBuffer) indices);
|
||||
else
|
||||
throw new GdxRuntimeException("Can't use " + indices.getClass().getName()
|
||||
+ " with this method. Use ShortBuffer or ByteBuffer instead. Blame LWJGL");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void enable(int cap) {
|
||||
GL11.glEnable(cap);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void enableVertexAttribArray(int index) {
|
||||
GL20.glEnableVertexAttribArray(index);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void finish() {
|
||||
GL11.glFinish();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void flush() {
|
||||
GL11.glFlush();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void framebufferRenderbuffer(int target, int attachment, int renderbuffertarget, int renderbuffer) {
|
||||
EXTFramebufferObject.glFramebufferRenderbufferEXT(target, attachment, renderbuffertarget, renderbuffer);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void framebufferTexture2D(int target, int attachment, int textarget, int texture, int level) {
|
||||
EXTFramebufferObject.glFramebufferTexture2DEXT(target, attachment, textarget, texture, level);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void frontFace(int mode) {
|
||||
GL11.glFrontFace(mode);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void genBuffers(int n, IntBuffer buffers) {
|
||||
GL15.glGenBuffers(buffers);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int genBuffer() {
|
||||
return GL15.glGenBuffers();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void genFramebuffers(int n, IntBuffer framebuffers) {
|
||||
EXTFramebufferObject.glGenFramebuffersEXT(framebuffers);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int genFramebuffer() {
|
||||
return EXTFramebufferObject.glGenFramebuffersEXT();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void genRenderbuffers(int n, IntBuffer renderbuffers) {
|
||||
EXTFramebufferObject.glGenRenderbuffersEXT(renderbuffers);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int genRenderbuffer() {
|
||||
return EXTFramebufferObject.glGenRenderbuffersEXT();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void genTextures(int n, IntBuffer textures) {
|
||||
GL11.glGenTextures(textures);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int genTexture() {
|
||||
return GL11.glGenTextures();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void generateMipmap(int target) {
|
||||
EXTFramebufferObject.glGenerateMipmapEXT(target);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getActiveAttrib(int program, int index, IntBuffer size, Buffer type) {
|
||||
IntBuffer typeTmp = BufferUtils.createIntBuffer(2);
|
||||
String name = GL20.glGetActiveAttrib(program, index, 256, size, typeTmp);
|
||||
size.put(typeTmp.get(0));
|
||||
if (type instanceof IntBuffer) ((IntBuffer) type).put(typeTmp.get(1));
|
||||
return name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getActiveUniform(int program, int index, IntBuffer size, Buffer type) {
|
||||
IntBuffer typeTmp = BufferUtils.createIntBuffer(2);
|
||||
String name = GL20.glGetActiveUniform(program, index, 256, size, typeTmp);
|
||||
size.put(typeTmp.get(0));
|
||||
if (type instanceof IntBuffer) ((IntBuffer) type).put(typeTmp.get(1));
|
||||
return name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getAttachedShaders(int program, int maxcount, Buffer count, IntBuffer shaders) {
|
||||
GL20.glGetAttachedShaders(program, (IntBuffer) count, shaders);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getAttribLocation(int program, String name) {
|
||||
return GL20.glGetAttribLocation(program, name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getBooleanv(int pname, Buffer params) {
|
||||
GL11.glGetBooleanv(pname, (ByteBuffer) params);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getBufferParameteriv(int target, int pname, IntBuffer params) {
|
||||
GL15.glGetBufferParameteriv(target, pname, params);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getError() {
|
||||
return GL11.glGetError();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getFloatv(int pname, FloatBuffer params) {
|
||||
GL11.glGetFloatv(pname, params);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getFramebufferAttachmentParameteriv(int target, int attachment, int pname, IntBuffer params) {
|
||||
EXTFramebufferObject.glGetFramebufferAttachmentParameterivEXT(target, attachment, pname, params);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getIntegerv(int pname, IntBuffer params) {
|
||||
GL11.glGetIntegerv(pname, params);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getProgramInfoLog(int program) {
|
||||
ByteBuffer buffer = ByteBuffer.allocateDirect(1024 * 10);
|
||||
buffer.order(ByteOrder.nativeOrder());
|
||||
ByteBuffer tmp = ByteBuffer.allocateDirect(4);
|
||||
tmp.order(ByteOrder.nativeOrder());
|
||||
IntBuffer intBuffer = tmp.asIntBuffer();
|
||||
|
||||
GL20.glGetProgramInfoLog(program, intBuffer, buffer);
|
||||
int numBytes = intBuffer.get(0);
|
||||
byte[] bytes = new byte[numBytes];
|
||||
buffer.get(bytes);
|
||||
return new String(bytes);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getProgramiv(int program, int pname, IntBuffer params) {
|
||||
GL20.glGetProgramiv(program, pname, params);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getRenderbufferParameteriv(int target, int pname, IntBuffer params) {
|
||||
EXTFramebufferObject.glGetRenderbufferParameterivEXT(target, pname, params);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getShaderInfoLog(int shader) {
|
||||
ByteBuffer buffer = ByteBuffer.allocateDirect(1024 * 10);
|
||||
buffer.order(ByteOrder.nativeOrder());
|
||||
ByteBuffer tmp = ByteBuffer.allocateDirect(4);
|
||||
tmp.order(ByteOrder.nativeOrder());
|
||||
IntBuffer intBuffer = tmp.asIntBuffer();
|
||||
|
||||
GL20.glGetShaderInfoLog(shader, intBuffer, buffer);
|
||||
int numBytes = intBuffer.get(0);
|
||||
byte[] bytes = new byte[numBytes];
|
||||
buffer.get(bytes);
|
||||
return new String(bytes);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getShaderPrecisionFormat(int shadertype, int precisiontype, IntBuffer range, IntBuffer precision) {
|
||||
throw new UnsupportedOperationException("unsupported, won't implement");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getShaderiv(int shader, int pname, IntBuffer params) {
|
||||
GL20.glGetShaderiv(shader, pname, params);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getString(int name) {
|
||||
return GL11.glGetString(name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getTexParameterfv(int target, int pname, FloatBuffer params) {
|
||||
GL11.glGetTexParameterfv(target, pname, params);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getTexParameteriv(int target, int pname, IntBuffer params) {
|
||||
GL11.glGetTexParameteriv(target, pname, params);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getUniformLocation(int program, String name) {
|
||||
return GL20.glGetUniformLocation(program, name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getUniformfv(int program, int location, FloatBuffer params) {
|
||||
GL20.glGetUniformfv(program, location, params);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getUniformiv(int program, int location, IntBuffer params) {
|
||||
GL20.glGetUniformiv(program, location, params);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getVertexAttribPointerv(int index, int pname, Buffer pointer) {
|
||||
throw new UnsupportedOperationException("unsupported, won't implement");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getVertexAttribfv(int index, int pname, FloatBuffer params) {
|
||||
GL20.glGetVertexAttribfv(index, pname, params);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getVertexAttribiv(int index, int pname, IntBuffer params) {
|
||||
GL20.glGetVertexAttribiv(index, pname, params);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void hint(int target, int mode) {
|
||||
GL11.glHint(target, mode);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isBuffer(int buffer) {
|
||||
return GL15.glIsBuffer(buffer);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isEnabled(int cap) {
|
||||
return GL11.glIsEnabled(cap);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isFramebuffer(int framebuffer) {
|
||||
return EXTFramebufferObject.glIsFramebufferEXT(framebuffer);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isProgram(int program) {
|
||||
return GL20.glIsProgram(program);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isRenderbuffer(int renderbuffer) {
|
||||
return EXTFramebufferObject.glIsRenderbufferEXT(renderbuffer);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isShader(int shader) {
|
||||
return GL20.glIsShader(shader);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isTexture(int texture) {
|
||||
return GL11.glIsTexture(texture);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void lineWidth(float width) {
|
||||
GL11.glLineWidth(width);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void linkProgram(int program) {
|
||||
GL20.glLinkProgram(program);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void pixelStorei(int pname, int param) {
|
||||
GL11.glPixelStorei(pname, param);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void polygonOffset(float factor, float units) {
|
||||
GL11.glPolygonOffset(factor, units);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readPixels(int x, int y, int width, int height, int format, int type, Buffer pixels) {
|
||||
if (pixels instanceof ByteBuffer)
|
||||
GL11.glReadPixels(x, y, width, height, format, type, (ByteBuffer) pixels);
|
||||
else if (pixels instanceof ShortBuffer)
|
||||
GL11.glReadPixels(x, y, width, height, format, type, (ShortBuffer) pixels);
|
||||
else if (pixels instanceof IntBuffer)
|
||||
GL11.glReadPixels(x, y, width, height, format, type, (IntBuffer) pixels);
|
||||
else if (pixels instanceof FloatBuffer)
|
||||
GL11.glReadPixels(x, y, width, height, format, type, (FloatBuffer) pixels);
|
||||
else
|
||||
throw new GdxRuntimeException("Can't use " + pixels.getClass().getName()
|
||||
+ " with this method. Use ByteBuffer, ShortBuffer, IntBuffer or FloatBuffer instead. Blame LWJGL");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void releaseShaderCompiler() {
|
||||
// nothing to do here
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderbufferStorage(int target, int internalformat, int width, int height) {
|
||||
EXTFramebufferObject.glRenderbufferStorageEXT(target, internalformat, width, height);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sampleCoverage(float value, boolean invert) {
|
||||
GL13.glSampleCoverage(value, invert);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void scissor(int x, int y, int width, int height) {
|
||||
GL11.glScissor(x, y, width, height);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void shaderBinary(int n, IntBuffer shaders, int binaryformat, Buffer binary, int length) {
|
||||
throw new UnsupportedOperationException("unsupported, won't implement");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void shaderSource(int shader, String string) {
|
||||
GL20.glShaderSource(shader, string);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void stencilFunc(int func, int ref, int mask) {
|
||||
GL11.glStencilFunc(func, ref, mask);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void stencilFuncSeparate(int face, int func, int ref, int mask) {
|
||||
GL20.glStencilFuncSeparate(face, func, ref, mask);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void stencilMask(int mask) {
|
||||
GL11.glStencilMask(mask);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void stencilMaskSeparate(int face, int mask) {
|
||||
GL20.glStencilMaskSeparate(face, mask);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void stencilOp(int fail, int zfail, int zpass) {
|
||||
GL11.glStencilOp(fail, zfail, zpass);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void stencilOpSeparate(int face, int fail, int zfail, int zpass) {
|
||||
GL20.glStencilOpSeparate(face, fail, zfail, zpass);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void texImage2D(int target, int level, int internalformat, int width, int height, int border, int format, int type,
|
||||
Buffer pixels) {
|
||||
if (pixels == null)
|
||||
GL11.glTexImage2D(target, level, internalformat, width, height, border, format, type, (ByteBuffer) null);
|
||||
else if (pixels instanceof ByteBuffer)
|
||||
GL11.glTexImage2D(target, level, internalformat, width, height, border, format, type, (ByteBuffer) pixels);
|
||||
else if (pixels instanceof ShortBuffer)
|
||||
GL11.glTexImage2D(target, level, internalformat, width, height, border, format, type, (ShortBuffer) pixels);
|
||||
else if (pixels instanceof IntBuffer)
|
||||
GL11.glTexImage2D(target, level, internalformat, width, height, border, format, type, (IntBuffer) pixels);
|
||||
else if (pixels instanceof FloatBuffer)
|
||||
GL11.glTexImage2D(target, level, internalformat, width, height, border, format, type, (FloatBuffer) pixels);
|
||||
else if (pixels instanceof DoubleBuffer)
|
||||
GL11.glTexImage2D(target, level, internalformat, width, height, border, format, type, (DoubleBuffer) pixels);
|
||||
else
|
||||
throw new GdxRuntimeException("Can't use " + pixels.getClass().getName()
|
||||
+ " with this method. Use ByteBuffer, ShortBuffer, IntBuffer, FloatBuffer or DoubleBuffer instead. Blame LWJGL");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void texParameterf(int target, int pname, float param) {
|
||||
GL11.glTexParameterf(target, pname, param);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void texParameterfv(int target, int pname, FloatBuffer params) {
|
||||
GL11.glTexParameterfv(target, pname, params);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void texParameteri(int target, int pname, int param) {
|
||||
GL11.glTexParameteri(target, pname, param);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void texParameteriv(int target, int pname, IntBuffer params) {
|
||||
GL11.glTexParameteriv(target, pname, params);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void texSubImage2D(int target, int level, int xoffset, int yoffset, int width, int height, int format, int type,
|
||||
Buffer pixels) {
|
||||
if (pixels instanceof ByteBuffer)
|
||||
GL11.glTexSubImage2D(target, level, xoffset, yoffset, width, height, format, type, (ByteBuffer) pixels);
|
||||
else if (pixels instanceof ShortBuffer)
|
||||
GL11.glTexSubImage2D(target, level, xoffset, yoffset, width, height, format, type, (ShortBuffer) pixels);
|
||||
else if (pixels instanceof IntBuffer)
|
||||
GL11.glTexSubImage2D(target, level, xoffset, yoffset, width, height, format, type, (IntBuffer) pixels);
|
||||
else if (pixels instanceof FloatBuffer)
|
||||
GL11.glTexSubImage2D(target, level, xoffset, yoffset, width, height, format, type, (FloatBuffer) pixels);
|
||||
else if (pixels instanceof DoubleBuffer)
|
||||
GL11.glTexSubImage2D(target, level, xoffset, yoffset, width, height, format, type, (DoubleBuffer) pixels);
|
||||
else
|
||||
throw new GdxRuntimeException("Can't use " + pixels.getClass().getName()
|
||||
+ " with this method. Use ByteBuffer, ShortBuffer, IntBuffer, FloatBuffer or DoubleBuffer instead. Blame LWJGL");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void uniform1f(int location, float x) {
|
||||
GL20.glUniform1f(location, x);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void uniform1fv(int location, int count, FloatBuffer v) {
|
||||
GL20.glUniform1fv(location, v);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void uniform1fv(int location, int count, float[] v, int offset) {
|
||||
GL20.glUniform1fv(location, toFloatBuffer(v, offset, count));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void uniform1i(int location, int x) {
|
||||
GL20.glUniform1i(location, x);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void uniform1iv(int location, int count, IntBuffer v) {
|
||||
GL20.glUniform1iv(location, v);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void uniform1iv(int location, int count, int[] v, int offset) {
|
||||
GL20.glUniform1iv(location, toIntBuffer(v, offset, count));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void uniform2f(int location, float x, float y) {
|
||||
GL20.glUniform2f(location, x, y);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void uniform2fv(int location, int count, FloatBuffer v) {
|
||||
GL20.glUniform2fv(location, v);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void uniform2fv(int location, int count, float[] v, int offset) {
|
||||
GL20.glUniform2fv(location, toFloatBuffer(v, offset, count << 1));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void uniform2i(int location, int x, int y) {
|
||||
GL20.glUniform2i(location, x, y);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void uniform2iv(int location, int count, IntBuffer v) {
|
||||
GL20.glUniform2iv(location, v);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void uniform2iv(int location, int count, int[] v, int offset) {
|
||||
GL20.glUniform2iv(location, toIntBuffer(v, offset, count << 1));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void uniform3f(int location, float x, float y, float z) {
|
||||
GL20.glUniform3f(location, x, y, z);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void uniform3fv(int location, int count, FloatBuffer v) {
|
||||
GL20.glUniform3fv(location, v);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void uniform3fv(int location, int count, float[] v, int offset) {
|
||||
GL20.glUniform3fv(location, toFloatBuffer(v, offset, count * 3));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void uniform3i(int location, int x, int y, int z) {
|
||||
GL20.glUniform3i(location, x, y, z);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void uniform3iv(int location, int count, IntBuffer v) {
|
||||
GL20.glUniform3iv(location, v);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void uniform3iv(int location, int count, int[] v, int offset) {
|
||||
GL20.glUniform3iv(location, toIntBuffer(v, offset, count * 3));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void uniform4f(int location, float x, float y, float z, float w) {
|
||||
GL20.glUniform4f(location, x, y, z, w);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void uniform4fv(int location, int count, FloatBuffer v) {
|
||||
GL20.glUniform4fv(location, v);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void uniform4fv(int location, int count, float[] v, int offset) {
|
||||
GL20.glUniform4fv(location, toFloatBuffer(v, offset, count << 2));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void uniform4i(int location, int x, int y, int z, int w) {
|
||||
GL20.glUniform4i(location, x, y, z, w);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void uniform4iv(int location, int count, IntBuffer v) {
|
||||
GL20.glUniform4iv(location, v);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void uniform4iv(int location, int count, int[] v, int offset) {
|
||||
GL20.glUniform4iv(location, toIntBuffer(v, offset, count << 2));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void uniformMatrix2fv(int location, int count, boolean transpose, FloatBuffer value) {
|
||||
GL20.glUniformMatrix2fv(location, transpose, value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void uniformMatrix2fv(int location, int count, boolean transpose, float[] value, int offset) {
|
||||
GL20.glUniformMatrix2fv(location, transpose, toFloatBuffer(value, offset, count << 2));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void uniformMatrix3fv(int location, int count, boolean transpose, FloatBuffer value) {
|
||||
GL20.glUniformMatrix3fv(location, transpose, value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void uniformMatrix3fv(int location, int count, boolean transpose, float[] value, int offset) {
|
||||
GL20.glUniformMatrix3fv(location, transpose, toFloatBuffer(value, offset, count * 9));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void uniformMatrix4fv(int location, int count, boolean transpose, FloatBuffer value) {
|
||||
GL20.glUniformMatrix4fv(location, transpose, value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void uniformMatrix4fv(int location, int count, boolean transpose, float[] value, int offset) {
|
||||
GL20.glUniformMatrix4fv(location, transpose, toFloatBuffer(value, offset, count << 4));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void useProgram(int program) {
|
||||
GL20.glUseProgram(program);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void validateProgram(int program) {
|
||||
GL20.glValidateProgram(program);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void vertexAttrib1f(int indx, float x) {
|
||||
GL20.glVertexAttrib1f(indx, x);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void vertexAttrib1fv(int indx, FloatBuffer values) {
|
||||
GL20.glVertexAttrib1f(indx, values.get());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void vertexAttrib2f(int indx, float x, float y) {
|
||||
GL20.glVertexAttrib2f(indx, x, y);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void vertexAttrib2fv(int indx, FloatBuffer values) {
|
||||
GL20.glVertexAttrib2f(indx, values.get(), values.get());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void vertexAttrib3f(int indx, float x, float y, float z) {
|
||||
GL20.glVertexAttrib3f(indx, x, y, z);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void vertexAttrib3fv(int indx, FloatBuffer values) {
|
||||
GL20.glVertexAttrib3f(indx, values.get(), values.get(), values.get());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void vertexAttrib4f(int indx, float x, float y, float z, float w) {
|
||||
GL20.glVertexAttrib4f(indx, x, y, z, w);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void vertexAttrib4fv(int indx, FloatBuffer values) {
|
||||
GL20.glVertexAttrib4f(indx, values.get(), values.get(), values.get(), values.get());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void vertexAttribPointer(int indx, int size, int type, boolean normalized, int stride, Buffer buffer) {
|
||||
if (buffer instanceof ByteBuffer) {
|
||||
if (type == GL.BYTE)
|
||||
GL20.glVertexAttribPointer(indx, size, type, normalized, stride, (ByteBuffer) buffer);
|
||||
else if (type == GL.UNSIGNED_BYTE)
|
||||
GL20.glVertexAttribPointer(indx, size, type, normalized, stride, (ByteBuffer) buffer);
|
||||
else if (type == GL.SHORT)
|
||||
GL20.glVertexAttribPointer(indx, size, type, normalized, stride, ((ByteBuffer) buffer).asShortBuffer());
|
||||
else if (type == GL.UNSIGNED_SHORT)
|
||||
GL20.glVertexAttribPointer(indx, size, type, normalized, stride, ((ByteBuffer) buffer).asShortBuffer());
|
||||
else if (type == GL.FLOAT)
|
||||
GL20.glVertexAttribPointer(indx, size, type, normalized, stride, ((ByteBuffer) buffer).asFloatBuffer());
|
||||
else
|
||||
throw new GdxRuntimeException(
|
||||
"Can't use "
|
||||
+ buffer.getClass().getName()
|
||||
+ " with type "
|
||||
+ type
|
||||
+ " with this method. Use ByteBuffer and one of GL_BYTE, GL_UNSIGNED_BYTE, GL_SHORT, GL_UNSIGNED_SHORT or GL_FLOAT for type. Blame LWJGL");
|
||||
} else if (buffer instanceof FloatBuffer) {
|
||||
if (type == GL.FLOAT)
|
||||
GL20.glVertexAttribPointer(indx, size, type, normalized, stride, (FloatBuffer) buffer);
|
||||
else
|
||||
throw new GdxRuntimeException("Can't use " + buffer.getClass().getName() + " with type " + type
|
||||
+ " with this method.");
|
||||
} else
|
||||
throw new GdxRuntimeException("Can't use " + buffer.getClass().getName()
|
||||
+ " with this method. Use ByteBuffer instead. Blame LWJGL");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void viewport(int x, int y, int width, int height) {
|
||||
GL11.glViewport(x, y, width, height);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawElements(int mode, int count, int type, int indices) {
|
||||
GL11.glDrawElements(mode, count, type, indices);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void vertexAttribPointer(int indx, int size, int type, boolean normalized, int stride, int ptr) {
|
||||
GL20.glVertexAttribPointer(indx, size, type, normalized, stride, ptr);
|
||||
}
|
||||
}
|
||||
640
vtm-desktop-lwjgl3/src/org/oscim/gdx/Lwjgl3GL30.java
Normal file
640
vtm-desktop-lwjgl3/src/org/oscim/gdx/Lwjgl3GL30.java
Normal file
@@ -0,0 +1,640 @@
|
||||
/*******************************************************************************
|
||||
* Copyright 2011 See AUTHORS file.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
******************************************************************************/
|
||||
|
||||
package org.oscim.gdx;
|
||||
|
||||
import com.badlogic.gdx.utils.GdxRuntimeException;
|
||||
import org.lwjgl.opengl.*;
|
||||
|
||||
import java.nio.*;
|
||||
|
||||
/**
|
||||
* See https://github.com/libgdx/libgdx/blob/master/backends/gdx-backend-lwjgl3/src/com/badlogic/gdx/backends/lwjgl3/Lwjgl3GL30.java
|
||||
*/
|
||||
public class Lwjgl3GL30 extends Lwjgl3GL20 implements org.oscim.backend.GL30 {
|
||||
@Override
|
||||
public void readBuffer(int mode) {
|
||||
GL11.glReadBuffer(mode);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawRangeElements(int mode, int start, int end, int count, int type, Buffer indices) {
|
||||
if (indices instanceof ByteBuffer)
|
||||
GL12.glDrawRangeElements(mode, start, end, (ByteBuffer) indices);
|
||||
else if (indices instanceof ShortBuffer)
|
||||
GL12.glDrawRangeElements(mode, start, end, (ShortBuffer) indices);
|
||||
else if (indices instanceof IntBuffer)
|
||||
GL12.glDrawRangeElements(mode, start, end, (IntBuffer) indices);
|
||||
else throw new GdxRuntimeException("indices must be byte, short or int buffer");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawRangeElements(int mode, int start, int end, int count, int type, int offset) {
|
||||
GL12.glDrawRangeElements(mode, start, end, count, type, offset);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void texImage3D(int target, int level, int internalformat, int width, int height, int depth, int border, int format,
|
||||
int type, Buffer pixels) {
|
||||
if (pixels == null)
|
||||
GL12.glTexImage3D(target, level, internalformat, width, height, depth, border, format, type, (ByteBuffer) null);
|
||||
else if (pixels instanceof ByteBuffer)
|
||||
GL12.glTexImage3D(target, level, internalformat, width, height, depth, border, format, type, (ByteBuffer) pixels);
|
||||
else if (pixels instanceof ShortBuffer)
|
||||
GL12.glTexImage3D(target, level, internalformat, width, height, depth, border, format, type, (ShortBuffer) pixels);
|
||||
else if (pixels instanceof IntBuffer)
|
||||
GL12.glTexImage3D(target, level, internalformat, width, height, depth, border, format, type, (IntBuffer) pixels);
|
||||
else if (pixels instanceof FloatBuffer)
|
||||
GL12.glTexImage3D(target, level, internalformat, width, height, depth, border, format, type, (FloatBuffer) pixels);
|
||||
else if (pixels instanceof DoubleBuffer)
|
||||
GL12.glTexImage3D(target, level, internalformat, width, height, depth, border, format, type, (DoubleBuffer) pixels);
|
||||
else
|
||||
throw new GdxRuntimeException("Can't use " + pixels.getClass().getName()
|
||||
+ " with this method. Use ByteBuffer, ShortBuffer, IntBuffer, FloatBuffer or DoubleBuffer instead. Blame LWJGL");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void texImage3D(int target, int level, int internalformat, int width, int height, int depth, int border, int format,
|
||||
int type, int offset) {
|
||||
GL12.glTexImage3D(target, level, internalformat, width, height, depth, border, format, type, offset);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void texSubImage3D(int target, int level, int xoffset, int yoffset, int zoffset, int width, int height, int depth,
|
||||
int format, int type, Buffer pixels) {
|
||||
if (pixels instanceof ByteBuffer)
|
||||
GL12.glTexSubImage3D(target, level, xoffset, yoffset, zoffset, width, height, depth, format, type, (ByteBuffer) pixels);
|
||||
else if (pixels instanceof ShortBuffer)
|
||||
GL12.glTexSubImage3D(target, level, xoffset, yoffset, zoffset, width, height, depth, format, type, (ShortBuffer) pixels);
|
||||
else if (pixels instanceof IntBuffer)
|
||||
GL12.glTexSubImage3D(target, level, xoffset, yoffset, zoffset, width, height, depth, format, type, (IntBuffer) pixels);
|
||||
else if (pixels instanceof FloatBuffer)
|
||||
GL12.glTexSubImage3D(target, level, xoffset, yoffset, zoffset, width, height, depth, format, type, (FloatBuffer) pixels);
|
||||
else if (pixels instanceof DoubleBuffer)
|
||||
GL12.glTexSubImage3D(target, level, xoffset, yoffset, zoffset, width, height, depth, format, type, (DoubleBuffer) pixels);
|
||||
else
|
||||
throw new GdxRuntimeException("Can't use " + pixels.getClass().getName()
|
||||
+ " with this method. Use ByteBuffer, ShortBuffer, IntBuffer, FloatBuffer or DoubleBuffer instead. Blame LWJGL");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void texSubImage3D(int target, int level, int xoffset, int yoffset, int zoffset, int width, int height, int depth,
|
||||
int format, int type, int offset) {
|
||||
GL12.glTexSubImage3D(target, level, xoffset, yoffset, zoffset, width, height, depth, format, type, offset);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void copyTexSubImage3D(int target, int level, int xoffset, int yoffset, int zoffset, int x, int y, int width,
|
||||
int height) {
|
||||
GL12.glCopyTexSubImage3D(target, level, xoffset, yoffset, zoffset, x, y, width, height);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void genQueries(int n, int[] ids, int offset) {
|
||||
for (int i = offset; i < offset + n; i++) {
|
||||
ids[i] = GL15.glGenQueries();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void genQueries(int n, IntBuffer ids) {
|
||||
for (int i = 0; i < n; i++) {
|
||||
ids.put(GL15.glGenQueries());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteQueries(int n, int[] ids, int offset) {
|
||||
for (int i = offset; i < offset + n; i++) {
|
||||
GL15.glDeleteQueries(ids[i]);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteQueries(int n, IntBuffer ids) {
|
||||
for (int i = 0; i < n; i++) {
|
||||
GL15.glDeleteQueries(ids.get());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isQuery(int id) {
|
||||
return GL15.glIsQuery(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void beginQuery(int target, int id) {
|
||||
GL15.glBeginQuery(target, id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void endQuery(int target) {
|
||||
GL15.glEndQuery(target);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getQueryiv(int target, int pname, IntBuffer params) {
|
||||
GL15.glGetQueryiv(target, pname, params);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getQueryObjectuiv(int id, int pname, IntBuffer params) {
|
||||
GL15.glGetQueryObjectuiv(id, pname, params);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean unmapBuffer(int target) {
|
||||
return GL15.glUnmapBuffer(target);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Buffer getBufferPointerv(int target, int pname) {
|
||||
// FIXME glGetBufferPointerv needs a proper translation
|
||||
// return GL15.glGetBufferPointer(target, pname);
|
||||
throw new UnsupportedOperationException("Not implemented");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawBuffers(int n, IntBuffer bufs) {
|
||||
GL20.glDrawBuffers(bufs);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void uniformMatrix2x3fv(int location, int count, boolean transpose, FloatBuffer value) {
|
||||
GL21.glUniformMatrix2x3fv(location, transpose, value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void uniformMatrix3x2fv(int location, int count, boolean transpose, FloatBuffer value) {
|
||||
GL21.glUniformMatrix3x2fv(location, transpose, value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void uniformMatrix2x4fv(int location, int count, boolean transpose, FloatBuffer value) {
|
||||
GL21.glUniformMatrix2x4fv(location, transpose, value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void uniformMatrix4x2fv(int location, int count, boolean transpose, FloatBuffer value) {
|
||||
GL21.glUniformMatrix4x2fv(location, transpose, value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void uniformMatrix3x4fv(int location, int count, boolean transpose, FloatBuffer value) {
|
||||
GL21.glUniformMatrix3x4fv(location, transpose, value);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void uniformMatrix4x3fv(int location, int count, boolean transpose, FloatBuffer value) {
|
||||
GL21.glUniformMatrix4x3fv(location, transpose, value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void blitFramebuffer(int srcX0, int srcY0, int srcX1, int srcY1, int dstX0, int dstY0, int dstX1, int dstY1,
|
||||
int mask, int filter) {
|
||||
GL30.glBlitFramebuffer(srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, mask, filter);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void bindFramebuffer(int target, int framebuffer) {
|
||||
GL30.glBindFramebuffer(target, framebuffer);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void bindRenderbuffer(int target, int renderbuffer) {
|
||||
GL30.glBindRenderbuffer(target, renderbuffer);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int checkFramebufferStatus(int target) {
|
||||
return GL30.glCheckFramebufferStatus(target);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteFramebuffers(int n, IntBuffer framebuffers) {
|
||||
GL30.glDeleteFramebuffers(framebuffers);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteFramebuffer(int framebuffer) {
|
||||
GL30.glDeleteFramebuffers(framebuffer);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteRenderbuffers(int n, IntBuffer renderbuffers) {
|
||||
GL30.glDeleteRenderbuffers(renderbuffers);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteRenderbuffer(int renderbuffer) {
|
||||
GL30.glDeleteRenderbuffers(renderbuffer);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void generateMipmap(int target) {
|
||||
GL30.glGenerateMipmap(target);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void genFramebuffers(int n, IntBuffer framebuffers) {
|
||||
GL30.glGenFramebuffers(framebuffers);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int genFramebuffer() {
|
||||
return GL30.glGenFramebuffers();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void genRenderbuffers(int n, IntBuffer renderbuffers) {
|
||||
GL30.glGenRenderbuffers(renderbuffers);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int genRenderbuffer() {
|
||||
return GL30.glGenRenderbuffers();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getRenderbufferParameteriv(int target, int pname, IntBuffer params) {
|
||||
GL30.glGetRenderbufferParameteriv(target, pname, params);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isFramebuffer(int framebuffer) {
|
||||
return GL30.glIsFramebuffer(framebuffer);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isRenderbuffer(int renderbuffer) {
|
||||
return GL30.glIsRenderbuffer(renderbuffer);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderbufferStorage(int target, int internalformat, int width, int height) {
|
||||
GL30.glRenderbufferStorage(target, internalformat, width, height);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderbufferStorageMultisample(int target, int samples, int internalformat, int width, int height) {
|
||||
GL30.glRenderbufferStorageMultisample(target, samples, internalformat, width, height);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void framebufferTexture2D(int target, int attachment, int textarget, int texture, int level) {
|
||||
GL30.glFramebufferTexture2D(target, attachment, textarget, texture, level);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void framebufferRenderbuffer(int target, int attachment, int renderbuffertarget, int renderbuffer) {
|
||||
GL30.glFramebufferRenderbuffer(target, attachment, renderbuffertarget, renderbuffer);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void framebufferTextureLayer(int target, int attachment, int texture, int level, int layer) {
|
||||
GL30.glFramebufferTextureLayer(target, attachment, texture, level, layer);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void flushMappedBufferRange(int target, int offset, int length) {
|
||||
GL30.glFlushMappedBufferRange(target, offset, length);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void bindVertexArray(int array) {
|
||||
GL30.glBindVertexArray(array);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteVertexArrays(int n, int[] arrays, int offset) {
|
||||
for (int i = offset; i < offset + n; i++) {
|
||||
GL30.glDeleteVertexArrays(arrays[i]);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteVertexArrays(int n, IntBuffer arrays) {
|
||||
GL30.glDeleteVertexArrays(arrays);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void genVertexArrays(int n, int[] arrays, int offset) {
|
||||
for (int i = offset; i < offset + n; i++) {
|
||||
arrays[i] = GL30.glGenVertexArrays();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void genVertexArrays(int n, IntBuffer arrays) {
|
||||
GL30.glGenVertexArrays(arrays);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isVertexArray(int array) {
|
||||
return GL30.glIsVertexArray(array);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void beginTransformFeedback(int primitiveMode) {
|
||||
GL30.glBeginTransformFeedback(primitiveMode);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void endTransformFeedback() {
|
||||
GL30.glEndTransformFeedback();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void bindBufferRange(int target, int index, int buffer, int offset, int size) {
|
||||
GL30.glBindBufferRange(target, index, buffer, offset, size);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void bindBufferBase(int target, int index, int buffer) {
|
||||
GL30.glBindBufferBase(target, index, buffer);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void transformFeedbackVaryings(int program, String[] varyings, int bufferMode) {
|
||||
GL30.glTransformFeedbackVaryings(program, varyings, bufferMode);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void vertexAttribIPointer(int index, int size, int type, int stride, int offset) {
|
||||
GL30.glVertexAttribIPointer(index, size, type, stride, offset);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getVertexAttribIiv(int index, int pname, IntBuffer params) {
|
||||
GL30.glGetVertexAttribIiv(index, pname, params);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getVertexAttribIuiv(int index, int pname, IntBuffer params) {
|
||||
GL30.glGetVertexAttribIuiv(index, pname, params);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void vertexAttribI4i(int index, int x, int y, int z, int w) {
|
||||
GL30.glVertexAttribI4i(index, x, y, z, w);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void vertexAttribI4ui(int index, int x, int y, int z, int w) {
|
||||
GL30.glVertexAttribI4ui(index, x, y, z, w);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getUniformuiv(int program, int location, IntBuffer params) {
|
||||
GL30.glGetUniformuiv(program, location, params);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getFragDataLocation(int program, String name) {
|
||||
return GL30.glGetFragDataLocation(program, name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void uniform1uiv(int location, int count, IntBuffer value) {
|
||||
GL30.glUniform1uiv(location, value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void uniform3uiv(int location, int count, IntBuffer value) {
|
||||
GL30.glUniform3uiv(location, value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void uniform4uiv(int location, int count, IntBuffer value) {
|
||||
GL30.glUniform4uiv(location, value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clearBufferiv(int buffer, int drawbuffer, IntBuffer value) {
|
||||
GL30.glClearBufferiv(buffer, drawbuffer, value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clearBufferuiv(int buffer, int drawbuffer, IntBuffer value) {
|
||||
GL30.glClearBufferuiv(buffer, drawbuffer, value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clearBufferfv(int buffer, int drawbuffer, FloatBuffer value) {
|
||||
GL30.glClearBufferfv(buffer, drawbuffer, value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clearBufferfi(int buffer, int drawbuffer, float depth, int stencil) {
|
||||
GL30.glClearBufferfi(buffer, drawbuffer, depth, stencil);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getStringi(int name, int index) {
|
||||
return GL30.glGetStringi(name, index);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void copyBufferSubData(int readTarget, int writeTarget, int readOffset, int writeOffset, int size) {
|
||||
GL31.glCopyBufferSubData(readTarget, writeTarget, readOffset, writeOffset, size);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getUniformIndices(int program, String[] uniformNames, IntBuffer uniformIndices) {
|
||||
GL31.glGetUniformIndices(program, uniformNames, uniformIndices);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getActiveUniformsiv(int program, int uniformCount, IntBuffer uniformIndices, int pname, IntBuffer params) {
|
||||
GL31.glGetActiveUniformsiv(program, uniformIndices, pname, params);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getUniformBlockIndex(int program, String uniformBlockName) {
|
||||
return GL31.glGetUniformBlockIndex(program, uniformBlockName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getActiveUniformBlockiv(int program, int uniformBlockIndex, int pname, IntBuffer params) {
|
||||
params.put(GL31.glGetActiveUniformBlocki(program, uniformBlockIndex, pname));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getActiveUniformBlockName(int program, int uniformBlockIndex, Buffer length, Buffer uniformBlockName) {
|
||||
GL31.glGetActiveUniformBlockName(program, uniformBlockIndex, (IntBuffer) length, (ByteBuffer) uniformBlockName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getActiveUniformBlockName(int program, int uniformBlockIndex) {
|
||||
return GL31.glGetActiveUniformBlockName(program, uniformBlockIndex, 1024);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void uniformBlockBinding(int program, int uniformBlockIndex, int uniformBlockBinding) {
|
||||
GL31.glUniformBlockBinding(program, uniformBlockIndex, uniformBlockBinding);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawArraysInstanced(int mode, int first, int count, int instanceCount) {
|
||||
GL31.glDrawArraysInstanced(mode, first, count, instanceCount);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawElementsInstanced(int mode, int count, int type, int indicesOffset, int instanceCount) {
|
||||
GL31.glDrawElementsInstanced(mode, count, type, indicesOffset, instanceCount);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getInteger64v(int pname, LongBuffer params) {
|
||||
GL32.glGetInteger64v(pname, params);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getBufferParameteri64v(int target, int pname, LongBuffer params) {
|
||||
params.put(GL32.glGetBufferParameteri64(target, pname));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void genSamplers(int count, int[] samplers, int offset) {
|
||||
for (int i = offset; i < offset + count; i++) {
|
||||
samplers[i] = GL33.glGenSamplers();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void genSamplers(int count, IntBuffer samplers) {
|
||||
GL33.glGenSamplers(samplers);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteSamplers(int count, int[] samplers, int offset) {
|
||||
for (int i = offset; i < offset + count; i++) {
|
||||
GL33.glDeleteSamplers(samplers[i]);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteSamplers(int count, IntBuffer samplers) {
|
||||
GL33.glDeleteSamplers(samplers);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSampler(int sampler) {
|
||||
return GL33.glIsSampler(sampler);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void bindSampler(int unit, int sampler) {
|
||||
GL33.glBindSampler(unit, sampler);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void samplerParameteri(int sampler, int pname, int param) {
|
||||
GL33.glSamplerParameteri(sampler, pname, param);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void samplerParameteriv(int sampler, int pname, IntBuffer param) {
|
||||
GL33.glSamplerParameteriv(sampler, pname, param);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void samplerParameterf(int sampler, int pname, float param) {
|
||||
GL33.glSamplerParameterf(sampler, pname, param);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void samplerParameterfv(int sampler, int pname, FloatBuffer param) {
|
||||
GL33.glSamplerParameterfv(sampler, pname, param);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getSamplerParameteriv(int sampler, int pname, IntBuffer params) {
|
||||
GL33.glGetSamplerParameterIiv(sampler, pname, params);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getSamplerParameterfv(int sampler, int pname, FloatBuffer params) {
|
||||
GL33.glGetSamplerParameterfv(sampler, pname, params);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void vertexAttribDivisor(int index, int divisor) {
|
||||
GL33.glVertexAttribDivisor(index, divisor);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void bindTransformFeedback(int target, int id) {
|
||||
GL40.glBindTransformFeedback(target, id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteTransformFeedbacks(int n, int[] ids, int offset) {
|
||||
for (int i = offset; i < offset + n; i++) {
|
||||
GL40.glDeleteTransformFeedbacks(ids[i]);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteTransformFeedbacks(int n, IntBuffer ids) {
|
||||
GL40.glDeleteTransformFeedbacks(ids);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void genTransformFeedbacks(int n, int[] ids, int offset) {
|
||||
for (int i = offset; i < offset + n; i++) {
|
||||
ids[i] = GL40.glGenTransformFeedbacks();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void genTransformFeedbacks(int n, IntBuffer ids) {
|
||||
GL40.glGenTransformFeedbacks(ids);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isTransformFeedback(int id) {
|
||||
return GL40.glIsTransformFeedback(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void pauseTransformFeedback() {
|
||||
GL40.glPauseTransformFeedback();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void resumeTransformFeedback() {
|
||||
GL40.glResumeTransformFeedback();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void programParameteri(int program, int pname, int value) {
|
||||
GL41.glProgramParameteri(program, pname, value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void invalidateFramebuffer(int target, int numAttachments, IntBuffer attachments) {
|
||||
GL43.glInvalidateFramebuffer(target, attachments);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void invalidateSubFramebuffer(int target, int numAttachments, IntBuffer attachments, int x, int y, int width,
|
||||
int height) {
|
||||
GL43.glInvalidateSubFramebuffer(target, attachments, x, y, width, height);
|
||||
}
|
||||
}
|
||||
@@ -3,7 +3,6 @@ apply plugin: 'maven'
|
||||
|
||||
dependencies {
|
||||
api project(':vtm-gdx')
|
||||
api "com.badlogicgames.gdx:gdx-backend-lwjgl:$gdxVersion"
|
||||
api 'com.github.blackears:svgSalamander:v1.1.1'
|
||||
}
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ buildscript {
|
||||
jcenter()
|
||||
}
|
||||
dependencies {
|
||||
classpath 'com.mobidevelop.robovm:robovm-gradle-plugin:2.3.5'
|
||||
classpath 'com.mobidevelop.robovm:robovm-gradle-plugin:2.3.7'
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@ sourceSets.main.java.srcDirs = ["src/"]
|
||||
[compileJava, compileTestJava]*.options*.encoding = 'UTF-8'
|
||||
|
||||
ext {
|
||||
roboVMVersion = "2.3.5"
|
||||
roboVMVersion = "2.3.7"
|
||||
}
|
||||
|
||||
launchIPhoneSimulator.dependsOn build
|
||||
|
||||
@@ -3,7 +3,7 @@ buildscript {
|
||||
jcenter()
|
||||
}
|
||||
dependencies {
|
||||
classpath 'com.mobidevelop.robovm:robovm-gradle-plugin:2.3.5'
|
||||
classpath 'com.mobidevelop.robovm:robovm-gradle-plugin:2.3.7'
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@ sourceSets.main.java.srcDirs = ["src/"]
|
||||
[compileJava, compileTestJava]*.options*.encoding = 'UTF-8'
|
||||
|
||||
ext {
|
||||
roboVMVersion = "2.3.5"
|
||||
roboVMVersion = "2.3.7"
|
||||
}
|
||||
|
||||
launchIPhoneSimulator.dependsOn build
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
apply plugin: 'application'
|
||||
|
||||
dependencies {
|
||||
implementation project(':vtm-desktop')
|
||||
implementation project(':vtm-desktop-lwjgl')
|
||||
file("${rootDir}/vtm-desktop/natives").eachDir() { dir ->
|
||||
implementation files(dir.path)
|
||||
}
|
||||
|
||||
@@ -18,7 +18,6 @@
|
||||
package org.oscim.test;
|
||||
|
||||
import com.badlogic.gdx.Input;
|
||||
|
||||
import org.oscim.core.BoundingBox;
|
||||
import org.oscim.gdx.GdxMapApp;
|
||||
import org.oscim.layers.tile.bitmap.BitmapTileLayer;
|
||||
|
||||
@@ -1,99 +0,0 @@
|
||||
/*
|
||||
* Copyright 2016-2018 devemux86
|
||||
* Copyright 2017 Longri
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify it under the
|
||||
* terms of the GNU Lesser General Public License as published by the Free Software
|
||||
* Foundation, either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||
* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License along with
|
||||
* this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package org.oscim.test;
|
||||
|
||||
import org.oscim.backend.CanvasAdapter;
|
||||
import org.oscim.backend.canvas.Bitmap;
|
||||
import org.oscim.core.GeoPoint;
|
||||
import org.oscim.gdx.GdxMapApp;
|
||||
import org.oscim.layers.marker.ItemizedLayer;
|
||||
import org.oscim.layers.marker.MarkerItem;
|
||||
import org.oscim.layers.marker.MarkerSymbol;
|
||||
import org.oscim.layers.tile.bitmap.BitmapTileLayer;
|
||||
import org.oscim.renderer.atlas.TextureAtlas;
|
||||
import org.oscim.renderer.atlas.TextureRegion;
|
||||
import org.oscim.tiling.TileSource;
|
||||
import org.oscim.tiling.source.OkHttpEngine;
|
||||
import org.oscim.tiling.source.bitmap.DefaultSources;
|
||||
import org.oscim.utils.TextureAtlasUtils;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
|
||||
import static org.oscim.layers.marker.MarkerSymbol.HotspotPlace;
|
||||
|
||||
public class AtlasMarkerLayerTest extends MarkerLayerTest {
|
||||
|
||||
@Override
|
||||
public void createLayers() {
|
||||
try {
|
||||
// Map events receiver
|
||||
mMap.layers().add(new MapEventsReceiver(mMap));
|
||||
|
||||
TileSource tileSource = DefaultSources.OPENSTREETMAP
|
||||
.httpFactory(new OkHttpEngine.OkHttpFactory())
|
||||
.build();
|
||||
mMap.layers().add(new BitmapTileLayer(mMap, tileSource));
|
||||
|
||||
mMap.setMapPosition(0, 0, 1 << 2);
|
||||
|
||||
Bitmap bitmapPoi = CanvasAdapter.decodeBitmap(getClass().getResourceAsStream("/res/marker_poi.png"));
|
||||
Bitmap bitmapFocus = CanvasAdapter.decodeBitmap(getClass().getResourceAsStream("/res/marker_focus.png"));
|
||||
|
||||
// Create Atlas from Bitmaps
|
||||
java.util.Map<Object, Bitmap> inputMap = new LinkedHashMap<>();
|
||||
java.util.Map<Object, TextureRegion> regionsMap = new LinkedHashMap<>();
|
||||
List<TextureAtlas> atlasList = new ArrayList<>();
|
||||
|
||||
inputMap.put("poi", bitmapPoi);
|
||||
inputMap.put("focus", bitmapFocus);
|
||||
|
||||
// Bitmaps will never used any more
|
||||
// With iOS we must flip the Y-Axis
|
||||
TextureAtlasUtils.createTextureRegions(inputMap, regionsMap, atlasList, true, false);
|
||||
|
||||
MarkerSymbol symbol;
|
||||
if (BILLBOARDS)
|
||||
symbol = new MarkerSymbol(regionsMap.get("poi"), HotspotPlace.BOTTOM_CENTER);
|
||||
else
|
||||
symbol = new MarkerSymbol(regionsMap.get("poi"), HotspotPlace.CENTER, false);
|
||||
|
||||
if (BILLBOARDS)
|
||||
mFocusMarker = new MarkerSymbol(regionsMap.get("focus"), HotspotPlace.BOTTOM_CENTER);
|
||||
else
|
||||
mFocusMarker = new MarkerSymbol(regionsMap.get("focus"), HotspotPlace.CENTER, false);
|
||||
|
||||
mMarkerLayer = new ItemizedLayer<>(mMap, new ArrayList<MarkerItem>(), symbol, this);
|
||||
mMap.layers().add(mMarkerLayer);
|
||||
|
||||
List<MarkerItem> pts = new ArrayList<>();
|
||||
for (double lat = -90; lat <= 90; lat += 5) {
|
||||
for (double lon = -180; lon <= 180; lon += 5)
|
||||
pts.add(new MarkerItem(lat + "/" + lon, "", new GeoPoint(lat, lon)));
|
||||
}
|
||||
mMarkerLayer.addItems(pts);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
GdxMapApp.init();
|
||||
GdxMapApp.run(new AtlasMarkerLayerTest());
|
||||
}
|
||||
}
|
||||
@@ -1,31 +0,0 @@
|
||||
/*
|
||||
* Copyright 2017 Longri
|
||||
* Copyright 2017 devemux86
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify it under the
|
||||
* terms of the GNU Lesser General Public License as published by the Free Software
|
||||
* Foundation, either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||
* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License along with
|
||||
* this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package org.oscim.test;
|
||||
|
||||
import org.oscim.gdx.GdxMapApp;
|
||||
import org.oscim.utils.Parameters;
|
||||
|
||||
public class AtlasThemeTest extends SimpleMapTest {
|
||||
|
||||
private AtlasThemeTest() {
|
||||
Parameters.TEXTURE_ATLAS = true;
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
GdxMapApp.init();
|
||||
GdxMapApp.run(new AtlasThemeTest());
|
||||
}
|
||||
}
|
||||
@@ -17,7 +17,6 @@
|
||||
package org.oscim.test;
|
||||
|
||||
import com.badlogic.gdx.Input;
|
||||
|
||||
import org.oscim.gdx.GdxMapApp;
|
||||
import org.oscim.layers.tile.bitmap.BitmapTileLayer;
|
||||
import org.oscim.renderer.MapRenderer;
|
||||
|
||||
@@ -20,13 +20,7 @@ import org.oscim.backend.canvas.Bitmap;
|
||||
import org.oscim.backend.canvas.Color;
|
||||
import org.oscim.core.GeoPoint;
|
||||
import org.oscim.gdx.GdxMapApp;
|
||||
import org.oscim.layers.marker.ClusterMarkerRenderer;
|
||||
import org.oscim.layers.marker.ItemizedLayer;
|
||||
import org.oscim.layers.marker.MarkerItem;
|
||||
import org.oscim.layers.marker.MarkerLayer;
|
||||
import org.oscim.layers.marker.MarkerRenderer;
|
||||
import org.oscim.layers.marker.MarkerRendererFactory;
|
||||
import org.oscim.layers.marker.MarkerSymbol;
|
||||
import org.oscim.layers.marker.*;
|
||||
import org.oscim.layers.tile.bitmap.BitmapTileLayer;
|
||||
import org.oscim.tiling.TileSource;
|
||||
import org.oscim.tiling.source.OkHttpEngine;
|
||||
|
||||
@@ -17,7 +17,6 @@
|
||||
package org.oscim.test;
|
||||
|
||||
import com.badlogic.gdx.Input;
|
||||
|
||||
import org.oscim.gdx.GdxMapApp;
|
||||
import org.oscim.layers.tile.vector.VectorTileLayer;
|
||||
import org.oscim.layers.tile.vector.labeling.LabelLayer;
|
||||
|
||||
@@ -24,7 +24,6 @@ import com.badlogic.gdx.graphics.g2d.SpriteBatch;
|
||||
import com.badlogic.gdx.math.Vector2;
|
||||
import com.badlogic.gdx.utils.viewport.ScreenViewport;
|
||||
import com.badlogic.gdx.utils.viewport.Viewport;
|
||||
|
||||
import org.oscim.backend.GL;
|
||||
import org.oscim.core.Point;
|
||||
import org.oscim.gdx.GdxMapApp;
|
||||
|
||||
@@ -18,7 +18,6 @@
|
||||
package org.oscim.test;
|
||||
|
||||
import com.badlogic.gdx.Input;
|
||||
|
||||
import org.oscim.backend.CanvasAdapter;
|
||||
import org.oscim.backend.canvas.Color;
|
||||
import org.oscim.backend.canvas.Paint.Cap;
|
||||
|
||||
@@ -2,7 +2,6 @@ package org.oscim.test;
|
||||
|
||||
import com.badlogic.gdx.Gdx;
|
||||
import com.badlogic.gdx.Input;
|
||||
|
||||
import org.oscim.backend.canvas.Color;
|
||||
import org.oscim.core.GeometryBuffer;
|
||||
import org.oscim.gdx.GdxMapApp;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Copyright 2014 Hannes Janetzek
|
||||
* Copyright 2016-2018 devemux86
|
||||
* Copyright 2016-2019 devemux86
|
||||
*
|
||||
* This file is part of the OpenScienceMap project (http://www.opensciencemap.org).
|
||||
*
|
||||
@@ -38,7 +38,7 @@ import java.util.List;
|
||||
|
||||
public class LineTexTest extends GdxMapApp {
|
||||
|
||||
private static final boolean ANIMATION = false;
|
||||
private static final boolean ANIMATION = true;
|
||||
|
||||
private List<PathLayer> mPathLayers = new ArrayList<>();
|
||||
private TextureItem tex;
|
||||
|
||||
@@ -14,6 +14,8 @@
|
||||
*/
|
||||
package org.oscim.test;
|
||||
|
||||
import okhttp3.Cache;
|
||||
import okhttp3.OkHttpClient;
|
||||
import org.oscim.core.MapPosition;
|
||||
import org.oscim.gdx.GdxMapApp;
|
||||
import org.oscim.layers.tile.bitmap.BitmapTileLayer;
|
||||
@@ -29,9 +31,6 @@ import org.oscim.tiling.source.mvt.MapilionMvtTileSource;
|
||||
import java.io.File;
|
||||
import java.util.UUID;
|
||||
|
||||
import okhttp3.Cache;
|
||||
import okhttp3.OkHttpClient;
|
||||
|
||||
public class MapilionMvtTest extends GdxMapApp {
|
||||
|
||||
// Metered API key for demonstration purposes
|
||||
|
||||
@@ -15,7 +15,6 @@
|
||||
package org.oscim.test;
|
||||
|
||||
import com.badlogic.gdx.Input;
|
||||
|
||||
import org.oscim.gdx.GdxMapApp;
|
||||
import org.oscim.theme.StreamRenderTheme;
|
||||
import org.oscim.theme.XmlRenderThemeMenuCallback;
|
||||
|
||||
@@ -30,11 +30,7 @@ import org.oscim.map.Map;
|
||||
import org.oscim.renderer.BitmapRenderer;
|
||||
import org.oscim.renderer.ExtrusionRenderer;
|
||||
import org.oscim.renderer.GLViewport;
|
||||
import org.oscim.scalebar.DefaultMapScaleBar;
|
||||
import org.oscim.scalebar.ImperialUnitAdapter;
|
||||
import org.oscim.scalebar.MapScaleBar;
|
||||
import org.oscim.scalebar.MapScaleBarLayer;
|
||||
import org.oscim.scalebar.MetricUnitAdapter;
|
||||
import org.oscim.scalebar.*;
|
||||
import org.oscim.theme.VtmThemes;
|
||||
import org.oscim.tiling.source.mapfile.MapFileTileSource;
|
||||
import org.oscim.tiling.source.mapfile.MapInfo;
|
||||
|
||||
@@ -14,6 +14,8 @@
|
||||
*/
|
||||
package org.oscim.test;
|
||||
|
||||
import okhttp3.Cache;
|
||||
import okhttp3.OkHttpClient;
|
||||
import org.oscim.core.MapPosition;
|
||||
import org.oscim.gdx.GdxMapApp;
|
||||
import org.oscim.layers.tile.buildings.BuildingLayer;
|
||||
@@ -27,9 +29,6 @@ import org.oscim.tiling.source.geojson.MapzenGeojsonTileSource;
|
||||
import java.io.File;
|
||||
import java.util.UUID;
|
||||
|
||||
import okhttp3.Cache;
|
||||
import okhttp3.OkHttpClient;
|
||||
|
||||
public class MapzenGeojsonTest extends GdxMapApp {
|
||||
|
||||
private static final boolean USE_CACHE = false;
|
||||
|
||||
@@ -14,6 +14,8 @@
|
||||
*/
|
||||
package org.oscim.test;
|
||||
|
||||
import okhttp3.Cache;
|
||||
import okhttp3.OkHttpClient;
|
||||
import org.oscim.core.MapPosition;
|
||||
import org.oscim.gdx.GdxMapApp;
|
||||
import org.oscim.layers.tile.buildings.BuildingLayer;
|
||||
@@ -27,9 +29,6 @@ import org.oscim.tiling.source.mvt.MapzenMvtTileSource;
|
||||
import java.io.File;
|
||||
import java.util.UUID;
|
||||
|
||||
import okhttp3.Cache;
|
||||
import okhttp3.OkHttpClient;
|
||||
|
||||
public class MapzenMvtTest extends GdxMapApp {
|
||||
|
||||
private static final boolean USE_CACHE = false;
|
||||
|
||||
@@ -14,6 +14,8 @@
|
||||
*/
|
||||
package org.oscim.test;
|
||||
|
||||
import okhttp3.Cache;
|
||||
import okhttp3.OkHttpClient;
|
||||
import org.oscim.core.MapPosition;
|
||||
import org.oscim.gdx.GdxMapApp;
|
||||
import org.oscim.layers.tile.buildings.BuildingLayer;
|
||||
@@ -27,9 +29,6 @@ import org.oscim.tiling.source.geojson.NextzenGeojsonTileSource;
|
||||
import java.io.File;
|
||||
import java.util.UUID;
|
||||
|
||||
import okhttp3.Cache;
|
||||
import okhttp3.OkHttpClient;
|
||||
|
||||
public class NextzenGeojsonTest extends GdxMapApp {
|
||||
|
||||
private static final boolean USE_CACHE = false;
|
||||
|
||||
@@ -14,6 +14,8 @@
|
||||
*/
|
||||
package org.oscim.test;
|
||||
|
||||
import okhttp3.Cache;
|
||||
import okhttp3.OkHttpClient;
|
||||
import org.oscim.core.MapPosition;
|
||||
import org.oscim.gdx.GdxMapApp;
|
||||
import org.oscim.layers.tile.buildings.BuildingLayer;
|
||||
@@ -27,9 +29,6 @@ import org.oscim.tiling.source.mvt.NextzenMvtTileSource;
|
||||
import java.io.File;
|
||||
import java.util.UUID;
|
||||
|
||||
import okhttp3.Cache;
|
||||
import okhttp3.OkHttpClient;
|
||||
|
||||
public class NextzenMvtTest extends GdxMapApp {
|
||||
|
||||
private static final boolean USE_CACHE = false;
|
||||
|
||||
@@ -1,57 +0,0 @@
|
||||
/*
|
||||
* Copyright 2016-2018 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 org.oscim.gdx.GdxMapApp;
|
||||
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.theme.VtmThemes;
|
||||
import org.oscim.tiling.TileSource;
|
||||
import org.oscim.tiling.source.OkHttpEngine;
|
||||
import org.oscim.tiling.source.oscimap4.OSciMap4TileSource;
|
||||
|
||||
public class OSciMapS3DBTest extends GdxMapApp {
|
||||
|
||||
@Override
|
||||
public void createLayers() {
|
||||
TileSource tileSource = OSciMap4TileSource.builder()
|
||||
.httpFactory(new OkHttpEngine.OkHttpFactory())
|
||||
.build();
|
||||
VectorTileLayer l = mMap.setBaseMap(tileSource);
|
||||
mMap.setTheme(VtmThemes.DEFAULT);
|
||||
|
||||
TileSource ts = OSciMap4TileSource.builder()
|
||||
.httpFactory(new OkHttpEngine.OkHttpFactory())
|
||||
.url("http://opensciencemap.org/tiles/s3db")
|
||||
.zoomMin(16)
|
||||
.zoomMax(16)
|
||||
.build();
|
||||
|
||||
S3DBTileLayer tl = new S3DBTileLayer(mMap, ts);
|
||||
mMap.layers().add(tl);
|
||||
mMap.layers().add(new LabelLayer(mMap, l));
|
||||
|
||||
mMap.setMapPosition(53.08, 8.82, 1 << 17);
|
||||
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
init();
|
||||
run(new OSciMapS3DBTest());
|
||||
}
|
||||
}
|
||||
@@ -14,6 +14,8 @@
|
||||
*/
|
||||
package org.oscim.test;
|
||||
|
||||
import okhttp3.Cache;
|
||||
import okhttp3.OkHttpClient;
|
||||
import org.oscim.core.MapPosition;
|
||||
import org.oscim.gdx.GdxMapApp;
|
||||
import org.oscim.layers.tile.buildings.BuildingLayer;
|
||||
@@ -27,9 +29,6 @@ import org.oscim.tiling.source.mvt.OpenMapTilesMvtTileSource;
|
||||
import java.io.File;
|
||||
import java.util.UUID;
|
||||
|
||||
import okhttp3.Cache;
|
||||
import okhttp3.OkHttpClient;
|
||||
|
||||
public class OpenMapTilesMvtTest extends GdxMapApp {
|
||||
|
||||
private static final boolean USE_CACHE = false;
|
||||
|
||||
@@ -1,33 +0,0 @@
|
||||
/*
|
||||
* Copyright 2017 Longri
|
||||
* 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 org.oscim.gdx.GdxMapApp;
|
||||
import org.oscim.utils.Parameters;
|
||||
|
||||
public class POTTextureTest extends SimpleMapTest {
|
||||
|
||||
private POTTextureTest() {
|
||||
Parameters.POT_TEXTURES = true;
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
GdxMapApp.init();
|
||||
GdxMapApp.run(new POTTextureTest());
|
||||
}
|
||||
}
|
||||
@@ -1,79 +0,0 @@
|
||||
/*
|
||||
* Copyright 2016-2017 devemux86
|
||||
* Copyright 2017 Longri
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify it under the
|
||||
* terms of the GNU Lesser General Public License as published by the Free Software
|
||||
* Foundation, either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||
* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License along with
|
||||
* this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package org.oscim.test;
|
||||
|
||||
import org.oscim.gdx.GdxMapApp;
|
||||
import org.oscim.layers.marker.MarkerItem;
|
||||
|
||||
import java.util.Timer;
|
||||
import java.util.TimerTask;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
|
||||
public class RotateMarkerLayerTest extends MarkerLayerTest {
|
||||
|
||||
private Timer timer;
|
||||
private int markerCount = 0;
|
||||
|
||||
private void itemEvent(final MarkerItem item) {
|
||||
if (item.getMarker() == null) {
|
||||
item.setMarker(mFocusMarker);
|
||||
markerCount++;
|
||||
final AtomicInteger rotValue = new AtomicInteger(0);
|
||||
if (timer != null)
|
||||
timer.cancel();
|
||||
timer = new Timer();
|
||||
TimerTask timerTask = new TimerTask() {
|
||||
@Override
|
||||
public void run() {
|
||||
float value = (float) (rotValue.incrementAndGet() * 10);
|
||||
item.setRotation(value);
|
||||
if (rotValue.get() > 36)
|
||||
rotValue.set(0);
|
||||
mMarkerLayer.update();
|
||||
mMap.updateMap(true);
|
||||
}
|
||||
};
|
||||
timer.schedule(timerTask, 1000, 1000);
|
||||
|
||||
} else {
|
||||
item.setMarker(null);
|
||||
markerCount--;
|
||||
if (timer != null && markerCount == 0)
|
||||
timer.cancel();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onItemSingleTapUp(int index, MarkerItem item) {
|
||||
itemEvent(item);
|
||||
|
||||
System.out.println("Marker tap " + item.getTitle());
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onItemLongPress(int index, MarkerItem item) {
|
||||
itemEvent(item);
|
||||
|
||||
System.out.println("Marker long press " + item.getTitle());
|
||||
return true;
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
GdxMapApp.init();
|
||||
GdxMapApp.run(new RotateMarkerLayerTest());
|
||||
}
|
||||
}
|
||||
@@ -17,7 +17,6 @@
|
||||
package org.oscim.test;
|
||||
|
||||
import com.badlogic.gdx.Input;
|
||||
|
||||
import org.oscim.gdx.GdxMapApp;
|
||||
import org.oscim.layers.tile.vector.VectorTileLayer;
|
||||
import org.oscim.renderer.MapRenderer;
|
||||
|
||||
@@ -25,11 +25,7 @@ import org.oscim.layers.tile.vector.labeling.LabelLayer;
|
||||
import org.oscim.map.Map;
|
||||
import org.oscim.renderer.BitmapRenderer;
|
||||
import org.oscim.renderer.GLViewport;
|
||||
import org.oscim.scalebar.DefaultMapScaleBar;
|
||||
import org.oscim.scalebar.ImperialUnitAdapter;
|
||||
import org.oscim.scalebar.MapScaleBar;
|
||||
import org.oscim.scalebar.MapScaleBarLayer;
|
||||
import org.oscim.scalebar.MetricUnitAdapter;
|
||||
import org.oscim.scalebar.*;
|
||||
import org.oscim.theme.VtmThemes;
|
||||
import org.oscim.tiling.TileSource;
|
||||
import org.oscim.tiling.source.OkHttpEngine;
|
||||
|
||||
@@ -22,12 +22,8 @@ import org.oscim.core.MapPosition;
|
||||
import org.oscim.core.MercatorProjection;
|
||||
import org.oscim.event.Event;
|
||||
import org.oscim.gdx.GdxMapApp;
|
||||
import org.oscim.layers.tile.MapTile;
|
||||
import org.oscim.layers.tile.*;
|
||||
import org.oscim.layers.tile.MapTile.TileNode;
|
||||
import org.oscim.layers.tile.TileLoader;
|
||||
import org.oscim.layers.tile.TileManager;
|
||||
import org.oscim.layers.tile.TileSet;
|
||||
import org.oscim.layers.tile.VectorTileRenderer;
|
||||
import org.oscim.layers.tile.vector.VectorTileLayer;
|
||||
import org.oscim.layers.tile.vector.VectorTileLoader;
|
||||
import org.oscim.layers.tile.vector.labeling.LabelLayer;
|
||||
|
||||
@@ -20,13 +20,7 @@ import org.oscim.backend.GL;
|
||||
import org.oscim.backend.canvas.Color;
|
||||
import org.oscim.gdx.GdxMapApp;
|
||||
import org.oscim.layers.GenericLayer;
|
||||
import org.oscim.renderer.BucketRenderer;
|
||||
import org.oscim.renderer.BufferObject;
|
||||
import org.oscim.renderer.GLShader;
|
||||
import org.oscim.renderer.GLState;
|
||||
import org.oscim.renderer.GLUtils;
|
||||
import org.oscim.renderer.GLViewport;
|
||||
import org.oscim.renderer.MapRenderer;
|
||||
import org.oscim.renderer.*;
|
||||
import org.oscim.utils.FastMath;
|
||||
|
||||
import java.nio.FloatBuffer;
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
/*
|
||||
* Copyright 2014 Hannes Janetzek
|
||||
* Copyright 2016 devemux86
|
||||
* Copyright 2019 Izumi Kawashima
|
||||
*
|
||||
* This file is part of the OpenScienceMap project (http://www.opensciencemap.org).
|
||||
*
|
||||
@@ -19,9 +21,11 @@ package org.oscim.utils;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
import org.oscim.core.Box;
|
||||
import org.oscim.core.Point;
|
||||
import org.oscim.utils.SpatialIndex.SearchCb;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
@@ -39,11 +43,17 @@ public class RTreeTest {
|
||||
this.max = max.clone();
|
||||
}
|
||||
|
||||
Item(int xmin, int ymin, int xmax, int ymax, int val) {
|
||||
this.val = val;
|
||||
this.min = new double[]{xmin, ymin};
|
||||
this.max = new double[]{xmax, ymax};
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
// return val + "/"
|
||||
// + Arrays.toString(min) + "/"
|
||||
// + Arrays.toString(max);
|
||||
// return val + "/"
|
||||
// + Arrays.toString(min) + "/"
|
||||
// + Arrays.toString(max);
|
||||
return String.valueOf(val);
|
||||
}
|
||||
}
|
||||
@@ -314,8 +324,7 @@ public class RTreeTest {
|
||||
|
||||
int cnt = 0;
|
||||
|
||||
for (@SuppressWarnings("unused")
|
||||
Item it : t) {
|
||||
for (@SuppressWarnings("unused") Item it : t) {
|
||||
//System.out.println(it.val);
|
||||
cnt++;
|
||||
}
|
||||
@@ -326,6 +335,146 @@ public class RTreeTest {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Use values from https://github.com/mourner/rbush-knn/blob/master/test.js
|
||||
*/
|
||||
private List<Item> generateKnnTestFixture() {
|
||||
List<Item> items = new ArrayList<Item>();
|
||||
|
||||
items.add(new Item(87, 55, 87, 56, items.size()));
|
||||
items.add(new Item(38, 13, 39, 16, items.size()));
|
||||
items.add(new Item(7, 47, 8, 47, items.size()));
|
||||
items.add(new Item(89, 9, 91, 12, items.size()));
|
||||
items.add(new Item(4, 58, 5, 60, items.size()));
|
||||
items.add(new Item(0, 11, 1, 12, items.size()));
|
||||
items.add(new Item(0, 5, 0, 6, items.size()));
|
||||
items.add(new Item(69, 78, 73, 78, items.size()));
|
||||
|
||||
items.add(new Item(56, 77, 57, 81, items.size()));
|
||||
items.add(new Item(23, 7, 24, 9, items.size()));
|
||||
items.add(new Item(68, 24, 70, 26, items.size()));
|
||||
items.add(new Item(31, 47, 33, 50, items.size()));
|
||||
items.add(new Item(11, 13, 14, 15, items.size()));
|
||||
items.add(new Item(1, 80, 1, 80, items.size()));
|
||||
items.add(new Item(72, 90, 72, 91, items.size()));
|
||||
items.add(new Item(59, 79, 61, 83, items.size()));
|
||||
|
||||
items.add(new Item(98, 77, 101, 77, items.size()));
|
||||
items.add(new Item(11, 55, 14, 56, items.size()));
|
||||
items.add(new Item(98, 4, 100, 6, items.size()));
|
||||
items.add(new Item(21, 54, 23, 58, items.size()));
|
||||
items.add(new Item(44, 74, 48, 74, items.size()));
|
||||
items.add(new Item(70, 57, 70, 61, items.size()));
|
||||
items.add(new Item(32, 9, 33, 12, items.size()));
|
||||
items.add(new Item(43, 87, 44, 91, items.size()));
|
||||
|
||||
items.add(new Item(38, 60, 38, 60, items.size()));
|
||||
items.add(new Item(62, 48, 66, 50, items.size()));
|
||||
items.add(new Item(16, 87, 19, 91, items.size()));
|
||||
items.add(new Item(5, 98, 9, 99, items.size()));
|
||||
items.add(new Item(9, 89, 10, 90, items.size()));
|
||||
items.add(new Item(89, 2, 92, 6, items.size()));
|
||||
items.add(new Item(41, 95, 45, 98, items.size()));
|
||||
items.add(new Item(57, 36, 61, 40, items.size()));
|
||||
|
||||
items.add(new Item(50, 1, 52, 1, items.size()));
|
||||
items.add(new Item(93, 87, 96, 88, items.size()));
|
||||
items.add(new Item(29, 42, 33, 42, items.size()));
|
||||
items.add(new Item(34, 43, 36, 44, items.size()));
|
||||
items.add(new Item(41, 64, 42, 65, items.size()));
|
||||
items.add(new Item(87, 3, 88, 4, items.size()));
|
||||
items.add(new Item(56, 50, 56, 52, items.size()));
|
||||
items.add(new Item(32, 13, 35, 15, items.size()));
|
||||
|
||||
items.add(new Item(3, 8, 5, 11, items.size()));
|
||||
items.add(new Item(16, 33, 18, 33, items.size()));
|
||||
items.add(new Item(35, 39, 38, 40, items.size()));
|
||||
items.add(new Item(74, 54, 78, 56, items.size()));
|
||||
items.add(new Item(92, 87, 95, 90, items.size()));
|
||||
items.add(new Item(12, 97, 16, 98, items.size()));
|
||||
items.add(new Item(76, 39, 78, 40, items.size()));
|
||||
items.add(new Item(16, 93, 18, 95, items.size()));
|
||||
|
||||
items.add(new Item(62, 40, 64, 42, items.size()));
|
||||
items.add(new Item(71, 87, 71, 88, items.size()));
|
||||
items.add(new Item(60, 85, 63, 86, items.size()));
|
||||
items.add(new Item(39, 52, 39, 56, items.size()));
|
||||
items.add(new Item(15, 18, 19, 18, items.size()));
|
||||
items.add(new Item(91, 62, 94, 63, items.size()));
|
||||
items.add(new Item(10, 16, 10, 18, items.size()));
|
||||
items.add(new Item(5, 86, 8, 87, items.size()));
|
||||
|
||||
items.add(new Item(85, 85, 88, 86, items.size()));
|
||||
items.add(new Item(44, 84, 44, 88, items.size()));
|
||||
items.add(new Item(3, 94, 3, 97, items.size()));
|
||||
items.add(new Item(79, 74, 81, 78, items.size()));
|
||||
items.add(new Item(21, 63, 24, 66, items.size()));
|
||||
items.add(new Item(16, 22, 16, 22, items.size()));
|
||||
items.add(new Item(68, 97, 72, 97, items.size()));
|
||||
items.add(new Item(39, 65, 42, 65, items.size()));
|
||||
|
||||
items.add(new Item(51, 68, 52, 69, items.size()));
|
||||
items.add(new Item(61, 38, 61, 42, items.size()));
|
||||
items.add(new Item(31, 65, 31, 65, items.size()));
|
||||
items.add(new Item(16, 6, 19, 6, items.size()));
|
||||
items.add(new Item(66, 39, 66, 41, items.size()));
|
||||
items.add(new Item(57, 32, 59, 35, items.size()));
|
||||
items.add(new Item(54, 80, 58, 84, items.size()));
|
||||
items.add(new Item(5, 67, 7, 71, items.size()));
|
||||
|
||||
items.add(new Item(49, 96, 51, 98, items.size()));
|
||||
items.add(new Item(29, 45, 31, 47, items.size()));
|
||||
items.add(new Item(31, 72, 33, 74, items.size()));
|
||||
items.add(new Item(94, 25, 95, 26, items.size()));
|
||||
items.add(new Item(14, 7, 18, 8, items.size()));
|
||||
items.add(new Item(29, 0, 31, 1, items.size()));
|
||||
items.add(new Item(48, 38, 48, 40, items.size()));
|
||||
items.add(new Item(34, 29, 34, 32, items.size()));
|
||||
|
||||
items.add(new Item(99, 21, 100, 25, items.size()));
|
||||
items.add(new Item(79, 3, 79, 4, items.size()));
|
||||
items.add(new Item(87, 1, 87, 5, items.size()));
|
||||
items.add(new Item(9, 77, 9, 81, items.size()));
|
||||
items.add(new Item(23, 25, 25, 29, items.size()));
|
||||
items.add(new Item(83, 48, 86, 51, items.size()));
|
||||
items.add(new Item(79, 94, 79, 95, items.size()));
|
||||
items.add(new Item(33, 95, 33, 99, items.size()));
|
||||
|
||||
items.add(new Item(1, 14, 1, 14, items.size()));
|
||||
items.add(new Item(33, 77, 34, 77, items.size()));
|
||||
items.add(new Item(94, 56, 98, 59, items.size()));
|
||||
items.add(new Item(75, 25, 78, 26, items.size()));
|
||||
items.add(new Item(17, 73, 20, 74, items.size()));
|
||||
items.add(new Item(11, 3, 12, 4, items.size()));
|
||||
items.add(new Item(45, 12, 47, 12, items.size()));
|
||||
items.add(new Item(38, 39, 39, 39, items.size()));
|
||||
|
||||
items.add(new Item(99, 3, 103, 5, items.size()));
|
||||
items.add(new Item(41, 92, 44, 96, items.size()));
|
||||
items.add(new Item(79, 40, 79, 41, items.size()));
|
||||
items.add(new Item(29, 2, 29, 4, items.size()));
|
||||
|
||||
return items;
|
||||
}
|
||||
|
||||
@Test
|
||||
public void shouldWorkKnn() {
|
||||
List<Item> items = generateKnnTestFixture();
|
||||
|
||||
RTree<Item> t = new RTree<Item>();
|
||||
for (Item item : items)
|
||||
t.insert(item.min, item.max, item);
|
||||
|
||||
List<Item> result = t.searchKNearestNeighbors(new Point(40, 40), 10, Double.POSITIVE_INFINITY, null);
|
||||
Assert.assertEquals(10, result.size());
|
||||
|
||||
result = t.searchKNearestNeighbors(new Point(40, 40), 10, 17, null);
|
||||
Assert.assertEquals(10, result.size());
|
||||
|
||||
result = t.searchKNearestNeighbors(new Point(40, 60), 90, Double.POSITIVE_INFINITY, result);
|
||||
Assert.assertEquals(90, result.size());
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
RTreeTest t = new RTreeTest();
|
||||
t.shouldWork2();
|
||||
|
||||
@@ -8,7 +8,7 @@ configurations.all {
|
||||
*/
|
||||
|
||||
dependencies {
|
||||
implementation project(':vtm-desktop')
|
||||
implementation project(':vtm-desktop-lwjgl')
|
||||
file("${rootDir}/vtm-desktop/natives").eachDir() { dir ->
|
||||
implementation files(dir.path)
|
||||
}
|
||||
|
||||
@@ -15,10 +15,10 @@
|
||||
*/
|
||||
package org.oscim.theme.comparator;
|
||||
|
||||
import ch.qos.logback.classic.LoggerContext;
|
||||
import com.badlogic.gdx.utils.SharedLibraryLoader;
|
||||
import com.jtattoo.plaf.DecorationHelper;
|
||||
import com.jtattoo.plaf.hifi.HiFiLookAndFeel;
|
||||
|
||||
import org.oscim.awt.AwtGraphics;
|
||||
import org.oscim.backend.DateTime;
|
||||
import org.oscim.backend.DateTimeAdapter;
|
||||
@@ -32,18 +32,11 @@ import org.oscim.theme.comparator.logging.VtmAppender;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.util.Properties;
|
||||
import java.util.prefs.BackingStoreException;
|
||||
import java.util.prefs.Preferences;
|
||||
|
||||
import javax.swing.ImageIcon;
|
||||
import javax.swing.JFrame;
|
||||
import javax.swing.JRootPane;
|
||||
import javax.swing.SwingUtilities;
|
||||
import javax.swing.UIManager;
|
||||
|
||||
import ch.qos.logback.classic.LoggerContext;
|
||||
|
||||
public class Main {
|
||||
|
||||
public static Preferences prefs = Preferences.userNodeForPackage(Main.class);
|
||||
|
||||
@@ -45,7 +45,8 @@
|
||||
<!--references-->
|
||||
<style-text style="bold" fill="#606060" id="ref" k="ref" priority="2" size="12" stroke="#ffffff"
|
||||
stroke-width="2.0" />
|
||||
<style-text caption="true" id="ref-caption" use="ref" />
|
||||
<style-text caption="true" style="bold" fill="#ffffff" id="ref-caption" k="ref" priority="2"
|
||||
size="12" bg-fill="#45a976" />
|
||||
<!--ferry-->
|
||||
<style-text style="bold" fill="#606060" id="ferry" k="name" size="12" stroke="#ffffff"
|
||||
stroke-width="2.0" />
|
||||
|
||||
@@ -25,7 +25,8 @@
|
||||
|
||||
<style-text style="bold" fill="#606060" id="ref" k="ref" priority="2" size="12" stroke="#ffffff"
|
||||
stroke-width="2.0" />
|
||||
<style-text caption="true" id="ref-caption" use="ref" />
|
||||
<style-text caption="true" style="bold" fill="#ffffff" id="ref-caption" k="ref" priority="2"
|
||||
size="12" bg-fill="#45a976" />
|
||||
|
||||
<style-text style="bold" fill="#606060" id="ferry" k="name" size="12" stroke="#ffffff"
|
||||
stroke-width="2.0" />
|
||||
|
||||
@@ -35,7 +35,8 @@
|
||||
<!--references-->
|
||||
<style-text style="bold" fill="#606060" id="ref" k="ref" priority="2" size="12" stroke="#ffffff"
|
||||
stroke-width="2.0" />
|
||||
<style-text caption="true" id="ref-caption" use="ref" />
|
||||
<style-text caption="true" style="bold" fill="#ffffff" id="ref-caption" k="ref" priority="2"
|
||||
size="12" bg-fill="#45a976" />
|
||||
|
||||
|
||||
<!--###### AREA styles ######-->
|
||||
|
||||
@@ -40,7 +40,8 @@
|
||||
<!--references-->
|
||||
<style-text style="bold" fill="#606060" id="ref" k="ref" priority="2" size="12" stroke="#ffffff"
|
||||
stroke-width="2.0" />
|
||||
<style-text caption="true" id="ref-caption" use="ref" />
|
||||
<style-text caption="true" style="bold" fill="#ffffff" id="ref-caption" k="ref" priority="2"
|
||||
size="12" bg-fill="#45a976" />
|
||||
<!--ferry-->
|
||||
<style-text style="bold" fill="#606060" id="ferry" k="name" size="12" stroke="#ffffff"
|
||||
stroke-width="2.0" />
|
||||
|
||||
@@ -34,7 +34,8 @@
|
||||
<!--references-->
|
||||
<style-text style="bold" fill="#606060" id="ref" k="ref" priority="2" size="12" stroke="#ffffff"
|
||||
stroke-width="2.0" />
|
||||
<style-text caption="true" id="ref-caption" use="ref" />
|
||||
<style-text caption="true" style="bold" fill="#ffffff" id="ref-caption" k="ref" priority="2"
|
||||
size="12" bg-fill="#5b5b5b" />
|
||||
|
||||
|
||||
<!--###### AREA styles ######-->
|
||||
|
||||
@@ -34,7 +34,8 @@
|
||||
<!--references-->
|
||||
<style-text style="bold" fill="#606060" id="ref" k="ref" priority="2" size="12" stroke="#ffffff"
|
||||
stroke-width="2.0" />
|
||||
<style-text caption="true" id="ref-caption" use="ref" />
|
||||
<style-text caption="true" style="bold" fill="#ffffff" id="ref-caption" k="ref" priority="2"
|
||||
size="12" bg-fill="#007f00" />
|
||||
|
||||
|
||||
<!--###### AREA styles ######-->
|
||||
|
||||
@@ -35,7 +35,8 @@
|
||||
<!--references-->
|
||||
<style-text style="bold" fill="#606060" id="ref" k="ref" priority="2" size="12" stroke="#ffffff"
|
||||
stroke-width="2.0" />
|
||||
<style-text caption="true" id="ref-caption" use="ref" />
|
||||
<style-text caption="true" style="bold" fill="#ffffff" id="ref-caption" k="ref" priority="2"
|
||||
size="12" bg-fill="#45a976" />
|
||||
|
||||
|
||||
<!--###### AREA styles ######-->
|
||||
|
||||
@@ -3,7 +3,7 @@ buildscript {
|
||||
jcenter()
|
||||
}
|
||||
dependencies {
|
||||
classpath 'de.richsource.gradle.plugins:gwt-gradle-plugin:0.6'
|
||||
classpath 'org.wisepersist:gwt-gradle-plugin:1.0.13'
|
||||
classpath 'org.akhikhl.gretty:gretty:2.0.0'
|
||||
}
|
||||
}
|
||||
@@ -41,7 +41,7 @@ gwt {
|
||||
noPrecompile = true
|
||||
}
|
||||
compiler {
|
||||
enableClosureCompiler = false // activates -XenableClosureCompiler
|
||||
//enableClosureCompiler = false // activates -XenableClosureCompiler
|
||||
disableClassMetadata = true // activates -XdisableClassMetadata
|
||||
disableCastChecking = true // activates -XdisableCastChecking
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user