Overpass tile source (#665)
This commit is contained in:
@@ -35,6 +35,7 @@ import org.oscim.renderer.bucket.RenderBuckets;
|
||||
import org.oscim.theme.IRenderTheme;
|
||||
import org.oscim.theme.styles.ExtrusionStyle;
|
||||
import org.oscim.theme.styles.RenderStyle;
|
||||
import org.oscim.utils.geom.GeometryUtils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
@@ -53,6 +54,11 @@ public class BuildingLayer extends Layer implements TileLoaderThemeHook, ZoomLim
|
||||
*/
|
||||
public static boolean POST_AA = false;
|
||||
|
||||
/**
|
||||
* Use real time calculations to pre-process data.
|
||||
*/
|
||||
public static boolean RAW_DATA = false;
|
||||
|
||||
/**
|
||||
* Let vanish extrusions / meshes which are covered by others.
|
||||
* {@link org.oscim.renderer.bucket.RenderBucket#EXTRUSION}: roofs are always translucent.
|
||||
@@ -147,6 +153,10 @@ public class BuildingLayer extends Layer implements TileLoaderThemeHook, ZoomLim
|
||||
mBuildings.put(tile.hashCode(), buildingElements);
|
||||
}
|
||||
element = new MapElement(element); // Deep copy, because element will be cleared
|
||||
if (RAW_DATA && element.isClockwise() > 0) {
|
||||
// Buildings must be counter clockwise in VTM (mirrored to OSM)
|
||||
element.reverse();
|
||||
}
|
||||
buildingElements.add(new BuildingElement(element, extrusion));
|
||||
return true;
|
||||
}
|
||||
@@ -216,8 +226,13 @@ public class BuildingLayer extends Layer implements TileLoaderThemeHook, ZoomLim
|
||||
|
||||
// Search buildings which inherit parts
|
||||
for (BuildingElement rootBuilding : tileBuildings) {
|
||||
if (rootBuilding.element.isBuildingPart()
|
||||
|| !(refId.equals(getValue(rootBuilding.element, Tag.KEY_ID))))
|
||||
if (rootBuilding.element.isBuildingPart())
|
||||
continue;
|
||||
if (RAW_DATA) {
|
||||
float[] center = GeometryUtils.center(partBuilding.element.points, 0, partBuilding.element.pointNextPos, null);
|
||||
if (!GeometryUtils.pointInPoly(center[0], center[1], rootBuilding.element.points, rootBuilding.element.index[0], 0))
|
||||
continue;
|
||||
} else if (!(refId.equals(getValue(rootBuilding.element, Tag.KEY_ID))))
|
||||
continue;
|
||||
|
||||
rootBuildings.add(rootBuilding);
|
||||
|
||||
@@ -27,6 +27,7 @@ import org.oscim.layers.tile.vector.VectorTileLayer;
|
||||
import org.oscim.map.Map;
|
||||
import org.oscim.theme.styles.ExtrusionStyle;
|
||||
import org.oscim.utils.ExtrusionUtils;
|
||||
import org.oscim.utils.geom.GeometryUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
@@ -191,15 +192,20 @@ public class S3DBLayer extends BuildingLayer {
|
||||
continue;
|
||||
|
||||
String refId = getValue(partBuilding.element, Tag.KEY_REF);
|
||||
if (refId == null)
|
||||
if (!RAW_DATA && refId == null)
|
||||
continue;
|
||||
|
||||
TagSet partTags = partBuilding.element.tags;
|
||||
|
||||
// Search buildings which inherit parts
|
||||
for (BuildingElement rootBuilding : tileBuildings) {
|
||||
if (rootBuilding.element.isBuildingPart()
|
||||
|| !(refId.equals(rootBuilding.element.tags.getValue(Tag.KEY_ID))))
|
||||
if (rootBuilding.element.isBuildingPart())
|
||||
continue;
|
||||
if (RAW_DATA) {
|
||||
float[] center = GeometryUtils.center(partBuilding.element.points, 0, partBuilding.element.pointNextPos, null);
|
||||
if (!GeometryUtils.pointInPoly(center[0], center[1], rootBuilding.element.points, rootBuilding.element.index[0], 0))
|
||||
continue;
|
||||
} else if (!refId.equals(rootBuilding.element.tags.getValue(Tag.KEY_ID)))
|
||||
continue;
|
||||
|
||||
if ((getValue(rootBuilding.element, Tag.KEY_ROOF_SHAPE) != null)
|
||||
|
||||
Reference in New Issue
Block a user