1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-04-03 17:56:21 +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:
asuraven 2021-07-20 18:44:23 +03:00 committed by bugmaster
parent 82bee1621a
commit 872a7e3a7e
57 changed files with 662 additions and 7 deletions

View File

@ -40,6 +40,16 @@ Adaptor2d_Curve2d::~Adaptor2d_Curve2d()
{
}
//=======================================================================
//function : ShallowCopy()
//purpose :
//=======================================================================
Handle(Adaptor2d_Curve2d) Adaptor2d_Curve2d::ShallowCopy() const
{
throw Standard_NotImplemented("Adaptor2d_Curve2d::ShallowCopy");
}
//=======================================================================
//function : FirstParameter
//purpose :

View File

@ -54,6 +54,9 @@ class Adaptor2d_Curve2d : public Standard_Transient
{
DEFINE_STANDARD_RTTIEXT(Adaptor2d_Curve2d, Standard_Transient)
public:
//! Shallow copy of adaptor
Standard_EXPORT virtual Handle(Adaptor2d_Curve2d) ShallowCopy() const;
Standard_EXPORT virtual Standard_Real FirstParameter() const;

View File

@ -53,6 +53,22 @@ Adaptor2d_Line2d::Adaptor2d_Line2d()
{
}
//=======================================================================
//function : ShallowCopy
//purpose :
//=======================================================================
Handle(Adaptor2d_Curve2d) Adaptor2d_Line2d::ShallowCopy() const
{
Handle(Adaptor2d_Line2d) aCopy = new Adaptor2d_Line2d();
aCopy->myUfirst = myUfirst;
aCopy->myUlast = myUlast;
aCopy->myAx2d = myAx2d;
return aCopy;
}
//=======================================================================
//function : Load
//purpose :

View File

@ -53,7 +53,10 @@ public:
Standard_EXPORT Adaptor2d_Line2d();
Standard_EXPORT Adaptor2d_Line2d(const gp_Pnt2d& P, const gp_Dir2d& D, const Standard_Real UFirst, const Standard_Real ULast);
//! Shallow copy of adaptor
Standard_EXPORT virtual Handle(Adaptor2d_Curve2d) ShallowCopy() const Standard_OVERRIDE;
Standard_EXPORT void Load (const gp_Lin2d& L);
Standard_EXPORT void Load (const gp_Lin2d& L, const Standard_Real UFirst, const Standard_Real ULast);

View File

@ -90,6 +90,25 @@ Adaptor2d_OffsetCurve::Adaptor2d_OffsetCurve(
{
}
//=======================================================================
//function : ShallowCopy
//purpose :
//=======================================================================
Handle(Adaptor2d_Curve2d) Adaptor2d_OffsetCurve::ShallowCopy() const
{
Handle(Adaptor2d_OffsetCurve) aCopy = new Adaptor2d_OffsetCurve();
if (!myCurve.IsNull())
{
aCopy->myCurve = myCurve->ShallowCopy();
}
aCopy->myOffset = myOffset;
aCopy->myFirst = myFirst;
aCopy->myLast = myLast;
return aCopy;
}
//=======================================================================
//function : Load
//purpose :

View File

@ -57,6 +57,9 @@ public:
//! WFirst,WLast define the bounds of the Offset curve.
Standard_EXPORT Adaptor2d_OffsetCurve(const Handle(Adaptor2d_Curve2d)& C, const Standard_Real Offset, const Standard_Real WFirst, const Standard_Real WLast);
//! Shallow copy of adaptor
Standard_EXPORT virtual Handle(Adaptor2d_Curve2d) ShallowCopy() const Standard_OVERRIDE;
//! Changes the curve. The Offset is reset to 0.
Standard_EXPORT void Load (const Handle(Adaptor2d_Curve2d)& S);

View File

@ -41,6 +41,16 @@ Adaptor3d_Curve::~Adaptor3d_Curve()
{
}
//=======================================================================
//function : ShallowCopy
//purpose :
//=======================================================================
Handle(Adaptor3d_Curve) Adaptor3d_Curve::ShallowCopy() const
{
throw Standard_NotImplemented("Adaptor3d_Curve::ShallowCopy");
}
//=======================================================================
//function : FirstParameter
//purpose :

View File

@ -58,6 +58,9 @@ class Adaptor3d_Curve : public Standard_Transient
DEFINE_STANDARD_RTTIEXT(Adaptor3d_Curve, Standard_Transient)
public:
//! Shallow copy of adaptor
Standard_EXPORT virtual Handle(Adaptor3d_Curve) ShallowCopy() const;
Standard_EXPORT virtual Standard_Real FirstParameter() const;
Standard_EXPORT virtual Standard_Real LastParameter() const;

View File

@ -718,6 +718,40 @@ Adaptor3d_CurveOnSurface::Adaptor3d_CurveOnSurface
Load(C);
}
//=======================================================================
//function : ShallowCopy
//purpose :
//=======================================================================
Handle(Adaptor3d_Curve) Adaptor3d_CurveOnSurface::ShallowCopy() const
{
Handle(Adaptor3d_CurveOnSurface) aCopy = new Adaptor3d_CurveOnSurface();
if (!mySurface.IsNull())
{
aCopy->mySurface = mySurface->ShallowCopy();
}
if (!myCurve.IsNull())
{
aCopy->myCurve = myCurve->ShallowCopy();
}
aCopy->myType = myType;
aCopy->myCirc = myCirc;
aCopy->myLin = myLin;
if (!myFirstSurf.IsNull())
{
aCopy->myFirstSurf = myFirstSurf->ShallowCopy();
}
if (!myLastSurf.IsNull())
{
aCopy->myLastSurf = myLastSurf->ShallowCopy();
}
aCopy->myIntervals = myIntervals;
aCopy->myIntCont = myIntCont;
return aCopy;
}
//=======================================================================
//function : Load
//purpose :

View File

@ -45,6 +45,9 @@ public:
//! the surface <S>.
Standard_EXPORT Adaptor3d_CurveOnSurface(const Handle(Adaptor2d_Curve2d)& C, const Handle(Adaptor3d_Surface)& S);
//! Shallow copy of adaptor
Standard_EXPORT virtual Handle(Adaptor3d_Curve) ShallowCopy() const Standard_OVERRIDE;
//! Changes the surface.
Standard_EXPORT void Load (const Handle(Adaptor3d_Surface)& S);

View File

@ -104,6 +104,27 @@ Adaptor3d_IsoCurve::Adaptor3d_IsoCurve(const Handle(Adaptor3d_Surface)& theS,
Load(theIso, theParam, theWFirst, theWLast);
}
//=======================================================================
//function : ShallowCopy
//purpose :
//=======================================================================
Handle(Adaptor3d_Curve) Adaptor3d_IsoCurve::ShallowCopy() const
{
Handle(Adaptor3d_IsoCurve) aCopy = new Adaptor3d_IsoCurve();
if (!mySurface.IsNull())
{
aCopy->mySurface = mySurface->ShallowCopy();
}
aCopy->myIso = myIso;
aCopy->myFirst = myFirst;
aCopy->myLast = myLast;
aCopy->myParameter = myParameter;
return aCopy;
}
//=======================================================================
//function : Load
//purpose :

View File

@ -49,6 +49,9 @@ public:
//! iso. WFirst,WLast define the bounds of the iso.
Standard_EXPORT Adaptor3d_IsoCurve(const Handle(Adaptor3d_Surface)& S, const GeomAbs_IsoType Iso, const Standard_Real Param, const Standard_Real WFirst, const Standard_Real WLast);
//! Shallow copy of adaptor
Standard_EXPORT virtual Handle(Adaptor3d_Curve) ShallowCopy() const Standard_OVERRIDE;
//! Changes the surface. The iso is reset to
//! NoneIso.
Standard_EXPORT void Load (const Handle(Adaptor3d_Surface)& S);

View File

@ -43,6 +43,15 @@ Adaptor3d_Surface::~Adaptor3d_Surface()
{
}
//=======================================================================
//function : ShallowCopy()
//purpose :
//=======================================================================
Handle(Adaptor3d_Surface) Adaptor3d_Surface::ShallowCopy() const
{
throw Standard_NotImplemented("Adaptor3d_Surface::ShallowCopy");
}
//=======================================================================
//function : FirstUParameter
//purpose :

View File

@ -59,6 +59,9 @@ class Adaptor3d_Surface : public Standard_Transient
DEFINE_STANDARD_RTTIEXT(Adaptor3d_Surface, Standard_Transient)
public:
//! Shallow copy of adaptor
Standard_EXPORT virtual Handle(Adaptor3d_Surface) ShallowCopy() const;
Standard_EXPORT virtual Standard_Real FirstUParameter() const;
Standard_EXPORT virtual Standard_Real LastUParameter() const;

View File

@ -79,6 +79,34 @@ BRepAdaptor_CompCurve::BRepAdaptor_CompCurve(const TopoDS_Wire& theWire,
Initialize(theWire, theIsAC, theFirst, theLast, theTolerance);
}
//=======================================================================
//function : ShallowCopy
//purpose :
//=======================================================================
Handle(Adaptor3d_Curve) BRepAdaptor_CompCurve::ShallowCopy() const
{
Handle(BRepAdaptor_CompCurve) aCopy = new BRepAdaptor_CompCurve();
aCopy->myWire = myWire;
aCopy->TFirst = TFirst;
aCopy->TLast = TLast;
aCopy->PTol = PTol;
aCopy->myCurves = new (BRepAdaptor_HArray1OfCurve) (1, myCurves->Size());
for (Standard_Integer anI = 1; anI <= myCurves->Size(); ++anI)
{
const Handle(Adaptor3d_Curve) aCurve = myCurves->Value(anI).ShallowCopy();
const BRepAdaptor_Curve& aBrepCurve = *(Handle(BRepAdaptor_Curve)::DownCast(aCurve));
aCopy->myCurves->SetValue(anI, aBrepCurve);
}
aCopy->myKnots = myKnots;
aCopy->CurIndex = CurIndex;
aCopy->Forward = Forward;
aCopy->IsbyAC = IsbyAC;
return aCopy;
}
void BRepAdaptor_CompCurve::Initialize(const TopoDS_Wire& W,
const Standard_Boolean AC)
{

View File

@ -74,6 +74,9 @@ public:
//! <W>.
Standard_EXPORT BRepAdaptor_CompCurve(const TopoDS_Wire& W, const Standard_Boolean KnotByCurvilinearAbcissa, const Standard_Real First, const Standard_Real Last, const Standard_Real Tol);
//! Shallow copy of adaptor
Standard_EXPORT virtual Handle(Adaptor3d_Curve) ShallowCopy() const Standard_OVERRIDE;
//! Sets the wire <W>.
Standard_EXPORT void Initialize (const TopoDS_Wire& W, const Standard_Boolean KnotByCurvilinearAbcissa);

View File

@ -73,6 +73,30 @@ BRepAdaptor_Curve::BRepAdaptor_Curve(const TopoDS_Edge& E,
Initialize(E,F);
}
//=======================================================================
//function : ShallowCopy
//purpose :
//=======================================================================
Handle(Adaptor3d_Curve) BRepAdaptor_Curve::ShallowCopy() const
{
Handle(BRepAdaptor_Curve) aCopy = new BRepAdaptor_Curve();
aCopy->myTrsf = myTrsf;
const Handle(Adaptor3d_Curve) aCurve = myCurve.ShallowCopy();
const GeomAdaptor_Curve& aGeomCurve = *(Handle(GeomAdaptor_Curve)::DownCast(aCurve));
aCopy->myCurve = aGeomCurve;
if (!myConSurf.IsNull())
{
aCopy->myConSurf = Handle(Adaptor3d_CurveOnSurface)::DownCast(myConSurf->ShallowCopy());
}
aCopy->myEdge = myEdge;
return aCopy;
}
//=======================================================================
//function : Reset
//purpose :

View File

@ -82,6 +82,9 @@ public:
//! the face.
Standard_EXPORT BRepAdaptor_Curve(const TopoDS_Edge& E, const TopoDS_Face& F);
//! Shallow copy of adaptor
Standard_EXPORT virtual Handle(Adaptor3d_Curve) ShallowCopy() const Standard_OVERRIDE;
//! Reset currently loaded curve (undone Load()).
Standard_EXPORT void Reset();

View File

@ -43,6 +43,27 @@ BRepAdaptor_Curve2d::BRepAdaptor_Curve2d(const TopoDS_Edge& E,
Initialize(E,F);
}
//=======================================================================
//function : ShallowCopy
//purpose :
//=======================================================================
Handle(Adaptor2d_Curve2d) BRepAdaptor_Curve2d::ShallowCopy() const
{
Handle(BRepAdaptor_Curve2d) aCopy = new BRepAdaptor_Curve2d();
aCopy->myCurve = myCurve;
aCopy->myTypeCurve = myTypeCurve;
aCopy->myFirst = myFirst;
aCopy->myLast = myLast;
aCopy->myBSplineCurve = myBSplineCurve;
if (!myNestedEvaluator.IsNull())
{
aCopy->myNestedEvaluator = myNestedEvaluator->ShallowCopy();
}
return aCopy;
}
//=======================================================================
//function : Initialize

View File

@ -49,6 +49,9 @@ public:
//! Creates with the pcurve of <E> on <F>.
Standard_EXPORT BRepAdaptor_Curve2d(const TopoDS_Edge& E, const TopoDS_Face& F);
//! Shallow copy of adaptor
Standard_EXPORT virtual Handle(Adaptor2d_Curve2d) ShallowCopy() const Standard_OVERRIDE;
//! Initialize with the pcurve of <E> on <F>.
Standard_EXPORT void Initialize (const TopoDS_Edge& E, const TopoDS_Face& F);

View File

@ -63,6 +63,24 @@ BRepAdaptor_Surface::BRepAdaptor_Surface(const TopoDS_Face& F,
}
//=======================================================================
//function : ShallowCopy
//purpose :
//=======================================================================
Handle(Adaptor3d_Surface) BRepAdaptor_Surface::ShallowCopy() const
{
Handle(BRepAdaptor_Surface) aCopy = new BRepAdaptor_Surface();
const Handle(Adaptor3d_Surface) aSurface = mySurf.ShallowCopy();
const GeomAdaptor_Surface& aGeomSurface = *(Handle(GeomAdaptor_Surface)::DownCast(aSurface));
aCopy->mySurf = aGeomSurface;
aCopy->myTrsf = myTrsf;
aCopy->myFace = myFace;
return aCopy;
}
//=======================================================================
//function : Initialize
//purpose :

View File

@ -68,6 +68,9 @@ public:
//! the parameter range in the UV space of the
//! restriction.
Standard_EXPORT BRepAdaptor_Surface(const TopoDS_Face& F, const Standard_Boolean R = Standard_True);
//! Shallow copy of adaptor
Standard_EXPORT virtual Handle(Adaptor3d_Surface) ShallowCopy() const Standard_OVERRIDE;
//! Sets the surface to the geometry of <F>.
Standard_EXPORT void Initialize (const TopoDS_Face& F, const Standard_Boolean Restriction = Standard_True);

View File

@ -64,7 +64,24 @@ BiTgte_CurveOnEdge::BiTgte_CurveOnEdge(const TopoDS_Edge& theEonF,
Init(theEonF, theEdge);
}
//=======================================================================
//function : ShallowCopy
//purpose :
//=======================================================================
Handle(Adaptor3d_Curve) BiTgte_CurveOnEdge::ShallowCopy() const
{
Handle(BiTgte_CurveOnEdge) aCopy = new BiTgte_CurveOnEdge();
aCopy->myEdge = myEdge;
aCopy->myEonF = myEonF;
aCopy->myCurv = myCurv;
aCopy->myConF = myConF;
aCopy->myType = myType;
aCopy->myCirc = myCirc;
return aCopy;
}
//=======================================================================
//function : Init
//purpose :

View File

@ -57,6 +57,9 @@ public:
Standard_EXPORT BiTgte_CurveOnEdge();
Standard_EXPORT BiTgte_CurveOnEdge(const TopoDS_Edge& EonF, const TopoDS_Edge& Edge);
//! Shallow copy of adaptor
Standard_EXPORT virtual Handle(Adaptor3d_Curve) ShallowCopy() const Standard_OVERRIDE;
Standard_EXPORT void Init (const TopoDS_Edge& EonF, const TopoDS_Edge& Edge);

View File

@ -51,6 +51,34 @@ ChFiDS_ElSpine::ChFiDS_ElSpine()
{
}
//=======================================================================
//function : ShallowCopy
//purpose :
//=======================================================================
Handle(Adaptor3d_Curve) ChFiDS_ElSpine::ShallowCopy() const
{
Handle(ChFiDS_ElSpine) aCopy = new ChFiDS_ElSpine();
const Handle(Adaptor3d_Curve) aCurve = curve.ShallowCopy();
const GeomAdaptor_Curve& aGeomCurve = *(Handle(GeomAdaptor_Curve)::DownCast(aCurve));
aCopy->curve = aGeomCurve;
aCopy->ptfirst = ptfirst;
aCopy->ptlast = ptlast;
aCopy->tgfirst = tgfirst;
aCopy->tglast = tglast;
aCopy->VerticesWithTangents = VerticesWithTangents;
aCopy->previous = previous;
aCopy->next = next;
aCopy->pfirst = pfirst;
aCopy->plast = plast;
aCopy->period = period;
aCopy->periodic = periodic;
aCopy->pfirstsav = pfirstsav;
aCopy->plastsav = plastsav;
return aCopy;
}
//=======================================================================
//function : FirstParameter
@ -449,7 +477,7 @@ Handle(ChFiDS_SurfData)& ChFiDS_ElSpine::ChangeNext()
gp_Lin ChFiDS_ElSpine::Line() const
{
return curve.Line();
return curve.Line();
}
//=======================================================================
@ -479,7 +507,7 @@ gp_Elips ChFiDS_ElSpine::Ellipse() const
gp_Hypr ChFiDS_ElSpine::Hyperbola() const
{
return curve.Hyperbola();
return curve.Hyperbola();
}
//=======================================================================

View File

@ -57,6 +57,9 @@ class ChFiDS_ElSpine : public Adaptor3d_Curve
public:
Standard_EXPORT ChFiDS_ElSpine();
//! Shallow copy of adaptor
Standard_EXPORT virtual Handle(Adaptor3d_Curve) ShallowCopy() const Standard_OVERRIDE;
Standard_EXPORT virtual Standard_Real FirstParameter() const Standard_OVERRIDE;

View File

@ -65,6 +65,28 @@ static const Standard_Real PosTol = Precision::PConfusion() / 2;
IMPLEMENT_STANDARD_RTTIEXT(Geom2dAdaptor_Curve, Adaptor2d_Curve2d)
//=======================================================================
//function : ShallowCopy
//purpose :
//=======================================================================
Handle(Adaptor2d_Curve2d) Geom2dAdaptor_Curve::ShallowCopy() const
{
Handle(Geom2dAdaptor_Curve) aCopy = new Geom2dAdaptor_Curve();
aCopy->myCurve = myCurve;
aCopy->myTypeCurve = myTypeCurve;
aCopy->myFirst = myFirst;
aCopy->myLast = myLast;
aCopy->myBSplineCurve = myBSplineCurve;
if(!myNestedEvaluator.IsNull())
{
aCopy->myNestedEvaluator = myNestedEvaluator->ShallowCopy();
}
return aCopy;
}
//=======================================================================
//function : LocalContinuity
//purpose : Computes the Continuity of a BSplineCurve

View File

@ -58,6 +58,9 @@ public:
//! Standard_ConstructionError is raised if Ufirst>Ulast
Standard_EXPORT Geom2dAdaptor_Curve(const Handle(Geom2d_Curve)& C, const Standard_Real UFirst, const Standard_Real ULast);
//! Shallow copy of adaptor
Standard_EXPORT virtual Handle(Adaptor2d_Curve2d) ShallowCopy() const Standard_OVERRIDE;
//! Reset currently loaded curve (undone Load()).
Standard_EXPORT void Reset();
@ -183,7 +186,7 @@ private:
//! \param theParameter the value on the knot axis which identifies the caching span
void RebuildCache (const Standard_Real theParameter) const;
private:
protected:
Handle(Geom2d_Curve) myCurve;
GeomAbs_CurveType myTypeCurve;

View File

@ -44,6 +44,8 @@ public:
virtual gp_Vec2d DN(const Standard_Real theU,
const Standard_Integer theDerU) const = 0;
virtual Handle(Geom2dEvaluator_Curve) ShallowCopy() const = 0;
DEFINE_STANDARD_RTTI_INLINE(Geom2dEvaluator_Curve,Standard_Transient)
};

View File

@ -113,6 +113,22 @@ gp_Vec2d Geom2dEvaluator_OffsetCurve::DN(const Standard_Real theU,
return aDN;
}
Handle(Geom2dEvaluator_Curve) Geom2dEvaluator_OffsetCurve::ShallowCopy() const
{
Handle(Geom2dEvaluator_OffsetCurve) aCopy;
if (!myBaseAdaptor.IsNull())
{
aCopy = new Geom2dEvaluator_OffsetCurve(Handle(Geom2dAdaptor_Curve)::DownCast(myBaseAdaptor->ShallowCopy()),
myOffset);
}
else
{
aCopy = new Geom2dEvaluator_OffsetCurve(myBaseCurve, myOffset);
}
return aCopy;
}
void Geom2dEvaluator_OffsetCurve::BaseD0(const Standard_Real theU,
gp_Pnt2d& theValue) const

View File

@ -53,6 +53,8 @@ public:
Standard_EXPORT gp_Vec2d DN(const Standard_Real theU,
const Standard_Integer theDeriv) const Standard_OVERRIDE;
Standard_EXPORT Handle(Geom2dEvaluator_Curve) ShallowCopy() const Standard_OVERRIDE;
DEFINE_STANDARD_RTTIEXT(Geom2dEvaluator_OffsetCurve,Geom2dEvaluator_Curve)
private:

View File

@ -63,6 +63,28 @@ static const Standard_Real PosTol = Precision::PConfusion() / 2;
IMPLEMENT_STANDARD_RTTIEXT(GeomAdaptor_Curve, Adaptor3d_Curve)
//=======================================================================
//function : ShallowCopy
//purpose :
//=======================================================================
Handle(Adaptor3d_Curve) GeomAdaptor_Curve::ShallowCopy() const
{
Handle(GeomAdaptor_Curve) aCopy = new GeomAdaptor_Curve();
aCopy->myCurve = myCurve;
aCopy->myTypeCurve = myTypeCurve;
aCopy->myFirst = myFirst;
aCopy->myLast = myLast;
aCopy->myBSplineCurve = myBSplineCurve;
if (!myNestedEvaluator.IsNull())
{
aCopy->myNestedEvaluator = myNestedEvaluator->ShallowCopy();
}
return aCopy;
}
//=======================================================================
//function : LocalContinuity
//purpose : Computes the Continuity of a BSplineCurve

View File

@ -54,6 +54,9 @@ public:
Load (theCurve, theUFirst, theULast);
}
//! Shallow copy of adaptor
Standard_EXPORT virtual Handle(Adaptor3d_Curve) ShallowCopy() const Standard_OVERRIDE;
//! Reset currently loaded curve (undone Load()).
Standard_EXPORT void Reset();

View File

@ -114,6 +114,33 @@ GeomAbs_Shape LocalContinuity(Standard_Integer Degree,
return GeomAbs_CN;
}
//=======================================================================
//function : ShallowCopy
//purpose :
//=======================================================================
Handle(Adaptor3d_Surface) GeomAdaptor_Surface::ShallowCopy() const
{
Handle(GeomAdaptor_Surface) aCopy = new GeomAdaptor_Surface();
aCopy->mySurface = mySurface;
aCopy->myUFirst = myUFirst;
aCopy->myULast = myULast;
aCopy->myVFirst = myVFirst;
aCopy->myVLast = myVLast;
aCopy->myTolU = myTolU;
aCopy->myTolV = myTolV;
aCopy->myBSplineSurface = myBSplineSurface;
aCopy->mySurfaceType = mySurfaceType;
if (!myNestedEvaluator.IsNull())
{
aCopy->myNestedEvaluator = myNestedEvaluator->ShallowCopy();
}
return aCopy;
}
//=======================================================================
//function : Load
//purpose :

View File

@ -61,6 +61,9 @@ public:
Load (theSurf, theUFirst, theULast, theVFirst, theVLast, theTolU, theTolV);
}
//! Shallow copy of adaptor
Standard_EXPORT virtual Handle(Adaptor3d_Surface) ShallowCopy() const Standard_OVERRIDE;
void Load (const Handle(Geom_Surface)& theSurf)
{
if (theSurf.IsNull()) { throw Standard_NullObject("GeomAdaptor_Surface::Load"); }
@ -257,7 +260,7 @@ private:
//! \param theV second parameter to identify the span for caching
Standard_EXPORT void RebuildCache (const Standard_Real theU, const Standard_Real theV) const;
private:
protected:
Handle(Geom_Surface) mySurface;
Standard_Real myUFirst;
@ -270,7 +273,6 @@ private:
Handle(Geom_BSplineSurface) myBSplineSurface; ///< B-spline representation to prevent downcasts
mutable Handle(BSplSLib_Cache) mySurfaceCache; ///< Cached data for B-spline or Bezier surface
protected:
GeomAbs_SurfaceType mySurfaceType;
Handle(GeomEvaluator_Surface) myNestedEvaluator; ///< Calculates values of nested complex surfaces (offset surface, surface of extrusion or revolution)
};

View File

@ -58,6 +58,39 @@ GeomAdaptor_SurfaceOfLinearExtrusion::GeomAdaptor_SurfaceOfLinearExtrusion
Load(V);
}
//=======================================================================
//function : ShallowCopy
//purpose :
//=======================================================================
Handle(Adaptor3d_Surface) GeomAdaptor_SurfaceOfLinearExtrusion::ShallowCopy() const
{
Handle(GeomAdaptor_SurfaceOfLinearExtrusion) aCopy = new GeomAdaptor_SurfaceOfLinearExtrusion();
if (!myBasisCurve.IsNull())
{
aCopy->myBasisCurve = myBasisCurve->ShallowCopy();
}
aCopy->myDirection = myDirection;
aCopy->myHaveDir = myHaveDir;
aCopy->mySurface = mySurface;
aCopy->myUFirst = myUFirst;
aCopy->myULast = myULast;
aCopy->myVFirst = myVFirst;
aCopy->myVLast = myVLast;
aCopy->myTolU = myTolU;
aCopy->myTolV = myTolV;
aCopy->myBSplineSurface = myBSplineSurface;
aCopy->mySurfaceType = mySurfaceType;
if (!myNestedEvaluator.IsNull())
{
aCopy->myNestedEvaluator = myNestedEvaluator->ShallowCopy();
}
return aCopy;
}
//=======================================================================
//function : Load
//purpose :

View File

@ -57,6 +57,9 @@ public:
//! Thew Curve and the Direction are loaded.
Standard_EXPORT GeomAdaptor_SurfaceOfLinearExtrusion(const Handle(Adaptor3d_Curve)& C, const gp_Dir& V);
//! Shallow copy of adaptor
Standard_EXPORT virtual Handle(Adaptor3d_Surface) ShallowCopy() const Standard_OVERRIDE;
//! Changes the Curve
Standard_EXPORT void Load (const Handle(Adaptor3d_Curve)& C);

View File

@ -58,6 +58,41 @@ GeomAdaptor_SurfaceOfRevolution::GeomAdaptor_SurfaceOfRevolution(
Load(V);
}
//=======================================================================
//function : ShallowCopy
//purpose :
//=======================================================================
Handle(Adaptor3d_Surface) GeomAdaptor_SurfaceOfRevolution::ShallowCopy() const
{
Handle(GeomAdaptor_SurfaceOfRevolution) aCopy = new GeomAdaptor_SurfaceOfRevolution();
if (!myBasisCurve.IsNull())
{
aCopy->myBasisCurve = myBasisCurve->ShallowCopy();
}
aCopy->myAxis = myAxis;
aCopy->myHaveAxis = myHaveAxis;
aCopy->myAxeRev = myAxeRev;
aCopy->mySurface = mySurface;
aCopy->myUFirst = myUFirst;
aCopy->myULast = myULast;
aCopy->myVFirst = myVFirst;
aCopy->myVLast = myVLast;
aCopy->myTolU = myTolU;
aCopy->myTolV = myTolV;
aCopy->myBSplineSurface = myBSplineSurface;
aCopy->mySurfaceType = mySurfaceType;
if (!myNestedEvaluator.IsNull())
{
aCopy->myNestedEvaluator = myNestedEvaluator->ShallowCopy();
}
return aCopy;
}
//=======================================================================
//function : Load
//purpose :

View File

@ -65,6 +65,9 @@ public:
//! The Curve and the Direction are loaded.
Standard_EXPORT GeomAdaptor_SurfaceOfRevolution(const Handle(Adaptor3d_Curve)& C, const gp_Ax1& V);
//! Shallow copy of adaptor
Standard_EXPORT virtual Handle(Adaptor3d_Surface) ShallowCopy() const Standard_OVERRIDE;
//! Changes the Curve
Standard_EXPORT void Load (const Handle(Adaptor3d_Curve)& C);

View File

@ -44,6 +44,8 @@ public:
virtual gp_Vec DN(const Standard_Real theU,
const Standard_Integer theDerU) const = 0;
virtual Handle(GeomEvaluator_Curve) ShallowCopy() const = 0;
DEFINE_STANDARD_RTTI_INLINE(GeomEvaluator_Curve,Standard_Transient)
};

View File

@ -117,6 +117,21 @@ gp_Vec GeomEvaluator_OffsetCurve::DN(const Standard_Real theU,
return aDN;
}
Handle(GeomEvaluator_Curve) GeomEvaluator_OffsetCurve::ShallowCopy() const
{
Handle(GeomEvaluator_OffsetCurve) aCopy;
if (!myBaseAdaptor.IsNull())
{
aCopy = new GeomEvaluator_OffsetCurve(Handle(GeomAdaptor_Curve)::DownCast(myBaseAdaptor->ShallowCopy()),
myOffset, myOffsetDir);
}
else
{
aCopy = new GeomEvaluator_OffsetCurve(myBaseCurve, myOffset, myOffsetDir);
}
return aCopy;
}
void GeomEvaluator_OffsetCurve::BaseD0(const Standard_Real theU,
gp_Pnt& theValue) const

View File

@ -59,6 +59,8 @@ public:
Standard_EXPORT gp_Vec DN(const Standard_Real theU,
const Standard_Integer theDeriv) const Standard_OVERRIDE;
Standard_EXPORT virtual Handle(GeomEvaluator_Curve) ShallowCopy() const Standard_OVERRIDE;
DEFINE_STANDARD_RTTIEXT(GeomEvaluator_OffsetCurve,GeomEvaluator_Curve)
private:

View File

@ -408,6 +408,22 @@ gp_Vec GeomEvaluator_OffsetSurface::DN(
}
}
Handle(GeomEvaluator_Surface) GeomEvaluator_OffsetSurface::ShallowCopy() const
{
Handle(GeomEvaluator_OffsetSurface) aCopy;
if (!myBaseAdaptor.IsNull())
{
aCopy = new GeomEvaluator_OffsetSurface(Handle(GeomAdaptor_Surface)::DownCast(myBaseAdaptor->ShallowCopy()),
myOffset, myOscSurf);
}
else
{
aCopy = new GeomEvaluator_OffsetSurface(myBaseSurf, myOffset, myOscSurf);
}
return aCopy;
}
void GeomEvaluator_OffsetSurface::BaseD0(const Standard_Real theU, const Standard_Real theV,
gp_Pnt& theValue) const

View File

@ -63,6 +63,8 @@ public:
const Standard_Integer theDerU,
const Standard_Integer theDerV) const Standard_OVERRIDE;
Standard_EXPORT Handle(GeomEvaluator_Surface) ShallowCopy() const Standard_OVERRIDE;
DEFINE_STANDARD_RTTIEXT(GeomEvaluator_OffsetSurface,GeomEvaluator_Surface)
private:

View File

@ -49,6 +49,8 @@ public:
virtual gp_Vec DN(const Standard_Real theU, const Standard_Real theV,
const Standard_Integer theDerU, const Standard_Integer theDerV) const = 0;
virtual Handle(GeomEvaluator_Surface) ShallowCopy() const = 0;
DEFINE_STANDARD_RTTI_INLINE(GeomEvaluator_Surface,Standard_Transient)
};

View File

@ -119,3 +119,18 @@ gp_Vec GeomEvaluator_SurfaceOfExtrusion::DN(
return aResult;
}
Handle(GeomEvaluator_Surface) GeomEvaluator_SurfaceOfExtrusion::ShallowCopy() const
{
Handle(GeomEvaluator_SurfaceOfExtrusion) aCopy;
if (!myBaseAdaptor.IsNull())
{
aCopy = new GeomEvaluator_SurfaceOfExtrusion(myBaseAdaptor->ShallowCopy(), myDirection);
}
else
{
aCopy = new GeomEvaluator_SurfaceOfExtrusion(myBaseCurve, myDirection);
}
return aCopy;
}

View File

@ -59,6 +59,8 @@ public:
const Standard_Integer theDerU,
const Standard_Integer theDerV) const Standard_OVERRIDE;
Standard_EXPORT Handle(GeomEvaluator_Surface) ShallowCopy() const Standard_OVERRIDE;
DEFINE_STANDARD_RTTIEXT(GeomEvaluator_SurfaceOfExtrusion,GeomEvaluator_Surface)
private:

View File

@ -203,3 +203,20 @@ gp_Vec GeomEvaluator_SurfaceOfRevolution::DN(
return aResult;
}
Handle(GeomEvaluator_Surface) GeomEvaluator_SurfaceOfRevolution::ShallowCopy() const
{
Handle(GeomEvaluator_SurfaceOfRevolution) aCopy;
if (!myBaseAdaptor.IsNull())
{
aCopy = new GeomEvaluator_SurfaceOfRevolution(myBaseAdaptor->ShallowCopy(),
myRotAxis.Direction(), myRotAxis.Location());
}
else
{
aCopy = new GeomEvaluator_SurfaceOfRevolution(myBaseCurve,
myRotAxis.Direction(), myRotAxis.Location());
}
return aCopy;
}

View File

@ -71,6 +71,8 @@ public:
const Standard_Integer theDerU,
const Standard_Integer theDerV) const Standard_OVERRIDE;
Standard_EXPORT Handle(GeomEvaluator_Surface) ShallowCopy() const Standard_OVERRIDE;
DEFINE_STANDARD_RTTIEXT(GeomEvaluator_SurfaceOfRevolution,GeomEvaluator_Surface)
private:

View File

@ -29,6 +29,18 @@ GeomFill_SnglrFunc::GeomFill_SnglrFunc(const Handle(Adaptor3d_Curve)& HC) :
{
}
//=======================================================================
//function : ShallowCopy
//purpose :
//=======================================================================
Handle(Adaptor3d_Curve) GeomFill_SnglrFunc::ShallowCopy() const
{
Handle(GeomFill_SnglrFunc) aCopy = new GeomFill_SnglrFunc(myHCurve->ShallowCopy());
aCopy->ratio = ratio;
return aCopy;
}
void GeomFill_SnglrFunc::SetRatio(const Standard_Real Ratio)
{
ratio = Ratio;

View File

@ -44,6 +44,9 @@ public:
Standard_EXPORT GeomFill_SnglrFunc(const Handle(Adaptor3d_Curve)& HC);
//! Shallow copy of adaptor
Standard_EXPORT virtual Handle(Adaptor3d_Curve) ShallowCopy() const Standard_OVERRIDE;
Standard_EXPORT void SetRatio (const Standard_Real Ratio);

View File

@ -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;

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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);