Salome HOME
Merge branch 'master' of newgeom:newgeom
authornds <natalia.donis@opencascade.com>
Wed, 29 Oct 2014 11:46:27 +0000 (14:46 +0300)
committernds <natalia.donis@opencascade.com>
Wed, 29 Oct 2014 11:46:27 +0000 (14:46 +0300)
src/GeomDataAPI/GeomDataAPI_Point2D.h
src/SketchPlugin/SketchPlugin_Arc.cpp
src/SketchPlugin/SketchPlugin_Circle.cpp
src/SketchPlugin/SketchPlugin_ConstraintDistance.cpp
src/SketchPlugin/SketchPlugin_ConstraintLength.cpp
src/SketchPlugin/SketchPlugin_ConstraintParallel.cpp
src/SketchPlugin/SketchPlugin_Line.cpp
src/SketchPlugin/SketchPlugin_Point.cpp

index 6189e87d21ab221a2945c6fe792b37064e1f664e..c0eb001cfbbafe1a24dae931ac524364ca01b32e 100644 (file)
@@ -30,6 +30,13 @@ class GeomDataAPI_Point2D : public ModelAPI_Attribute
   /// 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()
   {
index ae0b225ecb25e93cf741d734f4555bffa62c44ee..d9afa4fa9d9a619a485c962c85106e53b2e23a72 100644 (file)
@@ -109,15 +109,15 @@ void SketchPlugin_Arc::move(double theDeltaX, double theDeltaY)
 
   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)
index e4d9d8e94411e5185246105a54ee92cf61a1a975..992fc321d58d504e5cbe0b916e64c0ff2256a230 100644 (file)
@@ -92,7 +92,7 @@ void SketchPlugin_Circle::move(double theDeltaX, double theDeltaY)
 
   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)
index 65c6cf9cee8a0fdb5e2b5f7d5bbb245bc45a6933..90e1a2437e5fcf7733e46e0096e2189320a54ef7 100644 (file)
@@ -143,9 +143,9 @@ void SketchPlugin_ConstraintDistance::move(double theDeltaX, double 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->setValue(theDeltaX, theDeltaY);
 }
 
 //*************************************************************************************
index 00061c7390de1321b522f79522dd83e368e71d06..ff8a480b46ea314aad8fe37a1e8d0a78d7a5e0a8 100644 (file)
@@ -110,8 +110,8 @@ void SketchPlugin_ConstraintLength::move(double theDeltaX, double 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);
 }
 
index 056eda9396ea1ef111796055c762de7e6a46a3a0..ae105caa331fbe7a061c60c441a24d19bda6aaa1 100644 (file)
@@ -98,6 +98,6 @@ void SketchPlugin_ConstraintParallel::move(double theDeltaX, double 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);
 }
 
index ccefb4bec3aba9a144313b2a8842b55e11629a54..dac4222679edb0f0193182709f9b132bfc74d247 100644 (file)
@@ -65,11 +65,11 @@ void SketchPlugin_Line::move(double theDeltaX, double 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)
index 1ad78684f8ab806ea8676054956b1083aac3aa47..7cbdb647cc521533ec783ba3a192e52553b1b1d6 100644 (file)
@@ -55,7 +55,7 @@ void SketchPlugin_Point::move(double theDeltaX, double theDeltaY)
 
   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)