modernize C++: make unique
This commit is contained in:
@@ -1043,12 +1043,12 @@ PyObject* BSplineCurvePy::interpolate(PyObject *args, PyObject *kwds)
|
||||
|
||||
std::unique_ptr<GeomAPI_Interpolate> aBSplineInterpolation;
|
||||
if (parameters.IsNull()) {
|
||||
aBSplineInterpolation.reset(new GeomAPI_Interpolate(interpolationPoints,
|
||||
Base::asBoolean(periodic), tol3d));
|
||||
aBSplineInterpolation = std::make_unique<GeomAPI_Interpolate>(interpolationPoints,
|
||||
Base::asBoolean(periodic), tol3d);
|
||||
}
|
||||
else {
|
||||
aBSplineInterpolation.reset(new GeomAPI_Interpolate(interpolationPoints, parameters,
|
||||
Base::asBoolean(periodic), tol3d));
|
||||
aBSplineInterpolation = std::make_unique<GeomAPI_Interpolate>(interpolationPoints, parameters,
|
||||
Base::asBoolean(periodic), tol3d);
|
||||
}
|
||||
|
||||
if (t1 && t2) {
|
||||
|
||||
@@ -121,8 +121,8 @@ void FaceMakerBullseye::Build_Essence()
|
||||
}
|
||||
else {
|
||||
//wire is not on a face. Start a new face.
|
||||
faces.push_back(std::unique_ptr<FaceDriller>(
|
||||
new FaceDriller(plane, w)
|
||||
faces.push_back(std::make_unique<FaceDriller>(
|
||||
plane, w
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -949,12 +949,16 @@ PyObject* BSplineCurve2dPy::interpolate(PyObject *args, PyObject *kwds)
|
||||
|
||||
std::unique_ptr<Geom2dAPI_Interpolate> aBSplineInterpolation;
|
||||
if (parameters.IsNull()) {
|
||||
aBSplineInterpolation.reset(new Geom2dAPI_Interpolate(interpolationPoints,
|
||||
Base::asBoolean(periodic), tol3d));
|
||||
aBSplineInterpolation = std::make_unique<Geom2dAPI_Interpolate>(
|
||||
interpolationPoints,
|
||||
Base::asBoolean(periodic), tol3d
|
||||
);
|
||||
}
|
||||
else {
|
||||
aBSplineInterpolation.reset(new Geom2dAPI_Interpolate(interpolationPoints, parameters,
|
||||
Base::asBoolean(periodic), tol3d));
|
||||
aBSplineInterpolation = std::make_unique<Geom2dAPI_Interpolate>(
|
||||
interpolationPoints, parameters,
|
||||
Base::asBoolean(periodic), tol3d
|
||||
);
|
||||
}
|
||||
|
||||
if (t1 && t2) {
|
||||
|
||||
@@ -99,10 +99,10 @@ int CurveConstraintPy::PyInit(PyObject* args, PyObject* kwds)
|
||||
}
|
||||
#endif
|
||||
|
||||
ptr.reset(new GeomPlate_CurveConstraint(hCurve, order, nbPts, tolDist, tolAng, tolCurv));
|
||||
ptr = std::make_unique<GeomPlate_CurveConstraint>(hCurve, order, nbPts, tolDist, tolAng, tolCurv);
|
||||
}
|
||||
else {
|
||||
ptr.reset(new GeomPlate_CurveConstraint);
|
||||
ptr = std::make_unique<GeomPlate_CurveConstraint>();
|
||||
}
|
||||
|
||||
setTwinPointer(ptr.release());
|
||||
|
||||
@@ -56,7 +56,7 @@ int PointConstraintPy::PyInit(PyObject* args, PyObject* kwds)
|
||||
std::unique_ptr<GeomPlate_PointConstraint> ptr;
|
||||
Base::Vector3d v = static_cast<Base::VectorPy*>(pt)->value();
|
||||
|
||||
ptr.reset(new GeomPlate_PointConstraint(gp_Pnt(v.x, v.y, v.z), order, tolDist));
|
||||
ptr = std::make_unique<GeomPlate_PointConstraint>(gp_Pnt(v.x, v.y, v.z), order, tolDist);
|
||||
setTwinPointer(ptr.release());
|
||||
|
||||
return 0;
|
||||
|
||||
@@ -5365,51 +5365,51 @@ std::unique_ptr<GeomSurface> makeFromSurface(const Handle(Geom_Surface)& s)
|
||||
std::unique_ptr<GeomSurface> geoSurf;
|
||||
if (s->IsKind(STANDARD_TYPE(Geom_ToroidalSurface))) {
|
||||
Handle(Geom_ToroidalSurface) hSurf = Handle(Geom_ToroidalSurface)::DownCast(s);
|
||||
geoSurf.reset(new GeomToroid(hSurf));
|
||||
geoSurf = std::make_unique<GeomToroid>(hSurf);
|
||||
}
|
||||
else if (s->IsKind(STANDARD_TYPE(Geom_BezierSurface))) {
|
||||
Handle(Geom_BezierSurface) hSurf = Handle(Geom_BezierSurface)::DownCast(s);
|
||||
geoSurf.reset(new GeomBezierSurface(hSurf));
|
||||
geoSurf = std::make_unique<GeomBezierSurface>(hSurf);
|
||||
}
|
||||
else if (s->IsKind(STANDARD_TYPE(Geom_BSplineSurface))) {
|
||||
Handle(Geom_BSplineSurface) hSurf = Handle(Geom_BSplineSurface)::DownCast(s);
|
||||
geoSurf.reset(new GeomBSplineSurface(hSurf));
|
||||
geoSurf = std::make_unique<GeomBSplineSurface>(hSurf);
|
||||
}
|
||||
else if (s->IsKind(STANDARD_TYPE(Geom_CylindricalSurface))) {
|
||||
Handle(Geom_CylindricalSurface) hSurf = Handle(Geom_CylindricalSurface)::DownCast(s);
|
||||
geoSurf.reset(new GeomCylinder(hSurf));
|
||||
geoSurf = std::make_unique<GeomCylinder>(hSurf);
|
||||
}
|
||||
else if (s->IsKind(STANDARD_TYPE(Geom_ConicalSurface))) {
|
||||
Handle(Geom_ConicalSurface) hSurf = Handle(Geom_ConicalSurface)::DownCast(s);
|
||||
geoSurf.reset(new GeomCone(hSurf));
|
||||
geoSurf = std::make_unique<GeomCone>(hSurf);
|
||||
}
|
||||
else if (s->IsKind(STANDARD_TYPE(Geom_SphericalSurface))) {
|
||||
Handle(Geom_SphericalSurface) hSurf = Handle(Geom_SphericalSurface)::DownCast(s);
|
||||
geoSurf.reset(new GeomSphere(hSurf));
|
||||
geoSurf = std::make_unique<GeomSphere>(hSurf);
|
||||
}
|
||||
else if (s->IsKind(STANDARD_TYPE(Geom_Plane))) {
|
||||
Handle(Geom_Plane) hSurf = Handle(Geom_Plane)::DownCast(s);
|
||||
geoSurf.reset(new GeomPlane(hSurf));
|
||||
geoSurf = std::make_unique<GeomPlane>(hSurf);
|
||||
}
|
||||
else if (s->IsKind(STANDARD_TYPE(Geom_OffsetSurface))) {
|
||||
Handle(Geom_OffsetSurface) hSurf = Handle(Geom_OffsetSurface)::DownCast(s);
|
||||
geoSurf.reset(new GeomOffsetSurface(hSurf));
|
||||
geoSurf = std::make_unique<GeomOffsetSurface>(hSurf);
|
||||
}
|
||||
else if (s->IsKind(STANDARD_TYPE(GeomPlate_Surface))) {
|
||||
Handle(GeomPlate_Surface) hSurf = Handle(GeomPlate_Surface)::DownCast(s);
|
||||
geoSurf.reset(new GeomPlateSurface(hSurf));
|
||||
geoSurf = std::make_unique<GeomPlateSurface>(hSurf);
|
||||
}
|
||||
else if (s->IsKind(STANDARD_TYPE(Geom_RectangularTrimmedSurface))) {
|
||||
Handle(Geom_RectangularTrimmedSurface) hSurf = Handle(Geom_RectangularTrimmedSurface)::DownCast(s);
|
||||
geoSurf.reset(new GeomTrimmedSurface(hSurf));
|
||||
geoSurf = std::make_unique<GeomTrimmedSurface>(hSurf);
|
||||
}
|
||||
else if (s->IsKind(STANDARD_TYPE(Geom_SurfaceOfRevolution))) {
|
||||
Handle(Geom_SurfaceOfRevolution) hSurf = Handle(Geom_SurfaceOfRevolution)::DownCast(s);
|
||||
geoSurf.reset(new GeomSurfaceOfRevolution(hSurf));
|
||||
geoSurf = std::make_unique<GeomSurfaceOfRevolution>(hSurf);
|
||||
}
|
||||
else if (s->IsKind(STANDARD_TYPE(Geom_SurfaceOfLinearExtrusion))) {
|
||||
Handle(Geom_SurfaceOfLinearExtrusion) hSurf = Handle(Geom_SurfaceOfLinearExtrusion)::DownCast(s);
|
||||
geoSurf.reset(new GeomSurfaceOfExtrusion(hSurf));
|
||||
geoSurf = std::make_unique<GeomSurfaceOfExtrusion>(hSurf);
|
||||
}
|
||||
else {
|
||||
std::string err = "Unhandled surface type ";
|
||||
@@ -5425,27 +5425,27 @@ std::unique_ptr<GeomCurve> makeFromCurve(const Handle(Geom_Curve)& c)
|
||||
std::unique_ptr<GeomCurve> geoCurve;
|
||||
if (c->IsKind(STANDARD_TYPE(Geom_Circle))) {
|
||||
Handle(Geom_Circle) circ = Handle(Geom_Circle)::DownCast(c);
|
||||
geoCurve.reset(new GeomCircle(circ));
|
||||
geoCurve = std::make_unique<GeomCircle>(circ);
|
||||
}
|
||||
else if (c->IsKind(STANDARD_TYPE(Geom_Ellipse))) {
|
||||
Handle(Geom_Ellipse) ell = Handle(Geom_Ellipse)::DownCast(c);
|
||||
geoCurve.reset(new GeomEllipse(ell));
|
||||
geoCurve = std::make_unique<GeomEllipse>(ell);
|
||||
}
|
||||
else if (c->IsKind(STANDARD_TYPE(Geom_Hyperbola))) {
|
||||
Handle(Geom_Hyperbola) hyp = Handle(Geom_Hyperbola)::DownCast(c);
|
||||
geoCurve.reset(new GeomHyperbola(hyp));
|
||||
geoCurve = std::make_unique<GeomHyperbola>(hyp);
|
||||
}
|
||||
else if (c->IsKind(STANDARD_TYPE(Geom_Line))) {
|
||||
Handle(Geom_Line) lin = Handle(Geom_Line)::DownCast(c);
|
||||
geoCurve.reset(new GeomLine(lin));
|
||||
geoCurve = std::make_unique<GeomLine>(lin);
|
||||
}
|
||||
else if (c->IsKind(STANDARD_TYPE(Geom_OffsetCurve))) {
|
||||
Handle(Geom_OffsetCurve) oc = Handle(Geom_OffsetCurve)::DownCast(c);
|
||||
geoCurve.reset(new GeomOffsetCurve(oc));
|
||||
geoCurve = std::make_unique<GeomOffsetCurve>(oc);
|
||||
}
|
||||
else if (c->IsKind(STANDARD_TYPE(Geom_Parabola))) {
|
||||
Handle(Geom_Parabola) par = Handle(Geom_Parabola)::DownCast(c);
|
||||
geoCurve.reset(new GeomParabola(par));
|
||||
geoCurve = std::make_unique<GeomParabola>(par);
|
||||
}
|
||||
else if (c->IsKind(STANDARD_TYPE(Geom_TrimmedCurve))) {
|
||||
return makeFromTrimmedCurve(c, c->FirstParameter(), c->LastParameter());
|
||||
@@ -5456,11 +5456,11 @@ std::unique_ptr<GeomCurve> makeFromCurve(const Handle(Geom_Curve)& c)
|
||||
}*/
|
||||
else if (c->IsKind(STANDARD_TYPE(Geom_BezierCurve))) {
|
||||
Handle(Geom_BezierCurve) bezier = Handle(Geom_BezierCurve)::DownCast(c);
|
||||
geoCurve.reset(new GeomBezierCurve(bezier));
|
||||
geoCurve = std::make_unique<GeomBezierCurve>(bezier);
|
||||
}
|
||||
else if (c->IsKind(STANDARD_TYPE(Geom_BSplineCurve))) {
|
||||
Handle(Geom_BSplineCurve) bspline = Handle(Geom_BSplineCurve)::DownCast(c);
|
||||
geoCurve.reset(new GeomBSplineCurve(bspline));
|
||||
geoCurve = std::make_unique<GeomBSplineCurve>(bspline);
|
||||
}
|
||||
else {
|
||||
std::string err = "Unhandled curve type ";
|
||||
@@ -5567,7 +5567,7 @@ std::unique_ptr<GeomCurve> makeFromCurveAdaptor(const Adaptor3d_Curve& adapt)
|
||||
{
|
||||
case GeomAbs_Line:
|
||||
{
|
||||
geoCurve.reset(new GeomLine());
|
||||
geoCurve = std::make_unique<GeomLine>();
|
||||
Handle(Geom_Line) this_curv = Handle(Geom_Line)::DownCast
|
||||
(geoCurve->handle());
|
||||
this_curv->SetLin(adapt.Line());
|
||||
@@ -5575,7 +5575,7 @@ std::unique_ptr<GeomCurve> makeFromCurveAdaptor(const Adaptor3d_Curve& adapt)
|
||||
}
|
||||
case GeomAbs_Circle:
|
||||
{
|
||||
geoCurve.reset(new GeomCircle());
|
||||
geoCurve = std::make_unique<GeomCircle>();
|
||||
Handle(Geom_Circle) this_curv = Handle(Geom_Circle)::DownCast
|
||||
(geoCurve->handle());
|
||||
this_curv->SetCirc(adapt.Circle());
|
||||
@@ -5583,7 +5583,7 @@ std::unique_ptr<GeomCurve> makeFromCurveAdaptor(const Adaptor3d_Curve& adapt)
|
||||
}
|
||||
case GeomAbs_Ellipse:
|
||||
{
|
||||
geoCurve.reset(new GeomEllipse());
|
||||
geoCurve = std::make_unique<GeomEllipse>();
|
||||
Handle(Geom_Ellipse) this_curv = Handle(Geom_Ellipse)::DownCast
|
||||
(geoCurve->handle());
|
||||
this_curv->SetElips(adapt.Ellipse());
|
||||
@@ -5591,7 +5591,7 @@ std::unique_ptr<GeomCurve> makeFromCurveAdaptor(const Adaptor3d_Curve& adapt)
|
||||
}
|
||||
case GeomAbs_Hyperbola:
|
||||
{
|
||||
geoCurve.reset(new GeomHyperbola());
|
||||
geoCurve = std::make_unique<GeomHyperbola>();
|
||||
Handle(Geom_Hyperbola) this_curv = Handle(Geom_Hyperbola)::DownCast
|
||||
(geoCurve->handle());
|
||||
this_curv->SetHypr(adapt.Hyperbola());
|
||||
@@ -5599,7 +5599,7 @@ std::unique_ptr<GeomCurve> makeFromCurveAdaptor(const Adaptor3d_Curve& adapt)
|
||||
}
|
||||
case GeomAbs_Parabola:
|
||||
{
|
||||
geoCurve.reset(new GeomParabola());
|
||||
geoCurve = std::make_unique<GeomParabola>();
|
||||
Handle(Geom_Parabola) this_curv = Handle(Geom_Parabola)::DownCast
|
||||
(geoCurve->handle());
|
||||
this_curv->SetParab(adapt.Parabola());
|
||||
@@ -5607,17 +5607,17 @@ std::unique_ptr<GeomCurve> makeFromCurveAdaptor(const Adaptor3d_Curve& adapt)
|
||||
}
|
||||
case GeomAbs_BezierCurve:
|
||||
{
|
||||
geoCurve.reset(new GeomBezierCurve(adapt.Bezier()));
|
||||
geoCurve = std::make_unique<GeomBezierCurve>(adapt.Bezier());
|
||||
break;
|
||||
}
|
||||
case GeomAbs_BSplineCurve:
|
||||
{
|
||||
geoCurve.reset(new GeomBSplineCurve(adapt.BSpline()));
|
||||
geoCurve = std::make_unique<GeomBSplineCurve>(adapt.BSpline());
|
||||
break;
|
||||
}
|
||||
case GeomAbs_OffsetCurve:
|
||||
{
|
||||
geoCurve.reset(new GeomOffsetCurve(adapt.OffsetCurve()));
|
||||
geoCurve = std::make_unique<GeomOffsetCurve>(adapt.OffsetCurve());
|
||||
break;
|
||||
}
|
||||
case GeomAbs_OtherCurve:
|
||||
|
||||
@@ -2304,28 +2304,28 @@ std::unique_ptr<Geom2dCurve> makeFromCurve2d(Handle(Geom2d_Curve) curve)
|
||||
if (curve.IsNull())
|
||||
return geo2d;
|
||||
if (curve->IsKind(STANDARD_TYPE (Geom2d_Parabola))) {
|
||||
geo2d.reset(new Geom2dParabola(Handle(Geom2d_Parabola)::DownCast(curve)));
|
||||
geo2d = std::make_unique<Geom2dParabola>(Handle(Geom2d_Parabola)::DownCast(curve));
|
||||
}
|
||||
else if (curve->IsKind(STANDARD_TYPE (Geom2d_Hyperbola))) {
|
||||
geo2d.reset(new Geom2dHyperbola(Handle(Geom2d_Hyperbola)::DownCast(curve)));
|
||||
geo2d = std::make_unique<Geom2dHyperbola>(Handle(Geom2d_Hyperbola)::DownCast(curve));
|
||||
}
|
||||
else if (curve->IsKind(STANDARD_TYPE (Geom2d_Ellipse))) {
|
||||
geo2d.reset(new Geom2dEllipse(Handle(Geom2d_Ellipse)::DownCast(curve)));
|
||||
geo2d = std::make_unique<Geom2dEllipse>(Handle(Geom2d_Ellipse)::DownCast(curve));
|
||||
}
|
||||
else if (curve->IsKind(STANDARD_TYPE (Geom2d_Circle))) {
|
||||
geo2d.reset(new Geom2dCircle(Handle(Geom2d_Circle)::DownCast(curve)));
|
||||
geo2d = std::make_unique<Geom2dCircle>(Handle(Geom2d_Circle)::DownCast(curve));
|
||||
}
|
||||
else if (curve->IsKind(STANDARD_TYPE (Geom2d_Line))) {
|
||||
geo2d.reset(new Geom2dLine(Handle(Geom2d_Line)::DownCast(curve)));
|
||||
geo2d = std::make_unique<Geom2dLine>(Handle(Geom2d_Line)::DownCast(curve));
|
||||
}
|
||||
else if (curve->IsKind(STANDARD_TYPE (Geom2d_BSplineCurve))) {
|
||||
geo2d.reset(new Geom2dBSplineCurve(Handle(Geom2d_BSplineCurve)::DownCast(curve)));
|
||||
geo2d = std::make_unique<Geom2dBSplineCurve>(Handle(Geom2d_BSplineCurve)::DownCast(curve));
|
||||
}
|
||||
else if (curve->IsKind(STANDARD_TYPE (Geom2d_BezierCurve))) {
|
||||
geo2d.reset(new Geom2dBezierCurve(Handle(Geom2d_BezierCurve)::DownCast(curve)));
|
||||
geo2d = std::make_unique<Geom2dBezierCurve>(Handle(Geom2d_BezierCurve)::DownCast(curve));
|
||||
}
|
||||
else if (curve->IsKind(STANDARD_TYPE (Geom2d_TrimmedCurve))) {
|
||||
geo2d.reset(new Geom2dTrimmedCurve(Handle(Geom2d_TrimmedCurve)::DownCast(curve)));
|
||||
geo2d = std::make_unique<Geom2dTrimmedCurve>(Handle(Geom2d_TrimmedCurve)::DownCast(curve));
|
||||
}
|
||||
|
||||
return geo2d;
|
||||
@@ -2426,7 +2426,7 @@ std::unique_ptr<Geom2dCurve> makeFromCurveAdaptor2d(const Adaptor2d_Curve2d& ada
|
||||
{
|
||||
case GeomAbs_Line:
|
||||
{
|
||||
geoCurve.reset(new Geom2dLine());
|
||||
geoCurve = std::make_unique<Geom2dLine>();
|
||||
Handle(Geom2d_Line) this_curv = Handle(Geom2d_Line)::DownCast
|
||||
(geoCurve->handle());
|
||||
this_curv->SetLin2d(adapt.Line());
|
||||
@@ -2434,7 +2434,7 @@ std::unique_ptr<Geom2dCurve> makeFromCurveAdaptor2d(const Adaptor2d_Curve2d& ada
|
||||
}
|
||||
case GeomAbs_Circle:
|
||||
{
|
||||
geoCurve.reset(new Geom2dCircle());
|
||||
geoCurve = std::make_unique<Geom2dCircle>();
|
||||
Handle(Geom2d_Circle) this_curv = Handle(Geom2d_Circle)::DownCast
|
||||
(geoCurve->handle());
|
||||
this_curv->SetCirc2d(adapt.Circle());
|
||||
@@ -2442,7 +2442,7 @@ std::unique_ptr<Geom2dCurve> makeFromCurveAdaptor2d(const Adaptor2d_Curve2d& ada
|
||||
}
|
||||
case GeomAbs_Ellipse:
|
||||
{
|
||||
geoCurve.reset(new Geom2dEllipse());
|
||||
geoCurve = std::make_unique<Geom2dEllipse>();
|
||||
Handle(Geom2d_Ellipse) this_curv = Handle(Geom2d_Ellipse)::DownCast
|
||||
(geoCurve->handle());
|
||||
this_curv->SetElips2d(adapt.Ellipse());
|
||||
@@ -2450,7 +2450,7 @@ std::unique_ptr<Geom2dCurve> makeFromCurveAdaptor2d(const Adaptor2d_Curve2d& ada
|
||||
}
|
||||
case GeomAbs_Hyperbola:
|
||||
{
|
||||
geoCurve.reset(new Geom2dHyperbola());
|
||||
geoCurve = std::make_unique<Geom2dHyperbola>();
|
||||
Handle(Geom2d_Hyperbola) this_curv = Handle(Geom2d_Hyperbola)::DownCast
|
||||
(geoCurve->handle());
|
||||
this_curv->SetHypr2d(adapt.Hyperbola());
|
||||
@@ -2458,7 +2458,7 @@ std::unique_ptr<Geom2dCurve> makeFromCurveAdaptor2d(const Adaptor2d_Curve2d& ada
|
||||
}
|
||||
case GeomAbs_Parabola:
|
||||
{
|
||||
geoCurve.reset(new Geom2dParabola());
|
||||
geoCurve = std::make_unique<Geom2dParabola>();
|
||||
Handle(Geom2d_Parabola) this_curv = Handle(Geom2d_Parabola)::DownCast
|
||||
(geoCurve->handle());
|
||||
this_curv->SetParab2d(adapt.Parabola());
|
||||
@@ -2466,12 +2466,12 @@ std::unique_ptr<Geom2dCurve> makeFromCurveAdaptor2d(const Adaptor2d_Curve2d& ada
|
||||
}
|
||||
case GeomAbs_BezierCurve:
|
||||
{
|
||||
geoCurve.reset(new Geom2dBezierCurve(adapt.Bezier()));
|
||||
geoCurve = std::make_unique<Geom2dBezierCurve>(adapt.Bezier());
|
||||
break;
|
||||
}
|
||||
case GeomAbs_BSplineCurve:
|
||||
{
|
||||
geoCurve.reset(new Geom2dBSplineCurve(adapt.BSpline()));
|
||||
geoCurve = std::make_unique<Geom2dBSplineCurve>(adapt.BSpline());
|
||||
break;
|
||||
}
|
||||
case GeomAbs_OtherCurve:
|
||||
|
||||
@@ -170,7 +170,7 @@ SoBrepFaceSet::SoBrepFaceSet()
|
||||
selContext2 = std::make_shared<SelContext>();
|
||||
packedColor = 0;
|
||||
|
||||
pimpl.reset(new VBO);
|
||||
pimpl = std::make_unique<VBO>();
|
||||
}
|
||||
|
||||
SoBrepFaceSet::~SoBrepFaceSet()
|
||||
|
||||
Reference in New Issue
Block a user