1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
3 // File: PartSet_WidgetMultiSelector.h
4 // Created: 15 Apr 2015
5 // Author: Natalia Ermolaeva
8 #ifndef PartSet_WidgetMultiSelector_H
9 #define PartSet_WidgetMultiSelector_H
13 #include <ModuleBase_WidgetMultiSelector.h>
14 #include <ModuleBase_ViewerPrs.h>
16 #include <ModelAPI_CompositeFeature.h>
18 class PartSet_ExternalObjectsMgr;
22 * Customosation of ModuleBase_WidgetMultiSelector in order to provide
23 * working with sketch specific objects and creation of external objects.
25 class PARTSET_EXPORT PartSet_WidgetMultiSelector: public ModuleBase_WidgetMultiSelector
30 /// \param theParent the parent object
31 /// \param theWorkshop instance of workshop interface
32 /// \param theData the widget configuation. The attribute of the model widget is obtained from
33 /// \param theParentId is Id of a parent of the current attribute
34 PartSet_WidgetMultiSelector(QWidget* theParent, ModuleBase_IWorkshop* theWorkshop,
35 const Config_WidgetAPI* theData, const std::string& theParentId);
37 virtual ~PartSet_WidgetMultiSelector();
39 /// Defines if it is supposed that the widget should interact with the viewer.
40 virtual bool isViewerSelector() { return true; }
43 /// \param theSketch a sketcher object
44 void setSketcher(CompositeFeaturePtr theSketch) { mySketch = theSketch; }
46 /// Retrurns installed sketcher
47 CompositeFeaturePtr sketch() const { return mySketch; }
49 /// Set the given wrapped value to the current widget
50 /// This value should be processed in the widget according to the needs
51 /// \param theValues the wrapped selection values
52 virtual bool setSelection(QList<ModuleBase_ViewerPrs>& theValues,
53 const bool theToValidate);
56 /// Checks the widget validity. By default, it returns true.
57 /// \param theValue a selected presentation in the view
58 /// \return a boolean value
59 virtual bool isValidSelectionCustom(const ModuleBase_ViewerPrs& thePrs);
61 /// Creates a backup of the current values of the attribute
62 /// It should be realized in the specific widget because of different
63 /// parameters of the current attribute
64 virtual void storeAttributeValue();
66 /// Creates a backup of the current values of the attribute
67 /// It should be realized in the specific widget because of different
68 /// parameters of the current attribute
69 /// \param theValid a boolean flag, if restore happens for valid parameters
70 void restoreAttributeValue(const bool theValid);
72 /// Return an object and geom shape by the viewer presentation
73 /// \param thePrs a selection
74 /// \param theObject an output object
75 /// \param theShape a shape of the selection
76 virtual void getGeomSelection(const ModuleBase_ViewerPrs& thePrs,
78 GeomShapePtr& theShape);
81 PartSet_ExternalObjectsMgr* myExternalObjectMgr;
82 /// Pointer to a sketch
83 CompositeFeaturePtr mySketch;