#include <cmath>
void SketchSolver_ConstraintMultiRotation::getAttributes(
- EntityWrapperPtr& theCenter, EntityWrapperPtr& theAngle,
+ EntityWrapperPtr& theCenter, ScalarWrapperPtr& theAngle,
bool& theFullValue, std::list<EntityWrapperPtr>& theEntities)
{
AttributePtr anAngleAttr = myBaseConstraint->attribute(SketchPlugin_MultiRotation::ANGLE_ID());
PlaneGCSSolver_AttributeBuilder aValueBuilder;
- theAngle = aValueBuilder.createAttribute(anAngleAttr);
+ theAngle = std::dynamic_pointer_cast<PlaneGCSSolver_ScalarWrapper>(
+ aValueBuilder.createAttribute(anAngleAttr));
myStorage->addEntity(anAngleAttr, theAngle);
AttributeRefAttrPtr aCenterAttr =
return;
}
- EntityWrapperPtr anAngle;
EntityWrapperPtr aRotationCenter;
std::list<EntityWrapperPtr> aBaseEntities;
- getAttributes(aRotationCenter, anAngle, myIsFullValue, aBaseEntities);
+ getAttributes(aRotationCenter, myAngle, myIsFullValue, aBaseEntities);
if (!myErrorMsg.empty())
return;
- ScalarWrapperPtr anAngleVal = std::dynamic_pointer_cast<PlaneGCSSolver_ScalarWrapper>(anAngle);
- myAngle = anAngleVal->value();
myAdjusted = false;
adjustConstraint();
void SketchSolver_ConstraintMultiRotation::updateLocal()
{
double aValue = myBaseConstraint->real(SketchPlugin_MultiRotation::ANGLE_ID())->value();
- if (fabs(myAngle - aValue) > tolerance)
+ if (fabs(myAngle->value() - aValue) > tolerance)
myAdjusted = false;
// update angle value
- myAngle = aValue;
+ myAngle->setValue(aValue);
// update center
DataPtr aData = myBaseConstraint->data();
if (myAdjusted)
return;
- if (fabs(myAngle) < tolerance) {
+ double anAngleValue = myAngle->value();
+ if (fabs(anAngleValue) < tolerance) {
myStorage->setNeedToResolve(false);
return;
}
myCenterCoord[0] = *(aCenterPoint->x);
myCenterCoord[1] = *(aCenterPoint->y);
- double anAngleValue = myAngle;
if (myIsFullValue && myNumberOfCopies > 0)
anAngleValue /= myNumberOfCopies;
/// \param[out] theFullValue applying translation using the disstance as a full or single value
/// \param[out] theEntities list of base entities
void getAttributes(EntityWrapperPtr& theCenter,
- EntityWrapperPtr& theAngle,
+ ScalarWrapperPtr& theAngle,
bool& theFullValue,
std::list<EntityWrapperPtr>& theEntities);
private:
AttributePoint2DPtr myCenterPointAttribute; ///< a center of rotation
- double myAngle; ///< angle of rotation
+ ScalarWrapperPtr myAngle; ///< angle of rotation
double myCenterCoord[2]; ///< coordinates of rotation center
double myRotationVal[2]; ///< sinus and cosine of rotation angle