/** * 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; }
/** * send a streetLight in the dsf file. * * @param osmPolygon osm polygon * @return true if a streetlight has been written in the dsf file. */ private boolean processStreetLights(OsmPolygon osmPolygon) { Boolean result = false; if (XplaneOptionsHelper.getOptions().isGenerateStreetLights() && OsmUtils.isTagInTagsList("highway", "residential", osmPolygon.getTags())) { writeStreetLightToDsf(osmPolygon); result = true; } return result; }
/** * Construct and write a facade building in the dsf file. * * @param osmPolygon osm polygon * @return true if a building has been gennerated in the dsf file. */ private boolean processBuilding(OsmPolygon osmPolygon) { Boolean result = false; if (XplaneOptionsHelper.getOptions().isGenerateBuildings() && OsmUtils.isBuilding(osmPolygon.getTags()) && !OsmUtils.isExcluded(osmPolygon.getTags(), osmPolygon.getId()) && osmPolygon.getPolygon().getVertexNumber() > BUILDING_MIN_VECTORS && osmPolygon.getPolygon().getVertexNumber() < BUILDING_MAX_VECTORS) { // check that the largest vector of the building // and that the area of the osmPolygon.getPolygon() are over the // minimum values set by the user Double maxVector = osmPolygon.getMaxVectorSize(); if (maxVector > XplaneOptionsHelper.getOptions().getMinHouseSegment() && maxVector < XplaneOptionsHelper.getOptions().getMaxHouseSegment() && ((osmPolygon.getPolygon().getArea() * 100000) * 100000) > XplaneOptionsHelper.getOptions().getMinHouseArea()) { // simplify shape if checked and if necessary if (GuiOptionsHelper.getOptions().isSimplifyShapes() && !osmPolygon.isSimplePolygon()) { osmPolygon.simplifyPolygon(); } // compute height and facade dsf index osmPolygon.setHeight(computeBuildingHeight(osmPolygon)); Integer facade = computeFacadeIndex(osmPolygon); // write building in dsf file writeBuildingToDsf(osmPolygon, facade); // Smart exclusions if (XplaneOptionsHelper.getOptions().isSmartExclusions()) { exclusionsHelper.addTodoPolygon(osmPolygon); exclusionsHelper.run(); } result = true; } } return result; }
@Override public Boolean mustStoreWay(Way way) { List<Tag> tags = way.getTag(); return (OsmUtils.isBuilding(tags) || OsmUtils.isForest(tags) || OsmUtils.isObject(tags)); }