Skip to content

Commit

Permalink
Mapsforge: simplification exceptions (#906)
Browse files Browse the repository at this point in the history
  • Loading branch information
devemux86 authored Feb 22, 2022
1 parent 825cd05 commit 6fb02ec
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 2 deletions.
2 changes: 2 additions & 0 deletions docs/Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
17 changes: 16 additions & 1 deletion vtm/src/org/oscim/core/TagSet.java
Original file line number Diff line number Diff line change
@@ -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).
Expand All @@ -22,6 +22,7 @@
import org.oscim.utils.Utils;

import java.util.Arrays;
import java.util.Collection;

/**
* The Class TagSet holds a set of Tags.
Expand Down Expand Up @@ -219,6 +220,20 @@ public boolean contains(String key, String value) {
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
public String toString() {
StringBuilder sb = new StringBuilder();
Expand Down
1 change: 1 addition & 0 deletions vtm/src/org/oscim/tiling/source/mapfile/MapDatabase.java
Original file line number Diff line number Diff line change
Expand Up @@ -836,6 +836,7 @@ private int decodeWayNodes(boolean doubleDelta, MapElement e, int length, boolea
|| 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
Expand Down
12 changes: 11 additions & 1 deletion vtm/src/org/oscim/utils/Parameters.java
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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}
Expand Down Expand Up @@ -74,6 +79,11 @@ public enum SymbolScaling {ALL, POI}
*/
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.
* e.g. 0 (no simplification), 2, 4, ...
Expand Down

0 comments on commit 6fb02ec

Please sign in to comment.