mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-12 10:33:20 +00:00
Fixes bug mapping geometry for IfcSectionedSolidHorizontal that was introduced in 26ba761
This commit is contained in:
@@ -31,10 +31,10 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcSectionedSolidHorizontal* in
|
||||
std::vector<cross_section> cross_sections;
|
||||
|
||||
auto dir = map(inst->Directrix());
|
||||
auto pwf = taxonomy::dcast<taxonomy::piecewise_function>(dir);
|
||||
if (!pwf) {
|
||||
auto fn = taxonomy::dcast<taxonomy::function_item>(dir);
|
||||
if (!fn) {
|
||||
// Only implement on alignment curves
|
||||
Logger::Warning("IfcSectionedSolidHorizontal is only implemented for piecewise function Directrix curves", inst);
|
||||
Logger::Warning("IfcSectionedSolidHorizontal is only implemented for Directrix curves based on taxonomy::function_item", inst);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@@ -70,9 +70,6 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcSectionedSolidHorizontal* in
|
||||
|
||||
profile_offsets.push_back(po);
|
||||
}
|
||||
#else
|
||||
return nullptr;
|
||||
#endif
|
||||
if (faces.size() != profile_offsets.size()) {
|
||||
Logger::Warning("Expected CrossSections and CrossSectionPositions to be equal length, but got " + std::to_string(faces.size()) + " and " + std::to_string(profile_offsets.size()) + " respectively", inst);
|
||||
return nullptr;
|
||||
@@ -85,9 +82,12 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcSectionedSolidHorizontal* in
|
||||
for (size_t i = 0; i < faces.size(); ++i) {
|
||||
cross_sections.push_back({ longitudes[i], faces[i], profile_offsets[i] });
|
||||
}
|
||||
}
|
||||
#else
|
||||
return nullptr;
|
||||
#endif
|
||||
}
|
||||
|
||||
return make_loft(settings_, inst, pwf, cross_sections);
|
||||
return make_loft(settings_, inst, fn, cross_sections);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -800,13 +800,14 @@ boost::optional<face::ptr> ifcopenshell::geometry::taxonomy::curve_to_face_upgra
|
||||
}
|
||||
|
||||
|
||||
boost::optional<piecewise_function::ptr> ifcopenshell::geometry::taxonomy::loop_to_piecewise_function_upgrade_impl(ptr item) {
|
||||
boost::optional<piecewise_function::ptr> pwf_;
|
||||
boost::optional<function_item::ptr> ifcopenshell::geometry::taxonomy::loop_to_function_item_upgrade_impl(ptr item) {
|
||||
boost::optional<function_item::ptr> fi_;
|
||||
auto loop_ = dcast<loop>(item);
|
||||
if (loop_) {
|
||||
if (loop_->pwf.is_initialized()) {
|
||||
pwf_ = loop_->pwf;
|
||||
if (loop_->fi.is_initialized()) {
|
||||
fi_ = loop_->fi;
|
||||
} else {
|
||||
// piecewise_function is a specialization of function_item - callers don't need to know this detail
|
||||
piecewise_function::spans_t spans;
|
||||
spans.reserve(loop_->children.size());
|
||||
for (auto& edge_ : loop_->children) {
|
||||
@@ -828,9 +829,9 @@ boost::optional<piecewise_function::ptr> ifcopenshell::geometry::taxonomy::loop_
|
||||
};
|
||||
spans.emplace_back(taxonomy::make<taxonomy::functor_item>(l, fn));
|
||||
}
|
||||
pwf_ = make<piecewise_function>(0.0,spans);
|
||||
loop_->pwf = pwf_;
|
||||
fi_ = make<piecewise_function>(0.0,spans);
|
||||
loop_->fi = fi_;
|
||||
}
|
||||
}
|
||||
return pwf_;
|
||||
return fi_;
|
||||
}
|
||||
|
||||
+13
-13
@@ -892,7 +892,7 @@ typedef item const* ptr;
|
||||
DECLARE_PTR(loop)
|
||||
|
||||
boost::optional<bool> external, closed;
|
||||
boost::optional<taxonomy::piecewise_function::ptr> pwf;
|
||||
boost::optional<taxonomy::function_item::ptr> fi;
|
||||
|
||||
bool is_polyhedron() const {
|
||||
for (auto& e : children) {
|
||||
@@ -1374,27 +1374,27 @@ typedef item const* ptr;
|
||||
}
|
||||
};
|
||||
|
||||
boost::optional<piecewise_function::ptr> loop_to_piecewise_function_upgrade_impl(ptr item);
|
||||
boost::optional<function_item::ptr> loop_to_function_item_upgrade_impl(ptr item);
|
||||
template <typename T>
|
||||
class loop_to_piecewise_function_upgrade {
|
||||
class loop_to_function_item_upgrade {
|
||||
private:
|
||||
boost::optional<taxonomy::piecewise_function::ptr> pwf_;
|
||||
boost::optional<taxonomy::function_item::ptr> fi_;
|
||||
|
||||
public:
|
||||
loop_to_piecewise_function_upgrade(taxonomy::ptr item) {
|
||||
if constexpr (std::is_same_v<T, piecewise_function>) {
|
||||
pwf_ = loop_to_piecewise_function_upgrade_impl(item);
|
||||
loop_to_function_item_upgrade(taxonomy::ptr item) {
|
||||
if constexpr (std::is_same_v<T, function_item>) {
|
||||
fi_ = loop_to_function_item_upgrade_impl(item);
|
||||
}
|
||||
}
|
||||
|
||||
operator bool() const {
|
||||
return pwf_.is_initialized();
|
||||
return fi_.is_initialized();
|
||||
}
|
||||
|
||||
operator typename T::ptr() const {
|
||||
if constexpr (std::is_same_v<T, piecewise_function>) {
|
||||
if (pwf_) {
|
||||
return *pwf_;
|
||||
if constexpr (std::is_same_v<T, function_item>) {
|
||||
if (fi_) {
|
||||
return *fi_;
|
||||
}
|
||||
}
|
||||
return nullptr;
|
||||
@@ -1435,7 +1435,7 @@ typedef item const* ptr;
|
||||
}
|
||||
}
|
||||
{
|
||||
loop_to_piecewise_function_upgrade<T> upg(u);
|
||||
loop_to_function_item_upgrade<T> upg(u);
|
||||
if (upg) {
|
||||
return upg;
|
||||
}
|
||||
@@ -1479,7 +1479,7 @@ typedef item const* ptr;
|
||||
}
|
||||
}
|
||||
{
|
||||
loop_to_piecewise_function_upgrade<T> upg(u);
|
||||
loop_to_function_item_upgrade<T> upg(u);
|
||||
if (upg) {
|
||||
return upg;
|
||||
}
|
||||
|
||||
@@ -86,7 +86,7 @@
|
||||
%ignore curve_to_loop_upgrade_impl;
|
||||
%ignore edge_to_loop_upgrade_impl;
|
||||
%ignore curve_to_face_upgrade_impl;
|
||||
%ignore loop_to_piecewise_function_upgrade_impl;
|
||||
%ignore loop_to_function_item_upgrade_impl;
|
||||
|
||||
// settings, can this done more generally?
|
||||
%ignore UseElementNames;
|
||||
|
||||
Reference in New Issue
Block a user