]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
refs #80 - Sketch base GUI: create/draw point, circle and arc
authornds <natalia.donis@opencascade.com>
Mon, 23 Jun 2014 14:14:11 +0000 (18:14 +0400)
committernds <natalia.donis@opencascade.com>
Mon, 23 Jun 2014 14:14:11 +0000 (18:14 +0400)
The PartSet presentation's functionality should be partially moved to SketchPlugin and a custom widget creation.
1. feature move() method is moved to the sketch plugin feature.

30 files changed:
src/PartSet/PartSet_ConstraintDistancePrs.cpp
src/PartSet/PartSet_ConstraintDistancePrs.h
src/PartSet/PartSet_ConstraintLengthPrs.cpp
src/PartSet/PartSet_ConstraintLengthPrs.h
src/PartSet/PartSet_ConstraintRadiusPrs.cpp
src/PartSet/PartSet_ConstraintRadiusPrs.h
src/PartSet/PartSet_FeatureArcPrs.cpp
src/PartSet/PartSet_FeatureArcPrs.h
src/PartSet/PartSet_FeatureCirclePrs.cpp
src/PartSet/PartSet_FeatureCirclePrs.h
src/PartSet/PartSet_FeatureLinePrs.cpp
src/PartSet/PartSet_FeatureLinePrs.h
src/PartSet/PartSet_FeaturePointPrs.cpp
src/PartSet/PartSet_FeaturePointPrs.h
src/PartSet/PartSet_FeaturePrs.h
src/PartSet/PartSet_OperationEditConstraint.cpp
src/PartSet/PartSet_OperationEditFeature.cpp
src/PartSet/PartSet_Tools.cpp
src/PartSet/PartSet_Tools.h
src/SketchPlugin/SketchPlugin_Arc.cpp
src/SketchPlugin/SketchPlugin_Arc.h
src/SketchPlugin/SketchPlugin_Circle.cpp
src/SketchPlugin/SketchPlugin_Circle.h
src/SketchPlugin/SketchPlugin_Constraint.h
src/SketchPlugin/SketchPlugin_Feature.h
src/SketchPlugin/SketchPlugin_Line.cpp
src/SketchPlugin/SketchPlugin_Line.h
src/SketchPlugin/SketchPlugin_Point.cpp
src/SketchPlugin/SketchPlugin_Point.h
src/SketchPlugin/SketchPlugin_Sketch.h

index 809ea8c3c7f3ca0fb26d96d74e5e2d2b444b77f6..586a952465b52b1da93656eb4e1b57e99d1aee09 100644 (file)
@@ -206,10 +206,6 @@ PartSet_SelectionMode PartSet_ConstraintDistancePrs::getNextMode(const std::stri
   return SM_FirstPoint;
 }
 
-void PartSet_ConstraintDistancePrs::move(double theDeltaX, double theDeltaY)
-{
-}
-
 double PartSet_ConstraintDistancePrs::distanceToPoint(FeaturePtr theFeature,
                                                  double theX, double theY)
 {
index 7bac945e60c69720eb956e66bd1d0d8628446228..717d704a866b1bbced893fee21406a5143c207cd 100644 (file)
@@ -64,11 +64,6 @@ public:
   /// \return next attribute selection mode
   virtual PartSet_SelectionMode getNextMode(const std::string& theAttribute) const;
 
-  /// \brief Move the full feature.
-  /// \param theDeltaX the delta for X coordinate is moved
-  /// \param theDeltaY the delta for Y coordinate is moved
-  virtual void move(double theDeltaX, double theDeltaY);
-
   /// Return the distance between the feature and the point
   /// \param theFeature feature object
   /// \param theX the horizontal coordinate of the point
index a594bc6d30af287de0ac700ce1ab97e5176fdad7..16aecb5f853130a971476395ee9fc9f981cf1a81 100644 (file)
@@ -204,10 +204,6 @@ PartSet_SelectionMode PartSet_ConstraintLengthPrs::getNextMode(const std::string
   return SM_FirstPoint;
 }
 
-void PartSet_ConstraintLengthPrs::move(double theDeltaX, double theDeltaY)
-{
-}
-
 double PartSet_ConstraintLengthPrs::distanceToPoint(FeaturePtr theFeature,
                                                  double theX, double theY)
 {
index 69fef784858b40247e71cc6687d985945463b88a..a29465de3ce98744421906f7afd2f6b9f2c7182e 100644 (file)
@@ -64,11 +64,6 @@ public:
   /// \return next attribute selection mode
   virtual PartSet_SelectionMode getNextMode(const std::string& theAttribute) const;
 
-  /// \brief Move the full feature.
-  /// \param theDeltaX the delta for X coordinate is moved
-  /// \param theDeltaY the delta for Y coordinate is moved
-  virtual void move(double theDeltaX, double theDeltaY);
-
   /// Return the distance between the feature and the point
   /// \param theFeature feature object
   /// \param theX the horizontal coordinate of the point
index 394ae38dc9ba80e0d622bedd081510efca66c3e3..305351ef22a393631debdab5a22d9c62fbe1c8e0 100644 (file)
@@ -243,10 +243,6 @@ PartSet_SelectionMode PartSet_ConstraintRadiusPrs::getNextMode(const std::string
   return SM_FirstPoint;
 }
 
-void PartSet_ConstraintRadiusPrs::move(double theDeltaX, double theDeltaY)
-{
-}
-
 double PartSet_ConstraintRadiusPrs::distanceToPoint(FeaturePtr theFeature,
                                                  double theX, double theY)
 {
index 9767c766f26f9492ac83a072903edf024ce0ed97..7f618795434417f99c8713158f46c0bd28d523e7 100644 (file)
@@ -67,11 +67,6 @@ public:
   /// \return next attribute selection mode
   virtual PartSet_SelectionMode getNextMode(const std::string& theAttribute) const;
 
-  /// \brief Move the full feature.
-  /// \param theDeltaX the delta for X coordinate is moved
-  /// \param theDeltaY the delta for Y coordinate is moved
-  virtual void move(double theDeltaX, double theDeltaY);
-
   /// Return the distance between the feature and the point
   /// \param theFeature feature object
   /// \param theX the horizontal coordinate of the point
index ea9692edc4eca2fba4a1135776293a38f1c26caa..56b671fe4632f8786831c0ef5a662128633a0183 100644 (file)
@@ -94,25 +94,6 @@ PartSet_SelectionMode PartSet_FeatureArcPrs::getNextMode(const std::string& theA
   return aMode;
 }
 
-void PartSet_FeatureArcPrs::move(double theDeltaX, double theDeltaY)
-{
-  boost::shared_ptr<ModelAPI_Data> aData = feature()->data();
-  if (!aData->isValid())
-    return;
-
-  boost::shared_ptr<GeomDataAPI_Point2D> aPoint1 =
-        boost::dynamic_pointer_cast<GeomDataAPI_Point2D>(aData->attribute(ARC_ATTR_CENTER));
-  aPoint1->setValue(aPoint1->x() + theDeltaX, aPoint1->y() + theDeltaY);
-
-  boost::shared_ptr<GeomDataAPI_Point2D> aPoint2 =
-        boost::dynamic_pointer_cast<GeomDataAPI_Point2D>(aData->attribute(ARC_ATTR_START));
-  aPoint2->setValue(aPoint2->x() + theDeltaX, aPoint2->y() + theDeltaY);
-
-  boost::shared_ptr<GeomDataAPI_Point2D> aPoint3 =
-        boost::dynamic_pointer_cast<GeomDataAPI_Point2D>(aData->attribute(ARC_ATTR_END));
-  aPoint3->setValue(aPoint3->x() + theDeltaX, aPoint3->y() + theDeltaY);
-}
-
 double PartSet_FeatureArcPrs::distanceToPoint(FeaturePtr theFeature,
                                                double theX, double theY)
 {
index 28d9ab66925a88ce22ff806d6ef2c950844a6ab4..2ebc17e7bf62836cfdca9bae9cd8af47b750132a 100644 (file)
@@ -61,11 +61,6 @@ public:
   static void projectPointOnFeature(FeaturePtr theFeature, FeaturePtr theSketch, gp_Pnt& thePoint,
                                     Handle_V3d_View theView, double& theX, double& theY);
 
-  /// \brief Move the full feature.
-  /// \param theDeltaX the delta for X coordinate is moved
-  /// \param theDeltaY the delta for Y coordinate is moved
-  virtual void move(double theDeltaX, double theDeltaY);
-
   /// Return the distance between the feature and the point
   /// \param theFeature feature object
   /// \param theX the horizontal coordinate of the point
index 70f957134c2d08e7cb86ec8260c9c2615fa7eb1b..1de3bb5e3e0f412953dca45a2272f47348c923ce 100644 (file)
@@ -92,17 +92,6 @@ PartSet_SelectionMode PartSet_FeatureCirclePrs::getNextMode(const std::string& t
   return aMode;
 }
 
-void PartSet_FeatureCirclePrs::move(double theDeltaX, double theDeltaY)
-{
-  boost::shared_ptr<ModelAPI_Data> aData = feature()->data();
-  if (!aData->isValid())
-    return;
-
-  boost::shared_ptr<GeomDataAPI_Point2D> aPoint1 =
-        boost::dynamic_pointer_cast<GeomDataAPI_Point2D>(aData->attribute(CIRCLE_ATTR_CENTER));
-  aPoint1->setValue(aPoint1->x() + theDeltaX, aPoint1->y() + theDeltaY);
-}
-
 double PartSet_FeatureCirclePrs::distanceToPoint(FeaturePtr theFeature,
                                                  double theX, double theY)
 {
index c3ec1c6673609c0ec5c858cab79586ad73706f12..dccead22532697f786225ad2ae165a08963f7a23 100644 (file)
@@ -51,11 +51,6 @@ public:
   /// \return next attribute selection mode
   virtual PartSet_SelectionMode getNextMode(const std::string& theAttribute) const;
 
-  /// \brief Move the full feature.
-  /// \param theDeltaX the delta for X coordinate is moved
-  /// \param theDeltaY the delta for Y coordinate is moved
-  virtual void move(double theDeltaX, double theDeltaY);
-
   /// Return the distance between the feature and the point
   /// \param theFeature feature object
   /// \param theX the horizontal coordinate of the point
index 17c51670171d1fe0b45755f5cda62442fa2bea6e..ac173167f1e4c0e50df38abc4cd98b5010ad31f7 100644 (file)
@@ -107,21 +107,6 @@ PartSet_SelectionMode PartSet_FeatureLinePrs::getNextMode(const std::string& the
   return aMode;
 }
 
-void PartSet_FeatureLinePrs::move(double theDeltaX, double theDeltaY)
-{
-  boost::shared_ptr<ModelAPI_Data> aData = feature()->data();
-  if (!aData->isValid())
-    return;
-
-  boost::shared_ptr<GeomDataAPI_Point2D> aPoint1 =
-        boost::dynamic_pointer_cast<GeomDataAPI_Point2D>(aData->attribute(LINE_ATTR_START));
-  aPoint1->setValue(aPoint1->x() + theDeltaX, aPoint1->y() + theDeltaY);
-
-  boost::shared_ptr<GeomDataAPI_Point2D> aPoint2 =
-        boost::dynamic_pointer_cast<GeomDataAPI_Point2D>(aData->attribute(LINE_ATTR_END));
-  aPoint2->setValue(aPoint2->x() + theDeltaX, aPoint2->y() + theDeltaY);
-}
-
 void PartSet_FeatureLinePrs::projectPointOnLine(FeaturePtr theFeature,
                                                 const PartSet_SelectionMode& theMode,
                                                 const gp_Pnt& thePoint, Handle(V3d_View) theView,
index 128c127459ad765bef44836b14ccf9f24ae7445e..13d973ec66fe1e68093aee50b1fbc2f1223b7a43 100644 (file)
@@ -58,11 +58,6 @@ public:
   /// \return next attribute selection mode
   virtual PartSet_SelectionMode getNextMode(const std::string& theAttribute) const;
 
-  /// \brief Move the full feature.
-  /// \param theDeltaX the delta for X coordinate is moved
-  /// \param theDeltaY the delta for Y coordinate is moved
-  virtual void move(double theDeltaX, double theDeltaY);
-
   /// Project the point on a feature
   /// \param theFeature the feature to be projected on
   /// \param theMode the selection mode
index df9c76bc9fdcfca4aa56bf1e0918765072fce28d..569c771e03475e638cbd9fa5f2aead9ae5022da7 100644 (file)
@@ -71,17 +71,6 @@ PartSet_SelectionMode PartSet_FeaturePointPrs::getNextMode(const std::string& th
   return aMode;
 }
 
-void PartSet_FeaturePointPrs::move(double theDeltaX, double theDeltaY)
-{
-  boost::shared_ptr<ModelAPI_Data> aData = feature()->data();
-  if (!aData->isValid())
-    return;
-
-  boost::shared_ptr<GeomDataAPI_Point2D> aPoint1 =
-        boost::dynamic_pointer_cast<GeomDataAPI_Point2D>(aData->attribute(POINT_ATTR_COORD));
-  aPoint1->setValue(aPoint1->x() + theDeltaX, aPoint1->y() + theDeltaY);
-}
-
 double PartSet_FeaturePointPrs::distanceToPoint(FeaturePtr theFeature,
                                                 double theX, double theY)
 {
index f0962585e2483625e0dfccddc1dcd03ffe112e7f..cc344dc2522aa1b1376c4e2192309d0c72cccb6f 100644 (file)
@@ -48,11 +48,6 @@ public:
   /// \return next attribute selection mode
   virtual PartSet_SelectionMode getNextMode(const std::string& theAttribute) const;
 
-  /// \brief Move the full feature.
-  /// \param theDeltaX the delta for X coordinate is moved
-  /// \param theDeltaY the delta for Y coordinate is moved
-  virtual void move(double theDeltaX, double theDeltaY);
-
   /// Return the distance between the feature and the point
   /// \param theFeature feature object
   /// \param theX the horizontal coordinate of the point
index 609b16973ce31db4f8c3355424635def31ad157c..75aca1bb9f43162bdc82eb83555be35dd7aa476f 100644 (file)
@@ -59,11 +59,6 @@ public:
   /// \return next attribute selection mode
   virtual PartSet_SelectionMode getNextMode(const std::string& theAttribute) const = 0;
 
-  /// \brief Move the full feature.
-  /// \param theDeltaX the delta for X coordinate is moved
-  /// \param theDeltaY the delta for Y coordinate is moved
-  virtual void move(double theDeltaX, double theDeltaY) = 0;
-
   /// Return the distance between the feature and the point
   /// \param theFeature feature object
   /// \param theX the horizontal coordinate of the point
index ee536279b5e2b3035f9704fe79c6df0cbded2a30..0c3fae21691910550e0c4813280dea58cda67fd6 100644 (file)
@@ -145,10 +145,7 @@ void PartSet_OperationEditConstraint::mouseMoved(QMouseEvent* theEvent, Handle(V
     double aX, anY;
     PartSet_Tools::convertTo2D(aPoint, sketch(), theView, aX, anY);
 
-    /*double aDeltaX = aX - aCurX;
-    double aDeltaY = anY - aCurY;
 
-    PartSet_Tools::moveFeature(feature(), aDeltaX, aDeltaY);*/
     if (feature()->getKind() == PartSet_ConstraintRadiusPrs::getKind()) {
       boost::shared_ptr<PartSet_ConstraintRadiusPrs> anArcPrs =
                               boost::dynamic_pointer_cast<PartSet_ConstraintRadiusPrs>(myFeaturePrs);
@@ -157,15 +154,6 @@ void PartSet_OperationEditConstraint::mouseMoved(QMouseEvent* theEvent, Handle(V
       }
     }
     myFeaturePrs->setPoint(aX, anY, SM_LastPoint);
-
-
-    /*std::list<XGUI_ViewerPrs>::const_iterator anIt = myFeatures.begin(), aLast = myFeatures.end();
-    for (; anIt != aLast; anIt++) {
-      FeaturePtr aFeature = (*anIt).feature();
-      if (!aFeature || aFeature == feature())
-        continue;
-      PartSet_Tools::moveFeature(aFeature, aDeltaX, aDeltaY);
-    }*/
   }
   sendFeatures();
 
index fb86907205b2a34de9402a75f8a147e4428a2cf4..e0d52827d5ddb3d97dd99dc372e6791400190f2b 100644 (file)
@@ -132,14 +132,17 @@ void PartSet_OperationEditFeature::mouseMoved(QMouseEvent* theEvent, Handle(V3d_
     double aDeltaX = aX - aCurX;
     double aDeltaY = anY - aCurY;
 
-    PartSet_Tools::moveFeature(feature(), aDeltaX, aDeltaY);
+    boost::shared_ptr<SketchPlugin_Feature> aSketchFeature = 
+                           boost::dynamic_pointer_cast<SketchPlugin_Feature>(feature());
+    aSketchFeature->move(aDeltaX, aDeltaY);
 
     std::list<XGUI_ViewerPrs>::const_iterator anIt = myFeatures.begin(), aLast = myFeatures.end();
     for (; anIt != aLast; anIt++) {
       FeaturePtr aFeature = (*anIt).feature();
       if (!aFeature || aFeature == feature())
         continue;
-      PartSet_Tools::moveFeature(aFeature, aDeltaX, aDeltaY);
+      aSketchFeature = boost::dynamic_pointer_cast<SketchPlugin_Feature>(aFeature);
+      aSketchFeature->move(aDeltaX, aDeltaY);
     }
   }
   sendFeatures();
index 58ed85bb2b67756170e6efa300b63ffc68a24f0c..8f3090ec5501db13516676b05c9255c1c8843e16 100644 (file)
@@ -215,17 +215,6 @@ double PartSet_Tools::distanceToPoint(FeaturePtr theFeature,
   return aDelta;
 }
 
-void PartSet_Tools::moveFeature(FeaturePtr theFeature, double theDeltaX, double theDeltaY)
-{
-  if (!theFeature)
-    return;
-
-  boost::shared_ptr<PartSet_FeaturePrs> aFeaturePrs = PartSet_Tools::createFeaturePrs(
-                                           theFeature->getKind(), FeaturePtr(), theFeature);
-  if (aFeaturePrs)
-  aFeaturePrs->move(theDeltaX, theDeltaY);
-}
-
 boost::shared_ptr<ModelAPI_Document> PartSet_Tools::document()
 {
   return ModelAPI_PluginManager::get()->rootDocument();
index 7b81b3f10015e3c7e444d50cd9ed490759c5647a..cf841a81b8d8d22b746e8a3d4e00f11e8b9eb077 100644 (file)
@@ -69,12 +69,6 @@ public:
   static FeaturePtr nearestFeature(QPoint thePoint, Handle_V3d_View theView, FeaturePtr theSketch,
                                    const std::list<XGUI_ViewerPrs>& theFeatures);
 
-  /// \brief Move the feature.
-  /// \param theFeature the source feature
-  /// \param theDeltaX the delta for X coordinate is moved
-  /// \param theDeltaY the delta for Y coordinate is moved
-  static void moveFeature(FeaturePtr theFeature, double theDeltaX, double theDeltaY);
-
   /// Returns pointer to the root document.
   static boost::shared_ptr<ModelAPI_Document> document();
 
index e390c6af2274765003ea38183cf766b28734deba..566ef84d441e71da6758954c5c4fb6c2187b5335 100644 (file)
@@ -69,3 +69,22 @@ const boost::shared_ptr<GeomAPI_Shape>& SketchPlugin_Arc::preview()
   }
   return getPreview();
 }
+
+void SketchPlugin_Arc::move(double theDeltaX, double theDeltaY)
+{
+  boost::shared_ptr<ModelAPI_Data> aData = data();
+  if (!aData->isValid())
+    return;
+
+  boost::shared_ptr<GeomDataAPI_Point2D> aPoint1 =
+        boost::dynamic_pointer_cast<GeomDataAPI_Point2D>(aData->attribute(ARC_ATTR_CENTER));
+  aPoint1->setValue(aPoint1->x() + theDeltaX, aPoint1->y() + theDeltaY);
+
+  boost::shared_ptr<GeomDataAPI_Point2D> aPoint2 =
+        boost::dynamic_pointer_cast<GeomDataAPI_Point2D>(aData->attribute(ARC_ATTR_START));
+  aPoint2->setValue(aPoint2->x() + theDeltaX, aPoint2->y() + theDeltaY);
+
+  boost::shared_ptr<GeomDataAPI_Point2D> aPoint3 =
+        boost::dynamic_pointer_cast<GeomDataAPI_Point2D>(aData->attribute(ARC_ATTR_END));
+  aPoint3->setValue(aPoint3->x() + theDeltaX, aPoint3->y() + theDeltaY);
+}
index 928a7608347f7af73e96125bfc43c30965e559e4..4d6e6778562f6aba5d88840a50ed8ed8de9c8a73 100644 (file)
@@ -48,6 +48,11 @@ public:
   SKETCHPLUGIN_EXPORT virtual const void addSub(
     const FeaturePtr& theFeature) {};
 
+  /// Moves the feature
+  /// \param theDeltaX the delta for X coordinate is moved
+  /// \param theDeltaY the delta for Y coordinate is moved
+  SKETCHPLUGIN_EXPORT virtual void move(const double theDeltaX, const double theDeltaY);
+
   /// Use plugin manager for features creation
   SketchPlugin_Arc();
 };
index eaa284d083b9fc28b61ceb1540f580987f685e30..ab842378a2bc944be0dd0711710060a3cb3f9b73 100644 (file)
@@ -64,3 +64,14 @@ const boost::shared_ptr<GeomAPI_Shape>& SketchPlugin_Circle::preview()
   }
   return getPreview();
 }
+
+void SketchPlugin_Circle::move(double theDeltaX, double theDeltaY)
+{
+  boost::shared_ptr<ModelAPI_Data> aData = data();
+  if (!aData->isValid())
+    return;
+
+  boost::shared_ptr<GeomDataAPI_Point2D> aPoint1 =
+        boost::dynamic_pointer_cast<GeomDataAPI_Point2D>(aData->attribute(CIRCLE_ATTR_CENTER));
+  aPoint1->setValue(aPoint1->x() + theDeltaX, aPoint1->y() + theDeltaY);
+}
index 10fee4f7bba9f27b1c453d745528138dcced52d9..e74332eff97f322b84a457dd28f2ddfdd175ad1e 100644 (file)
@@ -46,6 +46,11 @@ public:
   SKETCHPLUGIN_EXPORT virtual const void addSub(
     const FeaturePtr& theFeature) {};
 
+  /// Moves the feature
+  /// \param theDeltaX the delta for X coordinate is moved
+  /// \param theDeltaY the delta for Y coordinate is moved
+  SKETCHPLUGIN_EXPORT virtual void move(const double theDeltaX, const double theDeltaY);
+
   /// Use plugin manager for features creation
   SketchPlugin_Circle();
 };
index 08dc621c70cc342be1b7be4df2dc41dba79a3dd9..2cc8bad32c98156eb01b0e8e8acb5d3478f46886 100644 (file)
@@ -61,6 +61,11 @@ public:
   SKETCHPLUGIN_EXPORT virtual const void addSub(
     const FeaturePtr& theFeature) {}
 
+  /// Moves the feature
+  /// \param theDeltaX the delta for X coordinate is moved
+  /// \param theDeltaY the delta for Y coordinate is moved
+  SKETCHPLUGIN_EXPORT virtual void move(const double theDeltaX, const double theDeltaY) {};
+
 protected:
   /// \brief Use plugin manager for features creation
   SketchPlugin_Constraint() {}
index 8e59b54892d5c8935f587563554b8338ec546032..4bf9ae7cb6ccbc452623a1c5befc591d53145703 100644 (file)
@@ -32,6 +32,11 @@ public:
   /// Returns true if this feature must be displayed in the history (top level of Part tree)
   SKETCHPLUGIN_EXPORT virtual bool isInHistory() {return false;}
 
+  /// Moves the feature
+  /// \param theDeltaX the delta for X coordinate is moved
+  /// \param theDeltaY the delta for Y coordinate is moved
+  SKETCHPLUGIN_EXPORT virtual void move(const double theDeltaX, const double theDeltaY) = 0;
+
 protected:
   /// Set the shape to the internal preview field
   /// \param theShape a preview shape
index 734666d8973d51e2112f0e4317ba4e7cdfe6cea9..25751f06bd285d712faccad4ae9ad449a5ba6549 100644 (file)
@@ -47,3 +47,18 @@ const boost::shared_ptr<GeomAPI_Shape>& SketchPlugin_Line::preview()
   }
   return getPreview();
 }
+
+void SketchPlugin_Line::move(double theDeltaX, double theDeltaY)
+{
+  boost::shared_ptr<ModelAPI_Data> aData = data();
+  if (!aData->isValid())
+    return;
+
+  boost::shared_ptr<GeomDataAPI_Point2D> aPoint1 =
+        boost::dynamic_pointer_cast<GeomDataAPI_Point2D>(aData->attribute(LINE_ATTR_START));
+  aPoint1->setValue(aPoint1->x() + theDeltaX, aPoint1->y() + theDeltaY);
+
+  boost::shared_ptr<GeomDataAPI_Point2D> aPoint2 =
+        boost::dynamic_pointer_cast<GeomDataAPI_Point2D>(aData->attribute(LINE_ATTR_END));
+  aPoint2->setValue(aPoint2->x() + theDeltaX, aPoint2->y() + theDeltaY);
+}
index 6acefd2943f36e69a885cd34769e7b36b6e10913..554fd5e5300313f214c03ca73bf99cb9f13b8ce0 100644 (file)
@@ -47,6 +47,11 @@ public:
   SKETCHPLUGIN_EXPORT virtual const void addSub(
     const FeaturePtr& theFeature) {};
 
+  /// Moves the feature
+  /// \param theDeltaX the delta for X coordinate is moved
+  /// \param theDeltaY the delta for Y coordinate is moved
+  SKETCHPLUGIN_EXPORT virtual void move(const double theDeltaX, const double theDeltaY);
+
   /// Use plugin manager for features creation
   SketchPlugin_Line();
 };
index 6df2b536bad40f21b91a6bdf4fbfd97c9cb65b8a..208063d3595505f1b412889ddc1fbeedff8fd6c0 100644 (file)
@@ -37,3 +37,14 @@ const boost::shared_ptr<GeomAPI_Shape>& SketchPlugin_Point::preview()
   }
   return getPreview();
 }
+
+void SketchPlugin_Point::move(double theDeltaX, double theDeltaY)
+{
+  boost::shared_ptr<ModelAPI_Data> aData = data();
+  if (!aData->isValid())
+    return;
+
+  boost::shared_ptr<GeomDataAPI_Point2D> aPoint1 =
+        boost::dynamic_pointer_cast<GeomDataAPI_Point2D>(aData->attribute(POINT_ATTR_COORD));
+  aPoint1->setValue(aPoint1->x() + theDeltaX, aPoint1->y() + theDeltaY);
+}
index 8d37e19e13eaea2520b4163670251c9d6ad6bae7..9faf8c9110f35d7d3cb1c337583baff79605ace1 100644 (file)
@@ -45,6 +45,11 @@ public:
   SKETCHPLUGIN_EXPORT virtual const void addSub(
     const FeaturePtr& theFeature) {};
 
+  /// Moves the feature
+  /// \param theDeltaX the delta for X coordinate is moved
+  /// \param theDeltaY the delta for Y coordinate is moved
+  SKETCHPLUGIN_EXPORT virtual void move(const double theDeltaX, const double theDeltaY);
+
   /// Use plugin manager for features creation
   SketchPlugin_Point();
 };
index 8337c8d2478d18a9c13fc1524373753eb4cdf405..3172d2f24280461a30ebcd0be10178a5b1f464d0 100644 (file)
@@ -53,6 +53,11 @@ public:
   SKETCHPLUGIN_EXPORT virtual const void addSub(
     const FeaturePtr& theFeature);
 
+  /// Moves the feature
+  /// \param theDeltaX the delta for X coordinate is moved
+  /// \param theDeltaY the delta for Y coordinate is moved
+  SKETCHPLUGIN_EXPORT virtual void move(const double theDeltaX, const double theDeltaY) {};
+
   /// Converts a 2D sketch space point into point in 3D space
   SKETCHPLUGIN_EXPORT boost::shared_ptr<GeomAPI_Pnt> to3D(
     const double theX, const double theY);