Salome HOME
Update classes documentation
[modules/shaper.git] / src / PartSet / PartSet_WidgetShapeSelector.h
1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
2
3 // File:        PartSet_WidgetShapeSelector.h
4 // Created:     27 Nov 2014
5 // Author:      Vitaly Smetannikov
6
7
8 #ifndef PartSet_WidgetShapeSelector_H
9 #define PartSet_WidgetShapeSelector_H
10
11 #include "PartSet.h"
12
13 #include <ModuleBase_WidgetShapeSelector.h>
14
15 #include <ModelAPI_CompositeFeature.h>
16
17 class PartSet_ExternalObjectsMgr;
18
19 /**
20 * \ingroup Modules
21 * Customosation of ModuleBase_WidgetShapeSelector in order to provide 
22 * working with sketch specific objects and external objects.
23 */
24 class PARTSET_EXPORT PartSet_WidgetShapeSelector: public ModuleBase_WidgetShapeSelector
25 {
26 Q_OBJECT
27  public:
28   /// Constructor
29   /// \param theParent the parent object
30   /// \param theWorkshop instance of workshop interface
31   /// \param theData the widget configuation. The attribute of the model widget is obtained from
32   PartSet_WidgetShapeSelector(QWidget* theParent, ModuleBase_IWorkshop* theWorkshop,
33                               const Config_WidgetAPI* theData);
34
35   virtual ~PartSet_WidgetShapeSelector();
36
37   /// Set sketcher
38   /// \param theSketch a sketcher object
39   void setSketcher(CompositeFeaturePtr theSketch) { mySketch = theSketch; }
40
41   /// Retrurns installed sketcher
42   CompositeFeaturePtr sketch() const { return mySketch; }
43
44   /// Activate or deactivate selection and selection filters
45   /// \param toActivate boolean state whether it should be activated/deactivated
46   virtual bool activateSelectionAndFilters(bool toActivate);
47
48 protected:
49   /// Checks the widget validity. By default, it returns true.
50   /// \param thePrs a selected presentation in the view
51   /// \return a boolean value
52   virtual bool isValidSelectionCustom(const std::shared_ptr<ModuleBase_ViewerPrs>& thePrs);
53
54   /// Return an object and geom shape by the viewer presentation
55   /// \param thePrs a selection
56   /// \param theObject an output object
57   /// \param theShape a shape of the selection
58   virtual void getGeomSelection(const std::shared_ptr<ModuleBase_ViewerPrs>& thePrs,
59                                 ObjectPtr& theObject,
60                                 GeomShapePtr& theShape);
61
62   /// Creates a backup of the current values of the attribute
63   /// It should be realized in the specific widget because of different
64   /// parameters of the current attribute
65   /// \param theAttribute an attribute
66   /// \param theValid a boolean flag, if restore happens for valid parameters
67   void restoreAttributeValue(const AttributePtr& theAttribute, const bool theValid);
68
69 protected:
70   /// A reference to external objects manager
71   PartSet_ExternalObjectsMgr* myExternalObjectMgr;
72
73   /// Pointer to a sketch 
74   CompositeFeaturePtr mySketch;
75
76   bool myUseSketchPlane; ///< state whether the sketch plane filter should be switched on
77 };
78
79 #endif