Added flag for computation internal shapes (manifold topology). In the SALOME/TRIPOLI module this piece of the functionality is not needed. It produces incorrect shapes and/or crashes.

This commit is contained in:
mpv 2011-02-08 14:17:24 +00:00
parent 335b22d949
commit ad52e520d5
5 changed files with 56 additions and 34 deletions

View File

@ -51,9 +51,14 @@ is
WarningStatus (me) WarningStatus (me)
returns Integer from Standard; 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 fields
myErrorStatus : Integer from Standard is protected; myErrorStatus : Integer from Standard is protected;
myWarningStatus : Integer from Standard is protected; myWarningStatus : Integer from Standard is protected;
myComputeInternalShapes : Boolean from Standard is protected;
end Algo; end Algo;

View File

@ -34,7 +34,8 @@
GEOMAlgo_Algo::GEOMAlgo_Algo() GEOMAlgo_Algo::GEOMAlgo_Algo()
: :
myErrorStatus(1), myErrorStatus(1),
myWarningStatus(0) myWarningStatus(0),
myComputeInternalShapes(Standard_True)
{} {}
//======================================================================= //=======================================================================
// function: ~ // function: ~
@ -78,3 +79,12 @@
// myErrorStatus // myErrorStatus
// //
// 1 - object is just initialized // 1 - object is just initialized
//=======================================================================
//function : ComputeInternalShapes
//purpose :
//=======================================================================
void GEOMAlgo_Algo::ComputeInternalShapes(const Standard_Boolean theFlag)
{
myComputeInternalShapes = theFlag;
}

View File

@ -64,6 +64,7 @@ Standard_EXPORT Standard_Integer ErrorStatus() const;
Standard_EXPORT Standard_Integer WarningStatus() 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 myErrorStatus;
Standard_Integer myWarningStatus; Standard_Integer myWarningStatus;
Standard_Boolean myComputeInternalShapes;
private: private:

View File

@ -159,9 +159,11 @@ static
if (myErrorStatus) { if (myErrorStatus) {
return; return;
} }
PerformInternalShapes(); if (myComputeInternalShapes) {
if (myErrorStatus) { PerformInternalShapes();
return; if (myErrorStatus) {
return;
}
} }
} }
//======================================================================= //=======================================================================
@ -445,42 +447,44 @@ static
aEFMap.Clear(); aEFMap.Clear();
AddedFacesMap.Clear(); AddedFacesMap.Clear();
// //
aItM.Initialize(myShapesToAvoid); if (myComputeInternalShapes) {
for (; aItM.More(); aItM.Next()) { aItM.Initialize(myShapesToAvoid);
const TopoDS_Shape& aFF=aItM.Key(); for (; aItM.More(); aItM.Next()) {
TopExp::MapShapesAndAncestors(aFF, TopAbs_EDGE, TopAbs_FACE, aEFMap); 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;
} }
// //
// make a new shell aItM.Initialize(myShapesToAvoid);
TopoDS_Shell aShell; for (; aItM.More(); aItM.Next()) {
aBB.MakeShell(aShell); const TopoDS_Shape& aFF=aItM.Key();
aBB.Add(aShell, aFF); if (!AddedFacesMap.Add(aFF)) {
// continue;
TopoDS_Iterator aItAddedF (aShell); }
for (; aItAddedF.More(); aItAddedF.Next()) {
const TopoDS_Face& aF = *((TopoDS_Face*)(&aItAddedF.Value()));
// //
TopExp_Explorer aEdgeExp(aF, TopAbs_EDGE); // make a new shell
for (; aEdgeExp.More(); aEdgeExp.Next()) { TopoDS_Shell aShell;
const TopoDS_Edge& aE = *((TopoDS_Edge*)(&aEdgeExp.Current())); aBB.MakeShell(aShell);
const TopTools_ListOfShape& aLF=aEFMap.FindFromKey(aE); aBB.Add(aShell, aFF);
aItF.Initialize(aLF); //
for (; aItF.More(); aItF.Next()) { TopoDS_Iterator aItAddedF (aShell);
const TopoDS_Face& aFL=*((TopoDS_Face*)(&aItF.Value())); for (; aItAddedF.More(); aItAddedF.Next()) {
if (AddedFacesMap.Add(aFL)){ const TopoDS_Face& aF = *((TopoDS_Face*)(&aItAddedF.Value()));
aBB.Add(aShell, aFL); //
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);
} }
} }
//======================================================================= //=======================================================================

View File

@ -456,6 +456,7 @@ void GEOMAlgo_Builder::BuildDraftSolid (const TopoDS_Shape& theSolid,
// //
// 1. Build solids for interferred source solids // 1. Build solids for interferred source solids
aSB.SetContext(aCtx); aSB.SetContext(aCtx);
aSB.ComputeInternalShapes(myComputeInternalShapes);
aNbS=myDraftSolids.Extent(); aNbS=myDraftSolids.Extent();
for (i=1; i<=aNbS; ++i) { for (i=1; i<=aNbS; ++i) {
const TopoDS_Shape& aS =myDraftSolids.FindKey(i); const TopoDS_Shape& aS =myDraftSolids.FindKey(i);