mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-09 13:22:24 +03:00
0025113: Mesh - Progress indication and user break functionality for BRepMesh component
Added Progress Indicator to BRep_Mesh
This commit is contained in:
@@ -22,6 +22,7 @@
|
||||
#include <IMeshData_Model.hxx>
|
||||
#include <IMeshTools_Parameters.hxx>
|
||||
#include <IMeshTools_ModelAlgo.hxx>
|
||||
#include <Message_ProgressRange.hxx>
|
||||
|
||||
//! Interface class representing context of BRepMesh algorithm.
|
||||
//! Intended to cache discrete model and instances of tools for
|
||||
@@ -64,7 +65,7 @@ public:
|
||||
}
|
||||
|
||||
// Discretize edges of a model.
|
||||
return myEdgeDiscret->Perform(myModel, myParameters);
|
||||
return myEdgeDiscret->Perform(myModel, myParameters, Message_ProgressRange());
|
||||
}
|
||||
|
||||
//! Performs healing of discrete model built by DiscretizeEdges() method
|
||||
@@ -79,7 +80,7 @@ public:
|
||||
|
||||
return myModelHealer.IsNull() ?
|
||||
Standard_True :
|
||||
myModelHealer->Perform(myModel, myParameters);
|
||||
myModelHealer->Perform (myModel, myParameters, Message_ProgressRange());
|
||||
}
|
||||
|
||||
//! Performs pre-processing of discrete model using assigned algorithm.
|
||||
@@ -94,12 +95,12 @@ public:
|
||||
|
||||
return myPreProcessor.IsNull() ?
|
||||
Standard_True :
|
||||
myPreProcessor->Perform(myModel, myParameters);
|
||||
myPreProcessor->Perform (myModel, myParameters, Message_ProgressRange());
|
||||
}
|
||||
|
||||
//! Performs meshing of faces of discrete model using assigned meshing algorithm.
|
||||
//! @return True on success, False elsewhere.
|
||||
Standard_EXPORT virtual Standard_Boolean DiscretizeFaces()
|
||||
virtual Standard_Boolean DiscretizeFaces (const Message_ProgressRange& theRange)
|
||||
{
|
||||
if (myModel.IsNull() || myFaceDiscret.IsNull())
|
||||
{
|
||||
@@ -107,7 +108,7 @@ public:
|
||||
}
|
||||
|
||||
// Discretize faces of a model.
|
||||
return myFaceDiscret->Perform(myModel, myParameters);
|
||||
return myFaceDiscret->Perform (myModel, myParameters, theRange);
|
||||
}
|
||||
|
||||
//! Performs post-processing of discrete model using assigned algorithm.
|
||||
@@ -121,7 +122,7 @@ public:
|
||||
|
||||
return myPostProcessor.IsNull() ?
|
||||
Standard_True :
|
||||
myPostProcessor->Perform(myModel, myParameters);
|
||||
myPostProcessor->Perform(myModel, myParameters, Message_ProgressRange());
|
||||
}
|
||||
|
||||
//! Cleans temporary context data.
|
||||
|
@@ -19,6 +19,7 @@
|
||||
#include <Standard_Transient.hxx>
|
||||
#include <Standard_Type.hxx>
|
||||
#include <IMeshData_Types.hxx>
|
||||
#include <Message_ProgressRange.hxx>
|
||||
|
||||
struct IMeshTools_Parameters;
|
||||
|
||||
@@ -35,7 +36,8 @@ public:
|
||||
//! Performs processing of the given face.
|
||||
Standard_EXPORT virtual void Perform(
|
||||
const IMeshData::IFaceHandle& theDFace,
|
||||
const IMeshTools_Parameters& theParameters) = 0;
|
||||
const IMeshTools_Parameters& theParameters,
|
||||
const Message_ProgressRange& theRange) = 0;
|
||||
|
||||
DEFINE_STANDARD_RTTI_INLINE(IMeshTools_MeshAlgo, Standard_Transient)
|
||||
|
||||
|
@@ -47,7 +47,7 @@ IMeshTools_MeshBuilder::~IMeshTools_MeshBuilder ()
|
||||
// Function: Perform
|
||||
// Purpose :
|
||||
//=======================================================================
|
||||
void IMeshTools_MeshBuilder::Perform ()
|
||||
void IMeshTools_MeshBuilder::Perform (const Message_ProgressRange& theRange)
|
||||
{
|
||||
ClearStatus ();
|
||||
|
||||
@@ -58,6 +58,8 @@ void IMeshTools_MeshBuilder::Perform ()
|
||||
return;
|
||||
}
|
||||
|
||||
Message_ProgressScope aPS(theRange, "Mesh Perform", 10);
|
||||
|
||||
if (aContext->BuildModel ())
|
||||
{
|
||||
if (aContext->DiscretizeEdges ())
|
||||
@@ -66,7 +68,7 @@ void IMeshTools_MeshBuilder::Perform ()
|
||||
{
|
||||
if (aContext->PreProcessModel())
|
||||
{
|
||||
if (aContext->DiscretizeFaces())
|
||||
if (aContext->DiscretizeFaces(aPS.Next(9)))
|
||||
{
|
||||
if (aContext->PostProcessModel())
|
||||
{
|
||||
@@ -79,6 +81,12 @@ void IMeshTools_MeshBuilder::Perform ()
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!aPS.More())
|
||||
{
|
||||
SetStatus(Message_Fail8);
|
||||
aContext->Clean();
|
||||
return;
|
||||
}
|
||||
SetStatus(Message_Fail6);
|
||||
}
|
||||
}
|
||||
@@ -113,6 +121,6 @@ void IMeshTools_MeshBuilder::Perform ()
|
||||
Message_Warn1 : Message_Fail2);
|
||||
}
|
||||
}
|
||||
|
||||
aPS.Next(1);
|
||||
aContext->Clean ();
|
||||
}
|
||||
|
@@ -19,6 +19,7 @@
|
||||
#include <Message_Algorithm.hxx>
|
||||
#include <IMeshTools_Context.hxx>
|
||||
#include <Standard_Type.hxx>
|
||||
#include <Message_ProgressRange.hxx>
|
||||
|
||||
//! Builds mesh for each face of shape without triangulation.
|
||||
//! In case if some faces of shape have already been triangulated
|
||||
@@ -62,7 +63,7 @@ public:
|
||||
}
|
||||
|
||||
//! Performs meshing ot the shape using current context.
|
||||
Standard_EXPORT virtual void Perform ();
|
||||
Standard_EXPORT virtual void Perform (const Message_ProgressRange& theRange);
|
||||
|
||||
DEFINE_STANDARD_RTTI_INLINE(IMeshTools_MeshBuilder, Message_Algorithm)
|
||||
|
||||
|
@@ -20,6 +20,7 @@
|
||||
#include <Standard_Failure.hxx>
|
||||
#include <Standard_Transient.hxx>
|
||||
#include <Standard_Type.hxx>
|
||||
#include <Message_ProgressRange.hxx>
|
||||
|
||||
class IMeshData_Model;
|
||||
struct IMeshTools_Parameters;
|
||||
@@ -37,13 +38,14 @@ public:
|
||||
//! Exceptions protected processing of the given model.
|
||||
Standard_Boolean Perform (
|
||||
const Handle (IMeshData_Model)& theModel,
|
||||
const IMeshTools_Parameters& theParameters)
|
||||
const IMeshTools_Parameters& theParameters,
|
||||
const Message_ProgressRange& theRange)
|
||||
{
|
||||
try
|
||||
{
|
||||
OCC_CATCH_SIGNALS
|
||||
|
||||
return performInternal (theModel, theParameters);
|
||||
return performInternal (theModel, theParameters, theRange);
|
||||
}
|
||||
catch (Standard_Failure const&)
|
||||
{
|
||||
@@ -63,7 +65,8 @@ protected:
|
||||
//! Performs processing of the given model.
|
||||
Standard_EXPORT virtual Standard_Boolean performInternal (
|
||||
const Handle (IMeshData_Model)& theModel,
|
||||
const IMeshTools_Parameters& theParameters) = 0;
|
||||
const IMeshTools_Parameters& theParameters,
|
||||
const Message_ProgressRange& theRange) = 0;
|
||||
};
|
||||
|
||||
#endif
|
Reference in New Issue
Block a user