mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-11 06:18:09 +00:00
Use opencascade::handle for compatibility with earlier versions
This commit is contained in:
@@ -109,7 +109,7 @@ void ifcopenshell::geometry::OpenCascadeShape::Triangulate(ifcopenshell::geometr
|
|||||||
std::vector<std::tuple<int, int, int>> triangle_indices;
|
std::vector<std::tuple<int, int, int>> triangle_indices;
|
||||||
|
|
||||||
TopLoc_Location loc;
|
TopLoc_Location loc;
|
||||||
occ::handle<Poly_Triangulation> tri = BRep_Tool::Triangulation(face, loc);
|
opencascade::handle<Poly_Triangulation> tri = BRep_Tool::Triangulation(face, loc);
|
||||||
|
|
||||||
if (tri.IsNull()) {
|
if (tri.IsNull()) {
|
||||||
Logger::Root().Message(Logger::LOG_ERROR, "GEO", 184, "Triangulation missing for face");
|
Logger::Root().Message(Logger::LOG_ERROR, "GEO", 184, "Triangulation missing for face");
|
||||||
@@ -145,7 +145,7 @@ void ifcopenshell::geometry::OpenCascadeShape::Triangulate(ifcopenshell::geometr
|
|||||||
normal = normal_direction;
|
normal = normal_direction;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
occ::handle<Geom_Surface> surf = BRep_Tool::Surface(face);
|
opencascade::handle<Geom_Surface> surf = BRep_Tool::Surface(face);
|
||||||
// Special case the normal at the poles of a spherical surface
|
// Special case the normal at the poles of a spherical surface
|
||||||
if (surf->DynamicType() == STANDARD_TYPE(Geom_SphericalSurface)) {
|
if (surf->DynamicType() == STANDARD_TYPE(Geom_SphericalSurface)) {
|
||||||
if (fabs(fabs(uv.Y()) - M_PI / 2.) < 1.e-9) {
|
if (fabs(fabs(uv.Y()) - M_PI / 2.) < 1.e-9) {
|
||||||
|
|||||||
@@ -167,12 +167,12 @@ namespace {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool IfcGeom::util::apply_folded_layerset(const ConversionResults& items, const std::vector< std::vector<occ::handle<Geom_Surface>>>& surfaces, const std::vector<ifcopenshell::geometry::taxonomy::style::ptr>& styles, ConversionResults& result, double tol) {
|
bool IfcGeom::util::apply_folded_layerset(const ConversionResults& items, const std::vector< std::vector<opencascade::handle<Geom_Surface>>>& surfaces, const std::vector<ifcopenshell::geometry::taxonomy::style::ptr>& styles, ConversionResults& result, double tol) {
|
||||||
Bnd_Box bb;
|
Bnd_Box bb;
|
||||||
TopoDS_Shape input;
|
TopoDS_Shape input;
|
||||||
flatten_shape_list(items, input, false, false, tol);
|
flatten_shape_list(items, input, false, false, tol);
|
||||||
|
|
||||||
typedef std::vector< std::vector<occ::handle<Geom_Surface>> > folded_surfaces_t;
|
typedef std::vector< std::vector<opencascade::handle<Geom_Surface>> > folded_surfaces_t;
|
||||||
typedef std::vector< std::pair< TopoDS_Face, std::pair<gp_Pnt, gp_Pnt> > > faces_with_mass_t;
|
typedef std::vector< std::pair< TopoDS_Face, std::pair<gp_Pnt, gp_Pnt> > > faces_with_mass_t;
|
||||||
|
|
||||||
NCollection_List<TopoDS_Shape> shells;
|
NCollection_List<TopoDS_Shape> shells;
|
||||||
@@ -181,7 +181,7 @@ bool IfcGeom::util::apply_folded_layerset(const ConversionResults& items, const
|
|||||||
if (it->empty()) {
|
if (it->empty()) {
|
||||||
continue;
|
continue;
|
||||||
} else if (it->size() == 1) {
|
} else if (it->size() == 1) {
|
||||||
const occ::handle<Geom_Surface>& surface = (*it)[0];
|
const opencascade::handle<Geom_Surface>& surface = (*it)[0];
|
||||||
double u1, v1, u2, v2;
|
double u1, v1, u2, v2;
|
||||||
if (!project(surface, input, u1, v1, u2, v2)) {
|
if (!project(surface, input, u1, v1, u2, v2)) {
|
||||||
continue;
|
continue;
|
||||||
@@ -190,7 +190,7 @@ bool IfcGeom::util::apply_folded_layerset(const ConversionResults& items, const
|
|||||||
} else {
|
} else {
|
||||||
faces_with_mass_t solids;
|
faces_with_mass_t solids;
|
||||||
for (folded_surfaces_t::value_type::const_iterator jt = it->begin(); jt != it->end(); ++jt) {
|
for (folded_surfaces_t::value_type::const_iterator jt = it->begin(); jt != it->end(); ++jt) {
|
||||||
const occ::handle<Geom_Surface>& surface = *jt;
|
const opencascade::handle<Geom_Surface>& surface = *jt;
|
||||||
double u1, v1, u2, v2;
|
double u1, v1, u2, v2;
|
||||||
if (!project(surface, input, u1, v1, u2, v2)) {
|
if (!project(surface, input, u1, v1, u2, v2)) {
|
||||||
continue;
|
continue;
|
||||||
@@ -284,7 +284,7 @@ bool IfcGeom::util::apply_folded_layerset(const ConversionResults& items, const
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool IfcGeom::util::apply_layerset(const ConversionResults& items, const std::vector<occ::handle<Geom_Surface>>& surfaces, const std::vector<ifcopenshell::geometry::taxonomy::style::ptr>& styles, ConversionResults& result, double tol) {
|
bool IfcGeom::util::apply_layerset(const ConversionResults& items, const std::vector<opencascade::handle<Geom_Surface>>& surfaces, const std::vector<ifcopenshell::geometry::taxonomy::style::ptr>& styles, ConversionResults& result, double tol) {
|
||||||
if (surfaces.size() < 3) {
|
if (surfaces.size() < 3) {
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
@@ -373,7 +373,7 @@ bool IfcGeom::util::apply_layerset(const ConversionResults& items, const std::ve
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool IfcGeom::util::split_solid_by_surface(const TopoDS_Shape& input, const occ::handle<Geom_Surface>& surface, TopoDS_Shape& front, TopoDS_Shape& back, double tol) {
|
bool IfcGeom::util::split_solid_by_surface(const TopoDS_Shape& input, const opencascade::handle<Geom_Surface>& surface, TopoDS_Shape& front, TopoDS_Shape& back, double tol) {
|
||||||
// Use an unbounded surface, that isolate part of the input shape,
|
// Use an unbounded surface, that isolate part of the input shape,
|
||||||
// to split this shape into two parts. Make sure that the addition
|
// to split this shape into two parts. Make sure that the addition
|
||||||
// of the two result volumes matches that of the input.
|
// of the two result volumes matches that of the input.
|
||||||
|
|||||||
@@ -11,11 +11,11 @@
|
|||||||
|
|
||||||
namespace IfcGeom {
|
namespace IfcGeom {
|
||||||
namespace util {
|
namespace util {
|
||||||
bool apply_layerset(const ConversionResults&, const std::vector<occ::handle<Geom_Surface>>&, const std::vector<ifcopenshell::geometry::taxonomy::style::ptr>&, ConversionResults&, double tol);
|
bool apply_layerset(const ConversionResults&, const std::vector<opencascade::handle<Geom_Surface>>&, const std::vector<ifcopenshell::geometry::taxonomy::style::ptr>&, ConversionResults&, double tol);
|
||||||
|
|
||||||
bool apply_folded_layerset(const ConversionResults&, const std::vector<std::vector<occ::handle<Geom_Surface>>>&, const std::vector<ifcopenshell::geometry::taxonomy::style::ptr>&, ConversionResults&, double tol);
|
bool apply_folded_layerset(const ConversionResults&, const std::vector<std::vector<opencascade::handle<Geom_Surface>>>&, const std::vector<ifcopenshell::geometry::taxonomy::style::ptr>&, ConversionResults&, double tol);
|
||||||
|
|
||||||
bool split_solid_by_surface(const TopoDS_Shape&, const occ::handle<Geom_Surface>&, TopoDS_Shape&, TopoDS_Shape&, double tol);
|
bool split_solid_by_surface(const TopoDS_Shape&, const opencascade::handle<Geom_Surface>&, TopoDS_Shape&, TopoDS_Shape&, double tol);
|
||||||
|
|
||||||
bool split_solid_by_shell(const TopoDS_Shape&, const TopoDS_Shape& s, TopoDS_Shape&, TopoDS_Shape&, double tol);
|
bool split_solid_by_shell(const TopoDS_Shape&, const TopoDS_Shape& s, TopoDS_Shape&, TopoDS_Shape&, double tol);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -117,7 +117,7 @@ bool IfcGeom::util::is_single_linear_edge(const TopoDS_Wire & wire) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
double u, v;
|
double u, v;
|
||||||
occ::handle<Geom_Curve> crv = BRep_Tool::Curve(e, u, v);
|
opencascade::handle<Geom_Curve> crv = BRep_Tool::Curve(e, u, v);
|
||||||
return crv->DynamicType() == STANDARD_TYPE(Geom_Line);
|
return crv->DynamicType() == STANDARD_TYPE(Geom_Line);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -132,7 +132,7 @@ bool IfcGeom::util::is_single_circular_edge(const TopoDS_Wire & wire) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
double u, v;
|
double u, v;
|
||||||
occ::handle<Geom_Curve> crv = BRep_Tool::Curve(e, u, v);
|
opencascade::handle<Geom_Curve> crv = BRep_Tool::Curve(e, u, v);
|
||||||
return crv->DynamicType() == STANDARD_TYPE(Geom_Circle);
|
return crv->DynamicType() == STANDARD_TYPE(Geom_Circle);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -140,7 +140,7 @@ void IfcGeom::util::process_sweep_as_extrusion(const TopoDS_Wire & wire, const T
|
|||||||
TopExp_Explorer exp(wire, TopAbs_EDGE);
|
TopExp_Explorer exp(wire, TopAbs_EDGE);
|
||||||
TopoDS_Edge e = TopoDS::Edge(exp.Current());
|
TopoDS_Edge e = TopoDS::Edge(exp.Current());
|
||||||
double u, v;
|
double u, v;
|
||||||
occ::handle<Geom_Curve> crv = BRep_Tool::Curve(e, u, v);
|
opencascade::handle<Geom_Curve> crv = BRep_Tool::Curve(e, u, v);
|
||||||
const auto& dir = Handle(Geom_Line)::DownCast(crv)->Position().Direction();
|
const auto& dir = Handle(Geom_Line)::DownCast(crv)->Position().Direction();
|
||||||
// OCCT line is normalized so diff in parametric coords equals length
|
// OCCT line is normalized so diff in parametric coords equals length
|
||||||
const double depth = std::abs(u - v);
|
const double depth = std::abs(u - v);
|
||||||
@@ -153,7 +153,7 @@ void IfcGeom::util::process_sweep_as_revolution(const TopoDS_Wire & wire, const
|
|||||||
TopExp_Explorer exp(wire, TopAbs_EDGE);
|
TopExp_Explorer exp(wire, TopAbs_EDGE);
|
||||||
TopoDS_Edge e = TopoDS::Edge(exp.Current());
|
TopoDS_Edge e = TopoDS::Edge(exp.Current());
|
||||||
double u, v;
|
double u, v;
|
||||||
occ::handle<Geom_Curve> crv = BRep_Tool::Curve(e, u, v);
|
opencascade::handle<Geom_Curve> crv = BRep_Tool::Curve(e, u, v);
|
||||||
auto circ = Handle(Geom_Circle)::DownCast(crv);
|
auto circ = Handle(Geom_Circle)::DownCast(crv);
|
||||||
// @todo we could be extruding the wire only when we know this is an intermediate edge.
|
// @todo we could be extruding the wire only when we know this is an intermediate edge.
|
||||||
const double depth = std::abs(u - v);
|
const double depth = std::abs(u - v);
|
||||||
@@ -269,7 +269,7 @@ void IfcGeom::util::segment_adjacent_non_linear(const TopoDS_Wire & wire, std::v
|
|||||||
|
|
||||||
for (int i = 0; i < (int)sorted_edges.size() - 1; ++i) {
|
for (int i = 0; i < (int)sorted_edges.size() - 1; ++i) {
|
||||||
const auto& e = sorted_edges[i];
|
const auto& e = sorted_edges[i];
|
||||||
occ::handle<Geom_Curve> crv = BRep_Tool::Curve(e, u, v);
|
opencascade::handle<Geom_Curve> crv = BRep_Tool::Curve(e, u, v);
|
||||||
const bool is_linear = crv->DynamicType() == STANDARD_TYPE(Geom_Line);
|
const bool is_linear = crv->DynamicType() == STANDARD_TYPE(Geom_Line);
|
||||||
|
|
||||||
const auto& f = sorted_edges[i + 1];
|
const auto& f = sorted_edges[i + 1];
|
||||||
|
|||||||
Reference in New Issue
Block a user