From f2dc8c5d31ed2ca968081eddab4be21751c5e1bd Mon Sep 17 00:00:00 2001 From: wmayer Date: Tue, 21 Feb 2017 13:30:43 +0100 Subject: [PATCH] Some fixes of pr 538 fix -Wreturn-type homogenous naming style use official spelling of B-spline --- src/Mod/Part/App/Geometry.cpp | 369 +++++++++--------- src/Mod/Part/App/Geometry.h | 4 +- src/Mod/Sketcher/App/SketchObject.cpp | 16 +- src/Mod/Sketcher/App/SketchObject.h | 8 +- src/Mod/Sketcher/App/SketchObjectPy.xml | 18 +- src/Mod/Sketcher/App/SketchObjectPyImp.cpp | 48 ++- src/Mod/Sketcher/Gui/CommandCreateGeo.cpp | 8 +- .../Sketcher/Gui/CommandSketcherBSpline.cpp | 48 +-- src/Mod/Sketcher/Gui/CommandSketcherTools.cpp | 4 +- src/Mod/Sketcher/Gui/Workbench.cpp | 6 +- 10 files changed, 284 insertions(+), 245 deletions(-) diff --git a/src/Mod/Part/App/Geometry.cpp b/src/Mod/Part/App/Geometry.cpp index 1ffb07786f..4470ea4fb6 100644 --- a/src/Mod/Part/App/Geometry.cpp +++ b/src/Mod/Part/App/Geometry.cpp @@ -187,24 +187,24 @@ Geometry::~Geometry() { } -// Persistence implementer -unsigned int Geometry::getMemSize (void) const +// Persistence implementer +unsigned int Geometry::getMemSize (void) const { return 1; } -void Geometry::Save(Base::Writer &writer) const +void Geometry::Save(Base::Writer &writer) const { const char c = Construction?'1':'0'; writer.Stream() << writer.ind() << "" << endl; } -void Geometry::Restore(Base::XMLReader &reader) +void Geometry::Restore(Base::XMLReader &reader) { // read my Element reader.readElement("Construction"); // get the value of my Attribute - Construction = (int)reader.getAttributeAsInteger("value")==0?false:true; + Construction = (int)reader.getAttributeAsInteger("value")==0?false:true; } // ------------------------------------------------- @@ -257,28 +257,28 @@ void GeomPoint::setPoint(const Base::Vector3d& p) this->myPoint->SetCoord(p.x,p.y,p.z); } -// Persistence implementer +// Persistence implementer unsigned int GeomPoint::getMemSize (void) const { return sizeof(Geom_CartesianPoint); } -void GeomPoint::Save(Base::Writer &writer) const +void GeomPoint::Save(Base::Writer &writer) const { // save the attributes of the father class Geometry::Save(writer); Base::Vector3d Point = getPoint(); - writer.Stream() - << writer.ind() - << "" << endl; } -void GeomPoint::Restore(Base::XMLReader &reader) +void GeomPoint::Restore(Base::XMLReader &reader) { // read the attributes of the father class Geometry::Restore(reader); @@ -290,7 +290,7 @@ void GeomPoint::Restore(Base::XMLReader &reader) X = reader.getAttributeAsFloat("X"); Y = reader.getAttributeAsFloat("Y"); Z = reader.getAttributeAsFloat("Z"); - + // set the read geometry setPoint(Base::Vector3d(X,Y,Z) ); } @@ -350,9 +350,9 @@ Base::Vector3d GeomCurve::pointAtParameter(double u) const { Handle_Geom_Curve c = Handle_Geom_Curve::DownCast(handle()); GeomLProp_CLProps prop(c,u,0,Precision::Confusion()); - + const gp_Pnt &point=prop.Value(); - + return Base::Vector3d(point.X(),point.Y(),point.Z()); } @@ -360,9 +360,9 @@ Base::Vector3d GeomCurve::firstDerivativeAtParameter(double u) const { Handle_Geom_Curve c = Handle_Geom_Curve::DownCast(handle()); GeomLProp_CLProps prop(c,u,1,Precision::Confusion()); - + const gp_Vec &vec=prop.D1(); - + return Base::Vector3d(vec.X(),vec.Y(),vec.Z()); } @@ -370,23 +370,23 @@ Base::Vector3d GeomCurve::secondDerivativeAtParameter(double u) const { Handle_Geom_Curve c = Handle_Geom_Curve::DownCast(handle()); GeomLProp_CLProps prop(c,u,2,Precision::Confusion()); - + const gp_Vec &vec=prop.D2(); - + return Base::Vector3d(vec.X(),vec.Y(),vec.Z()); } bool GeomCurve::normalAt(double u, Base::Vector3d& dir) const { Handle_Geom_Curve c = Handle_Geom_Curve::DownCast(handle()); - + try { if (!c.IsNull()) { GeomLProp_CLProps prop(c,u,2,Precision::Confusion()); gp_Dir gdir; prop.Normal(gdir); dir = Base::Vector3d(gdir.X(), gdir.Y(), gdir.Z()); - + return true; } } @@ -394,7 +394,7 @@ bool GeomCurve::normalAt(double u, Base::Vector3d& dir) const Handle_Standard_Failure e = Standard_Failure::Caught(); throw Base::RuntimeError(e->GetMessageString()); } - + return false; } @@ -420,7 +420,7 @@ bool GeomCurve::closestParameter(const Base::Vector3d& point, double &u) const bool GeomCurve::closestParameterToBasicCurve(const Base::Vector3d& point, double &u) const { Handle_Geom_Curve c = Handle_Geom_Curve::DownCast(handle()); - + if (c->IsKind(STANDARD_TYPE(Geom_TrimmedCurve))){ Handle_Geom_TrimmedCurve tc = Handle_Geom_TrimmedCurve::DownCast(handle()); Handle_Geom_Curve bc = tc->BasisCurve(); @@ -437,8 +437,8 @@ bool GeomCurve::closestParameterToBasicCurve(const Base::Vector3d& point, double throw Base::RuntimeError(e->GetMessageString()); } - return false; - } + return false; + } else { return this->closestParameter(point, u); } @@ -446,31 +446,26 @@ bool GeomCurve::closestParameterToBasicCurve(const Base::Vector3d& point, double double GeomCurve::getFirstParameter() const { - Handle_Geom_Curve c = Handle_Geom_Curve::DownCast(handle()); - + try { - if (!c.IsNull()) { - // pending check for RealFirst RealLast in case of infinite curve - return c->FirstParameter(); - } + // pending check for RealFirst RealLast in case of infinite curve + return c->FirstParameter(); } catch (Standard_Failure) { Handle_Standard_Failure e = Standard_Failure::Caught(); throw Base::RuntimeError(e->GetMessageString()); } - + } + double GeomCurve::getLastParameter() const { - Handle_Geom_Curve c = Handle_Geom_Curve::DownCast(handle()); try { - if (!c.IsNull()) { - // pending check for RealFirst RealLast in case of infinite curve - return c->LastParameter(); - } + // pending check for RealFirst RealLast in case of infinite curve + return c->LastParameter(); } catch (Standard_Failure) { Handle_Standard_Failure e = Standard_Failure::Caught(); @@ -478,15 +473,13 @@ double GeomCurve::getLastParameter() const } } -double GeomCurve::curvatureAt(double u) const +double GeomCurve::curvatureAt(double u) const { Handle_Geom_Curve c = Handle_Geom_Curve::DownCast(handle()); - + try { - if (!c.IsNull()) { - GeomLProp_CLProps prop(c,u,2,Precision::Confusion()); - return prop.Curvature(); - } + GeomLProp_CLProps prop(c,u,2,Precision::Confusion()); + return prop.Curvature(); } catch (Standard_Failure) { Handle_Standard_Failure e = Standard_Failure::Caught(); @@ -500,10 +493,8 @@ double GeomCurve::length(double u, double v) const Handle_Geom_Curve c = Handle_Geom_Curve::DownCast(handle()); try { - if (!c.IsNull()) { - GeomAdaptor_Curve adaptor(c); - return GCPnts_AbscissaPoint::Length(adaptor,u,v,Precision::Confusion()); - } + GeomAdaptor_Curve adaptor(c); + return GCPnts_AbscissaPoint::Length(adaptor,u,v,Precision::Confusion()); } catch (Standard_Failure) { Handle_Standard_Failure e = Standard_Failure::Caught(); @@ -511,14 +502,12 @@ double GeomCurve::length(double u, double v) const } } -void GeomCurve::Reverse(void) +void GeomCurve::reverse(void) { Handle_Geom_Curve c = Handle_Geom_Curve::DownCast(handle()); try { - if (!c.IsNull()) { - c->Reverse(); - } + c->Reverse(); } catch (Standard_Failure) { Handle_Standard_Failure e = Standard_Failure::Caught(); @@ -595,7 +584,7 @@ Geometry *GeomBezierCurve::clone(void) const return newCurve; } -// Persistence implementer +// Persistence implementer unsigned int GeomBezierCurve::getMemSize (void) const {assert(0); return 0;/* not implemented yet */} void GeomBezierCurve::Save (Base::Writer &/*writer*/) const {assert(0); /* not implemented yet */} void GeomBezierCurve::Restore (Base::XMLReader &/*reader*/) {assert(0); /* not implemented yet */} @@ -907,11 +896,11 @@ void GeomBSplineCurve::makeC1Continuous(double tol, double ang_tol) GeomConvert::C0BSplineToC1BSplineCurve(this->myCurve, tol, ang_tol); } -void GeomBSplineCurve::increaseDegree(const double Degree) +void GeomBSplineCurve::increaseDegree(double degree) { try { Handle_Geom_BSplineCurve curve = Handle_Geom_BSplineCurve::DownCast(this->handle()); - curve->IncreaseDegree(Degree); + curve->IncreaseDegree(degree); return; } catch (Standard_Failure) { @@ -920,7 +909,7 @@ void GeomBSplineCurve::increaseDegree(const double Degree) } } -// Persistence implementer +// Persistence implementer unsigned int GeomBSplineCurve::getMemSize (void) const { return sizeof(Geom_BSplineCurve); @@ -948,10 +937,10 @@ void GeomBSplineCurve::Save(Base::Writer& writer) const "\">" << endl; writer.incInd(); - + std::vector::const_iterator itp; std::vector::const_iterator itw; - + for (itp = poles.begin(), itw = weights.begin(); itp != poles.end() && itw != weights.end(); ++itp, ++itw) { writer.Stream() << writer.ind() @@ -991,10 +980,10 @@ void GeomBSplineCurve::Restore(Base::XMLReader& reader) int degree = reader.getAttributeAsInteger("Degree"); bool isperiodic = (bool) reader.getAttributeAsInteger("IsPeriodic"); - // Handle_Geom_BSplineCurve spline = new + // Handle_Geom_BSplineCurve spline = new // Geom_BSplineCurve(occpoles,occweights,occknots,occmults,degree, // PyObject_IsTrue(periodic) ? Standard_True : Standard_False, - // PyObject_IsTrue(CheckRational) ? Standard_True : Standard_False); + // PyObject_IsTrue(CheckRational) ? Standard_True : Standard_False); TColgp_Array1OfPnt p(1,polescount); TColStd_Array1OfReal w(1,polescount); @@ -1461,7 +1450,7 @@ void GeomCircle::setRadius(double Radius) } } -// Persistence implementer +// Persistence implementer unsigned int GeomCircle::getMemSize (void) const { return sizeof(Geom_Circle); @@ -1667,13 +1656,13 @@ void GeomArcOfCircle::setRange(double u, double v, bool emulateCCWXY) } } -// Persistence implementer +// Persistence implementer unsigned int GeomArcOfCircle::getMemSize (void) const { return sizeof(Geom_Circle) + 2 *sizeof(double); } -void GeomArcOfCircle::Save(Base::Writer &writer) const +void GeomArcOfCircle::Save(Base::Writer &writer) const { // save the attributes of the father class Geometry::Save(writer); @@ -1698,7 +1687,7 @@ void GeomArcOfCircle::Save(Base::Writer &writer) const "\"/>" << endl; } -void GeomArcOfCircle::Restore(Base::XMLReader &reader) +void GeomArcOfCircle::Restore(Base::XMLReader &reader) { // read the attributes of the father class Geometry::Restore(reader); @@ -1731,7 +1720,7 @@ void GeomArcOfCircle::Restore(Base::XMLReader &reader) Handle_Geom_TrimmedCurve tmpcurve = ma.Value(); Handle_Geom_Circle tmpcircle = Handle_Geom_Circle::DownCast(tmpcurve->BasisCurve()); Handle_Geom_Circle circle = Handle_Geom_Circle::DownCast(this->myCurve->BasisCurve()); - + circle->SetCirc(tmpcircle->Circ()); this->myCurve->SetTrim(tmpcurve->FirstParameter(), tmpcurve->LastParameter()); } @@ -1901,7 +1890,7 @@ void GeomEllipse::setMajorAxisDir(Base::Vector3d newdir) } } -// Persistence implementer +// Persistence implementer unsigned int GeomEllipse::getMemSize (void) const { return sizeof(Geom_Ellipse); @@ -1915,12 +1904,12 @@ void GeomEllipse::Save(Base::Writer& writer) const gp_Pnt center = this->myCurve->Axis().Location(); gp_Dir normal = this->myCurve->Axis().Direction(); gp_Dir xdir = this->myCurve->XAxis().Direction(); - + gp_Ax2 xdirref(center, normal); // this is a reference XY for the ellipse - + double AngleXU = -xdir.AngleWithRef(xdirref.XDirection(),normal); - - + + writer.Stream() << writer.ind() << "myCurve->BasisCurve()); gp_Pnt center = ellipse->Axis().Location(); gp_Dir normal = ellipse->Axis().Direction(); gp_Dir xdir = ellipse->XAxis().Direction(); - + gp_Ax2 xdirref(center, normal); // this is a reference XY for the ellipse - + double AngleXU = -xdir.AngleWithRef(xdirref.XDirection(),normal); - - + + writer.Stream() << writer.ind() << "MinorRadius() << "\" " << "AngleXU=\"" << AngleXU << "\" " << "StartAngle=\"" << this->myCurve->FirstParameter() << "\" " - << "EndAngle=\"" << this->myCurve->LastParameter() << "\" " + << "EndAngle=\"" << this->myCurve->LastParameter() << "\" " << "/>" << endl; } -void GeomArcOfEllipse::Restore(Base::XMLReader &reader) +void GeomArcOfEllipse::Restore(Base::XMLReader &reader) { // read the attributes of the father class GeomCurve::Restore(reader); @@ -2226,31 +2215,31 @@ void GeomArcOfEllipse::Restore(Base::XMLReader &reader) AngleXU = reader.getAttributeAsFloat("AngleXU"); StartAngle = reader.getAttributeAsFloat("StartAngle"); EndAngle = reader.getAttributeAsFloat("EndAngle"); - - + + // set the read geometry gp_Pnt p1(CenterX,CenterY,CenterZ); gp_Dir norm(NormalX,NormalY,NormalZ); - + gp_Ax1 normaxis(p1,norm); - + gp_Ax2 xdir(p1, norm); - - xdir.Rotate(normaxis,AngleXU); - + + xdir.Rotate(normaxis,AngleXU); + try { GC_MakeEllipse mc(xdir, MajorRadius, MinorRadius); if (!mc.IsDone()) throw Base::Exception(gce_ErrorStatusText(mc.Status())); - + GC_MakeArcOfEllipse ma(mc.Value()->Elips(), StartAngle, EndAngle, 1); if (!ma.IsDone()) throw Base::Exception(gce_ErrorStatusText(ma.Status())); - + Handle_Geom_TrimmedCurve tmpcurve = ma.Value(); Handle_Geom_Ellipse tmpellipse = Handle_Geom_Ellipse::DownCast(tmpcurve->BasisCurve()); Handle_Geom_Ellipse ellipse = Handle_Geom_Ellipse::DownCast(this->myCurve->BasisCurve()); - + ellipse->SetElips(tmpellipse->Elips()); this->myCurve->SetTrim(tmpcurve->FirstParameter(), tmpcurve->LastParameter()); } @@ -2339,7 +2328,7 @@ void GeomHyperbola::setMinorRadius(double Radius) } } -// Persistence implementer +// Persistence implementer unsigned int GeomHyperbola::getMemSize (void) const { return sizeof(Geom_Hyperbola); @@ -2353,11 +2342,11 @@ void GeomHyperbola::Save(Base::Writer& writer) const gp_Pnt center = this->myCurve->Axis().Location(); gp_Dir normal = this->myCurve->Axis().Direction(); gp_Dir xdir = this->myCurve->XAxis().Direction(); - + gp_Ax2 xdirref(center, normal); // this is a reference XY for the ellipse - + double AngleXU = -xdir.AngleWithRef(xdirref.XDirection(),normal); - + writer.Stream() << writer.ind() << "Position(); pos.SetXDirection(gp_Dir(newdir.x, newdir.y, newdir.z));//OCC should keep the old main Direction (Z), and change YDirection to accomodate the new XDirection. @@ -2587,27 +2576,27 @@ void GeomArcOfHyperbola::setRange(double u, double v, bool emulateCCWXY) } } -// Persistence implementer +// Persistence implementer unsigned int GeomArcOfHyperbola::getMemSize (void) const { return sizeof(Geom_Hyperbola) + 2 *sizeof(double); } -void GeomArcOfHyperbola::Save(Base::Writer &writer) const +void GeomArcOfHyperbola::Save(Base::Writer &writer) const { // save the attributes of the father class GeomCurve::Save(writer); - + Handle_Geom_Hyperbola h = Handle_Geom_Hyperbola::DownCast(this->myCurve->BasisCurve()); gp_Pnt center = h->Axis().Location(); gp_Dir normal = h->Axis().Direction(); gp_Dir xdir = h->XAxis().Direction(); - + gp_Ax2 xdirref(center, normal); // this is a reference XY for the ellipse - + double AngleXU = -xdir.AngleWithRef(xdirref.XDirection(),normal); - + writer.Stream() << writer.ind() << "MinorRadius() << "\" " << "AngleXU=\"" << AngleXU << "\" " << "StartAngle=\"" << this->myCurve->FirstParameter() << "\" " - << "EndAngle=\"" << this->myCurve->LastParameter() << "\" " + << "EndAngle=\"" << this->myCurve->LastParameter() << "\" " << "/>" << endl; } -void GeomArcOfHyperbola::Restore(Base::XMLReader &reader) +void GeomArcOfHyperbola::Restore(Base::XMLReader &reader) { // read the attributes of the father class GeomCurve::Restore(reader); @@ -2645,31 +2634,31 @@ void GeomArcOfHyperbola::Restore(Base::XMLReader &reader) AngleXU = reader.getAttributeAsFloat("AngleXU"); StartAngle = reader.getAttributeAsFloat("StartAngle"); EndAngle = reader.getAttributeAsFloat("EndAngle"); - - + + // set the read geometry gp_Pnt p1(CenterX,CenterY,CenterZ); gp_Dir norm(NormalX,NormalY,NormalZ); - + gp_Ax1 normaxis(p1,norm); - + gp_Ax2 xdir(p1, norm); - - xdir.Rotate(normaxis,AngleXU); - + + xdir.Rotate(normaxis,AngleXU); + try { GC_MakeHyperbola mc(xdir, MajorRadius, MinorRadius); if (!mc.IsDone()) throw Base::Exception(gce_ErrorStatusText(mc.Status())); - + GC_MakeArcOfHyperbola ma(mc.Value()->Hypr(), StartAngle, EndAngle, 1); if (!ma.IsDone()) throw Base::Exception(gce_ErrorStatusText(ma.Status())); - + Handle_Geom_TrimmedCurve tmpcurve = ma.Value(); Handle_Geom_Hyperbola tmphyperbola = Handle_Geom_Hyperbola::DownCast(tmpcurve->BasisCurve()); Handle_Geom_Hyperbola hyperbola = Handle_Geom_Hyperbola::DownCast(this->myCurve->BasisCurve()); - + hyperbola->SetHypr(tmphyperbola->Hypr()); this->myCurve->SetTrim(tmpcurve->FirstParameter(), tmpcurve->LastParameter()); } @@ -2740,7 +2729,7 @@ void GeomParabola::setFocal(double length) } } -// Persistence implementer +// Persistence implementer unsigned int GeomParabola::getMemSize (void) const { return sizeof(Geom_Parabola); @@ -2754,11 +2743,11 @@ void GeomParabola::Save(Base::Writer& writer) const gp_Pnt center = this->myCurve->Axis().Location(); gp_Dir normal = this->myCurve->Axis().Direction(); gp_Dir xdir = this->myCurve->XAxis().Direction(); - + gp_Ax2 xdirref(center, normal); // this is a reference XY for the ellipse - + double AngleXU = -xdir.AngleWithRef(xdirref.XDirection(),normal); - + writer.Stream() << writer.ind() << "BasisCurve()); gp_Pnt gp = p->Focus(); - + return Base::Vector3d(gp.X(),gp.Y(),gp.Z()); } @@ -2931,27 +2920,27 @@ void GeomArcOfParabola::setRange(double u, double v, bool emulateCCWXY) } } -// Persistence implementer +// Persistence implementer unsigned int GeomArcOfParabola::getMemSize (void) const { return sizeof(Geom_Parabola) + 2 *sizeof(double); } -void GeomArcOfParabola::Save(Base::Writer &writer) const +void GeomArcOfParabola::Save(Base::Writer &writer) const { // save the attributes of the father class GeomCurve::Save(writer); - + Handle_Geom_Parabola p = Handle_Geom_Parabola::DownCast(this->myCurve->BasisCurve()); gp_Pnt center = p->Axis().Location(); gp_Dir normal = p->Axis().Direction(); gp_Dir xdir = p->XAxis().Direction(); - + gp_Ax2 xdirref(center, normal); // this is a reference XY for the ellipse - + double AngleXU = -xdir.AngleWithRef(xdirref.XDirection(),normal); - + writer.Stream() << writer.ind() << "Focal() << "\" " << "AngleXU=\"" << AngleXU << "\" " << "StartAngle=\"" << this->myCurve->FirstParameter() << "\" " - << "EndAngle=\"" << this->myCurve->LastParameter() << "\" " + << "EndAngle=\"" << this->myCurve->LastParameter() << "\" " << "/>" << endl; } -void GeomArcOfParabola::Restore(Base::XMLReader &reader) +void GeomArcOfParabola::Restore(Base::XMLReader &reader) { // read the attributes of the father class GeomCurve::Restore(reader); @@ -2987,31 +2976,31 @@ void GeomArcOfParabola::Restore(Base::XMLReader &reader) AngleXU = reader.getAttributeAsFloat("AngleXU"); StartAngle = reader.getAttributeAsFloat("StartAngle"); EndAngle = reader.getAttributeAsFloat("EndAngle"); - - + + // set the read geometry gp_Pnt p1(CenterX,CenterY,CenterZ); gp_Dir norm(NormalX,NormalY,NormalZ); - + gp_Ax1 normaxis(p1,norm); - + gp_Ax2 xdir(p1, norm); - - xdir.Rotate(normaxis,AngleXU); - + + xdir.Rotate(normaxis,AngleXU); + try { gce_MakeParab mc(xdir, Focal); if (!mc.IsDone()) throw Base::Exception(gce_ErrorStatusText(mc.Status())); - + GC_MakeArcOfParabola ma(mc.Value(), StartAngle, EndAngle, 1); if (!ma.IsDone()) throw Base::Exception(gce_ErrorStatusText(ma.Status())); - + Handle_Geom_TrimmedCurve tmpcurve = ma.Value(); Handle_Geom_Parabola tmpparabola = Handle_Geom_Parabola::DownCast(tmpcurve->BasisCurve()); Handle_Geom_Parabola parabola = Handle_Geom_Parabola::DownCast(this->myCurve->BasisCurve()); - + parabola->SetParab(tmpparabola->Parab()); this->myCurve->SetTrim(tmpcurve->FirstParameter(), tmpcurve->LastParameter()); } @@ -3081,13 +3070,13 @@ Geometry *GeomLine::clone(void) const return newLine; } -// Persistence implementer -unsigned int GeomLine::getMemSize (void) const +// Persistence implementer +unsigned int GeomLine::getMemSize (void) const { return sizeof(Geom_Line); } -void GeomLine::Save(Base::Writer &writer) const +void GeomLine::Save(Base::Writer &writer) const { // save the attributes of the father class Geometry::Save(writer); @@ -3095,14 +3084,14 @@ void GeomLine::Save(Base::Writer &writer) const Base::Vector3d Pos = getPos(); Base::Vector3d Dir = getDir(); - writer.Stream() - << writer.ind() - << "" << endl; } @@ -3121,7 +3110,7 @@ void GeomLine::Restore(Base::XMLReader &reader) DirX = reader.getAttributeAsFloat("DirX"); DirY = reader.getAttributeAsFloat("DirY"); DirZ = reader.getAttributeAsFloat("DirZ"); - + // set the read geometry setLine(Base::Vector3d(PosX,PosY,PosZ),Base::Vector3d(DirX,DirY,DirZ) ); } @@ -3211,13 +3200,13 @@ void GeomLineSegment::setPoints(const Base::Vector3d& Start, const Base::Vector3 } } -// Persistence implementer +// Persistence implementer unsigned int GeomLineSegment::getMemSize (void) const { return sizeof(Geom_TrimmedCurve) + sizeof(Geom_Line); } -void GeomLineSegment::Save (Base::Writer &writer) const +void GeomLineSegment::Save (Base::Writer &writer) const { // save the attributes of the father class Geometry::Save(writer); @@ -3225,19 +3214,19 @@ void GeomLineSegment::Save (Base::Writer &writer) const Base::Vector3d End = getEndPoint(); Base::Vector3d Start = getStartPoint(); - writer.Stream() - << writer.ind() - << "" << endl; } -void GeomLineSegment::Restore (Base::XMLReader &reader) +void GeomLineSegment::Restore (Base::XMLReader &reader) { // read the attributes of the father class Geometry::Restore(reader); @@ -3252,7 +3241,7 @@ void GeomLineSegment::Restore (Base::XMLReader &reader) EndX = reader.getAttributeAsFloat("EndX"); EndY = reader.getAttributeAsFloat("EndY"); EndZ = reader.getAttributeAsFloat("EndZ"); - + // set the read geometry setPoints(Base::Vector3d(StartX,StartY,StartZ),Base::Vector3d(EndX,EndY,EndZ) ); } @@ -3301,7 +3290,7 @@ const Handle_Geom_Geometry& GeomOffsetCurve::handle() const return this->myCurve; } -// Persistence implementer +// Persistence implementer unsigned int GeomOffsetCurve::getMemSize (void) const {assert(0); return 0;/* not implemented yet */} void GeomOffsetCurve::Save (Base::Writer &/*writer*/) const {assert(0); /* not implemented yet */} void GeomOffsetCurve::Restore (Base::XMLReader &/*reader*/) {assert(0); /* not implemented yet */} @@ -3345,7 +3334,7 @@ Geometry *GeomTrimmedCurve::clone(void) const return newCurve; } -// Persistence implementer +// Persistence implementer unsigned int GeomTrimmedCurve::getMemSize (void) const {assert(0); return 0;/* not implemented yet */} void GeomTrimmedCurve::Save (Base::Writer &/*writer*/) const {assert(0); /* not implemented yet */} void GeomTrimmedCurve::Restore (Base::XMLReader &/*reader*/) {assert(0); /* not implemented yet */} @@ -3439,7 +3428,7 @@ Geometry *GeomBezierSurface::clone(void) const return newSurf; } -// Persistence implementer +// Persistence implementer unsigned int GeomBezierSurface::getMemSize (void) const {assert(0); return 0;/* not implemented yet */} void GeomBezierSurface::Save (Base::Writer &/*writer*/) const {assert(0); /* not implemented yet */} void GeomBezierSurface::Restore (Base::XMLReader &/*reader*/) {assert(0); /* not implemented yet */} @@ -3498,7 +3487,7 @@ Geometry *GeomBSplineSurface::clone(void) const return newSurf; } -// Persistence implementer +// Persistence implementer unsigned int GeomBSplineSurface::getMemSize (void) const {assert(0); return 0;/* not implemented yet */} void GeomBSplineSurface::Save (Base::Writer &/*writer*/) const {assert(0); /* not implemented yet */} void GeomBSplineSurface::Restore (Base::XMLReader &/*reader*/) {assert(0); /* not implemented yet */} @@ -3545,7 +3534,7 @@ Geometry *GeomCylinder::clone(void) const return tempCurve; } -// Persistence implementer +// Persistence implementer unsigned int GeomCylinder::getMemSize (void) const {assert(0); return 0;/* not implemented yet */} void GeomCylinder::Save (Base::Writer &/*writer*/) const {assert(0); /* not implemented yet */} void GeomCylinder::Restore (Base::XMLReader &/*reader*/) {assert(0); /* not implemented yet */} @@ -3592,7 +3581,7 @@ Geometry *GeomCone::clone(void) const return tempCurve; } -// Persistence implementer +// Persistence implementer unsigned int GeomCone::getMemSize (void) const {assert(0); return 0;/* not implemented yet */} void GeomCone::Save (Base::Writer &/*writer*/) const {assert(0); /* not implemented yet */} void GeomCone::Restore (Base::XMLReader &/*reader*/) {assert(0); /* not implemented yet */} @@ -3639,7 +3628,7 @@ Geometry *GeomToroid::clone(void) const return tempCurve; } -// Persistence implementer +// Persistence implementer unsigned int GeomToroid::getMemSize (void) const {assert(0); return 0;/* not implemented yet */} void GeomToroid::Save (Base::Writer &/*writer*/) const {assert(0); /* not implemented yet */} void GeomToroid::Restore (Base::XMLReader &/*reader*/) {assert(0); /* not implemented yet */} @@ -3686,7 +3675,7 @@ Geometry *GeomSphere::clone(void) const return tempCurve; } -// Persistence implementer +// Persistence implementer unsigned int GeomSphere::getMemSize (void) const {assert(0); return 0;/* not implemented yet */} void GeomSphere::Save (Base::Writer &/*writer*/) const {assert(0); /* not implemented yet */} void GeomSphere::Restore (Base::XMLReader &/*reader*/) {assert(0); /* not implemented yet */} @@ -3733,7 +3722,7 @@ Geometry *GeomPlane::clone(void) const return tempCurve; } -// Persistence implementer +// Persistence implementer unsigned int GeomPlane::getMemSize (void) const {assert(0); return 0;/* not implemented yet */} void GeomPlane::Save (Base::Writer &/*writer*/) const {assert(0); /* not implemented yet */} void GeomPlane::Restore (Base::XMLReader &/*reader*/) {assert(0); /* not implemented yet */} @@ -3782,7 +3771,7 @@ Geometry *GeomOffsetSurface::clone(void) const return newSurf; } -// Persistence implementer +// Persistence implementer unsigned int GeomOffsetSurface::getMemSize (void) const {assert(0); return 0;/* not implemented yet */} void GeomOffsetSurface::Save (Base::Writer &/*writer*/) const {assert(0); /* not implemented yet */} void GeomOffsetSurface::Restore (Base::XMLReader &/*reader*/) {assert(0); /* not implemented yet */} @@ -3837,7 +3826,7 @@ Geometry *GeomPlateSurface::clone(void) const return newSurf; } -// Persistence implementer +// Persistence implementer unsigned int GeomPlateSurface::getMemSize (void) const { throw Base::NotImplementedError("GeomPlateSurface::getMemSize"); @@ -3892,7 +3881,7 @@ Geometry *GeomTrimmedSurface::clone(void) const return newSurf; } -// Persistence implementer +// Persistence implementer unsigned int GeomTrimmedSurface::getMemSize (void) const {assert(0); return 0;/* not implemented yet */} void GeomTrimmedSurface::Save (Base::Writer &/*writer*/) const {assert(0); /* not implemented yet */} void GeomTrimmedSurface::Restore (Base::XMLReader &/*reader*/) {assert(0); /* not implemented yet */} @@ -3941,7 +3930,7 @@ Geometry *GeomSurfaceOfRevolution::clone(void) const return newSurf; } -// Persistence implementer +// Persistence implementer unsigned int GeomSurfaceOfRevolution::getMemSize (void) const {assert(0); return 0;/* not implemented yet */} void GeomSurfaceOfRevolution::Save (Base::Writer &/*writer*/) const {assert(0); /* not implemented yet */} void GeomSurfaceOfRevolution::Restore (Base::XMLReader &/*reader*/) {assert(0); /* not implemented yet */} @@ -3990,7 +3979,7 @@ Geometry *GeomSurfaceOfExtrusion::clone(void) const return newSurf; } -// Persistence implementer +// Persistence implementer unsigned int GeomSurfaceOfExtrusion::getMemSize (void) const {assert(0); return 0;/* not implemented yet */} void GeomSurfaceOfExtrusion::Save (Base::Writer &/*writer*/) const {assert(0); /* not implemented yet */} void GeomSurfaceOfExtrusion::Restore (Base::XMLReader &/*reader*/) {assert(0); /* not implemented yet */} diff --git a/src/Mod/Part/App/Geometry.h b/src/Mod/Part/App/Geometry.h index 23f8e48c72..2b20ed7adf 100644 --- a/src/Mod/Part/App/Geometry.h +++ b/src/Mod/Part/App/Geometry.h @@ -147,7 +147,7 @@ public: double length(double u, double v) const; bool normalAt(double u, Base::Vector3d& dir) const; - void Reverse(void); + void reverse(void); }; class PartExport GeomBoundedCurve : public GeomCurve @@ -231,7 +231,7 @@ public: void makeC1Continuous(double, double); std::list toBiArcs(double tolerance) const; - void increaseDegree(const double Degree); + void increaseDegree(double degree); // Persistence implementer --------------------- virtual unsigned int getMemSize(void) const; diff --git a/src/Mod/Sketcher/App/SketchObject.cpp b/src/Mod/Sketcher/App/SketchObject.cpp index 84429f3e1e..e24c54fc3d 100644 --- a/src/Mod/Sketcher/App/SketchObject.cpp +++ b/src/Mod/Sketcher/App/SketchObject.cpp @@ -659,7 +659,7 @@ int SketchObject::delGeometry(int GeoId, bool deleteinternalgeo) geo->getTypeId() == Part::GeomBSplineCurve::getClassTypeId())) { if(deleteinternalgeo) { - this->DeleteUnusedInternalGeometry(GeoId, true); + this->deleteUnusedInternalGeometry(GeoId, true); return 0; } } @@ -2950,7 +2950,7 @@ int SketchObject::addCopy(const std::vector &geoIdList, const Base::Vector3 } -int SketchObject::ExposeInternalGeometry(int GeoId) +int SketchObject::exposeInternalGeometry(int GeoId) { if (GeoId < 0 || GeoId > getHighestCurveIndex()) return -1; @@ -3488,7 +3488,7 @@ int SketchObject::ExposeInternalGeometry(int GeoId) return -1; // not supported type } -int SketchObject::DeleteUnusedInternalGeometry(int GeoId, bool delgeoid) +int SketchObject::deleteUnusedInternalGeometry(int GeoId, bool delgeoid) { if (GeoId < 0 || GeoId > getHighestCurveIndex()) return -1; @@ -3766,9 +3766,11 @@ int SketchObject::DeleteUnusedInternalGeometry(int GeoId, bool delgeoid) } } -bool SketchObject::ConvertToNURBS(int GeoId) +bool SketchObject::convertToNURBS(int GeoId) { - if ( GeoId > getHighestCurveIndex() || ( GeoId < 0 && -GeoId > int(ExternalGeo.size())) || GeoId == -1 || GeoId == -2) + if (GeoId > getHighestCurveIndex() || + (GeoId < 0 && -GeoId > static_cast(ExternalGeo.size())) || + GeoId == -1 || GeoId == -2) return false; const Part::Geometry *geo = getGeometry(GeoId); @@ -3787,7 +3789,7 @@ bool SketchObject::ConvertToNURBS(int GeoId) const Part::GeomArcOfConic * geoaoc = static_cast(geo1); if(geoaoc->isReversed()) - bspline->Reverse(); + bspline->reverse(); } } catch (const Base::Exception& e) { @@ -3833,7 +3835,7 @@ bool SketchObject::ConvertToNURBS(int GeoId) } -bool SketchObject::IncreaseBSplineDegree(int GeoId, int degreeincrement /*= 1*/) +bool SketchObject::increaseBSplineDegree(int GeoId, int degreeincrement /*= 1*/) { if (GeoId < 0 || GeoId > getHighestCurveIndex()) return -1; diff --git a/src/Mod/Sketcher/App/SketchObject.h b/src/Mod/Sketcher/App/SketchObject.h index f8d9229625..d5e3b3530e 100644 --- a/src/Mod/Sketcher/App/SketchObject.h +++ b/src/Mod/Sketcher/App/SketchObject.h @@ -188,21 +188,21 @@ public: /*! * \return -1 on error */ - int ExposeInternalGeometry(int GeoId); + int exposeInternalGeometry(int GeoId); /*! \brief Deletes all unused (not further constrained) internal geometry \param GeoId - the geometry having the internal geometry to delete \param delgeoid - if true in addition to the unused internal geometry also deletes the GeoId geometry \retval int - returns -1 on error, otherwise the number of deleted elements */ - int DeleteUnusedInternalGeometry(int GeoId, bool delgeoid=false); + int deleteUnusedInternalGeometry(int GeoId, bool delgeoid=false); /*! \brief Approximates the given geometry with a B-Spline \param GeoId - the geometry to approximate \param delgeoid - if true in addition to the unused internal geometry also deletes the GeoId geometry \retval bool - returns true if the approximation succeeded, or false if it did not succeed. */ - bool ConvertToNURBS(int GeoId); + bool convertToNURBS(int GeoId); /*! \brief Increases the degree of a BSpline by degreeincrement, which defaults to 1 @@ -210,7 +210,7 @@ public: \param degreeincrement - the increment in number of degrees to effect \retval bool - returns true if the increase in degree succeeded, or false if it did not succeed. */ - bool IncreaseBSplineDegree(int GeoId, int degreeincrement = 1); + bool increaseBSplineDegree(int GeoId, int degreeincrement = 1); /// retrieves for a Vertex number the corresponding GeoId and PosId void getGeoVertexIndex(int VertexId, int &GeoId, PointPos &PosId) const; diff --git a/src/Mod/Sketcher/App/SketchObjectPy.xml b/src/Mod/Sketcher/App/SketchObjectPy.xml index 2f82a64031..d097973637 100644 --- a/src/Mod/Sketcher/App/SketchObjectPy.xml +++ b/src/Mod/Sketcher/App/SketchObjectPy.xml @@ -149,20 +149,30 @@ - Exposes all internal geometry of an object supporting internal geometry + Deprecated -- use exposeInternalGeometry - Deletes all unused (not further constrained) internal geometry + Deprecated -- use deleteUnusedInternalGeometry - + + + Exposes all internal geometry of an object supporting internal geometry + + + + + Deletes all unused (not further constrained) internal geometry + + + Approximates the given geometry with a B-Spline - + Increases the given BSpline Degree by a number of degrees diff --git a/src/Mod/Sketcher/App/SketchObjectPyImp.cpp b/src/Mod/Sketcher/App/SketchObjectPyImp.cpp index 40c201d8c3..7ff121fbac 100644 --- a/src/Mod/Sketcher/App/SketchObjectPyImp.cpp +++ b/src/Mod/Sketcher/App/SketchObjectPyImp.cpp @@ -964,6 +964,7 @@ PyObject* SketchObjectPy::changeConstraintsLocking(PyObject *args) return Py::new_reference_to(Py::Int(naff)); } +//Deprecated PyObject* SketchObjectPy::ExposeInternalGeometry(PyObject *args) { int GeoId; @@ -971,7 +972,7 @@ PyObject* SketchObjectPy::ExposeInternalGeometry(PyObject *args) if (!PyArg_ParseTuple(args, "i", &GeoId)) return 0; - if (this->getSketchObjectPtr()->ExposeInternalGeometry(GeoId)==-1) { + if (this->getSketchObjectPtr()->exposeInternalGeometry(GeoId)==-1) { std::stringstream str; str << "Object does not support internal geometry: " << GeoId; PyErr_SetString(PyExc_ValueError, str.str().c_str()); @@ -981,6 +982,7 @@ PyObject* SketchObjectPy::ExposeInternalGeometry(PyObject *args) Py_Return; } +//Deprecated PyObject* SketchObjectPy::DeleteUnusedInternalGeometry(PyObject *args) { int GeoId; @@ -988,7 +990,7 @@ PyObject* SketchObjectPy::DeleteUnusedInternalGeometry(PyObject *args) if (!PyArg_ParseTuple(args, "i", &GeoId)) return 0; - if (this->getSketchObjectPtr()->DeleteUnusedInternalGeometry(GeoId)==-1) { + if (this->getSketchObjectPtr()->deleteUnusedInternalGeometry(GeoId)==-1) { std::stringstream str; str << "Object does not support internal geometry: " << GeoId; PyErr_SetString(PyExc_ValueError, str.str().c_str()); @@ -998,14 +1000,48 @@ PyObject* SketchObjectPy::DeleteUnusedInternalGeometry(PyObject *args) Py_Return; } -PyObject* SketchObjectPy::ConvertToNURBS(PyObject *args) +PyObject* SketchObjectPy::exposeInternalGeometry(PyObject *args) { int GeoId; if (!PyArg_ParseTuple(args, "i", &GeoId)) return 0; - if (this->getSketchObjectPtr()->ConvertToNURBS(GeoId)==false) { + if (this->getSketchObjectPtr()->exposeInternalGeometry(GeoId)==-1) { + std::stringstream str; + str << "Object does not support internal geometry: " << GeoId; + PyErr_SetString(PyExc_ValueError, str.str().c_str()); + return 0; + } + + Py_Return; +} + +PyObject* SketchObjectPy::deleteUnusedInternalGeometry(PyObject *args) +{ + int GeoId; + + if (!PyArg_ParseTuple(args, "i", &GeoId)) + return 0; + + if (this->getSketchObjectPtr()->deleteUnusedInternalGeometry(GeoId)==-1) { + std::stringstream str; + str << "Object does not support internal geometry: " << GeoId; + PyErr_SetString(PyExc_ValueError, str.str().c_str()); + return 0; + } + + Py_Return; +} + +PyObject* SketchObjectPy::convertToNURBS(PyObject *args) +{ + int GeoId; + + if (!PyArg_ParseTuple(args, "i", &GeoId)) + return 0; + + if (this->getSketchObjectPtr()->convertToNURBS(GeoId)==false) { std::stringstream str; str << "Object does not support NURBS conversion: " << GeoId; PyErr_SetString(PyExc_ValueError, str.str().c_str()); @@ -1015,7 +1051,7 @@ PyObject* SketchObjectPy::ConvertToNURBS(PyObject *args) Py_Return; } -PyObject* SketchObjectPy::IncreaseBSplineDegree(PyObject *args) +PyObject* SketchObjectPy::increaseBSplineDegree(PyObject *args) { int GeoId; int incr = 1; @@ -1023,7 +1059,7 @@ PyObject* SketchObjectPy::IncreaseBSplineDegree(PyObject *args) if (!PyArg_ParseTuple(args, "i|i", &GeoId, &incr)) return 0; - if (this->getSketchObjectPtr()->IncreaseBSplineDegree(GeoId, incr)==false) { + if (this->getSketchObjectPtr()->increaseBSplineDegree(GeoId, incr)==false) { std::stringstream str; str << "Degree increase failed for: " << GeoId; PyErr_SetString(PyExc_ValueError, str.str().c_str()); diff --git a/src/Mod/Sketcher/Gui/CommandCreateGeo.cpp b/src/Mod/Sketcher/Gui/CommandCreateGeo.cpp index 675eab9bb4..53fb2e49ac 100644 --- a/src/Mod/Sketcher/Gui/CommandCreateGeo.cpp +++ b/src/Mod/Sketcher/Gui/CommandCreateGeo.cpp @@ -2897,7 +2897,7 @@ private: currentgeoid++; Gui::Command::doCommand(Gui::Command::Doc, - "App.ActiveDocument.%s.ExposeInternalGeometry(%d)", + "App.ActiveDocument.%s.exposeInternalGeometry(%d)", sketchgui->getObject()->getNameInDocument(), currentgeoid); } @@ -3325,7 +3325,7 @@ public: currentgeoid++; Gui::Command::doCommand(Gui::Command::Doc, - "App.ActiveDocument.%s.ExposeInternalGeometry(%d)", + "App.ActiveDocument.%s.exposeInternalGeometry(%d)", sketchgui->getObject()->getNameInDocument(), currentgeoid); } @@ -3718,7 +3718,7 @@ public: currentgeoid++; Gui::Command::doCommand(Gui::Command::Doc, - "App.ActiveDocument.%s.ExposeInternalGeometry(%d)", + "App.ActiveDocument.%s.exposeInternalGeometry(%d)", sketchgui->getObject()->getNameInDocument(), currentgeoid); @@ -4071,7 +4071,7 @@ public: currentgeoid++; Gui::Command::doCommand(Gui::Command::Doc, - "App.ActiveDocument.%s.ExposeInternalGeometry(%d)", + "App.ActiveDocument.%s.exposeInternalGeometry(%d)", sketchgui->getObject()->getNameInDocument(), currentgeoid); diff --git a/src/Mod/Sketcher/Gui/CommandSketcherBSpline.cpp b/src/Mod/Sketcher/Gui/CommandSketcherBSpline.cpp index d910580e32..caa80f6a95 100644 --- a/src/Mod/Sketcher/Gui/CommandSketcherBSpline.cpp +++ b/src/Mod/Sketcher/Gui/CommandSketcherBSpline.cpp @@ -105,8 +105,8 @@ CmdSketcherBSplineDegree::CmdSketcherBSplineDegree() { sAppModule = "Sketcher"; sGroup = QT_TR_NOOP("Sketcher"); - sMenuText = QT_TR_NOOP("Show/Hide B-Spline degree"); - sToolTipText = QT_TR_NOOP("Switches between showing and hiding the degree for all B-Splines"); + sMenuText = QT_TR_NOOP("Show/Hide B-spline degree"); + sToolTipText = QT_TR_NOOP("Switches between showing and hiding the degree for all B-splines"); sWhatsThis = "Sketcher_BSplineDegree"; sStatusTip = sToolTipText; sPixmap = "Sketcher_BSplineDegree"; @@ -139,8 +139,8 @@ CmdSketcherBSplinePolygon::CmdSketcherBSplinePolygon() { sAppModule = "Sketcher"; sGroup = QT_TR_NOOP("Sketcher"); - sMenuText = QT_TR_NOOP("Show/Hide B-Spline control polygon"); - sToolTipText = QT_TR_NOOP("Switches between showing and hiding the control polygons for all B-Splines"); + sMenuText = QT_TR_NOOP("Show/Hide B-spline control polygon"); + sToolTipText = QT_TR_NOOP("Switches between showing and hiding the control polygons for all B-splines"); sWhatsThis = "Sketcher_BSplinePolygon"; sStatusTip = sToolTipText; sPixmap = "Sketcher_BSplinePolygon"; @@ -173,8 +173,8 @@ CmdSketcherBSplineComb::CmdSketcherBSplineComb() { sAppModule = "Sketcher"; sGroup = QT_TR_NOOP("Sketcher"); - sMenuText = QT_TR_NOOP("Show/Hide B-Spline curvature comb"); - sToolTipText = QT_TR_NOOP("Switches between showing and hiding the curvature comb for all B-Splines"); + sMenuText = QT_TR_NOOP("Show/Hide B-spline curvature comb"); + sToolTipText = QT_TR_NOOP("Switches between showing and hiding the curvature comb for all B-splines"); sWhatsThis = "Sketcher_BSplineComb"; sStatusTip = sToolTipText; sPixmap = "Sketcher_BSplineComb"; @@ -207,8 +207,8 @@ CmdSketcherCompBSplineShowHideGeometryInformation::CmdSketcherCompBSplineShowHid { sAppModule = "Sketcher"; sGroup = QT_TR_NOOP("Sketcher"); - sMenuText = QT_TR_NOOP("Show/hide B-Spline information layer"); - sToolTipText = QT_TR_NOOP("Show/hide B-Spline information layer"); + sMenuText = QT_TR_NOOP("Show/hide B-spline information layer"); + sToolTipText = QT_TR_NOOP("Show/hide B-spline information layer"); sWhatsThis = "Sketcher_CompBSplineShowHideGeometryInformation"; sStatusTip = sToolTipText; eType = ForEdit; @@ -273,17 +273,17 @@ void CmdSketcherCompBSplineShowHideGeometryInformation::languageChange() QList a = pcAction->actions(); QAction* c1 = a[0]; - c1->setText(QApplication::translate("CmdSketcherCompBSplineShowHideGeometryInformation","Show/Hide B-Spline degree")); - c1->setToolTip(QApplication::translate("Sketcher_BSplineDegree","Switches between showing and hiding the degree for all B-Splines")); - c1->setStatusTip(QApplication::translate("Sketcher_BSplineDegree","Switches between showing and hiding the degree for all B-Splines")); + c1->setText(QApplication::translate("CmdSketcherCompBSplineShowHideGeometryInformation","Show/Hide B-spline degree")); + c1->setToolTip(QApplication::translate("Sketcher_BSplineDegree","Switches between showing and hiding the degree for all B-splines")); + c1->setStatusTip(QApplication::translate("Sketcher_BSplineDegree","Switches between showing and hiding the degree for all B-splines")); QAction* c2 = a[1]; - c2->setText(QApplication::translate("CmdSketcherCompBSplineShowHideGeometryInformation","Show/Hide B-Spline control polygon")); - c2->setToolTip(QApplication::translate("Sketcher_BSplinePolygon","Switches between showing and hiding the control polygons for all B-Splines")); - c2->setStatusTip(QApplication::translate("Sketcher_BSplinePolygon","Switches between showing and hiding the control polygons for all B-Splines")); + c2->setText(QApplication::translate("CmdSketcherCompBSplineShowHideGeometryInformation","Show/Hide B-spline control polygon")); + c2->setToolTip(QApplication::translate("Sketcher_BSplinePolygon","Switches between showing and hiding the control polygons for all B-splines")); + c2->setStatusTip(QApplication::translate("Sketcher_BSplinePolygon","Switches between showing and hiding the control polygons for all B-splines")); QAction* c3 = a[2]; - c3->setText(QApplication::translate("CmdSketcherCompBSplineShowHideGeometryInformation","Show/Hide B-Spline curvature comb")); - c3->setToolTip(QApplication::translate("Sketcher_BSplineComb","Switches between showing and hiding the curvature comb for all B-Splines")); - c3->setStatusTip(QApplication::translate("Sketcher_BSplineComb","Switches between showing and hiding the curvature comb for all B-Splines")); + c3->setText(QApplication::translate("CmdSketcherCompBSplineShowHideGeometryInformation","Show/Hide B-spline curvature comb")); + c3->setToolTip(QApplication::translate("Sketcher_BSplineComb","Switches between showing and hiding the curvature comb for all B-splines")); + c3->setStatusTip(QApplication::translate("Sketcher_BSplineComb","Switches between showing and hiding the curvature comb for all B-splines")); } @@ -304,8 +304,8 @@ CmdSketcherConvertToNURB::CmdSketcherConvertToNURB() { sAppModule = "Sketcher"; sGroup = QT_TR_NOOP("Sketcher"); - sMenuText = QT_TR_NOOP("Convert Geometry to B-Spline"); - sToolTipText = QT_TR_NOOP("Converts the given Geometry to a B-Spline"); + sMenuText = QT_TR_NOOP("Convert Geometry to B-spline"); + sToolTipText = QT_TR_NOOP("Converts the given Geometry to a B-spline"); sWhatsThis = "Sketcher_ConvertToNURB"; sStatusTip = sToolTipText; sPixmap = "Sketcher_BSplineApproximate"; @@ -340,7 +340,7 @@ void CmdSketcherConvertToNURB::activated(int iMsg) int GeoId = std::atoi(SubNames[i].substr(4,4000).c_str()) - 1; Gui::Command::doCommand( - Doc,"App.ActiveDocument.%s.ConvertToNURBS(%d) ", + Doc,"App.ActiveDocument.%s.convertToNURBS(%d) ", selection[0].getFeatName(),GeoId); nurbsized = true; @@ -350,7 +350,7 @@ void CmdSketcherConvertToNURB::activated(int iMsg) int GeoId = - (std::atoi(SubNames[i].substr(12,4000).c_str()) + 2); Gui::Command::doCommand( - Doc,"App.ActiveDocument.%s.ConvertToNURBS(%d) ", + Doc,"App.ActiveDocument.%s.convertToNURBS(%d) ", selection[0].getFeatName(),GeoId); nurbsized = true; @@ -392,7 +392,7 @@ CmdSketcherIncreaseDegree::CmdSketcherIncreaseDegree() sAppModule = "Sketcher"; sGroup = QT_TR_NOOP("Sketcher"); sMenuText = QT_TR_NOOP("Increase degree"); - sToolTipText = QT_TR_NOOP("Increases the degree of the B-Spline"); + sToolTipText = QT_TR_NOOP("Increases the degree of the B-spline"); sWhatsThis = "Sketcher_BSplineIncreaseDegree"; sStatusTip = sToolTipText; sPixmap = "Sketcher_BSplineIncreaseDegree"; @@ -416,7 +416,7 @@ void CmdSketcherIncreaseDegree::activated(int iMsg) const std::vector &SubNames = selection[0].getSubNames(); Sketcher::SketchObject* Obj = static_cast(selection[0].getObject()); - openCommand("IncreaseBSplineDegree"); + openCommand("Increase degree"); for (unsigned int i=0; igetNameInDocument(), GeoId); @@ -781,7 +781,7 @@ void CmdSketcherRestoreInternalAlignmentGeometry::activated(int iMsg) if(aftergeoid == currentgeoid) { // if we did not expose anything, deleteunused Gui::Command::doCommand(Gui::Command::Doc, - "App.ActiveDocument.%s.DeleteUnusedInternalGeometry(%d)", + "App.ActiveDocument.%s.deleteUnusedInternalGeometry(%d)", Obj->getNameInDocument(), GeoId); } diff --git a/src/Mod/Sketcher/Gui/Workbench.cpp b/src/Mod/Sketcher/Gui/Workbench.cpp index 1b47fcf35f..40513ab59e 100644 --- a/src/Mod/Sketcher/Gui/Workbench.cpp +++ b/src/Mod/Sketcher/Gui/Workbench.cpp @@ -81,7 +81,7 @@ Gui::MenuItem* Workbench::setupMenuBar() const addSketcherWorkbenchTools(*consaccel); Gui::MenuItem* bsplines = new Gui::MenuItem(); - bsplines->setCommand("Sketcher B-Spline tools"); + bsplines->setCommand("Sketcher B-spline tools"); addSketcherWorkbenchBSplines(*bsplines); addSketcherWorkbenchSketchActions( *sketch ); @@ -114,7 +114,7 @@ Gui::ToolBarItem* Workbench::setupToolBars() const addSketcherWorkbenchTools( *consaccel ); Gui::ToolBarItem* bspline = new Gui::ToolBarItem(root); - bspline->setCommand("Sketcher B-Spline tools"); + bspline->setCommand("Sketcher B-spline tools"); addSketcherWorkbenchBSplines( *bspline ); return root; @@ -324,9 +324,11 @@ inline void Sketcher_addWorkbenchSketchActions(T& sketch){ void addSketcherWorkbenchConstraints( Gui::MenuItem& cons ){ SketcherAddWorkbenchConstraints( cons ); } + void addSketcherWorkbenchTools( Gui::MenuItem& consaccel ){ SketcherAddWorkbenchTools( consaccel ); } + void addSketcherWorkbenchBSplines( Gui::MenuItem& bspline ){ SketcherAddWorkbenchBSplines( bspline ); }