From 4837af7895a106c3f915f55a1091dc3c5df2214d Mon Sep 17 00:00:00 2001 From: asuraven Date: Tue, 20 Jul 2021 18:44:23 +0300 Subject: [PATCH] 0032485: Modeling Algorithms - Add Clone() function for adapters --- src/Adaptor2d/Adaptor2d_Curve2d.cxx | 10 ++ src/Adaptor2d/Adaptor2d_Curve2d.hxx | 3 + src/Adaptor2d/Adaptor2d_Line2d.cxx | 16 ++++ src/Adaptor2d/Adaptor2d_Line2d.hxx | 5 +- src/Adaptor2d/Adaptor2d_OffsetCurve.cxx | 16 ++++ src/Adaptor2d/Adaptor2d_OffsetCurve.hxx | 3 + src/Adaptor3d/Adaptor3d_Curve.cxx | 10 ++ src/Adaptor3d/Adaptor3d_Curve.hxx | 3 + src/Adaptor3d/Adaptor3d_CurveOnSurface.cxx | 22 +++++ src/Adaptor3d/Adaptor3d_CurveOnSurface.hxx | 3 + src/Adaptor3d/Adaptor3d_IsoCurve.cxx | 17 ++++ src/Adaptor3d/Adaptor3d_IsoCurve.hxx | 3 + src/Adaptor3d/Adaptor3d_Surface.cxx | 9 ++ src/Adaptor3d/Adaptor3d_Surface.hxx | 3 + src/BRepAdaptor/BRepAdaptor_CompCurve.cxx | 22 +++++ src/BRepAdaptor/BRepAdaptor_CompCurve.hxx | 3 + src/BRepAdaptor/BRepAdaptor_Curve.cxx | 93 ++++++++++++------- src/BRepAdaptor/BRepAdaptor_Curve.hxx | 5 +- src/BRepAdaptor/BRepAdaptor_Curve2d.cxx | 19 ++++ src/BRepAdaptor/BRepAdaptor_Curve2d.hxx | 3 + src/BRepAdaptor/BRepAdaptor_Surface.cxx | 15 +++ src/BRepAdaptor/BRepAdaptor_Surface.hxx | 3 + src/BiTgte/BiTgte_CurveOnEdge.cxx | 17 ++++ src/BiTgte/BiTgte_CurveOnEdge.hxx | 3 + src/ChFiDS/ChFiDS_ElSpine.cxx | 68 +++++++++----- src/ChFiDS/ChFiDS_ElSpine.hxx | 5 +- src/Geom2dAdaptor/Geom2dAdaptor_Curve.cxx | 19 ++++ src/Geom2dAdaptor/Geom2dAdaptor_Curve.hxx | 5 +- src/GeomAdaptor/GeomAdaptor_Curve.cxx | 19 ++++ src/GeomAdaptor/GeomAdaptor_Curve.hxx | 3 + src/GeomAdaptor/GeomAdaptor_Surface.cxx | 24 +++++ src/GeomAdaptor/GeomAdaptor_Surface.hxx | 6 +- .../GeomAdaptor_SurfaceOfLinearExtrusion.cxx | 28 ++++++ .../GeomAdaptor_SurfaceOfLinearExtrusion.hxx | 3 + .../GeomAdaptor_SurfaceOfRevolution.cxx | 30 ++++++ .../GeomAdaptor_SurfaceOfRevolution.hxx | 3 + src/GeomFill/GeomFill_SnglrFunc.cxx | 12 +++ src/GeomFill/GeomFill_SnglrFunc.hxx | 3 + src/GeomLib/GeomLib_CheckCurveOnSurface.cxx | 48 +++++----- src/ProjLib/ProjLib_CompProjectedCurve.cxx | 25 +++++ src/ProjLib/ProjLib_CompProjectedCurve.hxx | 3 + src/ProjLib/ProjLib_ProjectOnPlane.cxx | 23 +++++ src/ProjLib/ProjLib_ProjectOnPlane.hxx | 3 + src/ProjLib/ProjLib_ProjectedCurve.cxx | 21 +++++ src/ProjLib/ProjLib_ProjectedCurve.hxx | 3 + 45 files changed, 573 insertions(+), 87 deletions(-) diff --git a/src/Adaptor2d/Adaptor2d_Curve2d.cxx b/src/Adaptor2d/Adaptor2d_Curve2d.cxx index 3df4666d44..5bcd2eb872 100644 --- a/src/Adaptor2d/Adaptor2d_Curve2d.cxx +++ b/src/Adaptor2d/Adaptor2d_Curve2d.cxx @@ -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 : diff --git a/src/Adaptor2d/Adaptor2d_Curve2d.hxx b/src/Adaptor2d/Adaptor2d_Curve2d.hxx index ae14128738..1da082692c 100644 --- a/src/Adaptor2d/Adaptor2d_Curve2d.hxx +++ b/src/Adaptor2d/Adaptor2d_Curve2d.hxx @@ -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; diff --git a/src/Adaptor2d/Adaptor2d_Line2d.cxx b/src/Adaptor2d/Adaptor2d_Line2d.cxx index 7e5cd5deec..16792e654a 100644 --- a/src/Adaptor2d/Adaptor2d_Line2d.cxx +++ b/src/Adaptor2d/Adaptor2d_Line2d.cxx @@ -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 : diff --git a/src/Adaptor2d/Adaptor2d_Line2d.hxx b/src/Adaptor2d/Adaptor2d_Line2d.hxx index 3cdb10ef14..db8ee1a6c0 100644 --- a/src/Adaptor2d/Adaptor2d_Line2d.hxx +++ b/src/Adaptor2d/Adaptor2d_Line2d.hxx @@ -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); diff --git a/src/Adaptor2d/Adaptor2d_OffsetCurve.cxx b/src/Adaptor2d/Adaptor2d_OffsetCurve.cxx index db84f18200..6a7e86eb9c 100644 --- a/src/Adaptor2d/Adaptor2d_OffsetCurve.cxx +++ b/src/Adaptor2d/Adaptor2d_OffsetCurve.cxx @@ -90,6 +90,22 @@ Adaptor2d_OffsetCurve::Adaptor2d_OffsetCurve( { } +//======================================================================= +//function : ShallowCopy +//purpose : +//======================================================================= + +Handle(Adaptor2d_Curve2d) Adaptor2d_OffsetCurve::ShallowCopy() const +{ + Handle(Adaptor2d_OffsetCurve) aCopy = new Adaptor2d_OffsetCurve(); + + aCopy->myCurve = myCurve; + aCopy->myOffset = myOffset; + aCopy->myFirst = myFirst; + aCopy->myLast = myLast; + + return aCopy; +} //======================================================================= //function : Load //purpose : diff --git a/src/Adaptor2d/Adaptor2d_OffsetCurve.hxx b/src/Adaptor2d/Adaptor2d_OffsetCurve.hxx index bdfa376dd5..14c5bd838d 100644 --- a/src/Adaptor2d/Adaptor2d_OffsetCurve.hxx +++ b/src/Adaptor2d/Adaptor2d_OffsetCurve.hxx @@ -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); diff --git a/src/Adaptor3d/Adaptor3d_Curve.cxx b/src/Adaptor3d/Adaptor3d_Curve.cxx index d82c14b1b8..76b13c5557 100644 --- a/src/Adaptor3d/Adaptor3d_Curve.cxx +++ b/src/Adaptor3d/Adaptor3d_Curve.cxx @@ -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 : diff --git a/src/Adaptor3d/Adaptor3d_Curve.hxx b/src/Adaptor3d/Adaptor3d_Curve.hxx index 52897871e4..78f062eafc 100644 --- a/src/Adaptor3d/Adaptor3d_Curve.hxx +++ b/src/Adaptor3d/Adaptor3d_Curve.hxx @@ -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; diff --git a/src/Adaptor3d/Adaptor3d_CurveOnSurface.cxx b/src/Adaptor3d/Adaptor3d_CurveOnSurface.cxx index a0dff90f24..3967462bc2 100644 --- a/src/Adaptor3d/Adaptor3d_CurveOnSurface.cxx +++ b/src/Adaptor3d/Adaptor3d_CurveOnSurface.cxx @@ -718,6 +718,28 @@ Adaptor3d_CurveOnSurface::Adaptor3d_CurveOnSurface Load(C); } +//======================================================================= +//function : ShallowCopy +//purpose : +//======================================================================= + +Handle(Adaptor3d_Curve) Adaptor3d_CurveOnSurface::ShallowCopy() const +{ + Handle(Adaptor3d_CurveOnSurface) aCopy = new Adaptor3d_CurveOnSurface(); + + aCopy->mySurface = mySurface; + aCopy->myCurve = myCurve; + aCopy->myType = myType; + aCopy->myCirc = myCirc; + aCopy->myLin = myLin; + aCopy->myFirstSurf = myFirstSurf; + aCopy->myLastSurf = myLastSurf; + aCopy->myIntervals = myIntervals; + aCopy->myIntCont = myIntCont; + + return aCopy; +} + //======================================================================= //function : Load //purpose : diff --git a/src/Adaptor3d/Adaptor3d_CurveOnSurface.hxx b/src/Adaptor3d/Adaptor3d_CurveOnSurface.hxx index 96c2309534..554a7edf39 100644 --- a/src/Adaptor3d/Adaptor3d_CurveOnSurface.hxx +++ b/src/Adaptor3d/Adaptor3d_CurveOnSurface.hxx @@ -45,6 +45,9 @@ public: //! the surface . 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); diff --git a/src/Adaptor3d/Adaptor3d_IsoCurve.cxx b/src/Adaptor3d/Adaptor3d_IsoCurve.cxx index 712d89a8a3..092943093a 100644 --- a/src/Adaptor3d/Adaptor3d_IsoCurve.cxx +++ b/src/Adaptor3d/Adaptor3d_IsoCurve.cxx @@ -104,6 +104,23 @@ 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(); + aCopy->mySurface = mySurface; + aCopy->myIso = myIso; + aCopy->myFirst = myFirst; + aCopy->myLast = myLast; + aCopy->myParameter = myParameter; + + return aCopy; +} + //======================================================================= //function : Load //purpose : diff --git a/src/Adaptor3d/Adaptor3d_IsoCurve.hxx b/src/Adaptor3d/Adaptor3d_IsoCurve.hxx index b05da9e2c7..9fa24f5a95 100644 --- a/src/Adaptor3d/Adaptor3d_IsoCurve.hxx +++ b/src/Adaptor3d/Adaptor3d_IsoCurve.hxx @@ -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); diff --git a/src/Adaptor3d/Adaptor3d_Surface.cxx b/src/Adaptor3d/Adaptor3d_Surface.cxx index 5a52130b5c..c48bbc5b42 100644 --- a/src/Adaptor3d/Adaptor3d_Surface.cxx +++ b/src/Adaptor3d/Adaptor3d_Surface.cxx @@ -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 : diff --git a/src/Adaptor3d/Adaptor3d_Surface.hxx b/src/Adaptor3d/Adaptor3d_Surface.hxx index a3163f92da..5972b5ff76 100644 --- a/src/Adaptor3d/Adaptor3d_Surface.hxx +++ b/src/Adaptor3d/Adaptor3d_Surface.hxx @@ -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; diff --git a/src/BRepAdaptor/BRepAdaptor_CompCurve.cxx b/src/BRepAdaptor/BRepAdaptor_CompCurve.cxx index 64acb5ee91..ca1834ec01 100644 --- a/src/BRepAdaptor/BRepAdaptor_CompCurve.cxx +++ b/src/BRepAdaptor/BRepAdaptor_CompCurve.cxx @@ -79,6 +79,28 @@ 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 = myCurves; + 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) { diff --git a/src/BRepAdaptor/BRepAdaptor_CompCurve.hxx b/src/BRepAdaptor/BRepAdaptor_CompCurve.hxx index cf772a41a9..9378600ea0 100644 --- a/src/BRepAdaptor/BRepAdaptor_CompCurve.hxx +++ b/src/BRepAdaptor/BRepAdaptor_CompCurve.hxx @@ -74,6 +74,9 @@ public: //! . 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 . Standard_EXPORT void Initialize (const TopoDS_Wire& W, const Standard_Boolean KnotByCurvilinearAbcissa); diff --git a/src/BRepAdaptor/BRepAdaptor_Curve.cxx b/src/BRepAdaptor/BRepAdaptor_Curve.cxx index f6915be1f6..99d5f011fb 100644 --- a/src/BRepAdaptor/BRepAdaptor_Curve.cxx +++ b/src/BRepAdaptor/BRepAdaptor_Curve.cxx @@ -50,7 +50,9 @@ IMPLEMENT_STANDARD_RTTIEXT(BRepAdaptor_Curve, Adaptor3d_Curve) //purpose : //======================================================================= BRepAdaptor_Curve::BRepAdaptor_Curve() -{} +{ + myCurve = new GeomAdaptor_Curve; +} //======================================================================= //function : BRepAdaptor_Curve @@ -59,6 +61,7 @@ BRepAdaptor_Curve::BRepAdaptor_Curve() BRepAdaptor_Curve::BRepAdaptor_Curve(const TopoDS_Edge& E) { + myCurve = new GeomAdaptor_Curve; Initialize(E); } @@ -70,16 +73,34 @@ BRepAdaptor_Curve::BRepAdaptor_Curve(const TopoDS_Edge& E) BRepAdaptor_Curve::BRepAdaptor_Curve(const TopoDS_Edge& E, const TopoDS_Face& F) { + myCurve = new GeomAdaptor_Curve; Initialize(E,F); } +//======================================================================= +//function : ShallowCopy +//purpose : +//======================================================================= + +Handle(Adaptor3d_Curve) BRepAdaptor_Curve::ShallowCopy() const +{ + Handle(BRepAdaptor_Curve) aCopy = new BRepAdaptor_Curve(); + + aCopy->myTrsf = myTrsf; + aCopy->myCurve = Handle(GeomAdaptor_Curve)::DownCast(myCurve->ShallowCopy()); + aCopy->myConSurf = myConSurf; + aCopy->myEdge = myEdge; + + return aCopy; +} + //======================================================================= //function : Reset //purpose : //======================================================================= void BRepAdaptor_Curve::Reset() { - myCurve.Reset(); + myCurve->Reset(); myConSurf.Nullify(); myEdge.Nullify(); myTrsf = gp_Trsf(); @@ -100,7 +121,7 @@ void BRepAdaptor_Curve::Initialize(const TopoDS_Edge& E) Handle(Geom_Curve) C = BRep_Tool::Curve(E,L,pf,pl); if (!C.IsNull()) { - myCurve.Load(C,pf,pl); + myCurve->Load(C,pf,pl); } else { Handle(Geom2d_Curve) PC; @@ -184,7 +205,7 @@ Standard_Boolean BRepAdaptor_Curve::IsCurveOnSurface() const const GeomAdaptor_Curve& BRepAdaptor_Curve::Curve() const { - return myCurve; + return *myCurve; } //======================================================================= @@ -225,7 +246,7 @@ Standard_Real BRepAdaptor_Curve::Tolerance() const Standard_Real BRepAdaptor_Curve::FirstParameter() const { if (myConSurf.IsNull()) { - return myCurve.FirstParameter(); + return myCurve->FirstParameter(); } else { return myConSurf->FirstParameter(); @@ -240,7 +261,7 @@ Standard_Real BRepAdaptor_Curve::FirstParameter() const Standard_Real BRepAdaptor_Curve::LastParameter() const { if (myConSurf.IsNull()) { - return myCurve.LastParameter(); + return myCurve->LastParameter(); } else { return myConSurf->LastParameter(); @@ -255,7 +276,7 @@ Standard_Real BRepAdaptor_Curve::LastParameter() const GeomAbs_Shape BRepAdaptor_Curve::Continuity() const { if (myConSurf.IsNull()) { - return myCurve.Continuity(); + return myCurve->Continuity(); } else { return myConSurf->Continuity(); @@ -270,7 +291,7 @@ GeomAbs_Shape BRepAdaptor_Curve::Continuity() const Standard_Integer BRepAdaptor_Curve::NbIntervals(const GeomAbs_Shape S) const { if (myConSurf.IsNull()) { - return myCurve.NbIntervals(S); + return myCurve->NbIntervals(S); } else { return myConSurf->NbIntervals(S); @@ -286,7 +307,7 @@ void BRepAdaptor_Curve::Intervals(TColStd_Array1OfReal& T, const GeomAbs_Shape S) const { if (myConSurf.IsNull()) { - myCurve.Intervals(T, S); + myCurve->Intervals(T, S); } else { myConSurf->Intervals(T, S); @@ -307,10 +328,10 @@ Handle(Adaptor3d_Curve) BRepAdaptor_Curve::Trim(const Standard_Real First, Handle(BRepAdaptor_Curve) res; if (myConSurf.IsNull()){ Standard_Real pf = FirstParameter(), pl = LastParameter(); - Handle(Geom_Curve) C = myCurve.Curve(); - const_cast(&myCurve)->Load(C,First,Last); + Handle(Geom_Curve) C = myCurve->Curve(); + const_cast(myCurve.get())->Load(C,First,Last); res = new BRepAdaptor_Curve (*this); - const_cast(&myCurve)->Load(C,pf,pl); + const_cast(myCurve.get())->Load(C,pf,pl); } else { Handle(Adaptor3d_CurveOnSurface) sav = myConSurf; @@ -330,7 +351,7 @@ Handle(Adaptor3d_Curve) BRepAdaptor_Curve::Trim(const Standard_Real First, Standard_Boolean BRepAdaptor_Curve::IsClosed() const { if (myConSurf.IsNull()) { - return myCurve.IsClosed(); + return myCurve->IsClosed(); } else { return myConSurf->IsClosed(); @@ -345,7 +366,7 @@ Standard_Boolean BRepAdaptor_Curve::IsClosed() const Standard_Boolean BRepAdaptor_Curve::IsPeriodic() const { if (myConSurf.IsNull()) { - return myCurve.IsPeriodic(); + return myCurve->IsPeriodic(); } else { return myConSurf->IsPeriodic(); @@ -360,7 +381,7 @@ Standard_Boolean BRepAdaptor_Curve::IsPeriodic() const Standard_Real BRepAdaptor_Curve::Period() const { if (myConSurf.IsNull()) { - return myCurve.Period(); + return myCurve->Period(); } else { return myConSurf->Period(); @@ -376,7 +397,7 @@ gp_Pnt BRepAdaptor_Curve::Value(const Standard_Real U) const { gp_Pnt P; if (myConSurf.IsNull()) - P = myCurve.Value(U); + P = myCurve->Value(U); else P = myConSurf->Value(U); P.Transform(myTrsf); @@ -391,7 +412,7 @@ gp_Pnt BRepAdaptor_Curve::Value(const Standard_Real U) const void BRepAdaptor_Curve::D0(const Standard_Real U, gp_Pnt& P) const { if (myConSurf.IsNull()) - myCurve.D0(U,P); + myCurve->D0(U,P); else myConSurf->D0(U,P); P.Transform(myTrsf); @@ -406,7 +427,7 @@ void BRepAdaptor_Curve::D1(const Standard_Real U, gp_Pnt& P, gp_Vec& V) const { if (myConSurf.IsNull()) - myCurve.D1(U,P,V); + myCurve->D1(U,P,V); else myConSurf->D1(U,P,V); P.Transform(myTrsf); @@ -422,7 +443,7 @@ void BRepAdaptor_Curve::D2(const Standard_Real U, gp_Pnt& P, gp_Vec& V1, gp_Vec& V2) const { if (myConSurf.IsNull()) - myCurve.D2(U,P,V1,V2); + myCurve->D2(U,P,V1,V2); else myConSurf->D2(U,P,V1,V2); P.Transform(myTrsf); @@ -440,7 +461,7 @@ void BRepAdaptor_Curve::D3(const Standard_Real U, gp_Vec& V1, gp_Vec& V2, gp_Vec& V3) const { if (myConSurf.IsNull()) - myCurve.D3(U,P,V1,V2,V3); + myCurve->D3(U,P,V1,V2,V3); else myConSurf->D3(U,P,V1,V2,V3); P.Transform(myTrsf); @@ -459,7 +480,7 @@ gp_Vec BRepAdaptor_Curve::DN(const Standard_Real U, { gp_Vec V; if (myConSurf.IsNull()) - V = myCurve.DN(U,N); + V = myCurve->DN(U,N); else V = myConSurf->DN(U,N); V.Transform(myTrsf); @@ -474,7 +495,7 @@ gp_Vec BRepAdaptor_Curve::DN(const Standard_Real U, Standard_Real BRepAdaptor_Curve::Resolution(const Standard_Real R) const { if (myConSurf.IsNull()) { - return myCurve.Resolution(R); + return myCurve->Resolution(R); } else { return myConSurf->Resolution(R); @@ -489,7 +510,7 @@ Standard_Real BRepAdaptor_Curve::Resolution(const Standard_Real R) const GeomAbs_CurveType BRepAdaptor_Curve::GetType() const { if (myConSurf.IsNull()) { - return myCurve.GetType(); + return myCurve->GetType(); } else { return myConSurf->GetType(); @@ -505,7 +526,7 @@ gp_Lin BRepAdaptor_Curve::Line() const { gp_Lin L; if (myConSurf.IsNull()) - L = myCurve.Line(); + L = myCurve->Line(); else L = myConSurf->Line(); L.Transform(myTrsf); @@ -521,7 +542,7 @@ gp_Circ BRepAdaptor_Curve::Circle() const { gp_Circ C; if (myConSurf.IsNull()) - C = myCurve.Circle(); + C = myCurve->Circle(); else C = myConSurf->Circle(); C.Transform(myTrsf); @@ -537,7 +558,7 @@ gp_Elips BRepAdaptor_Curve::Ellipse() const { gp_Elips E; if (myConSurf.IsNull()) - E = myCurve.Ellipse(); + E = myCurve->Ellipse(); else E = myConSurf->Ellipse(); E.Transform(myTrsf); @@ -553,7 +574,7 @@ gp_Hypr BRepAdaptor_Curve::Hyperbola() const { gp_Hypr H; if (myConSurf.IsNull()) - H = myCurve.Hyperbola(); + H = myCurve->Hyperbola(); else H = myConSurf->Hyperbola(); H.Transform(myTrsf); @@ -569,7 +590,7 @@ gp_Parab BRepAdaptor_Curve::Parabola() const { gp_Parab P; if (myConSurf.IsNull()) - P = myCurve.Parabola(); + P = myCurve->Parabola(); else P = myConSurf->Parabola(); P.Transform(myTrsf); @@ -584,7 +605,7 @@ gp_Parab BRepAdaptor_Curve::Parabola() const Standard_Integer BRepAdaptor_Curve::Degree() const { if (myConSurf.IsNull()) - return myCurve.Degree(); + return myCurve->Degree(); else return myConSurf->Degree(); } @@ -597,7 +618,7 @@ Standard_Integer BRepAdaptor_Curve::Degree() const Standard_Boolean BRepAdaptor_Curve::IsRational() const { if (myConSurf.IsNull()) - return myCurve.IsRational(); + return myCurve->IsRational(); else return myConSurf->IsRational(); } @@ -609,7 +630,7 @@ Standard_Boolean BRepAdaptor_Curve::IsRational() const Standard_Integer BRepAdaptor_Curve::NbPoles() const { if (myConSurf.IsNull()) - return myCurve.NbPoles(); + return myCurve->NbPoles(); else return myConSurf->NbPoles(); } @@ -621,7 +642,7 @@ Standard_Integer BRepAdaptor_Curve::NbPoles() const Standard_Integer BRepAdaptor_Curve::NbKnots() const { if (myConSurf.IsNull()) - return myCurve.NbKnots(); + return myCurve->NbKnots(); else return myConSurf->NbKnots(); } @@ -635,7 +656,7 @@ Handle(Geom_BezierCurve) BRepAdaptor_Curve::Bezier() const { Handle(Geom_BezierCurve) BC; if (myConSurf.IsNull()) { - BC = myCurve.Bezier(); + BC = myCurve->Bezier(); } else { BC = myConSurf->Bezier(); @@ -654,7 +675,7 @@ Handle(Geom_BSplineCurve) BRepAdaptor_Curve::BSpline() const { Handle(Geom_BSplineCurve) BS; if (myConSurf.IsNull()) { - BS = myCurve.BSpline(); + BS = myCurve->BSpline(); } else { BS = myConSurf->BSpline(); @@ -670,10 +691,10 @@ Handle(Geom_BSplineCurve) BRepAdaptor_Curve::BSpline() const Handle(Geom_OffsetCurve) BRepAdaptor_Curve::OffsetCurve() const { - if ( !Is3DCurve() || myCurve.GetType() != GeomAbs_OffsetCurve) + if ( !Is3DCurve() || myCurve->GetType() != GeomAbs_OffsetCurve) throw Standard_NoSuchObject("BRepAdaptor_Curve::OffsetCurve"); - Handle(Geom_OffsetCurve) anOffC = myCurve.OffsetCurve(); + Handle(Geom_OffsetCurve) anOffC = myCurve->OffsetCurve(); return myTrsf.Form() == gp_Identity ? anOffC : Handle(Geom_OffsetCurve)::DownCast(anOffC->Transformed(myTrsf)); } diff --git a/src/BRepAdaptor/BRepAdaptor_Curve.hxx b/src/BRepAdaptor/BRepAdaptor_Curve.hxx index ded2fda66c..40617940f8 100644 --- a/src/BRepAdaptor/BRepAdaptor_Curve.hxx +++ b/src/BRepAdaptor/BRepAdaptor_Curve.hxx @@ -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(); @@ -222,7 +225,7 @@ public: private: gp_Trsf myTrsf; - GeomAdaptor_Curve myCurve; + Handle(GeomAdaptor_Curve) myCurve; Handle(Adaptor3d_CurveOnSurface) myConSurf; TopoDS_Edge myEdge; diff --git a/src/BRepAdaptor/BRepAdaptor_Curve2d.cxx b/src/BRepAdaptor/BRepAdaptor_Curve2d.cxx index 140f4dd97b..941ae240c1 100644 --- a/src/BRepAdaptor/BRepAdaptor_Curve2d.cxx +++ b/src/BRepAdaptor/BRepAdaptor_Curve2d.cxx @@ -43,6 +43,25 @@ 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; + aCopy->myCurveCache = myCurveCache; + aCopy->myNestedEvaluator = myNestedEvaluator; + + return aCopy; +} //======================================================================= //function : Initialize diff --git a/src/BRepAdaptor/BRepAdaptor_Curve2d.hxx b/src/BRepAdaptor/BRepAdaptor_Curve2d.hxx index f19157649d..a78e3c987a 100644 --- a/src/BRepAdaptor/BRepAdaptor_Curve2d.hxx +++ b/src/BRepAdaptor/BRepAdaptor_Curve2d.hxx @@ -49,6 +49,9 @@ public: //! Creates with the pcurve of on . 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 on . Standard_EXPORT void Initialize (const TopoDS_Edge& E, const TopoDS_Face& F); diff --git a/src/BRepAdaptor/BRepAdaptor_Surface.cxx b/src/BRepAdaptor/BRepAdaptor_Surface.cxx index 1eda58f4fe..d16ccc62d6 100644 --- a/src/BRepAdaptor/BRepAdaptor_Surface.cxx +++ b/src/BRepAdaptor/BRepAdaptor_Surface.cxx @@ -63,6 +63,21 @@ 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(); + + aCopy->mySurf = mySurf; + aCopy->myTrsf = myTrsf; + aCopy->myFace = myFace; + + return aCopy; +} //======================================================================= //function : Initialize //purpose : diff --git a/src/BRepAdaptor/BRepAdaptor_Surface.hxx b/src/BRepAdaptor/BRepAdaptor_Surface.hxx index ffd8648d35..ed067dc619 100644 --- a/src/BRepAdaptor/BRepAdaptor_Surface.hxx +++ b/src/BRepAdaptor/BRepAdaptor_Surface.hxx @@ -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 . Standard_EXPORT void Initialize (const TopoDS_Face& F, const Standard_Boolean Restriction = Standard_True); diff --git a/src/BiTgte/BiTgte_CurveOnEdge.cxx b/src/BiTgte/BiTgte_CurveOnEdge.cxx index d3dc87b552..a94b3a6091 100644 --- a/src/BiTgte/BiTgte_CurveOnEdge.cxx +++ b/src/BiTgte/BiTgte_CurveOnEdge.cxx @@ -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 : diff --git a/src/BiTgte/BiTgte_CurveOnEdge.hxx b/src/BiTgte/BiTgte_CurveOnEdge.hxx index 1c2c0c8793..d1b3142fc6 100644 --- a/src/BiTgte/BiTgte_CurveOnEdge.hxx +++ b/src/BiTgte/BiTgte_CurveOnEdge.hxx @@ -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); diff --git a/src/ChFiDS/ChFiDS_ElSpine.cxx b/src/ChFiDS/ChFiDS_ElSpine.cxx index a2866fffa9..579076164c 100644 --- a/src/ChFiDS/ChFiDS_ElSpine.cxx +++ b/src/ChFiDS/ChFiDS_ElSpine.cxx @@ -49,8 +49,34 @@ ChFiDS_ElSpine::ChFiDS_ElSpine() pfirstsav (Precision::Infinite()), plastsav (Precision::Infinite()) { + curve = new GeomAdaptor_Curve; } +//======================================================================= +//function : ShallowCopy +//purpose : +//======================================================================= +Handle(Adaptor3d_Curve) ChFiDS_ElSpine::ShallowCopy() const +{ + Handle(ChFiDS_ElSpine) aCopy = new ChFiDS_ElSpine(); + + aCopy->curve = Handle(GeomAdaptor_Curve)::DownCast(curve->ShallowCopy()); + 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 @@ -100,7 +126,7 @@ Standard_Real ChFiDS_ElSpine::GetSavedLastParameter() const GeomAbs_Shape ChFiDS_ElSpine::Continuity() const { - return curve.Continuity(); + return curve->Continuity(); } //======================================================================= @@ -110,7 +136,7 @@ GeomAbs_Shape ChFiDS_ElSpine::Continuity() const Standard_Integer ChFiDS_ElSpine::NbIntervals(const GeomAbs_Shape S) const { - return curve.NbIntervals(S); + return curve->NbIntervals(S); } //======================================================================= @@ -120,7 +146,7 @@ Standard_Integer ChFiDS_ElSpine::NbIntervals(const GeomAbs_Shape S) const void ChFiDS_ElSpine::Intervals(TColStd_Array1OfReal& T,const GeomAbs_Shape S) const { - curve.Intervals(T,S); + curve->Intervals(T,S); } //======================================================================= @@ -132,7 +158,7 @@ Handle(Adaptor3d_Curve) ChFiDS_ElSpine::Trim(const Standard_Real First, const Standard_Real Last, const Standard_Real Tol) const { - return curve.Trim(First,Last,Tol); + return curve->Trim(First,Last,Tol); } //======================================================================= @@ -142,7 +168,7 @@ Handle(Adaptor3d_Curve) ChFiDS_ElSpine::Trim(const Standard_Real First, Standard_Real ChFiDS_ElSpine::Resolution(const Standard_Real R3d) const { - return curve.Resolution(R3d); + return curve->Resolution(R3d); } @@ -153,7 +179,7 @@ Standard_Real ChFiDS_ElSpine::Resolution(const Standard_Real R3d) const GeomAbs_CurveType ChFiDS_ElSpine::GetType() const { - return curve.GetType(); + return curve->GetType(); } @@ -200,7 +226,7 @@ Standard_Real ChFiDS_ElSpine::Period() const gp_Pnt ChFiDS_ElSpine::Value(const Standard_Real AbsC) const { - return curve.Value(AbsC); + return curve->Value(AbsC); } @@ -211,7 +237,7 @@ gp_Pnt ChFiDS_ElSpine::Value(const Standard_Real AbsC) const void ChFiDS_ElSpine::D0(const Standard_Real AbsC, gp_Pnt& P) const { - curve.D0(AbsC,P); + curve->D0(AbsC,P); } @@ -223,7 +249,7 @@ void ChFiDS_ElSpine::D0(const Standard_Real AbsC, gp_Pnt& P) const void ChFiDS_ElSpine::D1(const Standard_Real AbsC, gp_Pnt& P, gp_Vec& V1) const { - curve.D1(AbsC,P,V1); + curve->D1(AbsC,P,V1); } @@ -235,7 +261,7 @@ const void ChFiDS_ElSpine::D2(const Standard_Real AbsC, gp_Pnt& P, gp_Vec& V1, gp_Vec& V2) const { - curve.D2(AbsC,P,V1,V2); + curve->D2(AbsC,P,V1,V2); } //======================================================================= @@ -246,7 +272,7 @@ void ChFiDS_ElSpine::D2(const Standard_Real AbsC, void ChFiDS_ElSpine::D3(const Standard_Real AbsC, gp_Pnt& P, gp_Vec& V1, gp_Vec& V2, gp_Vec& V3) const { - curve.D3(AbsC,P,V1,V2,V3); + curve->D3(AbsC,P,V1,V2,V3); } @@ -300,10 +326,10 @@ void ChFiDS_ElSpine::SaveLastParameter() void ChFiDS_ElSpine::SetOrigin(const Standard_Real O) { if(!periodic) throw Standard_Failure("Elspine non periodique"); - Handle(Geom_BSplineCurve) bs = Handle(Geom_BSplineCurve)::DownCast(curve.Curve()); + Handle(Geom_BSplineCurve) bs = Handle(Geom_BSplineCurve)::DownCast(curve->Curve()); if(!bs.IsNull()) { bs->SetOrigin(O,Precision::PConfusion()); - curve.Load(bs); + curve->Load(bs); } } @@ -392,7 +418,7 @@ const gp_Ax1& ChFiDS_ElSpine::VertexWithTangent(const Standard_Integer Index) co void ChFiDS_ElSpine::SetCurve(const Handle(Geom_Curve)& C) { - curve.Load(C); + curve->Load(C); } //======================================================================= @@ -449,7 +475,7 @@ Handle(ChFiDS_SurfData)& ChFiDS_ElSpine::ChangeNext() gp_Lin ChFiDS_ElSpine::Line() const { - return curve.Line(); + return curve->Line(); } //======================================================================= @@ -459,7 +485,7 @@ gp_Lin ChFiDS_ElSpine::Line() const gp_Circ ChFiDS_ElSpine::Circle() const { - return curve.Circle(); + return curve->Circle(); } //======================================================================= @@ -469,7 +495,7 @@ gp_Circ ChFiDS_ElSpine::Circle() const gp_Elips ChFiDS_ElSpine::Ellipse() const { - return curve.Ellipse(); + return curve->Ellipse(); } //======================================================================= @@ -479,7 +505,7 @@ gp_Elips ChFiDS_ElSpine::Ellipse() const gp_Hypr ChFiDS_ElSpine::Hyperbola() const { - return curve.Hyperbola(); + return curve->Hyperbola(); } //======================================================================= @@ -489,7 +515,7 @@ gp_Hypr ChFiDS_ElSpine::Hyperbola() const gp_Parab ChFiDS_ElSpine::Parabola() const { - return curve.Parabola(); + return curve->Parabola(); } //======================================================================= @@ -499,7 +525,7 @@ gp_Parab ChFiDS_ElSpine::Parabola() const Handle(Geom_BezierCurve) ChFiDS_ElSpine::Bezier() const { - return curve.Bezier(); + return curve->Bezier(); } //======================================================================= @@ -509,5 +535,5 @@ Handle(Geom_BezierCurve) ChFiDS_ElSpine::Bezier() const Handle(Geom_BSplineCurve) ChFiDS_ElSpine::BSpline() const { - return curve.BSpline(); + return curve->BSpline(); } diff --git a/src/ChFiDS/ChFiDS_ElSpine.hxx b/src/ChFiDS/ChFiDS_ElSpine.hxx index 9dfc5a0146..3124b7a175 100644 --- a/src/ChFiDS/ChFiDS_ElSpine.hxx +++ b/src/ChFiDS/ChFiDS_ElSpine.hxx @@ -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; @@ -147,7 +150,7 @@ public: private: - GeomAdaptor_Curve curve; + Handle(GeomAdaptor_Curve) curve; gp_Pnt ptfirst; gp_Pnt ptlast; gp_Vec tgfirst; diff --git a/src/Geom2dAdaptor/Geom2dAdaptor_Curve.cxx b/src/Geom2dAdaptor/Geom2dAdaptor_Curve.cxx index 2220bb3c65..a0b630f34c 100644 --- a/src/Geom2dAdaptor/Geom2dAdaptor_Curve.cxx +++ b/src/Geom2dAdaptor/Geom2dAdaptor_Curve.cxx @@ -65,6 +65,25 @@ 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; + aCopy->myNestedEvaluator = myNestedEvaluator; + + return aCopy; +} + //======================================================================= //function : LocalContinuity //purpose : Computes the Continuity of a BSplineCurve diff --git a/src/Geom2dAdaptor/Geom2dAdaptor_Curve.hxx b/src/Geom2dAdaptor/Geom2dAdaptor_Curve.hxx index 0c668ec6d4..accca173af 100644 --- a/src/Geom2dAdaptor/Geom2dAdaptor_Curve.hxx +++ b/src/Geom2dAdaptor/Geom2dAdaptor_Curve.hxx @@ -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; diff --git a/src/GeomAdaptor/GeomAdaptor_Curve.cxx b/src/GeomAdaptor/GeomAdaptor_Curve.cxx index 6d8bfae812..33fb3cca9c 100644 --- a/src/GeomAdaptor/GeomAdaptor_Curve.cxx +++ b/src/GeomAdaptor/GeomAdaptor_Curve.cxx @@ -63,6 +63,25 @@ 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; + aCopy->myNestedEvaluator = myNestedEvaluator; + + return aCopy; +} + //======================================================================= //function : LocalContinuity //purpose : Computes the Continuity of a BSplineCurve diff --git a/src/GeomAdaptor/GeomAdaptor_Curve.hxx b/src/GeomAdaptor/GeomAdaptor_Curve.hxx index 894623beba..4c2fe32d8c 100644 --- a/src/GeomAdaptor/GeomAdaptor_Curve.hxx +++ b/src/GeomAdaptor/GeomAdaptor_Curve.hxx @@ -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(); diff --git a/src/GeomAdaptor/GeomAdaptor_Surface.cxx b/src/GeomAdaptor/GeomAdaptor_Surface.cxx index 27d058aefc..010caba62f 100644 --- a/src/GeomAdaptor/GeomAdaptor_Surface.cxx +++ b/src/GeomAdaptor/GeomAdaptor_Surface.cxx @@ -114,6 +114,30 @@ 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; + aCopy->myNestedEvaluator = myNestedEvaluator; + + return aCopy; +} + //======================================================================= //function : Load //purpose : diff --git a/src/GeomAdaptor/GeomAdaptor_Surface.hxx b/src/GeomAdaptor/GeomAdaptor_Surface.hxx index 725bcfb6b5..49efc81932 100644 --- a/src/GeomAdaptor/GeomAdaptor_Surface.hxx +++ b/src/GeomAdaptor/GeomAdaptor_Surface.hxx @@ -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) }; diff --git a/src/GeomAdaptor/GeomAdaptor_SurfaceOfLinearExtrusion.cxx b/src/GeomAdaptor/GeomAdaptor_SurfaceOfLinearExtrusion.cxx index d196c8e908..e98a66884b 100644 --- a/src/GeomAdaptor/GeomAdaptor_SurfaceOfLinearExtrusion.cxx +++ b/src/GeomAdaptor/GeomAdaptor_SurfaceOfLinearExtrusion.cxx @@ -58,6 +58,34 @@ GeomAdaptor_SurfaceOfLinearExtrusion::GeomAdaptor_SurfaceOfLinearExtrusion Load(V); } +//======================================================================= +//function : ShallowCopy +//purpose : +//======================================================================= + +Handle(Adaptor3d_Surface) GeomAdaptor_SurfaceOfLinearExtrusion::ShallowCopy() const +{ + Handle(GeomAdaptor_SurfaceOfLinearExtrusion) aCopy = new GeomAdaptor_SurfaceOfLinearExtrusion(); + + aCopy->myBasisCurve = myBasisCurve; + 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->mySurfaceCache = mySurfaceCache; + + aCopy->mySurfaceType = mySurfaceType; + aCopy->myNestedEvaluator = myNestedEvaluator; + + return aCopy; +} //======================================================================= //function : Load //purpose : diff --git a/src/GeomAdaptor/GeomAdaptor_SurfaceOfLinearExtrusion.hxx b/src/GeomAdaptor/GeomAdaptor_SurfaceOfLinearExtrusion.hxx index f5e28e909a..c9b3179e9e 100644 --- a/src/GeomAdaptor/GeomAdaptor_SurfaceOfLinearExtrusion.hxx +++ b/src/GeomAdaptor/GeomAdaptor_SurfaceOfLinearExtrusion.hxx @@ -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); diff --git a/src/GeomAdaptor/GeomAdaptor_SurfaceOfRevolution.cxx b/src/GeomAdaptor/GeomAdaptor_SurfaceOfRevolution.cxx index b2bc4336c2..7260856980 100644 --- a/src/GeomAdaptor/GeomAdaptor_SurfaceOfRevolution.cxx +++ b/src/GeomAdaptor/GeomAdaptor_SurfaceOfRevolution.cxx @@ -58,6 +58,36 @@ GeomAdaptor_SurfaceOfRevolution::GeomAdaptor_SurfaceOfRevolution( Load(V); } +//======================================================================= +//function : ShallowCopy +//purpose : +//======================================================================= + +Handle(Adaptor3d_Surface) GeomAdaptor_SurfaceOfRevolution::ShallowCopy() const +{ + Handle(GeomAdaptor_SurfaceOfRevolution) aCopy = new GeomAdaptor_SurfaceOfRevolution(); + + aCopy->myBasisCurve = myBasisCurve; + 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->mySurfaceCache = mySurfaceCache; + + aCopy->mySurfaceType = mySurfaceType; + aCopy->myNestedEvaluator = myNestedEvaluator; + + return aCopy; +} + //======================================================================= //function : Load //purpose : diff --git a/src/GeomAdaptor/GeomAdaptor_SurfaceOfRevolution.hxx b/src/GeomAdaptor/GeomAdaptor_SurfaceOfRevolution.hxx index a41b151871..35485e9fb5 100644 --- a/src/GeomAdaptor/GeomAdaptor_SurfaceOfRevolution.hxx +++ b/src/GeomAdaptor/GeomAdaptor_SurfaceOfRevolution.hxx @@ -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); diff --git a/src/GeomFill/GeomFill_SnglrFunc.cxx b/src/GeomFill/GeomFill_SnglrFunc.cxx index 825758bff5..28e802c2fe 100644 --- a/src/GeomFill/GeomFill_SnglrFunc.cxx +++ b/src/GeomFill/GeomFill_SnglrFunc.cxx @@ -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); + aCopy->ratio = ratio; + return aCopy; +} + void GeomFill_SnglrFunc::SetRatio(const Standard_Real Ratio) { ratio = Ratio; diff --git a/src/GeomFill/GeomFill_SnglrFunc.hxx b/src/GeomFill/GeomFill_SnglrFunc.hxx index 69d9f7df65..8cbfc726e6 100644 --- a/src/GeomFill/GeomFill_SnglrFunc.hxx +++ b/src/GeomFill/GeomFill_SnglrFunc.hxx @@ -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); diff --git a/src/GeomLib/GeomLib_CheckCurveOnSurface.cxx b/src/GeomLib/GeomLib_CheckCurveOnSurface.cxx index 0de98e0c2d..2a55004ed6 100644 --- a/src/GeomLib/GeomLib_CheckCurveOnSurface.cxx +++ b/src/GeomLib/GeomLib_CheckCurveOnSurface.cxx @@ -421,30 +421,30 @@ void GeomLib_CheckCurveOnSurface::Perform(const Handle(Adaptor3d_CurveOnSurface) GeomLib_CheckCurveOnSurface_Local aComp(myCurve,theCurveOnSurface, anIntervals, anEpsilonRange, aNbParticles); - if (true/*isMultiThread*/) - { - const Handle(OSD_ThreadPool)& aThreadPool = OSD_ThreadPool::DefaultPool(); - const int aNbThreads = isMultiThread ? Min(anIntervals.Size(), aThreadPool->NbDefaultThreadsToLaunch()) : 1; - NCollection_Array1 anAdaptorArray(0, aNbThreads - 1); - for (Standard_Integer anI = 0; anI < aNbThreads; ++anI) - { -// anAdaptorArray[anI] = myCurve.ShallowCopy(); - } - OSD_ThreadPool::Launcher aLauncher(*aThreadPool, aNbThreads); - GeomLib_CheckCurveOnSurface_Wrapper aFunctor(aComp); - aLauncher.Perform(anIntervals.Lower(), anIntervals.Upper()+1, aFunctor); - } - else - { - for (Standard_Integer anI = anIntervals.Lower(); anI <= anIntervals.Upper(); ++anI) - { - aComp(anI); - } - } - - - -// OSD_Parallel::For(anIntervals.Lower(), anIntervals.Upper(), aComp, false/*!isMultiThread*/); +// if (true/*isMultiThread*/) +// { +// const Handle(OSD_ThreadPool)& aThreadPool = OSD_ThreadPool::DefaultPool(); +// const int aNbThreads = isMultiThread ? Min(anIntervals.Size(), aThreadPool->NbDefaultThreadsToLaunch()) : 1; +// NCollection_Array1 anAdaptorArray(0, aNbThreads - 1); +// for (Standard_Integer anI = 0; anI < aNbThreads; ++anI) +// { +//// anAdaptorArray[anI] = myCurve.ShallowCopy(); +// } +// OSD_ThreadPool::Launcher aLauncher(*aThreadPool, aNbThreads); +// GeomLib_CheckCurveOnSurface_Wrapper aFunctor(aComp); +// aLauncher.Perform(anIntervals.Lower(), anIntervals.Upper()+1, aFunctor); +// } +// else +// { +// for (Standard_Integer anI = anIntervals.Lower(); anI <= anIntervals.Upper(); ++anI) +// { +// aComp(anI); +// } +// } + + + + OSD_Parallel::For(anIntervals.Lower(), anIntervals.Upper(), aComp, false/*!isMultiThread*/); aComp.OptimalValues(myMaxDistance, myMaxParameter); diff --git a/src/ProjLib/ProjLib_CompProjectedCurve.cxx b/src/ProjLib/ProjLib_CompProjectedCurve.cxx index 49c15ece7d..0500f58c47 100644 --- a/src/ProjLib/ProjLib_CompProjectedCurve.cxx +++ b/src/ProjLib/ProjLib_CompProjectedCurve.cxx @@ -631,6 +631,31 @@ ProjLib_CompProjectedCurve::ProjLib_CompProjectedCurve Init(); } +//======================================================================= +//function : ShallowCopy +//purpose : +//======================================================================= + +Handle(Adaptor2d_Curve2d) ProjLib_CompProjectedCurve::ShallowCopy() const +{ + Handle(ProjLib_CompProjectedCurve) aCopy = new ProjLib_CompProjectedCurve(); + + aCopy->mySurface = mySurface; + aCopy->myCurve = myCurve; + 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; + aCopy->myTabInt = myTabInt; + + return aCopy; +} + //======================================================================= //function : Init //purpose : diff --git a/src/ProjLib/ProjLib_CompProjectedCurve.hxx b/src/ProjLib/ProjLib_CompProjectedCurve.hxx index d086f7e6d2..0838670521 100644 --- a/src/ProjLib/ProjLib_CompProjectedCurve.hxx +++ b/src/ProjLib/ProjLib_CompProjectedCurve.hxx @@ -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 diff --git a/src/ProjLib/ProjLib_ProjectOnPlane.cxx b/src/ProjLib/ProjLib_ProjectOnPlane.cxx index 1496e2848d..7da0316787 100644 --- a/src/ProjLib/ProjLib_ProjectOnPlane.cxx +++ b/src/ProjLib/ProjLib_ProjectOnPlane.cxx @@ -446,6 +446,29 @@ myIsApprox (Standard_False) // } } +//======================================================================= +//function : ShallowCopy +//purpose : +//======================================================================= + +Handle(Adaptor3d_Curve) ProjLib_ProjectOnPlane::ShallowCopy() const +{ + Handle(ProjLib_ProjectOnPlane) aCopy = new ProjLib_ProjectOnPlane(); + + aCopy->myCurve = myCurve; + aCopy->myPlane = myPlane; + aCopy->myDirection = myDirection; + aCopy->myKeepParam = myKeepParam; + aCopy->myFirstPar = myFirstPar; + aCopy->myLastPar = myLastPar; + aCopy->myTolerance = myTolerance; + aCopy->myType = myType; + aCopy->myResult = myResult; + aCopy->myIsApprox = myIsApprox; + + return aCopy; +} + //======================================================================= //function : Project //purpose : Returns the projection of a point on a plane diff --git a/src/ProjLib/ProjLib_ProjectOnPlane.hxx b/src/ProjLib/ProjLib_ProjectOnPlane.hxx index a9fb55bc15..1fc5e228dc 100644 --- a/src/ProjLib/ProjLib_ProjectOnPlane.hxx +++ b/src/ProjLib/ProjLib_ProjectOnPlane.hxx @@ -70,6 +70,9 @@ public: //! raises if the direction is parallel to the //! plane . 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 is true, the parametrization diff --git a/src/ProjLib/ProjLib_ProjectedCurve.cxx b/src/ProjLib/ProjLib_ProjectedCurve.cxx index f3617344e8..64db5c578f 100644 --- a/src/ProjLib/ProjLib_ProjectedCurve.cxx +++ b/src/ProjLib/ProjLib_ProjectedCurve.cxx @@ -371,6 +371,27 @@ 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; + aCopy->mySurface = mySurface; + aCopy->myCurve = myCurve; + aCopy->myResult = myResult; + aCopy->myDegMin = myDegMin; + aCopy->myDegMax = myDegMax; + aCopy->myMaxSegments = myMaxSegments; + aCopy->myMaxDist = myMaxDist; + aCopy->myBndPnt = myBndPnt; + + return aCopy; +} //======================================================================= //function : Load diff --git a/src/ProjLib/ProjLib_ProjectedCurve.hxx b/src/ProjLib/ProjLib_ProjectedCurve.hxx index 22e447ae53..61587c468a 100644 --- a/src/ProjLib/ProjLib_ProjectedCurve.hxx +++ b/src/ProjLib/ProjLib_ProjectedCurve.hxx @@ -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); -- 2.39.5