X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FModuleBase%2FModuleBase_WidgetPoint2dDistance.cpp;h=56496ebd15cdf0a6eab3b59e8fde136562a33f1c;hb=7981678231adaa3ef7468d7564fef427cffdaf50;hp=303d4508e07d04c6cf45b8cf8872ac837204c9ad;hpb=0c89bf75254d86feded0577ac60d0b8c5c4949e3;p=modules%2Fshaper.git diff --git a/src/ModuleBase/ModuleBase_WidgetPoint2dDistance.cpp b/src/ModuleBase/ModuleBase_WidgetPoint2dDistance.cpp index 303d4508e..56496ebd1 100644 --- a/src/ModuleBase/ModuleBase_WidgetPoint2dDistance.cpp +++ b/src/ModuleBase/ModuleBase_WidgetPoint2dDistance.cpp @@ -2,8 +2,9 @@ // Created: 23 June 2014 // Author: Vitaly Smetannikov -#include "ModuleBase_WidgetPoint2dDistance.h" -#include "ModuleBase_WidgetValueFeature.h" +#include +#include +#include #include #include @@ -12,10 +13,10 @@ #include #include -#include - -ModuleBase_WidgetPoint2dDistance::ModuleBase_WidgetPoint2dDistance(QWidget* theParent, const Config_WidgetAPI* theData) - : ModuleBase_WidgetDoubleValue(theParent, theData) +ModuleBase_WidgetPoint2dDistance::ModuleBase_WidgetPoint2dDistance(QWidget* theParent, + const Config_WidgetAPI* theData, + const std::string& theParentId) + : ModuleBase_WidgetDoubleValue(theParent, theData, theParentId) { myFirstPntName = theData->getProperty("first_point"); } @@ -29,11 +30,12 @@ bool ModuleBase_WidgetPoint2dDistance::setValue(ModuleBase_WidgetValue* theValue bool isDone = false; if (theValue) { - ModuleBase_WidgetValueFeature* aFeatureValue = - dynamic_cast(theValue); + ModuleBase_WidgetValueFeature* aFeatureValue = + dynamic_cast(theValue); if (aFeatureValue) { boost::shared_ptr aPnt = aFeatureValue->point(); - FeaturePtr aFeature = aFeatureValue->feature(); + ObjectPtr aObject = aFeatureValue->object(); + FeaturePtr aFeature = boost::dynamic_pointer_cast(aObject); if (aFeature && aPnt) { setPoint(aFeature, aPnt); isDone = true; @@ -43,12 +45,14 @@ bool ModuleBase_WidgetPoint2dDistance::setValue(ModuleBase_WidgetValue* theValue return isDone; } -void ModuleBase_WidgetPoint2dDistance::setPoint(FeaturePtr theFeature, const boost::shared_ptr& thePnt) +void ModuleBase_WidgetPoint2dDistance::setPoint(FeaturePtr theFeature, + const boost::shared_ptr& thePnt) { boost::shared_ptr aData = theFeature->data(); - boost::shared_ptr aPoint = boost::dynamic_pointer_cast - (aData->attribute(myFirstPntName)); - if (!aPoint) return; + boost::shared_ptr aPoint = boost::dynamic_pointer_cast( + aData->attribute(myFirstPntName)); + if (!aPoint) + return; double aRadius = thePnt->distance(aPoint->pnt()); AttributeDoublePtr aReal = aData->real(attributeID()); @@ -56,4 +60,4 @@ void ModuleBase_WidgetPoint2dDistance::setPoint(FeaturePtr theFeature, const boo aReal->setValue(aRadius); mySpinBox->setValue(aRadius); } -} \ No newline at end of file +}