X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FSketchSolver%2FPlaneGCSSolver%2FPlaneGCSSolver_ScalarWrapper.cpp;fp=src%2FSketchSolver%2FPlaneGCSSolver%2FPlaneGCSSolver_ScalarWrapper.cpp;h=399b37531a88487e34ab413c6c40c13a80a23952;hb=52b602cebc1184e09d86608510b0f14aff5d1d4b;hp=dc6d72ff391897d05cf5a1b7046995baf0cc2101;hpb=7b9662e1e63565ccfb95255f2b154d53357d091e;p=modules%2Fshaper.git diff --git a/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_ScalarWrapper.cpp b/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_ScalarWrapper.cpp index dc6d72ff3..399b37531 100644 --- a/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_ScalarWrapper.cpp +++ b/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_ScalarWrapper.cpp @@ -18,6 +18,10 @@ // #include +#include + +#include +#include PlaneGCSSolver_ScalarWrapper::PlaneGCSSolver_ScalarWrapper(double *const theParam) : myValue(theParam) @@ -33,3 +37,29 @@ double PlaneGCSSolver_ScalarWrapper::value() const { return *myValue; } + +bool PlaneGCSSolver_ScalarWrapper::update(AttributePtr theAttribute) +{ + double anAttrValue = 0.0; + AttributeDoublePtr aDouble = + std::dynamic_pointer_cast(theAttribute); + if (aDouble) + anAttrValue = aDouble->value(); + else { + AttributeIntegerPtr anInt = + std::dynamic_pointer_cast(theAttribute); + if (anInt) + anAttrValue = anInt->value(); + else + return false; + } + + // There is possible an angular value, which is converted between degrees and radians. + // So, we use its value instead of using direct pointer to variable. + double aCurrentValue = value(); + + bool isUpdated = PlaneGCSSolver_Tools::updateValue(anAttrValue, aCurrentValue); + if (isUpdated) + setValue(aCurrentValue); + return isUpdated; +}