#include <GeomLib.hxx>
#include <gp_Pnt.hxx>
#include <gp_Vec.hxx>
-#include <Message_ProgressIndicator.hxx>
-#include <Message_ProgressSentry.hxx>
+#include <Message_ProgressScope.hxx>
#include <NCollection_UBTreeFiller.hxx>
#include <Precision.hxx>
#include <Standard_ErrorHandler.hxx>
#include <OSD_Timer.hxx>
#endif
-void BRepBuilderAPI_Sewing::Perform(const Handle(Message_ProgressIndicator)& thePI)
+void BRepBuilderAPI_Sewing::Perform(const Message_ProgressRange& theProgress)
{
const Standard_Integer aNumberOfStages = myAnalysis + myCutting + mySewing + 2;
- Message_ProgressSentry aPS (thePI, "Sewing", 0, aNumberOfStages, 1);
+ Message_ProgressScope aPS (theProgress, "Sewing", aNumberOfStages);
#ifdef OCCT_DEBUG
Standard_Real t_total = 0., t_analysis = 0., t_assembling = 0., t_cutting = 0., t_merging = 0.;
OSD_Chronometer chr_total, chr_local;
chr_local.Reset();
chr_local.Start();
#endif
- FaceAnalysis (thePI);
+ FaceAnalysis (aPS.Next());
if (!aPS.More())
return;
- aPS.Next();
#ifdef OCCT_DEBUG
chr_local.Stop();
chr_local.Show(t_analysis);
chr_local.Reset();
chr_local.Start();
#endif
- VerticesAssembling (thePI);
+ VerticesAssembling (aPS.Next());
if (!aPS.More())
return;
- aPS.Next();
#ifdef OCCT_DEBUG
chr_local.Stop();
chr_local.Show(t_assembling);
chr_local.Reset();
chr_local.Start();
#endif
- Cutting (thePI);
+ Cutting (aPS.Next());
if (!aPS.More())
return;
- aPS.Next();
#ifdef OCCT_DEBUG
chr_local.Stop();
chr_local.Show(t_cutting);
chr_local.Reset();
chr_local.Start();
#endif
- Merging (Standard_True, thePI);
+ Merging (Standard_True, aPS.Next());
if (!aPS.More())
return;
- aPS.Next();
#ifdef OCCT_DEBUG
chr_local.Stop();
chr_local.Show(t_merging);
}
else
{
- aPS.Next( 1, Handle(TCollection_HAsciiString)());
+ aPS.Next();
if (myCutting)
- aPS.Next( 1, Handle(TCollection_HAsciiString)());
- aPS.Next( 1, Handle(TCollection_HAsciiString)());
+ aPS.Next();
+ aPS.Next();
if (!aPS.More())
return;
}
std::cout << "Creating sewed shape..." << std::endl;
#endif
// examine the multiple edges if any and process sameparameter for edges if necessary
- EdgeProcessing (thePI);
+ EdgeProcessing (aPS.Next());
if (!aPS.More())
return;
CreateSewedShape();
return;
}
- EdgeRegularity (thePI);
+ EdgeRegularity (aPS.Next());
if (mySameParameterMode && myFaceMode)
SameParameterShape();
// myDegenerated
//=======================================================================
-void BRepBuilderAPI_Sewing::FaceAnalysis(const Handle(Message_ProgressIndicator)& thePI)
+void BRepBuilderAPI_Sewing::FaceAnalysis(const Message_ProgressRange& theProgress)
{
if (!myShape.IsNull() && myOldShapes.IsEmpty()) {
Add(myShape);
TopTools_MapOfShape SmallEdges;
TopTools_IndexedDataMapOfShapeListOfShape GluedVertices;
Standard_Integer i = 1;
- Message_ProgressSentry aPS (thePI, "Shape analysis", 0, myOldShapes.Extent(), 1);
+ Message_ProgressScope aPS (theProgress, "Shape analysis", myOldShapes.Extent());
for (i = 1; i <= myOldShapes.Extent() && aPS.More(); i++, aPS.Next()) {
for (TopExp_Explorer fexp(myOldShapes(i),TopAbs_FACE); fexp.More(); fexp.Next()) {
TopTools_DataMapOfShapeListOfShape& aNodeEdges,
const TopTools_IndexedDataMapOfShapeListOfShape& aBoundFaces,
const Standard_Real Tolerance,
- const Handle(Message_ProgressIndicator)& theProgress)
+ const Message_ProgressRange& theProgress)
{
// Create map of node -> vertices
TopTools_IndexedDataMapOfShapeListOfShape NodeVertices;
#endif
// Merge nearest nodes
TopTools_IndexedDataMapOfShapeShape NodeNearestNode;
- Message_ProgressSentry aPS (theProgress, "Glueing nodes", 0, nbNodes, 1, Standard_True);
+ Message_ProgressScope aPS (theProgress, "Glueing nodes", nbNodes, Standard_True);
for (Standard_Integer i = 1; i <= nbNodes && aPS.More(); i++, aPS.Next()) {
const TopoDS_Vertex& node1 = TopoDS::Vertex(NodeVertices.FindKey(i));
// Find near nodes
return CreateNewNodes(NodeNearestNode,NodeVertices,aVertexNode,aNodeEdges);
}
-void BRepBuilderAPI_Sewing::VerticesAssembling(const Handle(Message_ProgressIndicator)& thePI)
+void BRepBuilderAPI_Sewing::VerticesAssembling(const Message_ProgressRange& theProgress)
{
Standard_Integer nbVert = myVertexNode.Extent();
Standard_Integer nbVertFree = myVertexNodeFree.Extent();
- Message_ProgressSentry aPS (thePI, "Vertices assembling", 0, 2, 1);
+ Message_ProgressScope aPS (theProgress, "Vertices assembling", 2);
if (nbVert || nbVertFree) {
// Fill map node -> sections
Standard_Integer i;
#ifdef OCCT_DEBUG
std::cout << "Assemble " << nbVert << " vertices on faces..." << std::endl;
#endif
- while (GlueVertices(myVertexNode,myNodeSections,myBoundFaces,myTolerance, thePI));
+ while (GlueVertices(myVertexNode,myNodeSections,myBoundFaces,myTolerance, aPS.Next()));
}
if (!aPS.More())
return;
- aPS.Next();
if (nbVertFree) {
#ifdef OCCT_DEBUG
std::cout << "Assemble " << nbVertFree << " vertices on floating edges..." << std::endl;
#endif
- while (GlueVertices(myVertexNodeFree,myNodeSections,myBoundFaces,myTolerance, thePI));
+ while (GlueVertices(myVertexNodeFree,myNodeSections,myBoundFaces,myTolerance, aPS.Next()));
}
}
}
//=======================================================================
void BRepBuilderAPI_Sewing::Merging(const Standard_Boolean /* firstTime */,
- const Handle(Message_ProgressIndicator)& thePI)
+ const Message_ProgressRange& theProgress)
{
BRep_Builder B;
// TopTools_MapOfShape MergedEdges;
- Message_ProgressSentry aPS (thePI, "Merging bounds", 0, myBoundFaces.Extent(), 1);
+ Message_ProgressScope aPS (theProgress, "Merging bounds", myBoundFaces.Extent());
TopTools_IndexedDataMapOfShapeListOfShape::Iterator anIterB(myBoundFaces);
for (; anIterB.More() && aPS.More(); anIterB.Next(), aPS.Next()) {
// myCuttingNode
//=======================================================================
-void BRepBuilderAPI_Sewing::Cutting(const Handle(Message_ProgressIndicator)& thePI)
+void BRepBuilderAPI_Sewing::Cutting(const Message_ProgressRange& theProgress)
{
Standard_Integer i, nbVertices = myVertexNode.Extent();
if (!nbVertices) return;
Standard_Real first, last;
// Iterate on all boundaries
Standard_Integer nbBounds = myBoundFaces.Extent();
- Message_ProgressSentry aPS (thePI, "Cutting bounds", 0, nbBounds, 1);
+ Message_ProgressScope aPS (theProgress, "Cutting bounds", nbBounds);
TopTools_IndexedDataMapOfShapeListOfShape::Iterator anIterB(myBoundFaces);
for (; anIterB.More() && aPS.More(); anIterB.Next(), aPS.Next()) {
const TopoDS_Edge& bound = TopoDS::Edge(anIterB.Key());
// - make the contigous edges sameparameter
//=======================================================================
-void BRepBuilderAPI_Sewing::EdgeProcessing(const Handle(Message_ProgressIndicator)& thePI)
+void BRepBuilderAPI_Sewing::EdgeProcessing(const Message_ProgressRange& theProgress)
{
// constructs sectionEdge
TopTools_IndexedMapOfShape MapFreeEdges;
TopTools_DataMapOfShapeShape EdgeFace;
- Message_ProgressSentry aPS (thePI, "Edge processing", 0, myBoundFaces.Extent(), 1);
+ Message_ProgressScope aPS (theProgress, "Edge processing", myBoundFaces.Extent());
TopTools_IndexedDataMapOfShapeListOfShape::Iterator anIterB(myBoundFaces);
for (; anIterB.More() && aPS.More(); anIterB.Next(), aPS.Next()) {
const TopoDS_Shape& bound = anIterB.Key();
//purpose : update Continuity flag on newly created edges
//=======================================================================
-void BRepBuilderAPI_Sewing::EdgeRegularity(const Handle(Message_ProgressIndicator)& thePI)
+void BRepBuilderAPI_Sewing::EdgeRegularity(const Message_ProgressRange& theProgress)
{
TopTools_IndexedDataMapOfShapeListOfShape aMapEF;
TopExp::MapShapesAndAncestors(mySewedShape, TopAbs_EDGE, TopAbs_FACE, aMapEF);
- Message_ProgressSentry aPS(thePI, "Encode edge regularity", 0, myMergedEdges.Extent(), 1);
+ Message_ProgressScope aPS(theProgress, "Encode edge regularity", myMergedEdges.Extent());
for (TopTools_MapIteratorOfMapOfShape aMEIt(myMergedEdges); aMEIt.More() && aPS.More(); aMEIt.Next(), aPS.Next())
{
TopoDS_Edge anEdge = TopoDS::Edge(myReShape->Apply(aMEIt.Value()));