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

Method setFile

src/serializers/SvgSerializer.cpp:2315–2352  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2313}
2314
2315void SvgSerializer::setFile(IfcParse::IfcFile* f) {
2316 file = f;
2317
2318 auto storeys = f->instances_by_type("IfcBuildingStorey");
2319 if (!storeys || storeys->size() == 0) {
2320 auto mapping = ifcopenshell::geometry::impl::mapping_implementations().construct(file, geometry_settings_);
2321
2322 std::vector<const IfcParse::declaration*> to_derive_from;
2323 to_derive_from.push_back(f->schema()->declaration_by_name("IfcBuilding"));
2324 to_derive_from.push_back(f->schema()->declaration_by_name("IfcSite"));
2325 for (auto it = to_derive_from.begin(); it != to_derive_from.end(); ++it) {
2326 aggregate_of_instance::ptr insts = f->instances_by_type(*it);
2327 if (insts) {
2328 for (auto jt = insts->begin(); jt != insts->end(); ++jt) {
2329 IfcUtil::IfcBaseEntity* product = (IfcUtil::IfcBaseEntity*) *jt;
2330 if (!product->get("ObjectPlacement").isNull()) {
2331 auto item = mapping->map(product->get("ObjectPlacement"));
2332 auto matrix = ifcopenshell::geometry::taxonomy::cast<ifcopenshell::geometry::taxonomy::matrix4>(item);
2333 gp_Trsf trsf;
2334 if (matrix) {
2335 // @todo shouldn't this take into account configurable section height?
2336 setSectionHeight(matrix->translation_part()(2) + 1.);
2337#ifdef TAXONOMY_USE_NAKED_PTR
2338 delete matrix;
2339#endif
2340 Logger::Warning("No building storeys encountered, used for reference:", product);
2341 return;
2342 }
2343 }
2344 }
2345 }
2346 }
2347
2348 delete mapping;
2349
2350 Logger::Warning("No building storeys encountered, output might be invalid or missing");
2351 }
2352}
2353
2354void SvgSerializer::setSectionHeight(double h, const IfcUtil::IfcBaseEntity* storey) {
2355 section_data_.emplace();

Callers 7

operator()Function · 0.45
operator()Function · 0.45
mainFunction · 0.45
IfcConvert.cppFile · 0.45
setup_serialiserMethod · 0.45
generate_lineworkMethod · 0.45
executeMethod · 0.45

Calls 11

WarningFunction · 0.85
instances_by_typeMethod · 0.80
push_backMethod · 0.80
isNullMethod · 0.80
sizeMethod · 0.45
constructMethod · 0.45
schemaMethod · 0.45
beginMethod · 0.45
endMethod · 0.45
getMethod · 0.45
mapMethod · 0.45

Tested by

no test coverage detected