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..dd1e205e89 100644 --- a/src/Adaptor2d/Adaptor2d_OffsetCurve.cxx +++ b/src/Adaptor2d/Adaptor2d_OffsetCurve.cxx @@ -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 : 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..8480ace335 100644 --- a/src/Adaptor3d/Adaptor3d_CurveOnSurface.cxx +++ b/src/Adaptor3d/Adaptor3d_CurveOnSurface.cxx @@ -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 : 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..7493df89da 100644 --- a/src/Adaptor3d/Adaptor3d_IsoCurve.cxx +++ b/src/Adaptor3d/Adaptor3d_IsoCurve.cxx @@ -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 : 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..2cf7998f0a 100644 --- a/src/BRepAdaptor/BRepAdaptor_CompCurve.cxx +++ b/src/BRepAdaptor/BRepAdaptor_CompCurve.cxx @@ -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) { 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..1bd9a2f7da 100644 --- a/src/BRepAdaptor/BRepAdaptor_Curve.cxx +++ b/src/BRepAdaptor/BRepAdaptor_Curve.cxx @@ -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 : diff --git a/src/BRepAdaptor/BRepAdaptor_Curve.hxx b/src/BRepAdaptor/BRepAdaptor_Curve.hxx index ded2fda66c..b411124337 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(); diff --git a/src/BRepAdaptor/BRepAdaptor_Curve2d.cxx b/src/BRepAdaptor/BRepAdaptor_Curve2d.cxx index 140f4dd97b..ceccc9e5b4 100644 --- a/src/BRepAdaptor/BRepAdaptor_Curve2d.cxx +++ b/src/BRepAdaptor/BRepAdaptor_Curve2d.cxx @@ -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 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..98acaaba90 100644 --- a/src/BRepAdaptor/BRepAdaptor_Surface.cxx +++ b/src/BRepAdaptor/BRepAdaptor_Surface.cxx @@ -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 : 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..8e46350225 100644 --- a/src/ChFiDS/ChFiDS_ElSpine.cxx +++ b/src/ChFiDS/ChFiDS_ElSpine.cxx @@ -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(); } //======================================================================= diff --git a/src/ChFiDS/ChFiDS_ElSpine.hxx b/src/ChFiDS/ChFiDS_ElSpine.hxx index 9dfc5a0146..374eeead39 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; diff --git a/src/Geom2dAdaptor/Geom2dAdaptor_Curve.cxx b/src/Geom2dAdaptor/Geom2dAdaptor_Curve.cxx index 2220bb3c65..b3ce81771b 100644 --- a/src/Geom2dAdaptor/Geom2dAdaptor_Curve.cxx +++ b/src/Geom2dAdaptor/Geom2dAdaptor_Curve.cxx @@ -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 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/Geom2dEvaluator/Geom2dEvaluator_Curve.hxx b/src/Geom2dEvaluator/Geom2dEvaluator_Curve.hxx index 4c99991a8e..9a82007b1b 100644 --- a/src/Geom2dEvaluator/Geom2dEvaluator_Curve.hxx +++ b/src/Geom2dEvaluator/Geom2dEvaluator_Curve.hxx @@ -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) }; diff --git a/src/Geom2dEvaluator/Geom2dEvaluator_OffsetCurve.cxx b/src/Geom2dEvaluator/Geom2dEvaluator_OffsetCurve.cxx index 88e3421484..6cbe24e2f4 100644 --- a/src/Geom2dEvaluator/Geom2dEvaluator_OffsetCurve.cxx +++ b/src/Geom2dEvaluator/Geom2dEvaluator_OffsetCurve.cxx @@ -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 diff --git a/src/Geom2dEvaluator/Geom2dEvaluator_OffsetCurve.hxx b/src/Geom2dEvaluator/Geom2dEvaluator_OffsetCurve.hxx index 356a89e9fc..209255983a 100644 --- a/src/Geom2dEvaluator/Geom2dEvaluator_OffsetCurve.hxx +++ b/src/Geom2dEvaluator/Geom2dEvaluator_OffsetCurve.hxx @@ -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: diff --git a/src/GeomAdaptor/GeomAdaptor_Curve.cxx b/src/GeomAdaptor/GeomAdaptor_Curve.cxx index 6d8bfae812..7115a0f80f 100644 --- a/src/GeomAdaptor/GeomAdaptor_Curve.cxx +++ b/src/GeomAdaptor/GeomAdaptor_Curve.cxx @@ -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 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..3c912b8a61 100644 --- a/src/GeomAdaptor/GeomAdaptor_Surface.cxx +++ b/src/GeomAdaptor/GeomAdaptor_Surface.cxx @@ -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 : 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..55e7e6b098 100644 --- a/src/GeomAdaptor/GeomAdaptor_SurfaceOfLinearExtrusion.cxx +++ b/src/GeomAdaptor/GeomAdaptor_SurfaceOfLinearExtrusion.cxx @@ -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 : 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..eea5ae45c9 100644 --- a/src/GeomAdaptor/GeomAdaptor_SurfaceOfRevolution.cxx +++ b/src/GeomAdaptor/GeomAdaptor_SurfaceOfRevolution.cxx @@ -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 : 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/GeomEvaluator/GeomEvaluator_Curve.hxx b/src/GeomEvaluator/GeomEvaluator_Curve.hxx index 6d57afad87..4a13acad50 100644 --- a/src/GeomEvaluator/GeomEvaluator_Curve.hxx +++ b/src/GeomEvaluator/GeomEvaluator_Curve.hxx @@ -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) }; diff --git a/src/GeomEvaluator/GeomEvaluator_OffsetCurve.cxx b/src/GeomEvaluator/GeomEvaluator_OffsetCurve.cxx index d01328ba5d..641221b9c5 100644 --- a/src/GeomEvaluator/GeomEvaluator_OffsetCurve.cxx +++ b/src/GeomEvaluator/GeomEvaluator_OffsetCurve.cxx @@ -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 diff --git a/src/GeomEvaluator/GeomEvaluator_OffsetCurve.hxx b/src/GeomEvaluator/GeomEvaluator_OffsetCurve.hxx index 1e894ce3b0..c16b1d34d5 100644 --- a/src/GeomEvaluator/GeomEvaluator_OffsetCurve.hxx +++ b/src/GeomEvaluator/GeomEvaluator_OffsetCurve.hxx @@ -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: diff --git a/src/GeomEvaluator/GeomEvaluator_OffsetSurface.cxx b/src/GeomEvaluator/GeomEvaluator_OffsetSurface.cxx index b154668fb1..6fac3fe0b1 100644 --- a/src/GeomEvaluator/GeomEvaluator_OffsetSurface.cxx +++ b/src/GeomEvaluator/GeomEvaluator_OffsetSurface.cxx @@ -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 diff --git a/src/GeomEvaluator/GeomEvaluator_OffsetSurface.hxx b/src/GeomEvaluator/GeomEvaluator_OffsetSurface.hxx index b6e6cb7d9d..e4433e28fa 100644 --- a/src/GeomEvaluator/GeomEvaluator_OffsetSurface.hxx +++ b/src/GeomEvaluator/GeomEvaluator_OffsetSurface.hxx @@ -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: diff --git a/src/GeomEvaluator/GeomEvaluator_Surface.hxx b/src/GeomEvaluator/GeomEvaluator_Surface.hxx index 4ec9aa5dbd..23fdcf8227 100644 --- a/src/GeomEvaluator/GeomEvaluator_Surface.hxx +++ b/src/GeomEvaluator/GeomEvaluator_Surface.hxx @@ -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) }; diff --git a/src/GeomEvaluator/GeomEvaluator_SurfaceOfExtrusion.cxx b/src/GeomEvaluator/GeomEvaluator_SurfaceOfExtrusion.cxx index b6a65e3e61..f84e72c0aa 100644 --- a/src/GeomEvaluator/GeomEvaluator_SurfaceOfExtrusion.cxx +++ b/src/GeomEvaluator/GeomEvaluator_SurfaceOfExtrusion.cxx @@ -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; +} + diff --git a/src/GeomEvaluator/GeomEvaluator_SurfaceOfExtrusion.hxx b/src/GeomEvaluator/GeomEvaluator_SurfaceOfExtrusion.hxx index 8b2a08c81c..49a48752b6 100644 --- a/src/GeomEvaluator/GeomEvaluator_SurfaceOfExtrusion.hxx +++ b/src/GeomEvaluator/GeomEvaluator_SurfaceOfExtrusion.hxx @@ -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: diff --git a/src/GeomEvaluator/GeomEvaluator_SurfaceOfRevolution.cxx b/src/GeomEvaluator/GeomEvaluator_SurfaceOfRevolution.cxx index fbce3b0a5b..6af64d0bd6 100644 --- a/src/GeomEvaluator/GeomEvaluator_SurfaceOfRevolution.cxx +++ b/src/GeomEvaluator/GeomEvaluator_SurfaceOfRevolution.cxx @@ -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; +} + diff --git a/src/GeomEvaluator/GeomEvaluator_SurfaceOfRevolution.hxx b/src/GeomEvaluator/GeomEvaluator_SurfaceOfRevolution.hxx index 97085349a4..c2858d0e5f 100644 --- a/src/GeomEvaluator/GeomEvaluator_SurfaceOfRevolution.hxx +++ b/src/GeomEvaluator/GeomEvaluator_SurfaceOfRevolution.hxx @@ -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: diff --git a/src/GeomFill/GeomFill_SnglrFunc.cxx b/src/GeomFill/GeomFill_SnglrFunc.cxx index 825758bff5..337f52e50a 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->ShallowCopy()); + 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/ProjLib/ProjLib_CompProjectedCurve.cxx b/src/ProjLib/ProjLib_CompProjectedCurve.cxx index 49c15ece7d..b13f5ac3c6 100644 --- a/src/ProjLib/ProjLib_CompProjectedCurve.cxx +++ b/src/ProjLib/ProjLib_CompProjectedCurve.cxx @@ -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; 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..07d3292333 100644 --- a/src/ProjLib/ProjLib_ProjectOnPlane.cxx +++ b/src/ProjLib/ProjLib_ProjectOnPlane.cxx @@ -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 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..875caf9e46 100644 --- a/src/ProjLib/ProjLib_ProjectedCurve.cxx +++ b/src/ProjLib/ProjLib_ProjectedCurve.cxx @@ -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 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);