From: jfa Date: Tue, 27 Sep 2011 11:42:33 +0000 (+0000) Subject: Porting to OCCT6.5.2. X-Git-Tag: V6_4_0a1~19 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=e808f9b75f70810dfd0428313d3ba8ad2cfa16df;p=modules%2Fgeom.git Porting to OCCT6.5.2. --- diff --git a/src/GEOMAlgo/GEOMAlgo_BuilderTools.cxx b/src/GEOMAlgo/GEOMAlgo_BuilderTools.cxx index 82cbf8c24..7c147907e 100755 --- a/src/GEOMAlgo/GEOMAlgo_BuilderTools.cxx +++ b/src/GEOMAlgo/GEOMAlgo_BuilderTools.cxx @@ -18,15 +18,14 @@ // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// // File: GEOMAlgo_BuilderTools.cxx -// Created: // Author: Peter KURNEV -// -// + #include +#include + #include #include @@ -53,6 +52,11 @@ #include #include +#if OCC_VERSION_LARGE > 0x06050100 // for OCC-6.5.2 and higher version +#include +#include +#endif + #include #include #include @@ -276,5 +280,12 @@ void BuildTriangulation(const TopoDS_Face& aF) Standard_True, Standard_False, Standard_True); + +#if OCC_VERSION_LARGE > 0x06050100 // for OCC-6.5.2 and higher version + TopTools_IndexedDataMapOfShapeListOfShape anAncestors; + TopExp::MapShapesAndAncestors(aF, TopAbs_EDGE, TopAbs_FACE, anAncestors); + aMesher.Add(aF, anAncestors); +#else aMesher.Add(aF); +#endif } diff --git a/src/GEOMAlgo/GEOMAlgo_FinderShapeOn.cxx b/src/GEOMAlgo/GEOMAlgo_FinderShapeOn.cxx index 066e6a006..c0f0ac711 100644 --- a/src/GEOMAlgo/GEOMAlgo_FinderShapeOn.cxx +++ b/src/GEOMAlgo/GEOMAlgo_FinderShapeOn.cxx @@ -18,15 +18,19 @@ // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// // File: GEOMAlgo_FinderShapeOn.cxx // Created: Tue Jan 11 14:44:31 2005 // Author: Peter KURNEV -// -// + #include +#include + +#if OCC_VERSION_LARGE > 0x06050100 // for OCC-6.5.2 and higher version +#include +#endif + #include #include @@ -383,7 +387,11 @@ void GEOMAlgo_FinderShapeOn::MakeArgument1() // // Argument 1 if (!myIsAnalytic) { +#if OCC_VERSION_LARGE > 0x06050100 // for OCC-6.5.2 and higher version + aMF.Init(mySurface, Standard_True, Precision::Confusion()); +#else aMF.Init(mySurface, Standard_True); +#endif aFErr=aMF.Error(); if (aFErr!=BRepLib_FaceDone) { myErrorStatus=20; // can not build the face diff --git a/src/GEOMAlgo/GEOMAlgo_GetInPlace_1.cxx b/src/GEOMAlgo/GEOMAlgo_GetInPlace_1.cxx index 9220a21b3..014a452af 100644 --- a/src/GEOMAlgo/GEOMAlgo_GetInPlace_1.cxx +++ b/src/GEOMAlgo/GEOMAlgo_GetInPlace_1.cxx @@ -18,9 +18,8 @@ // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// + // File: GEOMAlgo_GetInPlace_1.cxx -// Created: // Author: Peter KURNEV #include @@ -91,9 +90,9 @@ static Standard_Boolean GEOMAlgo_GetInPlace::CheckCoincidence(const TopoDS_Shape& aS1, const TopoDS_Shape& aS2) { - Standard_Boolean bOk, bIsDone; + Standard_Boolean bOk; Standard_Integer iErr; - Standard_Real aTol2, aD2; + Standard_Real aTol2; TopAbs_ShapeEnum aType1, aType2; TopAbs_State aState; gp_Pnt aP1, aP2; diff --git a/src/GEOMImpl/GEOMImpl_ArchimedeDriver.cxx b/src/GEOMImpl/GEOMImpl_ArchimedeDriver.cxx index 4646927a0..3be550a49 100644 --- a/src/GEOMImpl/GEOMImpl_ArchimedeDriver.cxx +++ b/src/GEOMImpl/GEOMImpl_ArchimedeDriver.cxx @@ -18,7 +18,6 @@ // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// #include "GEOMImpl_ArchimedeDriver.hxx" #include "GEOMImpl_IArchimede.hxx" @@ -26,6 +25,8 @@ #include "Archimede_VolumeSection.hxx" +#include + #include #include @@ -128,7 +129,11 @@ Standard_Integer GEOMImpl_ArchimedeDriver::Execute(TFunction_Logbook& log) const Standard_Real u1,u2,v1,v2; SurfaceTrimmee->Bounds(u1,u2,v1,v2); +#if OCC_VERSION_LARGE > 0x06050100 // for OCC-6.5.2 and higher version + TopoDS_Face tirant = BRepBuilderAPI_MakeFace(SurfaceTrimmee, u1, u2, v1, v2, Precision::Confusion()); +#else TopoDS_Face tirant = BRepBuilderAPI_MakeFace(SurfaceTrimmee, u1, u2, v1, v2); +#endif if (tirant.IsNull()) { StdFail_NotDone::Raise("Failed to build secant face"); @@ -182,7 +187,5 @@ const Handle(GEOMImpl_ArchimedeDriver) Handle(GEOMImpl_ArchimedeDriver)::DownCas } } - return _anOtherObject ; + return _anOtherObject; } - - diff --git a/src/GEOMImpl/GEOMImpl_FillingDriver.cxx b/src/GEOMImpl/GEOMImpl_FillingDriver.cxx index 8d601ccc9..b06c44ae7 100644 --- a/src/GEOMImpl/GEOMImpl_FillingDriver.cxx +++ b/src/GEOMImpl/GEOMImpl_FillingDriver.cxx @@ -18,28 +18,32 @@ // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// #include #include -#include #include #include +#include + +#include + +#include + #include #include -#include #include +#include #include #include +#include #include -#include #include #include +#include #include -#include #include #include @@ -48,25 +52,22 @@ #include #include #include +#include #include #include #include #include - -#include -#include - -#include -#include #include -#include #include +#include + #include #include -//#include +#include +#include //======================================================================= //function : GetID @@ -78,7 +79,6 @@ const Standard_GUID& GEOMImpl_FillingDriver::GetID() return aFillingDriver; } - //======================================================================= //function : GEOMImpl_FillingDriver //purpose : @@ -290,7 +290,11 @@ Standard_Integer GEOMImpl_FillingDriver::Execute(TFunction_Logbook& log) const App.SurfUMults(), App.SurfVMults(), App.UDegree(), App.VDegree()); if (GBS.IsNull()) return 0; +#if OCC_VERSION_LARGE > 0x06050100 // for OCC-6.5.2 and higher version + aShape = BRepBuilderAPI_MakeFace(GBS, Precision::Confusion()); +#else aShape = BRepBuilderAPI_MakeFace(GBS); +#endif } else { // implemented by skl 20.03.2008 for bug 16568 @@ -349,7 +353,11 @@ Standard_Integer GEOMImpl_FillingDriver::Execute(TFunction_Logbook& log) const } GeomAPI_PointsToBSplineSurface PTB(Points,mindeg,maxdeg,GeomAbs_C2,tol3d); Handle(Geom_BSplineSurface) BS = PTB.Surface(); - BRepBuilderAPI_MakeFace BB(BS); +#if OCC_VERSION_LARGE > 0x06050100 // for OCC-6.5.2 and higher version + BRepBuilderAPI_MakeFace BB (BS, Precision::Confusion()); +#else + BRepBuilderAPI_MakeFace BB (BS); +#endif TopoDS_Face NewF = BB.Face(); Handle(ShapeFix_Face) sff = new ShapeFix_Face(NewF); sff->Perform(); diff --git a/src/GEOMImpl/GEOMImpl_PlaneDriver.cxx b/src/GEOMImpl/GEOMImpl_PlaneDriver.cxx index cc4a07a85..6549eb316 100644 --- a/src/GEOMImpl/GEOMImpl_PlaneDriver.cxx +++ b/src/GEOMImpl/GEOMImpl_PlaneDriver.cxx @@ -18,7 +18,6 @@ // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// #include @@ -29,6 +28,8 @@ #include +#include + // OCCT Includes #include #include @@ -125,7 +126,12 @@ Standard_Integer GEOMImpl_PlaneDriver::Execute(TFunction_Logbook& log) const if (gp_Vec(aP1, aP2).IsParallel(gp_Vec(aP1, aP3), Precision::Angular())) Standard_ConstructionError::Raise("Plane creation aborted: points lay on one line"); GC_MakePlane aMakePlane (aP1, aP2, aP3); +#if OCC_VERSION_LARGE > 0x06050100 // for OCC-6.5.2 and higher version + aShape = BRepBuilderAPI_MakeFace(aMakePlane, -aSize, +aSize, -aSize, +aSize, + Precision::Confusion()).Shape(); +#else aShape = BRepBuilderAPI_MakeFace(aMakePlane, -aSize, +aSize, -aSize, +aSize).Shape(); +#endif } else if (aType == PLANE_FACE) { Handle(GEOM_Function) aRef = aPI.GetFace(); TopoDS_Shape aRefShape = aRef->GetValue(); diff --git a/src/ShHealOper/ShHealOper_FillHoles.cxx b/src/ShHealOper/ShHealOper_FillHoles.cxx index 5e3585706..2e55b642f 100644 --- a/src/ShHealOper/ShHealOper_FillHoles.cxx +++ b/src/ShHealOper/ShHealOper_FillHoles.cxx @@ -18,46 +18,50 @@ // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// // File: ShHealOper_FillHoles.cxx // Created: 26.04.04 17:35:30 // Author: Galina KULIKOVA -// + +#include + +#include +#include #include -#include -#include #include -#include -#include -#include + #include -#include -#include -#include -#include -#include -#include #include #include -#include -#include -#include -#include #include -#include -#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include #include +#include +#include #include -#include -#include -#include + +#include +#include +#include #include -#include -#include -#include -#include +#include +#include +#include +#include +#include + +#include //======================================================================= //function : ShHealOper_FillHoles() @@ -70,33 +74,31 @@ ShHealOper_FillHoles::ShHealOper_FillHoles () //======================================================================= //function : ShHealOper_FillHoles -//purpose : +//purpose : //======================================================================= - ShHealOper_FillHoles::ShHealOper_FillHoles (const TopoDS_Shape& theShape) { - Init(theShape); InitParameters(); } + //======================================================================= //function : Init -//purpose : +//purpose : //======================================================================= - void ShHealOper_FillHoles::Init(const TopoDS_Shape& theShape) { ShHealOper_Tool::Init(theShape); TopExp::MapShapesAndAncestors( myInitShape, TopAbs_EDGE,TopAbs_SHELL , myEdgeShells); TopExp::MapShapesAndAncestors ( myInitShape, TopAbs_EDGE,TopAbs_COMPOUND, myEdgeComps ); - + TopExp::MapShapesAndAncestors ( myInitShape, TopAbs_EDGE,TopAbs_FACE, myEdgeFaces ); } + //======================================================================= //function : InitParameters -//purpose : +//purpose : //======================================================================= - void ShHealOper_FillHoles::InitParameters(Standard_Integer theDegree, Standard_Integer theNbPtsOnCur, Standard_Integer theNbIter, @@ -119,9 +121,8 @@ void ShHealOper_FillHoles::InitParameters(Standard_Integer theDegree, } //======================================================================= //function : Fill -//purpose : +//purpose : //======================================================================= - Standard_Boolean ShHealOper_FillHoles::Fill() { ShapeAnalysis_FreeBounds sab(myInitShape); @@ -131,17 +132,17 @@ Standard_Boolean ShHealOper_FillHoles::Fill() if(!aCompClosed.IsNull()) { TopoDS_Iterator aIt(aCompClosed); - for( ; aIt.More(); aIt.Next()) + for( ; aIt.More(); aIt.Next()) aFillWires.Append(aIt.Value()); } if(!aCompOpen.IsNull()) { TopoDS_Iterator aIt(aCompOpen); - for( ; aIt.More(); aIt.Next()) + for( ; aIt.More(); aIt.Next()) aFillWires.Append(aIt.Value()); } - + TopExp_Explorer aExp(myInitShape,TopAbs_EDGE,TopAbs_FACE); - + for( ; aExp.More(); aExp.Next()) aFillWires.Append(aExp.Current()); @@ -150,9 +151,8 @@ Standard_Boolean ShHealOper_FillHoles::Fill() //======================================================================= //function : Fill -//purpose : +//purpose : //======================================================================= - Standard_Boolean ShHealOper_FillHoles::Fill(const TopTools_SequenceOfShape& theFillShapes) { myDone = Standard_False; @@ -181,36 +181,36 @@ Standard_Boolean ShHealOper_FillHoles::Fill(const TopTools_SequenceOfShape& theF Handle(Geom_Surface) aSurf = buildSurface(aWire,aCurves2d,aOrders,aSenses); if(aSurf.IsNull()) myErrorStatus = ShHealOper_ErrorExecution; - else + else myDone = (addFace(aSurf,aWire,aCurves2d,aOrders,aSenses) || myDone); } if(myDone) myResultShape = myContext->Apply(myResultShape); return myDone; } + //======================================================================= //function : isCircle -//purpose : +//purpose : //======================================================================= static Standard_Boolean isCircle(const TopoDS_Edge theEdge) { Standard_Real aFirst, aLast; Handle(Geom_Curve) aC3D = BRep_Tool::Curve(theEdge,aFirst, aLast ); if(aC3D.IsNull()) return Standard_False; - Standard_Boolean isCirc = (aC3D->Value(aFirst).Distance(aC3D->Value(aLast)) < + Standard_Boolean isCirc = (aC3D->Value(aFirst).Distance(aC3D->Value(aLast)) < aC3D->Value(aFirst).Distance(aC3D->Value((aFirst +aLast)/2))); return isCirc; } //======================================================================= //function : prepareWires -//purpose : +//purpose : //======================================================================= Standard_Boolean ShHealOper_FillHoles::prepareWires(const TopTools_SequenceOfShape& theFillShapes, Handle(TopTools_HSequenceOfShape)& theSeqWires) { Handle(TopTools_HSequenceOfShape) aSeqEdges = new TopTools_HSequenceOfShape; - BRep_Builder aB; Standard_Integer i =1; for( ; i <= theFillShapes.Length(); i++) { TopExp_Explorer aExp; @@ -231,7 +231,7 @@ Standard_Boolean ShHealOper_FillHoles::prepareWires(const TopTools_SequenceOfSha aSeqEdges->Append(aExp.Current()); } } - + if(aSeqEdges->Length()) { Standard_Real aTol = 0.; @@ -241,23 +241,21 @@ Standard_Boolean ShHealOper_FillHoles::prepareWires(const TopTools_SequenceOfSha Handle(TopTools_HSequenceOfShape) anWiresClosed = new TopTools_HSequenceOfShape, anWiresOpen = new TopTools_HSequenceOfShape; ShapeAnalysis_FreeBounds::SplitWires(aTmpWires, aTol, aShared, anWiresClosed, anWiresOpen); - + for (i = 1; i <= anWiresClosed->Length(); i++) theSeqWires->Append (anWiresClosed->Value (i)); for (i = 1; i <= anWiresOpen->Length(); i++) theSeqWires->Append (anWiresOpen->Value (i)); } - - for( i =1; i <= theSeqWires->Length(); i++) { TopoDS_Wire aWire = TopoDS::Wire(theSeqWires->Value(i)); - + TopoDS_Iterator aIt(aWire); Standard_Integer ne =0; TopoDS_Edge ae; for( ; aIt.More(); aIt.Next(), ne++) - ae = TopoDS::Edge(aIt.Value()); + ae = TopoDS::Edge(aIt.Value()); if((ne == 1) && ( !isCircle(ae))) { theSeqWires->Remove(i--); continue; @@ -267,7 +265,7 @@ Standard_Boolean ShHealOper_FillHoles::prepareWires(const TopTools_SequenceOfSha } //======================================================================= //function : buildSurface -//purpose : +//purpose : //======================================================================= Handle(Geom_Surface) ShHealOper_FillHoles::buildSurface(const TopoDS_Wire& theWire, @@ -277,7 +275,6 @@ Handle(Geom_Surface) ShHealOper_FillHoles::buildSurface(const TopoDS_Wire& theWi { Handle(Geom_BSplineSurface) aSurf; try { - GeomPlate_BuildPlateSurface aBuilder(myDegree, myNbPtsOnCur, myNbIter, myTol2d, myTol3d, myTolAng, myTolCrv); TopoDS_Iterator aIter; @@ -288,7 +285,7 @@ Handle(Geom_Surface) ShHealOper_FillHoles::buildSurface(const TopoDS_Wire& theWi Handle(BRepAdaptor_HCurve) aHAD= new BRepAdaptor_HCurve(adC); Handle(BRepFill_CurveConstraint) aConst = new BRepFill_CurveConstraint (aHAD, (Standard_Integer) GeomAbs_C0, myNbPtsOnCur, myTol3d); - //Handle(GeomPlate_CurveConstraint) aConst = + //Handle(GeomPlate_CurveConstraint) aConst = // new GeomPlate_CurveConstraint(aHAD, (Standard_Integer) GeomAbs_C0, myNbPtsOnCur, myTol3d); aBuilder.Add (aConst); } @@ -308,17 +305,16 @@ Handle(Geom_Surface) ShHealOper_FillHoles::buildSurface(const TopoDS_Wire& theWi S3d.Clear(); aBuilder.Disc2dContour(4,S2d); aBuilder.Disc3dContour(4,0,S3d); - Standard_Real amaxTol = Max( myTol3d, 10* aDist); + Standard_Real amaxTol = Max( myTol3d, 10* aDist); GeomPlate_PlateG0Criterion Criterion( S2d, S3d, amaxTol ); GeomPlate_MakeApprox Approx( aPlSurf, Criterion, myTol3d, myMaxSeg, myMaxDeg ); aSurf = Approx.Surface(); if(aSurf.IsNull()) return aSurf; - + theCurves2d = aBuilder.Curves2d(); theOrders = aBuilder.Order(); theSenses = aBuilder.Sense(); - } catch (Standard_Failure) { @@ -330,7 +326,7 @@ Handle(Geom_Surface) ShHealOper_FillHoles::buildSurface(const TopoDS_Wire& theWi //======================================================================= //function : addFace -//purpose : +//purpose : //======================================================================= Standard_Boolean ShHealOper_FillHoles::addFace(const Handle(Geom_Surface)& theSurf, @@ -339,10 +335,13 @@ Standard_Boolean ShHealOper_FillHoles::addFace(const Handle(Geom_Surface)& theSu const Handle(TColStd_HArray1OfInteger)& theOrders, const Handle(TColStd_HArray1OfInteger)& theSenses) { +#if OCC_VERSION_LARGE > 0x06050100 // for OCC-6.5.2 and higher version + BRepBuilderAPI_MakeFace aMakeFace (theSurf, Precision::Confusion()); +#else BRepBuilderAPI_MakeFace aMakeFace (theSurf); +#endif TopoDS_Face aFace = aMakeFace.Face(); aFace.EmptyCopy(); - TopoDS_Wire aWire; BRep_Builder aB; @@ -358,9 +357,9 @@ Standard_Boolean ShHealOper_FillHoles::addFace(const Handle(Geom_Surface)& theSu BRep_Tool::Range (anEdge, aF, aL); TopLoc_Location aLoc; aB.UpdateEdge (anEdge, theCurves2d->Value (aInd),aFace, 0.); - + aB.Range (anEdge, aFace, aF, aL); - + // Set orientation of the edge: orientation should be changed // if its orientation does not make sence with curve orientation // recommended by GeomPlate @@ -409,7 +408,7 @@ Standard_Boolean ShHealOper_FillHoles::addFace(const Handle(Geom_Surface)& theSu //======================================================================= //function : getResShape -//purpose : +//purpose : //======================================================================= void ShHealOper_FillHoles::getResShape(const TopoDS_Shape& theAddShape, @@ -432,7 +431,6 @@ void ShHealOper_FillHoles::getResShape(const TopoDS_Shape& theAddShape, aB.MakeShell(aTmpShell); TopTools_SequenceOfShape aseqShells; if(anhasShell) { - aB.Add(aTmpShell,theAddShape); Standard_Integer i =1; for( ; i <= aMapParent.Extent(); i++) { @@ -452,9 +450,8 @@ void ShHealOper_FillHoles::getResShape(const TopoDS_Shape& theAddShape, TopoDS_Shape anshape = asfs->Shape(); myContext->Replace(aseqShells.Value(1),anshape); Standard_Integer i =2; - for( ; i<= aseqShells.Length(); i++) + for( ; i<= aseqShells.Length(); i++) myContext->Remove(aseqShells.Value(i)); - } else { TopoDS_Compound aComp; @@ -465,6 +462,5 @@ void ShHealOper_FillHoles::getResShape(const TopoDS_Shape& theAddShape, aB.Add(aComp,aIt.Value()); aB.Add(aComp,theAddShape); myContext->Replace( oldshape,aComp); - } }