/** * Compute the facade index for given osm tags, polygon and height. * * @param tags * @param polygon * @param height * @return Integer the facade index. */ public Integer computeFacadeIndex(OsmPolygon polygon) { Integer result = null; // first, do we are on a residential object? // yes if there is residential or house tag // or if surface of the polygon is under the max surface for a // residential house // and height is under max residential height if ((OsmUtils.isValueinTags("residential", polygon.getTags()) || OsmUtils.isValueinTags("house", polygon.getTags()) || polygon.getArea() * 10000000 < ASSERTION_RESIDENTIAL_MAX_AREA) && polygon.getHeight() < XplaneOptionsHelper.getOptions().getResidentialMax()) { result = computeResidentialFacadeIndex(polygon); } // do we are on a building object? // yes if there is industrial or Commercial tag // or if surface of the polygon is above the max surface for a // residential house // and height is above max residential height else { if (OsmUtils.isValueinTags("industrial", polygon.getTags()) || OsmUtils.isValueinTags("Commercial", polygon.getTags()) || polygon.getArea() * 10000000 > ASSERTION_RESIDENTIAL_MAX_AREA || polygon.getHeight() > XplaneOptionsHelper.getOptions().getResidentialMax()) { result = computeBuildingFacadeIndex(polygon); } } return result; }
/** * Compute the height for this polygon and osm tags. * * @return Integer the height. */ private Integer computeBuildingHeight(OsmPolygon polygon) { Integer result = null; Integer osmHeight = polygon.getHeight(); if (osmHeight != null) { result = osmHeight; } else { if (polygon.getArea() * 10000000 < 0.2) { result = XplaneOptionsHelper.getOptions().getResidentialMin(); } else { if (polygon.getArea() * 10000000 > ASSERTION_RESIDENTIAL_MAX_AREA) result = MiscUtils.getRandomSize( XplaneOptionsHelper.getOptions().getBuildingMin(), XplaneOptionsHelper.getOptions().getBuildingMax()); else if (polygon.getArea() * 10000000 < ASSERTION_RESIDENTIAL_MAX_AREA) result = MiscUtils.getRandomSize( XplaneOptionsHelper.getOptions().getResidentialMin(), XplaneOptionsHelper.getOptions().getResidentialMax()); } } return result; }