From: nds Date: Wed, 29 Oct 2014 11:44:29 +0000 (+0300) Subject: #refs 156 - Behavior of the Sketch during edition X-Git-Tag: V_0.5~67 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=c090c28c1f1190a992e62baefeb01fd8873fb51c;p=modules%2Fshaper.git #refs 156 - Behavior of the Sketch during edition move() method implementation in GeomDataAPI_Point2D --- diff --git a/src/GeomDataAPI/GeomDataAPI_Point2D.h b/src/GeomDataAPI/GeomDataAPI_Point2D.h index 6189e87d2..c0eb001cf 100644 --- a/src/GeomDataAPI/GeomDataAPI_Point2D.h +++ b/src/GeomDataAPI/GeomDataAPI_Point2D.h @@ -30,6 +30,13 @@ class GeomDataAPI_Point2D : public ModelAPI_Attribute /// Returns the 2D point virtual boost::shared_ptr 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() { diff --git a/src/SketchPlugin/SketchPlugin_Arc.cpp b/src/SketchPlugin/SketchPlugin_Arc.cpp index ec9d227de..34e46fc5a 100644 --- a/src/SketchPlugin/SketchPlugin_Arc.cpp +++ b/src/SketchPlugin/SketchPlugin_Arc.cpp @@ -108,15 +108,15 @@ void SketchPlugin_Arc::move(double theDeltaX, double theDeltaY) boost::shared_ptr aPoint1 = boost::dynamic_pointer_cast( aData->attribute(SketchPlugin_Arc::CENTER_ID())); - aPoint1->setValue(aPoint1->x() + theDeltaX, aPoint1->y() + theDeltaY); + aPoint1->move(theDeltaX, theDeltaY); boost::shared_ptr aPoint2 = boost::dynamic_pointer_cast( aData->attribute(SketchPlugin_Arc::START_ID())); - aPoint2->setValue(aPoint2->x() + theDeltaX, aPoint2->y() + theDeltaY); + aPoint2->move(theDeltaX, theDeltaY); boost::shared_ptr aPoint3 = boost::dynamic_pointer_cast( 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& thePoint) diff --git a/src/SketchPlugin/SketchPlugin_Circle.cpp b/src/SketchPlugin/SketchPlugin_Circle.cpp index 4828a0f7b..860368b51 100644 --- a/src/SketchPlugin/SketchPlugin_Circle.cpp +++ b/src/SketchPlugin/SketchPlugin_Circle.cpp @@ -91,7 +91,7 @@ void SketchPlugin_Circle::move(double theDeltaX, double theDeltaY) boost::shared_ptr aPoint1 = boost::dynamic_pointer_cast( 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& thePoint) diff --git a/src/SketchPlugin/SketchPlugin_ConstraintDistance.cpp b/src/SketchPlugin/SketchPlugin_ConstraintDistance.cpp index 65c6cf9ce..90e1a2437 100644 --- a/src/SketchPlugin/SketchPlugin_ConstraintDistance.cpp +++ b/src/SketchPlugin/SketchPlugin_ConstraintDistance.cpp @@ -143,9 +143,9 @@ void SketchPlugin_ConstraintDistance::move(double theDeltaX, double theDeltaY) if (!aData->isValid()) return; - boost::shared_ptr aPoint1 = boost::dynamic_pointer_cast( + boost::shared_ptr aPoint = boost::dynamic_pointer_cast( aData->attribute(SketchPlugin_Constraint::FLYOUT_VALUE_PNT())); - aPoint1->setValue(aPoint1->x() + theDeltaX, aPoint1->y() + theDeltaY); + aPoint->setValue(theDeltaX, theDeltaY); } //************************************************************************************* diff --git a/src/SketchPlugin/SketchPlugin_ConstraintLength.cpp b/src/SketchPlugin/SketchPlugin_ConstraintLength.cpp index 00061c739..ff8a480b4 100644 --- a/src/SketchPlugin/SketchPlugin_ConstraintLength.cpp +++ b/src/SketchPlugin/SketchPlugin_ConstraintLength.cpp @@ -110,8 +110,8 @@ void SketchPlugin_ConstraintLength::move(double theDeltaX, double theDeltaY) if (!aData->isValid()) return; - boost::shared_ptr aPoint1 = boost::dynamic_pointer_cast( + boost::shared_ptr aPoint = boost::dynamic_pointer_cast( aData->attribute(SketchPlugin_Constraint::FLYOUT_VALUE_PNT())); - aPoint1->setValue(aPoint1->x() + theDeltaX, aPoint1->y() + theDeltaY); + aPoint->move(theDeltaX, theDeltaY); } diff --git a/src/SketchPlugin/SketchPlugin_ConstraintParallel.cpp b/src/SketchPlugin/SketchPlugin_ConstraintParallel.cpp index 056eda939..ae105caa3 100644 --- a/src/SketchPlugin/SketchPlugin_ConstraintParallel.cpp +++ b/src/SketchPlugin/SketchPlugin_ConstraintParallel.cpp @@ -98,6 +98,6 @@ void SketchPlugin_ConstraintParallel::move(double theDeltaX, double theDeltaY) boost::shared_ptr aPoint = boost::dynamic_pointer_cast( aData->attribute(SketchPlugin_Constraint::FLYOUT_VALUE_PNT())); - aPoint->setValue(aPoint->x() + theDeltaX, aPoint->y() + theDeltaY); + aPoint->move(theDeltaX, theDeltaY); } diff --git a/src/SketchPlugin/SketchPlugin_Line.cpp b/src/SketchPlugin/SketchPlugin_Line.cpp index 72a20f861..bdb608e6d 100644 --- a/src/SketchPlugin/SketchPlugin_Line.cpp +++ b/src/SketchPlugin/SketchPlugin_Line.cpp @@ -64,11 +64,11 @@ void SketchPlugin_Line::move(double theDeltaX, double theDeltaY) boost::shared_ptr aPoint1 = boost::dynamic_pointer_cast( aData->attribute(SketchPlugin_Line::START_ID())); - aPoint1->setValue(aPoint1->x() + theDeltaX, aPoint1->y() + theDeltaY); + aPoint1->move(theDeltaX, theDeltaY); boost::shared_ptr aPoint2 = boost::dynamic_pointer_cast( 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& thePoint) diff --git a/src/SketchPlugin/SketchPlugin_Point.cpp b/src/SketchPlugin/SketchPlugin_Point.cpp index c198e9b90..a905d8486 100644 --- a/src/SketchPlugin/SketchPlugin_Point.cpp +++ b/src/SketchPlugin/SketchPlugin_Point.cpp @@ -54,7 +54,7 @@ void SketchPlugin_Point::move(double theDeltaX, double theDeltaY) boost::shared_ptr aPoint1 = boost::dynamic_pointer_cast( 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& thePoint)