| 55 | } |
| 56 | |
| 57 | ifcopenshell::geometry::taxonomy::colour read_colour_component(const boost::optional<pt::ptree&> list) { |
| 58 | if (!list) { |
| 59 | return ifcopenshell::geometry::taxonomy::colour(); |
| 60 | } |
| 61 | double rgb[3]; |
| 62 | int i = 0; |
| 63 | for (pt::ptree::value_type &colour : list.get()) { |
| 64 | if (3 <= i) { |
| 65 | throw std::runtime_error("rgb array over 3 elements large"); |
| 66 | } |
| 67 | rgb[i] = colour.second.get_value<double>(); |
| 68 | i++; |
| 69 | } |
| 70 | if (i != 3) { |
| 71 | throw std::runtime_error("rgb array less than 3 elements large (was " + std::to_string(i) + ")"); |
| 72 | } |
| 73 | return ifcopenshell::geometry::taxonomy::colour(rgb[0], rgb[1], rgb[2]); |
| 74 | } |
| 75 | |
| 76 | void IfcGeom::set_default_style_file(const std::string& json_file) { |
| 77 | if (!default_materials_initialized) InitDefaultMaterials(); |
no test coverage detected