Salome HOME
Issue #710 fillet is wrong
[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 class ModuleBase_IWorkshop;
22 class XGUI_Workshop;
23
24 /**
25 * \ingroup Modules
26 * Customosation of ModuleBase_WidgetShapeSelector in order to provide 
27 * working with sketch specific objects.
28 */
29 class PARTSET_EXPORT PartSet_ExternalObjectsMgr
30 {
31  public:
32   /// Constructor
33   /// \param theExternal the external state
34   /// \param theDefaultValue the default value for the external object using
35   PartSet_ExternalObjectsMgr(const std::string& theExternal, const bool theDefaultValue);
36
37   virtual ~PartSet_ExternalObjectsMgr() {}
38
39   /// Returns the state whether the external object is used
40   bool useExternal() const { return myUseExternal; }
41
42   bool isValidObject(const ObjectPtr& theObject);
43
44   /// Finds or create and external object
45   /// \param theSelectedObject an object
46   /// \param theShape a selected shape, which is used in the selection attribute
47   /// \param theSketch a current sketch
48   /// \return the object
49   ObjectPtr externalObject(const ObjectPtr& theSelectedObject, const GeomShapePtr& theShape,
50                            const CompositeFeaturePtr& theSketch);
51
52   ObjectPtr externalObjectValidated(const ObjectPtr& theSelectedObject, const GeomShapePtr& theShape,
53                            const CompositeFeaturePtr& theSketch);
54
55   // Removes the external presentation from the model
56   /// \param theSketch a current sketch
57   /// \param theFeature a current feature
58   /// \param theFeature a current workshop
59   void removeExternal(const CompositeFeaturePtr& theSketch,
60                       const FeaturePtr& theFeature,
61                       ModuleBase_IWorkshop* theWorkshop);
62
63   void removeExternalValidated(const CompositeFeaturePtr& theSketch,
64                                const FeaturePtr& theFeature,
65                                ModuleBase_IWorkshop* theWorkshop);
66
67   void removeUnusedExternalObjects(const QObjectPtrList& theIgnoreObjects,
68                             const CompositeFeaturePtr& theSketch,
69                             const FeaturePtr& theFeature);
70
71 protected:
72   void removeExternalObject(const ObjectPtr& theObject,
73                             const CompositeFeaturePtr& theSketch,
74                             const FeaturePtr& theFeature,
75                             ModuleBase_IWorkshop* theWorkshop);
76
77   /// Returns the workshop
78   static XGUI_Workshop* workshop(ModuleBase_IWorkshop* theWorkshop);
79
80 protected:
81   /// An external object
82   QObjectPtrList myExternalObjects;
83
84   /// An external object
85   ObjectPtr myExternalObjectValidated;
86
87   /// Boolean value about the neccessity of the external object use
88   bool myUseExternal;
89 };
90
91 #endif