//purpose :
//=======================================================================
-Standard_Boolean BRepExtrema_DistShapeShape::Perform()
+Standard_Boolean BRepExtrema_DistShapeShape::Perform(const Handle(Message_ProgressIndicator)& PR)
{
myIsDone=Standard_False;
myInnerSol=Standard_False;
mySolutionsShape1.Clear();
mySolutionsShape2.Clear();
+ bool nullProgress = PR.IsNull();
+
if ( myShape1.IsNull() || myShape2.IsNull() )
return Standard_False;
BRepClass3d_SolidClassifier Classi(myShape1);
const Standard_Integer nbv2 = myMapV2.Extent();
Standard_Integer nbv1 = 0;
- while ( (nbv1<nbv2) && (!myInnerSol) )
+ while ( (nbv1<nbv2) && (!myInnerSol) && (nullProgress || !PR->UserBreak()))
{
nbv1++;
V = TopoDS::Vertex(myMapV2(nbv1));
}
}
}
-
const TopAbs_ShapeEnum Type2 = myShape2.ShapeType();
- if (((Type2==TopAbs_SOLID) || (Type2==TopAbs_COMPSOLID)) && (!myInnerSol))
+ if (((Type2 == TopAbs_SOLID) || (Type2 == TopAbs_COMPSOLID)) && (!myInnerSol) && (nullProgress || !PR->UserBreak()))
{
BRepClass3d_SolidClassifier Classi(myShape2);
const Standard_Integer nbv1 = myMapV1.Extent();
Standard_Integer nbv2 = 0;
- while ( (nbv2<nbv1) && (!myInnerSol) )
+ while ((nbv2<nbv1) && (!myInnerSol) && (nullProgress || !PR->UserBreak()))
{
nbv2++;
V = TopoDS::Vertex(myMapV1(nbv2));
}
}
- if (!myInnerSol)
+ if (!myInnerSol && (nullProgress || !PR->UserBreak()))
{
if (!myIsInitS1) // rebuild cached data for 1st shape
{
myIsInitS1 = Standard_True;
}
- if (!myIsInitS2) // rebuild cached data for 2nd shape
+ if (!myIsInitS2 && (nullProgress || !PR->UserBreak())) // rebuild cached data for 2nd shape
{
myBV2.Clear();
myBE2.Clear();
myIsInitS2 = Standard_True;
}
- if (myMapV1.Extent() && myMapV2.Extent())
+ if (myMapV1.Extent() && myMapV2.Extent() && (nullProgress || !PR->UserBreak()))
{
TopoDS_Vertex V1 = TopoDS::Vertex(myMapV1(1));
TopoDS_Vertex V2 = TopoDS::Vertex(myMapV2(1));
else
myDistRef= 1.e30; //szv:!!!
+ if (!nullProgress && !PR->UserBreak())
+ {
+ return false;
+ }
+
DistanceMapMap (myMapV1, myMapV2, myBV1, myBV2);
DistanceMapMap (myMapV1, myMapE2, myBV1, myBE2);
DistanceMapMap (myMapE1, myMapV2, myBE1, myBV2);
DistanceMapMap (myMapV1, myMapF2, myBV1, myBF2);
+
+ if (!nullProgress && !PR->UserBreak())
+ {
+ return false;
+ }
+
DistanceMapMap (myMapF1, myMapV2, myBF1, myBV2);
DistanceMapMap (myMapE1, myMapE2, myBE1, myBE2);
DistanceMapMap (myMapE1, myMapF2, myBE1, myBF2);
DistanceMapMap (myMapF1, myMapE2, myBF1, myBE2);
+ if (!nullProgress && !PR->UserBreak())
+ {
+ return false;
+ }
+
+
if (fabs (myDistRef) > myEps)
{
DistanceMapMap (myMapF1, myMapF2, myBF1, myBF2);
// Modified by Sergey KHROMOV - Tue Mar 6 11:55:03 2001 Begin
Standard_Integer i = 1;
- for (; i <= mySolutionsShape1.Length(); i++)
+ for (; i <= mySolutionsShape1.Length() && (nullProgress || !PR->UserBreak()); i++)
if (mySolutionsShape1.Value(i).Dist() > myDistRef + myEps)
{
mySolutionsShape1.Remove(i);
mySolutionsShape2.Remove(i);
}
// Modified by Sergey KHROMOV - Tue Mar 6 11:55:04 2001 End
- myIsDone = ( mySolutionsShape1.Length() > 0 );
+ myIsDone = (mySolutionsShape1.Length() > 0) && (nullProgress || !PR->UserBreak());
}
return myIsDone;
}
#include <Standard_OStream.hxx>
#include <Standard_DefineAlloc.hxx>
#include <TopTools_IndexedMapOfShape.hxx>
+#include <Message_ProgressIndicator.hxx>
+
//! This class provides tools to compute minimum distance <br>
//! between two Shapes (Compound,CompSolid, Solid, Shell, Face, Wire, Edge, Vertex). <br>
//! to specify a maximum deviation of extreme distances <br>
//! from the minimum one. <br>
//! Returns IsDone status. <br>
- Standard_EXPORT Standard_Boolean Perform();
+ Standard_EXPORT Standard_Boolean Perform(const Handle(Message_ProgressIndicator)& PR = nullptr);
//! True if the minimum distance is found. <br>
Standard_Boolean IsDone() const
{