]> SALOME platform Git repositories - modules/shaper.git/blob - src/PartSet/PartSet_WidgetSketchLabel.h
Salome HOME
Redesign of operations architecture
[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  private slots:
65   void onPlaneSelected();
66
67  private:
68   AISObjectPtr createPreviewPlane(std::shared_ptr<GeomAPI_Pnt> theOrigin, 
69                                   std::shared_ptr<GeomAPI_Dir> theNorm, 
70                                   const int theRGB[3]);
71
72   std::shared_ptr<GeomAPI_Dir> setSketchPlane(const TopoDS_Shape& theShape);
73
74   void erasePreviewPlanes();
75   void showPreviewPlanes();
76
77   void setSketchingMode();
78
79   QLabel* myLabel;
80   QString myText;
81   QString myTooltip;
82
83   XGUI_Workshop* myWorkshop;
84
85   AISObjectPtr myYZPlane;
86   AISObjectPtr myXZPlane;
87   AISObjectPtr myXYPlane;
88   bool myPreviewDisplayed;
89
90   Handle(StdSelect_FaceFilter) myPlaneFilter;
91   //Handle(ModuleBase_ShapeInPlaneFilter) mySketchFilter;
92 };
93
94 #endif