X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FPartSet%2FPartSet_OperationEditLine.h;h=58b911b261e0663b0dbe67c48b8b2de456edd1e5;hb=f4797a246fbd855f80f8a2f5c620e1aae1701000;hp=01a705386ccaf5d89919cbd8d3c8f426a58cf238;hpb=24f1f22de48301869843dad2130f75a2c3947387;p=modules%2Fshaper.git diff --git a/src/PartSet/PartSet_OperationEditLine.h b/src/PartSet/PartSet_OperationEditLine.h index 01a705386..58b911b26 100644 --- a/src/PartSet/PartSet_OperationEditLine.h +++ b/src/PartSet/PartSet_OperationEditLine.h @@ -19,6 +19,33 @@ class QMouseEvent; class PARTSET_EXPORT PartSet_OperationEditLine : public PartSet_OperationSketchBase { Q_OBJECT + /// Struct to define gp point, with the state is the point is initialized + struct Point + { + /// Constructor + Point() {} + /// Constructor + /// \param thePoint the point + Point(gp_Pnt thePoint) + { + setPoint(thePoint); + } + ~Point() {} + + /// clear the initialized flag. + void clear() { myIsInitialized = false; } + /// set the point and switch on the initialized flag + /// \param thePoint the point + void setPoint(const gp_Pnt& thePoint) + { + myIsInitialized = true; + myPoint = thePoint; + } + + bool myIsInitialized; /// the state whether the point is set + gp_Pnt myPoint; /// the point + }; + public: /// Returns the operation type key static std::string Type() { return "EditLine"; } @@ -44,7 +71,9 @@ public: /// Initializes some fields accorging to the feature /// \param theFeature the feature - virtual void init(boost::shared_ptr theFeature); + /// \param thePresentations the list of additional presentations + virtual void init(boost::shared_ptr theFeature, + const std::list& thePresentations); /// Processes the mouse pressed in the point /// \param thePoint a point clicked in the viewer @@ -53,20 +82,25 @@ public: /// Gives the current mouse point in the viewer /// \param thePoint a point clicked in the viewer /// \param theEvent the mouse event - virtual void mouseMoved(QMouseEvent* theEvent, Handle_V3d_View theView); - + /// \param theSelected the list of selected presentations + virtual void mouseMoved(QMouseEvent* theEvent, Handle_V3d_View theView, + const std::list& theSelected); /// Gives the current selected objects to be processed by the operation - /// \param theFeature the selected feature - /// \param theShape the selected shape - virtual void setSelected(boost::shared_ptr theFeature, - const TopoDS_Shape& theShape); - + /// \param thePoint a point clicked in the viewer + /// \param theEvent the mouse event + /// \param theSelected the list of selected presentations + virtual void mouseReleased(QMouseEvent* theEvent, Handle_V3d_View theView, + const std::list& theSelected); protected: /// \brief Virtual method called when operation is started /// Virtual method called when operation started (see start() method for more description) - /// After the parent operation body perform, set sketch feature to the created line feature + /// Switch off the multi selection state virtual void startOperation(); + /// Virtual method called when operation stopped - committed or aborted. + /// Restore the multi selection state + virtual void stopOperation(); + /// Creates an operation new feature /// Returns NULL feature. This is an operation of edition, not creation. /// \returns the created feature @@ -74,14 +108,18 @@ protected: protected: /// \brief Save the point to the line. + /// \param theFeature the source feature /// \param theDeltaX the delta for X coordinate is moved /// \param theDeltaY the delta for Y coordinate is moved /// \param theAttribute the start or end attribute of the line - void moveLinePoint(double theDeltaX, double theDeltaY, + void moveLinePoint(boost::shared_ptr theFeature, + double theDeltaX, double theDeltaY, const std::string& theAttribute); private: boost::shared_ptr mySketch; ///< the sketch feature + std::list myFeatures; ///< the features to apply the edit operation + Point myCurPoint; ///< the current 3D point clicked or moved gp_Pnt myCurPressed; ///< the current 3D point clicked or moved };