From fa29bfa66723af5587fba8cb27b7f71f045f04f2 Mon Sep 17 00:00:00 2001 From: Alexander Golubev Date: Wed, 9 Sep 2015 09:56:27 +0300 Subject: [PATCH] PartDesign/ViewProviderDatum: minor enhancements - added defaultSize constant - fixed typo in margin{g,}Factor function name --- src/Mod/PartDesign/Gui/ViewProviderDatum.cpp | 7 +++++-- src/Mod/PartDesign/Gui/ViewProviderDatum.h | 5 ++++- src/Mod/PartDesign/Gui/ViewProviderDatumLine.cpp | 2 +- src/Mod/PartDesign/Gui/ViewProviderDatumPlane.cpp | 2 +- 4 files changed, 11 insertions(+), 5 deletions(-) diff --git a/src/Mod/PartDesign/Gui/ViewProviderDatum.cpp b/src/Mod/PartDesign/Gui/ViewProviderDatum.cpp index 2fb6a4504..0d7d7d4fe 100644 --- a/src/Mod/PartDesign/Gui/ViewProviderDatum.cpp +++ b/src/Mod/PartDesign/Gui/ViewProviderDatum.cpp @@ -78,6 +78,9 @@ using namespace PartDesignGui; PROPERTY_SOURCE(PartDesignGui::ViewProviderDatum,Gui::ViewProviderGeometryObject) +// static data +const double ViewProviderDatum::defaultSize = Gui::ViewProviderOrigin::defaultSize (); + ViewProviderDatum::ViewProviderDatum() { pShapeSep = new SoSeparator(); @@ -382,6 +385,6 @@ SbBox3f ViewProviderDatum::getRelevantBoundBox ( } SbBox3f ViewProviderDatum::defaultBoundBox () { - double defSz = Gui::ViewProviderOrigin::defaultSize (); - return SbBox3f ( -defSz, -defSz, -defSz, defSz, defSz, defSz ); + return SbBox3f ( -defaultSize, -defaultSize, -defaultSize, + defaultSize, defaultSize, defaultSize ); } diff --git a/src/Mod/PartDesign/Gui/ViewProviderDatum.h b/src/Mod/PartDesign/Gui/ViewProviderDatum.h index fc8f2bbe3..863c25f61 100644 --- a/src/Mod/PartDesign/Gui/ViewProviderDatum.h +++ b/src/Mod/PartDesign/Gui/ViewProviderDatum.h @@ -87,11 +87,14 @@ public: SoGetBoundingBoxAction &bboxAction, const std::vector &objs); + /// Default size used to produce the default bbox + static const double defaultSize; + // Returnd default bounding box if relevant is can't be used for some reason static SbBox3f defaultBoundBox (); // Returns a default marging factor (part of size ) - static double margingFactor () { return 0.1; }; + static double marginFactor () { return 0.1; }; protected: virtual bool setEdit(int ModNum); diff --git a/src/Mod/PartDesign/Gui/ViewProviderDatumLine.cpp b/src/Mod/PartDesign/Gui/ViewProviderDatumLine.cpp index 717b02a9f..c1bfb3da3 100644 --- a/src/Mod/PartDesign/Gui/ViewProviderDatumLine.cpp +++ b/src/Mod/PartDesign/Gui/ViewProviderDatumLine.cpp @@ -87,7 +87,7 @@ void ViewProviderDatumLine::setExtents (Base::BoundBox3d bbox) { // Add origin of the line to the box if it's not bbox.Add ( Base::Vector3d (0, 0, 0) ); - double marging = bbox.LengthZ () * margingFactor (); + double marging = bbox.LengthZ () * marginFactor (); // Display the line pCoords->point.setNum (2); diff --git a/src/Mod/PartDesign/Gui/ViewProviderDatumPlane.cpp b/src/Mod/PartDesign/Gui/ViewProviderDatumPlane.cpp index 26f3c5a8a..2e3263f3f 100644 --- a/src/Mod/PartDesign/Gui/ViewProviderDatumPlane.cpp +++ b/src/Mod/PartDesign/Gui/ViewProviderDatumPlane.cpp @@ -109,7 +109,7 @@ void ViewProviderDatumPlane::setExtents (Base::BoundBox3d bbox) { // Add origin of the plane to the box if it's not bbox.Add ( Base::Vector3d (0, 0, 0) ); - double marging = sqrt(bbox.LengthX ()*bbox.LengthY ()) * margingFactor (); + double marging = sqrt(bbox.LengthX ()*bbox.LengthY ()) * marginFactor (); // Change the coordinates of the line pCoords->point.setNum (4);