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