From 440f972571097934b69e41ed3f264e2cd355051e Mon Sep 17 00:00:00 2001 From: nds Date: Fri, 3 Nov 2017 15:27:15 +0300 Subject: [PATCH] An attempt of porting to current OCCT. --- src/GeomAPI/GeomAPI_AISObject.cpp | 3 ++- src/GeomAlgoAPI/GeomAlgoAPI_Boolean.cpp | 5 +++++ src/GeomAlgoAPI/GeomAlgoAPI_Partition.cpp | 5 +++++ src/GeomAlgoAPI/GeomAlgoAPI_PaveFiller.cpp | 10 ++++++++++ src/GeomAlgoAPI/GeomAlgoAPI_ShapeTools.cpp | 10 ++++++++++ src/GeomAlgoAPI/GeomAlgoAPI_SketchBuilder.cpp | 6 +++++- src/GeomAlgoImpl/GEOMAlgo_Splitter.cxx | 2 ++ src/ModuleBase/ModuleBase_Tools.cpp | 4 ++++ src/ModuleBase/ModuleBase_ViewerFilters.cpp | 7 +++++++ src/PartSet/PartSet_Tools.cpp | 1 + src/SketcherPrs/SketcherPrs_Coincident.cpp | 2 ++ src/XGUI/XGUI_Displayer.cpp | 2 +- 12 files changed, 54 insertions(+), 3 deletions(-) diff --git a/src/GeomAPI/GeomAPI_AISObject.cpp b/src/GeomAPI/GeomAPI_AISObject.cpp index a94c7b425..c323a7835 100644 --- a/src/GeomAPI/GeomAPI_AISObject.cpp +++ b/src/GeomAPI/GeomAPI_AISObject.cpp @@ -388,7 +388,8 @@ void GeomAPI_AISObject::getColor(int& theR, int& theG, int& theB) if (anAIS.IsNull()) return; - Quantity_Color aColor = anAIS->Color(); + Quantity_Color aColor; + anAIS->Color(aColor); theR = (int)(aColor.Red()*255.); theG = (int)(aColor.Green()*255.); theB = (int)(aColor.Blue()*255.); diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_Boolean.cpp b/src/GeomAlgoAPI/GeomAlgoAPI_Boolean.cpp index 64dcb8949..7ef54d5d6 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_Boolean.cpp +++ b/src/GeomAlgoAPI/GeomAlgoAPI_Boolean.cpp @@ -86,9 +86,14 @@ void GeomAlgoAPI_Boolean::build(const ListOfShape& theObjects, // Building and getting result. aBuilder->Perform(); +#ifdef USE_OCCT_720 + if (aBuilder->HasErrors()) + return; +#else if(aBuilder->ErrorStatus() != 0) { return; } +#endif TopoDS_Shape aResult = aBuilder->Shape(); if(aResult.ShapeType() == TopAbs_COMPOUND) { diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_Partition.cpp b/src/GeomAlgoAPI/GeomAlgoAPI_Partition.cpp index cd880734a..4222649a8 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_Partition.cpp +++ b/src/GeomAlgoAPI/GeomAlgoAPI_Partition.cpp @@ -102,9 +102,14 @@ void GeomAlgoAPI_Partition::build(const ListOfShape& theObjects, // Building and getting result. anOperation->Perform(); +#ifdef USE_OCCT_720 + if (anOperation->HasErrors()) + return; +#else if(anOperation->ErrorStatus() != 0) { return; } +#endif TopoDS_Shape aResult = anOperation->Shape(); if(aResult.ShapeType() == TopAbs_COMPOUND) { diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_PaveFiller.cpp b/src/GeomAlgoAPI/GeomAlgoAPI_PaveFiller.cpp index aada7a927..9b61619a3 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_PaveFiller.cpp +++ b/src/GeomAlgoAPI/GeomAlgoAPI_PaveFiller.cpp @@ -55,20 +55,30 @@ void GeomAlgoAPI_PaveFiller::build(const ListOfShape& theListOfShape, } aPaveFiller.SetArguments(aListOfShape); aPaveFiller.Perform(); +#ifdef USE_OCCT_720 + if (aPaveFiller.HasErrors()) + return; +#else Standard_Integer iErr = aPaveFiller.ErrorStatus(); if(iErr) { return; } +#endif BOPAlgo_Builder* aBuilder = new BOPAlgo_Builder(); this->setImpl(aBuilder); this->setBuilderType(OCCT_BOPAlgo_Builder); aBuilder->SetArguments(aListOfShape); aBuilder->PerformWithFiller(aPaveFiller); +#ifdef USE_OCCT_720 + if (aBuilder->HasErrors()) + return; +#else iErr = aBuilder->ErrorStatus(); if(iErr) { return; } +#endif TopoDS_Shape aResult = aBuilder->Shape(); if(aResult.ShapeType() == TopAbs_COMPOUND) { diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_ShapeTools.cpp b/src/GeomAlgoAPI/GeomAlgoAPI_ShapeTools.cpp index d798b50ad..eeebf25b0 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_ShapeTools.cpp +++ b/src/GeomAlgoAPI/GeomAlgoAPI_ShapeTools.cpp @@ -821,8 +821,13 @@ void GeomAlgoAPI_ShapeTools::splitShape(const std::shared_ptr& th } aBOP.Perform(); +#ifdef USE_OCCT_720 + if (aBOP.HasErrors()) + return; +#else if (aBOP.ErrorStatus()) return; +#endif // Collect splits const TopTools_ListOfShape& aSplits = aBOP.Modified(aBaseEdge); @@ -866,8 +871,13 @@ void GeomAlgoAPI_ShapeTools::splitShape_p(const std::shared_ptr& } aBOP.Perform(); +#ifdef USE_OCCT_720 + if (aBOP.HasErrors()) + return; +#else if (aBOP.ErrorStatus()) return; +#endif // Collect splits const TopTools_ListOfShape& aSplits = aBOP.Modified(aBaseEdge); diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_SketchBuilder.cpp b/src/GeomAlgoAPI/GeomAlgoAPI_SketchBuilder.cpp index c4bf9d6f3..eadaee6c6 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_SketchBuilder.cpp +++ b/src/GeomAlgoAPI/GeomAlgoAPI_SketchBuilder.cpp @@ -218,9 +218,13 @@ void GeomAlgoAPI_SketchBuilder::createFaces( aBB.AddArgument(anEdge); } aBB.Perform(); +#ifdef USE_OCCT_720 + if (aBB.HasErrors()) + return; +#else if (aBB.ErrorStatus()) return; - +#endif // Collect faces TopTools_ListOfShape anAreas = aBB.Modified(aPlnFace); sortFaces(anAreas, theFeatures); // sort faces by the edges in them diff --git a/src/GeomAlgoImpl/GEOMAlgo_Splitter.cxx b/src/GeomAlgoImpl/GEOMAlgo_Splitter.cxx index f03f0594c..364834d40 100755 --- a/src/GeomAlgoImpl/GEOMAlgo_Splitter.cxx +++ b/src/GeomAlgoImpl/GEOMAlgo_Splitter.cxx @@ -143,7 +143,9 @@ void GEOMAlgo_Splitter::Clear() //======================================================================= void GEOMAlgo_Splitter::BuildResult(const TopAbs_ShapeEnum theType) { +#ifndef USE_OCCT_720 myErrorStatus=0; +#endif // TopAbs_ShapeEnum aType; BRep_Builder aBB; diff --git a/src/ModuleBase/ModuleBase_Tools.cpp b/src/ModuleBase/ModuleBase_Tools.cpp index 108ad1681..dbf0f252b 100755 --- a/src/ModuleBase/ModuleBase_Tools.cpp +++ b/src/ModuleBase/ModuleBase_Tools.cpp @@ -1103,6 +1103,9 @@ void setPointBallHighlighting(AIS_Shape* theAIS) Handle(Graphic3d_AspectMarker3d) anAspect; Handle(Prs3d_Drawer) aDrawer = theAIS->HilightAttributes(); +#ifdef USE_OCCT_720 + // to do: implement ball highlighting, in 7.2.0 this drawer is NULL +#else if(aDrawer->HasOwnPointAspect()) { Handle(Prs3d_PointAspect) aPntAspect = aDrawer->PointAspect(); if(aPixMap->IsEmpty()) { @@ -1120,6 +1123,7 @@ void setPointBallHighlighting(AIS_Shape* theAIS) aDrawer->SetPointAspect(aPntAspect); theAIS->SetHilightAttributes(aDrawer); } +#endif } } // namespace ModuleBase_Tools diff --git a/src/ModuleBase/ModuleBase_ViewerFilters.cpp b/src/ModuleBase/ModuleBase_ViewerFilters.cpp index 0686c1d7b..3f7b3a3ad 100644 --- a/src/ModuleBase/ModuleBase_ViewerFilters.cpp +++ b/src/ModuleBase/ModuleBase_ViewerFilters.cpp @@ -156,6 +156,12 @@ Standard_Boolean ModuleBase_ShapeInPlaneFilter::IsOk( const Prs3d_DatumParts& aPart = aTrOwner->DatumPart(); if (aPart >= Prs3d_DP_XAxis && aPart <= Prs3d_DP_ZAxis) { +#ifdef USE_OCCT_720 + gp_Ax2 anAxis = aTrihedron->Component()->Ax2(); + gp_Dir aDir = anAxis.XDirection(); + gp_Lin aLine(aTrihedron->Component()->Location(), aDir); + return aPlane.Contains(aLine, Precision::Confusion(), Precision::Angular()); +#else Handle(Prs3d_Drawer) aDrawer = aTrihedron->Attributes(); Handle(Prs3d_DatumAspect) aDatumAspect = aDrawer->DatumAspect(); Handle(Graphic3d_ArrayOfPrimitives) aPrimitives = @@ -167,6 +173,7 @@ Standard_Boolean ModuleBase_ShapeInPlaneFilter::IsOk( gp_Pnt aPnt2(aX2, anY2, aZ2); gp_Lin aLine(aPnt1, gp_Dir(gp_Vec(aPnt1, aPnt2))); return aPlane.Contains(aLine, Precision::Confusion(), Precision::Angular()); +#endif } } } diff --git a/src/PartSet/PartSet_Tools.cpp b/src/PartSet/PartSet_Tools.cpp index d7c4812d0..dac76b8e9 100755 --- a/src/PartSet/PartSet_Tools.cpp +++ b/src/PartSet/PartSet_Tools.cpp @@ -90,6 +90,7 @@ #include #include #include +#include #include diff --git a/src/SketcherPrs/SketcherPrs_Coincident.cpp b/src/SketcherPrs/SketcherPrs_Coincident.cpp index 69ece0e87..8d7ea1581 100644 --- a/src/SketcherPrs/SketcherPrs_Coincident.cpp +++ b/src/SketcherPrs/SketcherPrs_Coincident.cpp @@ -139,7 +139,9 @@ void SketcherPrs_Coincident::SetColor(const Quantity_NameOfColor aCol) void SketcherPrs_Coincident::SetColor(const Quantity_Color &aCol) { hasOwnColor=Standard_True; +#ifndef USE_OCCT_720 myOwnColor=aCol; +#endif } void SketcherPrs_Coincident::SetCustomColor(const std::vector& theColor) diff --git a/src/XGUI/XGUI_Displayer.cpp b/src/XGUI/XGUI_Displayer.cpp index 4a9582d29..eb2b6bbc7 100644 --- a/src/XGUI/XGUI_Displayer.cpp +++ b/src/XGUI/XGUI_Displayer.cpp @@ -1518,7 +1518,7 @@ void XGUI_Displayer::displayTrihedron(bool theToDisplay) const } else { deactivateTrihedron(false); - aContext->Erase(aTrihedron); + aContext->Erase(aTrihedron, Standard_True); #ifdef TINSPECTOR if (getCallBack()) getCallBack()->Remove(aTrihedron); #endif -- 2.39.2