/** * Parse maximal number of levels. * * @param osmPrimitive osm primitive * @return maximal number of levels */ public static Integer parseMaxLevel(OsmPrimitive osmPrimitive) { Integer level = roundToInteger(ModelUtil.getNumberAttribute(osmPrimitive, OsmAttributeKeys.BUILDING_MAX_LEVEL.getKey(), null)); if (level == null) { level = roundToInteger(ModelUtil.getNumberAttribute(osmPrimitive, OsmAttributeKeys.BUILDING_LEVELS.getKey(), null)); } if (level == null) { level = roundToInteger(ModelUtil.getNumberAttribute(osmPrimitive, OsmAttributeKeys.BUILDING_LEVELS_ABOVEGROUND.getKey(), null)); } if (level != null) { Integer roofLevels = BuildingAttributeParser.parseRoofLevels(osmPrimitive); if (roofLevels != null) { level += roofLevels; } } return level; }
/** * @param pOsmPrimitive * @return */ public static BuildingPart parseBuildingPartAttributes(OsmPrimitive pOsmPrimitive) { BuildingPart bp = new BuildingPart(); bp.setMaxHeight(BuildingAttributeParser.parseMaxHeight(pOsmPrimitive)); bp.setMinHeight(BuildingAttributeParser.parseMinHeight(pOsmPrimitive)); bp.setMaxLevel(BuildingAttributeParser.parseMaxLevel(pOsmPrimitive)); bp.setRoofLevels(BuildingAttributeParser.parseRoofLevels(pOsmPrimitive)); bp.setMinLevel(BuildingAttributeParser.parseMinLevel(pOsmPrimitive)); bp.setFacadeMaterialType(BuildingAttributeParser.parseFacadeMaterialName(pOsmPrimitive)); bp.setFacadeColor(BuildingAttributeParser.parseFacadeColor(pOsmPrimitive)); bp.setFloorMaterialType(BuildingAttributeParser.parseFloorMaterialName(pOsmPrimitive)); bp.setFloorColor(BuildingAttributeParser.parseFloorColor(pOsmPrimitive)); bp.setRoofMaterialType(BuildingAttributeParser.parseRoofMaterialName(pOsmPrimitive)); bp.setRoofColor(BuildingAttributeParser.parseRoofColor(pOsmPrimitive)); bp.setContext(pOsmPrimitive.getPrimitiveId()); return bp; }