From: mpv Date: Tue, 8 Feb 2011 11:39:12 +0000 (+0000) Subject: Added flag for computation internal shapes (manifol topology). In the SALOME/TRIPOLI... X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=ffd76778d77db3b6d9483eeb28a70011d3ca17e4;p=modules%2Fgeom.git Added flag for computation internal shapes (manifol topology). In the SALOME/TRIPOLI module this piece of the functionality is not needed. It produces incorrect shapes and/or crashes. --- diff --git a/src/GEOMAlgo/GEOMAlgo_Algo.cdl b/src/GEOMAlgo/GEOMAlgo_Algo.cdl index 7bb6dd4bc..02f7a57a3 100755 --- a/src/GEOMAlgo/GEOMAlgo_Algo.cdl +++ b/src/GEOMAlgo/GEOMAlgo_Algo.cdl @@ -51,9 +51,14 @@ is WarningStatus (me) returns Integer from Standard; - + + ComputeInternalShapes(me : in out; theFlag : Boolean from Standard) + ---Purpose: Allows to omit of creation of internal shapes (manifold topology). + -- Needed for the SALOME/TRIPOLI module. + fields myErrorStatus : Integer from Standard is protected; myWarningStatus : Integer from Standard is protected; + myComputeInternalShapes : Boolean from Standard is protected; end Algo; diff --git a/src/GEOMAlgo/GEOMAlgo_Algo.cxx b/src/GEOMAlgo/GEOMAlgo_Algo.cxx index 6435bcd3a..37a15abe6 100755 --- a/src/GEOMAlgo/GEOMAlgo_Algo.cxx +++ b/src/GEOMAlgo/GEOMAlgo_Algo.cxx @@ -34,7 +34,8 @@ GEOMAlgo_Algo::GEOMAlgo_Algo() : myErrorStatus(1), - myWarningStatus(0) + myWarningStatus(0), + myComputeInternalShapes(Standard_True) {} //======================================================================= // function: ~ @@ -78,3 +79,12 @@ // myErrorStatus // // 1 - object is just initialized + +//======================================================================= +//function : ComputeInternalShapes +//purpose : +//======================================================================= + void GEOMAlgo_Algo::ComputeInternalShapes(const Standard_Boolean theFlag) +{ + myComputeInternalShapes = theFlag; +} diff --git a/src/GEOMAlgo/GEOMAlgo_Algo.hxx b/src/GEOMAlgo/GEOMAlgo_Algo.hxx index 71b728c27..add926a46 100644 --- a/src/GEOMAlgo/GEOMAlgo_Algo.hxx +++ b/src/GEOMAlgo/GEOMAlgo_Algo.hxx @@ -64,6 +64,7 @@ Standard_EXPORT Standard_Integer ErrorStatus() const; Standard_EXPORT Standard_Integer WarningStatus() const; +Standard_EXPORT void ComputeInternalShapes(const Standard_Boolean theFlag); @@ -88,6 +89,7 @@ Standard_EXPORT virtual void CheckResult() ; // Standard_Integer myErrorStatus; Standard_Integer myWarningStatus; +Standard_Boolean myComputeInternalShapes; private: diff --git a/src/GEOMAlgo/GEOMAlgo_BuilderSolid.cxx b/src/GEOMAlgo/GEOMAlgo_BuilderSolid.cxx index 2bc49887d..2099ab9c6 100755 --- a/src/GEOMAlgo/GEOMAlgo_BuilderSolid.cxx +++ b/src/GEOMAlgo/GEOMAlgo_BuilderSolid.cxx @@ -155,9 +155,11 @@ static if (myErrorStatus) { return; } - PerformInternalShapes(); - if (myErrorStatus) { - return; + if (myComputeInternalShapes) { + PerformInternalShapes(); + if (myErrorStatus) { + return; + } } } //======================================================================= @@ -441,45 +443,48 @@ static // aEFMap.Clear(); AddedFacesMap.Clear(); - // - aNbFA=myShapesToAvoid.Extent(); - // - aItM.Initialize(myShapesToAvoid); - for (; aItM.More(); aItM.Next()) { - const TopoDS_Shape& aFF=aItM.Key(); - TopExp::MapShapesAndAncestors(aFF, TopAbs_EDGE, TopAbs_FACE, aEFMap); - } - // - aItM.Initialize(myShapesToAvoid); - for (; aItM.More(); aItM.Next()) { - const TopoDS_Shape& aFF=aItM.Key(); - if (!AddedFacesMap.Add(aFF)) { - continue; - } + + if (myComputeInternalShapes) { // - // make a new shell - TopoDS_Shell aShell; - aBB.MakeShell(aShell); - aBB.Add(aShell, aFF); + aNbFA=myShapesToAvoid.Extent(); // - TopoDS_Iterator aItAddedF (aShell); - for (; aItAddedF.More(); aItAddedF.Next()) { - const TopoDS_Face& aF = TopoDS::Face(aItAddedF.Value()); + aItM.Initialize(myShapesToAvoid); + for (; aItM.More(); aItM.Next()) { + const TopoDS_Shape& aFF=aItM.Key(); + TopExp::MapShapesAndAncestors(aFF, TopAbs_EDGE, TopAbs_FACE, aEFMap); + } + // + aItM.Initialize(myShapesToAvoid); + for (; aItM.More(); aItM.Next()) { + const TopoDS_Shape& aFF=aItM.Key(); + if (!AddedFacesMap.Add(aFF)) { + continue; + } // - TopExp_Explorer aEdgeExp(aF, TopAbs_EDGE); - for (; aEdgeExp.More(); aEdgeExp.Next()) { - const TopoDS_Edge& aE = TopoDS::Edge(aEdgeExp.Current()); - const TopTools_ListOfShape& aLF=aEFMap.FindFromKey(aE); - aItF.Initialize(aLF); - for (; aItF.More(); aItF.Next()) { - const TopoDS_Face& aFL=TopoDS::Face(aItF.Value()); - if (AddedFacesMap.Add(aFL)){ - aBB.Add(aShell, aFL); + // make a new shell + TopoDS_Shell aShell; + aBB.MakeShell(aShell); + aBB.Add(aShell, aFF); + // + TopoDS_Iterator aItAddedF (aShell); + for (; aItAddedF.More(); aItAddedF.Next()) { + const TopoDS_Face& aF = TopoDS::Face(aItAddedF.Value()); + // + TopExp_Explorer aEdgeExp(aF, TopAbs_EDGE); + for (; aEdgeExp.More(); aEdgeExp.Next()) { + const TopoDS_Edge& aE = TopoDS::Edge(aEdgeExp.Current()); + const TopTools_ListOfShape& aLF=aEFMap.FindFromKey(aE); + aItF.Initialize(aLF); + for (; aItF.More(); aItF.Next()) { + const TopoDS_Face& aFL=TopoDS::Face(aItF.Value()); + if (AddedFacesMap.Add(aFL)){ + aBB.Add(aShell, aFL); + } } } } + myLoopsInternal.Append(aShell); } - myLoopsInternal.Append(aShell); } } //======================================================================= diff --git a/src/GEOMAlgo/GEOMAlgo_Builder_3.cxx b/src/GEOMAlgo/GEOMAlgo_Builder_3.cxx index ea602fe60..e43eceb89 100755 --- a/src/GEOMAlgo/GEOMAlgo_Builder_3.cxx +++ b/src/GEOMAlgo/GEOMAlgo_Builder_3.cxx @@ -459,6 +459,7 @@ static // 1. Build solids for interferred source solids // aSB.SetContext(aCtx); + aSB.ComputeInternalShapes(myComputeInternalShapes); aNbS=myDraftSolids.Extent(); for (i=1; i<=aNbS; ++i) { const TopoDS_Shape& aS =myDraftSolids.FindKey(i);