MCPcopy Create free account
hub / github.com/IfcOpenShell/IfcOpenShell / Serialization

Method Serialization

src/ifcgeom/IfcGeomRepresentation.cpp:22–54  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

20#include "IfcGeomRepresentation.h"
21
22IfcGeom::Representation::Serialization::Serialization(const BRep& brep)
23 : Representation(brep.settings(), brep.entity(), brep.id())
24{
25 for (auto it = brep.begin(); it != brep.end(); ++it) {
26 int sid = -1;
27
28 if (it->hasStyle()) {
29 const auto& clr = it->Style().get_color().ccomponents();
30 surface_styles_.push_back(clr(0));
31 surface_styles_.push_back(clr(1));
32 surface_styles_.push_back(clr(2));
33
34 sid = it->Style().instance ? it->Style().instance->as<IfcUtil::IfcBaseEntity>()->id() : -1;
35 } else {
36 surface_styles_.push_back(-1.);
37 surface_styles_.push_back(-1.);
38 surface_styles_.push_back(-1.);
39 }
40
41 if (it->hasStyle() && it->Style().has_transparency()) {
42 surface_styles_.push_back(1. - it->Style().transparency);
43 } else {
44 surface_styles_.push_back(1.);
45 }
46
47 surface_style_ids_.push_back(sid);
48 }
49
50 ifcopenshell::geometry::taxonomy::matrix4 identity;
51 auto* comp = brep.as_compound();
52 comp->Serialize(identity, brep_data_);
53 delete comp;
54}
55
56IfcGeom::ConversionResultShape* IfcGeom::Representation::BRep::as_compound(bool force_meters) const {
57 ConversionResultShape* accum = nullptr;

Callers

nothing calls this directly

Calls 8

clrFunction · 0.85
push_backMethod · 0.80
as_compoundMethod · 0.80
entityMethod · 0.45
idMethod · 0.45
beginMethod · 0.45
endMethod · 0.45
SerializeMethod · 0.45

Tested by

no test coverage detected