diff --git a/docs/Changelog.md b/docs/Changelog.md index 07312877..db915932 100644 --- a/docs/Changelog.md +++ b/docs/Changelog.md @@ -4,6 +4,8 @@ - Mapsforge: deduplicate maps [#903](https://github.com/mapsforge/vtm/pull/903) - Fix overlapping map regions [#903](https://github.com/mapsforge/vtm/pull/903) [#905](https://github.com/mapsforge/vtm/pull/905) +- Mapsforge: simplification exceptions [#906](https://github.com/mapsforge/vtm/pull/906) + - `Parameters.SIMPLIFICATION_EXCEPTIONS` - Minor improvements and bug fixes - [Solved issues](https://github.com/mapsforge/vtm/issues?q=is%3Aclosed+milestone%3A0.18.0) diff --git a/vtm/src/org/oscim/core/TagSet.java b/vtm/src/org/oscim/core/TagSet.java index e62b1180..8efd4fc3 100644 --- a/vtm/src/org/oscim/core/TagSet.java +++ b/vtm/src/org/oscim/core/TagSet.java @@ -1,7 +1,7 @@ /* * Copyright 2013 Hannes Janetzek * Copyright 2016 Andrey Novikov - * Copyright 2016 devemux86 + * Copyright 2016-2022 devemux86 * Copyright 2017-2019 Gustl22 * * This file is part of the OpenScienceMap project (http://www.opensciencemap.org). @@ -22,6 +22,7 @@ package org.oscim.core; import org.oscim.utils.Utils; import java.util.Arrays; +import java.util.Collection; /** * The Class TagSet holds a set of Tags. @@ -219,6 +220,20 @@ public class TagSet { return false; } + /** + * Checks if any tag is contained in TagSet. + * + * @param tags the tags + * @return true, iff any tag is in TagSet + */ + public boolean contains(Collection tags) { + for (Tag tag : tags) { + if (contains(tag)) + return true; + } + return false; + } + @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/vtm/src/org/oscim/tiling/source/mapfile/MapDatabase.java b/vtm/src/org/oscim/tiling/source/mapfile/MapDatabase.java index 5fdc5cd6..b140d348 100644 --- a/vtm/src/org/oscim/tiling/source/mapfile/MapDatabase.java +++ b/vtm/src/org/oscim/tiling/source/mapfile/MapDatabase.java @@ -836,6 +836,7 @@ public class MapDatabase implements ITileDataSource { || e.tags.contains(TAG_ISSEA) || e.tags.contains(TAG_SEA) || e.tags.contains(TAG_NOSEA) + || e.tags.contains(Parameters.SIMPLIFICATION_EXCEPTIONS) || deltaLon > minDeltaLon || deltaLon < -minDeltaLon || deltaLat > minDeltaLat || deltaLat < -minDeltaLat)) { // Point reduction except lines and land/sea polygons diff --git a/vtm/src/org/oscim/utils/Parameters.java b/vtm/src/org/oscim/utils/Parameters.java index ded22996..a88aa6a1 100644 --- a/vtm/src/org/oscim/utils/Parameters.java +++ b/vtm/src/org/oscim/utils/Parameters.java @@ -1,5 +1,5 @@ /* - * Copyright 2017-2020 devemux86 + * Copyright 2017-2022 devemux86 * * This program is free software: you can redistribute it and/or modify it under the * terms of the GNU Lesser General Public License as published by the Free Software @@ -14,6 +14,11 @@ */ package org.oscim.utils; +import org.oscim.core.Tag; + +import java.util.HashSet; +import java.util.Set; + public final class Parameters { public enum SymbolScaling {ALL, POI} @@ -74,6 +79,11 @@ public final class Parameters { */ public static boolean POT_TEXTURES = false; + /** + * Simplification exceptions. + */ + public static final Set SIMPLIFICATION_EXCEPTIONS = new HashSet<>(); + /** * Reduce points on-the-fly while reading from map files. * e.g. 0 (no simplification), 2, 4, ...