mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-09 13:22:24 +03:00
0032485: Modeling Algorithms - Add Clone() function for adapters
Provide ShallowCopy() functions for adapters & evaluators of curves, 2d curves and surfaces. This will allow using copies of the same adapter in multi-thread calculations.
This commit is contained in:
@@ -631,6 +631,36 @@ ProjLib_CompProjectedCurve::ProjLib_CompProjectedCurve
|
||||
Init();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : ShallowCopy
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Handle(Adaptor2d_Curve2d) ProjLib_CompProjectedCurve::ShallowCopy() const
|
||||
{
|
||||
Handle(ProjLib_CompProjectedCurve) aCopy = new ProjLib_CompProjectedCurve();
|
||||
|
||||
if (!mySurface.IsNull())
|
||||
{
|
||||
aCopy->mySurface = mySurface->ShallowCopy();
|
||||
}
|
||||
if (!myCurve.IsNull())
|
||||
{
|
||||
aCopy->myCurve = myCurve->ShallowCopy();
|
||||
}
|
||||
aCopy->myNbCurves = myNbCurves;
|
||||
aCopy->mySequence = mySequence;
|
||||
aCopy->myTolU = myTolU;
|
||||
aCopy->myTolV = myTolV;
|
||||
aCopy->myMaxDist = myMaxDist;
|
||||
aCopy->myUIso = myUIso;
|
||||
aCopy->myVIso = myVIso;
|
||||
aCopy->mySnglPnts = mySnglPnts;
|
||||
aCopy->myMaxDistance = myMaxDistance;
|
||||
|
||||
return aCopy;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Init
|
||||
//purpose :
|
||||
@@ -1274,7 +1304,10 @@ void ProjLib_CompProjectedCurve::D0(const Standard_Real U,gp_Pnt2d& P) const
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!found) throw Standard_DomainError("ProjLib_CompProjectedCurve::D0");
|
||||
if (!found)
|
||||
{
|
||||
throw Standard_DomainError("ProjLib_CompProjectedCurve::D0");
|
||||
}
|
||||
|
||||
Standard_Real U0, V0;
|
||||
|
||||
|
@@ -45,6 +45,9 @@ public:
|
||||
//! if MaxDist < 0 then algorithm works as above.
|
||||
Standard_EXPORT ProjLib_CompProjectedCurve(const Handle(Adaptor3d_Surface)& S, const Handle(Adaptor3d_Curve)& C, const Standard_Real TolU, const Standard_Real TolV, const Standard_Real MaxDist);
|
||||
|
||||
//! Shallow copy of adaptor
|
||||
Standard_EXPORT virtual Handle(Adaptor2d_Curve2d) ShallowCopy() const Standard_OVERRIDE;
|
||||
|
||||
//! computes a set of projected point and determine the
|
||||
//! continuous parts of the projected curves. The points
|
||||
//! corresponding to a projection on the bounds of the surface are
|
||||
|
@@ -446,6 +446,35 @@ myIsApprox (Standard_False)
|
||||
// }
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : ShallowCopy
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Handle(Adaptor3d_Curve) ProjLib_ProjectOnPlane::ShallowCopy() const
|
||||
{
|
||||
Handle(ProjLib_ProjectOnPlane) aCopy = new ProjLib_ProjectOnPlane();
|
||||
|
||||
if (!myCurve.IsNull())
|
||||
{
|
||||
aCopy->myCurve = myCurve->ShallowCopy();
|
||||
}
|
||||
aCopy->myPlane = myPlane;
|
||||
aCopy->myDirection = myDirection;
|
||||
aCopy->myKeepParam = myKeepParam;
|
||||
aCopy->myFirstPar = myFirstPar;
|
||||
aCopy->myLastPar = myLastPar;
|
||||
aCopy->myTolerance = myTolerance;
|
||||
aCopy->myType = myType;
|
||||
if (!myResult.IsNull())
|
||||
{
|
||||
aCopy->myResult = Handle(GeomAdaptor_Curve)::DownCast(myResult->ShallowCopy());
|
||||
}
|
||||
aCopy->myIsApprox = myIsApprox;
|
||||
|
||||
return aCopy;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Project
|
||||
//purpose : Returns the projection of a point <Point> on a plane
|
||||
|
@@ -70,6 +70,9 @@ public:
|
||||
//! raises if the direction <D> is parallel to the
|
||||
//! plane <Pl>.
|
||||
Standard_EXPORT ProjLib_ProjectOnPlane(const gp_Ax3& Pl, const gp_Dir& D);
|
||||
|
||||
//! Shallow copy of adaptor
|
||||
Standard_EXPORT virtual Handle(Adaptor3d_Curve) ShallowCopy() const Standard_OVERRIDE;
|
||||
|
||||
//! Sets the Curve and perform the projection.
|
||||
//! if <KeepParametrization> is true, the parametrization
|
||||
|
@@ -371,6 +371,33 @@ ProjLib_ProjectedCurve::ProjLib_ProjectedCurve
|
||||
Perform(C);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : ShallowCopy
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Handle(Adaptor2d_Curve2d) ProjLib_ProjectedCurve::ShallowCopy() const
|
||||
{
|
||||
Handle(ProjLib_ProjectedCurve) aCopy = new ProjLib_ProjectedCurve();
|
||||
|
||||
aCopy->myTolerance = myTolerance;
|
||||
if (!mySurface.IsNull())
|
||||
{
|
||||
aCopy->mySurface = mySurface->ShallowCopy();
|
||||
}
|
||||
if (!myCurve.IsNull())
|
||||
{
|
||||
aCopy->myCurve = myCurve->ShallowCopy();
|
||||
}
|
||||
aCopy->myResult = myResult;
|
||||
aCopy->myDegMin = myDegMin;
|
||||
aCopy->myDegMax = myDegMax;
|
||||
aCopy->myMaxSegments = myMaxSegments;
|
||||
aCopy->myMaxDist = myMaxDist;
|
||||
aCopy->myBndPnt = myBndPnt;
|
||||
|
||||
return aCopy;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Load
|
||||
|
@@ -67,6 +67,9 @@ public:
|
||||
//! If projecting uses approximation, 3d tolerance is Tol, default parameters are used,
|
||||
Standard_EXPORT ProjLib_ProjectedCurve(const Handle(Adaptor3d_Surface)& S, const Handle(Adaptor3d_Curve)& C, const Standard_Real Tol);
|
||||
|
||||
//! Shallow copy of adaptor
|
||||
Standard_EXPORT virtual Handle(Adaptor2d_Curve2d) ShallowCopy() const Standard_OVERRIDE;
|
||||
|
||||
//! Changes the tolerance used to project
|
||||
//! the curve on the surface
|
||||
Standard_EXPORT void Load (const Standard_Real Tolerance);
|
||||
|
Reference in New Issue
Block a user