diff --git a/TIGLViewer/src/ISession_Text.cpp b/TIGLViewer/src/ISession_Text.cpp index 7ae394ec1..69ee7326d 100644 --- a/TIGLViewer/src/ISession_Text.cpp +++ b/TIGLViewer/src/ISession_Text.cpp @@ -35,6 +35,7 @@ IMPLEMENT_STANDARD_RTTIEXT(ISession_Text,AIS_InteractiveObject) #include #include #include +#include #include #include #include diff --git a/TIGLViewer/src/TIGLAISTriangulation.cpp b/TIGLViewer/src/TIGLAISTriangulation.cpp index c4a656342..252c2e9ab 100755 --- a/TIGLViewer/src/TIGLAISTriangulation.cpp +++ b/TIGLViewer/src/TIGLAISTriangulation.cpp @@ -74,9 +74,8 @@ TIGLAISTriangulation::TIGLAISTriangulation(const Handle(Poly_Triangulation)& Tri maxy = DBL_MIN; maxz = DBL_MIN; - const TColgp_Array1OfPnt& nodes = Triangulation->Nodes(); - for (int i = nodes.Lower(); i <= nodes.Upper(); ++i) { - const gp_Pnt& p = nodes.Value(i); + for (int i = 1; i <= Triangulation->NbNodes(); ++i) { + const gp_Pnt& p = Triangulation->Node(i); minx = min(minx, p.X()); miny = min(miny, p.Y()); minz = min(minz, p.Z()); @@ -108,9 +107,6 @@ void TIGLAISTriangulation::Compute(const Handle(PrsMgr_PresentationManager3d)& a Standard_Real ambient = 1.0; #endif - const TColgp_Array1OfPnt& nodes = myTriangulation->Nodes(); //Nodes - const Poly_Array1OfTriangle& triangles = myTriangulation->Triangles(); //Triangle - Standard_Boolean hasVNormals = myTriangulation->HasNormals(); Standard_Boolean hasVColors = (myFlagColor == 1); @@ -122,25 +118,24 @@ void TIGLAISTriangulation::Compute(const Handle(PrsMgr_PresentationManager3d)& a Standard_False //hasTexels ); - Standard_Integer i; - Standard_Integer j; + gp_Vec3f aNormal; if (hasVNormals) { - const TShort_Array1OfShortReal& normals = myTriangulation->Normals(); if (hasVColors) { const TColStd_Array1OfInteger& colors = myColor->Array1(); - for ( i = nodes.Lower(); i <= nodes.Upper(); i++ ) { - j = (i - nodes.Lower()) * 3; - anArray->AddVertex(nodes(i), AttenuateColor(colors(i), ambient)); - anArray->SetVertexNormal(i, normals(j+1), normals(j+2), normals(j+3)); + for (int i = 1; i <= myTriangulation->NbNodes(); i++ ) { + anArray->AddVertex(myTriangulation->Node(i), AttenuateColor(colors(i), ambient)); + myTriangulation->Normal(i, aNormal); + anArray->SetVertexNormal(i, aNormal.x(), aNormal.y(), aNormal.z()); } } // !hasVColors else { - for ( i = nodes.Lower(); i <= nodes.Upper(); i++ ) { - j = (i - nodes.Lower()) * 3; - anArray->AddVertex(nodes(i)); - anArray->SetVertexNormal(i, normals(j+1), normals(j+2), normals(j+3)); + for (int i = 1; i <= myTriangulation->NbNodes(); i++ ) { + anArray->AddVertex(myTriangulation->Node(i)); + myTriangulation->Normal(i, aNormal); + anArray->SetVertexNormal(i, aNormal.x(), aNormal.y(), aNormal.z()); + } } } @@ -148,21 +143,21 @@ void TIGLAISTriangulation::Compute(const Handle(PrsMgr_PresentationManager3d)& a else { if (hasVColors) { const TColStd_Array1OfInteger& colors = myColor->Array1(); - for ( i = nodes.Lower(); i <= nodes.Upper(); i++ ) { - anArray->AddVertex(nodes(i), AttenuateColor(colors(i), ambient)); + for (int i = 1; i <= myTriangulation->NbNodes(); i++ ) { + anArray->AddVertex(myTriangulation->Node(i), AttenuateColor(colors(i), ambient)); } } // !hasVColors else { - for ( i = nodes.Lower(); i <= nodes.Upper(); i++ ) { - anArray->AddVertex(nodes(i)); + for (int i = 1; i <= myTriangulation->NbNodes(); i++ ) { + anArray->AddVertex(myTriangulation->Node(i)); } } } Standard_Integer indexTriangle[3] = {0,0,0}; - for ( i = triangles.Lower(); i<= triangles.Upper(); i++ ) { - triangles(i).Get(indexTriangle[0], indexTriangle[1], indexTriangle[2]); + for (Standard_Integer i = 1; i<= myTriangulation->NbTriangles(); i++ ) { + myTriangulation->Triangle(i).Get(indexTriangle[0], indexTriangle[1], indexTriangle[2]); anArray->AddEdge(indexTriangle[0]); anArray->AddEdge(indexTriangle[1]); anArray->AddEdge(indexTriangle[2]); @@ -172,18 +167,16 @@ void TIGLAISTriangulation::Compute(const Handle(PrsMgr_PresentationManager3d)& a break; } case 0: { - const TColgp_Array1OfPnt& nodes = myTriangulation->Nodes(); - const Poly_Array1OfTriangle& triangles = myTriangulation->Triangles(); Handle(Graphic3d_AspectLine3d) aspect = myDrawer->WireAspect()->Aspect(); - Handle(Graphic3d_ArrayOfPrimitives) segments = new Graphic3d_ArrayOfSegments(nodes.Length(),triangles.Length()*6); - for (Standard_Integer i = nodes.Lower(); i <= nodes.Upper(); i++ ) { - segments->AddVertex(nodes(i)); + Handle(Graphic3d_ArrayOfPrimitives) segments = new Graphic3d_ArrayOfSegments(myTriangulation->NbNodes(),myTriangulation->NbTriangles()*6); + for (Standard_Integer i = 1; i <= myTriangulation->NbNodes(); i++ ) { + segments->AddVertex(myTriangulation->Node(i)); } Standard_Integer indexTriangle[3] = {0,0,0}; - for (Standard_Integer i = triangles.Lower(); i<= triangles.Upper(); i++ ) { - triangles(i).Get(indexTriangle[0], indexTriangle[1], indexTriangle[2]); + for (Standard_Integer i = 1; i<= myTriangulation->NbTriangles(); i++ ) { + myTriangulation->Triangle(i).Get(indexTriangle[0], indexTriangle[1], indexTriangle[2]); segments->AddEdge(indexTriangle[0]); segments->AddEdge(indexTriangle[1]); segments->AddEdge(indexTriangle[1]); diff --git a/TIGLViewer/src/TIGLQAspectWindow.cpp b/TIGLViewer/src/TIGLQAspectWindow.cpp index 7aa52910a..510125a92 100644 --- a/TIGLViewer/src/TIGLQAspectWindow.cpp +++ b/TIGLViewer/src/TIGLQAspectWindow.cpp @@ -103,7 +103,11 @@ void TIGLQAspectWindow::Unmap() const // function : DoResize // purpose : // ======================================================================= +#if OCC_VERSION_HEX >= 0x070600 +Aspect_TypeOfResize TIGLQAspectWindow::DoResize() +#else Aspect_TypeOfResize TIGLQAspectWindow::DoResize() const +#endif { int aMask = 0; Aspect_TypeOfResize aMode = Aspect_TOR_UNKNOWN; diff --git a/TIGLViewer/src/TIGLQAspectWindow.h b/TIGLViewer/src/TIGLQAspectWindow.h index 864ee1987..4472ccac3 100644 --- a/TIGLViewer/src/TIGLQAspectWindow.h +++ b/TIGLViewer/src/TIGLQAspectWindow.h @@ -73,7 +73,11 @@ class TIGLQAspectWindow : public Aspect_Window Aspect_Drawable NativeParentHandle() const override; //! Applies the resizing to the window +#if OCC_VERSION_HEX >= 0x070600 + Aspect_TypeOfResize DoResize() override; +#else Aspect_TypeOfResize DoResize() const override; +#endif //! Returns True if the window is opened //! and False if the window is closed. diff --git a/TIGLViewer/src/TIGLViewerDocument.cpp b/TIGLViewer/src/TIGLViewerDocument.cpp index 96724bcd7..0db93ea7b 100644 --- a/TIGLViewer/src/TIGLViewerDocument.cpp +++ b/TIGLViewer/src/TIGLViewerDocument.cpp @@ -2734,16 +2734,14 @@ void TIGLViewerDocument::createShapeTriangulation(const TopoDS_Shape& shape, Top } gp_Trsf nodeTransformation = location; - const TColgp_Array1OfPnt& nodes = triangulation->Nodes(); int index1, index2, index3; - const Poly_Array1OfTriangle& triangles = triangulation->Triangles(); - for (int j = triangles.Lower(); j <= triangles.Upper(); j++) { - const Poly_Triangle& triangle = triangles(j); + for (int j = 1; j <= triangulation->NbTriangles(); j++) { + const Poly_Triangle& triangle = triangulation->Triangle(j); triangle.Get(index1, index2, index3); - gp_Pnt point1 = nodes(index1).Transformed(nodeTransformation); - gp_Pnt point2 = nodes(index2).Transformed(nodeTransformation); - gp_Pnt point3 = nodes(index3).Transformed(nodeTransformation); + gp_Pnt point1 = triangulation->Node(index1).Transformed(nodeTransformation); + gp_Pnt point2 = triangulation->Node(index2).Transformed(nodeTransformation); + gp_Pnt point3 = triangulation->Node(index3).Transformed(nodeTransformation); BRepBuilderAPI_MakeEdge edge1(point1, point2); BRepBuilderAPI_MakeEdge edge2(point2, point3); diff --git a/cmake/UseOpenCASCADE.cmake b/cmake/UseOpenCASCADE.cmake index 965ef3022..005eaaeef 100644 --- a/cmake/UseOpenCASCADE.cmake +++ b/cmake/UseOpenCASCADE.cmake @@ -48,7 +48,7 @@ if(OCE_FOUND) option(OCE_STATIC_LIBS "Should be checked, if static OCE libs are linked" OFF) else(OCE_FOUND) message("OCE not found! Searching for OpenCASCADE.") - find_package(OpenCASCADE 7.4.0 CONFIG REQUIRED) + find_package(OpenCASCADE CONFIG REQUIRED) option(OpenCASCADE_STATIC_LIBS "Should be checked, if static OpenCASCADE libs are linked" OFF) message(STATUS "Found opencascade " ${OpenCASCADE_VERSION}) diff --git a/src/boolean_operations/GEOMAlgo_Splitter.cxx b/src/boolean_operations/GEOMAlgo_Splitter.cxx index ab5db37c2..d49dbd068 100644 --- a/src/boolean_operations/GEOMAlgo_Splitter.cxx +++ b/src/boolean_operations/GEOMAlgo_Splitter.cxx @@ -212,7 +212,11 @@ void GEOMAlgo_Splitter::BuildResult(const TopAbs_ShapeEnum theType) //function : PostTreat //purpose : //======================================================================= +#if OCC_VERSION_HEX >= VERSION_HEX_CODE(7,6,0) +void GEOMAlgo_Splitter::PostTreat(const Message_ProgressRange& p) +#else void GEOMAlgo_Splitter::PostTreat() +#endif { if (myLimit!=TopAbs_SHAPE) { Standard_Integer i, aNbS; @@ -340,7 +344,11 @@ void GEOMAlgo_Splitter::PostTreat() myShape=aLS.First(); } // +#if OCC_VERSION_HEX >= VERSION_HEX_CODE(7,6,0) + BOPAlgo_Builder::PostTreat(p); +#else BOPAlgo_Builder::PostTreat(); +#endif } //======================================================================= //function : TreatCompound diff --git a/src/boolean_operations/GEOMAlgo_Splitter.hxx b/src/boolean_operations/GEOMAlgo_Splitter.hxx index 643ec3085..eea890402 100644 --- a/src/boolean_operations/GEOMAlgo_Splitter.hxx +++ b/src/boolean_operations/GEOMAlgo_Splitter.hxx @@ -99,7 +99,11 @@ public: void BuildResult(const TopAbs_ShapeEnum theType) override; TIGL_EXPORT +#if OCC_VERSION_HEX >= VERSION_HEX_CODE(7,6,0) + void PostTreat(const Message_ProgressRange&) override; +#else void PostTreat() override; +#endif protected: #if OCC_VERSION_HEX >= VERSION_HEX_CODE(7,3,0) diff --git a/src/common/tiglcommonfunctions.cpp b/src/common/tiglcommonfunctions.cpp index 0bc1aea96..fb0827b3c 100644 --- a/src/common/tiglcommonfunctions.cpp +++ b/src/common/tiglcommonfunctions.cpp @@ -43,6 +43,8 @@ #include "CTiglProjectPointOnCurveAtAngle.h" #include "CTiglBSplineAlgorithms.h" +#include "Standard_Version.hxx" + #include "Geom_Curve.hxx" #include "Geom_Surface.hxx" #include "GeomAdaptor_Curve.hxx" @@ -77,7 +79,6 @@ #include "BRepExtrema_DistShapeShape.hxx" #include -#include #include #include #include @@ -1101,8 +1102,8 @@ TopoDS_Face BuildRuledFace(const TopoDS_Wire& wire1, const TopoDS_Wire& wire2) // Wrap the adaptor in a class which manages curve access via handle (HCurve). According to doxygen // this is required by the algorithms - Handle(Adaptor3d_HCurve) curve1 = new BRepAdaptor_HCompCurve(compCurve1); - Handle(Adaptor3d_HCurve) curve2 = new BRepAdaptor_HCompCurve(compCurve2); + const Handle(Adaptor3d_Curve) curve1 = new BRepAdaptor_CompCurve(compCurve1); + const Handle(Adaptor3d_Curve) curve2 = new BRepAdaptor_CompCurve(compCurve2); // We have to generate an approximated curve now from the wire using the adaptor // NOTE: last parameter value unknown diff --git a/src/control_devices/CControlSurfaceBorderBuilder.cpp b/src/control_devices/CControlSurfaceBorderBuilder.cpp index 336a41801..feb576976 100644 --- a/src/control_devices/CControlSurfaceBorderBuilder.cpp +++ b/src/control_devices/CControlSurfaceBorderBuilder.cpp @@ -25,6 +25,7 @@ #include #include #include +#include #include #include #include diff --git a/src/geometry/CTiglTriangularizer.cpp b/src/geometry/CTiglTriangularizer.cpp index ce0317e1e..be8064f8c 100644 --- a/src/geometry/CTiglTriangularizer.cpp +++ b/src/geometry/CTiglTriangularizer.cpp @@ -294,13 +294,11 @@ int CTiglTriangularizer::triangularizeFace(const TopoDS_Face & face, unsigned lo BRepGProp_Face prop(face); - const TColgp_Array1OfPnt2d& uvnodes = triangulation->UVNodes(); // get (face-local) list of nodes - ilower = uvnodes.Lower(); - - iBufferSize = uvnodes.Upper()-uvnodes.Lower()+1; + ilower = 1; + iBufferSize = triangulation->NbNodes(); indexBuffer.reserve(iBufferSize); - for (int inode = uvnodes.Lower(); inode <= uvnodes.Upper(); ++inode) { - const gp_Pnt2d& uv_pnt = uvnodes(inode); + for (int inode = 1; inode <= triangulation->NbNodes(); ++inode) { + const gp_Pnt2d& uv_pnt = triangulation->UVNode(inode); gp_Pnt p; gp_Vec n; prop.Normal(uv_pnt.X(),uv_pnt.Y(),p,n); if (n.SquareMagnitude() > 0.) { @@ -315,23 +313,20 @@ int CTiglTriangularizer::triangularizeFace(const TopoDS_Face & face, unsigned lo else { // we cannot compute normals - const TColgp_Array1OfPnt& nodes = triangulation->Nodes(); // get (face-local) list of nodes - ilower = nodes.Lower(); - - iBufferSize = nodes.Upper()-nodes.Lower()+1; + ilower = 1; + iBufferSize = triangulation->NbNodes(); indexBuffer.reserve(iBufferSize); - for (int inode = nodes.Lower(); inode <= nodes.Upper(); inode++) { - const gp_Pnt& p = nodes(inode).Transformed(nodeTransformation); + for (int inode = 1; inode <= triangulation->NbNodes(); inode++) { + const gp_Pnt& p = triangulation->Node(inode).Transformed(nodeTransformation); indexBuffer.push_back(polys.currentObject().addPointNormal(p.XYZ(), CTiglPoint(1,0,0))); } } - const Poly_Array1OfTriangle& triangles = triangulation->Triangles(); iPolyLower = ULONG_MAX; iPolyUpper = 0; - // iterate over triangles in the array - for (int j = triangles.Lower(); j <= triangles.Upper(); j++) { - const Poly_Triangle& triangle = triangles(j); + // iterate over triangles in the array + for (int j = 1; j <= triangulation->NbTriangles(); j++) { + const Poly_Triangle& triangle = triangulation->Triangle(j); int occindex1, occindex2, occindex3; triangle.Get(occindex1, occindex2, occindex3); // get indices into index1..3 unsigned long index1, index2, index3; diff --git a/src/wing/CCPACSWingSegment.cpp b/src/wing/CCPACSWingSegment.cpp index 20737cba2..e7e03f735 100644 --- a/src/wing/CCPACSWingSegment.cpp +++ b/src/wing/CCPACSWingSegment.cpp @@ -94,7 +94,6 @@ #include "Geom_BSplineCurve.hxx" #include "GeomAPI_PointsToBSpline.hxx" -#include "GeomAdaptor_HCurve.hxx" #include "GeomFill.hxx" #include "GeomFill_SimpleBound.hxx" #include "GeomFill_BSplineCurves.hxx" @@ -105,7 +104,6 @@ #include "BRepExtrema_DistShapeShape.hxx" #include "BRepIntCurveSurface_Inter.hxx" #include "GCPnts_AbscissaPoint.hxx" -#include "BRepAdaptor_CompCurve.hxx" #include "BRepTools.hxx" #include #include diff --git a/tests/unittests/tiglShapeCache.cpp b/tests/unittests/tiglShapeCache.cpp index 6f6c7f9d8..0fa18a87c 100644 --- a/tests/unittests/tiglShapeCache.cpp +++ b/tests/unittests/tiglShapeCache.cpp @@ -94,9 +94,10 @@ TEST(ShapeCache, Get) TopoDS_Shape shape1(wireBuilder.Wire()), shape2(wireBuilder.Wire()), shape3(wireBuilder.Wire()); gp_Trsf trafo1, trafo2, trafo3; - trafo1.SetScaleFactor(1.0); - trafo2.SetScaleFactor(2.0); - trafo3.SetScaleFactor(3.0); + trafo1.SetTranslation(gp_Vec(1., 0., 0.)); + trafo2.SetTranslation(gp_Vec(0., 1., 0.)); + trafo3.SetTranslation(gp_Vec(0., 0., 1.)); + shape1.Move(trafo1); shape2.Move(trafo2); shape3.Move(trafo3);