Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deprecated fixes #2312

Open
wants to merge 5 commits into
base: v0.7.0
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 7 additions & 0 deletions src/ifcgeom/IfcGeom.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3459,11 +3459,18 @@ bool IfcGeom::Kernel::triangulate_wire(const std::vector<TopoDS_Wire>& wires, To

if (!tri.IsNull()) {

#if OCC_VERSION_HEX < 0x70600
const Poly_Array1OfTriangle& triangles = tri->Triangles();
for (int i = 1; i <= triangles.Length(); ++i) {
if (face.Orientation() == TopAbs_REVERSED)
triangles(i).Get(n123[2], n123[1], n123[0]);
else triangles(i).Get(n123[0], n123[1], n123[2]);
#else
for (int i = 1; i <= tri->NbTriangles(); ++i) {
if (face.Orientation() == TopAbs_REVERSED)
tri->Triangle(i).Get(n123[2], n123[1], n123[0]);
else tri->Triangle(i).Get(n123[0], n123[1], n123[2]);
#endif

// Create polygons from the mesh vertices
BRepBuilderAPI_MakeWire mp2;
Expand Down
4 changes: 3 additions & 1 deletion src/ifcgeom/IfcTrimmedCurve.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,11 @@
#include <TopExp.hxx>
#include <BRep_Tool.hxx>
#include <ShapeFix_ShapeTolerance.hxx>
#include <BRepAdaptor_CompCurve.hxx>
#include <Standard_Version.hxx>
#if OCC_VERSION_HEX < 0x70600
#include <BRepAdaptor_HCompCurve.hxx>
#endif
#include <BRepAdaptor_CompCurve.hxx>
#include <Approx_Curve3d.hxx>
#include "../ifcgeom/IfcGeom.h"

Expand Down
8 changes: 8 additions & 0 deletions src/ifcgeom/Serialization.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
#include <Geom_BezierCurve.hxx>
#include <Geom_TrimmedCurve.hxx>

#include <Standard_Version.hxx>

#include "IfcGeom.h"

template <typename T, typename U>
Expand Down Expand Up @@ -695,10 +697,16 @@ IfcUtil::IfcBaseClass* IfcGeom::MAKE_TYPE_NAME(tesselate_)(const TopoDS_Shape& s
IfcSchema::IfcCartesianPoint* cpnt = new IfcSchema::IfcCartesianPoint(xyz);
vertices.push_back(cpnt);
}
#if OCC_VERSION_HEX < 0x70600
const Poly_Array1OfTriangle& triangles = tri->Triangles();
for (int i = 1; i <= triangles.Length(); ++i) {
int n1, n2, n3;
triangles(i).Get(n1, n2, n3);
#else
for (int i = 1; i <= tri->NbTriangles(); ++i) {
int n1, n2, n3;
tri->Triangle(i).Get(n1, n2, n3);
#endif
IfcSchema::IfcCartesianPoint::list::ptr points(new IfcSchema::IfcCartesianPoint::list);
points->push(vertices[n1 - 1]);
points->push(vertices[n2 - 1]);
Expand Down
20 changes: 20 additions & 0 deletions src/ifcgeom_schema_agnostic/IfcGeomRepresentation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
#include <TopoDS_Compound.hxx>
#include <BRepGProp.hxx>
#include <GProp_GProps.hxx>
#include <Standard_Version.hxx>

#include "../ifcparse/IfcLogger.h"
#include "../ifcgeom_schema_agnostic/Kernel.h"
Expand Down Expand Up @@ -155,6 +156,7 @@ namespace {
coords.push_back(tri->Node(i).Transformed(loc).XYZ());
}

#if OCC_VERSION_HEX < 0x70600
const Poly_Array1OfTriangle& triangles = tri->Triangles();
for (int i = 1; i <= triangles.Length(); ++i) {
int n1, n2, n3;
Expand All @@ -164,6 +166,16 @@ namespace {
} else {
triangles(i).Get(n1, n2, n3);
}
#else
for (int i = 1; i <= tri->NbTriangles(); ++i) {
int n1, n2, n3;

if (face.Orientation() == TopAbs_REVERSED) {
tri->Triangle(i).Get(n3, n2, n1);
} else {
tri->Triangle(i).Get(n1, n2, n3);
}
#endif

const gp_XYZ& pt1 = coords[n1 - 1];
const gp_XYZ& pt2 = coords[n2 - 1];
Expand Down Expand Up @@ -360,12 +372,20 @@ IfcGeom::Representation::Triangulation::Triangulation(const BRep& shape_model)
}
}

#if OCC_VERSION_HEX < 0x70600
const Poly_Array1OfTriangle& triangles = tri->Triangles();
for (int i = 1; i <= triangles.Length(); ++i) {
int n1, n2, n3;
if (face.Orientation() == TopAbs_REVERSED)
triangles(i).Get(n3, n2, n1);
else triangles(i).Get(n1, n2, n3);
#else
for (int i = 1; i <= tri->NbTriangles(); ++i) {
int n1, n2, n3;
if (face.Orientation() == TopAbs_REVERSED)
tri->Triangle(i).Get(n3, n2, n1);
else tri->Triangle(i).Get(n1, n2, n3);
#endif

/* An alternative would be to calculate normals based
* on the coordinates of the mesh vertices */
Expand Down