Mapsforge: simplification exceptions (#906)

This commit is contained in:
Emux 2022-02-22 17:54:16 +02:00 committed by GitHub
parent 825cd05150
commit 6fb02ec055
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 30 additions and 2 deletions

View File

@ -4,6 +4,8 @@
- Mapsforge: deduplicate maps [#903](https://github.com/mapsforge/vtm/pull/903) - 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) - 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 - Minor improvements and bug fixes
- [Solved issues](https://github.com/mapsforge/vtm/issues?q=is%3Aclosed+milestone%3A0.18.0) - [Solved issues](https://github.com/mapsforge/vtm/issues?q=is%3Aclosed+milestone%3A0.18.0)

View File

@ -1,7 +1,7 @@
/* /*
* Copyright 2013 Hannes Janetzek * Copyright 2013 Hannes Janetzek
* Copyright 2016 Andrey Novikov * Copyright 2016 Andrey Novikov
* Copyright 2016 devemux86 * Copyright 2016-2022 devemux86
* Copyright 2017-2019 Gustl22 * Copyright 2017-2019 Gustl22
* *
* This file is part of the OpenScienceMap project (http://www.opensciencemap.org). * 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 org.oscim.utils.Utils;
import java.util.Arrays; import java.util.Arrays;
import java.util.Collection;
/** /**
* The Class TagSet holds a set of Tags. * The Class TagSet holds a set of Tags.
@ -219,6 +220,20 @@ public class TagSet {
return false; 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<Tag> tags) {
for (Tag tag : tags) {
if (contains(tag))
return true;
}
return false;
}
@Override @Override
public String toString() { public String toString() {
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();

View File

@ -836,6 +836,7 @@ public class MapDatabase implements ITileDataSource {
|| e.tags.contains(TAG_ISSEA) || e.tags.contains(TAG_ISSEA)
|| e.tags.contains(TAG_SEA) || e.tags.contains(TAG_SEA)
|| e.tags.contains(TAG_NOSEA) || e.tags.contains(TAG_NOSEA)
|| e.tags.contains(Parameters.SIMPLIFICATION_EXCEPTIONS)
|| deltaLon > minDeltaLon || deltaLon < -minDeltaLon || deltaLon > minDeltaLon || deltaLon < -minDeltaLon
|| deltaLat > minDeltaLat || deltaLat < -minDeltaLat)) { || deltaLat > minDeltaLat || deltaLat < -minDeltaLat)) {
// Point reduction except lines and land/sea polygons // Point reduction except lines and land/sea polygons

View File

@ -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 * 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 * terms of the GNU Lesser General Public License as published by the Free Software
@ -14,6 +14,11 @@
*/ */
package org.oscim.utils; package org.oscim.utils;
import org.oscim.core.Tag;
import java.util.HashSet;
import java.util.Set;
public final class Parameters { public final class Parameters {
public enum SymbolScaling {ALL, POI} public enum SymbolScaling {ALL, POI}
@ -74,6 +79,11 @@ public final class Parameters {
*/ */
public static boolean POT_TEXTURES = false; public static boolean POT_TEXTURES = false;
/**
* Simplification exceptions.
*/
public static final Set<Tag> SIMPLIFICATION_EXCEPTIONS = new HashSet<>();
/** /**
* Reduce points on-the-fly while reading from map files. * Reduce points on-the-fly while reading from map files.
* e.g. 0 (no simplification), 2, 4, ... * e.g. 0 (no simplification), 2, 4, ...