forked from opensciencemap/vtm
-
Notifications
You must be signed in to change notification settings - Fork 91
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Areas not filled in overlapping map regions #806
Comments
I know this really hacky, and only probabilistically correct, but... it works for me ;) public class DedupMultiTileSource extends MultiMapFileTileSource {
private static class DedupDataSink implements ITileDataSink {
final private ITileDataSink parent;
final private HashSet<Integer> undupSet = new HashSet<>(2000);
DedupDataSink(ITileDataSink parent) {
this.parent = parent;
}
private static int genHashCode(MapElement elem) {
final int prime = 31;
int result = 1;
result = prime * result + elem.layer;
for (int i=0; i < elem.tags.size(); i++) {
Tag tag = elem.tags.get(i);
if (tag.key != null) {
result = prime * result + tag.key.hashCode();
}
if (tag.value != null) {
result = prime * result + tag.value.hashCode();
}
}
for (int i=0; i < elem.pointNextPos; i++) {
result = prime * result + Float.floatToIntBits(elem.points[i]);
}
if (elem.labelPosition != null) {
result = prime * result + elem.labelPosition.hashCode();
}
return result;
}
@Override
public void process(MapElement mapElement) {
int elHash = genHashCode(mapElement);
if (!undupSet.contains(elHash)) {
parent.process(mapElement);
undupSet.add(elHash);
}
}
@Override
public void setTileImage(Bitmap bitmap) {
parent.setTileImage(bitmap);
}
@Override
public void completed(QueryResult queryResult) {
parent.completed(queryResult);
}
}
private static class DedupDataSource implements ITileDataSource {
final private ITileDataSource parent;
DedupDataSource(ITileDataSource parent) {
this.parent = parent;
}
@Override
public void query(MapTile mapTile, ITileDataSink iTileDataSink) {
DedupDataSink dedupSink = new DedupDataSink(iTileDataSink);
parent.query(mapTile, dedupSink);
}
@Override
public void dispose() {
parent.dispose();
}
@Override
public void cancel() {
parent.cancel();
}
}
@Override
public ITileDataSource getDataSource() {
return new DedupDataSource(super.getDataSource());
}
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
When overlapping map regions are installed, the areas are not correctly filled.
Example: I have installed the Bavaria and Austria maps (from openandromaps.org) which have an overlapping part. The areas in this overlapping part (e.g. lakes, woods) are not correctly filled.
Both Bavaria and Austria installed:
Only Bavaria installed:
Using vtm-android 0.15.0 with diffeent themes, all themes are affected by this issue.
With MapsForge I was using the MultiMapDataStore with DataPolicy.DEDUPLICATE. For VTM I'm using the MultiMapFileTileSource which doesn't provide a similar option.
The text was updated successfully, but these errors were encountered: