64 Commits

Author SHA1 Message Date
Emux
bf6b325ce8 0.13.0 2020-01-12 15:31:31 +02:00
Emux
b43dfc53e4 Gradle: declare UTF-8 encoding for Java compile 2020-01-02 15:06:47 +02:00
Emux
883ed23272 Merge pull request #759 from mapsforge/themes
Render themes: avoid patterns and textures because of old GPU issues
2019-12-25 13:58:17 +02:00
Emux
0a0c2b3ce0 Render themes: avoid patterns and textures because of old GPU issues 2019-12-25 13:36:42 +02:00
Emux
c783255b97 Mapsforge: reduce points on-the-fly while reading from map files (except lines) #757 2019-12-17 17:54:27 +02:00
Emux
c689ad9e67 Merge pull request #758 from mapsforge/cap
Fix stroke cap line ending
2019-12-15 15:40:48 +02:00
Emux
0fabe4c738 Update changelog 2019-12-15 15:39:49 +02:00
Emux
d4a95dad19 Fix stroke cap line ending 2019-12-15 15:30:02 +02:00
Emux
4405b6235a AwtPaint: use round as default cap / join, like Mapsforge #92 2019-12-15 15:14:34 +02:00
Emux
766b0d9914 Mapsforge: reduce points on-the-fly while reading from map files (improvements) #757 2019-12-14 15:29:26 +02:00
Emux
412cacd1c2 Merge pull request #757 from mapsforge/mapsforge
Mapsforge: reduce points on-the-fly while reading from map files
2019-12-12 12:55:49 +02:00
Emux
299592d352 Update changelog 2019-12-12 12:53:30 +02:00
Emux
d512731d06 Mapsforge: reduce points on-the-fly while reading from map files 2019-12-12 12:26:19 +02:00
Emux
b2a8d3040a Render themes: area outlines as separate lines #121 2019-12-11 15:00:12 +02:00
Emux
892ea92580 Render themes: revert tessellation in water areas except sea #224 2019-12-11 12:37:03 +02:00
Emux
f7acfd9017 Samples improvements 2019-12-10 13:26:31 +02:00
Emux
701ac43746 Update Mapsforge-Maps.md 2019-12-09 14:58:18 +02:00
Emux
b926310296 Update Android Gradle plugin (#755) 2019-12-07 16:46:06 +02:00
Carlos Alberto Martínez Gadea
49d1e7bafc ItemizedLayer: Added a check that prevents Gestures from being processed if the Layer is not enabled (#754) 2019-12-04 11:18:08 +02:00
Emux
6f697ed6f8 Update changelog 2019-12-02 11:23:39 +02:00
Justus Schmidt
cdcae29ae1 Mapsforge: Move tileprojection to convert E6 int directly to tile coordinates (#752) 2019-12-02 11:10:01 +02:00
Emux
a13c4a3793 Merge pull request #753 from mapsforge/bitmap
AndroidGraphics: drawable to bitmap for Android >= 9
2019-11-30 15:43:19 +02:00
Emux
031a3bfa00 Android samples: simplify bitmap reading 2019-11-30 15:24:27 +02:00
Emux
7122e1fbc5 AndroidGraphics: drawable to bitmap for Android >= 9 2019-11-30 15:17:14 +02:00
Emux
6ed00d9a94 Style.Builder: make strokeColor public 2019-11-20 20:23:26 +02:00
Emux
327d6f1466 Animator: smooth scaling 2019-11-12 17:54:27 +02:00
Emux
17a135813b Update Android Gradle plugin 2019-11-08 10:02:55 +02:00
Emux
0dd82cb68f MapScaleBar: fix scaling 2019-11-05 15:03:18 +02:00
Emux
ae04fa83f6 MapScaleBar: minor code improvements 2019-11-04 18:26:34 +02:00
Emux
4bfcdadb76 MapScaleBar: minor optimization 2019-11-04 13:41:05 +02:00
Emux
fa5a72f20d MercatorProjection: minor code improvements 2019-11-04 13:39:45 +02:00
Emux
d81eb3d706 LocationRenderer: keep the position for which the overlay is compiled 2019-10-29 10:00:40 +02:00
Emux
97332e3e73 Merge pull request #750 from mapsforge/location
Location texture renderer: rewrite and optimize
2019-10-25 11:50:25 +03:00
Emux
e4a4857eb8 Update changelog 2019-10-25 11:50:03 +03:00
Emux
80018de754 Location texture renderer: rewrite and optimize 2019-10-25 11:43:51 +03:00
Emux
01bb7ca074 Merge pull request #749 from mapsforge/opengl
Android: OpenGL ES 2.0 default for performance / stability
2019-10-25 11:17:43 +03:00
Emux
a8f5eee505 Update changelog 2019-10-25 11:16:37 +03:00
Emux
644cf9dcb6 Android: OpenGL ES 2.0 default for performance / stability 2019-10-25 11:03:33 +03:00
Emux
cb0109ba42 Samples: use Mapsforge release version 2019-10-23 19:04:42 +03:00
Emux
2fa5afec11 Layers: make updateLayers public 2019-10-23 18:59:45 +03:00
Emux
69ea1e414a Location shader improvements 2019-10-22 18:21:43 +03:00
Emux
4866abe38e Merge pull request #748 from mapsforge/location
Location renderers: allow fixed center position
2019-10-18 14:12:33 +03:00
Emux
4c10d5848b Location renderers: allow fixed center position 2019-10-17 15:00:53 +03:00
Emux
faed3d05a5 VectorLayer: hide non usable add(Geometry, Style) method 2019-10-17 11:10:26 +03:00
Emux
88a9a9ee7f Polygon labels: use centroid position if available #734 2019-10-04 18:24:14 +03:00
Emux
3915e3343d Merge pull request #745 from Gustl22/s3db_profile
S3DB: shape profiles as constants
2019-10-04 10:10:36 +03:00
Gustl22
b22c023f1a S3DB: shape profiles as constants 2019-10-03 16:48:55 +02:00
Emux
5de7c9ec38 Update Android Gradle plugin 2019-10-03 09:39:10 +03:00
Gustl22
14c485914c S3DB: roof shape profiles (#744) 2019-10-03 09:32:57 +03:00
Emux
c20922b5f5 Tile decoders refactoring 2019-10-01 18:48:10 +03:00
Emux
1294ff9fea Symbols on lines doc improvements #743 2019-10-01 09:41:58 +03:00
Emux
992d9c8e66 Samples improvements 2019-09-30 20:03:15 +03:00
Emux
948449b3ec Fix Android samples on old Android 2019-09-29 15:09:46 +03:00
Emux
0c1c06c1bb Allow threaded system initialization 2019-09-28 22:36:17 +03:00
Emux
7ad3f4a0b1 Merge pull request #743 from mapsforge/symbol
Render themes - symbols on lines: add billboard, rotate options
2019-09-28 19:45:05 +03:00
Emux
c5836adc17 Update changelog 2019-09-28 19:44:29 +03:00
Emux
107a429517 Render themes: use symbols on lines for oneways 2019-09-28 19:38:54 +03:00
Emux
2cb0a80c47 LineStyle, SymbolStyle: use scale on repeat values 2019-09-28 19:38:22 +03:00
Emux
db9f83120a Render themes - symbols on lines: add billboard, rotate options 2019-09-28 18:50:20 +03:00
Emux
5facdb9888 XmlThemeBuilder: disable mipmap for sharper rendering 2019-09-28 18:29:47 +03:00
Emux
3f3caa1912 Update changelog 2019-09-23 19:39:33 +03:00
Emux
03b9f224b2 Render themes: improve nature park & reserve rendering 2019-09-23 19:17:52 +03:00
Emux
c013465d49 Render themes: improve nature reserve rendering 2019-09-23 18:39:52 +03:00
Emux
c91833519e Update dependencies 2019-09-18 21:11:15 +03:00
86 changed files with 1270 additions and 1025 deletions

View File

@@ -4,7 +4,7 @@ buildscript {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.5.0'
classpath 'com.android.tools.build:gradle:3.5.3'
classpath 'com.github.dcendents:android-maven-gradle-plugin:2.1'
}
}
@@ -17,7 +17,7 @@ allprojects {
ext.androidBuildVersionTools = "29.0.2"
ext.gdxVersion = "1.9.10"
ext.gwtVersion = "2.8.2"
ext.slf4jVersion = "1.7.25"
ext.slf4jVersion = "1.7.28"
if (JavaVersion.current().isJava8Compatible()) {
tasks.withType(Javadoc) {
@@ -44,12 +44,12 @@ subprojects {
google()
maven { url 'https://repo.boundlessgeo.com/main/' }
jcenter()
maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
maven { url 'https://jitpack.io' }
}
tasks.withType(JavaCompile) {
sourceCompatibility = JavaVersion.VERSION_1_7
targetCompatibility = JavaVersion.VERSION_1_7
options.encoding = 'UTF-8'
}
}

View File

@@ -1,5 +1,20 @@
# Changelog
## Version 0.13.0 (2020-01-12)
- Render themes: symbols on lines with billboard / rotation [#743](https://github.com/mapsforge/vtm/pull/743)
- Location texture renderer: rewrite and optimize [#750](https://github.com/mapsforge/vtm/pull/750)
- Fix stroke cap line ending [#758](https://github.com/mapsforge/vtm/pull/758)
- Mapsforge: fix ways precision loss [#752](https://github.com/mapsforge/vtm/pull/752)
- Mapsforge: additional simplification [#757](https://github.com/mapsforge/vtm/pull/757)
- `Parameters.SIMPLIFICATION_TOLERANCE`
- Android: OpenGL ES 2.0 default for performance / stability [#749](https://github.com/mapsforge/vtm/pull/749)
- `MapView.OPENGL_VERSION`
- Android: threaded system initialization
- `Parameters.THREADED_INIT`
- Many other minor improvements and bug fixes
- [Solved issues](https://github.com/mapsforge/vtm/issues?q=is%3Aclosed+milestone%3A0.13.0)
## Version 0.12.0 (2019-09-17)
- MBTiles vector tile source (Android) [#740](https://github.com/mapsforge/vtm/pull/740)

View File

@@ -10,7 +10,7 @@ Current version is [![Maven Central](https://img.shields.io/maven-central/v/org.
```groovy
implementation 'org.mapsforge:vtm:[CURRENT-VERSION]'
implementation 'org.mapsforge:vtm-themes:[CURRENT-VERSION]'
implementation 'org.slf4j:slf4j-api:1.7.25'
implementation 'org.slf4j:slf4j-api:1.7.28'
```
### Android
@@ -20,7 +20,7 @@ implementation 'org.mapsforge:vtm-android:[CURRENT-VERSION]:natives-armeabi-v7a'
implementation 'org.mapsforge:vtm-android:[CURRENT-VERSION]:natives-arm64-v8a'
implementation 'org.mapsforge:vtm-android:[CURRENT-VERSION]:natives-x86'
implementation 'org.mapsforge:vtm-android:[CURRENT-VERSION]:natives-x86_64'
implementation 'com.caverock:androidsvg:1.3'
implementation 'com.caverock:androidsvg:1.4'
```
### Android (libGDX)
@@ -38,7 +38,7 @@ 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.10'
implementation 'com.badlogicgames.gdx:gdx-backend-android:1.9.10'
implementation 'com.caverock:androidsvg:1.3'
implementation 'com.caverock:androidsvg:1.4'
```
### iOS
@@ -59,12 +59,12 @@ implementation 'org.mapsforge:vtm-desktop:[CURRENT-VERSION]:natives-windows'
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 'com.badlogicgames.gdx:gdx-backend-lwjgl:1.9.10'
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'
@@ -73,25 +73,28 @@ implementation 'org.lwjgl.lwjgl:lwjgl-platform:2.9.3:natives-windows'
### 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'
implementation 'com.badlogicgames.gdx:gdx-backend-lwjgl3:1.9.10'
implementation 'org.lwjgl:lwjgl:3.2.3'
implementation 'org.lwjgl:lwjgl:3.2.3:natives-linux'
implementation 'org.lwjgl:lwjgl:3.2.3:natives-macos'
implementation 'org.lwjgl:lwjgl:3.2.3:natives-windows'
```
### JTS geometries
```groovy
implementation 'org.mapsforge:vtm-jts:[CURRENT-VERSION]'
implementation 'org.locationtech.jts:jts-core:1.15.0'
// https://github.com/locationtech/jts/issues/145
implementation 'org.locationtech.jts:jts-core:1.15.1'
```
### Online tiles
```groovy
implementation 'org.mapsforge:vtm-http:[CURRENT-VERSION]'
implementation 'com.squareup.okhttp3:okhttp:3.8.0'
implementation 'com.squareup.okio:okio:1.13.0'
// https://github.com/square/okhttp/issues/4481
implementation 'com.squareup.okhttp3:okhttp:3.12.5'
implementation 'com.squareup.okio:okio:1.15.0'
```
### MBTiles (Android)
@@ -99,27 +102,29 @@ implementation 'com.squareup.okio:okio:1.13.0'
```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'
implementation 'com.google.protobuf:protobuf-java:3.6.1'
implementation 'com.wdtinc:mapbox-vector-tile:3.1.0'
// https://github.com/locationtech/jts/issues/145
implementation 'org.locationtech.jts:jts-core:1.15.1'
```
### Mapbox vector tiles
```groovy
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'
implementation 'com.google.protobuf:protobuf-java:3.6.1'
implementation 'com.wdtinc:mapbox-vector-tile:3.1.0'
// https://github.com/locationtech/jts/issues/145
implementation 'org.locationtech.jts:jts-core:1.15.1'
```
### GeoJSON vector tiles
```groovy
implementation 'org.mapsforge:vtm-json:[CURRENT-VERSION]'
implementation 'com.fasterxml.jackson.core:jackson-annotations:2.8.4'
implementation 'com.fasterxml.jackson.core:jackson-core:2.8.4'
implementation 'com.fasterxml.jackson.core:jackson-databind:2.8.4'
implementation 'com.fasterxml.jackson.core:jackson-annotations:2.9.9'
implementation 'com.fasterxml.jackson.core:jackson-core:2.9.9'
implementation 'com.fasterxml.jackson.core:jackson-databind:2.9.9'
```
### jeo (indoor maps)

View File

@@ -3,9 +3,9 @@
- [AndroidMaps](http://www.androidmaps.co.uk/)
- [Freizeitkarte](http://www.freizeitkarte-osm.de/android/en/index.html)
- [Kurviger](https://offline-maps.kurviger.de/)
- [Locusvectormaps](http://www.locusvectormaps.com)
- [Mapsforge](http://download.mapsforge.org/)
- [OpenAndroMaps](http://www.openandromaps.org/en/)
- [OpenMaps](http://openmaps.eu/)
- [vector.city](https://vector.city/)
You know a Mapsforge map provider that is missing here? Please inform us by sending a message via our public [forum](https://groups.google.com/group/mapsforge-dev).

View File

@@ -237,9 +237,13 @@
<xs:attribute name="symbol-width" type="xs:positiveInteger" use="optional" />
<xs:attribute name="symbol-height" type="xs:positiveInteger" use="optional" />
<xs:attribute name="symbol-percent" type="xs:positiveInteger" use="optional" />
<!-- symbols on lines -->
<xs:attribute name="billboard" default="false" type="xs:boolean" use="optional" />
<xs:attribute name="repeat" default="false" type="xs:boolean" use="optional" />
<xs:attribute name="repeat-gap" default="200" type="xs:float" use="optional" />
<xs:attribute name="repeat-start" default="30" type="xs:float" use="optional" />
<xs:attribute name="rotate" default="true" type="xs:boolean" use="optional" />
</xs:complexType>
<xs:complexType name="extrusion">

View File

@@ -7,6 +7,9 @@
<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"
android:maxSdkVersion="18" />
<application
android:allowBackup="true"

View File

@@ -1,12 +1,5 @@
apply plugin: 'com.android.application'
/*
configurations.all {
// Check latest snapshot on every build
resolutionStrategy.cacheChangingModulesFor 0, 'seconds'
}
*/
dependencies {
implementation project(':vtm-android')
implementation project(':vtm-android-mvt')
@@ -23,11 +16,11 @@ dependencies {
implementation project(':vtm-gdx')
implementation project(':vtm-gdx-poi3d')
implementation 'org.mapsforge:mapsforge-poi-android:master-SNAPSHOT'
implementation 'org.mapsforge:sqlite-android:master-SNAPSHOT:natives-armeabi-v7a'
implementation 'org.mapsforge:sqlite-android:master-SNAPSHOT:natives-arm64-v8a'
implementation 'org.mapsforge:sqlite-android:master-SNAPSHOT:natives-x86'
implementation 'org.mapsforge:sqlite-android:master-SNAPSHOT:natives-x86_64'
implementation 'org.mapsforge:mapsforge-poi-android:0.13.0'
implementation 'org.mapsforge:sqlite-android:0.13.0:natives-armeabi-v7a'
implementation 'org.mapsforge:sqlite-android:0.13.0:natives-arm64-v8a'
implementation 'org.mapsforge:sqlite-android:0.13.0:natives-x86'
implementation 'org.mapsforge:sqlite-android:0.13.0:natives-x86_64'
}
android {

View File

@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns="http://www.w3.org/2000/svg" height="580" width="580" version="1.0" xmlns:cc="http://creativecommons.org/ns#" xmlns:dc="http://purl.org/dc/elements/1.1/">
<title>other</title>
<metadata>
<rdf:RDF>
<cc:Work rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type rdf:resource="http://purl.org/dc/dcmitype/StillImage"/>
<dc:title>other</dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
<circle opacity=".8" cx="290" cy="290" r="145" fill="#fff"/>
<circle cy="290" cx="290" r="116" fill="#0092DA"/>
</svg>

After

Width:  |  Height:  |  Size: 651 B

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2016-2018 devemux86
* Copyright 2016-2019 devemux86
* Copyright 2017 nebular
*
* This program is free software: you can redistribute it and/or modify it under the
@@ -15,16 +15,12 @@
*/
package org.oscim.android.test;
import android.graphics.BitmapFactory;
import org.oscim.android.canvas.AndroidBitmap;
import org.oscim.backend.canvas.Bitmap;
import org.oscim.backend.canvas.Color;
import org.oscim.core.GeoPoint;
import org.oscim.layers.marker.ClusterMarkerRenderer;
import org.oscim.layers.marker.ItemizedLayer;
import org.oscim.layers.marker.MarkerItem;
import org.oscim.layers.marker.MarkerLayer;
import org.oscim.layers.marker.MarkerRenderer;
import org.oscim.layers.marker.MarkerRendererFactory;
import org.oscim.layers.marker.MarkerSymbol;
import org.oscim.layers.marker.*;
import org.oscim.layers.tile.bitmap.BitmapTileLayer;
import org.oscim.tiling.TileSource;
import org.oscim.tiling.source.OkHttpEngine;
@@ -33,8 +29,6 @@ import org.oscim.tiling.source.bitmap.DefaultSources;
import java.util.ArrayList;
import java.util.List;
import static org.oscim.android.canvas.AndroidGraphics.drawableToBitmap;
public class ClusterMarkerOverlayActivity extends MarkerOverlayActivity {
private static final int COUNT = 5;
@@ -50,7 +44,7 @@ public class ClusterMarkerOverlayActivity extends MarkerOverlayActivity {
.build();
mMap.layers().add(new BitmapTileLayer(mMap, tileSource));
Bitmap bitmapPoi = drawableToBitmap(getResources().getDrawable(R.drawable.marker_poi));
Bitmap bitmapPoi = new AndroidBitmap(BitmapFactory.decodeResource(getResources(), R.drawable.marker_poi));
final MarkerSymbol symbol;
if (BILLBOARDS)
symbol = new MarkerSymbol(bitmapPoi, MarkerSymbol.HotspotPlace.BOTTOM_CENTER);

View File

@@ -48,7 +48,7 @@ public class LineTexActivity extends BitmapTileActivity {
TextureItem tex = null;
try {
tex = new TextureItem(CanvasAdapter.getBitmapAsset("", "patterns/pike.png"));
tex.mipmap = true;
//tex.mipmap = true;
} catch (IOException e) {
e.printStackTrace();
}

View File

@@ -24,8 +24,10 @@ import android.os.Build;
import android.os.Bundle;
import org.oscim.core.MapPosition;
import org.oscim.layers.LocationLayer;
import org.oscim.renderer.LocationCallback;
public class LocationActivity extends BitmapTileActivity implements LocationListener {
private Location location;
private LocationLayer locationLayer;
private LocationManager locationManager;
private final MapPosition mapPosition = new MapPosition();
@@ -37,7 +39,17 @@ public class LocationActivity extends BitmapTileActivity implements LocationList
locationManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
locationLayer = new LocationLayer(mMap);
locationLayer.locationRenderer.setShader("location_1_reverse");
locationLayer.locationRenderer.setCallback(new LocationCallback() {
@Override
public boolean hasRotation() {
return location != null && location.hasBearing();
}
@Override
public float getRotation() {
return location != null && location.hasBearing() ? location.getBearing() : 0;
}
});
locationLayer.setEnabled(false);
mMap.layers().add(locationLayer);
}
@@ -66,6 +78,7 @@ public class LocationActivity extends BitmapTileActivity implements LocationList
@Override
public void onLocationChanged(Location location) {
this.location = location;
locationLayer.setEnabled(true);
locationLayer.setPosition(location.getLatitude(), location.getLongitude(), location.getAccuracy());

View File

@@ -25,18 +25,16 @@ 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;
import org.oscim.core.MapPosition;
import org.oscim.layers.LocationTextureLayer;
import org.oscim.renderer.atlas.TextureAtlas;
import org.oscim.renderer.atlas.TextureRegion;
import org.oscim.renderer.bucket.TextureItem;
import org.oscim.renderer.LocationCallback;
import org.oscim.utils.IOUtils;
import java.io.IOException;
import java.io.InputStream;
public class LocationTextureActivity extends BitmapTileActivity implements LocationListener {
private Location location;
private LocationTextureLayer locationLayer;
private LocationManager locationManager;
private final MapPosition mapPosition = new MapPosition();
@@ -47,34 +45,41 @@ public class LocationTextureActivity extends BitmapTileActivity implements Locat
locationManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
// load a Bitmap/SVG from resources
InputStream is = null;
Bitmap bmp = null;
Bitmap bitmapArrow = null;
try {
is = getResources().openRawResource(R.raw.arrow);
float scale = CanvasAdapter.getScale();
bmp = CanvasAdapter.decodeSvgBitmap(is, (int) (60 * scale), (int) (60 * scale), 100);
bitmapArrow = CanvasAdapter.decodeSvgBitmap(is, (int) (48 * CanvasAdapter.getScale()), (int) (48 * CanvasAdapter.getScale()), 100);
} catch (IOException e) {
e.printStackTrace();
} finally {
IOUtils.closeQuietly(is);
}
// create TextureRegion from Bitmap
TextureRegion textureRegion = new TextureRegion(new TextureItem(bmp), new TextureAtlas.Rect(0, 0, bmp.getWidth(), bmp.getHeight()));
Bitmap bitmapMarker = null;
try {
is = getResources().openRawResource(R.raw.marker);
bitmapMarker = CanvasAdapter.decodeSvgBitmap(is, (int) (48 * CanvasAdapter.getScale()), (int) (48 * CanvasAdapter.getScale()), 100);
} catch (IOException e) {
e.printStackTrace();
} finally {
IOUtils.closeQuietly(is);
}
// create LocationTextureLayer with created/loaded TextureRegion
locationLayer = new LocationTextureLayer(mMap, textureRegion);
// set color of accuracy circle (Color.BLUE is default)
locationLayer.locationRenderer.setAccuracyColor(Color.get(50, 50, 255));
// set color of indicator circle (Color.RED is default)
locationLayer.locationRenderer.setIndicatorColor(Color.MAGENTA);
// set billboard rendering for TextureRegion (false is default)
locationLayer.locationRenderer.setBillboard(false);
locationLayer = new LocationTextureLayer(mMap);
locationLayer.locationRenderer.setBitmapArrow(bitmapArrow);
locationLayer.locationRenderer.setBitmapMarker(bitmapMarker);
locationLayer.locationRenderer.setCallback(new LocationCallback() {
@Override
public boolean hasRotation() {
return location != null && location.hasBearing();
}
@Override
public float getRotation() {
return location != null && location.hasBearing() ? location.getBearing() : 0;
}
});
locationLayer.setEnabled(false);
mMap.layers().add(locationLayer);
}
@@ -103,8 +108,9 @@ public class LocationTextureActivity extends BitmapTileActivity implements Locat
@Override
public void onLocationChanged(Location location) {
this.location = location;
locationLayer.setEnabled(true);
locationLayer.setPosition(location.getLatitude(), location.getLongitude(), location.getBearing(), location.getAccuracy());
locationLayer.setPosition(location.getLatitude(), location.getLongitude(), location.getAccuracy());
// Follow location
mMap.getMapPosition(mapPosition);

View File

@@ -14,8 +14,11 @@
*/
package org.oscim.android.test;
import android.os.Build;
import android.os.Bundle;
import okhttp3.CipherSuite;
import okhttp3.ConnectionSpec;
import okhttp3.OkHttpClient;
import org.oscim.android.cache.TileCache;
import org.oscim.layers.tile.bitmap.BitmapTileLayer;
import org.oscim.layers.tile.buildings.BuildingLayer;
@@ -27,6 +30,10 @@ import org.oscim.tiling.source.UrlTileSource;
import org.oscim.tiling.source.bitmap.DefaultSources;
import org.oscim.tiling.source.mvt.MapilionMvtTileSource;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
public class MapilionMvtActivity extends MapActivity {
// Metered API key for demonstration purposes
@@ -40,7 +47,23 @@ public class MapilionMvtActivity extends MapActivity {
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
OkHttpEngine.OkHttpFactory factory = new OkHttpEngine.OkHttpFactory();
OkHttpClient.Builder builder = new OkHttpClient.Builder();
// https://github.com/square/okhttp/issues/4053
if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.KITKAT) {
List<CipherSuite> cipherSuites = new ArrayList<>();
List<CipherSuite> modernTlsCipherSuites = ConnectionSpec.MODERN_TLS.cipherSuites();
if (modernTlsCipherSuites != null)
cipherSuites.addAll(modernTlsCipherSuites);
cipherSuites.add(CipherSuite.TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA);
cipherSuites.add(CipherSuite.TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA);
ConnectionSpec legacyTls = new ConnectionSpec.Builder(ConnectionSpec.MODERN_TLS)
.cipherSuites(cipherSuites.toArray(new CipherSuite[0]))
.build();
builder.connectionSpecs(Arrays.asList(legacyTls, ConnectionSpec.CLEARTEXT));
}
OkHttpEngine.OkHttpFactory factory = new OkHttpEngine.OkHttpFactory(builder);
UrlTileSource tileSource = MapilionMvtTileSource.builder()
.apiKey(API_KEY)

View File

@@ -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).
*
@@ -17,9 +17,10 @@
*/
package org.oscim.android.test;
import android.graphics.BitmapFactory;
import android.os.Bundle;
import android.widget.Toast;
import org.oscim.android.canvas.AndroidBitmap;
import org.oscim.backend.canvas.Bitmap;
import org.oscim.core.GeoPoint;
import org.oscim.event.Gesture;
@@ -39,8 +40,6 @@ import org.oscim.tiling.source.bitmap.DefaultSources;
import java.util.ArrayList;
import java.util.List;
import static org.oscim.android.canvas.AndroidGraphics.drawableToBitmap;
public class MarkerOverlayActivity extends MapActivity
implements ItemizedLayer.OnItemGestureListener<MarkerItem> {
@@ -64,14 +63,14 @@ public class MarkerOverlayActivity extends MapActivity
.build();
mMap.layers().add(new BitmapTileLayer(mMap, tileSource));
Bitmap bitmapPoi = drawableToBitmap(getResources().getDrawable(R.drawable.marker_poi));
Bitmap bitmapPoi = new AndroidBitmap(BitmapFactory.decodeResource(getResources(), R.drawable.marker_poi));
MarkerSymbol symbol;
if (BILLBOARDS)
symbol = new MarkerSymbol(bitmapPoi, HotspotPlace.BOTTOM_CENTER);
else
symbol = new MarkerSymbol(bitmapPoi, HotspotPlace.CENTER, false);
Bitmap bitmapFocus = drawableToBitmap(getResources().getDrawable(R.drawable.marker_focus));
Bitmap bitmapFocus = new AndroidBitmap(BitmapFactory.decodeResource(getResources(), R.drawable.marker_focus));
if (BILLBOARDS)
mFocusMarker = new MarkerSymbol(bitmapFocus, HotspotPlace.BOTTOM_CENTER);
else

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2017-2018 devemux86
* Copyright 2017-2019 devemux86
* Copyright 2018 Gustl22
*
* This program is free software: you can redistribute it and/or modify it under the
@@ -17,6 +17,7 @@ package org.oscim.android.test;
import android.content.Context;
import android.content.Intent;
import android.graphics.BitmapFactory;
import android.os.AsyncTask;
import android.os.Bundle;
import android.text.Editable;
@@ -25,20 +26,11 @@ import android.view.LayoutInflater;
import android.view.Menu;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ListView;
import android.widget.Toast;
import android.widget.ToggleButton;
import android.widget.*;
import org.mapsforge.core.model.Tag;
import org.mapsforge.poi.android.storage.AndroidPoiPersistenceManagerFactory;
import org.mapsforge.poi.storage.ExactMatchPoiCategoryFilter;
import org.mapsforge.poi.storage.PoiCategoryFilter;
import org.mapsforge.poi.storage.PoiCategoryManager;
import org.mapsforge.poi.storage.PoiPersistenceManager;
import org.mapsforge.poi.storage.PointOfInterest;
import org.mapsforge.poi.storage.*;
import org.oscim.android.canvas.AndroidBitmap;
import org.oscim.android.filepicker.FilePicker;
import org.oscim.android.filepicker.FilterByFileExtension;
import org.oscim.backend.canvas.Bitmap;
@@ -60,8 +52,6 @@ import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import static org.oscim.android.canvas.AndroidGraphics.drawableToBitmap;
/**
* POI search.<br/>
* Long press on map to search inside visible bounding box.<br/>
@@ -162,7 +152,7 @@ public class PoiSearchActivity extends MapsforgeActivity implements ItemizedLaye
String file = intent.getStringExtra(FilePicker.SELECTED_FILE);
mPersistenceManager = AndroidPoiPersistenceManagerFactory.getPoiPersistenceManager(file);
Bitmap bitmap = drawableToBitmap(getResources().getDrawable(R.drawable.marker_green));
Bitmap bitmap = new AndroidBitmap(BitmapFactory.decodeResource(getResources(), R.drawable.marker_green));
MarkerSymbol symbol = new MarkerSymbol(bitmap, MarkerSymbol.HotspotPlace.BOTTOM_CENTER);
mMarkerLayer = new ItemizedLayer<>(mMap, new ArrayList<MarkerItem>(), symbol, this);
mMap.layers().add(mMarkerLayer);

View File

@@ -22,7 +22,7 @@ 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.oscim.tiling.source.mvt.TileDecoder;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -45,10 +45,10 @@ public class MBTilesMvtTileDataSource extends MBTilesTileDataSource {
private final String mLanguage;
private final ThreadLocal<MvtTileDecoder> mThreadLocalDecoders = new ThreadLocal<MvtTileDecoder>() {
private final ThreadLocal<TileDecoder> mThreadLocalDecoders = new ThreadLocal<TileDecoder>() {
@Override
protected MvtTileDecoder initialValue() {
return new MvtTileDecoder(mLanguage);
protected TileDecoder initialValue() {
return new TileDecoder(mLanguage);
}
};

View File

@@ -3,7 +3,7 @@ apply plugin: 'com.github.dcendents.android-maven'
dependencies {
api project(':vtm')
api 'com.caverock:androidsvg:1.3'
api 'com.caverock:androidsvg:1.4'
}
android {

View File

@@ -65,12 +65,21 @@ public class MapView extends GLSurfaceView {
private static final Pattern GL_PATTERN = Pattern.compile("OpenGL ES (\\d(\\.\\d){0,2})");
/**
* Target OpenGL ES version, if not available fall back to OpenGL ES 2.0
* OpenGL ES 2.0 default on Android for performance / stability.
* Any larger not available versions fall back to OpenGL ES 2.0.
*/
public static double targetGLESVersion = 3.0;
public static double OPENGL_VERSION = 2.0;
private static void init() {
System.loadLibrary("vtm-jni");
if (Parameters.THREADED_INIT)
new Thread(new Runnable() {
@Override
public void run() {
System.loadLibrary("vtm-jni");
}
}).start();
else
System.loadLibrary("vtm-jni");
}
protected AndroidMap mMap;
@@ -125,16 +134,20 @@ public class MapView extends GLSurfaceView {
mMap = new AndroidMap(this);
/* Initialize Renderer */
// OpenGL ES 3.0 is supported with Android 4.3 (API level 18) and higher
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2) {
try {
setEGLContextFactory(new GlContextFactory());
} catch (Throwable t) {
log.error("Falling back to GLES 2", t);
setEGLContextClientVersion(2);
}
} else
if (OPENGL_VERSION == 2.0)
setEGLContextClientVersion(2);
else {
// OpenGL ES 3.0 is supported with Android 4.3 (API level 18) and higher
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2) {
try {
setEGLContextFactory(new GlContextFactory());
} catch (Throwable t) {
log.error("Falling back to GLES 2", t);
setEGLContextClientVersion(2);
}
} else
setEGLContextClientVersion(2);
}
setEGLConfigChooser(new GlConfigChooser());
if (GLAdapter.debug)
@@ -346,23 +359,27 @@ public class MapView extends GLSurfaceView {
@Override
public void onSurfaceCreated(GL10 gl, EGLConfig config) {
try {
// Create a minimum supported OpenGL ES context, then check:
String versionString = gl.glGetString(GL10.GL_VERSION);
log.info("Version: " + versionString);
// The version format is displayed as: "OpenGL ES <major>.<minor>"
// followed by optional content provided by the implementation.
// OpenGL<space>ES<space><version number><space><vendor-specific information>.
int[] version = extractVersion(versionString);
int majorVersion = version[0];
if (majorVersion >= 3)
GLAdapter.init(new AndroidGL30());
else
GLAdapter.init(new AndroidGL());
} catch (Throwable t) {
log.error("Falling back to GLES 2", t);
if (OPENGL_VERSION == 2.0)
GLAdapter.init(new AndroidGL());
else {
try {
// Create a minimum supported OpenGL ES context, then check:
String versionString = gl.glGetString(GL10.GL_VERSION);
log.info("Version: " + versionString);
// The version format is displayed as: "OpenGL ES <major>.<minor>"
// followed by optional content provided by the implementation.
// OpenGL<space>ES<space><version number><space><vendor-specific information>.
int[] version = extractVersion(versionString);
int majorVersion = Math.min(version[0], (int) OPENGL_VERSION);
if (majorVersion >= 3)
GLAdapter.init(new AndroidGL30());
else
GLAdapter.init(new AndroidGL());
} catch (Throwable t) {
log.error("Falling back to GLES 2", t);
GLAdapter.init(new AndroidGL());
}
}
super.onSurfaceCreated();

View File

@@ -1,6 +1,6 @@
/*
* Copyright 2010, 2011, 2012 mapsforge.org
* Copyright 2016-2018 devemux86
* Copyright 2016-2019 devemux86
* Copyright 2017 Longri
*
* This file is part of the OpenScienceMap project (http://www.opensciencemap.org).
@@ -22,7 +22,7 @@ import android.content.res.Resources;
import android.graphics.Bitmap.Config;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;
import android.os.Build;
import org.oscim.backend.CanvasAdapter;
import org.oscim.backend.Platform;
import org.oscim.backend.canvas.Bitmap;
@@ -90,7 +90,7 @@ public final class AndroidGraphics extends CanvasAdapter {
//-------------------------------------
public static Bitmap drawableToBitmap(Drawable drawable) {
if (drawable instanceof BitmapDrawable) {
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.P && drawable instanceof BitmapDrawable) {
return new AndroidBitmap(((BitmapDrawable) drawable).getBitmap());
}

View File

@@ -28,7 +28,6 @@
package org.oscim.android.gl;
import android.opengl.GLSurfaceView;
import org.oscim.android.MapView;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -51,18 +50,18 @@ public class GlContextFactory implements GLSurfaceView.EGLContextFactory {
@Override
public EGLContext createContext(EGL10 egl, EGLDisplay display, EGLConfig eglConfig) {
log.info("creating OpenGL ES " + MapView.targetGLESVersion + " context");
checkEglError("Before eglCreateContext " + MapView.targetGLESVersion, egl);
int[] attrib_list = {EGL_CONTEXT_CLIENT_VERSION, (int) MapView.targetGLESVersion, EGL10.EGL_NONE};
log.info("creating OpenGL ES " + MapView.OPENGL_VERSION + " context");
checkEglError("Before eglCreateContext " + MapView.OPENGL_VERSION, egl);
int[] attrib_list = {EGL_CONTEXT_CLIENT_VERSION, (int) MapView.OPENGL_VERSION, EGL10.EGL_NONE};
EGLContext context = egl.eglCreateContext(display, eglConfig, EGL10.EGL_NO_CONTEXT, attrib_list);
boolean success = checkEglError("After eglCreateContext " + MapView.targetGLESVersion, egl);
boolean success = checkEglError("After eglCreateContext " + MapView.OPENGL_VERSION, egl);
if ((!success || context == null) && MapView.targetGLESVersion > 2) {
if ((!success || context == null) && MapView.OPENGL_VERSION > 2) {
log.warn("Falling back to GLES 2");
MapView.targetGLESVersion = 2.0;
MapView.OPENGL_VERSION = 2.0;
return createContext(egl, display, eglConfig);
}
log.info("Returning a GLES " + MapView.targetGLESVersion + " context");
log.info("Returning a GLES " + MapView.OPENGL_VERSION + " context");
return context;
}

View File

@@ -4,7 +4,8 @@ dependencies {
implementation project(':vtm-android')
implementation project(':vtm-extras')
implementation project(':vtm-themes')
implementation 'com.squareup.okhttp3:okhttp:3.8.0'
// https://github.com/square/okhttp/issues/4481
implementation 'com.squareup.okhttp3:okhttp:3.12.5'
implementation "org.slf4j:slf4j-android:$slf4jVersion"
}

View File

@@ -1,7 +1,7 @@
/*
* Copyright 2013 Ahmad Saleem
* Copyright 2013 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
@@ -24,19 +24,17 @@ import android.hardware.SensorManager;
import android.view.animation.Animation;
import android.view.animation.RotateAnimation;
import android.widget.ImageView;
import org.oscim.app.App;
import org.oscim.app.R;
import org.oscim.core.MapPosition;
import org.oscim.event.Event;
import org.oscim.layers.Layer;
import org.oscim.map.Map;
import org.oscim.renderer.LocationRenderer;
import org.oscim.renderer.LocationCallback;
import org.oscim.utils.FastMath;
@SuppressWarnings("deprecation")
public class Compass extends Layer implements SensorEventListener, Map.UpdateListener,
LocationRenderer.Callback {
public class Compass extends Layer implements SensorEventListener, Map.UpdateListener, LocationCallback {
// static final Logger log = LoggerFactory.getLogger(Compass.class);

View File

@@ -1,7 +1,7 @@
/*
* Copyright 2010, 2011, 2012, 2013 mapsforge.org
* Copyright 2013 Hannes Janetzek
* Copyright 2016-2017 devemux86
* Copyright 2016-2019 devemux86
* Copyright 2017 nebular
* Copyright 2018 Gustl22
*
@@ -22,12 +22,7 @@ package org.oscim.awt;
import org.oscim.backend.canvas.Paint;
import java.awt.BasicStroke;
import java.awt.Color;
import java.awt.Font;
import java.awt.FontMetrics;
import java.awt.Graphics2D;
import java.awt.Stroke;
import java.awt.*;
import java.awt.font.TextAttribute;
import java.awt.image.BufferedImage;
import java.text.AttributedCharacterIterator.Attribute;
@@ -125,8 +120,8 @@ public class AwtPaint implements Paint {
Font font = DEFAULT_FONT; // new Font("Default", Font.PLAIN, 13);
Stroke stroke;
Style style = Style.FILL;
private int cap = getCap(Cap.BUTT);
private int join = getJoin(Join.MITER);
private int cap = getCap(Cap.ROUND);
private int join = getJoin(Join.ROUND);
private float strokeWidth;
private float textSize = DEFAULT_FONT.getSize();

View File

@@ -3,9 +3,10 @@ apply plugin: 'maven'
dependencies {
api project(':vtm')
api 'com.fasterxml.jackson.core:jackson-core:2.8.4'
api 'org.locationtech.jts:jts-core:1.15.0'
api 'org.openstreetmap.osmosis:osmosis-osm-binary:0.46'
api 'com.fasterxml.jackson.core:jackson-core:2.9.9'
// https://github.com/locationtech/jts/issues/145
api 'org.locationtech.jts:jts-core:1.15.1'
api 'org.openstreetmap.osmosis:osmosis-osm-binary:0.47'
}
sourceSets {

View File

@@ -78,6 +78,6 @@ public class OverpassTileSource extends UrlTileSource {
@Override
public ITileDataSource getDataSource() {
return new OverzoomTileDataSource(new UrlTileDataSource(this, new OverpassTileDecoder(), getHttpEngine()), mOverZoom);
return new OverzoomTileDataSource(new UrlTileDataSource(this, new TileDecoder(), getHttpEngine()), mOverZoom);
}
}

View File

@@ -39,14 +39,14 @@ import java.io.InputStream;
import static org.oscim.core.MercatorProjection.latitudeToY;
import static org.oscim.core.MercatorProjection.longitudeToX;
public class OverpassTileDecoder implements ITileDecoder {
public class TileDecoder implements ITileDecoder {
private final MapElement mMapElement;
private ITileDataSink mTileDataSink;
private double mTileY, mTileX, mTileScale;
public OverpassTileDecoder() {
public TileDecoder() {
mMapElement = new MapElement();
mMapElement.layer = 5;
}

View File

@@ -3,7 +3,8 @@ apply plugin: 'maven'
dependencies {
api project(':vtm')
api 'com.squareup.okhttp3:okhttp:3.8.0'
// https://github.com/square/okhttp/issues/4481
api 'com.squareup.okhttp3:okhttp:3.12.5'
}
sourceSets {

View File

@@ -3,7 +3,7 @@ apply plugin: 'maven'
dependencies {
api project(':vtm')
api 'com.fasterxml.jackson.core:jackson-core:2.8.4'
api 'com.fasterxml.jackson.core:jackson-core:2.9.9'
}
sourceSets {

View File

@@ -3,7 +3,8 @@ apply plugin: 'maven'
dependencies {
api project(':vtm')
api 'org.locationtech.jts:jts-core:1.15.0'
// https://github.com/locationtech/jts/issues/145
api 'org.locationtech.jts:jts-core:1.15.1'
}
sourceSets {

View File

@@ -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).
*
@@ -17,18 +17,11 @@
*/
package org.oscim.layers.vector;
import org.locationtech.jts.geom.Envelope;
import org.locationtech.jts.geom.Geometry;
import org.locationtech.jts.geom.LineString;
import org.locationtech.jts.geom.Point;
import org.locationtech.jts.geom.Polygon;
import org.locationtech.jts.geom.*;
import org.locationtech.jts.simplify.DouglasPeuckerSimplifier;
import org.oscim.backend.canvas.Color;
import org.oscim.core.Box;
import org.oscim.core.GeoPoint;
import org.oscim.core.GeometryBuffer;
import org.oscim.core.MapPosition;
import org.oscim.core.Tile;
import org.oscim.core.*;
import org.oscim.event.Gesture;
import org.oscim.event.GestureListener;
import org.oscim.event.MotionEvent;
@@ -124,7 +117,7 @@ public class VectorLayer extends AbstractVectorLayer<Drawable> implements Gestur
*
* @param drawable
*/
public void add(Drawable drawable) {
public synchronized void add(Drawable drawable) {
mDrawables.insert(bbox(drawable.getGeometry(), drawable.getStyle()), drawable);
}
@@ -135,7 +128,7 @@ public class VectorLayer extends AbstractVectorLayer<Drawable> implements Gestur
* @param geometry
* @param style
*/
public synchronized void add(Geometry geometry, Style style) {
synchronized void add(Geometry geometry, Style style) {
mDrawables.insert(bbox(geometry, style), new GeometryWithStyle(geometry, style));
}

View File

@@ -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).
*
@@ -94,7 +94,7 @@ public class Style {
public static class Builder {
private float strokeWidth = 1f;
private int strokeColor = Color.GRAY;
public int strokeColor = Color.GRAY;
private int fillColor = Color.GRAY;
private float fillAlpha = 0.25f;

View File

@@ -3,7 +3,7 @@ apply plugin: 'maven'
dependencies {
api project(':vtm')
api 'com.wdtinc:mapbox-vector-tile:3.0.0'
api 'com.wdtinc:mapbox-vector-tile:3.1.0'
}
sourceSets {

View File

@@ -65,6 +65,6 @@ public class MapilionMvtTileSource extends UrlTileSource {
@Override
public ITileDataSource getDataSource() {
return new OverzoomTileDataSource(new UrlTileDataSource(this, new MvtTileDecoder(locale), getHttpEngine()), mOverZoom);
return new OverzoomTileDataSource(new UrlTileDataSource(this, new TileDecoder(locale), getHttpEngine()), mOverZoom);
}
}

View File

@@ -69,6 +69,6 @@ public class MapzenMvtTileSource extends UrlTileSource {
@Override
public ITileDataSource getDataSource() {
return new OverzoomTileDataSource(new UrlTileDataSource(this, new MvtTileDecoder(locale), getHttpEngine()), mOverZoom);
return new OverzoomTileDataSource(new UrlTileDataSource(this, new TileDecoder(locale), getHttpEngine()), mOverZoom);
}
}

View File

@@ -66,6 +66,6 @@ public class NextzenMvtTileSource extends UrlTileSource {
@Override
public ITileDataSource getDataSource() {
return new OverzoomTileDataSource(new UrlTileDataSource(this, new MvtTileDecoder(locale), getHttpEngine()), mOverZoom);
return new OverzoomTileDataSource(new UrlTileDataSource(this, new TileDecoder(locale), getHttpEngine()), mOverZoom);
}
}

View File

@@ -69,6 +69,6 @@ public class OpenMapTilesMvtTileSource extends UrlTileSource {
@Override
public ITileDataSource getDataSource() {
return new OverzoomTileDataSource(new UrlTileDataSource(this, new MvtTileDecoder(locale), getHttpEngine()), mOverZoom);
return new OverzoomTileDataSource(new UrlTileDataSource(this, new TileDecoder(locale), getHttpEngine()), mOverZoom);
}
}

View File

@@ -42,7 +42,7 @@ import java.io.IOException;
import java.io.InputStream;
import java.util.Map;
public class MvtTileDecoder implements ITileDecoder {
public class TileDecoder implements ITileDecoder {
private final String mLocale;
private static final float REF_TILE_SIZE = 4096.0f;
@@ -52,11 +52,11 @@ public class MvtTileDecoder implements ITileDecoder {
private final MapElement mMapElement;
private ITileDataSink mTileDataSink;
public MvtTileDecoder() {
public TileDecoder() {
this("");
}
public MvtTileDecoder(String locale) {
public TileDecoder(String locale) {
mLocale = locale;
mGeomFactory = new GeometryFactory();
mMapElement = new MapElement();

View File

@@ -28,7 +28,7 @@ import org.oscim.theme.VtmThemes;
public class ExtrusionsTest extends GdxMapApp {
enum GroundShape {
HEXAGON, RECTANGLE, SHAPE_L, SHAPE_O, SHAPE_T, SHAPE_U, SHAPE_V, SHAPE_X, SHAPE_Z, TEST
HEXAGON, RECTANGLE, SHAPE_L, SHAPE_M, SHAPE_O, SHAPE_T, SHAPE_U, SHAPE_V, SHAPE_X, SHAPE_Z, TEST
}
/**
@@ -123,6 +123,9 @@ public class ExtrusionsTest extends GdxMapApp {
case SHAPE_L:
shapeLGround(e);
break;
case SHAPE_M:
shapeMGround(e);
break;
case SHAPE_O:
shapeOGround(e);
break;
@@ -181,6 +184,19 @@ public class ExtrusionsTest extends GdxMapApp {
e.addPoint(0, 10);
}
private void shapeMGround(MapElement e) {
e.addPoint(0, 0);
e.addPoint(10, 0);
e.addPoint(10, 5);
e.addPoint(20, 5);
e.addPoint(20, 20);
e.addPoint(37, 20);
e.addPoint(37, 25);
e.addPoint(12, 25);
e.addPoint(12, 15);
e.addPoint(0, 15);
}
private void shapeOGround(MapElement e) {
hexagonGround(e);
e.reverse();

View File

@@ -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).
*
@@ -77,7 +77,7 @@ public class LineRenderTest extends GdxMapApp {
TextureItem tex = null;
try {
tex = new TextureItem(CanvasAdapter.getBitmapAsset("", "patterns/dot.png"));
tex.mipmap = true;
//tex.mipmap = true;
} catch (IOException e) {
e.printStackTrace();
}

View File

@@ -54,7 +54,7 @@ public class LineTexTest extends GdxMapApp {
try {
tex = new TextureItem(CanvasAdapter.getBitmapAsset("", "patterns/pike.png"));
tex.mipmap = true;
//tex.mipmap = true;
} catch (IOException e) {
e.printStackTrace();
}

View File

@@ -1,84 +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.test;
import org.oscim.core.MapPosition;
import org.oscim.core.Tile;
import org.oscim.gdx.GdxMapApp;
import org.oscim.layers.tile.buildings.BuildingLayer;
import org.oscim.layers.tile.vector.VectorTileLayer;
import org.oscim.layers.tile.vector.labeling.LabelLayer;
import org.oscim.theme.VtmThemes;
import org.oscim.tiling.source.mapfile.MapFileTileSource;
import org.oscim.tiling.source.mapfile.MultiMapFileTileSource;
import java.io.File;
import java.util.ArrayList;
import java.util.List;
public class MapsforgeMultiTest extends GdxMapApp {
private final List<File> mapFiles;
private MapsforgeMultiTest(List<File> mapFiles) {
this.mapFiles = mapFiles;
}
@Override
public void createLayers() {
MultiMapFileTileSource tileSource = new MultiMapFileTileSource();
for (File mapFile : mapFiles) {
MapFileTileSource mapFileTileSource = new MapFileTileSource();
mapFileTileSource.setMapFile(mapFile.getAbsolutePath());
tileSource.add(mapFileTileSource);
}
//tileSource.setPreferredLanguage("en");
VectorTileLayer l = mMap.setBaseMap(tileSource);
mMap.setTheme(VtmThemes.DEFAULT);
mMap.layers().add(new BuildingLayer(mMap, l));
mMap.layers().add(new LabelLayer(mMap, l));
MapPosition pos = new MapPosition();
pos.setByBoundingBox(tileSource.getBoundingBox(), Tile.SIZE * 4, Tile.SIZE * 4);
mMap.setMapPosition(pos);
}
private static List<File> getMapFiles(String[] args) {
if (args.length == 0) {
throw new IllegalArgumentException("missing argument: <mapFile>");
}
List<File> result = new ArrayList<>();
for (String arg : args) {
File mapFile = new File(arg);
if (!mapFile.exists()) {
throw new IllegalArgumentException("file does not exist: " + mapFile);
} else if (!mapFile.isFile()) {
throw new IllegalArgumentException("not a file: " + mapFile);
} else if (!mapFile.canRead()) {
throw new IllegalArgumentException("cannot read file: " + mapFile);
}
result.add(mapFile);
}
return result;
}
public static void main(String[] args) {
GdxMapApp.init();
GdxMapApp.run(new MapsforgeMultiTest(getMapFiles(args)));
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2018 devemux86
* Copyright 2018-2019 devemux86
* Copyright 2018 Gustl22
*
* This program is free software: you can redistribute it and/or modify it under the
@@ -18,15 +18,16 @@ package org.oscim.test;
import org.oscim.gdx.GdxMapApp;
import java.io.File;
import java.util.List;
public class MapsforgePoi3DTest extends MapsforgeTest {
private MapsforgePoi3DTest(File mapFile) {
super(mapFile, false, true);
private MapsforgePoi3DTest(List<File> mapFiles) {
super(mapFiles, false, true);
}
public static void main(String[] args) {
GdxMapApp.init();
GdxMapApp.run(new MapsforgePoi3DTest(getMapFile(args)));
GdxMapApp.run(new MapsforgePoi3DTest(getMapFiles(args)));
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2018 devemux86
* Copyright 2018-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
@@ -17,15 +17,16 @@ package org.oscim.test;
import org.oscim.gdx.GdxMapApp;
import java.io.File;
import java.util.List;
public class MapsforgeS3DBTest extends MapsforgeTest {
private MapsforgeS3DBTest(File mapFile) {
super(mapFile, true, false);
private MapsforgeS3DBTest(List<File> mapFiles) {
super(mapFiles, true, false);
}
public static void main(String[] args) {
GdxMapApp.init();
GdxMapApp.run(new MapsforgeS3DBTest(getMapFile(args)));
GdxMapApp.run(new MapsforgeS3DBTest(getMapFiles(args)));
}
}

View File

@@ -1,5 +1,5 @@
/*
* 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
@@ -22,16 +22,17 @@ import org.oscim.theme.XmlRenderThemeStyleLayer;
import org.oscim.theme.XmlRenderThemeStyleMenu;
import java.io.File;
import java.util.List;
import java.util.Set;
public class MapsforgeStyleTest extends MapsforgeTest {
private MapsforgeStyleTest(File mapFile) {
super(mapFile);
private MapsforgeStyleTest(List<File> mapFiles) {
super(mapFiles);
}
@Override
protected void loadTheme(final String styleId) {
void loadTheme(final String styleId) {
mMap.setTheme(new StreamRenderTheme("", getClass().getResourceAsStream("/assets/vtm/stylemenu.xml"), new XmlRenderThemeMenuCallback() {
@Override
public Set<String> getCategories(XmlRenderThemeStyleMenu renderThemeStyleMenu) {
@@ -79,6 +80,6 @@ public class MapsforgeStyleTest extends MapsforgeTest {
public static void main(String[] args) {
GdxMapApp.init();
GdxMapApp.run(new MapsforgeStyleTest(getMapFile(args)));
GdxMapApp.run(new MapsforgeStyleTest(getMapFiles(args)));
}
}

View File

@@ -17,6 +17,7 @@
*/
package org.oscim.test;
import org.oscim.core.BoundingBox;
import org.oscim.core.MapPosition;
import org.oscim.core.Tile;
import org.oscim.event.Event;
@@ -33,33 +34,39 @@ import org.oscim.renderer.GLViewport;
import org.oscim.scalebar.*;
import org.oscim.theme.VtmThemes;
import org.oscim.tiling.source.mapfile.MapFileTileSource;
import org.oscim.tiling.source.mapfile.MapInfo;
import org.oscim.tiling.source.mapfile.MultiMapFileTileSource;
import java.io.File;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.List;
public class MapsforgeTest extends GdxMapApp {
private static final boolean SHADOWS = false;
private File mapFile;
private boolean poi3d;
private boolean s3db;
private final List<File> mapFiles;
private final boolean poi3d;
private final boolean s3db;
MapsforgeTest(File mapFile) {
this(mapFile, false, false);
MapsforgeTest(List<File> mapFiles) {
this(mapFiles, false, false);
}
MapsforgeTest(File mapFile, boolean s3db, boolean poi3d) {
this.mapFile = mapFile;
MapsforgeTest(List<File> mapFiles, boolean s3db, boolean poi3d) {
this.mapFiles = mapFiles;
this.s3db = s3db;
this.poi3d = poi3d;
}
@Override
public void createLayers() {
MapFileTileSource tileSource = new MapFileTileSource();
tileSource.setMapFile(mapFile.getAbsolutePath());
MultiMapFileTileSource tileSource = new MultiMapFileTileSource();
for (File mapFile : mapFiles) {
MapFileTileSource mapFileTileSource = new MapFileTileSource();
mapFileTileSource.setMapFile(mapFile.getAbsolutePath());
tileSource.add(mapFileTileSource);
}
//tileSource.setPreferredLanguage("en");
VectorTileLayer l = mMap.setBaseMap(tileSource);
@@ -86,10 +93,10 @@ public class MapsforgeTest extends GdxMapApp {
mMap.layers().add(mapScaleBarLayer);
MapPosition pos = MapPreferences.getMapPosition();
MapInfo info = tileSource.getMapInfo();
if (pos == null || !info.boundingBox.contains(pos.getGeoPoint())) {
BoundingBox bbox = tileSource.getBoundingBox();
if (pos == null || !bbox.contains(pos.getGeoPoint())) {
pos = new MapPosition();
pos.setByBoundingBox(info.boundingBox, Tile.SIZE * 4, Tile.SIZE * 4);
pos.setByBoundingBox(bbox, Tile.SIZE * 4, Tile.SIZE * 4);
}
mMap.setMapPosition(pos);
@@ -123,28 +130,32 @@ public class MapsforgeTest extends GdxMapApp {
super.dispose();
}
static File getMapFile(String[] args) {
static List<File> getMapFiles(String[] args) {
if (args.length == 0) {
throw new IllegalArgumentException("missing argument: <mapFile>");
}
File file = new File(args[0]);
if (!file.exists()) {
throw new IllegalArgumentException("file does not exist: " + file);
} else if (!file.isFile()) {
throw new IllegalArgumentException("not a file: " + file);
} else if (!file.canRead()) {
throw new IllegalArgumentException("cannot read file: " + file);
List<File> result = new ArrayList<>();
for (String arg : args) {
File mapFile = new File(arg);
if (!mapFile.exists()) {
throw new IllegalArgumentException("file does not exist: " + mapFile);
} else if (!mapFile.isFile()) {
throw new IllegalArgumentException("not a file: " + mapFile);
} else if (!mapFile.canRead()) {
throw new IllegalArgumentException("cannot read file: " + mapFile);
}
result.add(mapFile);
}
return file;
return result;
}
protected void loadTheme(final String styleId) {
void loadTheme(final String styleId) {
mMap.setTheme(VtmThemes.DEFAULT);
}
public static void main(String[] args) {
GdxMapApp.init();
GdxMapApp.run(new MapsforgeTest(getMapFile(args)));
GdxMapApp.run(new MapsforgeTest(getMapFiles(args)));
}
}

View File

@@ -24,11 +24,11 @@ import org.oscim.tiling.QueryResult;
import static org.junit.Assert.assertEquals;
public class MvtTileDecoderTest {
public class TileDecoderTest {
@Test
public void tileDecodingTest() throws Exception {
MvtTileDecoder decoder = new MvtTileDecoder();
TileDecoder decoder = new TileDecoder();
Tile tile = new Tile(0, 0, (byte) 0);
ITileDataSink sink = new ITileDataSink() {
@Override

View File

@@ -1,12 +1,5 @@
apply plugin: 'application'
/*
configurations.all {
// Check latest snapshot on every build
resolutionStrategy.cacheChangingModulesFor 0, 'seconds'
}
*/
dependencies {
implementation project(':vtm-desktop-lwjgl')
file("${rootDir}/vtm-desktop/natives").eachDir() { dir ->
@@ -17,11 +10,11 @@ dependencies {
implementation 'com.fifesoft:rsyntaxtextarea:2.6.1'
implementation 'com.jtattoo:JTattoo:1.6.11'
implementation 'org.mapsforge:mapsforge-core:master-SNAPSHOT'
implementation 'org.mapsforge:mapsforge-map:master-SNAPSHOT'
implementation 'org.mapsforge:mapsforge-map-awt:master-SNAPSHOT'
implementation 'org.mapsforge:mapsforge-map-reader:master-SNAPSHOT'
implementation 'org.mapsforge:mapsforge-themes:master-SNAPSHOT'
implementation 'org.mapsforge:mapsforge-core:0.13.0'
implementation 'org.mapsforge:mapsforge-map:0.13.0'
implementation 'org.mapsforge:mapsforge-map-awt:0.13.0'
implementation 'org.mapsforge:mapsforge-map-reader:0.13.0'
implementation 'org.mapsforge:mapsforge-themes:0.13.0'
implementation 'net.sf.kxml:kxml2:2.3.0'
}

View File

@@ -60,40 +60,41 @@
<style-area fade="10" fill="#e6e3e5" id="railway|industrial" />
<!--Note: ordered according to their inheritance via the `use` attribute-->
<style-area id="tex1" src="assets:textures/rough.png" />
<!-- Avoid patterns and textures because of old GPU issues -->
<!--<style-area id="tex1" src="assets:textures/rough.png" />-->
<!-- meadow|garden -->
<style-area fade="10" fill="#c9dc91" id="greens" use="tex1" />
<style-area fade="10" fill="#c9dc91" id="greens" />
<!-- grass -->
<style-area fade="12" fill="#d3dcb9" id="lightgreen" use="tex1" />
<style-area fade="12" fill="#d3dcb9" id="lightgreen" />
<!-- grassland|scrub -->
<style-area fade="10" fill="#c2cba5" id="darkgreen" use="tex1" />
<style-area fade="10" fill="#c2cba5" id="darkgreen" />
<!-- <style-area id="greens" fill="#d2e5ce" fade="10" /> -->
<!--farmland-->
<style-area fade="12" fill="#e4dab5" id="farmland" stroke="#d1dbc7" stroke-width="1.0"
use="tex1" />
<style-area fade="12" fill="#e4dab5" id="farmland" />
<!-- marsh|wetland|mud|nature_reserve -->
<style-area fade="12" fill="#deecb9" id="greens2" />
<!-- park|common|green|cemetery|golf_course|dog_park -->
<style-area fade="11" fill="#9ac56e" id="park" use="tex1" />
<style-area fade="11" fill="#9ac56e" id="park" />
<!-- <style-area id="park" fill="#a3ca7b" fade="11" /> -->
<!--wood-->
<!-- fade out at z=7, blend over to 'blend-fill' in z=11 -->
<!-- src="assets:textures/wood.png" -->
<!-- <style-area id="wood" fill="#d1dbc7" fade="8" blend="11" blend-fill="#9ac56e" /> -->
<!-- <style-area id="wood" use="park" fill="#9ac56e" fade="8" stroke="#d1dbc7" stroke-width="1.0"/> -->
<!-- <style-area id="wood" use="park" fill="#9ac56e" fade="8" /> -->
<style-area blend="11" blend-fill="#83aa5b" fade="8" fill="#b3d095" id="wood" use="park" />
<!-- <style-line id="wood" fix="true" cap="butt" width="1.0" stroke="#9ac56e" /> -->
<!-- de:Kleingartengebiet -->
<style-area fade="12" fill="#efeae0" id="allotments" use="tex1" />
<style-area fade="12" fill="#efeae0" id="allotments" />
<!-- de:Steinbruch, Schotter-, Kies-, Sand- und Tongrube -->
<style-area fade="10" fill="#ddddcc" id="quarry" />
@@ -101,12 +102,12 @@
<!--military-->
<style-area fade="10" fill="#eeedea" id="military" />
<!--building-->
<style-area fade="15" fill="#f2f0eb" id="building" stroke="#b7b6b3" stroke-width="1.0" />
<style-area fade="15" fill="#f2f0eb" id="building" />
<!--water-->
<!--<style-area id="water" fill="#97b7e5" afc5e3 /> -->
<!-- src="assets:textures/water.png" -->
<style-area fade="-1" fill="#99badf" id="water" mesh="true" />
<style-area fade="-1" fill="#99badf" id="water" />
<!--###### LINE styles ######-->
@@ -168,7 +169,7 @@
<!--###### ASSIGNMENT ######-->
<m e="way" k="natural" v="issea|sea">
<area use="water" />
<area mesh="true" use="water" />
</m>
<m e="way" k="natural" v="nosea">
@@ -220,7 +221,7 @@
<m k="landuse|natural|leisure|amenity|tourism">
<!-- kind of more like landuse imho -->
<m k="leisure|landuse" v="nature_reserve">
<area use="greens2" />
<area fill="#40abe29c" />
<m zoom-min="14">
<line cap="butt" fix="true" stroke="#abe29c" width="1.0" />
</m>
@@ -248,10 +249,10 @@
<area fill="#f2d9b1" />
</m>
<!-- <m v="parking" zoom-min="15">
<area fill="#f4f4f4" stroke="#d4d4d4" stroke-width="0.2" />
<area fill="#f4f4f4" />
</m>
<m v="fountain" closed="yes">
<area fill="#b4cbdc" stroke="#000080" stroke-width="0.15" />
<area fill="#b4cbdc" />
</m> -->
</m>
@@ -281,16 +282,13 @@
<!-- Heideland, keep below forest -->
<m v="heath|sand" zoom-min="10">
<area fade="10" fill="#fffad1" use="tex1" />
<area fade="10" fill="#fffad1" />
</m>
<m k="landuse|natural" v="forest|wood">
<m zoom-max="13" zoom-min="8">
<m zoom-min="8">
<area use="wood" />
</m>
<m zoom-min="14">
<area stroke="#91bf63" stroke-width="1.0" use="wood" />
</m>
</m>
<!-- keep grass above forest:wood and leisure:park! -->
@@ -316,10 +314,10 @@
</m>
-->
<m v="parking" zoom-min="15">
<area fill="#f4f4f4" stroke="#d4d4d4" stroke-width="0.2" />
<area fill="#f4f4f4" />
</m>
<m closed="yes" v="fountain">
<area fill="#b4cbdc" stroke="#000080" stroke-width="0.15" />
<area fill="#b4cbdc" />
</m>
</m>
@@ -357,7 +355,7 @@
<area fade="12" fill="#daefdb" />
</m>
<m v="playground|miniature_golf" zoom-min="15">
<area fill="#f4f4de" use="tex1" />
<area fill="#f4f4de" />
<line cap="butt" fix="true" stroke="#d9d9a3" width="1.0" />
</m>
<m v="playing_fields|pitch">
@@ -365,7 +363,7 @@
<line cap="butt" fix="true" stroke="#d9d9a3" width="1.0" />
</m>
<m v="swimming_pool">
<area fill="#d4ebfc" stroke="#6060ff" stroke-width="0.2" />
<area fill="#d4ebfc" />
</m>
<!-- <m v="track"> <m k="area" v="yes|true">
@@ -617,6 +615,7 @@
<!-- Airport passenger building -->
<m v="terminal|hangar">
<area use="building" />
<line use="building" />
</m>
</m>
@@ -631,6 +630,7 @@
<m zoom-min="14">
<m closed="yes">
<area fade="14" use="building" />
<line fade="14" use="building" />
</m>
<m closed="no">
<line fade="14" use="building" />
@@ -641,6 +641,7 @@
<m zoom-min="16">
<m closed="yes">
<area fade="16" use="building" />
<line fade="16" use="building" />
</m>
<m closed="no">
<line fade="16" use="building" />
@@ -963,7 +964,7 @@
<line cap="butt" stroke="#e4e4e4" width="0.3" />
</m>
<m closed="yes">
<area fill="#e4e4e4" stroke="#d0d0d0" stroke-width="1.05" />
<area fill="#e4e4e4" />
</m>
</m>
@@ -982,7 +983,7 @@
<m k="tunnel" v="~|false|no">
<m v="station">
<area fill="#dbdbc9" stroke="#707070" stroke-width="0.3" />
<area fill="#dbdbc9" />
</m>
<!-- railway bridge casings -->
@@ -1030,16 +1031,9 @@
</m>
<!-- non-physical boundaries -->
<!-- <m k="boundary"> <m k="boundary" v="national_park">
<line stroke="#4ef94b" width="0.25" stroke-dasharray="15, 5, 5, 5"
/> -->
<!--
maybe use some alpha texture for this
<m k="boundary" v="national_park">
<area fill="#d7e6b0" />
</m>
-->
<m k="boundary" v="national_park">
<area fill="#40abe29c" />
</m>
<!--<m k="boundary" v="administrative"> -->
<m k="admin_level">
@@ -1085,7 +1079,7 @@
<m k="area" v="~|false|no">
<m k="highway">
<m k="oneway" v="yes|true" zoom-min="16">
<lineSymbol src="assets:symbols/oneway.svg" />
<symbol repeat="true" src="assets:symbols/oneway.svg" />
</m>
</m>
</m>

View File

@@ -43,19 +43,19 @@
<!-- src="assets:textures/wood.png" -->
<!-- <style-area id="wood" fill="#d1dbc7" fade="8" blend="11" blend-fill="#9ac56e" /> -->
<style-area id="tex1" src="assets:textures/rough.png" />
<!-- Avoid patterns and textures because of old GPU issues -->
<!--<style-area id="tex1" src="assets:textures/rough.png" />-->
<!-- meadow|garden -->
<style-area fade="10" fill="#c9dc91" id="greens" use="tex1" />
<style-area fade="10" fill="#c9dc91" id="greens" />
<!-- grass -->
<style-area fade="12" fill="#d3dcb9" id="lightgreen" use="tex1" />
<style-area fade="12" fill="#d3dcb9" id="lightgreen" />
<!-- grassland|scrub -->
<style-area fade="10" fill="#c2cba5" id="darkgreen" use="tex1" />
<style-area fade="10" fill="#c2cba5" id="darkgreen" />
<style-area fade="12" fill="#e4dab5" id="farmland" stroke="#d1dbc7" stroke-width="1.0"
use="tex1" />
<style-area fade="12" fill="#e4dab5" id="farmland" />
<!-- <style-area id="greens" fill="#d2e5ce" fade="10" /> -->
@@ -63,8 +63,8 @@
<style-area fade="12" fill="#deecb9" id="greens2" />
<!-- park|common|green|cemetery|golf_course|dog_park -->
<style-area fade="11" fill="#9ac56e" id="park" use="tex1" />
<!-- <style-area id="wood" use="park" fill="#9ac56e" fade="8" stroke="#d1dbc7" stroke-width="1.0"/> -->
<style-area fade="11" fill="#9ac56e" id="park" />
<!-- <style-area id="wood" use="park" fill="#9ac56e" fade="8" /> -->
<style-area blend="11" blend-fill="#83aa5b" fade="8" fill="#b3d095" id="wood" use="park" />
<!-- <style-line id="wood" fix="true" cap="butt" width="1.0" stroke="#9ac56e" /> -->
@@ -73,7 +73,7 @@
<style-line cap="butt" fade="14" fix="true" id="park" stroke="#9ac56e" width="1.0" />
<!-- de:Kleingartengebiet -->
<style-area fade="12" fill="#efeae0" id="allotments" use="tex1" />
<style-area fade="12" fill="#efeae0" id="allotments" />
<!-- de:Steinbruch, Schotter-, Kies-, Sand- und Tongrube -->
<style-area fade="10" fill="#ddddcc" id="quarry" />
@@ -116,7 +116,7 @@
<!--<style-area id="water" fill="#97b7e5" afc5e3 /> -->
<!-- src="assets:textures/water.png" -->
<style-area fade="-1" fill="#99badf" id="water" use="tex1" />
<style-area fade="-1" fill="#99badf" id="water" />
<!-- no-go area boundary -->
<style-line cap="butt" fix="true" id="fence" stroke="#444444" width="1.2" />
@@ -127,7 +127,7 @@
<style-area id="building" fill="#e9e6e3" fade="15"/> -->
<style-line fade="15" id="building" stroke="#eeb7b6b3" use="fix" />
<style-area fade="15" fill="#f2f0eb" id="building" stroke="#b7b6b3" stroke-width="1.0" />
<style-area fade="15" fill="#f2f0eb" id="building" />
<m closed="yes" e="way" k="layer" v="water">
<area mesh="true" use="water" />
@@ -182,7 +182,7 @@
<m k="kind">
<!-- kind of more like landuse imho -->
<m v="nature_reserve">
<area use="greens2" />
<area fill="#40abe29c" />
<m zoom-min="14">
<line cap="butt" fix="true" stroke="#abe29c" width="1.0" />
</m>
@@ -208,10 +208,10 @@
<area fill="#f2d9b1" />
</m>
<!-- <m v="parking" zoom-min="15">
<area fill="#f4f4f4" stroke="#d4d4d4" stroke-width="0.2" />
<area fill="#f4f4f4" />
</m>
<m v="fountain" closed="yes">
<area fill="#b4cbdc" stroke="#000080" stroke-width="0.15" />
<area fill="#b4cbdc" />
</m> -->
</m>
@@ -241,16 +241,13 @@
<!-- Heideland, keep below forest -->
<m v="heath|sand" zoom-min="10">
<area fade="10" fill="#fffad1" use="tex1" />
<area fade="10" fill="#fffad1" />
</m>
<m v="forest|wood">
<m zoom-max="13" zoom-min="8">
<m zoom-min="8">
<area use="wood" />
</m>
<m zoom-min="14">
<area stroke="#91bf63" stroke-width="1.0" use="wood" />
</m>
</m>
<!-- keep grass above forest:wood and leisure:park! -->
@@ -275,13 +272,13 @@
</m>
-->
<m v="parking" zoom-min="15">
<area fill="#f4f4f4" stroke="#d4d4d4" stroke-width="0.2" />
<area fill="#f4f4f4" />
<m zoom-min="17">
<symbol src="assets:symbols/transport/parking.svg" />
</m>
</m>
<m closed="yes" v="fountain">
<area fill="#b4cbdc" stroke="#000080" stroke-width="0.15" />
<area fill="#b4cbdc" />
</m>
@@ -318,7 +315,7 @@
<area fade="12" fill="#daefdb" />
</m>
<m v="playground|miniature_golf" zoom-min="15">
<area fill="#f4f4de" use="tex1" />
<area fill="#f4f4de" />
<line cap="butt" fix="true" stroke="#d9d9a3" width="1.0" />
</m>
<m v="playing_fields|pitch">
@@ -326,7 +323,7 @@
<line cap="butt" fix="true" stroke="#d9d9a3" width="1.0" />
</m>
<m v="swimming_pool">
<area fill="#d4ebfc" stroke="#6060ff" stroke-width="0.2" />
<area fill="#d4ebfc" />
</m>
<!-- <m v="track"> <m k="area" v="yes|true">
@@ -580,6 +577,7 @@
<!-- Airport passenger building -->
<m v="terminal|hangar">
<area use="building" />
<line use="building" />
</m>
</m>
@@ -594,6 +592,7 @@
<m zoom-min="14">
<m closed="yes">
<area fade="14" use="building" />
<line fade="14" use="building" />
</m>
<m closed="no">
<line fade="14" use="building" />
@@ -604,6 +603,7 @@
<m zoom-min="16">
<m closed="yes">
<area fade="16" use="building" />
<line fade="16" use="building" />
</m>
<m closed="no">
<line fade="16" use="building" />
@@ -923,7 +923,7 @@
<line cap="butt" stroke="#e4e4e4" width="0.3" />
</m>
<m closed="yes">
<area fill="#e4e4e4" stroke="#d0d0d0" stroke-width="1.05" />
<area fill="#e4e4e4" />
</m>
</m>
@@ -942,7 +942,7 @@
<m k="is_tunnel" v="~|false|no">
<m v="station">
<area fill="#dbdbc9" stroke="#707070" stroke-width="0.3" />
<area fill="#dbdbc9" />
</m>
<!-- railway bridge casings -->
@@ -990,16 +990,9 @@
</m>
<!-- non-physical boundaries -->
<!-- <m k="boundary"> <m k="boundary" v="national_park">
<line stroke="#4ef94b" width="0.25" stroke-dasharray="15, 5, 5, 5"
/> -->
<!--
maybe use some alpha texture for this
<m k="boundary" v="national_park">
<area fill="#d7e6b0" />
</m>
-->
<m k="boundary" v="national_park">
<area fill="#40abe29c" />
</m>
<!--<m k="boundary" v="administrative"> -->
<m k="kind_detail">
@@ -1045,7 +1038,7 @@
<m k="area" v="~|false|no">
<m k="kind_detail">
<m k="oneway" v="yes|true" zoom-min="16">
<lineSymbol src="assets:symbols/oneway.svg" />
<symbol repeat="true" src="assets:symbols/oneway.svg" />
</m>
</m>
</m>

View File

@@ -74,7 +74,7 @@
<style-area fade="15" fill="#ee404040" id="building" />
<!--water-->
<style-area fill="#001223" id="water" mesh="true" />
<style-area fill="#001223" id="water" />
<!--###### LINE styles ######-->
@@ -122,7 +122,7 @@
<!--###### ASSIGNMENT ######-->
<m e="way" k="natural" v="issea|sea">
<area use="water" />
<area mesh="true" use="water" />
</m>
<m e="way" k="natural" v="nosea">
@@ -168,7 +168,7 @@
<m k="landuse|natural|leisure||amenity">
<!-- kind of more like landuse imho -->
<m k="leisure|landuse" v="nature_reserve">
<area use="greens2" />
<area fill="#40abe29c" />
<m zoom-min="14">
<line cap="butt" fix="true" stroke="#abe29c" width="1.0" />
</m>
@@ -229,17 +229,17 @@
<!-- amenity -->
<m k="amenity">
<m v="kindergarten|school|college|university" zoom-min="14">
<area fill="#323439" stroke="#b094bf" stroke-width="2.0" />
<area fill="#323439" />
</m>
<m v="hospital">
<area fill="#716553" />
</m>
<m v="parking" zoom-min="14">
<area fill="#444434" stroke="#d4d4d4" stroke-width="0.2" />
<area fill="#444434" />
</m>
<m closed="yes" v="fountain">
<area fill="#b4cbdc" stroke="#000080" stroke-width="0.15" />
<area fill="#b4cbdc" />
</m>
</m>
@@ -292,7 +292,7 @@
</m>
-->
<m v="swimming_pool">
<area fill="#b4cbdc" stroke="#6060ff" stroke-width="0.2" />
<area fill="#b4cbdc" />
</m>
<!-- <m v="track"> <m k="area" v="yes|true">
@@ -932,7 +932,7 @@
<line stroke="#e4e4e4" width="0.3" cap="butt" />
</m>
<m closed="yes">
<area fill="#e4e4e4" stroke="#d0d0d0" stroke-width="0.05" />
<area fill="#e4e4e4" />
</m>
</m> -->
@@ -1021,9 +1021,9 @@
<!-- non-physical boundaries -->
<!-- <m k="boundary"> <m k="boundary" v="national_park">
<line stroke="#4ef94b" width="0.25" stroke-dasharray="15, 5, 5, 5"
/> -->
<m k="boundary" v="national_park">
<area fill="#40abe29c" />
</m>
<!--<m k="boundary" v="administrative"> -->
<m k="admin_level">
@@ -1080,7 +1080,7 @@
<m k="area" v="~|false|no">
<m k="highway">
<m k="oneway" v="yes|true" zoom-min="16">
<lineSymbol src="assets:symbols/oneway.svg" />
<symbol repeat="true" src="assets:symbols/oneway.svg" />
</m>
</m>
</m>

View File

@@ -59,20 +59,21 @@
<!-- <style-area id="wood" fill="#d1dbc7" fade="8" blend="11" blend-fill="#9ac56e" /> -->
<!--Note: ordered according to their inheritance via the `use` attribute-->
<style-area id="tex1" src="assets:textures/rough.png" />
<!-- Avoid patterns and textures because of old GPU issues -->
<!--<style-area id="tex1" src="assets:textures/rough.png" />-->
<!-- meadow|garden -->
<style-area fade="10" fill="#c9dc91" id="greens" use="tex1" />
<style-area fade="10" fill="#c9dc91" id="greens" />
<!-- grass -->
<style-area fade="12" fill="#d3dcb9" id="lightgreen" use="tex1" />
<style-area fade="12" fill="#d3dcb9" id="lightgreen" />
<!-- grassland|scrub -->
<style-area fade="10" fill="#c2cba5" id="darkgreen" use="tex1" />
<style-area fade="10" fill="#c2cba5" id="darkgreen" />
<!--farmland-->
<style-area fade="12" fill="#e4dab5" id="farmland" stroke="#d1dbc7" stroke-width="1.0"
use="tex1" />
<style-area fade="12" fill="#e4dab5" id="farmland" />
<!-- <style-area id="greens" fill="#d2e5ce" fade="10" /> -->
@@ -80,15 +81,15 @@
<style-area fade="12" fill="#deecb9" id="greens2" />
<!-- park|common|green|cemetery|golf_course|dog_park -->
<style-area fade="11" fill="#9ac56e" id="park" use="tex1" />
<!-- <style-area id="wood" use="park" fill="#9ac56e" fade="8" stroke="#d1dbc7" stroke-width="1.0"/> -->
<style-area fade="11" fill="#9ac56e" id="park" />
<!-- <style-area id="wood" use="park" fill="#9ac56e" fade="8" /> -->
<!--wood-->
<style-area blend="11" blend-fill="#83aa5b" fade="8" fill="#b3d095" id="wood" use="park" />
<!-- <style-line id="wood" fix="true" cap="butt" width="1.0" stroke="#9ac56e" /> -->
<!-- de:Kleingartengebiet -->
<style-area fade="12" fill="#efeae0" id="allotments" use="tex1" />
<style-area fade="12" fill="#efeae0" id="allotments" />
<!-- de:Steinbruch, Schotter-, Kies-, Sand- und Tongrube -->
<style-area fade="10" fill="#ddddcc" id="quarry" />
@@ -96,13 +97,13 @@
<!--military-->
<style-area fade="10" fill="#eeedea" id="military" />
<!--building-->
<style-area fade="15" fill="#f2f0eb" id="building" stroke="#b7b6b3" stroke-width="1.0" />
<style-area fade="15" fill="#f2f0eb" id="building" />
<!--<style-area id="building" fill="#e9e6e3" fade="15"/>-->
<!--water-->
<!--<style-area id="water" fill="#97b7e5" afc5e3 /> -->
<!-- src="assets:textures/water.png" -->
<style-area fade="-1" fill="#99badf" id="water" mesh="true" />
<style-area fade="-1" fill="#99badf" id="water" />
<!--###### LINE styles ######-->
@@ -241,7 +242,7 @@
<m k="layer" v="park">
<m k="class">
<m v="national_park|nature_reserve">
<area use="greens2" />
<area fill="#40abe29c" />
</m>
</m>
</m>
@@ -328,7 +329,12 @@
<line outline="motorway" use="highway:z11" />
</m>
</m>
<!--</m>-->
<m k="oneway" v="1" zoom-min="16">
<m k="class" v="motorway|trunk|primary|secondary|tertiary|minor">
<symbol repeat="true" src="assets:symbols/oneway.svg" />
</m>
</m>
</m>
<m k="layer" v="transportation_name">
@@ -351,7 +357,7 @@
<m k="layer" v="water">
<m k="class">
<m v="ocean|lake|river">
<area use="water" />
<area mesh="true" use="water" />
</m>
</m>
</m>
@@ -384,6 +390,7 @@
<m zoom-min="14">
<m closed="yes">
<area fade="14" use="building" />
<line fade="14" use="building" />
</m>
<m closed="no">
<line fade="14" use="building" />
@@ -394,6 +401,7 @@
<m zoom-min="16">
<m closed="yes">
<area fade="16" use="building" />
<line fade="16" use="building" />
</m>
<m closed="no">
<line fade="16" use="building" />

View File

@@ -41,7 +41,7 @@
<!--###### AREA styles ######-->
<!--water-->
<style-area fill="#d0d0d0" id="water" mesh="true" />
<style-area fill="#d0d0d0" id="water" />
<!--###### LINE styles ######-->
@@ -56,7 +56,7 @@
<!--###### ASSIGNMENT ######-->
<m e="way" k="natural" v="issea|sea">
<area use="water" />
<area mesh="true" use="water" />
</m>
<m e="way" k="natural" v="nosea">
@@ -69,38 +69,38 @@
<m k="landuse">
<m select="first">
<m v="military">
<area src="assets:patterns/military.png" stroke="#e4e4e4" stroke-width="0.2" />
<area fill="#40ededed" />
</m>
<m v="residential|farmyard">
<area fill="#e4e4e4" />
</m>
<m v="retail">
<area fill="#efefef" stroke="#e4e4e4" stroke-width="0.2" />
<area fill="#efefef" />
</m>
<m v="industrial|brownfield|railway">
<area fill="#dedede" stroke="#e4e4e4" stroke-width="0.2" />
<area fill="#dedede" />
</m>
<m v="commercial">
<area fill="#fafafa" stroke="#e4e4e4" stroke-width="0.2" />
<area fill="#fafafa" />
</m>
<m v="construction|greenfield">
<area fill="#808080" stroke="#e4e4e4" stroke-width="0.2" />
<area fill="#808080" />
</m>
<m v="garages">
<area fill="#d6d6d6" />
</m>
<m v="landfill|quarry">
<area fill="#d8d8d8" stroke="#626262" stroke-width="0.2" />
<area fill="#d8d8d8" />
</m>
<m v="cemetery">
<area src="assets:patterns/cemetery.png" stroke="#e4e4e4" stroke-width="0.2" />
<area fill="#e2e2e2" />
</m>
<m v="field|farm|farmland|meadow|grass">
<area fill="#f9f9f9" stroke="#cecece" stroke-width="0.1" />
<area fill="#f9f9f9" />
</m>
<m v="allotments|village_green|recreation_ground">
<area fill="#d9d9d9" stroke="#a6a6a6" stroke-width="0.2" />
<area fill="#d9d9d9" />
</m>
<m v="reservoir|basin">
<area fill="#d0d0d0" />
@@ -113,24 +113,11 @@
<m k="natural" v="grassland|scrub">
<area fill="#acacac" stroke="#acacac" stroke-width="0.2" />
<area fill="#acacac" />
</m>
<m k="natural|landuse" v="forest|wood">
<m k="wood">
<m k="wood" v="coniferous">
<area src="assets:patterns/wood-coniferous.png" />
</m>
<m k="wood" v="deciduous">
<area src="assets:patterns/wood-deciduous.png" />
</m>
<m k="wood" v="mixed">
<area src="assets:patterns/wood-mixed.png" />
</m>
</m>
<m k="wood" v="~">
<area fill="#acacac" stroke="#acacac" stroke-width="0.2" />
</m>
<area fill="#acacac" />
<m zoom-min="16">
<text use="caption-small-blue" />
@@ -142,19 +129,19 @@
<m k="amenity">
<m select="first">
<m v="kindergarten|school|college|university">
<area fill="#b5b5b5" stroke="#d8d8d8" stroke-width="0.2" />
<area fill="#b5b5b5" />
</m>
<m v="grave_yard">
<area src="assets:patterns/cemetery.png" stroke="#e4e4e4" stroke-width="0.2" />
<area fill="#e2e2e2" />
</m>
<m v="parking">
<area fill="#fafafa" stroke="#d8d8d8" stroke-width="0.2" />
<area fill="#fafafa" />
<m k="access" v="private" zoom-min="15">
<area src="assets:patterns/access-private.png" />
<area fill="#40363636" />
</m>
</m>
<m closed="yes" v="fountain">
<area fill="#d0d0d0" stroke="#080808" stroke-width="0.15" />
<area fill="#d0d0d0" />
</m>
</m>
</m>
@@ -168,23 +155,23 @@
<line stroke="#708599" fix="true" cap="butt" width="2.0" />
</m> &ndash;&gt;
<m closed="yes">
<area fill="#d0d0d0" stroke="#d0d0d0" stroke-width="0.4" />
<area fill="#d0d0d0" />
</m>
</m>-->
<m v="glacier">
<area fill="#fafafa" stroke="#cfcfcf" stroke-width="0.8" />
<area fill="#fafafa" />
</m>
<m v="land">
<area fill="#f8f8f8" stroke="#e0e0e0" stroke-width="0.1" />
<area fill="#f8f8f8" />
</m>
<m v="beach">
<area fill="#cacaca" />
</m>
<m v="heath">
<area fill="#fafafa" stroke="#f7f7f7" stroke-width="0.2" />
<area fill="#fafafa" />
</m>
<m v="marsh|wetland">
<area src="assets:patterns/marsh.png" />
<area fill="#e5e5e5" />
</m>
</m>
<m k="name" zoom-min="16">
@@ -197,25 +184,24 @@
<m k="leisure">
<m select="first">
<m v="park|garden|golf_course|common|green">
<area fill="#e2e2e2" stroke="#acacac" stroke-width="0.2" />
<area fill="#e2e2e2" />
</m>
<m v="playground|playing_fields|pitch|dog_park">
<area fill="#e2e2e2" stroke="#acacac" stroke-width="0.2" />
<area fill="#e2e2e2" />
<m v="playground" zoom-min="17">
<symbol src="assets:symbols/amenity/playground.svg" />
</m>
</m>
<m v="nature_reserve">
<area src="assets:patterns/nature-reserve.png" stroke="#acacac"
stroke-width="0.2" />
<area fill="#40d1d1d1" />
</m>
<m v="stadium|sports_centre|water_park">
<area fill="#d9d9d9" stroke="#acacac" stroke-width="0.2" />
<area fill="#d9d9d9" />
</m>
<m v="track">
<m k="area" v="yes|true">
<area fill="#d9d9d9" stroke="#acacac" stroke-width="0.025" />
<area fill="#d9d9d9" />
</m>
<m k="area" v="~|no|false">
<line stroke="#acacac" width="0.75" />
@@ -223,7 +209,7 @@
</m>
</m>
<m v="swimming_pool">
<area fill="#d0d0d0" stroke="#6b6b6b" stroke-width="0.2" />
<area fill="#d0d0d0" />
</m>
</m>
<m k="name" zoom-min="16">
@@ -281,7 +267,7 @@
<!-- military -->
<m k="military">
<area src="assets:patterns/military.png" stroke="#e4e4e4" stroke-width="0.2" />
<area fill="#40ededed" />
</m>
@@ -291,10 +277,10 @@
<symbol src="assets:symbols/sport/soccer.svg" />
</m>
<m v="swimming|canoe|diving|scuba_diving">
<area fill="#d0d0d0" stroke="#6b6b6b" stroke-width="0.2" />
<area fill="#d0d0d0" />
</m>
<m v="tennis">
<area fill="#969696" stroke="#787878" stroke-width="0.2" />
<area fill="#969696" />
<m zoom-min="17">
<symbol src="assets:symbols/sport/tennis.svg" />
</m>
@@ -308,7 +294,7 @@
<area fill="#d4d4d4" />
</m>
<m v="zoo|picnic_site|caravan_site|camp_site">
<area fill="#e2e2e2" stroke="#acacac" stroke-width="0.2" />
<area fill="#e2e2e2" />
</m>
</m>
@@ -393,28 +379,28 @@
<m k="area" v="yes|true">
<m k="highway">
<m v="footway|footpath">
<area fill="#dedede" stroke="#707070" stroke-width="1.15" />
<area fill="#dedede" />
</m>
<m v="pedestrian">
<area fill="#dedede" stroke="#707070" stroke-width="1.15" />
<area fill="#dedede" />
</m>
<m v="path">
<area fill="#d0d0d0" stroke="#d0d0d0" stroke-width="1.15" />
<area fill="#d0d0d0" />
</m>
<m v="service">
<area fill="#ffffff" stroke="#707070" stroke-width="1.15" />
<area fill="#ffffff" />
</m>
<m v="unclassified">
<area fill="#ffffff" stroke="#707070" stroke-width="1.3" />
<area fill="#ffffff" />
</m>
<m v="residential">
<area fill="#ffffff" stroke="#707070" stroke-width="1.15" />
<area fill="#ffffff" />
</m>
<m v="road">
<area fill="#d0d0d0" />
</m>
<m v="living_street">
<area fill="#ffffff" stroke="#ffffff" stroke-width="1.15" />
<area fill="#ffffff" />
</m>
</m>
</m>
@@ -435,7 +421,7 @@
<m k="aeroway">
<m closed="yes" v="aerodrome">
<m zoom-min="12">
<area fill="#dadada" stroke="#aeaeae" stroke-width="0.8" />
<area fill="#dadada" />
</m>
<m zoom-max="11">
<caption dy="18" fill="#000000" k="ref" priority="5" size="19" stroke="#ffffff"
@@ -450,7 +436,8 @@
<area fill="#f0f0f0" />
</m>
<m v="terminal">
<area fill="#d9d9d9" stroke="#616161" stroke-width="0.2" />
<area fill="#d9d9d9" />
<line cap="butt" fix="true" stroke="#616161" width="1.0" />
</m>
<!-- <m v="runway">
@@ -553,9 +540,10 @@
<m k="building|building:part">
<m select="first">
<m closed="yes">
<area fill="#d9d9d9" stroke="#616161" stroke-width="1.0" />
<area fill="#d9d9d9" />
<line cap="butt" fix="true" stroke="#616161" width="1.0" />
</m>
<m zoom-max="16">
<m closed="no">
<line cap="butt" fix="true" stroke="#616161" width="1.0" />
</m>
</m>
@@ -781,18 +769,6 @@
</m>
</m>
<!-- <m zoom-min="16">
<line width="1.0" stroke="#ff0000" />
<m k="access" v="destination">
<line src="assets:patterns/access-destination.png" width="1.5" />
</m>
<m k="access" v="private">
<line src="assets:patterns/access-private.png" width="1.5" />
</m>
</m> -->
<!-- add outline for all matches -->
<m select="when-matched">
<outline use="casing" />
@@ -952,7 +928,7 @@
<line cap="butt" stroke="#e4e4e4" width="0.3" />
</m>
<m closed="yes">
<area fill="#e4e4e4" stroke="#d0d0d0" stroke-width="0.05" />
<area fill="#e4e4e4" />
</m>
</m>
@@ -983,7 +959,7 @@
<m k="area" v="~|false|no">
<m k="highway">
<m k="oneway" v="yes|true" zoom-min="16">
<lineSymbol src="assets:symbols/oneway.svg" />
<symbol repeat="true" src="assets:symbols/oneway.svg" />
</m>
</m>
</m>
@@ -1013,7 +989,7 @@
<m k="tunnel" v="~|false|no">
<m v="station">
<area fill="#909090" stroke="#707070" stroke-width="0.3" />
<area fill="#909090" />
</m>
<m k="bridge" v="yes|true">
@@ -1061,7 +1037,7 @@
<m k="boundary">
<m k="boundary" v="national_park">
<line dasharray="15, 5, 5, 5" fix="true" stroke="#c8c8c8" width="1.25" />
<area fill="#40d1d1d1" />
</m>
<m k="boundary" v="administrative">
<m k="admin_level">

View File

@@ -41,7 +41,7 @@
<!--###### AREA styles ######-->
<!--water-->
<style-area fill="#b5d6f1" id="water" mesh="true" />
<style-area fill="#b5d6f1" id="water" />
<!--###### LINE styles ######-->
@@ -56,7 +56,7 @@
<!--###### ASSIGNMENT ######-->
<m e="way" k="natural" v="issea|sea">
<area use="water" />
<area mesh="true" use="water" />
</m>
<m e="way" k="natural" v="nosea">
@@ -69,38 +69,38 @@
<m k="landuse">
<m select="first">
<m v="military">
<area src="assets:patterns/military.png" stroke="#e4e4e4" stroke-width="0.2" />
<area fill="#40eeedea" />
</m>
<m v="residential|farmyard">
<area fill="#e4e4e4" />
</m>
<m v="retail">
<area fill="#ffebeb" stroke="#e4e4e4" stroke-width="0.2" />
<area fill="#ffebeb" />
</m>
<m v="industrial|brownfield|railway">
<area fill="#ecd8ff" stroke="#e4e4e4" stroke-width="0.2" />
<area fill="#ecd8ff" />
</m>
<m v="commercial">
<area fill="#ffffc0" stroke="#e4e4e4" stroke-width="0.2" />
<area fill="#ffffc0" />
</m>
<m v="construction|greenfield">
<area fill="#a47c41" stroke="#e4e4e4" stroke-width="0.2" />
<area fill="#a47c41" />
</m>
<m v="garages">
<area fill="#d6d6e4" />
</m>
<m v="landfill|quarry">
<area fill="#e9dd72" stroke="#556b2f" stroke-width="0.2" />
<area fill="#e9dd72" />
</m>
<m v="cemetery">
<area src="assets:patterns/cemetery.png" stroke="#e4e4e4" stroke-width="0.2" />
<area fill="#c7f1a3" />
</m>
<m v="field|farm|farmland|meadow|grass">
<area fill="#ebfff2" stroke="#9ee673" stroke-width="0.1" />
<area fill="#ebfff2" />
</m>
<m v="allotments|village_green|recreation_ground">
<area fill="#bde3cb" stroke="#6fc13d" stroke-width="0.2" />
<area fill="#bde3cb" />
</m>
<m v="reservoir|basin">
<area fill="#b5d6f1" />
@@ -113,24 +113,11 @@
<m k="natural" v="grassland|scrub">
<area fill="#6fc18e" stroke="#6fc18e" stroke-width="0.2" />
<area fill="#6fc18e" />
</m>
<m k="natural|landuse" v="forest|wood">
<m k="wood">
<m k="wood" v="coniferous">
<area src="assets:patterns/wood-coniferous.png" />
</m>
<m k="wood" v="deciduous">
<area src="assets:patterns/wood-deciduous.png" />
</m>
<m k="wood" v="mixed">
<area src="assets:patterns/wood-mixed.png" />
</m>
</m>
<m k="wood" v="~">
<area fill="#6fc18e" stroke="#6fc18e" stroke-width="0.2" />
</m>
<area fill="#6fc18e" />
<m zoom-min="16">
<text use="caption-small-blue" />
@@ -142,19 +129,19 @@
<m k="amenity">
<m select="first">
<m v="kindergarten|school|college|university">
<area fill="#cdabde" stroke="#e9dd72" stroke-width="0.2" />
<area fill="#cdabde" />
</m>
<m v="grave_yard">
<area src="assets:patterns/cemetery.png" stroke="#e4e4e4" stroke-width="0.2" />
<area fill="#c7f1a3" />
</m>
<m v="parking">
<area fill="#ffffc0" stroke="#e9dd72" stroke-width="0.2" />
<area fill="#ffffc0" />
<m k="access" v="private" zoom-min="15">
<area src="assets:patterns/access-private.png" />
<area fill="#40ff0000" />
</m>
</m>
<m closed="yes" v="fountain">
<area fill="#b5d6f1" stroke="#000080" stroke-width="0.15" />
<area fill="#b5d6f1" />
</m>
</m>
</m>
@@ -168,23 +155,23 @@
<line stroke="#708599" fix="true" cap="butt" width="2.0" />
</m> &ndash;&gt;
<m closed="yes">
<area fill="#b5d6f1" stroke="#b5d6f1" stroke-width="0.4" />
<area fill="#b5d6f1" />
</m>
</m>-->
<m v="glacier">
<area fill="#fafaff" stroke="#add8e6" stroke-width="0.8" />
<area fill="#fafaff" />
</m>
<m v="land">
<area fill="#f8f8f8" stroke="#e0e0e0" stroke-width="0.1" />
<area fill="#f8f8f8" />
</m>
<m v="beach">
<area fill="#eecc55" />
</m>
<m v="heath">
<area fill="#ffffc0" stroke="#ffff90" stroke-width="0.2" />
<area fill="#ffffc0" />
</m>
<m v="marsh|wetland">
<area src="assets:patterns/marsh.png" />
<area fill="#deecb9" />
</m>
</m>
<m k="name" zoom-min="16">
@@ -197,25 +184,24 @@
<m k="leisure">
<m select="first">
<m v="park|garden|golf_course|common|green">
<area fill="#c7f1a3" stroke="#6fc18e" stroke-width="0.2" />
<area fill="#c7f1a3" />
</m>
<m v="playground|playing_fields|pitch|dog_park">
<area fill="#c7f1a3" stroke="#6fc18e" stroke-width="0.2" />
<area fill="#c7f1a3" />
<m v="playground" zoom-min="17">
<symbol src="assets:symbols/amenity/playground.svg" />
</m>
</m>
<m v="nature_reserve">
<area src="assets:patterns/nature-reserve.png" stroke="#6fc18e"
stroke-width="0.2" />
<area fill="#40abe29c" />
</m>
<m v="stadium|sports_centre|water_park">
<area fill="#bde3cb" stroke="#6fc18e" stroke-width="0.2" />
<area fill="#bde3cb" />
</m>
<m v="track">
<m k="area" v="yes|true">
<area fill="#bde3cb" stroke="#6fc18e" stroke-width="0.025" />
<area fill="#bde3cb" />
</m>
<m k="area" v="~|no|false">
<line stroke="#6fc18e" width="0.75" />
@@ -223,7 +209,7 @@
</m>
</m>
<m v="swimming_pool">
<area fill="#b5d6f1" stroke="#6060ff" stroke-width="0.2" />
<area fill="#b5d6f1" />
</m>
</m>
<m k="name" zoom-min="16">
@@ -281,7 +267,7 @@
<!-- military -->
<m k="military">
<area src="assets:patterns/military.png" stroke="#e4e4e4" stroke-width="0.2" />
<area fill="#40eeedea" />
</m>
@@ -291,10 +277,10 @@
<symbol src="assets:symbols/sport/soccer.svg" />
</m>
<m v="swimming|canoe|diving|scuba_diving">
<area fill="#b5d6f1" stroke="#6060ff" stroke-width="0.2" />
<area fill="#b5d6f1" />
</m>
<m v="tennis">
<area fill="#d18a6a" stroke="#b36c4c" stroke-width="0.2" />
<area fill="#d18a6a" />
<m zoom-min="17">
<symbol src="assets:symbols/sport/tennis.svg" />
</m>
@@ -308,7 +294,7 @@
<area fill="#f2caea" />
</m>
<m v="zoo|picnic_site|caravan_site|camp_site">
<area fill="#c7f1a3" stroke="#6fc18e" stroke-width="0.2" />
<area fill="#c7f1a3" />
</m>
</m>
@@ -393,28 +379,28 @@
<m k="area" v="yes|true">
<m k="highway">
<m v="footway|footpath">
<area fill="#e5e0c2" stroke="#707070" stroke-width="1.15" />
<area fill="#e5e0c2" />
</m>
<m v="pedestrian">
<area fill="#e5e0c2" stroke="#707070" stroke-width="1.15" />
<area fill="#e5e0c2" />
</m>
<m v="path">
<area fill="#d0d0d0" stroke="#d0d0d0" stroke-width="1.15" />
<area fill="#d0d0d0" />
</m>
<m v="service">
<area fill="#ffffff" stroke="#707070" stroke-width="1.15" />
<area fill="#ffffff" />
</m>
<m v="unclassified">
<area fill="#ffffff" stroke="#707070" stroke-width="1.3" />
<area fill="#ffffff" />
</m>
<m v="residential">
<area fill="#ffffff" stroke="#707070" stroke-width="1.15" />
<area fill="#ffffff" />
</m>
<m v="road">
<area fill="#d0d0d0" />
</m>
<m v="living_street">
<area fill="#ffffff" stroke="#ffffff" stroke-width="1.15" />
<area fill="#ffffff" />
</m>
</m>
</m>
@@ -435,7 +421,7 @@
<m k="aeroway">
<m closed="yes" v="aerodrome">
<m zoom-min="12">
<area fill="#d8dcce" stroke="#b8acae" stroke-width="0.8" />
<area fill="#d8dcce" />
</m>
<m zoom-max="11">
<caption dy="18" fill="#000000" k="ref" priority="5" size="19" stroke="#ffffff"
@@ -450,7 +436,8 @@
<area fill="#f0f0f0" />
</m>
<m v="terminal">
<area fill="#f3d6b6" stroke="#6a5a8e" stroke-width="0.2" />
<area fill="#f3d6b6" />
<line cap="butt" fix="true" stroke="#6a5a8e" width="1.0" />
</m>
<!-- <m v="runway">
@@ -553,9 +540,10 @@
<m k="building|building:part">
<m select="first">
<m closed="yes">
<area fill="#f3d6b6" stroke="#6a5a8e" stroke-width="1.0" />
<area fill="#f3d6b6" />
<line cap="butt" fix="true" stroke="#6a5a8e" width="1.0" />
</m>
<m zoom-max="16">
<m closed="no">
<line cap="butt" fix="true" stroke="#6a5a8e" width="1.0" />
</m>
</m>
@@ -781,18 +769,6 @@
</m>
</m>
<!-- <m zoom-min="16">
<line width="1.0" stroke="#ff0000" />
<m k="access" v="destination">
<line src="assets:patterns/access-destination.png" width="1.5" />
</m>
<m k="access" v="private">
<line src="assets:patterns/access-private.png" width="1.5" />
</m>
</m> -->
<!-- add outline for all matches -->
<m select="when-matched">
<outline use="casing" />
@@ -952,7 +928,7 @@
<line cap="butt" stroke="#e4e4e4" width="0.3" />
</m>
<m closed="yes">
<area fill="#e4e4e4" stroke="#d0d0d0" stroke-width="0.05" />
<area fill="#e4e4e4" />
</m>
</m>
@@ -983,7 +959,7 @@
<m k="area" v="~|false|no">
<m k="highway">
<m k="oneway" v="yes|true" zoom-min="16">
<lineSymbol src="assets:symbols/oneway.svg" />
<symbol repeat="true" src="assets:symbols/oneway.svg" />
</m>
</m>
</m>
@@ -1013,7 +989,7 @@
<m k="tunnel" v="~|false|no">
<m v="station">
<area fill="#9b9b79" stroke="#707070" stroke-width="0.3" />
<area fill="#9b9b79" />
</m>
<m k="bridge" v="yes|true">
@@ -1061,7 +1037,7 @@
<m k="boundary">
<m k="boundary" v="national_park">
<line dasharray="15, 5, 5, 5" fix="true" stroke="#4ef94b" width="1.25" />
<area fill="#40abe29c" />
</m>
<m k="boundary" v="administrative">
<m k="admin_level">

View File

@@ -73,7 +73,7 @@
<style-area fade="15" fill="#ee606060" id="building" />
<!--water-->
<style-area fill="#001223" id="water" mesh="true" />
<style-area fill="#001223" id="water" />
<!--###### LINE styles ######-->
@@ -122,7 +122,7 @@
<!--###### ASSIGNMENT ######-->
<m e="way" k="natural" v="issea|sea">
<area use="water" />
<area mesh="true" use="water" />
</m>
<m e="way" k="natural" v="nosea">
@@ -168,7 +168,7 @@
<m k="landuse|natural|leisure||amenity">
<!-- kind of more like landuse imho -->
<m k="leisure|landuse" v="nature_reserve">
<area use="greens2" />
<area fill="#40abe29c" />
<m zoom-min="14">
<line cap="butt" fix="true" stroke="#abe29c" width="1.0" />
</m>
@@ -229,17 +229,17 @@
<!-- amenity -->
<m k="amenity">
<m v="kindergarten|school|college|university" zoom-min="14">
<area fill="#524459" stroke="#b094bf" stroke-width="0.2" />
<area fill="#524459" />
</m>
<m v="hospital">
<area fill="#716553" />
</m>
<m v="parking" zoom-min="14">
<area fill="#444434" stroke="#d4d4d4" stroke-width="0.2" />
<area fill="#444434" />
</m>
<m closed="yes" v="fountain">
<area fill="#b4cbdc" stroke="#000080" stroke-width="0.15" />
<area fill="#b4cbdc" />
</m>
</m>
@@ -292,7 +292,7 @@
</m>
-->
<m v="swimming_pool">
<area fill="#b4cbdc" stroke="#6060ff" stroke-width="0.2" />
<area fill="#b4cbdc" />
</m>
<!-- <m v="track"> <m k="area" v="yes|true">
@@ -925,7 +925,7 @@
<line stroke="#e4e4e4" width="0.3" cap="butt" />
</m>
<m closed="yes">
<area fill="#e4e4e4" stroke="#d0d0d0" stroke-width="0.05" />
<area fill="#e4e4e4" />
</m>
</m> -->
@@ -1014,9 +1014,9 @@
<!-- non-physical boundaries -->
<!-- <m k="boundary"> <m k="boundary" v="national_park">
<line stroke="#4ef94b" width="0.25" stroke-dasharray="15, 5, 5, 5"
/> -->
<m k="boundary" v="national_park">
<area fill="#40abe29c" />
</m>
<!--<m k="boundary" v="administrative"> -->
<m k="admin_level">
@@ -1073,7 +1073,7 @@
<m k="area" v="~|false|no">
<m k="highway">
<m k="oneway" v="yes|true" zoom-min="16">
<lineSymbol src="assets:symbols/oneway.svg" />
<symbol repeat="true" src="assets:symbols/oneway.svg" />
</m>
</m>
</m>

View File

@@ -56,8 +56,7 @@
<!-- <style-area id="greens" fill="#d2e5ce" fade="10" /> -->
<!--farmland-->
<style-area fade="12" fill="#e4dab5" id="farmland" stroke="#d1dbc7" stroke-width="1.0"
use="tex1" />
<style-area fade="12" fill="#e4dab5" id="farmland" use="tex1" />
<!-- marsh|wetland|mud|nature_reserve -->
<style-area fade="12" fill="#deecb9" id="greens2" />
@@ -72,7 +71,7 @@
<!-- <style-area id="wood" fill="#d1dbc7" fade="8" blend="11" blend-fill="#9ac56e" /> -->
<style-area blend="11" blend-fill="#83aa5b" fade="8" fill="#b3d095" id="wood" use="park" />
<!-- <style-line id="wood" fix="true" cap="butt" width="1.0" stroke="#9ac56e" /> -->
<!-- <style-area id="wood" use="park" fill="#9ac56e" fade="8" stroke="#d1dbc7" stroke-width="1.0"/> -->
<!-- <style-area id="wood" use="park" fill="#9ac56e" fade="8" /> -->
<!-- de:Kleingartengebiet -->
<style-area fade="12" fill="#efeae0" id="allotments" use="tex1" />
@@ -83,7 +82,7 @@
<!--military-->
<style-area fade="10" fill="#eeedea" id="military" />
<!--building-->
<style-area fade="15" fill="#f2f0eb" id="building" stroke="#b7b6b3" stroke-width="1.0" />
<style-area fade="15" fill="#f2f0eb" id="building" />
<!--<style-area id="building" fill="#e9e6e3" fade="15"/>-->
<!--water-->
@@ -268,10 +267,10 @@
<area fill="#f2d9b1" />
</m>
<!-- <m v="parking" zoom-min="15">
<area fill="#f4f4f4" stroke="#d4d4d4" stroke-width="0.2" />
<area fill="#f4f4f4" />
</m>
<m v="fountain" closed="yes">
<area fill="#b4cbdc" stroke="#000080" stroke-width="0.15" />
<area fill="#b4cbdc" />
</m> -->
</m>
@@ -305,12 +304,9 @@
</m>
<m k="landuse|natural" v="forest|wood">
<m zoom-max="9" zoom-min="8">
<m zoom-min="8">
<area use="wood" />
</m>
<m zoom-min="10">
<area stroke="#91bf63" stroke-width="1.0" use="wood" />
</m>
</m>
<!-- keep grass above forest:wood and leisure:park! -->
@@ -336,10 +332,10 @@
</m>
-->
<m v="parking" zoom-min="15">
<area fill="#f4f4f4" stroke="#d4d4d4" stroke-width="0.2" />
<area fill="#f4f4f4" />
</m>
<m closed="yes" v="fountain">
<area fill="#b4cbdc" stroke="#000080" stroke-width="0.15" />
<area fill="#b4cbdc" />
</m>
</m>
@@ -385,7 +381,7 @@
<line cap="butt" fix="true" stroke="#d9d9a3" width="1.0" />
</m>
<m v="swimming_pool">
<area fill="#d4ebfc" stroke="#6060ff" stroke-width="0.2" />
<area fill="#d4ebfc" />
</m>
<!-- <m v="track"> <m k="area" v="yes|true">
@@ -607,6 +603,7 @@
<!-- Airport passenger building -->
<m v="terminal|hangar">
<area use="building" />
<line use="building" />
</m>
</m>
@@ -620,6 +617,7 @@
<m zoom-max="16" zoom-min="14">
<m closed="yes">
<area fade="14" use="building" />
<line fade="14" use="building" />
</m>
<m closed="no">
<line fade="14" use="building" />
@@ -905,7 +903,7 @@
<line cap="butt" stroke="#e4e4e4" width="0.3" />
</m>
<m closed="yes">
<area fill="#e4e4e4" stroke="#d0d0d0" stroke-width="1.05" />
<area fill="#e4e4e4" />
</m>
</m>
@@ -924,7 +922,7 @@
<m k="tunnel" v="~|false|no">
<m k="railway" v="station">
<area fill="#dbdbc9" stroke="#707070" stroke-width="0.3" />
<area fill="#dbdbc9" />
</m>
<!-- railway bridge casings -->

View File

@@ -3,7 +3,7 @@ apply plugin: 'maven'
dependencies {
api "org.slf4j:slf4j-api:$slf4jVersion"
compileOnly 'com.google.code.findbugs:jsr305:3.0.1'
compileOnly 'com.google.code.findbugs:jsr305:3.0.2'
}
sourceSets {

View File

@@ -0,0 +1,38 @@
#ifdef GLES
precision mediump float;
#endif
uniform mat4 u_mvp;
uniform float u_phase;
uniform float u_scale;
attribute vec2 a_pos;
varying vec2 v_tex;
void main() {
gl_Position = u_mvp * vec4(a_pos * u_scale * u_phase, 0.0, 1.0);
v_tex = a_pos;
}
$$
#ifdef GLES
precision mediump float;
#endif
varying vec2 v_tex;
uniform float u_scale;
uniform int u_mode;
uniform vec4 u_color;
void main() {
float len = 1.0 - length(v_tex);
if (u_mode == -1) {
gl_FragColor = u_color * len;
} else {
// outer ring
float a = smoothstep(0.0, 2.0 / u_scale, len);
// inner ring
float b = 0.8 * smoothstep(3.0 / u_scale, 4.0 / u_scale, len);
// - subtract inner from outer to create the outline
a = a - b;
gl_FragColor = u_color * a;
}
}

View File

@@ -19,7 +19,6 @@ precision mediump float;
#endif
varying vec2 v_tex;
uniform float u_scale;
uniform float u_phase;
uniform vec2 u_dir;
uniform int u_mode;
uniform vec4 u_color;

View File

@@ -19,7 +19,6 @@ precision mediump float;
#endif
varying vec2 v_tex;
uniform float u_scale;
uniform float u_phase;
uniform vec2 u_dir;
uniform int u_mode;
uniform vec4 u_color;

View File

@@ -19,7 +19,6 @@ precision mediump float;
#endif
varying vec2 v_tex;
uniform float u_scale;
uniform float u_phase;
uniform vec2 u_dir;
uniform int u_mode;
uniform vec4 u_color;

View File

@@ -99,14 +99,14 @@ public final class MercatorProjection {
}
public static Point getPixelWithScale(GeoPoint geoPoint, double scale) {
double pixelX = MercatorProjection.longitudeToPixelXWithScale(geoPoint.getLongitude(), scale);
double pixelY = MercatorProjection.latitudeToPixelYWithScale(geoPoint.getLatitude(), scale);
double pixelX = longitudeToPixelXWithScale(geoPoint.getLongitude(), scale);
double pixelY = latitudeToPixelYWithScale(geoPoint.getLatitude(), scale);
return new Point(pixelX, pixelY);
}
public static Point getPixel(GeoPoint geoPoint, long mapSize) {
double pixelX = MercatorProjection.longitudeToPixelX(geoPoint.getLongitude(), mapSize);
double pixelY = MercatorProjection.latitudeToPixelY(geoPoint.getLatitude(), mapSize);
double pixelX = longitudeToPixelX(geoPoint.getLongitude(), mapSize);
double pixelY = latitudeToPixelY(geoPoint.getLatitude(), mapSize);
return new Point(pixelX, pixelY);
}
@@ -130,8 +130,8 @@ public final class MercatorProjection {
* @return the relative pixel position to the origin values (e.g. for a tile)
*/
public static Point getPixelRelative(GeoPoint geoPoint, long mapSize, double x, double y) {
double pixelX = MercatorProjection.longitudeToPixelX(geoPoint.getLongitude(), mapSize) - x;
double pixelY = MercatorProjection.latitudeToPixelY(geoPoint.getLatitude(), mapSize) - y;
double pixelX = longitudeToPixelX(geoPoint.getLongitude(), mapSize) - x;
double pixelY = latitudeToPixelY(geoPoint.getLatitude(), mapSize) - y;
return new Point(pixelX, pixelY);
}
@@ -172,11 +172,8 @@ public final class MercatorProjection {
/ (Tile.SIZE * scale);
}
public static float groundResolution(MapPosition pos) {
double lat = MercatorProjection.toLatitude(pos.y);
return (float) (Math.cos(lat * (Math.PI / 180))
* MercatorProjection.EARTH_CIRCUMFERENCE
/ (Tile.SIZE * pos.scale));
public static double groundResolution(MapPosition pos) {
return groundResolutionWithScale(toLatitude(pos.y), pos.scale);
}
/**
@@ -360,7 +357,7 @@ public final class MercatorProjection {
* @return pixels that represent the meters at the given zoom-level and latitude.
*/
public static double metersToPixelsWithScale(float meters, double latitude, double scale) {
return meters / MercatorProjection.groundResolutionWithScale(latitude, scale);
return meters / groundResolutionWithScale(latitude, scale);
}
/**
@@ -372,7 +369,7 @@ public final class MercatorProjection {
* @return pixels that represent the meters at the given zoom-level and latitude.
*/
public static double metersToPixels(float meters, double latitude, long mapSize) {
return meters / MercatorProjection.groundResolution(latitude, mapSize);
return meters / groundResolution(latitude, mapSize);
}
/**

View File

@@ -1,7 +1,7 @@
/*
* Copyright 2013 Ahmad Saleem
* Copyright 2013 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
@@ -45,7 +45,7 @@ public class LocationLayer extends Layer {
locationRenderer.animate(false);
}
public void setPosition(double latitude, double longitude, double accuracy) {
public void setPosition(double latitude, double longitude, float accuracy) {
double x = MercatorProjection.longitudeToX(longitude);
double y = MercatorProjection.latitudeToY(latitude);
double radius = accuracy / MercatorProjection.groundResolutionWithScale(latitude, 1);

View File

@@ -1,6 +1,8 @@
/*
* Copyright 2013 Ahmad Saleem
* Copyright 2013 Hannes Janetzek
* Copyright 2016-2019 devemux86
* Copyright 2017-2018 Longri
* Copyright 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
@@ -15,19 +17,22 @@
*/
package org.oscim.layers;
import org.oscim.backend.CanvasAdapter;
import org.oscim.core.MercatorProjection;
import org.oscim.map.Map;
import org.oscim.renderer.LocationTextureRenderer;
import org.oscim.renderer.atlas.TextureRegion;
public class LocationTextureLayer extends Layer {
public final LocationTextureRenderer locationRenderer;
public LocationTextureLayer(Map map, TextureRegion textureRegion) {
public LocationTextureLayer(Map map) {
this(map, CanvasAdapter.getScale());
}
public LocationTextureLayer(Map map, float scale) {
super(map);
mRenderer = locationRenderer = new LocationTextureRenderer(map);
locationRenderer.setTextureRegion(textureRegion);
mRenderer = locationRenderer = new LocationTextureRenderer(map, this, scale);
}
@Override
@@ -41,14 +46,11 @@ public class LocationTextureLayer extends Layer {
locationRenderer.animate(false);
}
public void setPosition(double latitude, double longitude, float bearing, float accuracy) {
public void setPosition(double latitude, double longitude, float accuracy) {
double x = MercatorProjection.longitudeToX(longitude);
double y = MercatorProjection.latitudeToY(latitude);
bearing = -bearing;
while (bearing < 0)
bearing += 360;
double radius = accuracy / MercatorProjection.groundResolutionWithScale(latitude, 1);
locationRenderer.setLocation(x, y, bearing, radius);
locationRenderer.setLocation(x, y, radius);
locationRenderer.animate(true);
}
}

View File

@@ -5,6 +5,7 @@
* Copyright 2016-2019 devemux86
* Copyright 2016 Stephan Leuschner
* Copyright 2016 Pedinel
* Copyright 2019 Carlos Alberto Martínez Gadea
*
* This file is part of the OpenScienceMap project (http://www.opensciencemap.org).
*
@@ -264,6 +265,9 @@ public class ItemizedLayer<Item extends MarkerInterface> extends MarkerLayer<Ite
@Override
public boolean onGesture(Gesture g, MotionEvent e) {
if (!isEnabled())
return false;
if (g instanceof Gesture.Tap)
return activateSelectedItems(e, mActiveItemSingleTap);

View File

@@ -16,12 +16,7 @@
package org.oscim.layers.tile.buildings;
import org.oscim.backend.canvas.Color;
import org.oscim.core.Box;
import org.oscim.core.GeometryBuffer;
import org.oscim.core.MapElement;
import org.oscim.core.Tag;
import org.oscim.core.TagSet;
import org.oscim.core.Tile;
import org.oscim.core.*;
import org.oscim.layers.tile.MapTile;
import org.oscim.layers.tile.vector.VectorTileLayer;
import org.oscim.map.Map;
@@ -302,12 +297,12 @@ public class S3DBLayer extends BuildingLayer {
case Tag.VALUE_GABLED:
case Tag.VALUE_GAMBREL:
specialParts = new GeometryBuffer(0, 0); // No data in GeometryBuffer needed
success = S3DBUtils.calcRidgeMesh(gElement, minHeight, maxHeight, roofOrientationAcross, true, specialParts);
success = S3DBUtils.calcRidgeMesh(gElement, minHeight, maxHeight, roofOrientationAcross, v, specialParts);
break;
case Tag.VALUE_MANSARD:
case Tag.VALUE_HALF_HIPPED:
case Tag.VALUE_HIPPED:
success = S3DBUtils.calcRidgeMesh(gElement, minHeight, maxHeight, roofOrientationAcross, false, null);
success = S3DBUtils.calcRidgeMesh(gElement, minHeight, maxHeight, roofOrientationAcross, v, null);
break;
case Tag.VALUE_SKILLION:
// ROOF_SLOPE_DIRECTION is not supported yet

View File

@@ -39,6 +39,32 @@ public final class S3DBUtils {
private static final boolean IMPROVE_RIDGE_CALCULATION = false;
private static final int SNAP_THRESHOLD = 70; // Threshold for ridge snap calculation (maybe should depend on map scale)
private static final float[][] PROFILE_DOME = new float[][]{
{1, 0},
{0.825f, 0.5f},
{0.5f, 0.825f},
{0, 1}};
private static final float[][] PROFILE_HIPPED = new float[][]{
{1, 0},
{0, 1}};
private static final float[][] PROFILE_MANSARD = new float[][]{
{1, 0},
{0.75f, 0.75f},
{0, 1}};
private static final float[][] PROFILE_ONION = new float[][]{
{1, 0},
{0.2f, 0.01f},
{0.875f, 0.1875f},
{1, 0.375f},
{0.875f, 0.5625f},
{0.5f, 0.75f},
{0.2f, 0.8125f},
{0, 1}};
private static final float[][] PROFILE_SALTBOX = new float[][]{
{1, 0},
{0.5f, 1},
{0, 1}};
/**
* Adds point to ridgePoints and snaps it to a point which is in radius of SNAP_THRESHOLD.
*/
@@ -64,7 +90,7 @@ public final class S3DBUtils {
* @param element the GeometryBuffer which is used to write the 3D mesh
* @return true if calculation succeeded, false otherwise
*/
public static boolean calcCircleMesh(GeometryBuffer element, float minHeight, float maxHeight, String type) {
public static boolean calcCircleMesh(GeometryBuffer element, float minHeight, float maxHeight, String roofShape) {
float[] points = element.points;
int[] index = element.index;
@@ -81,30 +107,7 @@ public final class S3DBUtils {
// Init mesh
GeometryBuffer mesh;
switch (type) {
case Tag.VALUE_ONION:
float[][] onionShape = new float[][]{
{1, 0, 0},
{0.2f, 0, 0.01f},
{0.875f, 0, 0.1875f},
{1, 0, 0.375f},
{0.875f, 0, 0.5625f},
{0.5f, 0, 0.75f},
{0.2f, 0, 0.8125f},
{0, 0, 1}};
mesh = initCircleMesh(onionShape, numSections);
break;
case Tag.VALUE_DOME:
default:
float[][] domeShape = new float[][]{
{1, 0, 0},
{0.825f, 0, 0.5f},
{0.5f, 0, 0.825f},
{0, 0, 1}};
mesh = initCircleMesh(domeShape, numSections);
break;
}
mesh = initCircleMesh(getProfile(roofShape), numSections);
// Calculate center and load points
float centerX = 0;
@@ -363,14 +366,16 @@ public final class S3DBUtils {
* @param minHeight the minimum height
* @param maxHeight the maximum height
* @param orientationAcross indicates if ridge is parallel to short side
* @param isGabled indicates if should calculate a gable
* @param roofShape the roof shape
* @param specialParts element to add missing parts of underlying element
* @return true if calculation succeeded, false otherwise
*/
public static boolean calcRidgeMesh(GeometryBuffer element, float minHeight, float maxHeight, boolean orientationAcross, boolean isGabled, GeometryBuffer specialParts) {
public static boolean calcRidgeMesh(GeometryBuffer element, float minHeight, float maxHeight, boolean orientationAcross, String roofShape, GeometryBuffer specialParts) {
float[] points = element.points;
int[] index = element.index;
boolean isGabled = isGabled(roofShape);
for (int i = 0, pointPos = 0; i < index.length; i++) {
if (index[i] < 0) {
break;
@@ -395,9 +400,10 @@ public final class S3DBUtils {
point3Fs.add(new float[]{x, y, minHeight});
}
// Calc vectors
// Number of ground points
int groundSize = point3Fs.size();
// Calc vectors
List<Float> lengths = new ArrayList<>();
List<float[]> normVectors = GeometryUtils.normalizedVectors2D(point3Fs, lengths);
@@ -627,9 +633,13 @@ public final class S3DBUtils {
}
}
float[][] profile = getProfile(roofShape);
int profileSize = profile.length - 2;
int profileSizePlus = profile.length - 1; // profile roof shape size + ground size (+1)
// Allocate the indices to the points
int ridgePointSize = ridgePoints.size();
float[] meshPoints = new float[(groundSize + ridgePointSize) * 3]; //(ridgePoints * 3 = 6)
float[] meshPoints = new float[(groundSize * profileSizePlus + ridgePointSize) * 3]; //(ridgePoints * 3 = 6)
List<Integer> meshVarIndex = new ArrayList<>();
// Add special building parts
@@ -638,41 +648,93 @@ public final class S3DBUtils {
meshPartVarIndex = new ArrayList<>();
}
for (int k = 0; k < groundSize; k++) {
float heightRange = maxHeight - minHeight;
// Number of 3D-points for the roof (groundSize * inner profile + groundSize)
int grRsSize = groundSize * profileSizePlus;
// WRITE MESH
for (int l = 0; l < groundSize; l++) {
// l: #ground points
// k: #(shape points + ground points)
int k = l * profileSizePlus;
// Add first face
float[] p = point3Fs.get(k);
int ridgePointIndex1 = k;
float[] p = point3Fs.get(l);
int ridgePointIndex1 = l;
while (!ridgePoints.containsKey(ridgePointIndex1)) {
ridgePointIndex1 = (ridgePointIndex1 + groundSize - 1) % groundSize; // Decrease ridgePointIndex
ridgePointIndex1 = (ridgePointIndex1 + groundSize - 1) % groundSize; // Decrease ridgePointIndex until a ridge point is found for the k point.
}
int ridgeIndex1 = ridgePoints.headMap(ridgePointIndex1).size(); // set ridgeIndex to shift in ridgePoints
if (meshPartVarIndex != null && gablePoints.contains(ridgePointIndex1) && getIndexNextTurn(ridgePointIndex1, simpleAngles).equals(getIndexNextTurn(k, simpleAngles))) {
meshPartVarIndex.add(k);
meshPartVarIndex.add((k + 1) % groundSize);
meshPartVarIndex.add(ridgeIndex1 + groundSize);
boolean isGable = false;
if (meshPartVarIndex != null && gablePoints.contains(ridgePointIndex1) && getIndexNextTurn(ridgePointIndex1, simpleAngles).equals(getIndexNextTurn(l, simpleAngles))) {
isGable = true;
// Add missing parts to building
meshPartVarIndex.add(k + profileSize);
meshPartVarIndex.add((k + profileSizePlus + profileSize) % grRsSize);
meshPartVarIndex.add(ridgeIndex1 + grRsSize);
} else {
meshVarIndex.add(k);
meshVarIndex.add((k + 1) % groundSize);
meshVarIndex.add(ridgeIndex1 + groundSize);
// Add first roof face
meshVarIndex.add(k + profileSize);
meshVarIndex.add((k + profileSizePlus + profileSize) % grRsSize);
meshVarIndex.add(ridgeIndex1 + grRsSize);
}
// Add second face, if necessary
int ridgePointIndex2 = (k + 1) % groundSize;
int ridgePointIndex2 = (l + 1) % groundSize;
while (!ridgePoints.containsKey(ridgePointIndex2)) {
ridgePointIndex2 = (ridgePointIndex2 + groundSize - 1) % groundSize; // Decrease ridgePointIndex
}
if (ridgePointIndex2 != ridgePointIndex1) {
int ridgeIndex2 = ridgePoints.headMap(ridgePointIndex2).size(); // Set ridgeIndex to position in ridgePoints
meshVarIndex.add(ridgeIndex1 + groundSize);
meshVarIndex.add((k + 1) % groundSize);
meshVarIndex.add(ridgeIndex2 + groundSize);
meshVarIndex.add(ridgeIndex1 + grRsSize);
meshVarIndex.add((k + profileSizePlus + profileSize) % grRsSize);
meshVarIndex.add(ridgeIndex2 + grRsSize);
}
// Write points
meshPoints[3 * k + 0] = p[0];
meshPoints[3 * k + 1] = p[1];
meshPoints[3 * k + 2] = p[2];
// Write ground points
int offset = 3 * k;
meshPoints[offset + 0] = p[0];
meshPoints[offset + 1] = p[1];
meshPoints[offset + 2] = p[2];
// Write profile roof shape points, skip ground points and ridge points of profile
float[] rp1 = ridgePoints.get(ridgePointIndex1);
float[] dif = GeometryUtils.diffVec(p, rp1); // Vector from ridge point to ground point
float phi = (float) Math.atan2(dif[0], dif[1]); // direction of diff
float r = (float) GeometryUtils.length(dif);
for (int m = 1; m < profileSizePlus; m++) {
offset = 3 * (k + m); // (+ 1 - 1 = 0)
int o = k + m - 1; // the ground + actual point of profile (m = 0 is the ground point)
// Add profile roof faces (2 per side and profile point)
if (isGable) {
// Add missing parts to building
meshPartVarIndex.add(o); // ground
meshPartVarIndex.add((o + profileSizePlus) % grRsSize); // ground
meshPartVarIndex.add((o + 1) % grRsSize); // profile
meshPartVarIndex.add((o + profileSizePlus) % grRsSize); // ground + 1
meshPartVarIndex.add((o + 1 + profileSizePlus) % grRsSize); // profile
meshPartVarIndex.add((o + 1) % grRsSize); // profile
} else {
meshVarIndex.add(o); // ground
meshVarIndex.add((o + profileSizePlus) % grRsSize); // ground + 1
meshVarIndex.add((o + 1) % grRsSize); // profile
meshVarIndex.add((o + profileSizePlus) % grRsSize); // ground + 1
meshVarIndex.add((o + 1 + profileSizePlus) % grRsSize); // profile + 1
meshVarIndex.add((o + 1) % grRsSize); // profile
}
// Calculate position of profile point.
// profile[m][0] is same length for x and y
meshPoints[offset + 0] = rp1[0] + (float) (r * profile[m][0] * Math.sin(phi));
meshPoints[offset + 1] = rp1[1] + (float) (r * profile[m][0] * Math.cos(phi));
meshPoints[offset + 2] = p[2] + heightRange * profile[m][1];
}
}
// Tessellate top, if necessary (can be used to improve wrong rendered roofs)
@@ -723,7 +785,7 @@ public final class S3DBUtils {
if (Tessellator.tessellate(buffer, buffer) != 0) {
for (int ind : buffer.index) {
// Get position in ridgePoints, considering skipped points
meshVarIndex.add(ridgePoints.headMap(faceIndex.get(ind)).size() + groundSize);
meshVarIndex.add(ridgePoints.headMap(faceIndex.get(ind)).size() + grRsSize);
}
} else {
// TODO Improve wrong or not tessellated faces
@@ -746,11 +808,10 @@ public final class S3DBUtils {
// Add ridge points
float[] tmp = ridgePoints.get(k);
if (tmp != null) {
float[] p = new float[]{tmp[0], tmp[1], maxHeight};
int ppos = 3 * (l + groundSize);
meshPoints[ppos + 0] = p[0];
meshPoints[ppos + 1] = p[1];
meshPoints[ppos + 2] = p[2];
int ppos = 3 * (l + grRsSize);
meshPoints[ppos + 0] = tmp[0];
meshPoints[ppos + 1] = tmp[1];
meshPoints[ppos + 2] = maxHeight;
l++;
}
}
@@ -1292,6 +1353,33 @@ public final class S3DBUtils {
return hsv.mod(c, relative);
}
/**
* Get the profile (half cross section) of roof shape.
* profile[i][0]: x-coordinate
* profile[i][1]: z-coordinate
*
* @param roofShape the roof shape value
* @return the profile (read-only!)
*/
public static float[][] getProfile(String roofShape) {
switch (roofShape) {
case Tag.VALUE_ONION:
return PROFILE_ONION;
case Tag.VALUE_ROUND:
case Tag.VALUE_DOME:
return PROFILE_DOME;
case Tag.VALUE_SALTBOX:
return PROFILE_SALTBOX;
case Tag.VALUE_MANSARD:
case Tag.VALUE_GAMBREL:
return PROFILE_MANSARD;
case Tag.VALUE_GABLED:
case Tag.VALUE_HIPPED:
default:
return PROFILE_HIPPED;
}
}
/**
* @param normVectors the normalized vectors
* @return a list of simple angles:
@@ -1342,32 +1430,32 @@ public final class S3DBUtils {
return simpAngls;
}
private static GeometryBuffer initCircleMesh(float[][] circleShape, int numSections) {
int indexSize = numSections * (circleShape.length - 1) * 2 * 3; // * 2 faces * 3 vertices
private static GeometryBuffer initCircleMesh(float[][] profile, int numSections) {
int indexSize = numSections * (profile.length - 1) * 2 * 3; // * 2 faces * 3 vertices
int[] meshIndex = new int[indexSize];
int meshSize = numSections * circleShape.length;
int meshSize = numSections * profile.length;
float[] meshPoints = new float[meshSize * 3];
for (int i = 0; i < numSections; i++) {
for (int j = 0; j < circleShape.length; j++) {
for (int j = 0; j < profile.length; j++) {
// Write point mesh
int pPos = 3 * (i * circleShape.length + j);
meshPoints[pPos + 0] = circleShape[j][0];
meshPoints[pPos + 1] = circleShape[j][1];
meshPoints[pPos + 2] = circleShape[j][2];
int pPos = 3 * (i * profile.length + j);
meshPoints[pPos + 0] = profile[j][0];
meshPoints[pPos + 1] = 0f;
meshPoints[pPos + 2] = profile[j][1];
// Write point indices
if (j != circleShape.length - 1) {
int iPos = 6 * (i * (circleShape.length - 1) + j); // 6 = 2 * Mesh * 3PointsPerMesh
if (j != profile.length - 1) {
int iPos = 6 * (i * (profile.length - 1) + j); // 6 = 2 * Mesh * 3PointsPerMesh
pPos = pPos / 3;
meshIndex[iPos + 2] = pPos + 0;
meshIndex[iPos + 1] = pPos + 1;
meshIndex[iPos + 0] = (pPos + circleShape.length) % meshSize;
meshIndex[iPos + 0] = (pPos + profile.length) % meshSize;
// FIXME if is last point, only one tris is needed, if top shape is closed
meshIndex[iPos + 5] = pPos + 1;
meshIndex[iPos + 4] = (pPos + circleShape.length + 1) % meshSize;
meshIndex[iPos + 3] = (pPos + circleShape.length) % meshSize;
meshIndex[iPos + 4] = (pPos + profile.length + 1) % meshSize;
meshIndex[iPos + 3] = (pPos + profile.length) % meshSize;
}
}
@@ -1376,6 +1464,21 @@ public final class S3DBUtils {
return new GeometryBuffer(meshPoints, meshIndex);
}
private static boolean isGabled(String roofShape) {
switch (roofShape) {
case Tag.VALUE_ROUND:
case Tag.VALUE_SALTBOX:
case Tag.VALUE_GABLED:
case Tag.VALUE_GAMBREL:
return true;
case Tag.VALUE_MANSARD:
case Tag.VALUE_HALF_HIPPED:
case Tag.VALUE_HIPPED:
default:
return false;
}
}
private static void mergeMeshGeometryBuffer(GeometryBuffer gb1, GeometryBuffer gb2, GeometryBuffer out) {
if (!(gb1.isTris() && gb2.isTris())) return;
int gb1PointSize = gb1.points.length;

View File

@@ -1,6 +1,6 @@
/*
* Copyright 2013 Hannes Janetzek
* Copyright 2016 devemux86
* Copyright 2016-2019 devemux86
* Copyright 2018 Gustl22
*
* This file is part of the OpenScienceMap project (http://www.opensciencemap.org).
@@ -522,7 +522,8 @@ public class LabelPlacement {
s.texRegion = ti.texRegion;
s.x = x;
s.y = y;
s.billboard = true;
s.billboard = ti.billboard;
s.rotation = ti.rotation;
sl.addSymbol(s);
}
}

View File

@@ -1,6 +1,6 @@
/*
* Copyright 2013 Hannes Janetzek
* Copyright 2016-2018 devemux86
* Copyright 2016-2019 devemux86
* Copyright 2016 Andrey Novikov
* Copyright 2019 marq24
*
@@ -75,6 +75,8 @@ public class LabelTileLoaderHook implements TileLoaderThemeHook {
}
} else if (element.type == POLY) {
PointF label = element.labelPosition;
if (label == null)
label = element.centroidPosition;
// skip unnecessary calculations if label is outside of visible area
if (label != null && (label.x < 0 || label.x > Tile.SIZE || label.y < 0 || label.y > Tile.SIZE))
return false;

View File

@@ -1,7 +1,7 @@
/*
* Copyright 2010, 2011, 2012, 2013 mapsforge.org
* Copyright 2013 Hannes Janetzek
* Copyright 2018 devemux86
* Copyright 2018-2019 devemux86
*
* This file is part of the OpenScienceMap project (http://www.opensciencemap.org).
*
@@ -63,20 +63,19 @@ public final class WayDecorator {
previousX += diffX * segmentSkipPercentage;
previousY += diffY * segmentSkipPercentage;
// TODO
/*if (rotate) {
if (symbol.rotate) {
// if we do not rotate theta will be 0, which is correct
theta = (float) Math.atan2(currentY - previousY, currentX - previousX);
}*/
theta = (float) Math.toDegrees(Math.atan2(currentY - previousY, currentX - previousX));
}
float x = previousX;
float y = previousY;
if (x >= 0 && x <= Tile.SIZE && y >= 0 && y <= Tile.SIZE) {
SymbolItem s = SymbolItem.pool.get();
if (symbol.bitmap != null)
s.set(x, y, symbol.bitmap, 0, true);
s.set(x, y, symbol.bitmap, theta, symbol.billboard);
else
s.set(x, y, symbol.texture, 0, true);
s.set(x, y, symbol.texture, theta, symbol.billboard);
ld.symbols.push(s);
}

View File

@@ -1,7 +1,7 @@
/*
* Copyright 2013 Hannes Janetzek
* Copyright 2016 Stephan Leuschner
* Copyright 2016-2018 devemux86
* Copyright 2016-2019 devemux86
* Copyright 2016 Izumi Kawashima
* Copyright 2017 Wolfgang Schramm
* Copyright 2018 Gustl22
@@ -22,11 +22,7 @@
package org.oscim.map;
import org.oscim.backend.CanvasAdapter;
import org.oscim.core.BoundingBox;
import org.oscim.core.GeoPoint;
import org.oscim.core.MapPosition;
import org.oscim.core.Point;
import org.oscim.core.Tile;
import org.oscim.core.*;
import org.oscim.renderer.MapRenderer;
import org.oscim.utils.ThreadUtils;
import org.oscim.utils.animation.Easing;
@@ -350,7 +346,7 @@ public class Animator {
};
double doScale(ViewController v, float adv) {
double newScale = mStartPos.scale + mDeltaPos.scale * Math.sqrt(adv);
double newScale = mStartPos.scale + mDeltaPos.scale * adv;
v.scaleMap((float) (newScale / mCurPos.scale),
(float) mPivot.x, (float) mPivot.y);

View File

@@ -1,6 +1,6 @@
/*
* Copyright 2013 Hannes Janetzek
* Copyright 2016-2018 devemux86
* Copyright 2016-2019 devemux86
* Copyright 2016 Andrey Novikov
* Copyright 2017 Longri
* Copyright 2018 Gustl22
@@ -251,7 +251,7 @@ public final class Layers extends AbstractList<Layer> {
return false;
}
private synchronized void updateLayers() {
public synchronized void updateLayers() {
try {
mLayers = new Layer[mLayerList.size()];
int numRenderLayers = 0;

View File

@@ -1,4 +1,5 @@
/*
* Copyright 2014 Hannes Janetzek
* Copyright 2016-2019 devemux86
* Copyright 2017 Luca Osten
* Copyright 2018 Izumi Kawashima
@@ -74,21 +75,49 @@ public class ViewController extends Viewport {
}
/**
* Get pivot horizontal / vertical relative to view center.
* Get pivot horizontal / vertical relative to view center in [-1, 1].
* e.g. pivotY 0.5 is usually preferred for navigation, moving center to 25% of view height.
* Range is [-1, 1].
*/
public float[] getMapViewCenter() {
return new float[]{mPivotX, mPivotY};
}
/**
* Set pivot horizontal / vertical relative to view center.
* Get pivot horizontal relative to view center in [-1, 1].
*/
public float getMapViewCenterX() {
return mPivotX;
}
/**
* Get pivot vertical relative to view center in [-1, 1].
* e.g. pivotY 0.5 is usually preferred for navigation, moving center to 25% of view height.
*/
public float getMapViewCenterY() {
return mPivotY;
}
/**
* Set pivot horizontal / vertical relative to view center in [-1, 1].
* e.g. pivotY 0.5 is usually preferred for navigation, moving center to 25% of view height.
* Range is [-1, 1].
*/
public void setMapViewCenter(float pivotX, float pivotY) {
setMapViewCenterX(pivotX);
setMapViewCenterY(pivotY);
}
/**
* Set pivot horizontal relative to view center in [-1, 1].
*/
public void setMapViewCenterX(float pivotX) {
mPivotX = FastMath.clamp(pivotX, -1, 1) * 0.5f;
}
/**
* Set pivot horizontal / vertical relative to view center in [-1, 1].
* e.g. pivotY 0.5 is usually preferred for navigation, moving center to 25% of view height.
*/
public void setMapViewCenterY(float pivotY) {
mPivotY = FastMath.clamp(pivotY, -1, 1) * 0.5f;
}

View File

@@ -0,0 +1,24 @@
/*
* 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
* Foundation, either version 3 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT ANY
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License along with
* this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.oscim.renderer;
public interface LocationCallback {
/**
* Useful with Android Location.hasBearing().
*/
boolean hasRotation();
float getRotation();
}

View File

@@ -20,8 +20,8 @@ package org.oscim.renderer;
import org.oscim.backend.CanvasAdapter;
import org.oscim.backend.GL;
import org.oscim.backend.canvas.Color;
import org.oscim.core.Box;
import org.oscim.core.MapPosition;
import org.oscim.core.Point;
import org.oscim.core.Tile;
import org.oscim.layers.Layer;
@@ -44,6 +44,13 @@ public class LocationRenderer extends LayerRenderer {
private final Layer mLayer;
protected final float mScale;
/**
* Use mMapPosition.copy(position) to keep the position for which
* the Overlay is *compiled*. NOTE: required by setMatrix utility
* functions to draw this layer fixed to the map
*/
protected MapPosition mMapPosition;
private String mShaderFile;
protected int mShaderProgram;
private int hVertexPosition;
@@ -66,9 +73,10 @@ public class LocationRenderer extends LayerRenderer {
private boolean mRunAnim;
private boolean mAnimate = true;
private long mAnimStart;
private boolean mCenter;
private Callback mCallback;
private final float[] mColors = new float[4];
private LocationCallback mCallback;
private int mColor = COLOR;
private final Point mLocation = new Point(Double.NaN, Double.NaN);
private double mRadius;
private int mShowAccuracyZoom = SHOW_ACCURACY_ZOOM;
@@ -82,27 +90,23 @@ public class LocationRenderer extends LayerRenderer {
mLayer = layer;
mScale = scale;
float a = Color.aToFloat(COLOR);
mColors[0] = a * Color.rToFloat(COLOR);
mColors[1] = a * Color.gToFloat(COLOR);
mColors[2] = a * Color.bToFloat(COLOR);
mColors[3] = a;
mMapPosition = new MapPosition();
}
public void setAnimate(boolean animate) {
mAnimate = animate;
}
public void setCallback(Callback callback) {
public void setCallback(LocationCallback callback) {
mCallback = callback;
}
public void setCenter(boolean center) {
mCenter = center;
}
public void setColor(int color) {
float a = Color.aToFloat(color);
mColors[0] = a * Color.rToFloat(color);
mColors[1] = a * Color.gToFloat(color);
mColors[2] = a * Color.bToFloat(color);
mColors[3] = a;
mColor = color;
}
public void setLocation(double x, double y, double radius) {
@@ -168,33 +172,39 @@ public class LocationRenderer extends LayerRenderer {
return;
}
/*if (!v.changed() && isReady())
return;*/
/*if (!v.changed() && isReady())
return;*/
setReady(true);
int width = mMap.getWidth();
int height = mMap.getHeight();
// clamp location to a position that can be
// savely translated to screen coordinates
v.getBBox(mBBox, 0);
double x, y;
if (mCenter) {
x = (width >> 1) + width * mMap.viewport().getMapViewCenterX();
y = (height >> 1) + height * mMap.viewport().getMapViewCenterY();
} else {
// clamp location to a position that can be
// safely translated to screen coordinates
v.getBBox(mBBox, 0);
double x = mLocation.x;
double y = mLocation.y;
x = mLocation.x;
y = mLocation.y;
if (!mBBox.contains(mLocation)) {
x = FastMath.clamp(x, mBBox.xmin, mBBox.xmax);
y = FastMath.clamp(y, mBBox.ymin, mBBox.ymax);
if (!mBBox.contains(mLocation)) {
x = FastMath.clamp(x, mBBox.xmin, mBBox.xmax);
y = FastMath.clamp(y, mBBox.ymin, mBBox.ymax);
}
// get position of Location in pixel relative to
// screen center
v.toScreenPoint(x, y, mScreenPoint);
x = mScreenPoint.x + (width >> 1);
y = mScreenPoint.y + (height >> 1);
}
// get position of Location in pixel relative to
// screen center
v.toScreenPoint(x, y, mScreenPoint);
x = mScreenPoint.x + width / 2;
y = mScreenPoint.y + height / 2;
// clip position to screen boundaries
int visible = 0;
@@ -216,6 +226,9 @@ public class LocationRenderer extends LayerRenderer {
// set location indicator position
v.fromScreenPoint(x, y, mIndicatorPosition);
mMapPosition.copy(v.pos);
mMapPosition.bearing = -mMapPosition.bearing;
}
@Override
@@ -276,7 +289,7 @@ public class LocationRenderer extends LayerRenderer {
} else
gl.uniform1i(uMode, -1); // Outside screen
GLUtils.glUniform4fv(uColor, 1, mColors);
GLUtils.setColor(uColor, mColor);
gl.drawArrays(GL.TRIANGLE_STRIP, 0, 4);
}
@@ -297,13 +310,4 @@ public class LocationRenderer extends LayerRenderer {
return true;
}
public interface Callback {
/**
* Usually true, can be used with e.g. Android Location.hasBearing().
*/
boolean hasRotation();
float getRotation();
}
}

View File

@@ -1,6 +1,10 @@
/*
* Copyright 2013 Ahmad Saleem
* Copyright 2013 Hannes Janetzek
* Copyright 2016-2019 devemux86
* Copyright 2016 ocsike
* Copyright 2017 Mathieu De Brito
* Copyright 2017-2018 Longri
* Copyright 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
@@ -17,142 +21,125 @@ package org.oscim.renderer;
import org.oscim.backend.CanvasAdapter;
import org.oscim.backend.GL;
import org.oscim.backend.canvas.Color;
import org.oscim.backend.canvas.Bitmap;
import org.oscim.core.Box;
import org.oscim.core.Point;
import org.oscim.core.PointF;
import org.oscim.core.Tile;
import org.oscim.layers.Layer;
import org.oscim.map.Map;
import org.oscim.renderer.atlas.TextureRegion;
import org.oscim.renderer.bucket.SymbolBucket;
import org.oscim.renderer.bucket.SymbolItem;
import org.oscim.utils.FastMath;
import org.oscim.utils.geom.GeometryUtils;
import org.oscim.utils.math.Interpolation;
import java.util.Locale;
import static org.oscim.backend.GLAdapter.gl;
public class LocationTextureRenderer extends BucketRenderer {
private static final PointF CENTER_OFFSET = new PointF(0.5f, 0.5f);
private static final long ANIM_RATE = 50;
private static final long INTERVAL = 2000;
private static final float CIRCLE_SIZE = 30;
private static final int SHOW_ACCURACY_ZOOM = 13;
private static final boolean IS_MAC = System.getProperty("os.name").toLowerCase(Locale.ENGLISH).contains("mac");
private static final String V_SHADER = (""
+ "precision highp float;"
+ "uniform mat4 u_mvp;"
+ "uniform float u_phase;"
+ "uniform float u_scale;"
+ "attribute vec2 a_pos;"
+ "varying vec2 v_tex;"
+ "void main() {"
+ " gl_Position = u_mvp * vec4(a_pos * u_scale * u_phase, 0.0, 1.0);"
+ " v_tex = a_pos;"
+ "}").replace("precision highp float;", IS_MAC ? "" : "precision highp float;");
public static float CIRCLE_SIZE = /*30*/0;
private static final int COLOR = 0xff3333cc;
private static final int SHOW_ACCURACY_ZOOM = 16;
// only circle without direction
private static final String F_SHADER = (""
+ "precision highp float;"
+ "varying vec2 v_tex;"
+ "uniform float u_scale;"
+ "uniform float u_phase;"
+ "uniform vec4 u_fill;"
+ "void main() {"
+ " float len = 1.0 - length(v_tex);"
/// outer ring
+ " float a = smoothstep(0.0, 2.0 / u_scale, len);"
/// inner ring
+ " float b = 0.8 * smoothstep(3.0 / u_scale, 4.0 / u_scale, len);"
/// center point
+ " float c = 0.5 * (1.0 - smoothstep(14.0 / u_scale, 16.0 / u_scale, 1.0 - len));"
+ " vec2 dir = normalize(v_tex);"
/// - subtract inner from outer to create the outline
/// - multiply by viewshed
/// - add center point
+ " a = (a - (b + c)) + c;"
+ " gl_FragColor = u_fill * a;"
+ "}").replace("precision highp float;", IS_MAC ? "" : "precision highp float;");
private final Map mMap;
private final Layer mLayer;
protected final float mScale;
private final SymbolBucket mSymbolLayer;
private final SymbolBucket symbolBucket;
private final float[] box = new float[8];
private final Point mapPoint = new Point();
private final Map map;
private boolean initialized;
private boolean locationIsVisible;
private int shaderProgramNumber;
private String mShaderFile;
protected int mShaderProgram;
private int hVertexPosition;
private int hMatrixPosition;
private int hScale;
private int hPhase;
private int uFill;
private double radius;
private int uColor;
private int uMode;
private final Point indicatorPosition = new Point();
private final Point screenPoint = new Point();
private final Box boundingBox = new Box();
private boolean runAnim;
private boolean animate = true;
private long animStart;
private boolean update;
private float bearing;
private final Point mIndicatorPosition = new Point();
// properties
private TextureRegion textureRegion;
private int accuracyColor = Color.BLUE;
private int viewShedColor = Color.RED;
private boolean billboard = false;
private final Point mScreenPoint = new Point();
private final Box mBBox = new Box();
public LocationTextureRenderer(Map map) {
this.map = map;
symbolBucket = new SymbolBucket();
private boolean mLocationIsVisible;
private boolean mRunAnim;
private boolean mAnimate = true;
private long mAnimStart;
private boolean mCenter;
private boolean mBillboard;
private Bitmap mBitmapArrow, mBitmapMarker;
private LocationCallback mCallback;
private int mColor = COLOR;
private final Point mLocation = new Point(Double.NaN, Double.NaN);
private double mRadius;
private int mShowAccuracyZoom = SHOW_ACCURACY_ZOOM;
public LocationTextureRenderer(Map map, Layer layer) {
this(map, layer, CanvasAdapter.getScale());
}
public void setAccuracyColor(int color) {
this.accuracyColor = color;
public LocationTextureRenderer(Map map, Layer layer, float scale) {
mMap = map;
mLayer = layer;
mScale = scale;
mSymbolLayer = new SymbolBucket();
}
public void setAnimate(boolean animate) {
this.animate = animate;
mAnimate = animate;
}
public void setBillboard(boolean billboard) {
this.billboard = billboard;
mBillboard = billboard;
}
public void setIndicatorColor(int color) {
this.viewShedColor = color;
public void setBitmapArrow(Bitmap bitmap) {
mBitmapArrow = bitmap;
}
public void setLocation(double x, double y, float bearing, double radius) {
update = true;
mapPoint.x = x;
mapPoint.y = y;
this.bearing = bearing;
this.radius = radius;
public void setBitmapMarker(Bitmap bitmap) {
mBitmapMarker = bitmap;
}
public void setTextureRegion(TextureRegion textureRegion) {
this.textureRegion = textureRegion;
public void setCallback(LocationCallback callback) {
mCallback = callback;
}
public void setTextureRegion(TextureRegion textureRegion, boolean billboard) {
this.textureRegion = textureRegion;
this.billboard = billboard;
public void setCenter(boolean center) {
mCenter = center;
}
public void setColor(int color) {
mColor = color;
}
public void setLocation(double x, double y, double radius) {
mLocation.x = x;
mLocation.y = y;
mRadius = radius;
}
public void setShader(String shaderFile) {
mShaderFile = shaderFile;
mInitialized = false;
}
public void setShowAccuracyZoom(int showAccuracyZoom) {
mShowAccuracyZoom = showAccuracyZoom;
}
public void animate(boolean enable) {
if (runAnim == enable)
if (mRunAnim == enable)
return;
runAnim = enable;
mRunAnim = enable;
if (!enable)
return;
if (!animate)
if (!mAnimate)
return;
final Runnable action = new Runnable() {
@@ -160,57 +147,72 @@ public class LocationTextureRenderer extends BucketRenderer {
@Override
public void run() {
if (!runAnim)
if (!mRunAnim)
return;
if (!animate)
if (!mAnimate)
return;
long diff = System.currentTimeMillis() - lastRun;
map.postDelayed(this, Math.min(ANIM_RATE, diff));
map.render();
mMap.postDelayed(this, Math.min(ANIM_RATE, diff));
mMap.render();
lastRun = System.currentTimeMillis();
}
};
animStart = System.currentTimeMillis();
map.postDelayed(action, ANIM_RATE);
mAnimStart = System.currentTimeMillis();
mMap.postDelayed(action, ANIM_RATE);
}
private float animPhase() {
return (float) ((MapRenderer.frametime - animStart) % INTERVAL) / INTERVAL;
return (float) ((MapRenderer.frametime - mAnimStart) % INTERVAL) / INTERVAL;
}
@Override
public synchronized void update(GLViewport v) {
if (!v.changed() && !update)
return;
// accuracy
if (!initialized) {
if (!mInitialized) {
init();
initialized = true;
mInitialized = true;
}
if (!mLayer.isEnabled()) {
setReady(false);
return;
}
/*if (!v.changed() && isReady())
return;*/
setReady(true);
int width = map.getWidth();
int height = map.getHeight();
v.getBBox(boundingBox, 0);
int width = mMap.getWidth();
int height = mMap.getHeight();
double x = mapPoint.x;
double y = mapPoint.y;
double x, y;
if (mCenter) {
x = (width >> 1) + width * mMap.viewport().getMapViewCenterX();
y = (height >> 1) + height * mMap.viewport().getMapViewCenterY();
} else {
// clamp location to a position that can be
// safely translated to screen coordinates
v.getBBox(mBBox, 0);
if (!boundingBox.contains(mapPoint)) {
x = FastMath.clamp(x, boundingBox.xmin, boundingBox.xmax);
y = FastMath.clamp(y, boundingBox.ymin, boundingBox.ymax);
x = mLocation.x;
y = mLocation.y;
if (!mBBox.contains(mLocation)) {
x = FastMath.clamp(x, mBBox.xmin, mBBox.xmax);
y = FastMath.clamp(y, mBBox.ymin, mBBox.ymax);
}
// get position of Location in pixel relative to
// screen center
v.toScreenPoint(x, y, mScreenPoint);
x = mScreenPoint.x + (width >> 1);
y = mScreenPoint.y + (height >> 1);
}
// get position of Location in pixel relative to
// screen center
v.toScreenPoint(x, y, screenPoint);
x = screenPoint.x + width / 2;
y = screenPoint.y + height / 2;
// clip position to screen boundaries
int visible = 0;
@@ -228,112 +230,130 @@ public class LocationTextureRenderer extends BucketRenderer {
else
visible++;
locationIsVisible = (visible == 2);
mLocationIsVisible = (visible == 2);
if (locationIsVisible)
animate(false);
else
animate(true);
// set location indicator position
v.fromScreenPoint(x, y, indicatorPosition);
v.fromScreenPoint(x, y, mIndicatorPosition);
// Texture
mMapPosition.copy(v.pos);
/* Texture */
double mx = v.pos.x;
double my = v.pos.y;
double scale = Tile.SIZE * v.pos.scale;
map.viewport().getMapExtents(box, 100);
long flip = (long) (Tile.SIZE * v.pos.scale) >> 1;
/* check visibility */
float symbolX = (float) ((mapPoint.x - mx) * scale);
float symbolY = (float) ((mapPoint.y - my) * scale);
if (symbolX > flip)
symbolX -= (flip << 1);
else if (symbolX < -flip)
symbolX += (flip << 1);
buckets.clear();
if (!GeometryUtils.pointInPoly(symbolX, symbolY, box, 8, 0))
if (mBitmapArrow == null || mBitmapMarker == null)
return;
if (!mLocationIsVisible)
return;
float itx, ity;
if (mCenter) {
itx = 0;
ity = 0;
} else {
double mx = v.pos.x;
double my = v.pos.y;
double scale = Tile.SIZE * v.pos.scale;
long flip = (long) (Tile.SIZE * v.pos.scale) >> 1;
itx = (float) ((mLocation.x - mx) * scale);
ity = (float) ((mLocation.y - my) * scale);
if (itx > flip)
itx -= (flip << 1);
else if (itx < -flip)
itx += (flip << 1);
}
mMapPosition.copy(v.pos);
mMapPosition.bearing = -mMapPosition.bearing;
if (textureRegion == null)
return;
SymbolItem symbolItem = SymbolItem.pool.get();
symbolItem.set(symbolX, symbolY, textureRegion, this.bearing, this.billboard);
symbolItem.offset = CENTER_OFFSET;
symbolBucket.pushSymbol(symbolItem);
buckets.set(symbolBucket);
SymbolItem s = SymbolItem.pool.get();
if (mCallback != null && mCallback.hasRotation())
s.set(itx, ity, mBitmapArrow, mCallback.getRotation(), mBillboard);
else
s.set(itx, ity, mBitmapMarker, mBillboard);
mSymbolLayer.pushSymbol(s);
buckets.set(mSymbolLayer);
buckets.prepare();
buckets.compile(true);
compile();
update = false;
}
@Override
public void render(GLViewport v) {
renderAccuracyCircle(v);
super.render(v);
}
public synchronized void render(GLViewport v) {
private void init() {
int shader = GLShader.createProgram(V_SHADER, F_SHADER);
if (shader == 0)
return;
shaderProgramNumber = shader;
hVertexPosition = gl.getAttribLocation(shader, "a_pos");
hMatrixPosition = gl.getUniformLocation(shader, "u_mvp");
hPhase = gl.getUniformLocation(shader, "u_phase");
hScale = gl.getUniformLocation(shader, "u_scale");
uFill = gl.getUniformLocation(shader, "u_fill");
}
private void renderAccuracyCircle(GLViewport v) {
GLState.useProgram(shaderProgramNumber);
GLState.useProgram(mShaderProgram);
GLState.blend(true);
GLState.test(false, false);
GLState.enableVertexArrays(hVertexPosition, GLState.DISABLED);
MapRenderer.bindQuadVertexVBO(hVertexPosition/*, true*/);
float radius = 10;
float radius = CIRCLE_SIZE * mScale;
boolean viewShed = false;
if (!locationIsVisible)
radius = CIRCLE_SIZE * CanvasAdapter.getScale();
else {
if (v.pos.zoomLevel >= SHOW_ACCURACY_ZOOM)
radius = (float) (this.radius * v.pos.scale);
radius = Math.max(2, radius);
if (!mLocationIsVisible /* || pos.zoomLevel < SHOW_ACCURACY_ZOOM */) {
animate(true);
} else {
if (v.pos.zoomLevel >= mShowAccuracyZoom)
radius = (float) (mRadius * v.pos.scale);
radius = Math.max(CIRCLE_SIZE * mScale, radius);
viewShed = true;
animate(false);
}
gl.uniform1f(hScale, radius);
double x = indicatorPosition.x - v.pos.x;
double y = indicatorPosition.y - v.pos.y;
double x = mIndicatorPosition.x - v.pos.x;
double y = mIndicatorPosition.y - v.pos.y;
double tileScale = Tile.SIZE * v.pos.scale;
v.mvp.setTransScale((float) (x * tileScale), (float) (y * tileScale), 1);
v.mvp.multiplyMM(v.viewproj, v.mvp);
v.mvp.setAsUniform(hMatrixPosition);
if (!viewShed && animate) {
if (!viewShed && mAnimate) {
float phase = Math.abs(animPhase() - 0.5f) * 2;
//phase = Interpolation.fade.apply(phase);
phase = Interpolation.swing.apply(phase);
gl.uniform1f(hPhase, 0.8f + phase * 0.2f);
} else
gl.uniform1f(hPhase, 1);
if (viewShed && locationIsVisible)
GLUtils.setColor(uFill, accuracyColor, 1);
else
GLUtils.setColor(uFill, viewShedColor, 1);
gl.uniform1f(hPhase, 0.8f + phase * 0.2f);
} else {
gl.uniform1f(hPhase, 1);
}
if (viewShed && mLocationIsVisible) {
if (mCallback != null && mCallback.hasRotation())
gl.uniform1i(uMode, 1); // With bearing
else
gl.uniform1i(uMode, 0); // Without bearing
} else
gl.uniform1i(uMode, -1); // Outside screen
GLUtils.setColor(uColor, mColor);
gl.drawArrays(GL.TRIANGLE_STRIP, 0, 4);
gl.flush();
/* Texture */
super.render(v);
}
protected boolean init() {
int program = GLShader.loadShader(mShaderFile != null ? mShaderFile : "accuracy_1");
if (program == 0)
return false;
mShaderProgram = program;
hVertexPosition = gl.getAttribLocation(program, "a_pos");
hMatrixPosition = gl.getUniformLocation(program, "u_mvp");
hPhase = gl.getUniformLocation(program, "u_phase");
hScale = gl.getUniformLocation(program, "u_scale");
uColor = gl.getUniformLocation(program, "u_color");
uMode = gl.getUniformLocation(program, "u_mode");
return true;
}
}

View File

@@ -1,6 +1,6 @@
/*
* Copyright 2013 Hannes Janetzek
* Copyright 2016-2017 devemux86
* Copyright 2016-2019 devemux86
*
* This file is part of the OpenScienceMap project (http://www.opensciencemap.org).
*
@@ -638,8 +638,7 @@ public class LineBucket extends RenderBucket {
if (lb.heightOffset != heightOffset) {
heightOffset = lb.heightOffset;
gl.uniform1f(uLineHeight, heightOffset /
MercatorProjection.groundResolution(v.pos));
gl.uniform1f(uLineHeight, (float) (heightOffset / MercatorProjection.groundResolution(v.pos)));
}
if (line.fadeScale < v.pos.zoomLevel) {
@@ -679,7 +678,7 @@ public class LineBucket extends RenderBucket {
}
/* Cap mode */
if (lb.scale < 1.5/* || lb.line.fixed*/) {
if (lb.scale < 1.0) {
if (capMode != CAP_THIN) {
capMode = CAP_THIN;
gl.uniform1i(uLineMode, capMode);

View File

@@ -1,6 +1,6 @@
/*
* Copyright 2013 Hannes Janetzek
* Copyright 2017 devemux86
* Copyright 2017-2019 devemux86
*
* This file is part of the OpenScienceMap project (http://www.opensciencemap.org).
*
@@ -102,7 +102,7 @@ public class MeshBucket extends RenderBucket {
}
if (!tess.tesselate()) {
tess.dispose();
log.debug("error in tessellation {}", numPoints);
log.error("error in tessellation {}", numPoints);
return;
}
@@ -191,8 +191,7 @@ public class MeshBucket extends RenderBucket {
if (ml.heightOffset != heightOffset) {
heightOffset = ml.heightOffset;
gl.uniform1f(s.uHeight, heightOffset /
MercatorProjection.groundResolution(v.pos));
gl.uniform1f(s.uHeight, (float) (heightOffset / MercatorProjection.groundResolution(v.pos)));
}
if (ml.area == null)

View File

@@ -1,7 +1,7 @@
/*
* Copyright 2010, 2011, 2012, 2013 mapsforge.org
* Copyright 2014 Ludwig M Brinckmann
* Copyright 2014-2017 devemux86
* Copyright 2014-2019 devemux86
* Copyright 2014 Erik Duisters
* Copyright 2014 Christian Pesch
*
@@ -39,7 +39,6 @@ public class DefaultMapScaleBar extends MapScaleBar {
public enum ScaleBarMode {BOTH, SINGLE}
private final float scale;
private ScaleBarMode scaleBarMode;
private DistanceUnitAdapter secondaryDistanceUnitAdapter;
@@ -53,12 +52,11 @@ public class DefaultMapScaleBar extends MapScaleBar {
}
public DefaultMapScaleBar(Map map, float scale) {
super(map, (int) (BITMAP_WIDTH * scale), (int) (BITMAP_HEIGHT * scale));
super(map, (int) (BITMAP_WIDTH * scale), (int) (BITMAP_HEIGHT * scale), scale);
setMarginHorizontal((int) (DEFAULT_HORIZONTAL_MARGIN * scale));
setMarginVertical((int) (DEFAULT_VERTICAL_MARGIN * scale));
this.scale = scale;
this.scaleBarMode = ScaleBarMode.BOTH;
this.secondaryDistanceUnitAdapter = ImperialUnitAdapter.INSTANCE;

View File

@@ -1,7 +1,7 @@
/*
* Copyright 2010, 2011, 2012, 2013 mapsforge.org
* Copyright 2014 Ludwig M Brinckmann
* Copyright 2014-2016 devemux86
* Copyright 2014-2019 devemux86
* Copyright 2014 Erik Duisters
*
* This program is free software: you can redistribute it and/or modify it under the
@@ -44,8 +44,9 @@ public abstract class MapScaleBar {
protected Canvas mapScaleCanvas;
private int marginHorizontal;
private int marginVertical;
private MapPosition prevMapPosition;
protected final MapPosition prevMapPosition = new MapPosition();
protected boolean redrawNeeded;
protected final float scale;
protected ScaleBarPosition scaleBarPosition;
private boolean visible;
@@ -62,9 +63,10 @@ public abstract class MapScaleBar {
}
}
public MapScaleBar(Map map, int width, int height) {
public MapScaleBar(Map map, int width, int height, float scale) {
this.map = map;
this.mapScaleBitmap = CanvasAdapter.newBitmap(width, height, 0);
this.scale = scale;
this.scaleBarPosition = DEFAULT_SCALE_BAR_POSITION;
@@ -194,7 +196,7 @@ public abstract class MapScaleBar {
* @return a {@link ScaleBarLengthAndValue} object containing the required scaleBarLength and scaleBarValue
*/
protected ScaleBarLengthAndValue calculateScaleBarLengthAndValue(DistanceUnitAdapter unitAdapter) {
this.prevMapPosition = this.map.getMapPosition();
this.map.getMapPosition(this.prevMapPosition);
double groundResolution = MercatorProjection.groundResolution(this.prevMapPosition);
groundResolution = groundResolution / unitAdapter.getMeterRatio();
@@ -206,7 +208,7 @@ public abstract class MapScaleBar {
for (int scaleBarValue : scaleBarValues) {
mapScaleValue = scaleBarValue;
scaleBarLength = (int) (mapScaleValue / groundResolution);
if (scaleBarLength < (this.mapScaleBitmap.getWidth() - 10)) {
if (scaleBarLength < (this.mapScaleBitmap.getWidth() - 10 * this.scale)) {
break;
}
}
@@ -266,7 +268,7 @@ public abstract class MapScaleBar {
* @return true if redraw is necessary, false otherwise
*/
protected boolean isRedrawNecessary() {
if (this.redrawNeeded || this.prevMapPosition == null) {
if (this.redrawNeeded) {
return true;
}

View File

@@ -635,7 +635,7 @@ public class XmlThemeBuilder extends DefaultHandler {
transparent = !transparent;
}
b.texture = new TextureItem(Utils.potBitmap(bitmap));
b.texture.mipmap = true;
//b.texture.mipmap = true;
b.randomOffset = false;
b.stipple = width;
b.stippleWidth = 1;
@@ -653,7 +653,7 @@ public class XmlThemeBuilder extends DefaultHandler {
canvas.setBitmap(bitmap);
canvas.drawBitmap(b.texture.bitmap, b.repeatStart, 0);
b.texture = new TextureItem(Utils.potBitmap(bitmap));
b.texture.mipmap = true;
//b.texture.mipmap = true;
b.fixed = true;
b.randomOffset = false;
b.stipple = width;
@@ -1163,6 +1163,9 @@ public class XmlThemeBuilder extends DefaultHandler {
else if ("symbol-scaling".equals(name))
; // no-op
else if ("billboard".equals(name))
b.billboard(Boolean.parseBoolean(value));
else if ("repeat".equals(name))
b.repeat(Boolean.parseBoolean(value));
@@ -1172,6 +1175,9 @@ public class XmlThemeBuilder extends DefaultHandler {
else if ("repeat-gap".equals(name))
b.repeatGap = Float.parseFloat(value) * mScale;
else if ("rotate".equals(name))
b.rotate(Boolean.parseBoolean(value));
else
logUnknownAttribute(elementName, name, value, i);
}

View File

@@ -19,6 +19,7 @@
*/
package org.oscim.theme.styles;
import org.oscim.backend.CanvasAdapter;
import org.oscim.backend.canvas.Color;
import org.oscim.backend.canvas.Paint.Cap;
import org.oscim.renderer.bucket.TextureItem;
@@ -58,15 +59,15 @@ public final class LineStyle extends RenderStyle<LineStyle> {
public final float repeatGap;
public LineStyle(int stroke, float width) {
this(0, "", stroke, width, Cap.BUTT, true, 1, 0, 0, 0, -1, 0, false, null, true, null, REPEAT_START_DEFAULT, REPEAT_GAP_DEFAULT);
this(0, "", stroke, width, Cap.BUTT, true, 1, 0, 0, 0, -1, 0, false, null, true, null, REPEAT_START_DEFAULT * CanvasAdapter.getScale(), REPEAT_GAP_DEFAULT * CanvasAdapter.getScale());
}
public LineStyle(int level, int stroke, float width) {
this(level, "", stroke, width, Cap.BUTT, true, 1, 0, 0, 0, -1, 0, false, null, true, null, REPEAT_START_DEFAULT, REPEAT_GAP_DEFAULT);
this(level, "", stroke, width, Cap.BUTT, true, 1, 0, 0, 0, -1, 0, false, null, true, null, REPEAT_START_DEFAULT * CanvasAdapter.getScale(), REPEAT_GAP_DEFAULT * CanvasAdapter.getScale());
}
public LineStyle(int stroke, float width, Cap cap) {
this(0, "", stroke, width, cap, true, 1, 0, 0, 0, -1, 0, false, null, true, null, REPEAT_START_DEFAULT, REPEAT_GAP_DEFAULT);
this(0, "", stroke, width, cap, true, 1, 0, 0, 0, -1, 0, false, null, true, null, REPEAT_START_DEFAULT * CanvasAdapter.getScale(), REPEAT_GAP_DEFAULT * CanvasAdapter.getScale());
}
public LineStyle(int level, String style, int color, float width,
@@ -328,8 +329,8 @@ public final class LineStyle extends RenderStyle<LineStyle> {
symbolPercent = 100;
dashArray = null;
repeatStart = REPEAT_START_DEFAULT;
repeatGap = REPEAT_GAP_DEFAULT;
repeatStart = REPEAT_START_DEFAULT * CanvasAdapter.getScale();
repeatGap = REPEAT_GAP_DEFAULT * CanvasAdapter.getScale();
return self();
}

View File

@@ -1,7 +1,7 @@
/*
* Copyright 2010, 2011, 2012 mapsforge.org
* Copyright 2013 Hannes Janetzek
* Copyright 2016-2018 devemux86
* Copyright 2016-2019 devemux86
* Copyright 2017 Longri
*
* This file is part of the OpenScienceMap project (http://www.opensciencemap.org).
@@ -19,6 +19,7 @@
*/
package org.oscim.theme.styles;
import org.oscim.backend.CanvasAdapter;
import org.oscim.backend.canvas.Bitmap;
import org.oscim.renderer.atlas.TextureRegion;
@@ -38,9 +39,12 @@ public final class SymbolStyle extends RenderStyle<SymbolStyle> {
public final int symbolHeight;
public final int symbolPercent;
// Symbols on lines
public final boolean billboard;
public final boolean repeat;
public final float repeatStart;
public final float repeatGap;
public final boolean rotate;
public SymbolStyle(Bitmap bitmap) {
this(bitmap, null, 0);
@@ -63,9 +67,11 @@ public final class SymbolStyle extends RenderStyle<SymbolStyle> {
this.symbolHeight = 0;
this.symbolPercent = 100;
this.billboard = false;
this.repeat = false;
this.repeatStart = REPEAT_START_DEFAULT;
this.repeatGap = REPEAT_GAP_DEFAULT;
this.repeatStart = REPEAT_START_DEFAULT * CanvasAdapter.getScale();
this.repeatGap = REPEAT_GAP_DEFAULT * CanvasAdapter.getScale();
this.rotate = true;
}
public SymbolStyle(SymbolBuilder<?> b) {
@@ -79,9 +85,11 @@ public final class SymbolStyle extends RenderStyle<SymbolStyle> {
this.symbolHeight = b.symbolHeight;
this.symbolPercent = b.symbolPercent;
this.billboard = b.billboard;
this.repeat = b.repeat;
this.repeatStart = b.repeatStart;
this.repeatGap = b.repeatGap;
this.rotate = b.rotate;
}
@Override
@@ -115,9 +123,12 @@ public final class SymbolStyle extends RenderStyle<SymbolStyle> {
public int symbolHeight;
public int symbolPercent;
// Symbols on lines
public boolean billboard;
public boolean repeat;
public float repeatStart;
public float repeatGap;
public boolean rotate;
public SymbolBuilder() {
}
@@ -136,9 +147,11 @@ public final class SymbolStyle extends RenderStyle<SymbolStyle> {
this.symbolHeight = symbol.symbolHeight;
this.symbolPercent = symbol.symbolPercent;
this.billboard = symbol.billboard;
this.repeat = symbol.repeat;
this.repeatStart = symbol.repeatStart;
this.repeatGap = symbol.repeatGap;
this.rotate = symbol.rotate;
return self();
}
@@ -173,6 +186,11 @@ public final class SymbolStyle extends RenderStyle<SymbolStyle> {
return self();
}
public T billboard(boolean billboard) {
this.billboard = billboard;
return self();
}
public T repeat(boolean repeat) {
this.repeat = repeat;
return self();
@@ -188,6 +206,11 @@ public final class SymbolStyle extends RenderStyle<SymbolStyle> {
return self();
}
public T rotate(boolean rotate) {
this.rotate = rotate;
return self();
}
public T reset() {
cat = null;
@@ -199,9 +222,11 @@ public final class SymbolStyle extends RenderStyle<SymbolStyle> {
symbolHeight = 0;
symbolPercent = 100;
billboard = false;
repeat = false;
repeatStart = REPEAT_START_DEFAULT;
repeatGap = REPEAT_GAP_DEFAULT;
repeatStart = REPEAT_START_DEFAULT * CanvasAdapter.getScale();
repeatGap = REPEAT_GAP_DEFAULT * CanvasAdapter.getScale();
rotate = true;
return self();
}

View File

@@ -81,10 +81,10 @@ public class BitmapTileSource extends UrlTileSource {
@Override
public ITileDataSource getDataSource() {
return new UrlTileDataSource(this, new BitmapTileDecoder(), getHttpEngine());
return new UrlTileDataSource(this, new TileDecoder(), getHttpEngine());
}
public class BitmapTileDecoder implements ITileDecoder {
public static class TileDecoder implements ITileDecoder {
@Override
public boolean decode(Tile tile, ITileDataSink sink, InputStream is)

View File

@@ -7,6 +7,7 @@
* Copyright 2017-2018 Gustl22
* Copyright 2018 Bezzu
* Copyright 2019 marq24
* Copyright 2019 Justus Schmidt
*
* This file is part of the OpenScienceMap project (http://www.opensciencemap.org).
*
@@ -51,7 +52,7 @@ import static org.oscim.tiling.QueryResult.SUCCESS;
/**
* A class for reading binary map files.
*
* @see <a href="http://code.google.com/p/mapsforge/wiki/SpecificationBinaryMapFile">Specification</a>
* @see <a href="https://github.com/mapsforge/mapsforge/blob/master/docs/Specification-Binary-Map-File.md">Specification</a>
*/
public class MapDatabase implements ITileDataSource {
/**
@@ -186,6 +187,19 @@ public class MapDatabase implements ITileDataSource {
public static boolean wayFilterEnabled = true;
public static int wayFilterDistance = 20;
/**
* Reduce points on-the-fly while reading from map files.
*/
public static int SIMPLIFICATION_MIN_ZOOM = 8;
public static int SIMPLIFICATION_MAX_ZOOM = 11;
/**
* Mapsforge artificial tags for land/sea areas.
*/
private static final Tag TAG_ISSEA = new Tag("natural", "issea");
private static final Tag TAG_NOSEA = new Tag("natural", "nosea");
private static final Tag TAG_SEA = new Tag("natural", "sea");
private long mFileSize;
private boolean mDebugFile;
private RandomAccessFile mInputFile;
@@ -249,20 +263,26 @@ public class MapDatabase implements ITileDataSource {
mTileProjection.setTile(tile);
//mTile = tile;
/* size of tile in map coordinates; */
double size = 1.0 / (1 << tile.zoomLevel);
if (Parameters.SIMPLIFICATION_TOLERANCE > 0
&& tile.zoomLevel >= SIMPLIFICATION_MIN_ZOOM && tile.zoomLevel <= SIMPLIFICATION_MAX_ZOOM) {
/* size of tile in map coordinates; */
double size = 1.0 / (1 << tile.zoomLevel);
/* simplification tolerance */
int pixel = (tile.zoomLevel > 11) ? 1 : 2;
/* simplification tolerance */
int pixel = Parameters.SIMPLIFICATION_TOLERANCE;
int simplify = Tile.SIZE / pixel;
int simplify = Tile.SIZE / pixel;
/* translate screen pixel for tile to latitude and longitude
* tolerance for point reduction before projection. */
minDeltaLat = (int) (Math.abs(MercatorProjection.toLatitude(tile.y + size)
- MercatorProjection.toLatitude(tile.y)) * 1e6) / simplify;
minDeltaLon = (int) (Math.abs(MercatorProjection.toLongitude(tile.x + size)
- MercatorProjection.toLongitude(tile.x)) * 1e6) / simplify;
/* translate screen pixel for tile to latitude and longitude
* tolerance for point reduction before projection. */
minDeltaLat = (int) (Math.abs(MercatorProjection.toLatitude(tile.y + size)
- MercatorProjection.toLatitude(tile.y)) * 1e6) / simplify;
minDeltaLon = (int) (Math.abs(MercatorProjection.toLongitude(tile.x + size)
- MercatorProjection.toLongitude(tile.x)) * 1e6) / simplify;
} else {
minDeltaLat = 0;
minDeltaLon = 0;
}
QueryParameters queryParameters = new QueryParameters();
queryParameters.queryZoomLevel =
@@ -692,7 +712,7 @@ public class MapDatabase implements ITileDataSource {
return true;
}
private boolean processWayDataBlock(MapElement e, boolean doubleDeltaEncoding, boolean isLine, List<GeoPoint[]> wayCoordinates) {
private boolean processWayDataBlock(MapElement e, boolean doubleDeltaEncoding, boolean isLine, List<GeoPoint[]> wayCoordinates, int[] labelPosition) {
/* get and check the number of way coordinate blocks (VBE-U) */
int numBlocks = mReadBuffer.readUnsignedInt();
if (numBlocks < 1 || numBlocks > Short.MAX_VALUE) {
@@ -717,37 +737,50 @@ public class MapDatabase implements ITileDataSource {
/* each way node consists of latitude and longitude */
int len = numWayNodes * 2;
wayLengths[coordinateBlock] = decodeWayNodes(doubleDeltaEncoding,
e, len, isLine);
// create the array which will store the current way segment
GeoPoint[] waySegment = null;
if (wayCoordinates != null)
waySegment = new GeoPoint[numWayNodes];
if (wayCoordinates != null) {
// create the array which will store the current way segment
GeoPoint[] waySegment = new GeoPoint[e.getNumPoints()];
for (int i = 0; i < e.getNumPoints(); i++)
waySegment[i] = new GeoPoint(e.getPointY(i) / 1E6, e.getPointX(i) / 1E6);
// label position must be set on first coordinate block
wayLengths[coordinateBlock] = decodeWayNodes(doubleDeltaEncoding, e, len, isLine,
coordinateBlock == 0 ? labelPosition : null, waySegment);
if (wayCoordinates != null)
wayCoordinates.add(waySegment);
}
}
return true;
}
private int decodeWayNodes(boolean doubleDelta, MapElement e, int length, boolean isLine) {
private int decodeWayNodes(boolean doubleDelta, MapElement e, int length, boolean isLine, int[] labelPosition, GeoPoint[] waySegment) {
int[] buffer = mIntBuffer;
mReadBuffer.readSignedInt(buffer, length);
float[] outBuffer = e.ensurePointSize(e.pointNextPos + length, true);
int outPos = e.pointNextPos;
int lat, lon;
float pLat, pLon;
/* first node latitude single-delta offset */
int firstLat = lat = mTileLatitude + buffer[0];
int firstLon = lon = mTileLongitude + buffer[1];
int rawLat = mTileLatitude + buffer[0];
int rawLon = mTileLongitude + buffer[1];
outBuffer[outPos++] = lon;
outBuffer[outPos++] = lat;
float firstLat = pLat = mTileProjection.projectLat(rawLat);
float firstLon = pLon = mTileProjection.projectLon(rawLon);
outBuffer[outPos++] = pLon;
outBuffer[outPos++] = pLat;
int cnt = 2;
/* reset label position single-delta to first way node */
if (labelPosition != null) {
labelPosition[1] = rawLat + labelPosition[1];
labelPosition[0] = rawLon + labelPosition[0];
}
if (waySegment != null)
waySegment[0] = new GeoPoint(rawLat / 1E6, rawLon / 1E6);
int deltaLat = 0;
int deltaLon = 0;
@@ -759,8 +792,14 @@ public class MapDatabase implements ITileDataSource {
deltaLat = buffer[pos];
deltaLon = buffer[pos + 1];
}
lat += deltaLat;
lon += deltaLon;
rawLat += deltaLat;
rawLon += deltaLon;
if (waySegment != null)
waySegment[pos / 2] = new GeoPoint(rawLat / 1E6, rawLon / 1E6);
float lat = mTileProjection.projectLat(rawLat);
float lon = mTileProjection.projectLon(rawLon);
if (pos == length - 2) {
boolean line = isLine || (lon != firstLon || lat != firstLat);
@@ -774,13 +813,19 @@ public class MapDatabase implements ITileDataSource {
if (e.type == GeometryType.NONE)
e.type = line ? LINE : POLY;
} else /*if ((deltaLon > minDeltaLon || deltaLon < -minDeltaLon
|| deltaLat > minDeltaLat || deltaLat < -minDeltaLat)
|| e.tags.contains("natural", "nosea"))*/ {
// Avoid additional simplification
// https://github.com/mapsforge/vtm/issues/39
outBuffer[outPos++] = lon;
outBuffer[outPos++] = lat;
} else if (lat == pLat && lon == pLon) {
/* drop small distance intermediate nodes */
//log.debug("drop zero delta ");
} else if (Parameters.SIMPLIFICATION_TOLERANCE == 0
|| (isLine
|| e.tags.contains(TAG_ISSEA)
|| e.tags.contains(TAG_SEA)
|| e.tags.contains(TAG_NOSEA)
|| deltaLon > minDeltaLon || deltaLon < -minDeltaLon
|| deltaLat > minDeltaLat || deltaLat < -minDeltaLat)) {
// Point reduction except lines and land/sea polygons
outBuffer[outPos++] = pLon = lon;
outBuffer[outPos++] = pLat = lat;
cnt += 2;
}
}
@@ -954,7 +999,7 @@ public class MapDatabase implements ITileDataSource {
if (ways != null)
wayNodes = new ArrayList<>();
if (!processWayDataBlock(e, featureWayDoubleDeltaEncoding, linearFeature, wayNodes))
if (!processWayDataBlock(e, featureWayDoubleDeltaEncoding, linearFeature, wayNodes, labelPosition))
return false;
/* drop invalid outer ring */
@@ -963,12 +1008,10 @@ public class MapDatabase implements ITileDataSource {
}
if (labelPosition != null && wayDataBlock == 0)
e.setLabelPosition(e.points[0] + labelPosition[0], e.points[1] + labelPosition[1]);
e.setLabelPosition(mTileProjection.projectLon(labelPosition[0]), mTileProjection.projectLat(labelPosition[1]));
else
e.labelPosition = null;
mTileProjection.project(e);
// When a way will be rendered then typically a label / symbol will be applied
// by the render theme. If the way does not come with a defined labelPosition
// we should calculate a position, that is based on all points of the given way.
@@ -1011,7 +1054,7 @@ public class MapDatabase implements ITileDataSource {
for (int i = 0; i < e.tags.size(); i++)
tags.add(e.tags.get(i));
if (Selector.ALL == selector || hasName || hasHouseNr || hasRef || wayAsLabelTagFilter(tags)) {
GeoPoint labelPos = e.labelPosition != null ? new GeoPoint(e.labelPosition.y / 1E6, e.labelPosition.x / 1E6) : null;
GeoPoint labelPos = labelPosition != null ? new GeoPoint(labelPosition[1] / 1E6, labelPosition[0] / 1E6) : null;
ways.add(new Way(layer, tags, wayNodesArray, labelPos, e.type));
}
}

View File

@@ -16,7 +16,7 @@
* You should have received a copy of the GNU Lesser General Public License along with
* this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.oscim.tiling.source.mvt;
package org.oscim.tiling.source.mapzen;
import org.oscim.core.GeometryBuffer.GeometryType;
import org.oscim.core.MapElement;

View File

@@ -62,11 +62,22 @@ public final class Parameters {
*/
public static boolean POT_TEXTURES = false;
/**
* Reduce points on-the-fly while reading from map files.
* e.g. 0 (no simplification), 2, 4, ...
*/
public static int SIMPLIFICATION_TOLERANCE = 0;
/**
* Texture atlas in themes.
*/
public static boolean TEXTURE_ATLAS = false;
/**
* Threaded system initialization.
*/
public static boolean THREADED_INIT = false;
private Parameters() {
throw new IllegalStateException();
}