Salome HOME
A sketcher operations manager is created
[modules/shaper.git] / src / PartSet / PartSet_WidgetSketchLabel.h
1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
2
3 // File:        PartSet_WidgetSketchLabel.h
4 // Created:     07 July 2014
5 // Author:      Vitaly SMETANNIKOV
6
7 #ifndef PartSet_WidgetSketchLabel_H
8 #define PartSet_WidgetSketchLabel_H
9
10 #include "PartSet.h"
11
12 #include <ModuleBase_ModelWidget.h>
13 #include <ModuleBase_ViewerFilters.h>
14
15 #include <GeomAPI_Pnt.h>
16 #include <GeomAPI_Dir.h>
17 #include <GeomAPI_AISObject.h>
18
19 #include <StdSelect_FaceFilter.hxx>
20 #include <TopoDS_Shape.hxx>
21
22 class QLabel;
23 class QTimer;
24 class XGUI_OperationMgr;
25 class XGUI_Workshop;
26
27 class PARTSET_EXPORT PartSet_WidgetSketchLabel : public ModuleBase_ModelWidget
28 {
29 Q_OBJECT
30  public:
31   PartSet_WidgetSketchLabel(QWidget* theParent, const Config_WidgetAPI* theData,
32                             const std::string& theParentId);
33
34   virtual ~PartSet_WidgetSketchLabel();
35
36   /// Saves the internal parameters to the given feature
37   /// \param theFeature a model feature to be changed
38   virtual bool storeValue() const
39   {
40     return true;
41   }
42
43   virtual bool restoreValue()
44   {
45     return true;
46   }
47
48   /// Returns list of widget controls
49   /// \return a control list
50   virtual QList<QWidget*> getControls() const;
51
52   QWidget* getControl() const;
53
54   /// The methiod called when widget is activated
55   virtual void activate();
56
57   /// The methiod called when widget is deactivated
58   virtual void deactivate();
59
60   XGUI_Workshop* workshop() const { return myWorkshop; }
61
62   void setWorkshop(XGUI_Workshop* theWork) { myWorkshop = theWork; }
63
64   std::shared_ptr<GeomAPI_Pln> plane() const;
65
66 signals:
67   void planeSelected(const std::shared_ptr<GeomAPI_Pln>& thePln);
68
69  private slots:
70   void onPlaneSelected();
71   void setSketchingMode();
72
73  private:
74   AISObjectPtr createPreviewPlane(std::shared_ptr<GeomAPI_Pnt> theOrigin, 
75                                   std::shared_ptr<GeomAPI_Dir> theNorm, 
76                                   const int theRGB[3]);
77
78   std::shared_ptr<GeomAPI_Dir> setSketchPlane(const TopoDS_Shape& theShape);
79
80   void erasePreviewPlanes();
81   void showPreviewPlanes();
82
83
84   QLabel* myLabel;
85   QString myText;
86   QString myTooltip;
87
88   XGUI_Workshop* myWorkshop;
89
90   AISObjectPtr myYZPlane;
91   AISObjectPtr myXZPlane;
92   AISObjectPtr myXYPlane;
93   bool myPreviewDisplayed;
94
95   Handle(StdSelect_FaceFilter) myFaceFilter;
96
97   QTimer* mySelectionTimer;
98 };
99
100 #endif