Add progress indicator to BRepOffset_MakeOffset::MakeOffsetShape().
//purpose :
//=======================================================================
void BRepOffset_Analyse::Perform (const TopoDS_Shape& S,
- const Standard_Real Angle)
+ const Standard_Real Angle,
+ const Message_ProgressRange& theRange)
{
myShape = S;
myNewFaces .Clear();
BuildAncestors (S,myAncestors);
TopTools_ListOfShape aLETang;
-
TopExp_Explorer Exp(S.Oriented(TopAbs_FORWARD),TopAbs_EDGE);
- for ( ; Exp.More(); Exp.Next()) {
+ Message_ProgressScope aPSOuter(theRange, NULL, 2);
+ Message_ProgressScope aPS(aPSOuter.Next(), "Performing edges analysis", 1, Standard_True);
+ for ( ; Exp.More(); Exp.Next(), aPS.Next()) {
+ if (!aPS.More())
+ {
+ return;
+ }
const TopoDS_Edge& E = TopoDS::Edge(Exp.Current());
if (!myMapEdgeType.IsBound(E)) {
BRepOffset_ListOfInterval LI;
}
}
- TreatTangentFaces (aLETang);
+ TreatTangentFaces (aLETang, aPSOuter.Next());
+ if (!aPSOuter.More())
+ {
+ return;
+ }
myDone = Standard_True;
}
//function : Generated
//purpose :
//=======================================================================
-void BRepOffset_Analyse::TreatTangentFaces (const TopTools_ListOfShape& theLE)
+void BRepOffset_Analyse::TreatTangentFaces (const TopTools_ListOfShape& theLE, const Message_ProgressRange& theRange)
{
if (theLE.IsEmpty() || myFaceOffsetMap.IsEmpty())
{
// Bind vertices of the tangent edges with connected edges
// of the face with smaller offset value
TopTools_DataMapOfShapeShape aDMVEMin;
- for (TopTools_ListOfShape::Iterator it (theLE); it.More(); it.Next())
+ Message_ProgressScope aPSOuter(theRange, NULL, 3);
+ Message_ProgressScope aPS1(aPSOuter.Next(), "Binding vertices with connected edges", theLE.Size());
+ for (TopTools_ListOfShape::Iterator it (theLE); it.More(); it.Next(), aPS1.Next())
{
+ if (!aPS1.More())
+ {
+ return;
+ }
const TopoDS_Shape& aE = it.Value();
const TopTools_ListOfShape& aLA = Ancestors (aE);
// Create map of Face ancestors for the vertices on tangent edges
TopTools_DataMapOfShapeListOfShape aDMVFAnc;
- for (TopTools_ListOfShape::Iterator itE (theLE); itE.More(); itE.Next())
+ Message_ProgressScope aPS2(aPSOuter.Next(), "Creating map of Face ancestors", theLE.Size());
+ for (TopTools_ListOfShape::Iterator itE (theLE); itE.More(); itE.Next(), aPS2.Next())
{
+ if (!aPS2.More())
+ {
+ return;
+ }
const TopoDS_Shape& aE = itE.Value();
if (!anEdgeOffsetMap.IsBound (aE))
continue;
BOPTools_AlgoTools::MakeConnexityBlocks (aCETangent, TopAbs_VERTEX, TopAbs_EDGE, aLCB, aMVEMap);
// Analyze each block to find co-planar edges
- for (TopTools_ListOfListOfShape::Iterator itLCB (aLCB); itLCB.More(); itLCB.Next())
+ Message_ProgressScope aPS3(aPSOuter.Next(), "Analyzing blocks to find co-planar edges", aLCB.Size());
+ for (TopTools_ListOfListOfShape::Iterator itLCB (aLCB); itLCB.More(); itLCB.Next(), aPS3.Next())
{
+ if (!aPS3.More())
+ {
+ return;
+ }
const TopTools_ListOfShape& aCB = itLCB.Value();
TopTools_MapOfShape aMFence;
#include <TopTools_DataMapOfShapeShape.hxx>
#include <TopTools_ListOfShape.hxx>
#include <TopTools_MapOfShape.hxx>
+
+#include <Message_ProgressRange.hxx>
+
class TopoDS_Shape;
class TopoDS_Edge;
class TopoDS_Vertex;
//! Performs the analysis
Standard_EXPORT void Perform (const TopoDS_Shape& theS,
- const Standard_Real theAngle);
+ const Standard_Real theAngle,
+ const Message_ProgressRange& theRange = Message_ProgressRange());
public: //! @name Results
//! Treatment of the tangential cases.
//! @param theEdges List of edges connecting tangent faces
- Standard_EXPORT void TreatTangentFaces (const TopTools_ListOfShape& theEdges);
+ Standard_EXPORT void TreatTangentFaces (const TopTools_ListOfShape& theEdges, const Message_ProgressRange& theRange);
private: //! @name Fields
BRepOffset_NotConnectedShell,
BRepOffset_CannotTrimEdges, //!< exception while trim edges
BRepOffset_CannotFuseVertices, //!< exception while fuse vertices
- BRepOffset_CannotExtentEdge //!< exception while extent edges
+ BRepOffset_CannotExtentEdge, //!< exception while extent edges
+ BRepOffset_UserBreak //!< user break
};
#endif // _BRepOffset_Error_HeaderFile
const TopTools_IndexedMapOfShape& NewEdges,
const Standard_Real Tol,
const TopTools_DataMapOfShapeListOfShape& theEdgeIntEdges,
- TopTools_IndexedDataMapOfShapeListOfShape& theDMVV)
+ TopTools_IndexedDataMapOfShapeListOfShape& theDMVV,
+ const Message_ProgressRange& theRange)
{
#ifdef DRAW
NbF2d++;
Standard_Integer j, i = 1;
BRepAdaptor_Surface BAsurf(F);
//
- for ( it1LE.Initialize(LE) ; it1LE.More(); it1LE.Next()) {
+ Message_ProgressScope aPS(theRange, "Intersecting edges on faces", LE.Size());
+ for ( it1LE.Initialize(LE) ; it1LE.More(); it1LE.Next(), aPS.Next()) {
+ if (!aPS.More())
+ {
+ return;
+ }
const TopoDS_Edge& E1 = TopoDS::Edge(it1LE.Value());
j = 1;
it2LE.Initialize(LE);
TopTools_IndexedMapOfShape& FacesWithVerts,
BRepAlgo_Image& theImageVV,
TopTools_DataMapOfShapeListOfShape& theEdgeIntEdges,
- TopTools_IndexedDataMapOfShapeListOfShape& theDMVV)
+ TopTools_IndexedDataMapOfShapeListOfShape& theDMVV,
+ const Message_ProgressRange& theRange)
{
TopTools_DataMapOfShapeListOfShape MVE;
BRepOffset_Tool::MapVertexEdges(FI,MVE);
-
+ Message_ProgressScope aPS(theRange, "Intersecting edges obtained as intersection of faces", 1, Standard_True);
//---------------------
// Extension of edges.
//---------------------
TopoDS_Edge NE;
TopTools_DataMapIteratorOfDataMapOfShapeListOfShape it(MVE);
for ( ; it.More(); it.Next()) {
+ if (!aPS.More())
+ {
+ return Standard_False;
+ }
const TopTools_ListOfShape& L = it.Value();
Standard_Boolean YaBuild = 0;
TopTools_ListIteratorOfListOfShape itL(L);
if (MES.IsBound(FIO)) FIO = TopoDS::Face(MES(FIO));
//
BRepAdaptor_Surface BAsurf(FIO);
-
+
TopExp_Explorer exp(FI.Oriented(TopAbs_FORWARD),TopAbs_WIRE);
- for (; exp.More(); exp.Next()) {
+ for (; exp.More(); exp.Next(), aPS.Next()) {
+ if (!aPS.More())
+ {
+ return Standard_False;
+ }
const TopoDS_Wire& W = TopoDS::Wire(exp.Current());
BRepTools_WireExplorer wexp;
Standard_Boolean end = Standard_False ;
const Handle(BRepAlgo_AsDes)& AsDes2d,
const Standard_Real Tol,
const BRepOffset_Analyse& Analyse,
- TopTools_IndexedDataMapOfShapeListOfShape& theDMVV)
+ TopTools_IndexedDataMapOfShapeListOfShape& theDMVV,
+ const Message_ProgressRange& theRange)
{
TopoDS_Face FIO = TopoDS::Face(OFI.Face());
if (MES.IsBound(FIO)) FIO = TopoDS::Face(MES(FIO));
//
BRepAdaptor_Surface BAsurf(FIO);
//
+ Message_ProgressScope aPS(theRange, "Intersecting edges created from vertices", 1, Standard_True);
TopExp_Explorer exp(FI.Oriented(TopAbs_FORWARD),TopAbs_WIRE);
- for (; exp.More(); exp.Next()) {
+ for (; exp.More(); exp.Next(), aPS.Next()) {
+ if (!aPS.More())
+ {
+ return;
+ }
const TopoDS_Wire& W = TopoDS::Wire(exp.Current());
//
BRepTools_WireExplorer wexp;
#include <TopTools_DataMapOfShapeShape.hxx>
#include <TopTools_DataMapOfShapeListOfShape.hxx>
#include <TopTools_IndexedDataMapOfShapeListOfShape.hxx>
+#include <Message_ProgressRange.hxx>
class BRepAlgo_AsDes;
class BRepAlgo_Image;
const TopTools_IndexedMapOfShape& NewEdges,
const Standard_Real Tol,
const TopTools_DataMapOfShapeListOfShape& theEdgeIntEdges,
- TopTools_IndexedDataMapOfShapeListOfShape& theDMVV);
+ TopTools_IndexedDataMapOfShapeListOfShape& theDMVV,
+ const Message_ProgressRange& theRange);
//! Computes the intersection between the offset edges of the <FI>.
//! All intersection vertices will be stored in AsDes2d.
TopTools_IndexedMapOfShape& FacesWithVerts,
BRepAlgo_Image& theImageVV,
TopTools_DataMapOfShapeListOfShape& theEdgeIntEdges,
- TopTools_IndexedDataMapOfShapeListOfShape& theDMVV);
+ TopTools_IndexedDataMapOfShapeListOfShape& theDMVV,
+ const Message_ProgressRange& theRange);
//! Computes the intersection between the offset edges generated
//! from vertices and stored into AsDes as descendants of the <FI>.
const Handle(BRepAlgo_AsDes)& AsDes2d,
const Standard_Real Tol,
const BRepOffset_Analyse& Analyse,
- TopTools_IndexedDataMapOfShapeListOfShape& theDMVV);
+ TopTools_IndexedDataMapOfShapeListOfShape& theDMVV,
+ const Message_ProgressRange& theRange);
//! Fuses the chains of vertices in the theDMVV
//! and updates AsDes by replacing the old vertices
//purpose :
//=======================================================================
-void BRepOffset_Inter3d::CompletInt(const TopTools_ListOfShape& SetOfFaces,
- const BRepAlgo_Image& InitOffsetFace)
+void BRepOffset_Inter3d::CompletInt (const TopTools_ListOfShape& SetOfFaces,
+ const BRepAlgo_Image& InitOffsetFace,
+ const Message_ProgressRange& theRange)
{
//---------------------------------------------------------------
// Calculate the intersections of offset faces
// Treat the selected pairs
const std::vector<BOPTools_BoxPairSelector::PairIDs>& aPairs = aSelector.Pairs();
const Standard_Integer aNbPairs = static_cast<Standard_Integer> (aPairs.size());
-
- for (Standard_Integer iPair = 0; iPair < aNbPairs; ++iPair)
+ Message_ProgressScope aPS(theRange, "Complete intersection", aNbPairs);
+ for (Standard_Integer iPair = 0; iPair < aNbPairs; ++iPair, aPS.Next())
{
+ if (!aPS.More())
+ {
+ return;
+ }
const BOPTools_BoxPairSelector::PairIDs& aPair = aPairs[iPair];
const TopoDS_Face& aF1 = TopoDS::Face (aMFaces.FindKey (Min (aPair.ID1, aPair.ID2)));
//=======================================================================
void BRepOffset_Inter3d::ConnexIntByArc(const TopTools_ListOfShape& /*SetOfFaces*/,
- const TopoDS_Shape& ShapeInit,
- const BRepOffset_Analyse& Analyse,
- const BRepAlgo_Image& InitOffsetFace)
+ const TopoDS_Shape& ShapeInit,
+ const BRepOffset_Analyse& Analyse,
+ const BRepAlgo_Image& InitOffsetFace,
+ const Message_ProgressRange& theRange)
{
ChFiDS_TypeOfConcavity OT = ChFiDS_Concave;
if (mySide == TopAbs_OUT) OT = ChFiDS_Convex;
TopoDS_Face F1,F2;
TopoDS_Edge NullEdge;
TopoDS_Face NullFace;
-
+ Message_ProgressScope aPSOuter(theRange, NULL, 2);
+ Message_ProgressScope aPSIntF(aPSOuter.Next(), "Intersecting offset faces", 1, Standard_True);
//---------------------------------------------------------------------
// etape 1 : Intersection of faces // corresponding to the initial faces
// separated by a concave edge if offset > 0, otherwise convex.
//---------------------------------------------------------------------
- for (; Exp.More(); Exp.Next()) {
+ for (; Exp.More(); Exp.Next(), aPSIntF.Next()) {
+ if (!aPSIntF.More())
+ {
+ return;
+ }
const TopoDS_Edge& E = TopoDS::Edge(Exp.Current());
const BRepOffset_ListOfInterval& L = Analyse.Type(E);
if (!L.IsEmpty() && L.First().Type() == OT) {
//---------------------------------------------------------------------
TopoDS_Vertex V[2];
TopTools_ListIteratorOfListOfShape it;
-
- for (Exp.Init(ShapeInit,TopAbs_EDGE); Exp.More(); Exp.Next()) {
+ Message_ProgressScope aPSIntT(aPSOuter.Next(), "Intersecting tubes", 1, Standard_True);
+ for (Exp.Init(ShapeInit,TopAbs_EDGE); Exp.More(); Exp.Next(), aPSIntT.Next()) {
+ if (!aPSIntT.More())
+ {
+ return;
+ }
const TopoDS_Edge& E1 = TopoDS::Edge(Exp.Current());
if (InitOffsetFace.HasImage(E1)) {
//---------------------------
TopTools_DataMapOfShapeShape& MES,
TopTools_DataMapOfShapeShape& Build,
TopTools_ListOfShape& Failed,
+ const Message_ProgressRange& theRange,
const Standard_Boolean bIsPlanar)
{
TopTools_IndexedMapOfShape VEmap;
//
TopExp::MapShapes (SI, TopAbs_EDGE, VEmap);
// Take the vertices for treatment
+ Message_ProgressScope aPSOuter(theRange, NULL, 10);
if (bIsPlanar)
{
aNb = VEmap.Extent();
// Analyze faces connected through vertices
for (i = aNb + 1, aNb = VEmap.Extent(); i <= aNb; ++i)
{
+ if (!aPSOuter.More())
+ {
+ return;
+ }
const TopoDS_Shape& aS = VEmap(i);
if (aS.ShapeType() != TopAbs_VERTEX)
continue;
}
//
aNb = VEmap.Extent();
- for (i = 1; i <= aNb; ++i) {
+ Message_ProgressScope aPSInter(aPSOuter.Next(8), "Intersecting offset faces", aNb);
+ for (i = 1; i <= aNb; ++i, aPSInter.Next()) {
+ if (!aPSInter.More())
+ {
+ return;
+ }
const TopoDS_Shape& aS = VEmap(i);
//
TopoDS_Edge E;
//
// create unique intersection for each localized shared part
aNb = aDMIntE.Extent();
- for (i = 1; i <= aNb; ++i) {
+ Message_ProgressScope aPSPostTreat(aPSOuter.Next(2), "Creating unique intersection", aNb);
+ for (i = 1; i <= aNb; ++i, aPSPostTreat.Next()) {
+ if (!aPSPostTreat.More())
+ {
+ return;
+ }
const TopTools_ListOfShape& aLS = aDMIntE(i);
if (aLS.Extent() < 2) {
continue;
TopTools_DataMapOfShapeShape& MES,
TopTools_DataMapOfShapeShape& Build,
TopTools_ListOfShape& Failed,
+ const Message_ProgressRange& theRange,
const Standard_Boolean bIsPlanar)
{
TopTools_MapOfShape MV;
}
TopAbs_State Side = TopAbs_OUT;
- for (i = 1; i <= aNb; i++) {
+ Message_ProgressScope aPS(theRange, "Intersecting with deepening faces", aNb);
+ for (i = 1; i <= aNb; i++, aPS.Next()) {
+ if (!aPS.More())
+ {
+ return;
+ }
const TopoDS_Face& CF = TopoDS::Face(ContextFaces(i));
if (ExtentContext) WCF = TopoDS::Face(MES(CF));
else WCF = CF;
//function : ContextIntByArc
//purpose :
//=======================================================================
-
void BRepOffset_Inter3d::ContextIntByArc(const TopTools_IndexedMapOfShape& ContextFaces,
const Standard_Boolean InSide,
const BRepOffset_Analyse& Analyse,
const BRepAlgo_Image& InitOffsetFace,
- BRepAlgo_Image& InitOffsetEdge)
-
+ BRepAlgo_Image& InitOffsetEdge,
+ const Message_ProgressRange& theRange)
{
TopTools_ListOfShape LInt1,LInt2;
TopTools_MapOfShape MV;
myTouched.Add(CF);
}
- for (j = 1; j <= ContextFaces.Extent(); j++) {
+ Message_ProgressScope aPS(theRange, "Intersecting with deepening faces", ContextFaces.Extent());
+ for (j = 1; j <= ContextFaces.Extent(); j++, aPS.Next()) {
+ if (!aPS.More())
+ {
+ return;
+ }
const TopoDS_Face& CF = TopoDS::Face(ContextFaces(j));
for (exp.Init(CF.Oriented(TopAbs_FORWARD),TopAbs_EDGE);
exp.More(); exp.Next()) {
}
}
-//=======================================================================
-//function : AddCommonEdges
-//purpose :
-//=======================================================================
-
-void BRepOffset_Inter3d::AddCommonEdges(const TopTools_ListOfShape&)
-{
-}
-
-
//=======================================================================
//function : SetDone
//purpose :
//=======================================================================
-
void BRepOffset_Inter3d::SetDone(const TopoDS_Face& F1,
const TopoDS_Face& F2)
{
myDone(F2).Append(F1);
}
-
//=======================================================================
//function : IsDone
//purpose :
//=======================================================================
-
-Standard_Boolean BRepOffset_Inter3d::IsDone(const TopoDS_Face& F1,
- const TopoDS_Face& F2)
-const
+Standard_Boolean BRepOffset_Inter3d::IsDone(const TopoDS_Face& F1,
+ const TopoDS_Face& F2) const
{
if (myDone.IsBound(F1)) {
TopTools_ListIteratorOfListOfShape it (myDone(F1));
return Standard_False;
}
-
-//=======================================================================
-//function : TouchedFaces
-//purpose :
-//=======================================================================
-
-TopTools_IndexedMapOfShape& BRepOffset_Inter3d::TouchedFaces()
-{
- return myTouched;
-}
-
-
-//=======================================================================
-//function : AsDes
-//purpose :
-//=======================================================================
-
-Handle(BRepAlgo_AsDes) BRepOffset_Inter3d::AsDes() const
-{
- return myAsDes;
-}
-
-
-//=======================================================================
-//function : NewEdges
-//purpose :
-//=======================================================================
-
-TopTools_IndexedMapOfShape& BRepOffset_Inter3d::NewEdges()
-{
- return myNewEdges;
-}
-
-
-
//=======================================================================
//function : Store
//purpose :
//=======================================================================
-
void BRepOffset_Inter3d::Store(const TopoDS_Face& F1,
const TopoDS_Face& F2,
const TopTools_ListOfShape& LInt1,
#ifndef _BRepOffset_Inter3d_HeaderFile
#define _BRepOffset_Inter3d_HeaderFile
+#include <Message_ProgressRange.hxx>
#include <Standard.hxx>
#include <Standard_DefineAlloc.hxx>
#include <Standard_Handle.hxx>
class BRepOffset_Analyse;
-//! Computes the intersection face face in a set of faces
-//! Store the result in a SD as AsDes.
-class BRepOffset_Inter3d
+
+//! Computes the connection of the offset and not offset faces
+//! according to the connection type required.
+//! Store the result in AsDes tool.
+class BRepOffset_Inter3d
{
public:
-
DEFINE_STANDARD_ALLOC
-
- Standard_EXPORT BRepOffset_Inter3d(const Handle(BRepAlgo_AsDes)& AsDes, const TopAbs_State Side, const Standard_Real Tol);
-
- Standard_EXPORT void CompletInt (const TopTools_ListOfShape& SetOfFaces, const BRepAlgo_Image& InitOffsetFace);
-
- Standard_EXPORT void FaceInter (const TopoDS_Face& F1, const TopoDS_Face& F2, const BRepAlgo_Image& InitOffsetFace);
-
- Standard_EXPORT void ConnexIntByArc (const TopTools_ListOfShape& SetOfFaces, const TopoDS_Shape& ShapeInit, const BRepOffset_Analyse& Analyse, const BRepAlgo_Image& InitOffsetFace);
-
- Standard_EXPORT void ConnexIntByInt (const TopoDS_Shape& SI, const BRepOffset_DataMapOfShapeOffset& MapSF, const BRepOffset_Analyse& A, TopTools_DataMapOfShapeShape& MES, TopTools_DataMapOfShapeShape& Build, TopTools_ListOfShape& Failed, const Standard_Boolean bIsPlanar = Standard_False);
-
- Standard_EXPORT void ContextIntByInt (const TopTools_IndexedMapOfShape& ContextFaces, const Standard_Boolean ExtentContext, const BRepOffset_DataMapOfShapeOffset& MapSF, const BRepOffset_Analyse& A, TopTools_DataMapOfShapeShape& MES, TopTools_DataMapOfShapeShape& Build, TopTools_ListOfShape& Failed, const Standard_Boolean bIsPlanar = Standard_False);
-
- Standard_EXPORT void ContextIntByArc (const TopTools_IndexedMapOfShape& ContextFaces, const Standard_Boolean ExtentContext, const BRepOffset_Analyse& Analyse, const BRepAlgo_Image& InitOffsetFace, BRepAlgo_Image& InitOffsetEdge);
-
- Standard_EXPORT void AddCommonEdges (const TopTools_ListOfShape& SetOfFaces);
-
- Standard_EXPORT void SetDone (const TopoDS_Face& F1, const TopoDS_Face& F2);
-
- Standard_EXPORT Standard_Boolean IsDone (const TopoDS_Face& F1, const TopoDS_Face& F2) const;
-
- Standard_EXPORT TopTools_IndexedMapOfShape& TouchedFaces();
-
- Standard_EXPORT Handle(BRepAlgo_AsDes) AsDes() const;
-
- Standard_EXPORT TopTools_IndexedMapOfShape& NewEdges();
-
-
-
+public:
-protected:
+ //! Constructor
+ Standard_EXPORT BRepOffset_Inter3d (const Handle (BRepAlgo_AsDes)& AsDes,
+ const TopAbs_State Side,
+ const Standard_Real Tol);
+
+ // Computes intersection of the given faces among each other
+ Standard_EXPORT void CompletInt (const TopTools_ListOfShape& SetOfFaces,
+ const BRepAlgo_Image& InitOffsetFace,
+ const Message_ProgressRange& theRange);
+
+ //! Computes intersection of pair of faces
+ Standard_EXPORT void FaceInter (const TopoDS_Face& F1,
+ const TopoDS_Face& F2,
+ const BRepAlgo_Image& InitOffsetFace);
+
+ //! Computes connections of the offset faces that have to be connected by arcs.
+ Standard_EXPORT void ConnexIntByArc (const TopTools_ListOfShape& SetOfFaces,
+ const TopoDS_Shape& ShapeInit,
+ const BRepOffset_Analyse& Analyse,
+ const BRepAlgo_Image& InitOffsetFace,
+ const Message_ProgressRange& theRange);
+
+ //! Computes intersection of the offset faces that have to be connected by
+ //! sharp edges, i.e. it computes intersection between extended offset faces.
+ Standard_EXPORT void ConnexIntByInt (const TopoDS_Shape& SI,
+ const BRepOffset_DataMapOfShapeOffset& MapSF,
+ const BRepOffset_Analyse& A,
+ TopTools_DataMapOfShapeShape& MES,
+ TopTools_DataMapOfShapeShape& Build,
+ TopTools_ListOfShape& Failed,
+ const Message_ProgressRange& theRange,
+ const Standard_Boolean bIsPlanar = Standard_False);
+
+ //! Computes intersection with not offset faces .
+ Standard_EXPORT void ContextIntByInt (const TopTools_IndexedMapOfShape& ContextFaces,
+ const Standard_Boolean ExtentContext,
+ const BRepOffset_DataMapOfShapeOffset& MapSF,
+ const BRepOffset_Analyse& A,
+ TopTools_DataMapOfShapeShape& MES,
+ TopTools_DataMapOfShapeShape& Build,
+ TopTools_ListOfShape& Failed,
+ const Message_ProgressRange& theRange,
+ const Standard_Boolean bIsPlanar = Standard_False);
+
+ //! Computes connections of the not offset faces that have to be connected by arcs
+ Standard_EXPORT void ContextIntByArc (const TopTools_IndexedMapOfShape& ContextFaces,
+ const Standard_Boolean ExtentContext,
+ const BRepOffset_Analyse& Analyse,
+ const BRepAlgo_Image& InitOffsetFace,
+ BRepAlgo_Image& InitOffsetEdge,
+ const Message_ProgressRange& theRange);
+
+ //! Marks the pair of faces as already intersected
+ Standard_EXPORT void SetDone (const TopoDS_Face& F1, const TopoDS_Face& F2);
+ //! Checks if the pair of faces has already been treated.
+ Standard_EXPORT Standard_Boolean IsDone (const TopoDS_Face& F1,
+ const TopoDS_Face& F2) const;
+ //! Returns touched faces
+ TopTools_IndexedMapOfShape& TouchedFaces() { return myTouched; };
+ //! Returns AsDes tool
+ Handle (BRepAlgo_AsDes) AsDes() const { return myAsDes; }
+ //! Returns new edges
+ TopTools_IndexedMapOfShape& NewEdges() { return myNewEdges; }
private:
-
- Standard_EXPORT void Store (const TopoDS_Face& F1, const TopoDS_Face& F2, const TopTools_ListOfShape& LInt1, const TopTools_ListOfShape& LInt2);
+ //! Stores the intersection results into AsDes
+ Standard_EXPORT void Store (const TopoDS_Face& F1,
+ const TopoDS_Face& F2,
+ const TopTools_ListOfShape& LInt1,
+ const TopTools_ListOfShape& LInt2);
-
- Handle(BRepAlgo_AsDes) myAsDes;
+private:
+ Handle (BRepAlgo_AsDes) myAsDes;
TopTools_IndexedMapOfShape myTouched;
TopTools_DataMapOfShapeListOfShape myDone;
TopTools_IndexedMapOfShape myNewEdges;
TopAbs_State mySide;
Standard_Real myTol;
-
-
};
-
-
-
-
-
-
-
#endif // _BRepOffset_Inter3d_HeaderFile
void BRepOffset_MakeLoops::Build(const TopTools_ListOfShape& LF,
const Handle(BRepAlgo_AsDes)& AsDes,
BRepAlgo_Image& Image,
- BRepAlgo_Image& theImageVV)
+ BRepAlgo_Image& theImageVV,
+ const Message_ProgressRange& theRange)
{
TopTools_ListIteratorOfListOfShape it(LF);
TopTools_ListIteratorOfListOfShape itl,itLCE;
BRepAlgo_Loop Loops;
Loops.VerticesForSubstitute( myVerVerMap );
Loops.SetImageVV (theImageVV);
-
- for (; it.More(); it.Next()) {
+ Message_ProgressScope aPSOuter(theRange, NULL, 2);
+ Message_ProgressScope aPS1(aPSOuter.Next(), "Init loops", LF.Size());
+ for (; it.More(); it.Next(), aPS1.Next()) {
+ if (!aPS1.More())
+ {
+ return;
+ }
const TopoDS_Face& F = TopoDS::Face(it.Value());
//---------------------------
// Initialization of Loops.
if (myVerVerMap.IsEmpty())
return;
BRep_Builder BB;
- for (it.Initialize( LF ); it.More(); it.Next())
+ Message_ProgressScope aPS2(aPSOuter.Next(), "Building loops", LF.Size());
+ for (it.Initialize(LF); it.More(); it.Next(), aPS2.Next())
+ {
+ if (!aPS2.More())
{
- TopoDS_Shape F = it.Value();
- TopTools_ListOfShape LIF;
- Image.LastImage( F, LIF );
- for (itl.Initialize(LIF); itl.More(); itl.Next())
- {
- const TopoDS_Shape& IF = itl.Value();
- TopExp_Explorer EdExp( IF, TopAbs_EDGE );
- for (; EdExp.More(); EdExp.Next())
- {
- TopoDS_Shape E = EdExp.Current();
- TopTools_ListOfShape VList;
- TopoDS_Iterator VerExp( E );
- for (; VerExp.More(); VerExp.Next())
- VList.Append( VerExp.Value() );
- TopTools_ListIteratorOfListOfShape itlv( VList );
- for (; itlv.More(); itlv.Next())
- {
- const TopoDS_Shape& V = itlv.Value();
- if (myVerVerMap.IsBound( V ))
- {
- TopoDS_Shape NewV = myVerVerMap( V );
- E.Free( Standard_True );
- NewV.Orientation( V.Orientation() );
- Handle(BRep_TVertex)& TV = *((Handle(BRep_TVertex)*) &V.TShape());
- Handle(BRep_TVertex)& NewTV = *((Handle(BRep_TVertex)*) &NewV.TShape());
- if (TV->Tolerance() > NewTV->Tolerance())
- NewTV->Tolerance( TV->Tolerance() );
- NewTV->ChangePoints().Append( TV->ChangePoints() );
- AsDes->Replace( V, NewV );
- BB.Remove( E, V );
- BB.Add( E, NewV );
- }
- }
- }
- }
+ return;
+ }
+ TopoDS_Shape F = it.Value();
+ TopTools_ListOfShape LIF;
+ Image.LastImage(F, LIF);
+ for (itl.Initialize(LIF); itl.More(); itl.Next())
+ {
+ const TopoDS_Shape& IF = itl.Value();
+ TopExp_Explorer EdExp(IF, TopAbs_EDGE);
+ for (; EdExp.More(); EdExp.Next())
+ {
+ TopoDS_Shape E = EdExp.Current();
+ TopTools_ListOfShape VList;
+ TopoDS_Iterator VerExp(E);
+ for (; VerExp.More(); VerExp.Next())
+ VList.Append(VerExp.Value());
+ TopTools_ListIteratorOfListOfShape itlv(VList);
+ for (; itlv.More(); itlv.Next())
+ {
+ const TopoDS_Shape& V = itlv.Value();
+ if (myVerVerMap.IsBound(V))
+ {
+ TopoDS_Shape NewV = myVerVerMap(V);
+ E.Free(Standard_True);
+ NewV.Orientation(V.Orientation());
+ Handle(BRep_TVertex)& TV = *((Handle(BRep_TVertex)*) &V.TShape());
+ Handle(BRep_TVertex)& NewTV = *((Handle(BRep_TVertex)*) &NewV.TShape());
+ if (TV->Tolerance() > NewTV->Tolerance())
+ NewTV->Tolerance(TV->Tolerance());
+ NewTV->ChangePoints().Append(TV->ChangePoints());
+ AsDes->Replace(V, NewV);
+ BB.Remove(E, V);
+ BB.Add(E, NewV);
+ }
+ }
+ }
}
+ }
}
//=======================================================================
//=======================================================================
void BRepOffset_MakeLoops::BuildOnContext(const TopTools_ListOfShape& LContext,
- const BRepOffset_Analyse& Analyse,
- const Handle(BRepAlgo_AsDes)& AsDes,
- BRepAlgo_Image& Image,
- const Standard_Boolean InSide)
+ const BRepOffset_Analyse& Analyse,
+ const Handle(BRepAlgo_AsDes)& AsDes,
+ BRepAlgo_Image& Image,
+ const Standard_Boolean InSide,
+ const Message_ProgressRange& theRange)
{
//-----------------------------------------
// unwinding of caps.
TopExp_Explorer exp;
TopTools_MapOfShape MapExtent;
- for (; it.More(); it.Next()) {
+ Message_ProgressScope aPS(theRange, "Building deepening faces", LContext.Extent());
+ for (; it.More(); it.Next(), aPS.Next()) {
+ if (!aPS.More())
+ {
+ return;
+ }
const TopoDS_Face& F = TopoDS::Face(it.Value());
TopTools_MapOfShape MBound;
//-----------------------------------------------
void BRepOffset_MakeLoops::BuildFaces(const TopTools_ListOfShape& LF,
const Handle(BRepAlgo_AsDes)& AsDes,
- BRepAlgo_Image& Image)
+ BRepAlgo_Image& Image,
+ const Message_ProgressRange& theRange)
{
TopTools_ListIteratorOfListOfShape itr,itl,itLCE;
Standard_Boolean ToRebuild;
//----------------------------------
// Loop on all faces //.
//----------------------------------
- for (itr.Initialize(LF); itr.More(); itr.Next()) {
+ Message_ProgressScope aPS(theRange, "Building faces", LF.Size());
+ for (itr.Initialize(LF); itr.More(); itr.Next(), aPS.Next()) {
+ if (!aPS.More())
+ {
+ return;
+ }
TopoDS_Face F = TopoDS::Face(itr.Value());
Loops.Init(F);
ToRebuild = Standard_False;
#ifndef _BRepOffset_MakeLoops_HeaderFile
#define _BRepOffset_MakeLoops_HeaderFile
+#include <Message_ProgressRange.hxx>
+
#include <Standard.hxx>
#include <Standard_DefineAlloc.hxx>
#include <Standard_Handle.hxx>
Standard_EXPORT void Build (const TopTools_ListOfShape& LF,
const Handle(BRepAlgo_AsDes)& AsDes,
BRepAlgo_Image& Image,
- BRepAlgo_Image& theImageVV);
+ BRepAlgo_Image& theImageVV,
+ const Message_ProgressRange& theRange);
Standard_EXPORT void BuildOnContext (const TopTools_ListOfShape& LContext,
const BRepOffset_Analyse& Analyse,
const Handle(BRepAlgo_AsDes)& AsDes,
BRepAlgo_Image& Image,
- const Standard_Boolean InSide);
+ const Standard_Boolean InSide,
+ const Message_ProgressRange& theRange);
Standard_EXPORT void BuildFaces (const TopTools_ListOfShape& LF,
const Handle(BRepAlgo_AsDes)& AsDes,
- BRepAlgo_Image& Image);
+ BRepAlgo_Image& Image,
+ const Message_ProgressRange& theRange);
}
#endif
+namespace
+{
+ //=======================================================================
+ //function : BRepOffset_PIOperation
+ //purpose : List of operations to be supported by the Progress Indicator
+ //=======================================================================
+ enum BRepOffset_PIOperation
+ {
+ PIOperation_CheckInputData = 0,
+ PIOperation_Analyse,
+ PIOperation_BuildOffsetBy,
+ PIOperation_Intersection,
+ PIOperation_MakeMissingWalls,
+ PIOperation_MakeShells,
+ PIOperation_MakeSolid,
+ PIOperation_Sewing,
+ PIOperation_Last
+ };
+
+ //=======================================================================
+ //function : normalizeSteps
+ //purpose : Normalization of progress steps
+ //=======================================================================
+ static void normalizeSteps(const Standard_Real theWhole,
+ TColStd_Array1OfReal& theSteps)
+ {
+ Standard_Real aSum = 0.;
+ for (Standard_Integer i = theSteps.Lower(); i <= theSteps.Upper(); ++i)
+ {
+ aSum += theSteps(i);
+ }
+
+ // Normalize steps
+ for (Standard_Integer i = theSteps.Lower(); i <= theSteps.Upper(); ++i)
+ {
+ theSteps(i) = theWhole * theSteps(i) / aSum;
+ }
+ }
+
+}
//=======================================================================
// static methods
static
Standard_Boolean BuildShellsCompleteInter(const TopTools_ListOfShape& theLF,
BRepAlgo_Image& theImage,
- TopoDS_Shape& theShells);
+ TopoDS_Shape& theShells,
+ const Message_ProgressRange& theRange);
static
Standard_Boolean GetSubShapes(const TopoDS_Shape& theShape,
BRepOffset_MakeOffset::BRepOffset_MakeOffset(const TopoDS_Shape& S,
const Standard_Real Offset,
- const Standard_Real Tol,
+ const Standard_Real Tol,
const BRepOffset_Mode Mode,
const Standard_Boolean Inter,
const Standard_Boolean SelfInter,
const GeomAbs_JoinType Join,
const Standard_Boolean Thickening,
- const Standard_Boolean RemoveIntEdges)
+ const Standard_Boolean RemoveIntEdges,
+ const Message_ProgressRange& theRange)
:
myOffset (Offset),
myTol (Tol),
myAsDes = new BRepAlgo_AsDes();
myIsLinearizationAllowed = Standard_True;
- MakeOffsetShape();
+ MakeOffsetShape(theRange);
}
//purpose :
//=======================================================================
-void BRepOffset_MakeOffset::MakeOffsetShape()
+void BRepOffset_MakeOffset::MakeOffsetShape(const Message_ProgressRange& theRange)
{
myDone = Standard_False;
//
RemoveCorks (myFaceComp, myFaces);
}
- if (!CheckInputData())
+ Message_ProgressScope aPS(theRange, "Making offset shape", 100);
+
+ TColStd_Array1OfReal aSteps(0, PIOperation_Last - 1);
+ analyzeProgress(100., aSteps);
+
+ if (!CheckInputData(aPS.Next(aSteps(PIOperation_CheckInputData))) || myError != BRepOffset_NoError)
{
// There is error in input data.
// Check Error() method.
myAnalyse.SetOffsetValue (myOffset);
myAnalyse.SetFaceOffsetMap (myFaceOffset);
}
- myAnalyse.Perform(myFaceComp,TolAngle);
+ myAnalyse.Perform(myFaceComp,TolAngle, aPS.Next(aSteps(PIOperation_Analyse)));
+ if (!aPS.More())
+ {
+ myError = BRepOffset_UserBreak;
+ return;
+ }
//---------------------------------------------------
// Construction of Offset from preanalysis.
//---------------------------------------------------
UpdateFaceOffset();
if (myJoin == GeomAbs_Arc)
- BuildOffsetByArc();
+ BuildOffsetByArc(aPS.Next(aSteps(PIOperation_BuildOffsetBy)));
else if (myJoin == GeomAbs_Intersection)
- BuildOffsetByInter();
+ BuildOffsetByInter(aPS.Next(aSteps(PIOperation_BuildOffsetBy)));
if (myError != BRepOffset_NoError)
{
return;
//-----------------
// Intersection 3d .
//-----------------
+ Message_ProgressScope aPSInter(aPS.Next(aSteps(PIOperation_Intersection)), NULL, 100);
+ aPSInter.SetName((myJoin == GeomAbs_Arc) ? "Connect offset faces by arc" :
+ "Connect offset faces by intersection");
+
BRepOffset_Inter3d Inter(myAsDes,Side,myTol);
- Intersection3D (Inter);
+ Intersection3D (Inter, aPSInter.Next(90));
+ if (myError != BRepOffset_NoError)
+ {
+ return;
+ }
//-----------------
// Intersection2D
//-----------------
TopTools_IndexedMapOfShape& Modif = Inter.TouchedFaces();
TopTools_IndexedMapOfShape& NewEdges = Inter.NewEdges();
- if (!Modif.IsEmpty()) Intersection2D (Modif,NewEdges);
+ if (!Modif.IsEmpty())
+ {
+ Intersection2D(Modif, NewEdges, aPSInter.Next(4));
+ if (myError != BRepOffset_NoError)
+ {
+ return;
+ }
+ }
+
//-------------------------------------------------------
// Unwinding 2D and reconstruction of modified faces
//----------------------------------------------------
- MakeLoops (Modif);
+ MakeLoops (Modif, aPSInter.Next(4));
+ if (myError != BRepOffset_NoError)
+ {
+ return;
+ }
//-----------------------------------------------------
// Reconstruction of non modified faces sharing
// reconstructed edges
//------------------------------------------------------
- if (!Modif.IsEmpty()) MakeFaces (Modif);
+ if (!Modif.IsEmpty())
+ {
+ MakeFaces(Modif, aPSInter.Next(2));
+ if (myError != BRepOffset_NoError)
+ {
+ return;
+ }
+ }
+
+ aPSInter.Close();
if (myThickening)
- MakeMissingWalls();
+ {
+ MakeMissingWalls(aPS.Next(aSteps(PIOperation_MakeMissingWalls)));
+ if (myError != BRepOffset_NoError)
+ {
+ return;
+ }
+ }
//-------------------------
// Construction of shells.
//-------------------------
- MakeShells ();
+ MakeShells (aPS.Next(aSteps(PIOperation_MakeShells)));
+ if (myError != BRepOffset_NoError)
+ {
+ return;
+ }
if (myOffsetShape.IsNull()) {
// not done
myDone = Standard_False;
//----------------------
// Creation of solids.
//----------------------
- MakeSolid ();
-
+ MakeSolid (aPS.Next(aSteps(PIOperation_MakeSolid)));
+ if (myError != BRepOffset_NoError)
+ {
+ return;
+ }
//-----------------------------
// MAJ Tolerance edge and Vertex
// ----------------------------
{
BRepBuilderAPI_Sewing aSew(myTol);
aSew.Add(myOffsetShape);
- aSew.Perform();
+ aSew.Perform(aPS.Next(aSteps(PIOperation_Sewing) / 2.));
+ if (!aPS.More())
+ {
+ myError = BRepOffset_UserBreak;
+ return;
+ }
myOffsetShape = aSew.SewedShape();
// Rebuild solid.
// Offset shape expected to be really closed after sewing.
myOffsetShape.Closed(Standard_True);
- MakeSolid();
+ MakeSolid(aPS.Next(aSteps(PIOperation_Sewing) / 2.));
+ if (myError != BRepOffset_NoError)
+ {
+ return;
+ }
}
myDone = Standard_True;
//purpose :
//=======================================================================
-void BRepOffset_MakeOffset::MakeThickSolid()
+void BRepOffset_MakeOffset::MakeThickSolid(const Message_ProgressRange& theRange)
{
//--------------------------------------------------------------
// Construction of shell parallel to shell (initial without cap).
//--------------------------------------------------------------
- MakeOffsetShape ();
+ MakeOffsetShape (theRange);
if (!myDone)
{
//function : MakeOffsetFaces
//purpose :
//=======================================================================
-void BRepOffset_MakeOffset::MakeOffsetFaces(BRepOffset_DataMapOfShapeOffset& theMapSF)
+void BRepOffset_MakeOffset::MakeOffsetFaces(BRepOffset_DataMapOfShapeOffset& theMapSF, const Message_ProgressRange& theRange)
{
Standard_Real aCurOffset;
TopTools_ListOfShape aLF;
//
BRepLib::SortFaces(myFaceComp, aLF);
//
+ Message_ProgressScope aPS(theRange, "Making offset faces", aLF.Size());
aItLF.Initialize(aLF);
- for (; aItLF.More(); aItLF.Next()) {
+ for (; aItLF.More(); aItLF.Next(), aPS.Next()) {
+ if (!aPS.More())
+ {
+ myError = BRepOffset_UserBreak;
+ return;
+ }
const TopoDS_Face& aF = TopoDS::Face(aItLF.Value());
aCurOffset = myFaceOffset.IsBound(aF) ? myFaceOffset(aF) : myOffset;
BRepOffset_Offset OF(aF, aCurOffset, ShapeTgt, OffsetOutside, myJoin);
//function : BuildOffsetByInter
//purpose :
//=======================================================================
-void BRepOffset_MakeOffset::BuildOffsetByInter()
+void BRepOffset_MakeOffset::BuildOffsetByInter(const Message_ProgressRange& theRange)
{
#ifdef OCCT_DEBUG
if ( ChronBuild) {
}
#endif
+ Message_ProgressScope aPSOuter(theRange, "Connect offset faces by intersection", 100);
+ // just for better management and visualization of the progress steps
+ // define a nested enum listing all the steps of the current method.
+ enum BuildOffsetByInter_PISteps
+ {
+ BuildOffsetByInter_MakeOffsetFaces = 0,
+ BuildOffsetByInter_ConnexIntByInt,
+ BuildOffsetByInter_ContextIntByInt,
+ BuildOffsetByInter_IntersectEdges,
+ BuildOffsetByInter_CompleteEdgesIntersection,
+ BuildOffsetByInter_BuildFaces,
+ BuildOffsetByInter_FillHistoryForOffsets,
+ BuildOffsetByInter_FillHistoryForDeepenings,
+ BuildOffsetByInter_Last
+ };
+
+ Standard_Real aNbFaces = myFaceComp.NbChildren() + myAnalyse.NewFaces().Extent() + myFaces.Extent();
+ Standard_Real anOffsetsPart = (myFaceComp.NbChildren() + myAnalyse.NewFaces().Extent()) / aNbFaces;
+ Standard_Real aDeepeningsPart = myFaces.Extent() / aNbFaces;
+
+ TColStd_Array1OfReal aSteps(0, BuildOffsetByInter_Last - 1);
+ {
+ aSteps.Init(0);
+
+ Standard_Boolean isInter = myJoin == GeomAbs_Intersection;
+ Standard_Real aFaceInter = isInter ? 25. : 50.;
+ Standard_Real aBuildFaces = isInter ? 50. : 25.;
+ aSteps(BuildOffsetByInter_MakeOffsetFaces) = 5.;
+ aSteps(BuildOffsetByInter_ConnexIntByInt) = aFaceInter * anOffsetsPart;
+ aSteps(BuildOffsetByInter_ContextIntByInt) = aFaceInter * aDeepeningsPart;
+ aSteps(BuildOffsetByInter_IntersectEdges) = 10.;
+ aSteps(BuildOffsetByInter_CompleteEdgesIntersection) = 5.;
+ aSteps(BuildOffsetByInter_BuildFaces) = aBuildFaces;
+ aSteps(BuildOffsetByInter_FillHistoryForOffsets) = 5. * anOffsetsPart;
+ aSteps(BuildOffsetByInter_FillHistoryForDeepenings) = 5. * aDeepeningsPart;
+ normalizeSteps(100., aSteps);
+ }
+
TopExp_Explorer Exp, Exp2, ExpC;
TopTools_ListIteratorOfListOfShape itLF;
-
+
//--------------------------------------------------------
// Construction of faces parallel to initial faces
//--------------------------------------------------------
BRepOffset_DataMapOfShapeOffset MapSF;
- MakeOffsetFaces(MapSF);
+ MakeOffsetFaces(MapSF, aPSOuter.Next(aSteps(BuildOffsetByInter_MakeOffsetFaces)));
+ if (!aPSOuter.More())
+ {
+ myError = BRepOffset_UserBreak;
+ return;
+ }
//--------------------------------------------------------------------
// MES : Map of OffsetShape -> Extended Shapes.
// Build : Map of Initial SS -> OffsetShape build by Inter.
BRepOffset_Inter3d Inter3 (AsDes,Side,myTol);
// Intersection between parallel faces
- Inter3.ConnexIntByInt(myFaceComp,MapSF,myAnalyse,MES,Build,Failed,myIsPlanar);
+ Inter3.ConnexIntByInt(myFaceComp, MapSF, myAnalyse, MES, Build, Failed,
+ aPSOuter.Next(aSteps(BuildOffsetByInter_ConnexIntByInt)), myIsPlanar);
+ if (!aPSOuter.More())
+ {
+ myError = BRepOffset_UserBreak;
+ return;
+ }
// Intersection with caps.
- Inter3.ContextIntByInt(myFaces,ExtentContext,MapSF,myAnalyse,MES,Build,Failed,myIsPlanar);
+ Inter3.ContextIntByInt(myFaces, ExtentContext, MapSF, myAnalyse, MES, Build, Failed,
+ aPSOuter.Next(aSteps(BuildOffsetByInter_ContextIntByInt)), myIsPlanar);
+ if (!aPSOuter.More())
+ {
+ myError = BRepOffset_UserBreak;
+ return;
+ }
TopTools_ListOfShape aLFaces;
for (Exp.Init(myFaceComp,TopAbs_FACE) ; Exp.More(); Exp.Next())
// Extension of neighbor edges of new edges and intersection between neighbors.
//--------------------------------------------------------------------------------
Handle(BRepAlgo_AsDes) AsDes2d = new BRepAlgo_AsDes();
- IntersectEdges(aLFaces, MapSF, MES, Build, AsDes, AsDes2d);
+ IntersectEdges(aLFaces, MapSF, MES, Build, AsDes, AsDes2d,
+ aPSOuter.Next(aSteps(BuildOffsetByInter_IntersectEdges)));
if (myError != BRepOffset_NoError)
{
return;
//Map of edges obtained after FACE-FACE (offsetted) intersection.
//Key1 is edge trimmed by intersection points with other edges;
//Item is not-trimmed edge.
- if (!TrimEdges(myFaceComp, myOffset, myAnalyse, MapSF, MES, Build, AsDes, AsDes2d, NewEdges, aETrimEInf, anEdgesOrigins))
+ if (!TrimEdges(myFaceComp, myOffset, myAnalyse, MapSF, MES, Build,
+ AsDes, AsDes2d, NewEdges, aETrimEInf, anEdgesOrigins))
{
myError = BRepOffset_CannotTrimEdges;
return;
GetEnlargedFaces(aLFaces, MapSF, MES, aFacesOrigins, IMOE, LFE);
//
TopTools_ListIteratorOfListOfShape itLFE(LFE);
+ Message_ProgressScope aPS2d(aPSOuter.Next(aSteps(BuildOffsetByInter_CompleteEdgesIntersection)), NULL, 2);
+ Message_ProgressScope aPS2dOffsets(aPS2d.Next(2. * anOffsetsPart), NULL, LFE.Size());
for (; itLFE.More(); itLFE.Next())
{
+ if (!aPS2dOffsets.More())
+ {
+ myError = BRepOffset_UserBreak;
+ return;
+ }
const TopoDS_Face& NEF = TopoDS::Face(itLFE.Value());
Standard_Real aCurrFaceTol = BRep_Tool::Tolerance(NEF);
- BRepOffset_Inter2d::Compute(AsDes, NEF, NewEdges, aCurrFaceTol, myEdgeIntEdges, aDMVV);
+ BRepOffset_Inter2d::Compute(AsDes, NEF, NewEdges, aCurrFaceTol, myEdgeIntEdges, aDMVV, aPS2dOffsets.Next());
}
//----------------------------------------------
// Intersections 2d on caps.
//----------------------------------------------
Standard_Integer i;
+ Message_ProgressScope aPS2dCaps(aPS2d.Next(2. * aDeepeningsPart), NULL, myFaces.Extent());
for (i = 1; i <= myFaces.Extent(); i++)
{
+ if (!aPS2dCaps.More())
+ {
+ myError = BRepOffset_UserBreak;
+ return;
+ }
const TopoDS_Face& Cork = TopoDS::Face(myFaces(i));
Standard_Real aCurrFaceTol = BRep_Tool::Tolerance(Cork);
- BRepOffset_Inter2d::Compute(AsDes, Cork, NewEdges, aCurrFaceTol, myEdgeIntEdges, aDMVV);
+ BRepOffset_Inter2d::Compute(AsDes, Cork, NewEdges, aCurrFaceTol, myEdgeIntEdges, aDMVV, aPS2dCaps.Next());
}
//
BRepOffset_Inter2d::FuseVertices(aDMVV, AsDes, myImageVV);
TopTools_MapOfShape aMFDone;
//
if ((myJoin == GeomAbs_Intersection) && myInter && myIsPlanar) {
- BuildSplitsOfExtendedFaces(LFE, myAnalyse, AsDes, anEdgesOrigins, aFacesOrigins, aETrimEInf, IMOE);
+ BuildSplitsOfExtendedFaces(LFE, myAnalyse, AsDes, anEdgesOrigins, aFacesOrigins, aETrimEInf,
+ IMOE, aPSOuter.Next(aSteps(BuildOffsetByInter_BuildFaces)));
+ if (myError != BRepOffset_NoError)
+ {
+ return;
+ }
//
TopTools_ListIteratorOfListOfShape aItLF(LFE);
for (; aItLF.More(); aItLF.Next()) {
}
}
else {
- myMakeLoops.Build(LFE, AsDes, IMOE, myImageVV);
+ myMakeLoops.Build(LFE, AsDes, IMOE, myImageVV, aPSOuter.Next(aSteps(BuildOffsetByInter_BuildFaces)));
+ if (!aPSOuter.More())
+ {
+ myError = BRepOffset_UserBreak;
+ return;
+ }
}
//
#ifdef OCCT_DEBUG
//---------------------------
// MAJ SD. for faces //
//---------------------------
- for (TopTools_ListOfShape::Iterator it (aLFaces); it.More(); it.Next())
+ Message_ProgressScope aPSHist(aPSOuter.Next(aSteps(BuildOffsetByInter_FillHistoryForOffsets)),
+ "Fill history for offset faces", aLFaces.Size());
+ for (TopTools_ListOfShape::Iterator it (aLFaces); it.More(); it.Next(), aPSHist.Next())
{
+ if (!aPSHist.More())
+ {
+ myError = BRepOffset_UserBreak;
+ return;
+ }
const TopoDS_Shape& FI = it.Value();
myInitOffsetFace.SetRoot(FI);
TopoDS_Face OF = MapSF(FI).Face();
TopoDS_Vertex CV1,CV2;
TopExp::Vertices(COE,CV1,CV2);
if (!CV1.IsNull()) myAsDes->Add(COE,CV1.Oriented(TopAbs_FORWARD));
- if (!CV2.IsNull()) myAsDes->Add(COE,CV2.Oriented(TopAbs_REVERSED));
+ if (!CV2.IsNull()) myAsDes->Add(COE,CV2.Oriented(TopAbs_REVERSED));
}
}
}
// MAJ SD. for caps
//---------------------------
//TopTools_MapOfShape View;
- for (i = 1; i <= myFaces.Extent(); i++) {
+ Message_ProgressScope aPSHist2(aPSOuter.Next(aSteps(BuildOffsetByInter_FillHistoryForDeepenings)),
+ "Fill history for deepening faces", myFaces.Extent());
+ for (i = 1; i <= myFaces.Extent(); i++, aPSHist2.Next()) {
+ if (!aPSHist2.More())
+ {
+ myError = BRepOffset_UserBreak;
+ return;
+ }
const TopoDS_Shape& Cork = myFaces(i);
const TopTools_ListOfShape& LE = AsDes->Descendant(Cork);
for (itLF.Initialize(LE) ; itLF.More(); itLF.Next()) {
TopoDS_Vertex CV1,CV2;
TopExp::Vertices(COE,CV1,CV2);
if (!CV1.IsNull()) myAsDes->Add(COE,CV1.Oriented(TopAbs_FORWARD));
- if (!CV2.IsNull()) myAsDes->Add(COE,CV2.Oriented(TopAbs_REVERSED));
+ if (!CV2.IsNull()) myAsDes->Add(COE,CV2.Oriented(TopAbs_REVERSED));
}
}
}
//function : BuildOffsetByArc
//purpose :
//=======================================================================
-void BRepOffset_MakeOffset::BuildOffsetByArc()
+void BRepOffset_MakeOffset::BuildOffsetByArc(const Message_ProgressRange& theRange)
{
#ifdef OCCT_DEBUG
if ( ChronBuild) {
TopExp_Explorer Exp;
TopTools_ListIteratorOfListOfShape itLF;
TopTools_MapOfShape Done;
-
+ Message_ProgressScope aPSOuter(theRange, NULL, 10);
//--------------------------------------------------------
// Construction of faces parallel to initial faces
//--------------------------------------------------------
BRepOffset_DataMapOfShapeOffset MapSF;
- MakeOffsetFaces(MapSF);
+ MakeOffsetFaces(MapSF, aPSOuter.Next());
+ if (myError != BRepOffset_NoError)
+ {
+ return;
+ }
//--------------------------------------------------------
// Construction of tubes on edge.
//--------------------------------------------------------
ChFiDS_TypeOfConcavity OT = ChFiDS_Convex;
if (myOffset < 0.) OT = ChFiDS_Concave;
-
- for (Exp.Init(myFaceComp,TopAbs_EDGE); Exp.More(); Exp.Next()) {
+
+ Message_ProgressScope aPS1(aPSOuter.Next(4), "Constructing tubes on edges", 1, Standard_True);
+ for (Exp.Init(myFaceComp,TopAbs_EDGE); Exp.More(); Exp.Next(), aPS1.Next()) {
+ if (!aPS1.More())
+ {
+ myError = BRepOffset_UserBreak;
+ return;
+ }
const TopoDS_Edge& E = TopoDS::Edge(Exp.Current());
if (Done.Add(E)) {
const TopTools_ListOfShape& Anc = myAnalyse.Ancestors(E);
//--------------------------------------------------------
Done.Clear();
TopTools_ListIteratorOfListOfShape it;
-
- for (Exp.Init(myFaceComp,TopAbs_VERTEX); Exp.More(); Exp.Next()) {
+ Message_ProgressScope aPS2(aPSOuter.Next(4), "Constructing spheres on vertices", 1, Standard_True);
+ for (Exp.Init(myFaceComp,TopAbs_VERTEX); Exp.More(); Exp.Next(), aPS2.Next()) {
+ if (!aPS2.More())
+ {
+ myError = BRepOffset_UserBreak;
+ return;
+ }
const TopoDS_Vertex& V = TopoDS::Vertex (Exp.Current());
if (Done.Add(V)) {
const TopTools_ListOfShape& LA = myAnalyse.Ancestors(V);
ChFiDS_TypeOfConcavity RT = ChFiDS_Concave;
if (myOffset < 0.) RT = ChFiDS_Convex;
BRepOffset_DataMapIteratorOfDataMapOfShapeOffset It(MapSF);
- for ( ; It.More(); It.Next()) {
+ Message_ProgressScope aPS3(aPSOuter.Next(), NULL, MapSF.Size());
+ for ( ; It.More(); It.Next(), aPS3.Next()) {
+ if (!aPS3.More())
+ {
+ myError = BRepOffset_UserBreak;
+ return;
+ }
const TopoDS_Shape& SI = It.Key();
const BRepOffset_Offset& SF = It.Value();
if (SF.Status() == BRepOffset_Reversed ||
//purpose :
//=======================================================================
-void BRepOffset_MakeOffset::Intersection3D(BRepOffset_Inter3d& Inter)
+void BRepOffset_MakeOffset::Intersection3D(BRepOffset_Inter3d& Inter, const Message_ProgressRange& theRange)
{
#ifdef OCCT_DEBUG
if (ChronBuild) {
Clock.Start();
}
#endif
+ Message_ProgressScope aPS(theRange, NULL, (myFaces.Extent() && myJoin == GeomAbs_Arc) ? 2 : 1);
// In the Complete Intersection mode, implemented currently for planar
// solids only, there is no need to intersect the faces here.
// between the cap and the part.
if (myJoin == GeomAbs_Arc)
- Inter.ContextIntByArc (myFaces,InSide,myAnalyse,myInitOffsetFace,myInitOffsetEdge);
+ Inter.ContextIntByArc (myFaces,InSide,myAnalyse,myInitOffsetFace,myInitOffsetEdge, aPS.Next());
}
if (myInter) {
//-------------
//Complete.
//-------------
- Inter.CompletInt (OffsetFaces,myInitOffsetFace);
+ Inter.CompletInt (OffsetFaces,myInitOffsetFace, aPS.Next());
+ if (!aPS.More())
+ {
+ myError = BRepOffset_UserBreak;
+ return;
+ }
TopTools_IndexedMapOfShape& NewEdges = Inter.NewEdges();
if (myJoin == GeomAbs_Intersection) {
BRepOffset_Tool::CorrectOrientation (myFaceComp,NewEdges,myAsDes,myInitOffsetFace,myOffset);
//--------------------------------
// Only between neighbor faces.
//--------------------------------
- Inter.ConnexIntByArc(OffsetFaces,myFaceComp,myAnalyse,myInitOffsetFace);
+ Inter.ConnexIntByArc(OffsetFaces,myFaceComp,myAnalyse,myInitOffsetFace, aPS.Next());
+ if (!aPS.More())
+ {
+ myError = BRepOffset_UserBreak;
+ return;
+ }
}
#ifdef OCCT_DEBUG
if ( ChronBuild) Clock.Show();
//purpose :
//=======================================================================
-void BRepOffset_MakeOffset::Intersection2D(const TopTools_IndexedMapOfShape& Modif,
- const TopTools_IndexedMapOfShape& NewEdges)
+void BRepOffset_MakeOffset::Intersection2D (const TopTools_IndexedMapOfShape& Modif,
+ const TopTools_IndexedMapOfShape& NewEdges,
+ const Message_ProgressRange& theRange)
{
#ifdef OCCT_DEBUG
if (ChronBuild) {
//-----------------------------------------------
TopTools_IndexedDataMapOfShapeListOfShape aDMVV;
Standard_Integer i;
+ Message_ProgressScope aPS(theRange, "Intersection 2D", Modif.Extent());
for (i = 1; i <= Modif.Extent(); i++) {
+ if (!aPS.More())
+ {
+ myError = BRepOffset_UserBreak;
+ return;
+ }
const TopoDS_Face& F = TopoDS::Face(Modif(i));
- BRepOffset_Inter2d::Compute(myAsDes, F, NewEdges, myTol, myEdgeIntEdges, aDMVV);
+ BRepOffset_Inter2d::Compute(myAsDes, F, NewEdges, myTol, myEdgeIntEdges, aDMVV, aPS.Next());
}
//
BRepOffset_Inter2d::FuseVertices(aDMVV, myAsDes, myImageVV);
//purpose :
//=======================================================================
-void BRepOffset_MakeOffset::MakeLoops(TopTools_IndexedMapOfShape& Modif)
+void BRepOffset_MakeOffset::MakeLoops(TopTools_IndexedMapOfShape& Modif, const Message_ProgressRange& theRange)
{
#ifdef OCCT_DEBUG
if (ChronBuild) {
LF.Append(Modif(i));
}
//
+ Message_ProgressScope aPS(theRange, NULL, LF.Extent() + myFaces.Extent());
if ((myJoin == GeomAbs_Intersection) && myInter && myIsPlanar) {
- BuildSplitsOfTrimmedFaces(LF, myAsDes, myImageOffset);
+ BuildSplitsOfTrimmedFaces(LF, myAsDes, myImageOffset, aPS.Next(LF.Extent()));
}
else {
- myMakeLoops.Build(LF,myAsDes,myImageOffset,myImageVV);
+ myMakeLoops.Build(LF,myAsDes,myImageOffset,myImageVV, aPS.Next(LF.Extent()));
+ }
+ if (!aPS.More())
+ {
+ myError = BRepOffset_UserBreak;
+ return;
}
//-----------------------------------------
Standard_Boolean InSide = 1;
if (myOffset > 0 ) InSide = 0;
- myMakeLoops.BuildOnContext(LC,myAnalyse,myAsDes,myImageOffset,InSide);
+ myMakeLoops.BuildOnContext(LC,myAnalyse,myAsDes,myImageOffset,InSide, aPS.Next(LC.Extent()));
#ifdef OCCT_DEBUG
if ( ChronBuild) Clock.Show();
// share edges that were reconstructed.
//=======================================================================
-void BRepOffset_MakeOffset::MakeFaces(TopTools_IndexedMapOfShape& /*Modif*/)
+void BRepOffset_MakeOffset::MakeFaces (TopTools_IndexedMapOfShape& /*Modif*/,
+ const Message_ProgressRange& theRange)
{
#ifdef OCCT_DEBUG
- if (ChronBuild) {
+ if (ChronBuild) {
std::cout << " RECONSTRUCTION OF FACES:" << std::endl;
Clock.Reset();
Clock.Start();
}
}
//
+ Message_ProgressScope aPS(theRange, NULL, 1);
if ((myJoin == GeomAbs_Intersection) && myInter && myIsPlanar) {
- BuildSplitsOfTrimmedFaces(LOF, myAsDes, myImageOffset);
+ BuildSplitsOfTrimmedFaces(LOF, myAsDes, myImageOffset, aPS.Next());
}
else {
- myMakeLoops.BuildFaces(LOF,myAsDes,myImageOffset);
+ myMakeLoops.BuildFaces(LOF, myAsDes, myImageOffset, aPS.Next());
+ }
+ if (!aPS.More())
+ {
+ myError = BRepOffset_UserBreak;
+ return;
}
-
#ifdef OCCT_DEBUG
if ( ChronBuild) Clock.Show();
#endif
//function : MakeMissingWalls
//purpose :
//=======================================================================
-void BRepOffset_MakeOffset::MakeMissingWalls ()
+void BRepOffset_MakeOffset::MakeMissingWalls (const Message_ProgressRange& theRange)
{
TopTools_IndexedDataMapOfShapeListOfShape Contours; //Start vertex + list of connected edges (free boundary)
TopTools_DataMapOfShapeShape MapEF; //Edges of contours: edge + face
FillContours(myFaceComp, myAnalyse, Contours, MapEF);
- for (Standard_Integer ic = 1; ic <= Contours.Extent(); ic++)
+ Message_ProgressScope aPS(theRange, "Making missing walls", Contours.Extent());
+ for (Standard_Integer ic = 1; ic <= Contours.Extent(); ic++, aPS.Next())
{
+ if (!aPS.More())
+ {
+ myError = BRepOffset_UserBreak;
+ return;
+ }
TopoDS_Vertex StartVertex = TopoDS::Vertex(Contours.FindKey(ic));
TopoDS_Edge StartEdge;
const TopTools_ListOfShape& aContour = Contours(ic);
//purpose :
//=======================================================================
-void BRepOffset_MakeOffset::MakeShells ()
+void BRepOffset_MakeOffset::MakeShells (const Message_ProgressRange& theRange)
{
#ifdef OCCT_DEBUG
if (ChronBuild) {
}
#endif
//
+ Message_ProgressScope aPS(theRange, "Making shells", 1);
// Prepare list of splits of the offset faces to make the shells
TopTools_ListOfShape aLSF;
const TopTools_ListOfShape& R = myImageOffset.Roots();
TopTools_ListIteratorOfListOfShape it(R);
//
for (; it.More(); it.Next()) {
+ if (!aPS.More())
+ {
+ myError = BRepOffset_UserBreak;
+ return;
+ }
TopoDS_Shape aF = it.Value();
if (myThickening) //offsetted faces must change their orientations
aF.Reverse();
IsSolid(myShape) && myIsPlanar) {
//
TopoDS_Shape aShells;
- bDone = BuildShellsCompleteInter(aLSF, myImageOffset, aShells);
+ bDone = BuildShellsCompleteInter(aLSF, myImageOffset, aShells, aPS.Next());
if (bDone) {
myOffsetShape = aShells;
}
//purpose :
//=======================================================================
-void BRepOffset_MakeOffset::MakeSolid ()
+void BRepOffset_MakeOffset::MakeSolid (const Message_ProgressRange& theRange)
{
if (myOffsetShape.IsNull()) return;
TopoDS_Shape S1;
B.MakeCompound (NC);
+ Message_ProgressScope aPS(theRange, "Making solid", 1);
+
TopoDS_Solid Sol;
B.MakeSolid(Sol);
Sol.Closed(Standard_True);
Standard_Boolean aMakeSolid = (myShape.ShapeType() == TopAbs_SOLID) || myThickening;
for (exp.Init(myOffsetShape,TopAbs_SHELL); exp.More(); exp.Next()) {
+ if (!aPS.More())
+ {
+ myError = BRepOffset_UserBreak;
+ return;
+ }
TopoDS_Shell Sh = TopoDS::Shell(exp.Current());
if (myThickening && myOffset > 0.)
Sh.Reverse();
//function : CheckInputData
//purpose : Check input data for possibility of offset perform.
//=======================================================================
-Standard_Boolean BRepOffset_MakeOffset::CheckInputData()
+Standard_Boolean BRepOffset_MakeOffset::CheckInputData(const Message_ProgressRange& theRange)
{
// Set initial error state.
myError = BRepOffset_NoError;
TopoDS_Shape aTmpShape;
myBadShape = aTmpShape;
-
+ Message_ProgressScope aPS(theRange, NULL, 1);
// Non-null offset.
if (Abs(myOffset) <= myTol)
{
gp_Pnt2d aPnt2d;
for( ; anExpSF.More(); anExpSF.Next())
{
+ if (!aPS.More())
+ {
+ myError = BRepOffset_UserBreak;
+ return Standard_False;
+ }
const TopoDS_Face& aF = TopoDS::Face(anExpSF.Current());
if (aPresenceMap.Contains(aF.TShape()))
TopTools_DataMapOfShapeShape& theMES,
TopTools_DataMapOfShapeShape& theBuild,
Handle(BRepAlgo_AsDes)& theAsDes,
- Handle(BRepAlgo_AsDes)& theAsDes2d)
+ Handle(BRepAlgo_AsDes)& theAsDes2d,
+ const Message_ProgressRange& theRange)
{
Standard_Real aTolF;
TopTools_IndexedDataMapOfShapeListOfShape aDMVV;
// intersect edges created from edges
TopTools_IndexedMapOfShape aMFV;
+ Message_ProgressScope aPSOuter(theRange, NULL , 2);
+ Message_ProgressScope aPS1(aPSOuter.Next(), NULL, theFaces.Size());
for (TopTools_ListOfShape::Iterator it (theFaces); it.More(); it.Next())
{
const TopoDS_Face& aF = TopoDS::Face (it.Value());
aTolF = BRep_Tool::Tolerance (aF);
if (!BRepOffset_Inter2d::ConnexIntByInt(aF, theMapSF(aF), theMES, theBuild, theAsDes, theAsDes2d,
- myOffset, aTolF, myAnalyse, aMFV, myImageVV, myEdgeIntEdges, aDMVV))
+ myOffset, aTolF, myAnalyse, aMFV, myImageVV, myEdgeIntEdges, aDMVV, aPS1.Next()))
{
myError = BRepOffset_CannotExtentEdge;
return;
}
+ if (!aPS1.More())
+ {
+ myError = BRepOffset_UserBreak;
+ return;
+ }
}
// intersect edges created from vertices
Standard_Integer i, aNbF = aMFV.Extent();
+ Message_ProgressScope aPS2(aPSOuter.Next(), "Intersecting edges created from vertices", aNbF);
for (i = 1; i <= aNbF; ++i) {
const TopoDS_Face& aF = TopoDS::Face(aMFV(i));
aTolF = BRep_Tool::Tolerance(aF);
BRepOffset_Inter2d::ConnexIntByIntInVert
- (aF, theMapSF(aF), theMES, theBuild, theAsDes, theAsDes2d, aTolF, myAnalyse, aDMVV);
+ (aF, theMapSF(aF), theMES, theBuild, theAsDes, theAsDes2d, aTolF, myAnalyse, aDMVV, aPS2.Next());
+ if (!aPS2.More())
+ {
+ myError = BRepOffset_UserBreak;
+ return;
+ }
}
//
// fuse vertices on edges
//=======================================================================
Standard_Boolean BuildShellsCompleteInter(const TopTools_ListOfShape& theLF,
BRepAlgo_Image& theImage,
- TopoDS_Shape& theShells)
+ TopoDS_Shape& theShells,
+ const Message_ProgressRange& theRange)
{
+ Message_ProgressScope aPS(theRange, NULL, 5);
// make solids
BOPAlgo_MakerVolume aMV1;
aMV1.SetArguments(theLF);
// we need to intersect the faces to process the tangential faces
aMV1.SetIntersect(Standard_True);
aMV1.SetAvoidInternalShapes(Standard_True);
- aMV1.Perform();
+ aMV1.Perform(aPS.Next(3));
//
Standard_Boolean bDone = ! aMV1.HasErrors();
if (!bDone) {
// no need to intersect this time
aMV2.SetIntersect(Standard_False);
aMV2.SetAvoidInternalShapes(Standard_True);
- aMV2.Perform();
+ aMV2.Perform(aPS.Next());
bDone = ! aMV2.HasErrors();
if (!bDone) {
return bDone;
aMV3.SetArguments(aLF);
aMV3.SetIntersect(Standard_False);
aMV3.SetAvoidInternalShapes(Standard_True);
- aMV3.Perform();
+ aMV3.Perform(aPS.Next());
bDone = ! aMV3.HasErrors();
if (!bDone) {
return bDone;
return Standard_True;
}
+//=======================================================================
+//function : analyzeProgress
+//purpose :
+//=======================================================================
+void BRepOffset_MakeOffset::analyzeProgress (const Standard_Real theWhole,
+ TColStd_Array1OfReal& theSteps) const
+{
+ theSteps.Init(0.0);
+
+ // Set, approximately, the proportions for each operation.
+ // It is not a problem that the sum of the set values will not
+ // be equal to 100%, as the values will be normalized.
+ // The main point is to make the proportions valid relatively each other.
+
+ // Proportions will be different for different connection types
+ Standard_Boolean isArc = (myJoin == GeomAbs_Arc);
+ Standard_Boolean isPlanarIntCase = myInter && !isArc && myIsPlanar && !myThickening &&
+ myFaces.IsEmpty() && IsSolid(myShape);
+
+ theSteps(PIOperation_CheckInputData) = 1.;
+ theSteps(PIOperation_Analyse) = 2.;
+ theSteps(PIOperation_BuildOffsetBy) = isPlanarIntCase ? 70. : (isArc ? 20. : 50.);
+ theSteps(PIOperation_Intersection) = isPlanarIntCase ? 0. : (isArc ? 50. : 20.);
+ if (myThickening)
+ {
+ theSteps(PIOperation_MakeMissingWalls) = 5.;
+ }
+ theSteps(PIOperation_MakeShells) = isPlanarIntCase ? 25. : 5.;
+ theSteps(PIOperation_MakeSolid) = 5.;
+ if (myIsPerformSewing && myThickening)
+ {
+ theSteps(PIOperation_Sewing) = 10.;
+ }
+
+ normalizeSteps(theWhole, theSteps);
+}
+
//=======================================================================
//function : IsPlanar
//purpose : Checks if all the faces of the shape are planes
#include <BRepOffset_MakeLoops.hxx>
#include <TopTools_MapOfShape.hxx>
#include <BRepOffset_DataMapOfShapeOffset.hxx>
+#include <TColStd_Array1OfReal.hxx>
+
+#include <Message_ProgressRange.hxx>
class BRepAlgo_AsDes;
class TopoDS_Shape;
class TopoDS_Face;
class BRepOffset_Inter3d;
-
class BRepOffset_MakeOffset
{
public:
const Standard_Boolean SelfInter = Standard_False,
const GeomAbs_JoinType Join = GeomAbs_Arc,
const Standard_Boolean Thickening = Standard_False,
- const Standard_Boolean RemoveIntEdges = Standard_False);
+ const Standard_Boolean RemoveIntEdges = Standard_False,
+ const Message_ProgressRange& theRange = Message_ProgressRange());
Standard_EXPORT void Initialize (const TopoDS_Shape& S,
const Standard_Real Offset,
//! set the offset <Off> on the Face <F>
Standard_EXPORT void SetOffsetOnFace (const TopoDS_Face& F, const Standard_Real Off);
- Standard_EXPORT void MakeOffsetShape();
+ Standard_EXPORT void MakeOffsetShape(const Message_ProgressRange& theRange = Message_ProgressRange());
- Standard_EXPORT void MakeThickSolid();
+ Standard_EXPORT void MakeThickSolid(const Message_ProgressRange& theRange = Message_ProgressRange());
Standard_EXPORT const BRepOffset_Analyse& GetAnalyse() const;
//! 3) Check continuity of input surfaces.
//! 4) Check for normals existence on grid.
//! @return True if possible make computations and false otherwise.
- Standard_EXPORT Standard_Boolean CheckInputData();
+ Standard_EXPORT Standard_Boolean CheckInputData(const Message_ProgressRange& theRange);
//! Return bad shape, which obtained in CheckInputData.
Standard_EXPORT const TopoDS_Shape& GetBadShape() const;
protected:
-
+ //! Analyze progress steps of the whole operation.
+ //! @param theWhole - sum of progress of all operations.
+ //! @oaram theSteps - steps of the operations supported by PI
+ Standard_EXPORT void analyzeProgress (const Standard_Real theWhole,
+ TColStd_Array1OfReal& theSteps) const;
private:
Standard_EXPORT void BuildFaceComp();
- Standard_EXPORT void BuildOffsetByArc();
+ Standard_EXPORT void BuildOffsetByArc(const Message_ProgressRange& theRange);
- Standard_EXPORT void BuildOffsetByInter();
+ Standard_EXPORT void BuildOffsetByInter(const Message_ProgressRange& theRange);
//! Make Offset faces
- Standard_EXPORT void MakeOffsetFaces(BRepOffset_DataMapOfShapeOffset& theMapSF);
+ Standard_EXPORT void MakeOffsetFaces(BRepOffset_DataMapOfShapeOffset& theMapSF, const Message_ProgressRange& theRange);
Standard_EXPORT void SelfInter (TopTools_MapOfShape& Modif);
- Standard_EXPORT void Intersection3D (BRepOffset_Inter3d& Inter);
+ Standard_EXPORT void Intersection3D (BRepOffset_Inter3d& Inter, const Message_ProgressRange& theRange);
- Standard_EXPORT void Intersection2D (const TopTools_IndexedMapOfShape& Modif, const TopTools_IndexedMapOfShape& NewEdges);
+ Standard_EXPORT void Intersection2D (const TopTools_IndexedMapOfShape& Modif,
+ const TopTools_IndexedMapOfShape& NewEdges,
+ const Message_ProgressRange& theRange);
- Standard_EXPORT void MakeLoops (TopTools_IndexedMapOfShape& Modif);
+ Standard_EXPORT void MakeLoops (TopTools_IndexedMapOfShape& Modif, const Message_ProgressRange& theRange);
Standard_EXPORT void MakeLoopsOnContext (TopTools_MapOfShape& Modif);
- Standard_EXPORT void MakeFaces (TopTools_IndexedMapOfShape& Modif);
+ Standard_EXPORT void MakeFaces (TopTools_IndexedMapOfShape& Modif, const Message_ProgressRange& theRange);
- Standard_EXPORT void MakeShells();
+ Standard_EXPORT void MakeShells(const Message_ProgressRange& theRange);
Standard_EXPORT void SelectShells();
//! Replace roots in history maps
Standard_EXPORT void ReplaceRoots();
- Standard_EXPORT void MakeSolid();
+ Standard_EXPORT void MakeSolid(const Message_ProgressRange& theRange);
Standard_EXPORT void ToContext (BRepOffset_DataMapOfShapeOffset& MapSF);
Standard_EXPORT void CorrectConicalFaces();
//! Private method used to build walls for thickening the shell
- Standard_EXPORT void MakeMissingWalls();
+ Standard_EXPORT void MakeMissingWalls(const Message_ProgressRange& theRange);
//! Removes INTERNAL edges from the result
Standard_EXPORT void RemoveInternalEdges();
TopTools_DataMapOfShapeShape& theMES,
TopTools_DataMapOfShapeShape& theBuild,
Handle(BRepAlgo_AsDes)& theAsDes,
- Handle(BRepAlgo_AsDes)& theAsDes2d);
+ Handle(BRepAlgo_AsDes)& theAsDes2d,
+ const Message_ProgressRange& theRange);
//! Building of the splits of the offset faces for mode Complete
//! and joint type Intersection. This method is an advanced alternative
TopTools_DataMapOfShapeListOfShape& theEdgesOrigins,
TopTools_DataMapOfShapeShape& theFacesOrigins,
TopTools_DataMapOfShapeShape& theETrimEInf,
- BRepAlgo_Image& theImage);
+ BRepAlgo_Image& theImage,
+ const Message_ProgressRange& theRange);
//! Building of the splits of the already trimmed offset faces for mode Complete
//! and joint type Intersection.
Standard_EXPORT void BuildSplitsOfTrimmedFaces(const TopTools_ListOfShape& theLF,
const Handle(BRepAlgo_AsDes)& theAsDes,
- BRepAlgo_Image& theImage);
+ BRepAlgo_Image& theImage,
+ const Message_ProgressRange& theRange);
Standard_Real myOffset;
Standard_Real myTol;
ContainerType& theContainer,
FenceMapType* theMFence)
{
- const TopTools_ListOfShape *pLSIm = theImages.Seek (theS);
+ const TopTools_ListOfShape* pLSIm = theImages.Seek (theS);
if (pLSIm)
{
TopTools_ListIteratorOfListOfShape itLSIm (*pLSIm);
//purpose : Checking if the edge is micro edge
//=======================================================================
static Standard_Boolean ProcessMicroEdge (const TopoDS_Edge& theEdge,
- const Handle (IntTools_Context)& theCtx)
+ const Handle(IntTools_Context)& theCtx)
{
TopoDS_Vertex aV1, aV2;
TopExp::Vertices (theEdge, aV1, aV2);
}
TopTools_ListOfShape aLSEmpt;
- TopTools_ListOfShape *pLS = theOrigins.ChangeSeek (aS);
+ TopTools_ListOfShape* pLS = theOrigins.ChangeSeek (aS);
if (!pLS)
{
pLS = &aLSEmpt;
for (TopTools_ListOfShape::Iterator aIt (aLSIm); aIt.More(); aIt.Next())
{
const TopoDS_Shape& aSIm = aIt.Value();
- if (TopTools_ListOfShape *pLSOr = theOrigins.ChangeSeek (aSIm))
+ if (TopTools_ListOfShape* pLSOr = theOrigins.ChangeSeek (aSIm))
{
// merge two lists
for (TopTools_ListOfShape::Iterator aIt1 (*pLS); aIt1.More(); aIt1.Next())
if (!bFound && theAnalyse)
{
- const TopTools_ListOfShape *pLD = theAnalyse->Descendants (theSWhere);
+ const TopTools_ListOfShape* pLD = theAnalyse->Descendants (theSWhere);
if (pLD)
{
for (TopTools_ListOfShape::Iterator it (*pLD); it.More(); it.Next())
//=======================================================================
static void BuildSplitsOfTrimmedFace (const TopoDS_Face& theFace,
const TopoDS_Shape& theEdges,
- TopTools_ListOfShape& theLFImages)
+ TopTools_ListOfShape& theLFImages,
+ const Message_ProgressRange& theRange)
{
BOPAlgo_Splitter aSplitter;
//
aSplitter.AddArgument (theFace);
aSplitter.AddArgument (theEdges);
aSplitter.SetToFillHistory (Standard_False);
- aSplitter.Perform();
+ aSplitter.Perform (theRange);
if (aSplitter.HasErrors())
{
return;
aBF.SetFace (aFF);
aBF.SetShapes (aLE);
aBF.Perform();
+ if (aBF.HasErrors())
+ {
+ return;
+ }
//
const TopTools_ListOfShape& aLFSp = aBF.Areas();
TopTools_ListIteratorOfListOfShape aItLF (aLFSp);
const TopoDS_Edge& aE = *(TopoDS_Edge*)&aExp.Current();
//
Standard_Real aT1, aT2;
- const Handle (Geom_Curve)& aC = BRep_Tool::Curve (aE, aT1, aT2);
+ const Handle(Geom_Curve)& aC = BRep_Tool::Curve (aE, aT1, aT2);
//
gp_Pnt aP;
gp_Vec aV, aVSum;
void SetFaces (const TopTools_ListOfShape& theFaces) { myFaces = &theFaces; }
//! Sets ascendants/descendants information
- void SetAsDesInfo (const Handle (BRepAlgo_AsDes)& theAsDes) { myAsDes = theAsDes; }
+ void SetAsDesInfo (const Handle(BRepAlgo_AsDes)& theAsDes) { myAsDes = theAsDes; }
//! Sets the analysis info of the input shape
void SetAnalysis (const BRepOffset_Analyse& theAnalyse) { myAnalyzer = &theAnalyse; }
public: //! @name Public methods to build the splits
//! Build splits of already trimmed faces
- void BuildSplitsOfTrimmedFaces();
+ void BuildSplitsOfTrimmedFaces (const Message_ProgressRange& theRange);
//! Building splits of not-trimmed offset faces.
//! For the cases in which invalidities will be found, these invalidities will be rebuilt.
- void BuildSplitsOfExtendedFaces();
+ void BuildSplitsOfExtendedFaces (const Message_ProgressRange& theRange);
private: //! @name private methods performing the job
private: //! @name Intersection and post-treatment of edges
//! Intersection of the trimmed edges among themselves
- void IntersectTrimmedEdges();
+ void IntersectTrimmedEdges (const Message_ProgressRange& theRange);
//! Saving connection from trimmed edges to not trimmed ones
void UpdateIntersectedEdges (const TopTools_ListOfShape& theLA,
BRepOffset_DataMapOfShapeMapOfShape& theDMFMVIE,
TopTools_DataMapOfShapeListOfShape& theDMEOrLEIm,
TopTools_MapOfShape& theEdgesInvalidByVertex,
- TopTools_MapOfShape& theEdgesValidByVertex);
+ TopTools_MapOfShape& theEdgesValidByVertex,
+ const Message_ProgressRange& theRange);
//! Additional method to look for invalid edges
void FindInvalidEdges (const TopTools_ListOfShape& theLFOffset,
private: //! @name Checking faces
//! Build splits of faces
- void BuildSplitsOfFaces();
+ void BuildSplitsOfFaces (const Message_ProgressRange& theRange);
//! Looking for the invalid faces by analyzing their invalid edges
void FindInvalidFaces (TopTools_ListOfShape& theLFImages,
const TopTools_IndexedMapOfShape& theMFInvInHole,
const TopoDS_Shape& theFHoles,
TopTools_IndexedMapOfShape& theMERemoved,
- TopTools_IndexedMapOfShape& theMEInside);
+ TopTools_IndexedMapOfShape& theMEInside,
+ const Message_ProgressRange& theRange);
//! Looking for the connections between faces not to miss some necessary intersection
void ShapesConnections (const TopTools_DataMapOfShapeShape& theDMFOr,
void FindFacesToRebuild();
//! Intersection of the faces that should be rebuild to resolve all invalidities
- void IntersectFaces (TopTools_MapOfShape& theVertsToAvoid);
+ void IntersectFaces (TopTools_MapOfShape& theVertsToAvoid,
+ const Message_ProgressRange& theRange);
//! Preparation of the maps for analyzing intersections of the faces
void PrepareFacesForIntersection (const Standard_Boolean theLookVertToAvoid,
TopTools_MapOfShape& theMECheckExt,
TopTools_MapOfShape& theVertsToAvoid,
TopTools_DataMapOfShapeListOfShape& theEImages,
- TopTools_DataMapOfShapeListOfShape& theEETrim);
+ TopTools_DataMapOfShapeListOfShape& theEETrim,
+ const Message_ProgressRange& theRange);
//! Trims intersection edges
void TrimNewIntersectionEdges (const TopTools_ListOfShape& theLE,
private:
//! Fill possible gaps (holes) in the splits of the offset faces
- void FillGaps();
+ void FillGaps (const Message_ProgressRange& theRange);
//! Saving obtained results in history tools
void FillHistory();
private:
// Input data
const TopTools_ListOfShape* myFaces; //!< Input faces which have to be split
- Handle (BRepAlgo_AsDes) myAsDes; //!< Ascendants/descendants of the edges faces
+ Handle(BRepAlgo_AsDes) myAsDes; //!< Ascendants/descendants of the edges faces
const BRepOffset_Analyse* myAnalyzer; //!< Analyzer of the input parameters
TopTools_DataMapOfShapeListOfShape* myEdgesOrigins; //!< Origins of the offset edges (binding between offset edge and original edge)
TopoDS_Shape mySolids; //!< Solids built from the splits of faces
// Auxiliary tools
- Handle (IntTools_Context) myContext;
+ Handle(IntTools_Context) myContext;
// Output
BRepAlgo_Image* myImage; //!< History of modifications
//function : BuildSplitsOfTrimmedFaces
//purpose :
//=======================================================================
-void BRepOffset_BuildOffsetFaces::BuildSplitsOfTrimmedFaces()
+void BRepOffset_BuildOffsetFaces::BuildSplitsOfTrimmedFaces (const Message_ProgressRange& theRange)
{
if (!hasData (myFaces))
{
myEdgesOrigins = &anEdgesOrigins;
}
+ Message_ProgressScope aPS (theRange, "Building splits of trimmed faces", 5);
+
// Fuse all edges
- IntersectTrimmedEdges();
+ IntersectTrimmedEdges (aPS.Next (1));
+ Message_ProgressScope aPSLoop (aPS.Next (4), NULL, myFaces->Extent());
for (TopTools_ListOfShape::Iterator aItLF (*myFaces); aItLF.More(); aItLF.Next())
{
+ if (!aPSLoop.More())
+ {
+ return;
+ }
const TopoDS_Face& aF = *(TopoDS_Face*)&aItLF.Value();
TopoDS_Shape aCE;
}
TopTools_ListOfShape aLFImages;
- BuildSplitsOfTrimmedFace (aF, aCE, aLFImages);
+ BuildSplitsOfTrimmedFace (aF, aCE, aLFImages, aPSLoop.Next());
myOFImages.Add (aF, aLFImages);
}
//function : BuildSplitsOfExtendedFaces
//purpose :
//=======================================================================
-void BRepOffset_BuildOffsetFaces::BuildSplitsOfExtendedFaces()
+void BRepOffset_BuildOffsetFaces::BuildSplitsOfExtendedFaces (const Message_ProgressRange& theRange)
{
// Check input data
if (!hasData (myFaces) || !hasData (myEdgesOrigins) || !hasData (myFacesOrigins) || !hasData (myETrimEInf))
return;
}
- // Fusing all trimmed offset edges to avoid self-intersections in the splits
- IntersectTrimmedEdges();
+ Message_ProgressScope aPS (theRange, "Building splits of extended faces", 100.);
+ // Scope has to be added into a loop of undefined size.
+ // In general there are about 2 to 5 loops performed, each time
+ // decreasing complexity. So reserve for each next loop smaller time.
+ // Reserve also 4% on filling gaps after the faces are built.
+ Standard_Real aWhole = 100. - 4.;
+ // Fusing all trimmed offset edges to avoid self-intersections in the splits
+ IntersectTrimmedEdges (aPS.Next());
+ if (!aPS.More())
+ {
+ return;
+ }
// vertices to avoid
TopTools_MapOfShape aVertsToAvoid;
// Limit total number of attempts by 10. This should be extra, as each invalid face can be
// rebuilt only three times. So, in general, there are about 2-5 loops done.
const Standard_Integer aNbMaxAttempts = 10;
- for (Standard_Integer iCount = 0; iCount < aNbMaxAttempts; ++iCount)
+ // First progress portion is the half of the whole. Each next step is half of the previous:
+ // 48%, 24%, 12%, 6% and so on. This way in three loops it will already be 84%,
+ // and in four - 90%. So even if the loop will stop earlier, the not advanced scope
+ // will be acceptable.
+ Standard_Real aPart = aWhole / 2.;
+ for (Standard_Integer iCount = 1; iCount <= aNbMaxAttempts; ++iCount, aPart /= 2.)
{
+ if (!aPS.More())
+ {
+ return;
+ }
// Clear the data before further faces construction
myInvalidFaces.Clear();
myArtInvalidFaces.Clear();
myFacesToRebuild.Clear();
myFSelfRebAvoid.Clear();
+ // Split progress range on
+ // * building faces basing on currently available edges and
+ // * rebuilding faces basing on edges classification
+ Message_ProgressScope aPSLoop (aPS.Next (aPart), NULL, 10.);
+
// Build splits of the faces having new intersection edges
- BuildSplitsOfFaces();
+ BuildSplitsOfFaces (aPSLoop.Next (7.));
if (myInvalidFaces.IsEmpty())
{
break;
// Perform new intersections
myModifiedEdges.Clear();
- IntersectFaces (aVertsToAvoid);
+ IntersectFaces (aVertsToAvoid, aPSLoop.Next (3.));
}
// Fill possible gaps in the splits of offset faces to increase possibility of
// creating closed volume from these splits
- FillGaps();
+ FillGaps (aPS.Next (4.));
// Fill history for faces and edges
FillHistory();
//function : IntersectTrimmedEdges
//purpose :
//=======================================================================
-void BRepOffset_BuildOffsetFaces::IntersectTrimmedEdges()
+void BRepOffset_BuildOffsetFaces::IntersectTrimmedEdges (const Message_ProgressRange& theRange)
{
// get edges to intersect from descendants of the offset faces
TopTools_ListOfShape aLS;
//
+ Message_ProgressScope aPS (theRange, NULL, 2);
TopTools_ListIteratorOfListOfShape aItLF (*myFaces);
for (; aItLF.More(); aItLF.Next())
{
+ if (!aPS.More())
+ {
+ return;
+ }
const TopoDS_Face& aF = *(TopoDS_Face*)&aItLF.Value();
//
const TopTools_ListOfShape& aLE = myAsDes->Descendant (aF);
// perform intersection of the edges
BOPAlgo_Builder aGFE;
aGFE.SetArguments (aLS);
- aGFE.Perform();
+ aGFE.Perform (aPS.Next());
if (aGFE.HasErrors())
{
return;
//
TopTools_ListOfShape aLA;
// fill map with edges images
- for (TopTools_ListOfShape::Iterator aIt (aLS); aIt.More(); aIt.Next())
+ Message_ProgressScope aPSLoop (aPS.Next(), NULL, aLS.Size());
+ for (TopTools_ListOfShape::Iterator aIt (aLS); aIt.More(); aIt.Next(), aPSLoop.Next())
{
+ if (!aPSLoop.More())
+ {
+ return;
+ }
const TopoDS_Shape& aE = aIt.Value();
const TopTools_ListOfShape& aLEIm = aGFE.Modified (aE);
if (aLEIm.IsEmpty())
//purpose : Building the splits of offset faces and
// looking for the invalid splits
//=======================================================================
-void BRepOffset_BuildOffsetFaces::BuildSplitsOfFaces()
+void BRepOffset_BuildOffsetFaces::BuildSplitsOfFaces (const Message_ProgressRange& theRange)
{
BRep_Builder aBB;
Standard_Integer i, aNb;
// connection map from old edges to new ones
TopTools_DataMapOfShapeListOfShape aDMEOrLEIm;
//
+ // Outer range
+ Message_ProgressScope aPSOuter (theRange, NULL, 10.);
// build splits of faces
+ Message_ProgressScope aPSBF (aPSOuter.Next (3.), "Building faces", 2 * myFaces->Extent());
TopTools_ListOfShape::Iterator aItLF (*myFaces);
- for (; aItLF.More(); aItLF.Next())
+ for (; aItLF.More(); aItLF.Next(), aPSBF.Next())
{
+ if (!aPSBF.More())
+ {
+ return;
+ }
const TopoDS_Face& aF = *(TopoDS_Face*)&aItLF.Value();
//
TopTools_ListOfShape* pLFIm = myOFImages.ChangeSeek (aF);
// find invalid edges
FindInvalidEdges (aF, aLFImages, aDMFMVE, aDMFMNE, aDMFMIE, aDMFMVIE,
- aDMEOrLEIm, aMEdgeInvalidByVertex, aMEdgeValidByVertex);
+ aDMEOrLEIm, aMEdgeInvalidByVertex, aMEdgeValidByVertex, aPSBF.Next());
// save the new splits
if (!pLFIm)
aBB.MakeCompound (aFHoles);
// Find the faces containing only the inverted edges and the invalid ones
TopTools_ListOfShape anInvertedFaces;
+
+ Message_ProgressScope aPSIF (aPSOuter.Next (2.), "Checking validity of faces", aLFDone.Extent());
// find invalid faces
// considering faces containing only invalid edges as invalid
aItLF.Initialize (aLFDone);
- for (; aItLF.More(); aItLF.Next())
+ for (; aItLF.More(); aItLF.Next(), aPSIF.Next())
{
+ if (!aPSIF.More())
+ {
+ return;
+ }
const TopoDS_Face& aF = TopoDS::Face (aItLF.Value());
TopTools_ListOfShape& aLFImages = myOFImages.ChangeFromKey (aF);
//
//
// remove inside faces
TopTools_IndexedMapOfShape aMEInside;
- RemoveInsideFaces (anInvertedFaces, aMFToCheckInt, aMFInvInHole, aFHoles, aMERemoved, aMEInside);
+ RemoveInsideFaces (anInvertedFaces, aMFToCheckInt, aMFInvInHole, aFHoles,
+ aMERemoved, aMEInside, aPSOuter.Next (5.));
//
// make compound of valid splits
TopoDS_Compound aCFIm;
BRepOffset_DataMapOfShapeMapOfShape& theDMFMVIE,
TopTools_DataMapOfShapeListOfShape& theDMEOrLEIm,
TopTools_MapOfShape& theEdgesInvalidByVertex,
- TopTools_MapOfShape& theEdgesValidByVertex)
+ TopTools_MapOfShape& theEdgesValidByVertex,
+ const Message_ProgressRange& theRange)
{
// Edge is considered as invalid in the following cases:
// 1. Its orientation on the face has changed comparing to the originals edge and face;
// back map from the original shapes to their offset images
TopTools_DataMapOfShapeListOfShape anImages;
//
+ Message_ProgressScope aPS (theRange, "Checking validity of edges", 2 * theLFImages.Extent());
TopTools_ListIteratorOfListOfShape aItLF (theLFImages);
- for (; aItLF.More(); aItLF.Next())
+ for (; aItLF.More(); aItLF.Next(), aPS.Next())
{
+ if (!aPS.More())
+ {
+ return;
+ }
const TopoDS_Face& aFIm = *(TopoDS_Face*)&aItLF.Value();
//
TopExp_Explorer aExp (aFIm, TopAbs_EDGE);
TopTools_IndexedDataMapOfShapeListOfShape aDMVEFOr;
//
aItLF.Initialize (theLFImages);
- for (; aItLF.More(); aItLF.Next())
+ for (; aItLF.More(); aItLF.Next(), aPS.Next())
{
+ if (!aPS.More())
+ {
+ return;
+ }
const TopoDS_Face& aFIm = *(TopoDS_Face*)&aItLF.Value();
//
// valid edges for this split
TopExp::MapShapesAndAncestors (aFOr, TopAbs_VERTEX, TopAbs_EDGE, aDMVEFOr);
}
//
- TopTools_ListOfShape *pLEFOr = aDMVEFOr.ChangeSeek (aSOr);
+ TopTools_ListOfShape* pLEFOr = aDMVEFOr.ChangeSeek (aSOr);
if (pLEFOr)
{
TopoDS_Compound aCEOr;
{
FindShape (aSOr, aFOr, myAnalyzer, aEOrF);
//
- TopTools_ListOfShape *pLEIm = theDMEOrLEIm.ChangeSeek (aSOr);
+ TopTools_ListOfShape* pLEIm = theDMEOrLEIm.ChangeSeek (aSOr);
if (!pLEIm)
{
pLEIm = theDMEOrLEIm.Bound (aSOr, TopTools_ListOfShape());
(!pMEValid || !pMEValid->Contains (aE)))
{
// but not in the current one
- TopTools_MapOfShape *pMap = aMEUnclassified.ChangeSeek (aE);
+ TopTools_MapOfShape* pMap = aMEUnclassified.ChangeSeek (aE);
if (!pMap)
pMap = &aMEUnclassified (aMEUnclassified.Add (aE, TopTools_MapOfShape()));
pMap->Add (aFIm);
return;
}
//
- TopTools_ListOfShape *pLFNewHoles = myFNewHoles.ChangeSeek (theFOrigin);
+ TopTools_ListOfShape* pLFNewHoles = myFNewHoles.ChangeSeek (theFOrigin);
//
if (!pLFNewHoles)
{
for (; aItE.More(); aItE.Next())
{
const TopoDS_Shape& aEOr = aItE.Value();
- const TopTools_ListOfShape *pLEIm = theDMEOrLEIm.Seek (aEOr);
+ const TopTools_ListOfShape* pLEIm = theDMEOrLEIm.Seek (aEOr);
if (!pLEIm || pLEIm->IsEmpty())
{
continue;
for (; aItE.More(); aItE.Next())
{
const TopoDS_Shape& aE = aItE.Value();
- const TopTools_ListOfShape *pLEOr = myOEOrigins.Seek (aE);
+ const TopTools_ListOfShape* pLEOr = myOEOrigins.Seek (aE);
if (!pLEOr)
{
aMEOrigins.Add (aE);
{
const TopoDS_Shape& aE = aExp.Current();
//
- TopTools_ListOfShape *pLF = aDMEF.ChangeSeek (aE);
+ TopTools_ListOfShape* pLF = aDMEF.ChangeSeek (aE);
if (!pLF)
{
pLF = aDMEF.Bound (aE, TopTools_ListOfShape());
{
const TopoDS_Shape& aV = aExp.Current();
//
- TopTools_ListOfShape *pLF = aDMVF.ChangeSeek (aV);
+ TopTools_ListOfShape* pLF = aDMVF.ChangeSeek (aV);
if (!pLF)
{
pLF = aDMVF.Bound (aV, TopTools_ListOfShape());
for (; aIt.More(); aIt.Next())
{
const TopoDS_Shape& aV = aIt.Value();
- const TopTools_ListOfShape *pLF = aDMVF.Seek (aV);
+ const TopTools_ListOfShape* pLF = aDMVF.Seek (aV);
if (pLF && (pLF->Extent() > 3))
{
aMERem.Add (aE);
const TopTools_IndexedMapOfShape& theMFInvInHole,
const TopoDS_Shape& theFHoles,
TopTools_IndexedMapOfShape& theMERemoved,
- TopTools_IndexedMapOfShape& theMEInside)
+ TopTools_IndexedMapOfShape& theMEInside,
+ const Message_ProgressRange& theRange)
{
TopTools_ListOfShape aLS;
TopTools_MapOfShape aMFence;
TopTools_ListIteratorOfListOfShape aItLF;
TopTools_DataMapOfShapeShape aDMFImF;
//
+ Message_ProgressScope aPS (theRange, "Looking for inside faces", 10);
Standard_Integer i, aNb = myOFImages.Extent();
for (i = 1; i <= aNb; ++i)
{
+ if (!aPS.More())
+ {
+ return;
+ }
const TopoDS_Shape& aF = myOFImages.FindKey (i);
// to avoid intersection of the splits of the same
// offset faces among themselves make compound of the
BOPAlgo_MakerVolume aMV;
aMV.SetArguments (aLS);
aMV.SetIntersect (Standard_True);
- aMV.Perform();
+ aMV.Perform (aPS.Next (9));
if (aMV.HasErrors())
return;
aNb = myOFImages.Extent();
for (i = 1; i <= aNb; ++i)
{
+ if (!aPS.More())
+ {
+ return;
+ }
const TopTools_ListOfShape& aLFIm = myOFImages (i);
if (aLFIm.IsEmpty())
{
Standard_Integer aNbFH = theMFInvInHole.Extent();
for (i = 1; i <= aNbFH; ++i)
{
+ if (!aPS.More())
+ {
+ return;
+ }
const TopoDS_Shape& aFInv = theMFInvInHole (i);
TopTools_ListOfShape aLFInvIm = aMV.Modified (aFInv);
if (aLFInvIm.IsEmpty())
aLFInvIm.Append (aFInv);
}
//
- const TopoDS_Shape *pFOffset = aDMFImF.Seek (aFInv);
+ const TopoDS_Shape* pFOffset = aDMFImF.Seek (aFInv);
if (!pFOffset)
{
continue;
TopExp_Explorer aExpS (aSols, TopAbs_SOLID);
for (; aExpS.More(); aExpS.Next())
{
+ if (!aPS.More())
+ {
+ return;
+ }
const TopoDS_Shape& aSol = aExpS.Current();
//
Standard_Boolean bAllInv (Standard_True), bAllRemoved (Standard_True);
BOPDS_ListIteratorOfListOfPaveBlock aItLPB (aLPB);
for (; aItLPB.More(); aItLPB.Next())
{
- const Handle (BOPDS_PaveBlock)& aPB = aItLPB.Value();
+ const Handle(BOPDS_PaveBlock)& aPB = aItLPB.Value();
Standard_Integer nEInt;
if (aPB->HasEdge (nEInt))
{
for (; aItLE.More(); aItLE.Next())
{
const TopoDS_Shape& aEOr = aItLE.Value();
- TopTools_ListOfShape *pLFE = mySSInterfs.ChangeSeek (aEOr);
+ TopTools_ListOfShape* pLFE = mySSInterfs.ChangeSeek (aEOr);
if (!pLFE)
{
pLFE = mySSInterfs.Bound (aEOr, TopTools_ListOfShape());
if (bFound)
{
// save connection between offset faces
- TopTools_ListOfShape *pLF = mySSInterfs.ChangeSeek (aF);
+ TopTools_ListOfShape* pLF = mySSInterfs.ChangeSeek (aF);
if (!pLF)
{
pLF = mySSInterfs.Bound (aF, TopTools_ListOfShape());
for (; anExpE.More() && !bIsConnected; anExpE.Next())
{
const TopoDS_Shape& aE = anExpE.Current();
- const TopTools_ListOfShape *pLF = aDMEF.Seek (aE);
+ const TopTools_ListOfShape* pLF = aDMEF.Seek (aE);
if (pLF)
{
TopTools_ListIteratorOfListOfShape aItLF (*pLF);
for (; anExpV.More() && !bIsConnected; anExpV.Next())
{
const TopoDS_Shape& aV = anExpV.Current();
- const TopTools_ListOfShape *pLE = aDMVE.Seek (aV);
+ const TopTools_ListOfShape* pLE = aDMVE.Seek (aV);
if (pLE)
{
TopTools_ListIteratorOfListOfShape aItLE (*pLE);
//function : IntersectFaces
//purpose : Intersection of the faces that should be rebuild to resolve all invalidities
//=======================================================================
-void BRepOffset_BuildOffsetFaces::IntersectFaces (TopTools_MapOfShape& theVertsToAvoid)
+void BRepOffset_BuildOffsetFaces::IntersectFaces (TopTools_MapOfShape& theVertsToAvoid,
+ const Message_ProgressRange& theRange)
{
Standard_Integer aNbFR = myFacesToRebuild.Extent();
if (!aNbFR)
{
return;
}
+
+ Message_ProgressScope aPSOuter (theRange, "Rebuilding invalid faces", 10);
//
Standard_Integer i, j, k, aNbInv;
TopTools_ListIteratorOfListOfShape aItLF, aItLE;
TopTools_MapOfShape aMVRInv = theVertsToAvoid;
FindVerticesToAvoid (aDMEFInv, aDMVEFull, aMVRInv);
//
+ aPSOuter.Next();
+ if (!aPSOuter.More())
+ {
+ return;
+ }
+
// The faces should be intersected selectively -
// intersect only faces neighboring to the same invalid face
// and connected to its invalid edges;
// alone edges
TopTools_MapOfShape aMEAlone, aMEInvOnArt;
//
+ Message_ProgressScope aPSArt (aPSOuter.Next(), NULL, aLCBArt.Extent());
TopTools_ListIteratorOfListOfShape aItLCBArt (aLCBArt);
- for (; aItLCBArt.More(); aItLCBArt.Next())
+ for (; aItLCBArt.More(); aItLCBArt.Next(), aPSArt.Next())
{
+ if (!aPSArt.More())
+ {
+ return;
+ }
const TopoDS_Shape& aCB = aItLCBArt.Value();
//
// check if aCB contains splits of only one offset face
//
if (bAlone)
{
- const TopTools_ListOfShape *pLEOr = myOEOrigins.Seek (aE);
+ const TopTools_ListOfShape* pLEOr = myOEOrigins.Seek (aE);
if (pLEOr)
{
TopTools_ListIteratorOfListOfShape aItLEOr (*pLEOr);
}
//
// the edge is useless - look for other images
- const TopTools_ListOfShape *pLEOr = myOEOrigins.Seek (aE);
+ const TopTools_ListOfShape* pLEOr = myOEOrigins.Seek (aE);
if (!pLEOr)
{
continue;
TopTools_IndexedDataMapOfShapeListOfShape aDMOENEdges;
aNbInv = myInvalidFaces.Extent();
+ Message_ProgressScope aPSInter (aPSOuter.Next (5), NULL, aNbInv);
for (k = 1; k <= aNbInv; ++k)
{
+ if (!aPSInter.More())
+ {
+ return;
+ }
const TopoDS_Shape& aFInv = myInvalidFaces.FindKey (k);
Standard_Boolean bSelfRebAvoid = myFSelfRebAvoid.Contains (aFInv);
const TopTools_ListOfShape& aLFInv = myInvalidFaces (k);
aLCB = aLFInv;
}
//
+ Message_ProgressScope aPSCB (aPSInter.Next(), NULL, aLCB.Extent());
Standard_Boolean bArtificial = myArtInvalidFaces.IsBound (aFInv);
TopTools_ListIteratorOfListOfShape aItLCB (aLCB);
for (; aItLCB.More(); aItLCB.Next())
{
+ if (!aPSCB.More())
+ {
+ return;
+ }
const TopoDS_Shape& aCBInv = aItLCB.Value();
//
TopTools_MapOfShape aMEFence;
TopTools_ListOfShape aLCBE;
BOPTools_AlgoTools::MakeConnexityBlocks (aCBE, TopAbs_VERTEX, TopAbs_EDGE, aLCBE);
//
+ Message_ProgressScope aPSCBE (aPSCB.Next(), NULL, aLCBE.Extent());
TopTools_ListIteratorOfListOfShape aItLCBE (aLCBE);
for (; aItLCBE.More(); aItLCBE.Next())
{
+ if (!aPSCBE.More())
+ {
+ return;
+ }
const TopoDS_Shape& aCBELoc = aItLCBE.Value();
//
// map of edges and vertices of processing invalidity
if (aMFInt.Extent() < 3)
{
// nothing to intersect
+ aPSCBE.Next();
continue;
}
//
// among each other (except for the artificially invalid faces)
TopTools_IndexedMapOfShape aMEToInt;
Standard_Integer aNb = aMFInt.Extent();
- for (i = 1; i <= aNb; ++i)
+ Message_ProgressScope aPSIntPair (aPSCBE.Next(), NULL, aNb);
+ for (i = 1; i <= aNb; ++i, aPSIntPair.Next())
{
+ if (!aPSIntPair.More())
+ {
+ return;
+ }
const TopoDS_Face& aFi = TopoDS::Face (aMFInt (i));
if (bSelfRebAvoid && aFi.IsSame (aFInv))
{
}
//
// filter the obtained edges
- UpdateValidEdges (aFLE, aDMOENEdges, aMVBounds, aMEInvOnArt, aMECheckExt, theVertsToAvoid, aEImages, aDMEETrim);
+ UpdateValidEdges (aFLE, aDMOENEdges, aMVBounds, aMEInvOnArt, aMECheckExt,
+ theVertsToAvoid, aEImages, aDMEETrim, aPSOuter.Next (3));
}
//=======================================================================
{
const TopoDS_Shape& aE = aExp.Current();
// save connection to untrimmed face
- TopTools_ListOfShape *pLF = theDMSF.ChangeSeek (aE);
+ TopTools_ListOfShape* pLF = theDMSF.ChangeSeek (aE);
if (!pLF)
{
pLF = theDMSF.Bound (aE, TopTools_ListOfShape());
//
// save connection to untrimmed edge
const TopoDS_Shape& aEInf = myETrimEInf->Find (aE);
- TopTools_ListOfShape *pLETrim = theMEInfETrim.ChangeSeek (aEInf);
+ TopTools_ListOfShape* pLETrim = theMEInfETrim.ChangeSeek (aEInf);
if (!pLETrim)
{
pLETrim = theMEInfETrim.Bound (aEInf, TopTools_ListOfShape());
{
const TopoDS_Shape& aV = aExpV.Current();
// save connection to face
- TopTools_ListOfShape *pLFV = theDMSF.ChangeSeek (aV);
+ TopTools_ListOfShape* pLFV = theDMSF.ChangeSeek (aV);
if (!pLFV)
{
pLFV = theDMSF.Bound (aV, TopTools_ListOfShape());
if (theLookVertToAvoid)
{
// save connection to edges
- TopTools_ListOfShape *pLEV = theDMVEFull.ChangeSeek (aV);
+ TopTools_ListOfShape* pLEV = theDMVEFull.ChangeSeek (aV);
if (!pLEV)
{
pLEV = theDMVEFull.Bound (aV, TopTools_ListOfShape());
if (theLookVertToAvoid)
{
// get edges of invalid faces (from invalid splits only)
- const TopTools_ListOfShape *pLFInv = myInvalidFaces.Seek (aF);
+ const TopTools_ListOfShape* pLFInv = myInvalidFaces.Seek (aF);
if (!pLFInv || myArtInvalidFaces.IsBound (aF))
{
continue;
for (; aExp.More(); aExp.Next())
{
const TopoDS_Shape& aE = aExp.Current();
- TopTools_ListOfShape *pLF = theDMEFInv.ChangeSeek (aE);
+ TopTools_ListOfShape* pLF = theDMEFInv.ChangeSeek (aE);
if (!pLF)
{
pLF = &theDMEFInv (theDMEFInv.Add (aE, TopTools_ListOfShape()));
TopTools_IndexedDataMapOfShapeListOfShape aMVEEdges;
// Do not check the splitting vertices, but check only the ending ones
- const TopTools_ListOfShape *pLEOr = myOEOrigins.Seek (aE);
+ const TopTools_ListOfShape* pLEOr = myOEOrigins.Seek (aE);
if (pLEOr)
{
TopTools_ListIteratorOfListOfShape aItLEOr (*pLEOr);
const TopoDS_Shape& aV = aMVEEdges.FindKey (j);
if (!aMFence.Add (aV))
continue;
- const TopTools_ListOfShape *pLE = theDMVEFull.Seek (aV);
+ const TopTools_ListOfShape* pLE = theDMVEFull.Seek (aV);
if (!pLE)
{
// isolated vertex
continue;
}
//
- TopTools_ListOfShape *pLVE = aDMVE.ChangeSeek (aV);
+ TopTools_ListOfShape* pLVE = aDMVE.ChangeSeek (aV);
if (!pLVE)
{
continue;
TopTools_MapOfShape& theMECheckExt,
TopTools_MapOfShape& theVertsToAvoid,
TopTools_DataMapOfShapeListOfShape& theEImages,
- TopTools_DataMapOfShapeListOfShape& theEETrim)
+ TopTools_DataMapOfShapeListOfShape& theEETrim,
+ const Message_ProgressRange& theRange)
{
+ Message_ProgressScope aPSOuter (theRange, "Updating edges", 10);
// update images and origins of edges, plus update AsDes
//
// new edges
return;
}
+ aPSOuter.Next();
+ if (!aPSOuter.More())
+ {
+ return;
+ }
+
BRep_Builder aBB;
// Make connexity blocks of the invalid edges
// Intersected splits
TopTools_IndexedDataMapOfShapeListOfShape aMBlocksSp;
+ Message_ProgressScope aPSB (aPSOuter.Next(), NULL, aLBlocks.Extent());
TopTools_ListIteratorOfListOfShape aItLB (aLBlocks);
- for (; aItLB.More(); aItLB.Next())
+ for (; aItLB.More(); aItLB.Next(), aPSB.Next())
{
+ if (!aPSB.More())
+ {
+ return;
+ }
const TopoDS_Shape& aBlock = aItLB.Value();
// Get the list of new edges for the block
TopTools_ListOfShape aLValBlocks;
Standard_Integer aNbB = aMBlocksSp.Extent();
- for (i = 1; i <= aNbB; ++i)
+ Message_ProgressScope aPSBSp (aPSOuter.Next(), NULL, aNbB);
+ for (i = 1; i <= aNbB; ++i, aPSBSp.Next())
{
+ if (!aPSBSp.More())
+ {
+ return;
+ }
const TopoDS_Shape& aCE = aMBlocksSp.FindKey (i);
const TopTools_ListOfShape& aBlockLENew = aMBlocksSp (i);
TopTools_ListIteratorOfListOfShape aItLE (aBlockLENew);
for (; aItLE.More(); aItLE.Next())
{
- const TopTools_ListOfShape *pLF = aMELF.Seek (aItLE.Value());
+ const TopTools_ListOfShape* pLF = aMELF.Seek (aItLE.Value());
if (!pLF)
continue;
TopTools_ListIteratorOfListOfShape aItLF (*pLF);
return;
}
+ aPSOuter.Next();
+ if (!aPSOuter.More())
+ {
+ return;
+ }
+
// SECOND STAGE - Filter the remaining splits together
// Add for intersection already removed new edges using them
else
aSplits1 = aLValBlocks.First();
+ aPSOuter.Next();
+ if (!aPSOuter.More())
+ {
+ return;
+ }
+
// Get all faces to get the bounds from their splits
TopTools_ListOfShape aLFaces;
for (i = 1; i <= myOFImages.Extent(); ++i)
TopoDS_Shape aSplits;
FilterSplits (aLE, aMEInv, Standard_True, theEImages, aSplits);
+ aPSOuter.Next();
+ if (!aPSOuter.More())
+ {
+ return;
+ }
+
// get bounds to update
// we need to update the edges of all the affected faces
TopTools_ListOfShape aLF;
BOPAlgo_Builder aGF;
aGF.AddArgument (aBounds);
aGF.AddArgument (aSplits);
- aGF.Perform();
+ aGF.Perform (aPSOuter.Next (3));
//
// update splits
UpdateImages (aLE, theEImages, aGF, myModifiedEdges);
const BOPDS_ListOfPaveBlock& aLPB = pDS->PaveBlocks (pDS->Index (aE));
if (aLPB.Extent() == 1)
{
- const Handle (BOPDS_PaveBlock)& aPB = aLPB.First();
- const Handle (BOPDS_CommonBlock)& aCB = pDS->CommonBlock (aPB);
+ const Handle(BOPDS_PaveBlock)& aPB = aLPB.First();
+ const Handle(BOPDS_CommonBlock)& aCB = pDS->CommonBlock (aPB);
if (!aCB.IsNull())
{
const BOPDS_ListOfPaveBlock& aLPBCB = aCB->PaveBlocks();
for (; aItLFDes.More(); aItLFDes.Next())
{
const TopoDS_Shape& aED = aItLFDes.Value();
- const TopTools_ListOfShape *pLEDIm = myOEImages.Seek (aED);
+ const TopTools_ListOfShape* pLEDIm = myOEImages.Seek (aED);
if (!pLEDIm)
{
aMDE.Add (aED);
theLABounds.Append (aEIm);
}
//
- const TopTools_ListOfShape *pLO = myOEOrigins.Seek (aEIm);
+ const TopTools_ListOfShape* pLO = myOEOrigins.Seek (aEIm);
if (pLO)
{
TopTools_ListIteratorOfListOfShape aItLO (*pLO);
{
const TopoDS_Shape& aEOr = aItLEOr.Value();
//
- const TopTools_ListOfShape *pLEIm = theEImages.Seek (aEOr);
+ const TopTools_ListOfShape* pLEIm = theEImages.Seek (aEOr);
if (!pLEIm)
continue;
TopTools_ListIteratorOfListOfShape aItLEIm (*pLEIm);
// add this edge for checking by making new vertex in the middle of the edge
TopoDS_Vertex aV;
Standard_Real f, l;
- const Handle (Geom_Curve)& aC = BRep_Tool::Curve (TopoDS::Edge (aEIm), f, l);
- BRep_Builder().MakeVertex (aV, aC->Value ((f + l)*0.5), Precision::Confusion());
+ const Handle(Geom_Curve)& aC = BRep_Tool::Curve (TopoDS::Edge (aEIm), f, l);
+ BRep_Builder().MakeVertex (aV, aC->Value ((f + l) * 0.5), Precision::Confusion());
// and adding this vertex for checking
aDMVE.ChangeFromIndex (aDMVE.Add (aV, TopTools_ListOfShape())).Append (aE);
aMVInv.Add (aV);
// make new vertex in the middle of the edge
TopoDS_Vertex aV;
Standard_Real f, l;
- const Handle (Geom_Curve)& aC = BRep_Tool::Curve (TopoDS::Edge (aE), f, l);
- BRep_Builder().MakeVertex (aV, aC->Value ((f + l)*0.5), Precision::Confusion());
+ const Handle(Geom_Curve)& aC = BRep_Tool::Curve (TopoDS::Edge (aE), f, l);
+ BRep_Builder().MakeVertex (aV, aC->Value ((f + l) * 0.5), Precision::Confusion());
// add this vertex for checking
aDMVE.ChangeFromIndex (aDMVE.Add (aV, TopTools_ListOfShape())).Append (aE);
aMVInv.Add (aV);
for (; aItLE.More(); aItLE.Next())
{
const TopoDS_Shape& aE = aItLE.Value();
- TopTools_ListOfShape *pLEIm = theEImages.ChangeSeek (aE);
+ TopTools_ListOfShape* pLEIm = theEImages.ChangeSeek (aE);
if (!pLEIm)
continue;
//function : FillGaps
//purpose : Fill possible gaps (holes) in the splits of the offset faces
//=======================================================================
-void BRepOffset_BuildOffsetFaces::FillGaps()
+void BRepOffset_BuildOffsetFaces::FillGaps (const Message_ProgressRange& theRange)
{
Standard_Integer aNbF = myOFImages.Extent();
if (!aNbF)
return;
+ Message_ProgressScope aPS (theRange, "Filling gaps", 2 * aNbF);
+
// Check the splits of offset faces on the free edges and fill the gaps (holes)
// in created splits, otherwise the closed volume will not be possible to create.
// Map the splits of faces to find free edges
TopTools_IndexedDataMapOfShapeListOfShape anEFMap;
- for (Standard_Integer i = 1; i <= aNbF; ++i)
+ for (Standard_Integer i = 1; i <= aNbF; ++i, aPS.Next())
{
+ if (!aPS.More())
+ {
+ return;
+ }
+
TopTools_ListIteratorOfListOfShape itLF (myOFImages (i));
for (; itLF.More(); itLF.Next())
TopExp::MapShapesAndAncestors (itLF.Value(), TopAbs_EDGE, TopAbs_FACE, anEFMap);
// Analyze images of each offset face on the presence of free edges
// and try to fill the holes
- for (Standard_Integer i = 1; i <= aNbF; ++i)
+ for (Standard_Integer i = 1; i <= aNbF; ++i, aPS.Next())
{
+ if (!aPS.More())
+ {
+ return;
+ }
+
TopTools_ListOfShape& aLFImages = myOFImages (i);
if (aLFImages.IsEmpty())
continue;
//purpose : Building splits of already trimmed faces
//=======================================================================
void BRepOffset_MakeOffset::BuildSplitsOfTrimmedFaces (const TopTools_ListOfShape& theLF,
- const Handle (BRepAlgo_AsDes)& theAsDes,
- BRepAlgo_Image& theImage)
+ const Handle(BRepAlgo_AsDes)& theAsDes,
+ BRepAlgo_Image& theImage,
+ const Message_ProgressRange& theRange)
{
BRepOffset_BuildOffsetFaces aBFTool (theImage);
aBFTool.SetFaces (theLF);
aBFTool.SetAsDesInfo (theAsDes);
- aBFTool.BuildSplitsOfTrimmedFaces();
+ aBFTool.BuildSplitsOfTrimmedFaces (theRange);
}
//=======================================================================
//=======================================================================
void BRepOffset_MakeOffset::BuildSplitsOfExtendedFaces (const TopTools_ListOfShape& theLF,
const BRepOffset_Analyse& theAnalyse,
- const Handle (BRepAlgo_AsDes)& theAsDes,
+ const Handle(BRepAlgo_AsDes)& theAsDes,
TopTools_DataMapOfShapeListOfShape& theEdgesOrigins,
TopTools_DataMapOfShapeShape& theFacesOrigins,
TopTools_DataMapOfShapeShape& theETrimEInf,
- BRepAlgo_Image& theImage)
+ BRepAlgo_Image& theImage,
+ const Message_ProgressRange& theRange)
{
BRepOffset_BuildOffsetFaces aBFTool (theImage);
aBFTool.SetFaces (theLF);
aBFTool.SetEdgesOrigins (theEdgesOrigins);
aBFTool.SetFacesOrigins (theFacesOrigins);
aBFTool.SetInfEdges (theETrimEInf);
- aBFTool.BuildSplitsOfExtendedFaces();
+ aBFTool.BuildSplitsOfExtendedFaces (theRange);
}
const Standard_Boolean Intersection,
const Standard_Boolean SelfInter,
const GeomAbs_JoinType Join,
- const Standard_Boolean RemoveIntEdges)
+ const Standard_Boolean RemoveIntEdges,
+ const Message_ProgressRange& theRange)
{
NotDone();
myLastUsedAlgo = OffsetAlgo_JOIN;
myOffsetShape.Initialize (S,Offset,Tol,Mode,Intersection,SelfInter,
Join, Standard_False, RemoveIntEdges);
- myOffsetShape.MakeOffsetShape();
+ myOffsetShape.MakeOffsetShape(theRange);
if (!myOffsetShape.IsDone())
return;
const Standard_Boolean Intersection = Standard_False,
const Standard_Boolean SelfInter = Standard_False,
const GeomAbs_JoinType Join = GeomAbs_Arc,
- const Standard_Boolean RemoveIntEdges = Standard_False);
+ const Standard_Boolean RemoveIntEdges = Standard_False,
+ const Message_ProgressRange& theRange = Message_ProgressRange());
//! Returns instance of the unrelying intersection / arc algorithm.
Standard_EXPORT virtual const BRepOffset_MakeOffset& MakeOffset() const;
(const TopoDS_Shape& S,
const TopTools_ListOfShape& ClosingFaces,
const Standard_Real Offset,
- const Standard_Real Tol,
+ const Standard_Real Tol,
const BRepOffset_Mode Mode,
const Standard_Boolean Intersection,
const Standard_Boolean SelfInter,
const GeomAbs_JoinType Join,
- const Standard_Boolean RemoveIntEdges)
+ const Standard_Boolean RemoveIntEdges,
+ const Message_ProgressRange& theRange)
{
NotDone();
myLastUsedAlgo = OffsetAlgo_JOIN;
for (; it.More(); it.Next())
myOffsetShape.AddFace(TopoDS::Face(it.Value()));
- myOffsetShape.MakeThickSolid();
+ myOffsetShape.MakeThickSolid(theRange);
if (!myOffsetShape.IsDone())
return;
const Standard_Boolean Intersection = Standard_False,
const Standard_Boolean SelfInter = Standard_False,
const GeomAbs_JoinType Join = GeomAbs_Arc,
- const Standard_Boolean RemoveIntEdges = Standard_False);
+ const Standard_Boolean RemoveIntEdges = Standard_False,
+ const Message_ProgressRange& theRange = Message_ProgressRange());
// Does nothing.
Standard_EXPORT virtual void Build(const Message_ProgressRange& theRange = Message_ProgressRange()) Standard_OVERRIDE;
#include <Draw_Interpretor.hxx>
#include <Draw_Appli.hxx>
#include <DrawTrSurf.hxx>
+#include <Draw_ProgressIndicator.hxx>
#include <TopTools_ListOfShape.hxx>
#include <TopTools_ListIteratorOfListOfShape.hxx>
if (n > 5)
Tol = Draw::Atof(a[5]);
+ Handle(Draw_ProgressIndicator) aProgress = new Draw_ProgressIndicator(theCommands, 1);
+
BRepOffset_MakeOffset B;
B.Initialize(S, Of, Tol, BRepOffset_Skin, Inter, 0, JT, Standard_True);
- B.MakeOffsetShape();
+ B.MakeOffsetShape(aProgress->Start());
const BRepOffset_Error aRetCode = B.Error();
reportOffsetState(theCommands, aRetCode);
}
}
- if (!YaBouchon) B.MakeOffsetShape();
- else B.MakeThickSolid();
+ Handle(Draw_ProgressIndicator) aProgress = new Draw_ProgressIndicator(theCommands, 1);
+ if (!YaBouchon) B.MakeOffsetShape(aProgress->Start());
+ else B.MakeThickSolid(aProgress->Start());
const BRepOffset_Error aRetCode = B.Error();
reportOffsetState(theCommands, aRetCode);
{
if (theNArg < 2) return 1;
+ Handle(Draw_ProgressIndicator) aProgress = new Draw_ProgressIndicator(theCommands, 1);
if (theYaBouchon)
- TheOffset.MakeThickSolid();
+ TheOffset.MakeThickSolid(aProgress->Start());
else
- TheOffset.MakeOffsetShape();
+ TheOffset.MakeOffsetShape(aProgress->Start());
if (TheOffset.IsDone())
{
#include <Draw_Interpretor.hxx>
#include <DBRep.hxx>
#include <DrawTrSurf.hxx>
+#include <Draw_ProgressIndicator.hxx>
#include <string.h>
#include <stdio.h>
//function : MakeShell
//purpose :
//=======================================================================
-Standard_Integer MakeShell(Draw_Interpretor& , Standard_Integer , const char** a)
+Standard_Integer MakeShell(Draw_Interpretor& theDI, Standard_Integer , const char** a)
{
TopoDS_Shape aShape = DBRep::Get( a[1] );
Standard_Real Off = -Draw::Atof( a[3] );
+ Handle(Draw_ProgressIndicator) aProgress = new Draw_ProgressIndicator(theDI, 1);
+
BRepOffset_MakeOffset Offset;
Offset.Initialize( aShape, Off, 1.0e-3, BRepOffset_Skin,
Standard_True , Standard_False , GeomAbs_Arc );
Offset.AddFace( F );
- Offset.MakeThickSolid();
+ Offset.MakeThickSolid(aProgress->Start());
if( Offset.IsDone() ) {
// SaveShape::Save(Offset.Shape(), "ss");
}
}
TopTools_DataMapOfShapeListOfShape anEmptyMap;
- BRepOffset_Inter2d::Compute(myAsDes,
- CurOF,
- myEdges,
- myTol,
- anEmptyMap,
- aDMVV);
+ BRepOffset_Inter2d::Compute(myAsDes, CurOF, myEdges, myTol,
+ anEmptyMap, aDMVV, Message_ProgressRange());
}
}
}
TopTools_DataMapOfShapeListOfShape anEmptyMap;
- BRepOffset_Inter2d::Compute(myAsDes,
- CurOF,
- myEdges,
- myTol,
- anEmptyMap,
- aDMVV);
+ BRepOffset_Inter2d::Compute(myAsDes, CurOF, myEdges, myTol,
+ anEmptyMap, aDMVV, Message_ProgressRange());
}
//
// fuse vertices on edges stored in AsDes
// unwinding
// ------------
BRepOffset_MakeLoops MakeLoops;
- MakeLoops.Build (LOF, myAsDes, myImageOffset, anEmptyImage);
+ MakeLoops.Build (LOF, myAsDes, myImageOffset, anEmptyImage, Message_ProgressRange());
// ------------------------------------------------------------
// It is possible to unwind edges at least one ancestor which of
--- /dev/null
+puts "============================================"
+puts "0032330: Modeling Algorithms - Extend Offset algorithm with Progress Indicator and User Break"
+puts "============================================"
+puts ""
+
+proc isTracked { theOutput } {
+ if {![regexp "Progress" $theOutput]} {
+ puts "Error: progress is not tracked"
+ }
+}
+
+XProgress +t
+
+# check that progress is tracked for offsetshape operation
+
+box s1 100 100 100
+explode s1 f
+set log [offsetshape result1 s1 -5 s1_1]
+isTracked $log
+
+# check that progress is tracked for offsetperform operation
+
+restore [locate_data_file bug27908.brep] s2
+offsetparameter 1e-7 p i
+offsetload s2 10
+set log [offsetperform result2]
+isTracked $log
+
+
+polyline p 0 0 0 5 0 0 7 0 3 3 0 3 4 0 1 1 0 1 2 0 3 -2 0 3 0 0 0
+mkplane f p
+prism s3 f 0 5 0
+offsetparameter 1e-7 c i
+offsetload s3 1
+set log [offsetperform result3]
+isTracked $log
+
+box s4 10 10 10
+offsetparameter 1e-7 c a
+offsetload s4 5
+set log [offsetperform result4]
+isTracked $log
+
+offsetparameter 1e-7 p a
+offsetload s4 5
+set log [offsetperform result5]
+isTracked $log