Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/feature/mapsforge#1085' into fea…
Browse files Browse the repository at this point in the history
  • Loading branch information
monsieurtanuki committed Sep 24, 2018
2 parents c977ef5 + 88c528d commit 54be9d8
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 0 deletions.
6 changes: 6 additions & 0 deletions docs/Changelog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Changelog

## New since 0.10.0

- Polyline scaled width [#1088](https://github.com/mapsforge/mapsforge/issues/1088)
- Many other minor improvements and bug fixes
- [Solved issues](https://github.com/mapsforge/mapsforge/issues?q=is%3Aclosed+milestone%3A0.11.0)

## Version 0.10.0 (2018-08-28)

- Mapsforge maps **v5**: custom tag keys [#1041](https://github.com/mapsforge/mapsforge/issues/1041)
Expand Down
1 change: 1 addition & 0 deletions docs/Mapsforge-Applications.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
| [Bike Computer](https://play.google.com/store/apps/details?id=de.rooehler.bikecomputer) | Routes and Tracks for Cycling | Proprietary/Free and Premium | Closed |
| [Bladenight App](https://play.google.com/store/apps/details?id=fr.ocroquette.bladenight) | Tracking for inline skating events | Proprietary/Free | Closed |
| [Calimoto](https://play.google.com/store/apps/details?id=com.calimoto.calimoto) | Motorrad navigation | Proprietary/Free (in-app purchases) | Closed |
| [Cartograph 2 Maps](https://www.cartograph.eu/) | Map viewer and tracking | Proprietary/Commercial | Closed |
| [Cruiser](http://wiki.openstreetmap.org/wiki/Cruiser) | Android / Desktop map and navigation application | Proprietary/Free | Closed |
| [c:geo](https://github.com/cgeo/) | Geocaching | Apache 2.0/Free | Open |
| [DogSheep](https://play.google.com/store/apps/details?id=com.dogsheep) | Customized maps and tours | Proprietary/Free | Closed |
Expand Down
11 changes: 11 additions & 0 deletions mapsforge-map-writer/src/main/config/tag-mapping.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
<osm-tag key="highway" value="mini_roundabout" zoom-appear="17" />
<osm-tag key="highway" value="traffic_signals" zoom-appear="17" />
<osm-tag key="highway" value="turning_circle" zoom-appear="15" />
<osm-tag key="highway" value="street_lamp" zoom-appear="17" />
</pois>

<!-- PUBLIC AMENITIES -->
Expand Down Expand Up @@ -88,6 +89,7 @@
<!-- TOURISM TAGS -->
<pois>
<osm-tag key="tourism" value="alpine_hut" zoom-appear="15" />
<osm-tag key="tourism" value="artwork" zoom-appear="17" />
<osm-tag key="tourism" value="attraction" zoom-appear="17" />
<osm-tag key="tourism" value="hostel" zoom-appear="17" />
<osm-tag key="tourism" value="hotel" zoom-appear="17" />
Expand All @@ -113,9 +115,14 @@

<!-- NATURAL TAGS -->
<pois>
<osm-tag key="leaf_type" renderable="false" value="broadleaved" />
<osm-tag key="leaf_type" renderable="false" value="needleleaved" />
<osm-tag key="leaf_type" renderable="false" value="leafless" />

<osm-tag key="natural" value="cave_entrance" zoom-appear="14" />
<osm-tag key="natural" value="peak" zoom-appear="12" />
<osm-tag key="natural" value="spring" zoom-appear="17" />
<osm-tag key="natural" value="tree" zoom-appear="17" />
<osm-tag key="natural" value="volcano" zoom-appear="12" />
</pois>

Expand Down Expand Up @@ -180,6 +187,10 @@

<!-- NATURAL / WATERWAY TAGS -->
<ways>
<osm-tag key="leaf_type" renderable="false" value="broadleaved" />
<osm-tag key="leaf_type" renderable="false" value="needleleaved" />
<osm-tag key="leaf_type" renderable="false" value="leafless" />

<osm-tag key="lock" value="yes" zoom-appear="14" />

<!-- mapsforge artificial tags for land/sea areas, do not remove -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,14 @@
*/
public class Polyline extends Layer {

private static final byte STROKE_MIN_ZOOM = 12;

private BoundingBox boundingBox;
private final GraphicFactory graphicFactory;
private final boolean keepAligned;
private final List<LatLong> latLongs = new CopyOnWriteArrayList<>();
private Paint paintStroke;
private double strokeIncrease = 1;

/**
* @param paintStroke the initial {@code Paint} used to stroke this polyline (may be null).
Expand Down Expand Up @@ -132,7 +135,13 @@ public synchronized void draw(BoundingBox boundingBox, byte zoomLevel, Canvas ca
if (this.keepAligned) {
this.paintStroke.setBitmapShaderShift(topLeftPoint);
}
float strokeWidth = this.paintStroke.getStrokeWidth();
if (this.strokeIncrease > 1) {
float scale = (float) Math.pow(this.strokeIncrease, Math.max(zoomLevel - STROKE_MIN_ZOOM, 0));
this.paintStroke.setStrokeWidth(strokeWidth * scale);
}
canvas.drawPath(path, this.paintStroke);
this.paintStroke.setStrokeWidth(strokeWidth);
}

/**
Expand All @@ -149,6 +158,13 @@ public synchronized Paint getPaintStroke() {
return this.paintStroke;
}

/**
* @return the base to scale polyline stroke per zoom (default 1 not scale).
*/
public synchronized double getStrokeIncrease() {
return strokeIncrease;
}

/**
* @return true if it keeps the bitmap aligned with the map, to avoid a
* moving effect of a bitmap shader, false otherwise.
Expand All @@ -170,6 +186,13 @@ public synchronized void setPoints(List<LatLong> points) {
updatePoints();
}

/**
* @param strokeIncrease the base to scale polyline stroke per zoom (default 1 not scale).
*/
public synchronized void setStrokeIncrease(double strokeIncrease) {
this.strokeIncrease = strokeIncrease;
}

private void updatePoints() {
this.boundingBox = this.latLongs.isEmpty() ? null : new BoundingBox(this.latLongs);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ public TileBitmap executeJob(RendererJob rendererJob) {
// now draw the ways and the labels
renderContext.canvasRasterer.drawMapElements(labelsToDraw, rendererJob.tile);
}

if (!rendererJob.labelsOnly && renderContext.renderTheme.hasMapBackgroundOutside()) {
// blank out all areas outside of map
if (this.mapDataStore != null) {
Expand Down

0 comments on commit 54be9d8

Please sign in to comment.