+void SketchPlugin_ConstraintRadius::move(double theDeltaX, double theDeltaY)
+{
+ boost::shared_ptr<ModelAPI_Data> aData = data();
+ if (!aData->isValid())
+ return;
+
+ boost::shared_ptr<ModelAPI_AttributeRefAttr> aRef = boost::dynamic_pointer_cast<
+ ModelAPI_AttributeRefAttr>(data()->attribute(SketchPlugin_Constraint::ENTITY_A()));
+ FeaturePtr aFeature = ModelAPI_Feature::feature(aRef->object());
+ if (!aFeature)
+ return;
+ std::string aCenterAttrName;
+ if (aFeature->getKind() == SketchPlugin_Circle::ID())
+ aCenterAttrName = SketchPlugin_Circle::CENTER_ID();
+ else if (aFeature->getKind() == SketchPlugin_Arc::ID())
+ aCenterAttrName = SketchPlugin_Arc::CENTER_ID();
+ boost::shared_ptr<GeomDataAPI_Point2D> aCenterAttr = boost::dynamic_pointer_cast<
+ GeomDataAPI_Point2D>(aFeature->data()->attribute(aCenterAttrName));
+ boost::shared_ptr<GeomAPI_Pnt2d> aCenter = aCenterAttr->pnt();
+
+ // The specified delta applied on the circle curve,
+ // so it will be scaled due to distance between flyout and center points
+ boost::shared_ptr<GeomDataAPI_Point2D> aFlyoutAttr = boost::dynamic_pointer_cast<
+ GeomDataAPI_Point2D>(aData->attribute(SketchPlugin_Constraint::FLYOUT_VALUE_PNT()));
+ boost::shared_ptr<GeomAPI_Pnt2d> aFlyout = aFlyoutAttr->pnt();
+
+ boost::shared_ptr<ModelAPI_AttributeDouble> aRadius = boost::dynamic_pointer_cast<
+ ModelAPI_AttributeDouble>(aData->attribute(SketchPlugin_Constraint::VALUE()));
+ double aScale = aFlyout->distance(aCenter) / aRadius->value();
+
+ boost::shared_ptr<GeomAPI_Circ2d> aCircle(new GeomAPI_Circ2d(aCenter, aFlyout));
+ aFlyout->setX(aFlyout->x() + aScale * theDeltaX);
+ aFlyout->setY(aFlyout->y() + aScale * theDeltaY);
+ aFlyout = aCircle->project(aFlyout);
+
+ aFlyoutAttr->setValue(aFlyout->x(), aFlyout->y());
+}