From 3b02241a66e6be241eebbe70df42349293c5f4ab Mon Sep 17 00:00:00 2001 From: jfa Date: Mon, 20 Feb 2023 17:21:19 +0000 Subject: [PATCH] Porting Salome to OCCT 7.7.0 --- src/GeomAPI/GeomAPI_Face.cpp | 14 +++++++++++++- src/GeomAlgoAPI/GeomAlgoAPI_ShapeTools.cpp | 10 ++++++++++ src/GeomAlgoImpl/GEOMAlgo_Splitter.cxx | 8 ++++++++ src/GeomAlgoImpl/GEOMAlgo_Splitter.hxx | 6 ++++++ src/ModuleBase/ModuleBase_Tools.cpp | 10 ++++++++++ src/PartSet/PartSet_FieldStepPrs.cpp | 14 ++++++-------- src/PartSet/PartSet_Module.cpp | 6 ++++++ src/PartSet/PartSet_Tools.cpp | 5 ++--- 8 files changed, 61 insertions(+), 12 deletions(-) diff --git a/src/GeomAPI/GeomAPI_Face.cpp b/src/GeomAPI/GeomAPI_Face.cpp index 21d99ecc1..1ba00d29b 100644 --- a/src/GeomAPI/GeomAPI_Face.cpp +++ b/src/GeomAPI/GeomAPI_Face.cpp @@ -28,6 +28,8 @@ #include "GeomAPI_Cone.h" #include "GeomAPI_Torus.h" +#include + #include #include #include @@ -47,7 +49,6 @@ #include #include #include -#include #include #include #include @@ -56,6 +57,12 @@ #include #include +#if OCC_VERSION_LARGE < 0x07070000 +#include +#else +#include +#endif + #include #include #include @@ -156,8 +163,13 @@ bool GeomAPI_Face::isSameGeometry(const std::shared_ptr theShape) if (anOwnSurf->IsKind(STANDARD_TYPE(Geom_ElementarySurface)) && anOtherSurf->IsKind(STANDARD_TYPE(Geom_ElementarySurface))) { +#if OCC_VERSION_LARGE < 0x07070000 Handle(GeomAdaptor_HSurface) aGA1 = new GeomAdaptor_HSurface(anOwnSurf); Handle(GeomAdaptor_HSurface) aGA2 = new GeomAdaptor_HSurface(anOtherSurf); +#else + Handle(GeomAdaptor_Surface) aGA1 = new GeomAdaptor_Surface(anOwnSurf); + Handle(GeomAdaptor_Surface) aGA2 = new GeomAdaptor_Surface(anOtherSurf); +#endif Handle(BRepTopAdaptor_TopolTool) aTT1 = new BRepTopAdaptor_TopolTool(); Handle(BRepTopAdaptor_TopolTool) aTT2 = new BRepTopAdaptor_TopolTool(); diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_ShapeTools.cpp b/src/GeomAlgoAPI/GeomAlgoAPI_ShapeTools.cpp index d6baade6e..d4996e38b 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_ShapeTools.cpp +++ b/src/GeomAlgoAPI/GeomAlgoAPI_ShapeTools.cpp @@ -21,6 +21,8 @@ #include "GeomAlgoAPI_SketchBuilder.h" +#include + #include #include #include @@ -67,7 +69,11 @@ #include #include +#if OCC_VERSION_LARGE < 0x07070000 #include +#else +#include +#endif #include #include @@ -1303,7 +1309,11 @@ std::shared_ptr GeomAlgoAPI_ShapeTools::wireToEdge( static const int THE_MAX_INTERVALS = 32; double aFirst, aLast; Handle(Geom_Curve) aCurve = BRep_Tool::Curve(aNewEdge, aFirst, aLast); +#if OCC_VERSION_LARGE < 0x07070000 Handle(GeomAdaptor_HCurve) aHCurve = new GeomAdaptor_HCurve(aCurve); +#else + Handle(GeomAdaptor_Curve) aHCurve = new GeomAdaptor_Curve(aCurve); +#endif Approx_CurvilinearParameter anApprox(aHCurve, Precision::Confusion(), aCurve->Continuity(), THE_MAX_DEGREE, THE_MAX_INTERVALS); if (anApprox.HasResult()) { diff --git a/src/GeomAlgoImpl/GEOMAlgo_Splitter.cxx b/src/GeomAlgoImpl/GEOMAlgo_Splitter.cxx index a666a3768..e7b8adb38 100644 --- a/src/GeomAlgoImpl/GEOMAlgo_Splitter.cxx +++ b/src/GeomAlgoImpl/GEOMAlgo_Splitter.cxx @@ -166,7 +166,11 @@ void GEOMAlgo_Splitter::BuildResult(const TopAbs_ShapeEnum theType) //function : PostTreat //purpose : //======================================================================= +#if OCC_VERSION_LARGE < 0x07070000 void GEOMAlgo_Splitter::PostTreat() +#else +void GEOMAlgo_Splitter::PostTreat(const Message_ProgressRange& theRange) +#endif { if (myLimit!=TopAbs_SHAPE) { Standard_Integer i, aNbS; @@ -268,7 +272,11 @@ void GEOMAlgo_Splitter::PostTreat() myShape=aLS.First(); } // +#if OCC_VERSION_LARGE < 0x07070000 BOPAlgo_Builder::PostTreat(); +#else + BOPAlgo_Builder::PostTreat(theRange); +#endif } //======================================================================= //function : TreatCompound diff --git a/src/GeomAlgoImpl/GEOMAlgo_Splitter.hxx b/src/GeomAlgoImpl/GEOMAlgo_Splitter.hxx index 6b9b396e4..7237d65f6 100644 --- a/src/GeomAlgoImpl/GEOMAlgo_Splitter.hxx +++ b/src/GeomAlgoImpl/GEOMAlgo_Splitter.hxx @@ -35,6 +35,8 @@ #include +#include + //======================================================================= //class : GEOMAlgo_Splitter //purpose : @@ -86,7 +88,11 @@ GEOMALGOIMPL_EXPORT virtual void BuildResult(const TopAbs_ShapeEnum theType); /// Post processing of the calculation +#if OCC_VERSION_LARGE < 0x07070000 GEOMALGOIMPL_EXPORT virtual void PostTreat(); +#else + GEOMALGOIMPL_EXPORT virtual void PostTreat(const Message_ProgressRange& theRange); +#endif protected: /// List of tools diff --git a/src/ModuleBase/ModuleBase_Tools.cpp b/src/ModuleBase/ModuleBase_Tools.cpp index 60c1bb579..5ac621e1b 100644 --- a/src/ModuleBase/ModuleBase_Tools.cpp +++ b/src/ModuleBase/ModuleBase_Tools.cpp @@ -56,6 +56,8 @@ #include #include +#include + #ifdef HAVE_SALOME #include #include @@ -1235,11 +1237,19 @@ void setPointBallHighlighting(AIS_InteractiveObject* theAIS) anAspect = aPntAspect->Aspect(); anAspect->SetType(Aspect_TOM_BALL); } else { +#if OCC_VERSION_LARGE < 0x07070000 if(aPixMap->Format() == Image_PixMap::ImgGray) { aPixMap->SetFormat (Image_PixMap::ImgAlpha); } else if(aPixMap->Format() == Image_PixMap::ImgGrayF) { aPixMap->SetFormat (Image_PixMap::ImgAlphaF); } +#else + if(aPixMap->Format() == Image_Format_Gray) { + aPixMap->SetFormat (Image_Format_Alpha); + } else if(aPixMap->Format() == Image_Format_GrayF) { + aPixMap->SetFormat (Image_Format_AlphaF); + } +#endif anAspect = new Graphic3d_AspectMarker3d(aPixMap); aPntAspect->SetAspect(anAspect); } diff --git a/src/PartSet/PartSet_FieldStepPrs.cpp b/src/PartSet/PartSet_FieldStepPrs.cpp index a73f47798..b435b1f87 100644 --- a/src/PartSet/PartSet_FieldStepPrs.cpp +++ b/src/PartSet/PartSet_FieldStepPrs.cpp @@ -38,7 +38,7 @@ #include #include #include - +#include IMPLEMENT_STANDARD_RTTIEXT(PartSet_FieldStepPrs, ViewerData_AISShape); @@ -318,14 +318,12 @@ bool PartSet_FieldStepPrs::computeMassCenter(const TopoDS_Shape& theShape, gp_Pn if (!triangulation.IsNull() && triangulation->HasUVNodes()) { gp_XY C(0, 0); double A = 0; - const TColgp_Array1OfPnt2d& uvArray = triangulation->UVNodes(); - const Poly_Array1OfTriangle& trias = triangulation->Triangles(); int n1, n2, n3; - for (int iT = trias.Lower(); iT <= trias.Upper(); ++iT) { - trias(iT).Get(n1, n2, n3); - const gp_Pnt2d& uv1 = uvArray(n1); - const gp_Pnt2d& uv2 = uvArray(n2); - const gp_Pnt2d& uv3 = uvArray(n3); + for (int iT = 1; iT <= triangulation->NbTriangles(); ++iT) { + triangulation->Triangle(iT).Get(n1, n2, n3); + const gp_Pnt2d& uv1 = triangulation->UVNode(n1); + const gp_Pnt2d& uv2 = triangulation->UVNode(n2); + const gp_Pnt2d& uv3 = triangulation->UVNode(n3); double a = 0.5 * sqrt((uv1.X() - uv3.X()) * (uv2.Y() - uv1.Y()) - (uv1.X() - uv2.X()) * (uv3.Y() - uv1.Y())); C += (uv1.XY() + uv2.XY() + uv3.XY()) / 3. * a; diff --git a/src/PartSet/PartSet_Module.cpp b/src/PartSet/PartSet_Module.cpp index 76bafe5f6..8292e70d6 100644 --- a/src/PartSet/PartSet_Module.cpp +++ b/src/PartSet/PartSet_Module.cpp @@ -153,6 +153,8 @@ #include +#include + #define FEATURE_ITEM_COLOR "0,0,225" @@ -1474,7 +1476,11 @@ void PartSet_Module::setTexture(const AISObjectPtr& thePrs, //aPixmap = OCCViewer_Utilities::imageToPixmap( px.toImage()); Handle(Image_PixMap) aPixmap = new Image_PixMap(); +#if OCC_VERSION_LARGE < 0x07070000 aPixmap->InitTrash(Image_PixMap::ImgBGRA, aWidth, aHeight); +#else + aPixmap->InitTrash(Image_Format_BGRA, aWidth, aHeight); +#endif std::list::iterator aByteIter = aByteList.begin(); for (int aLine = 0; aLine < aHeight; ++aLine) { // convert pixels from ARGB to renderer-compatible RGBA diff --git a/src/PartSet/PartSet_Tools.cpp b/src/PartSet/PartSet_Tools.cpp index 6db3bb34a..7e77f8c99 100644 --- a/src/PartSet/PartSet_Tools.cpp +++ b/src/PartSet/PartSet_Tools.cpp @@ -93,7 +93,6 @@ #include #include #include -#include #include @@ -115,7 +114,7 @@ gp_Pnt PartSet_Tools::convertClickToPoint(QPoint thePoint, Handle(V3d_View) theV if (theView.IsNull()) return gp_Pnt(); - V3d_Coordinate XAt, YAt, ZAt; + Standard_Real XAt, YAt, ZAt; theView->At(XAt, YAt, ZAt); gp_Pnt AtPoint(XAt, YAt, ZAt); @@ -157,7 +156,7 @@ Handle(V3d_View) theView, gp_Vec aVec(anOriginPnt, thePoint); if (!theView.IsNull()) { - V3d_Coordinate XEye, YEye, ZEye, XAt, YAt, ZAt; + Standard_Real XEye, YEye, ZEye, XAt, YAt, ZAt; theView->Eye(XEye, YEye, ZEye); theView->At(XAt, YAt, ZAt); -- 2.30.2