Adapt OCE 3D plugin to OpenCascade 7.6.0

In line with
https://dev.opencascade.org/doc/overview/html/occt__upgrade.html#upgrade_occt760_poly
the Poly_Triangulation does not provide direct access to the internal
arrays anymore - use the accessor functions instead.
This commit is contained in:
Christoph Moench-Tegeder 2021-11-16 18:08:17 +01:00 committed by Mark Roszko
parent 1d2fd6d271
commit 12152d4331
1 changed files with 12 additions and 0 deletions

View File

@ -80,6 +80,8 @@
#include <TDF_Tool.hxx> #include <TDF_Tool.hxx>
#include <TDataStd_Name.hxx> #include <TDataStd_Name.hxx>
#include <Standard_Version.hxx>
#include "plugins/3dapi/ifsg_all.h" #include "plugins/3dapi/ifsg_all.h"
@ -1116,8 +1118,10 @@ bool processFace( const TopoDS_Face& face, DATA& data, SGNODE* parent,
else else
S3D::AddSGNodeRef( vshape.GetRawPtr(), ocolor ); S3D::AddSGNodeRef( vshape.GetRawPtr(), ocolor );
#if OCC_VERSION_HEX < 0x070600
const TColgp_Array1OfPnt& arrPolyNodes = triangulation->Nodes(); const TColgp_Array1OfPnt& arrPolyNodes = triangulation->Nodes();
const Poly_Array1OfTriangle& arrTriangles = triangulation->Triangles(); const Poly_Array1OfTriangle& arrTriangles = triangulation->Triangles();
#endif
std::vector< SGPOINT > vertices; std::vector< SGPOINT > vertices;
std::vector< int > indices; std::vector< int > indices;
@ -1126,14 +1130,22 @@ bool processFace( const TopoDS_Face& face, DATA& data, SGNODE* parent,
for( int i = 1; i <= triangulation->NbNodes(); i++ ) for( int i = 1; i <= triangulation->NbNodes(); i++ )
{ {
#if OCC_VERSION_HEX < 0x070600
gp_XYZ v( arrPolyNodes(i).Coord() ); gp_XYZ v( arrPolyNodes(i).Coord() );
#else
gp_XYZ v( triangulation->Node(i).Coord() );
#endif
vertices.emplace_back( v.X(), v.Y(), v.Z() ); vertices.emplace_back( v.X(), v.Y(), v.Z() );
} }
for( int i = 1; i <= triangulation->NbTriangles(); i++ ) for( int i = 1; i <= triangulation->NbTriangles(); i++ )
{ {
int a, b, c; int a, b, c;
#if OCC_VERSION_HEX < 0x070600
arrTriangles( i ).Get( a, b, c ); arrTriangles( i ).Get( a, b, c );
#else
triangulation->Triangle(i).Get(a, b, c);
#endif
a--; a--;
if( reverse ) if( reverse )