/// Returns the 2D point
virtual boost::shared_ptr<GeomAPI_Pnt2d> pnt() = 0;
+ /// Appends the delta values to point
+ void move(const double theDeltaX, const double theDeltaY)
+ {
+ setValue(x() + theDeltaX, y() + theDeltaY);
+ }
+
+
/// Returns the type of this class of attributes
static inline std::string type()
{
boost::shared_ptr<GeomDataAPI_Point2D> aPoint1 = boost::dynamic_pointer_cast<GeomDataAPI_Point2D>(
aData->attribute(SketchPlugin_Arc::CENTER_ID()));
- aPoint1->setValue(aPoint1->x() + theDeltaX, aPoint1->y() + theDeltaY);
+ aPoint1->move(theDeltaX, theDeltaY);
boost::shared_ptr<GeomDataAPI_Point2D> aPoint2 = boost::dynamic_pointer_cast<GeomDataAPI_Point2D>(
aData->attribute(SketchPlugin_Arc::START_ID()));
- aPoint2->setValue(aPoint2->x() + theDeltaX, aPoint2->y() + theDeltaY);
+ aPoint2->move(theDeltaX, theDeltaY);
boost::shared_ptr<GeomDataAPI_Point2D> aPoint3 = boost::dynamic_pointer_cast<GeomDataAPI_Point2D>(
aData->attribute(SketchPlugin_Arc::END_ID()));
- aPoint3->setValue(aPoint3->x() + theDeltaX, aPoint3->y() + theDeltaY);
+ aPoint3->move(theDeltaX, theDeltaY);
}
double SketchPlugin_Arc::distanceToPoint(const boost::shared_ptr<GeomAPI_Pnt2d>& thePoint)
boost::shared_ptr<GeomDataAPI_Point2D> aPoint1 = boost::dynamic_pointer_cast<GeomDataAPI_Point2D>(
aData->attribute(SketchPlugin_Circle::CENTER_ID()));
- aPoint1->setValue(aPoint1->x() + theDeltaX, aPoint1->y() + theDeltaY);
+ aPoint1->move(theDeltaX, theDeltaY);
}
double SketchPlugin_Circle::distanceToPoint(const boost::shared_ptr<GeomAPI_Pnt2d>& thePoint)
if (!aData->isValid())
return;
- boost::shared_ptr<GeomDataAPI_Point2D> aPoint1 = boost::dynamic_pointer_cast<GeomDataAPI_Point2D>(
+ boost::shared_ptr<GeomDataAPI_Point2D> aPoint = boost::dynamic_pointer_cast<GeomDataAPI_Point2D>(
aData->attribute(SketchPlugin_Constraint::FLYOUT_VALUE_PNT()));
- aPoint1->setValue(aPoint1->x() + theDeltaX, aPoint1->y() + theDeltaY);
+ aPoint->setValue(theDeltaX, theDeltaY);
}
//*************************************************************************************
if (!aData->isValid())
return;
- boost::shared_ptr<GeomDataAPI_Point2D> aPoint1 = boost::dynamic_pointer_cast<GeomDataAPI_Point2D>(
+ boost::shared_ptr<GeomDataAPI_Point2D> aPoint = boost::dynamic_pointer_cast<GeomDataAPI_Point2D>(
aData->attribute(SketchPlugin_Constraint::FLYOUT_VALUE_PNT()));
- aPoint1->setValue(aPoint1->x() + theDeltaX, aPoint1->y() + theDeltaY);
+ aPoint->move(theDeltaX, theDeltaY);
}
boost::shared_ptr<GeomDataAPI_Point2D> aPoint = boost::dynamic_pointer_cast<GeomDataAPI_Point2D>(
aData->attribute(SketchPlugin_Constraint::FLYOUT_VALUE_PNT()));
- aPoint->setValue(aPoint->x() + theDeltaX, aPoint->y() + theDeltaY);
+ aPoint->move(theDeltaX, theDeltaY);
}
boost::shared_ptr<GeomDataAPI_Point2D> aPoint1 = boost::dynamic_pointer_cast<GeomDataAPI_Point2D>(
aData->attribute(SketchPlugin_Line::START_ID()));
- aPoint1->setValue(aPoint1->x() + theDeltaX, aPoint1->y() + theDeltaY);
+ aPoint1->move(theDeltaX, theDeltaY);
boost::shared_ptr<GeomDataAPI_Point2D> aPoint2 = boost::dynamic_pointer_cast<GeomDataAPI_Point2D>(
aData->attribute(SketchPlugin_Line::END_ID()));
- aPoint2->setValue(aPoint2->x() + theDeltaX, aPoint2->y() + theDeltaY);
+ aPoint2->move(theDeltaX, theDeltaY);
}
double SketchPlugin_Line::distanceToPoint(const boost::shared_ptr<GeomAPI_Pnt2d>& thePoint)
boost::shared_ptr<GeomDataAPI_Point2D> aPoint1 = boost::dynamic_pointer_cast<GeomDataAPI_Point2D>(
aData->attribute(SketchPlugin_Point::COORD_ID()));
- aPoint1->setValue(aPoint1->x() + theDeltaX, aPoint1->y() + theDeltaY);
+ aPoint1->move(theDeltaX, theDeltaY);
}
double SketchPlugin_Point::distanceToPoint(const boost::shared_ptr<GeomAPI_Pnt2d>& thePoint)