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

Method setSectionHeightsFromStoreys

src/serializers/SvgSerializer.cpp:2359–2388  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2357}
2358
2359void SvgSerializer::setSectionHeightsFromStoreys(double offset) {
2360 if (!file) {
2361 Logger::Error("No file specified");
2362 return;
2363 }
2364 with_section_heights_from_storey_ = true;
2365 section_data_.emplace();
2366 auto storeys = file->instances_by_type("IfcBuildingStorey");
2367 const double lu = file->getUnit("LENGTHUNIT").second;
2368 if (storeys && storeys->size() > 0) {
2369 for (auto& s : *storeys) {
2370 auto attr_value = ((IfcUtil::IfcBaseEntity*)s)->get("Elevation");
2371 if (!attr_value.isNull()) {
2372 double elev;
2373 try {
2374 elev = attr_value;
2375 } catch (std::exception& e) {
2376 Logger::Error(e);
2377 continue;
2378 }
2379 if (!section_data_->empty()) {
2380 boost::get<horizontal_plan>(section_data_->back()).next_elevation = elev * lu;
2381 }
2382 section_data_->push_back(horizontal_plan{ (IfcUtil::IfcBaseEntity*)s, elev * lu, offset, std::numeric_limits<double>::infinity() });
2383 }
2384 }
2385 } else {
2386 section_data_->push_back(horizontal_plan_at_element{});
2387 }
2388}
2389
2390namespace {
2391 std::string array_to_string(double v) {

Callers 2

mainFunction · 0.80
IfcConvert.cppFile · 0.80

Calls 8

instances_by_typeMethod · 0.80
getUnitMethod · 0.80
isNullMethod · 0.80
push_backMethod · 0.80
ErrorFunction · 0.50
sizeMethod · 0.45
getMethod · 0.45
emptyMethod · 0.45

Tested by

no test coverage detected