1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
3 // File: PartSet_ExternalObjectsMgr.h
4 // Created: 15 Apr 2015
5 // Author: Natalia Ermolaeva
8 #ifndef PartSet_ExternalObjectsMgr_H
9 #define PartSet_ExternalObjectsMgr_H
13 #include <ModelAPI_CompositeFeature.h>
14 #include <ModelAPI_Object.h>
15 #include <GeomAPI_Shape.h>
17 #include <ModuleBase_Definitions.h>
21 class ModuleBase_IWorkshop;
26 * Customosation of ModuleBase_WidgetShapeSelector in order to provide
27 * working with sketch specific objects.
29 class PARTSET_EXPORT PartSet_ExternalObjectsMgr
33 /// \param theExternal the external state
34 /// \param theCanCreateExternal the state if it can and should create external features
35 /// \param theDefaultValue the default value for the external object using
36 PartSet_ExternalObjectsMgr(const std::string& theExternal,
37 const std::string& theCanCreateExternal,
38 const bool theDefaultValue);
40 virtual ~PartSet_ExternalObjectsMgr() {}
42 /// Returns the state whether the external object is used
43 bool useExternal() const { return myUseExternal; }
45 /// Returns if new external objects can be created
46 /// \return boolean value
47 bool canCreateExternal() { return myCanCreateExternal;}
49 /// Checks validity of the given object
50 /// \param theObject an object to check
51 /// \return valid or not valid
52 bool isValidObject(const ObjectPtr& theObject);
54 /// Finds or create and external object
55 /// \param theSelectedObject an object
56 /// \param theShape a selected shape, which is used in the selection attribute
57 /// \param theSketch a current sketch
58 /// \param theTemporary the created external object is temporary, execute is not performed for it
59 /// \return the object
60 ObjectPtr externalObject(const ObjectPtr& theSelectedObject, const GeomShapePtr& theShape,
61 const CompositeFeaturePtr& theSketch, const bool theTemporary = false);
63 // Removes the external presentation from the model
64 /// \param theSketch a current sketch
65 /// \param theFeature a current feature
66 /// \param theWorkshop a current workshop
67 /// \param theTemporary if true, a temporary external object is removed overwise all ext objects
68 void removeExternal(const CompositeFeaturePtr& theSketch,
69 const FeaturePtr& theFeature,
70 ModuleBase_IWorkshop* theWorkshop,
71 const bool theTemporary);
74 /// Delete from the document the feature of the object. It deletes all objects, which refers to
75 /// the deleted one. The parameter feature is ignored even it refer to the deleted object.
76 /// \param theObject a removed object
77 /// \param theSketch a current sketch
78 /// \param theFeature a current feature
79 /// \param theWorkshop a current workshop
80 void removeExternalObject(const ObjectPtr& theObject,
81 const CompositeFeaturePtr& theSketch,
82 const FeaturePtr& theFeature,
83 ModuleBase_IWorkshop* theWorkshop);
85 /// Returns the workshop
86 static XGUI_Workshop* workshop(ModuleBase_IWorkshop* theWorkshop);
89 /// An external object
90 ObjectPtr myExternalObjectValidated;
92 /// Boolean value about the neccessity of the external object use
94 /// Boolean value about the necessity of a new external object creation
95 bool myCanCreateExternal;