Merge pull request #553 from Gustl22/s3db_roof_angle

S3DBLayer: fix roof height estimation based on tag "roof:angle"
This commit is contained in:
Emux 2018-06-21 11:38:08 +03:00 committed by GitHub
commit c8068d5835
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -94,8 +94,9 @@ public class S3DBLayer extends BuildingLayer {
}
}
if (bb != null) {
float maxSize = (int) Math.max(bb.getHeight(), bb.getWidth()) * TILE_SCALE;
roofHeight = (int) ((Float.parseFloat(v) / 45.f) * (maxSize * 15)); // Angle is simplified, 15 is some constant, may depend on lat
float minSize = (int) Math.min(bb.getHeight(), bb.getWidth()) * groundScale; // depends on lat
// Angle is simplified, 40 is an estimated constant
roofHeight = (int) ((Float.parseFloat(v) / 45.f) * (minSize * 40));
}
} else if ((v = element.tags.getValue(Tag.KEY_ROOF_SHAPE)) != null && !v.equals(Tag.VALUE_FLAT)) {
roofHeight = (2 * BUILDING_LEVEL_HEIGHT);