X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FPartSet%2FPartSet_OperationSketchLine.h;h=b048ef8a7b451dc018878adf551a88a37d0a41af;hb=1d7a043abfadf964bf38802e8adb5a4773fec900;hp=604baffa3229daa6fa7f43e0bae0563ce90a2e18;hpb=eba34f3947483cd9a7a8f441af334fba01f36425;p=modules%2Fshaper.git diff --git a/src/PartSet/PartSet_OperationSketchLine.h b/src/PartSet/PartSet_OperationSketchLine.h index 604baffa3..b048ef8a7 100644 --- a/src/PartSet/PartSet_OperationSketchLine.h +++ b/src/PartSet/PartSet_OperationSketchLine.h @@ -10,6 +10,9 @@ #include #include +class GeomDataAPI_Point2D; +class QMouseEvent; + /*! \class PartSet_OperationSketchLine * \brief The operation for the sketch feature creation @@ -17,6 +20,11 @@ class PARTSET_EXPORT PartSet_OperationSketchLine : public PartSet_OperationSketchBase { Q_OBJECT + +public: + /// Returns the operation type key + static std::string Type() { return "SketchLine"; } + public: /// Constructor /// \param theId the feature identifier @@ -36,33 +44,38 @@ public: /// \return the selection mode virtual std::list getSelectionModes(boost::shared_ptr theFeature) const; + /// Initializes some fields accorging to the feature + /// \param theFeature the feature + virtual void init(boost::shared_ptr theFeature); + /// Gives the current selected objects to be processed by the operation /// \param thePoint a point clicked in the viewer - virtual void mouseReleased(const gp_Pnt& thePoint); + /// \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); /// Gives the current mouse point in the viewer /// \param thePoint a point clicked in the viewer - virtual void mouseMoved(const gp_Pnt& thePoint); + /// \param theEvent the mouse event + /// \param theSelected the list of selected presentations + virtual void mouseMoved(QMouseEvent* theEvent, Handle_V3d_View theView, + const std::list& theSelected); /// Processes the key pressed in the view /// \param theKey a key value virtual void keyReleased(const int theKey); -signals: - /// signal about the sketch plane is selected - /// \param theX the value in the X direction of the plane - /// \param theX the value in the Y direction value of the plane - /// \param theX the value in the Z direction of the plane - void localContextChanged(boost::shared_ptr theFeature, - int theMode); - 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 virtual void startOperation(); - /// \brief Virtual method called when operation is started + /// Virtual method called when operation aborted (see abort() method for more description) + /// Before the feature is aborted, it should be hidden from the viewer + virtual void abortOperation(); + /// Virtual method called when operation stopped - committed or aborted. - /// After the parent operation body perform, reset selection point mode of the operation + /// Restore the multi selection state virtual void stopOperation(); /// Creates an operation new feature @@ -71,31 +84,48 @@ protected: /// \returns the created feature virtual boost::shared_ptr createFeature(); + /// Creates a constraint on two points + /// \param thePoint1 the first point + /// \param thePoint1 the second point + void createConstraint(boost::shared_ptr thePoint1, + boost::shared_ptr thePoint2); + + /// Creates constrains of the current + /// \param theX the horizontal coordnate of the point + /// \param theY the vertical coordnate of the point + void setConstraints(double theX, double theY); protected: - /// \brief Save the point to the line. - /// \param thePoint the 3D point in the viewer + /// \brief Get the line point 2d coordinates. + /// \param theFeature the line feature /// \param theAttribute the start or end attribute of the line - void setLinePoint(const gp_Pnt& thePoint, const std::string& theAttribute); + /// \param theX the horizontal coordinate + /// \param theY the vertical coordinate + void getLinePoint(boost::shared_ptr theFeature, const std::string& theAttribute, + double& theX, double& theY); + /// Find a point in the line with given coordinates + /// \param theFeature the line feature + /// \param theX the horizontal point coordinate + /// \param theY the vertical point coordinate + boost::shared_ptr findLinePoint(boost::shared_ptr theFeature, + double theX, double theY); - /// \brief Set the point to the line by the point of the source line. - /// \param theSourceFeature the feature, where the point is obtained - /// \param theSourceAttribute the start or end attribute of the source line + /// \brief Save the point to the line. + /// \param theX the horizontal coordinate + /// \param theY the vertical coordinate /// \param theAttribute the start or end attribute of the line - void setLinePoint(boost::shared_ptr theSourceFeature, - const std::string& theSourceAttribute, - const std::string& theAttribute); - /// \brief Converts the 3D point to the projected coodinates on the sketch plane. + void setLinePoint(double theX, double theY, const std::string& theAttribute); + /// \brief Save the point to the line. /// \param thePoint the 3D point in the viewer - /// \param theX the X coordinate - /// \param theY the Y coordinate - void convertTo2D(const gp_Pnt& thePoint, double& theX, double& theY); + /// \param theAttribute the start or end attribute of the line + void setLinePoint(const gp_Pnt& thePoint, Handle(V3d_View) theView, const std::string& theAttribute); protected: ///< Structure to lists the possible types of point selection modes - enum PointSelectionMode {SM_FirstPoint, SM_SecondPoint, SM_None}; + enum PointSelectionMode {SM_FirstPoint, SM_SecondPoint}; private: boost::shared_ptr mySketch; ///< the sketch feature + boost::shared_ptr myInitPoint; ///< the first line point PointSelectionMode myPointSelectionMode; ///< point selection mode };