mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-09 13:22:24 +03:00
0025748: Parallel version of progress indicator
Progress indication mechanism is refactored to support incrementing progress within multithreaded algorithms. The class Message_ProgressIndicator is only an interface to the user application. It accumulates the progress provided by progress scopes. The counter is protected by mutex for thread-safety. The new class Message_ProgressScope replacing Message_ProgressSentry should be used to advance the progress. The scopes are nested to each other to reflect the nested nature of operations. The new class Message_ProgressRange should be used to pass the progress to sub-scopes. All OCCT algorithms involving progress indication have been updated to new API. Improvements in Draw_ProgressIndicator: - Separate console mode has been added in order to make possible to put the progress into std::cout instead or in addition to the draw interpreter, instead of trigger option "-tclOutput". - Treatment of Ctrl-Break signal has been added. Now any operation can be aborted by Ctrl-C or Ctrl-Break keystroke. Added new test case 'perf fclasses progr_par' for testing of parallel work of the progress.
This commit is contained in:
@@ -22,7 +22,7 @@
|
||||
#include <Interface_InterfaceModel.hxx>
|
||||
#include <Interface_Macros.hxx>
|
||||
#include <Interface_Static.hxx>
|
||||
#include <Message_ProgressSentry.hxx>
|
||||
#include <Message_ProgressScope.hxx>
|
||||
#include <ShapeExtend_Explorer.hxx>
|
||||
#include <ShapeFix_ShapeTolerance.hxx>
|
||||
#include <Standard_ErrorHandler.hxx>
|
||||
@@ -141,7 +141,8 @@ static void TrimTolerances (const TopoDS_Shape& shape,
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Handle(Transfer_Binder) IGESToBRep_Actor::Transfer
|
||||
(const Handle(Standard_Transient)& start, const Handle(Transfer_TransientProcess)& TP)
|
||||
(const Handle(Standard_Transient)& start, const Handle(Transfer_TransientProcess)& TP,
|
||||
const Message_ProgressRange& theProgress)
|
||||
{
|
||||
DeclareAndCast(IGESData_IGESModel,mymodel,themodel);
|
||||
DeclareAndCast(IGESData_IGESEntity,ent,start);
|
||||
@@ -162,7 +163,7 @@ Handle(Transfer_Binder) IGESToBRep_Actor::Transfer
|
||||
(typnum == 408) || (typnum == 308)) {
|
||||
|
||||
// Start progress scope (no need to check if progress exists -- it is safe)
|
||||
Message_ProgressSentry aPSentry(TP->GetProgress(), "Transfer stage", 0, 2, 1);
|
||||
Message_ProgressScope aPS(theProgress, "Transfer stage", 2);
|
||||
|
||||
XSAlgo::AlgoContainer()->PrepareForTransfer();
|
||||
IGESToBRep_CurveAndSurface CAS;
|
||||
@@ -189,22 +190,19 @@ Handle(Transfer_Binder) IGESToBRep_Actor::Transfer
|
||||
{
|
||||
try {
|
||||
OCC_CATCH_SIGNALS
|
||||
shape = CAS.TransferGeometry(ent);
|
||||
shape = CAS.TransferGeometry(ent, aPS.Next());
|
||||
}
|
||||
catch(Standard_Failure const&) {
|
||||
shape.Nullify();
|
||||
}
|
||||
}
|
||||
|
||||
// Switch to fix stage.
|
||||
aPSentry.Next();
|
||||
|
||||
// fixing shape
|
||||
Handle(Standard_Transient) info;
|
||||
shape = XSAlgo::AlgoContainer()->ProcessShape( shape, theeps, CAS.GetMaxTol(),
|
||||
"read.iges.resource.name",
|
||||
"read.iges.sequence", info,
|
||||
TP->GetProgress() );
|
||||
aPS.Next());
|
||||
XSAlgo::AlgoContainer()->MergeTransferInfo(TP, info, nbTPitems);
|
||||
}
|
||||
|
||||
|
@@ -24,12 +24,13 @@
|
||||
#include <Standard_Real.hxx>
|
||||
#include <Transfer_ActorOfTransientProcess.hxx>
|
||||
#include <Standard_Boolean.hxx>
|
||||
#include <Message_ProgressRange.hxx>
|
||||
|
||||
class Interface_InterfaceModel;
|
||||
class Standard_Transient;
|
||||
class Transfer_Binder;
|
||||
class Transfer_TransientProcess;
|
||||
|
||||
|
||||
class IGESToBRep_Actor;
|
||||
DEFINE_STANDARD_HANDLE(IGESToBRep_Actor, Transfer_ActorOfTransientProcess)
|
||||
|
||||
@@ -58,7 +59,10 @@ public:
|
||||
|
||||
Standard_EXPORT virtual Standard_Boolean Recognize (const Handle(Standard_Transient)& start) Standard_OVERRIDE;
|
||||
|
||||
Standard_EXPORT virtual Handle(Transfer_Binder) Transfer (const Handle(Standard_Transient)& start, const Handle(Transfer_TransientProcess)& TP) Standard_OVERRIDE;
|
||||
Standard_EXPORT virtual Handle(Transfer_Binder) Transfer
|
||||
(const Handle(Standard_Transient)& start,
|
||||
const Handle(Transfer_TransientProcess)& TP,
|
||||
const Message_ProgressRange& theProgress = Message_ProgressRange()) Standard_OVERRIDE;
|
||||
|
||||
//! Returns the tolerance which was actually used, either from
|
||||
//! the file or from statics
|
||||
|
@@ -59,7 +59,7 @@
|
||||
#include <IGESToBRep_TopoSurface.hxx>
|
||||
#include <Interface_Macros.hxx>
|
||||
#include <Message_Msg.hxx>
|
||||
#include <Message_ProgressSentry.hxx>
|
||||
#include <Message_ProgressScope.hxx>
|
||||
#include <Precision.hxx>
|
||||
#include <ShapeBuild_Edge.hxx>
|
||||
#include <ShapeExtend_WireData.hxx>
|
||||
@@ -128,7 +128,8 @@ IGESToBRep_BRepEntity::IGESToBRep_BRepEntity
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
TopoDS_Shape IGESToBRep_BRepEntity::TransferBRepEntity
|
||||
(const Handle(IGESData_IGESEntity)& start)
|
||||
(const Handle(IGESData_IGESEntity)& start,
|
||||
const Message_ProgressRange& theProgress)
|
||||
{
|
||||
TopoDS_Shape res;
|
||||
|
||||
@@ -138,11 +139,11 @@ TopoDS_Shape IGESToBRep_BRepEntity::TransferBRepEntity
|
||||
}
|
||||
else if (start->IsKind(STANDARD_TYPE(IGESSolid_Shell))) {
|
||||
DeclareAndCast(IGESSolid_Shell, st514, start);
|
||||
res = TransferShell(st514);
|
||||
res = TransferShell(st514, theProgress);
|
||||
}
|
||||
else if (start->IsKind(STANDARD_TYPE(IGESSolid_ManifoldSolid))) {
|
||||
DeclareAndCast(IGESSolid_ManifoldSolid, st186, start);
|
||||
res = TransferManifoldSolid(st186);
|
||||
res = TransferManifoldSolid(st186, theProgress);
|
||||
}
|
||||
else {
|
||||
Message_Msg Msg1005("IGES_1005");
|
||||
@@ -531,7 +532,8 @@ TopoDS_Shape IGESToBRep_BRepEntity::TransferFace
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
TopoDS_Shape IGESToBRep_BRepEntity::TransferShell
|
||||
(const Handle(IGESSolid_Shell)& start)
|
||||
(const Handle(IGESSolid_Shell)& start,
|
||||
const Message_ProgressRange& theProgress)
|
||||
{
|
||||
TopoDS_Shape res;
|
||||
|
||||
@@ -542,13 +544,8 @@ TopoDS_Shape IGESToBRep_BRepEntity::TransferShell
|
||||
Standard_Integer nbfaces = start->NbFaces();
|
||||
if (nbfaces != 0) {
|
||||
Standard_Boolean closed = Standard_True; //:39
|
||||
Handle(Message_ProgressIndicator) progress = GetTransferProcess()->GetProgress();
|
||||
if ( ! progress.IsNull() ) progress->SetScale ( "Face", 0, nbfaces, 1 );
|
||||
for (Standard_Integer iface = 1; iface <= nbfaces; iface++) {
|
||||
if ( ! progress.IsNull() ) {
|
||||
progress->Increment();
|
||||
if ( progress->UserBreak() ) break;
|
||||
}
|
||||
Message_ProgressScope aPS(theProgress, "Face", nbfaces);
|
||||
for (Standard_Integer iface = 1; iface <= nbfaces && aPS.More(); iface++, aPS.Next()) {
|
||||
Handle(IGESSolid_Face) face = start->Face(iface);
|
||||
Standard_Boolean orientation = start->Orientation(iface);
|
||||
TopoDS_Shape Sh = TransferFace(face);
|
||||
@@ -595,7 +592,8 @@ TopoDS_Shape IGESToBRep_BRepEntity::TransferShell
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
TopoDS_Shape IGESToBRep_BRepEntity::TransferManifoldSolid
|
||||
(const Handle(IGESSolid_ManifoldSolid)& start)
|
||||
(const Handle(IGESSolid_ManifoldSolid)& start,
|
||||
const Message_ProgressRange& theProgress)
|
||||
{
|
||||
TopoDS_Shape res;
|
||||
|
||||
@@ -606,7 +604,7 @@ TopoDS_Shape IGESToBRep_BRepEntity::TransferManifoldSolid
|
||||
Handle(IGESSolid_Shell) shell = start->Shell();
|
||||
Standard_Boolean isoriented = start->OrientationFlag();
|
||||
Standard_Integer nbshell = start->NbVoidShells();
|
||||
TopoDS_Shape Sh = TransferShell(shell);
|
||||
TopoDS_Shape Sh = TransferShell(shell, theProgress);
|
||||
if (!Sh.IsNull()) {
|
||||
if (Sh.ShapeType() == TopAbs_SHELL) {
|
||||
TopoDS_Shell Shell = TopoDS::Shell(Sh);
|
||||
@@ -616,11 +614,11 @@ TopoDS_Shape IGESToBRep_BRepEntity::TransferManifoldSolid
|
||||
|
||||
if (nbshell != 0) {
|
||||
// progress scope without name, since usually we have single shell in solid
|
||||
Message_ProgressSentry PS ( GetTransferProcess()->GetProgress(), 0, 0, nbshell, 1 );
|
||||
for (Standard_Integer ishell=1; ishell<= nbshell && PS.More(); ishell++, PS.Next()) {
|
||||
Message_ProgressScope aPS (theProgress, NULL, nbshell);
|
||||
for (Standard_Integer ishell=1; ishell<= nbshell && aPS.More(); ishell++) {
|
||||
Handle(IGESSolid_Shell) voidshell= start->VoidShell(ishell);
|
||||
// Standard_Boolean orientation = start->VoidOrientationFlag(ishell);
|
||||
TopoDS_Shape aSh = TransferShell(voidshell);
|
||||
TopoDS_Shape aSh = TransferShell (voidshell, aPS.Next());
|
||||
if (!aSh.IsNull()) {
|
||||
if (aSh.ShapeType() == TopAbs_SHELL) {
|
||||
TopoDS_Shell Shell = TopoDS::Shell(aSh);
|
||||
|
@@ -25,6 +25,8 @@
|
||||
#include <Standard_Real.hxx>
|
||||
#include <Standard_Boolean.hxx>
|
||||
#include <Standard_Integer.hxx>
|
||||
#include <Message_ProgressRange.hxx>
|
||||
|
||||
class IGESToBRep_CurveAndSurface;
|
||||
class TopoDS_Shape;
|
||||
class IGESData_IGESEntity;
|
||||
@@ -63,7 +65,8 @@ public:
|
||||
Standard_EXPORT IGESToBRep_BRepEntity(const Standard_Real eps, const Standard_Real epsGeom, const Standard_Real epsCoeff, const Standard_Boolean mode, const Standard_Boolean modeapprox, const Standard_Boolean optimized);
|
||||
|
||||
//! Transfer the BRepEntity" : Face, Shell or ManifoldSolid.
|
||||
Standard_EXPORT TopoDS_Shape TransferBRepEntity (const Handle(IGESData_IGESEntity)& start);
|
||||
Standard_EXPORT TopoDS_Shape TransferBRepEntity (const Handle(IGESData_IGESEntity)& start,
|
||||
const Message_ProgressRange& theProgress = Message_ProgressRange());
|
||||
|
||||
//! Transfer the entity number "index" of the VertexList "start"
|
||||
Standard_EXPORT TopoDS_Vertex TransferVertex (const Handle(IGESSolid_VertexList)& start, const Standard_Integer index);
|
||||
@@ -78,10 +81,12 @@ public:
|
||||
Standard_EXPORT TopoDS_Shape TransferFace (const Handle(IGESSolid_Face)& start);
|
||||
|
||||
//! Transfer the Shell Entity
|
||||
Standard_EXPORT TopoDS_Shape TransferShell (const Handle(IGESSolid_Shell)& start);
|
||||
Standard_EXPORT TopoDS_Shape TransferShell (const Handle(IGESSolid_Shell)& start,
|
||||
const Message_ProgressRange& theProgress = Message_ProgressRange());
|
||||
|
||||
//! Transfer the ManifoldSolid Entity
|
||||
Standard_EXPORT TopoDS_Shape TransferManifoldSolid (const Handle(IGESSolid_ManifoldSolid)& start);
|
||||
Standard_EXPORT TopoDS_Shape TransferManifoldSolid (const Handle(IGESSolid_ManifoldSolid)& start,
|
||||
const Message_ProgressRange& theProgress = Message_ProgressRange());
|
||||
|
||||
|
||||
|
||||
|
@@ -39,7 +39,7 @@
|
||||
#include <Interface_Static.hxx>
|
||||
#include <Message_Messenger.hxx>
|
||||
#include <Message_Msg.hxx>
|
||||
#include <Message_ProgressSentry.hxx>
|
||||
#include <Message_ProgressScope.hxx>
|
||||
#include <Precision.hxx>
|
||||
#include <Standard_ErrorHandler.hxx>
|
||||
#include <Standard_Failure.hxx>
|
||||
@@ -178,7 +178,8 @@ void IGESToBRep_CurveAndSurface::SetModel(const Handle(IGESData_IGESModel)& mode
|
||||
//=======================================================================
|
||||
|
||||
TopoDS_Shape IGESToBRep_CurveAndSurface::TransferCurveAndSurface
|
||||
(const Handle(IGESData_IGESEntity)& start)
|
||||
(const Handle(IGESData_IGESEntity)& start,
|
||||
const Message_ProgressRange& theProgress)
|
||||
{
|
||||
TopoDS_Shape res;
|
||||
if (start.IsNull()) {
|
||||
@@ -199,7 +200,7 @@ TopoDS_Shape IGESToBRep_CurveAndSurface::TransferCurveAndSurface
|
||||
}
|
||||
else if (IGESToBRep::IsBRepEntity(start)) {
|
||||
IGESToBRep_BRepEntity TS(*this);
|
||||
res = TS.TransferBRepEntity(start);
|
||||
res = TS.TransferBRepEntity(start, theProgress);
|
||||
}
|
||||
else {
|
||||
Message_Msg msg1015("IGES_1015");
|
||||
@@ -231,7 +232,8 @@ TopoDS_Shape IGESToBRep_CurveAndSurface::TransferCurveAndSurface
|
||||
//=======================================================================
|
||||
|
||||
TopoDS_Shape IGESToBRep_CurveAndSurface::TransferGeometry
|
||||
(const Handle(IGESData_IGESEntity)& start)
|
||||
(const Handle(IGESData_IGESEntity)& start,
|
||||
const Message_ProgressRange& theProgress)
|
||||
{
|
||||
// Declaration of messages//
|
||||
// DCE 22/12/98
|
||||
@@ -263,7 +265,7 @@ TopoDS_Shape IGESToBRep_CurveAndSurface::TransferGeometry
|
||||
return res;
|
||||
try {
|
||||
OCC_CATCH_SIGNALS
|
||||
res = TransferCurveAndSurface(start);
|
||||
res = TransferCurveAndSurface(start, theProgress);
|
||||
}
|
||||
catch(Standard_Failure const&) {
|
||||
Message_Msg msg1015("IGES_1015");
|
||||
@@ -295,7 +297,7 @@ TopoDS_Shape IGESToBRep_CurveAndSurface::TransferGeometry
|
||||
else {
|
||||
try {
|
||||
OCC_CATCH_SIGNALS
|
||||
res = TransferGeometry(stsub);
|
||||
res = TransferGeometry(stsub, theProgress);
|
||||
}
|
||||
catch(Standard_Failure const&) {
|
||||
res.Nullify();
|
||||
@@ -319,8 +321,10 @@ TopoDS_Shape IGESToBRep_CurveAndSurface::TransferGeometry
|
||||
SendFail( st308, msg210);
|
||||
return res;
|
||||
}
|
||||
Message_ProgressSentry PS ( myTP->GetProgress(), "Subfigure item", 0, st308->NbEntities(), 1 );
|
||||
for (Standard_Integer i=1; i <= st308->NbEntities() && PS.More(); i++, PS.Next()) {
|
||||
Message_ProgressScope PS (theProgress, "Subfigure item", st308->NbEntities());
|
||||
for (Standard_Integer i=1; i <= st308->NbEntities() && PS.More(); i++)
|
||||
{
|
||||
Message_ProgressRange aRange = PS.Next();
|
||||
TopoDS_Shape item;
|
||||
if (st308->AssociatedEntity(i).IsNull()) {
|
||||
Message_Msg msg1020("IGES_1020");
|
||||
@@ -338,7 +342,7 @@ TopoDS_Shape IGESToBRep_CurveAndSurface::TransferGeometry
|
||||
else {
|
||||
try {
|
||||
OCC_CATCH_SIGNALS
|
||||
item = TransferGeometry(st308->AssociatedEntity(i));
|
||||
item = TransferGeometry (st308->AssociatedEntity(i), aRange);
|
||||
}
|
||||
catch(Standard_Failure const&) {
|
||||
item.Nullify();
|
||||
@@ -372,9 +376,11 @@ TopoDS_Shape IGESToBRep_CurveAndSurface::TransferGeometry
|
||||
SendFail(st402f1, msg202);
|
||||
return res;
|
||||
}
|
||||
Message_ProgressSentry PS ( myTP->GetProgress(), "Group item", 0, st402f1->NbEntities(), 1 );
|
||||
Message_ProgressScope PS (theProgress, "Group item", st402f1->NbEntities());
|
||||
Standard_Boolean ProblemInGroup = Standard_False;
|
||||
for (Standard_Integer i=1; i <= st402f1->NbEntities() && PS.More(); i++, PS.Next()) {
|
||||
for (Standard_Integer i=1; i <= st402f1->NbEntities() && PS.More(); i++)
|
||||
{
|
||||
Message_ProgressRange aRange = PS.Next();
|
||||
TopoDS_Shape item;
|
||||
if (st402f1->Entity(i).IsNull()) {
|
||||
Message_Msg msg1020("IGES_1020");
|
||||
@@ -392,7 +398,7 @@ TopoDS_Shape IGESToBRep_CurveAndSurface::TransferGeometry
|
||||
else {
|
||||
try {
|
||||
OCC_CATCH_SIGNALS
|
||||
item = TransferGeometry(st402f1->Entity(i));
|
||||
item = TransferGeometry (st402f1->Entity(i), aRange);
|
||||
}
|
||||
catch(Standard_Failure const&) {
|
||||
item.Nullify();
|
||||
@@ -435,9 +441,11 @@ TopoDS_Shape IGESToBRep_CurveAndSurface::TransferGeometry
|
||||
SendFail(st402f7, msg202);
|
||||
return res;
|
||||
}
|
||||
Message_ProgressSentry PS ( myTP->GetProgress(), "Group item", 0, st402f7->NbEntities(), 1 );
|
||||
Message_ProgressScope PS (theProgress, "Group item", st402f7->NbEntities());
|
||||
Standard_Boolean ProblemInGroup = Standard_False;
|
||||
for (Standard_Integer i=1; i <= st402f7->NbEntities() && PS.More(); i++, PS.Next()) {
|
||||
for (Standard_Integer i=1; i <= st402f7->NbEntities() && PS.More(); i++)
|
||||
{
|
||||
Message_ProgressRange aRange = PS.Next();
|
||||
TopoDS_Shape item;
|
||||
if (st402f7->Entity(i).IsNull()) {
|
||||
Message_Msg msg1020("IGES_1020");
|
||||
@@ -455,7 +463,7 @@ TopoDS_Shape IGESToBRep_CurveAndSurface::TransferGeometry
|
||||
else {
|
||||
try {
|
||||
OCC_CATCH_SIGNALS
|
||||
item = TransferGeometry(st402f7->Entity(i));
|
||||
item = TransferGeometry (st402f7->Entity(i), aRange);
|
||||
}
|
||||
catch(Standard_Failure const&) {
|
||||
item.Nullify();
|
||||
|
@@ -24,6 +24,8 @@
|
||||
#include <Standard_Real.hxx>
|
||||
#include <Standard_Boolean.hxx>
|
||||
#include <Standard_Integer.hxx>
|
||||
#include <Message_ProgressRange.hxx>
|
||||
|
||||
class Geom_Surface;
|
||||
class IGESData_IGESModel;
|
||||
class Transfer_TransientProcess;
|
||||
@@ -31,7 +33,6 @@ class TopoDS_Shape;
|
||||
class IGESData_IGESEntity;
|
||||
class Message_Msg;
|
||||
|
||||
|
||||
//! Provides methods to transfer CurveAndSurface from IGES to CASCADE.
|
||||
class IGESToBRep_CurveAndSurface
|
||||
{
|
||||
@@ -142,12 +143,14 @@ public:
|
||||
//! Returns the result of the transfert of any IGES Curve
|
||||
//! or Surface Entity. If the transfer has failed, this
|
||||
//! member return a NullEntity.
|
||||
Standard_EXPORT TopoDS_Shape TransferCurveAndSurface (const Handle(IGESData_IGESEntity)& start);
|
||||
Standard_EXPORT TopoDS_Shape TransferCurveAndSurface (const Handle(IGESData_IGESEntity)& start,
|
||||
const Message_ProgressRange& theProgress = Message_ProgressRange());
|
||||
|
||||
//! Returns the result of the transfert the geometry of
|
||||
//! any IGESEntity. If the transfer has failed, this
|
||||
//! member return a NullEntity.
|
||||
Standard_EXPORT TopoDS_Shape TransferGeometry (const Handle(IGESData_IGESEntity)& start);
|
||||
Standard_EXPORT TopoDS_Shape TransferGeometry (const Handle(IGESData_IGESEntity)& start,
|
||||
const Message_ProgressRange& theProgress = Message_ProgressRange());
|
||||
|
||||
//! Records a new Fail message
|
||||
void SendFail (const Handle(IGESData_IGESEntity)& start, const Message_Msg& amsg);
|
||||
|
@@ -40,7 +40,7 @@
|
||||
#include <Interface_Static.hxx>
|
||||
#include <Message_Messenger.hxx>
|
||||
#include <Message_Msg.hxx>
|
||||
#include <Message_ProgressSentry.hxx>
|
||||
#include <Message_ProgressScope.hxx>
|
||||
#include <OSD_Timer.hxx>
|
||||
#include <ShapeAlgo.hxx>
|
||||
#include <ShapeAlgo_AlgoContainer.hxx>
|
||||
@@ -368,7 +368,8 @@ static void TrimTolerances (const TopoDS_Shape& shape,
|
||||
//function : TransferRoots
|
||||
//purpose : Transfers all Roots Entities
|
||||
//=======================================================================
|
||||
void IGESToBRep_Reader::TransferRoots (const Standard_Boolean onlyvisible)
|
||||
void IGESToBRep_Reader::TransferRoots (const Standard_Boolean onlyvisible,
|
||||
const Message_ProgressRange& theProgress)
|
||||
{
|
||||
if (theModel.IsNull() || theProc.IsNull()) return;
|
||||
|
||||
@@ -417,8 +418,10 @@ void IGESToBRep_Reader::TransferRoots (const Standard_Boolean onlyvisible)
|
||||
// sln 11.06.2002 OCC448
|
||||
Interface_Static::SetIVal("read.iges.onlyvisible",onlyvisible);
|
||||
|
||||
Message_ProgressSentry PS ( theProc->GetProgress(), "Root", 0, nb, 1 );
|
||||
for (Standard_Integer i = 1; i <= nb && PS.More(); i++, PS.Next()) {
|
||||
Message_ProgressScope PS (theProgress, "Root", nb);
|
||||
for (Standard_Integer i = 1; i <= nb && PS.More(); i++)
|
||||
{
|
||||
Message_ProgressRange aRange = PS.Next();
|
||||
Handle(IGESData_IGESEntity) ent = theModel->Entity(i);
|
||||
if ( SH.IsShared(ent) || ! theActor->Recognize (ent) ) continue;
|
||||
if (level > 0) {
|
||||
@@ -433,7 +436,7 @@ void IGESToBRep_Reader::TransferRoots (const Standard_Boolean onlyvisible)
|
||||
theDone = Standard_True;
|
||||
try {
|
||||
OCC_CATCH_SIGNALS
|
||||
TP.Transfer(ent);
|
||||
TP.Transfer (ent, aRange);
|
||||
shape = TransferBRep::ShapeResult (theProc,ent);
|
||||
}
|
||||
catch(Standard_Failure const&) {
|
||||
@@ -478,7 +481,8 @@ void IGESToBRep_Reader::TransferRoots (const Standard_Boolean onlyvisible)
|
||||
//function : Transfer
|
||||
//purpose : Transfers an Entity given
|
||||
//=======================================================================
|
||||
Standard_Boolean IGESToBRep_Reader::Transfer(const Standard_Integer num)
|
||||
Standard_Boolean IGESToBRep_Reader::Transfer(const Standard_Integer num,
|
||||
const Message_ProgressRange& theProgress)
|
||||
{
|
||||
Handle(Message_Messenger) TF = theProc->Messenger();
|
||||
theDone = Standard_False;
|
||||
@@ -501,7 +505,7 @@ Standard_Boolean IGESToBRep_Reader::Transfer(const Standard_Integer num)
|
||||
|
||||
Handle(IGESData_IGESEntity) ent = theModel->Entity(num);
|
||||
|
||||
Message_ProgressSentry PS ( theProc->GetProgress(), "OneEnt", 0, 1, 1 ); //skl
|
||||
Message_ProgressScope aPS(theProgress, "OneEnt", 2);
|
||||
|
||||
XSAlgo::AlgoContainer()->PrepareForTransfer();
|
||||
IGESToBRep_CurveAndSurface CAS;
|
||||
@@ -543,7 +547,9 @@ Standard_Boolean IGESToBRep_Reader::Transfer(const Standard_Integer num)
|
||||
{
|
||||
try {
|
||||
OCC_CATCH_SIGNALS
|
||||
shape = CAS.TransferGeometry (ent);
|
||||
shape = CAS.TransferGeometry (ent, aPS.Next());
|
||||
if (aPS.UserBreak())
|
||||
return Standard_False;
|
||||
}
|
||||
catch(Standard_Failure const&) {
|
||||
Message_Msg msg1015("IGES_1015");
|
||||
@@ -559,7 +565,10 @@ Standard_Boolean IGESToBRep_Reader::Transfer(const Standard_Integer num)
|
||||
shape = XSAlgo::AlgoContainer()->ProcessShape( shape, eps*CAS.GetUnitFactor(), CAS.GetMaxTol(),
|
||||
"read.iges.resource.name",
|
||||
"read.iges.sequence", info,
|
||||
theProc->GetProgress() );
|
||||
aPS.Next() );
|
||||
if (aPS.UserBreak())
|
||||
return Standard_False;
|
||||
|
||||
XSAlgo::AlgoContainer()->MergeTransferInfo(theProc, info, nbTPitems);
|
||||
|
||||
ShapeExtend_Explorer SBE;
|
||||
@@ -576,8 +585,6 @@ Standard_Boolean IGESToBRep_Reader::Transfer(const Standard_Integer num)
|
||||
}
|
||||
}
|
||||
|
||||
PS.Relieve(); //skl
|
||||
|
||||
char t [20];
|
||||
t[0]='\0';
|
||||
Standard_Real second, cpu;
|
||||
|
@@ -26,12 +26,13 @@
|
||||
#include <Standard_Integer.hxx>
|
||||
#include <Standard_CString.hxx>
|
||||
#include <Standard_Real.hxx>
|
||||
#include <Message_ProgressRange.hxx>
|
||||
|
||||
class IGESData_IGESModel;
|
||||
class IGESToBRep_Actor;
|
||||
class Transfer_TransientProcess;
|
||||
class TopoDS_Shape;
|
||||
|
||||
|
||||
//! A simple way to read geometric IGES data.
|
||||
//! Encapsulates reading file and calling transfer tools
|
||||
class IGESToBRep_Reader
|
||||
@@ -79,12 +80,14 @@ public:
|
||||
//! IGES file. Standard_True is the default value and means that only
|
||||
//! visible root entities are translated. Standard_False
|
||||
//! translates all of the roots (visible and invisible).
|
||||
Standard_EXPORT void TransferRoots (const Standard_Boolean onlyvisible = Standard_True);
|
||||
Standard_EXPORT void TransferRoots (const Standard_Boolean onlyvisible = Standard_True,
|
||||
const Message_ProgressRange& theProgress = Message_ProgressRange());
|
||||
|
||||
//! Transfers an Entity given its rank in the Model (Root or not)
|
||||
//! Returns True if it is recognized as Geom-Topol.
|
||||
//! (But it can have failed : see IsDone)
|
||||
Standard_EXPORT Standard_Boolean Transfer (const Standard_Integer num);
|
||||
Standard_EXPORT Standard_Boolean Transfer (const Standard_Integer num,
|
||||
const Message_ProgressRange& theProgress = Message_ProgressRange());
|
||||
|
||||
//! Returns True if the LAST Transfer/TransferRoots was a success
|
||||
Standard_EXPORT Standard_Boolean IsDone() const;
|
||||
|
Reference in New Issue
Block a user