1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
3 // File: PartSet_WidgetSketchLabel.h
4 // Created: 07 July 2014
5 // Author: Vitaly SMETANNIKOV
7 #ifndef PartSet_WidgetSketchLabel_H
8 #define PartSet_WidgetSketchLabel_H
12 #include <ModuleBase_ModelWidget.h>
13 #include <ModuleBase_ViewerFilters.h>
15 #include <GeomAPI_Pnt.h>
16 #include <GeomAPI_Dir.h>
17 #include <GeomAPI_AISObject.h>
19 #include <StdSelect_FaceFilter.hxx>
20 #include <TopoDS_Shape.hxx>
24 class XGUI_OperationMgr;
29 * A model widget implementation for a label which provides specific behaviour
30 * for sketcher starting and launching operations
32 class PARTSET_EXPORT PartSet_WidgetSketchLabel : public ModuleBase_ModelWidget
37 /// \param theParent the parent object
38 /// \param theData the widget configuation. The attribute of the model widget is obtained from
39 /// \param theParentId is Id of a parent of the current attribute
40 PartSet_WidgetSketchLabel(QWidget* theParent, const Config_WidgetAPI* theData,
41 const std::string& theParentId);
43 virtual ~PartSet_WidgetSketchLabel();
45 virtual bool storeValue() const
50 virtual bool restoreValue()
55 /// Returns list of widget controls
56 /// \return a control list
57 virtual QList<QWidget*> getControls() const;
59 QWidget* getControl() const;
61 /// The methiod called when widget is deactivated
62 virtual void deactivate();
64 /// Returns pointer to workshop
65 XGUI_Workshop* workshop() const { return myWorkshop; }
67 /// Set pointer to workshop
68 /// \param theWork a pointer to workshop
69 void setWorkshop(XGUI_Workshop* theWork) { myWorkshop = theWork; }
71 /// Returns sketcher plane
72 std::shared_ptr<GeomAPI_Pln> plane() const;
75 /// Signal on plane selection
76 void planeSelected(const std::shared_ptr<GeomAPI_Pln>& thePln);
79 /// The methiod called when widget is activated
80 virtual void activateCustom();
83 /// Slot on plane selection
84 void onPlaneSelected();
86 /// Set sketch specific mode of selection
87 void setSketchingMode();
90 /// Create preview of planes for sketch plane selection
91 /// \param theOrigin an origin of the plane
92 /// \param theNorm a normal vector of the plane
93 /// \param theRGB a color of plane presentation [r, g, b] array
94 AISObjectPtr createPreviewPlane(std::shared_ptr<GeomAPI_Pnt> theOrigin,
95 std::shared_ptr<GeomAPI_Dir> theNorm,
98 /// Set sketch plane by shape
99 /// \param theShape a planar face
100 std::shared_ptr<GeomAPI_Dir> setSketchPlane(const TopoDS_Shape& theShape);
102 /// Erase preview planes
103 void erasePreviewPlanes();
105 /// Show preview planes
106 void showPreviewPlanes();
113 XGUI_Workshop* myWorkshop;
115 AISObjectPtr myYZPlane;
116 AISObjectPtr myXZPlane;
117 AISObjectPtr myXYPlane;
118 bool myPreviewDisplayed;
120 Handle(StdSelect_FaceFilter) myFaceFilter;
122 QTimer* mySelectionTimer;