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 theDefaultValue the default value for the external object using
35 PartSet_ExternalObjectsMgr(const std::string& theExternal, const bool theDefaultValue);
37 virtual ~PartSet_ExternalObjectsMgr() {}
39 /// Returns the state whether the external object is used
40 bool useExternal() const { return myUseExternal; }
42 bool isValidObject(const ObjectPtr& theObject);
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 /// \param theTemporary the created external object is temporary, execute is not performed for it
49 /// \return the object
50 ObjectPtr externalObject(const ObjectPtr& theSelectedObject, const GeomShapePtr& theShape,
51 const CompositeFeaturePtr& theSketch, const bool theTemporary = false);
53 //ObjectPtr externalObjectValidated(const ObjectPtr& theSelectedObject, const GeomShapePtr& theShape,
54 // const CompositeFeaturePtr& theSketch);
56 // Removes the external presentation from the model
57 /// \param theSketch a current sketch
58 /// \param theFeature a current feature
59 /// \param theFeature a current workshop
60 /// \param theTemporary if true, a temporary external object is removed overwise all ext objects
61 void removeExternal(const CompositeFeaturePtr& theSketch,
62 const FeaturePtr& theFeature,
63 ModuleBase_IWorkshop* theWorkshop,
64 const bool theTemporary);
66 //void removeExternalVali+dated(const CompositeFeaturePtr& theSketch,
67 // const FeaturePtr& theFeature,
68 // ModuleBase_IWorkshop* theWorkshop);
70 void removeUnusedExternalObjects(const QObjectPtrList& theIgnoreObjects,
71 const CompositeFeaturePtr& theSketch,
72 const FeaturePtr& theFeature);
75 void removeExternalObject(const ObjectPtr& theObject,
76 const CompositeFeaturePtr& theSketch,
77 const FeaturePtr& theFeature,
78 ModuleBase_IWorkshop* theWorkshop);
80 /// Returns the workshop
81 static XGUI_Workshop* workshop(ModuleBase_IWorkshop* theWorkshop);
84 /// An external object
85 QObjectPtrList myExternalObjects;
87 /// An external object
88 ObjectPtr myExternalObjectValidated;
90 /// Boolean value about the neccessity of the external object use