Salome HOME
External object manager to be used in the multi selector widget
[modules/shaper.git] / src / PartSet / PartSet_ExternalObjectsMgr.h
1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
2
3 // File:        PartSet_ExternalObjectsMgr.h
4 // Created:     15 Apr 2015
5 // Author:      Natalia Ermolaeva
6
7
8 #ifndef PartSet_ExternalObjectsMgr_H
9 #define PartSet_ExternalObjectsMgr_H
10
11 #include "PartSet.h"
12
13 #include <ModelAPI_CompositeFeature.h>
14 #include <ModelAPI_Object.h>
15 #include <GeomAPI_Shape.h>
16
17 #include <ModuleBase_Definitions.h>
18
19 #include <string>
20
21 /**
22 * \ingroup Modules
23 * Customosation of ModuleBase_WidgetShapeSelector in order to provide 
24 * working with sketch specific objects.
25 */
26 class PARTSET_EXPORT PartSet_ExternalObjectsMgr
27 {
28  public:
29   /// Constructor
30   /// \param theExternal the external state
31   /// \param theDefaultValue the default value for the external object using
32   PartSet_ExternalObjectsMgr(const std::string& theExternal, const bool theDefaultValue);
33
34   virtual ~PartSet_ExternalObjectsMgr() {}
35
36   /// Returns the state whether the external object is used
37   bool useExternal() const { return myUseExternal; }
38
39   /// Finds or create and external object
40   /// \param theSelectedObject an object
41   /// \param theShape a selected shape, which is used in the selection attribute
42   /// \param theSketch a current sketch
43   /// \return the object
44   ObjectPtr externalObject(const ObjectPtr& theSelectedObject, const GeomShapePtr& theShape,
45                            const CompositeFeaturePtr& theSketch);
46
47   // Removes the external presentation from the model
48   /// \param theSketch a current sketch
49   /// \param theFeature a current feature
50   void removeExternal(const CompositeFeaturePtr& theSketch,
51                       const FeaturePtr& theFeature);
52
53 protected:
54   /// An external object
55   QObjectPtrList myExternalObjects;
56
57   /// Boolean value about the neccessity of the external object use
58   bool myUseExternal;
59 };
60
61 #endif