MapElement: add building methods
This commit is contained in:
parent
c46548d15e
commit
f7f1940054
@ -2,6 +2,7 @@
|
|||||||
* Copyright 2012 Hannes Janetzek
|
* Copyright 2012 Hannes Janetzek
|
||||||
* Copyright 2016 Andrey Novikov
|
* Copyright 2016 Andrey Novikov
|
||||||
* Copyright 2017 Gustl22
|
* Copyright 2017 Gustl22
|
||||||
|
* Copyright 2018 devemux86
|
||||||
*
|
*
|
||||||
* This file is part of the OpenScienceMap project (http://www.opensciencemap.org).
|
* This file is part of the OpenScienceMap project (http://www.opensciencemap.org).
|
||||||
*
|
*
|
||||||
@ -59,6 +60,16 @@ public class MapElement extends GeometryBuffer {
|
|||||||
this.setLayer(element.layer);
|
this.setLayer(element.layer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isBuilding() {
|
||||||
|
return tags.containsKey(Tag.KEY_BUILDING)
|
||||||
|
|| "building".equals(tags.getValue("kind")); // Mapzen
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isBuildingPart() {
|
||||||
|
return tags.containsKey(Tag.KEY_BUILDING_PART)
|
||||||
|
|| "building_part".equals(tags.getValue("kind")); // Mapzen
|
||||||
|
}
|
||||||
|
|
||||||
public void setLabelPosition(float x, float y) {
|
public void setLabelPosition(float x, float y) {
|
||||||
labelPosition = new PointF(x, y);
|
labelPosition = new PointF(x, y);
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2013 Hannes Janetzek
|
* Copyright 2013 Hannes Janetzek
|
||||||
* Copyright 2016-2017 devemux86
|
* Copyright 2016-2018 devemux86
|
||||||
* Copyright 2016 Robin Boldt
|
* Copyright 2016 Robin Boldt
|
||||||
* Copyright 2017 Gustl22
|
* Copyright 2017 Gustl22
|
||||||
*
|
*
|
||||||
@ -103,17 +103,14 @@ public class BuildingLayer extends Layer implements TileLoaderThemeHook {
|
|||||||
|
|
||||||
// Filter all building elements
|
// Filter all building elements
|
||||||
// TODO #TagFromTheme: load from theme or decode tags to generalize mapsforge tags
|
// TODO #TagFromTheme: load from theme or decode tags to generalize mapsforge tags
|
||||||
boolean isBuildingPart = element.tags.containsKey(Tag.KEY_BUILDING_PART)
|
if (element.isBuilding() || element.isBuildingPart()) {
|
||||||
|| (element.tags.containsKey("kind") && element.tags.getValue("kind").equals("building_part")); // Mapzen
|
|
||||||
if (element.tags.containsKey(Tag.KEY_BUILDING) || isBuildingPart
|
|
||||||
|| (element.tags.containsKey("kind") && element.tags.getValue("kind").equals("building"))) { // Mapzen
|
|
||||||
List<BuildingElement> buildingElements = mBuildings.get(tile.hashCode());
|
List<BuildingElement> buildingElements = mBuildings.get(tile.hashCode());
|
||||||
if (buildingElements == null) {
|
if (buildingElements == null) {
|
||||||
buildingElements = new ArrayList<>();
|
buildingElements = new ArrayList<>();
|
||||||
mBuildings.put(tile.hashCode(), buildingElements);
|
mBuildings.put(tile.hashCode(), buildingElements);
|
||||||
}
|
}
|
||||||
element = new MapElement(element); // Deep copy, because element will be cleared
|
element = new MapElement(element); // Deep copy, because element will be cleared
|
||||||
buildingElements.add(new BuildingElement(element, extrusion, isBuildingPart));
|
buildingElements.add(new BuildingElement(element, extrusion, element.isBuildingPart()));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user