Enable per-item styles in the pythonOCC viewer

This commit is contained in:
Thomas Krijnen
2016-04-11 11:50:43 +02:00
parent 426b1279e3
commit 81ee60079e
4 changed files with 144 additions and 14 deletions
+17
View File
@@ -38,6 +38,23 @@ IfcGeom::Representation::Serialization::Serialization(const BRep& brep)
for (IfcGeom::IfcRepresentationShapeItems::const_iterator it = brep.begin(); it != brep.end(); ++ it) {
const TopoDS_Shape& s = it->Shape();
gp_GTrsf trsf = it->Placement();
if (it->hasStyle() && it->Style().Diffuse()) {
const IfcGeom::SurfaceStyle::ColorComponent& clr = *it->Style().Diffuse();
_surface_styles.push_back(clr.R());
_surface_styles.push_back(clr.G());
_surface_styles.push_back(clr.B());
} else {
_surface_styles.push_back(-1.);
_surface_styles.push_back(-1.);
_surface_styles.push_back(-1.);
}
if (it->hasStyle() && it->Style().Transparency()) {
_surface_styles.push_back(1. - *it->Style().Transparency());
} else {
_surface_styles.push_back(1.);
}
if (settings().get(IteratorSettings::CONVERT_BACK_UNITS)) {
gp_Trsf scale;
scale.SetScaleFactor(1.0 / settings().unit_magnitude());