SHAPER  9.12.0
PartSet_ExternalObjectsMgr.h
1 // Copyright (C) 2014-2023 CEA, EDF
2 //
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
7 //
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 // Lesser General Public License for more details.
12 //
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16 //
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18 //
19 
20 #ifndef PartSet_ExternalObjectsMgr_H
21 #define PartSet_ExternalObjectsMgr_H
22 
23 #include "PartSet.h"
24 
25 #include <ModelAPI_CompositeFeature.h>
26 #include <ModelAPI_Object.h>
27 #include <GeomAPI_Shape.h>
28 
29 #include <ModuleBase_Definitions.h>
30 
31 #include <string>
32 
35 class XGUI_Workshop;
36 
42 class PARTSET_EXPORT PartSet_ExternalObjectsMgr
43 {
44  public:
49  PartSet_ExternalObjectsMgr(const std::string& theExternal,
50  const std::string& theCanCreateExternal,
51  const bool theDefaultValue);
52 
53  virtual ~PartSet_ExternalObjectsMgr() {}
54 
56  bool useExternal() const { return myUseExternal; }
57 
60  bool canCreateExternal() { return myCanCreateExternal;}
61 
65  bool isValidObject(const ObjectPtr& theObject);
66 
73  ObjectPtr externalObject(const ObjectPtr& theSelectedObject, const GeomShapePtr& theShape,
74  const CompositeFeaturePtr& theSketch, const bool theTemporary = false);
75 
81  ObjectPtr externalCenterObject(const std::shared_ptr<ModuleBase_ViewerPrs>& thePrs,
82  const CompositeFeaturePtr& theSketch,
83  const bool theTemporary);
84 
87  ObjectPtr getExternalObjectValidated() const { return myExternalObjectValidated; }
88 
89  // Removes the external presentation from the model
94  void removeExternal(const CompositeFeaturePtr& theSketch,
95  const FeaturePtr& theFeature,
96  ModuleBase_IWorkshop* theWorkshop,
97  const bool theTemporary);
98 
103  virtual void getGeomSelection(const std::shared_ptr<ModuleBase_ViewerPrs>& thePrs,
104  ObjectPtr& theObject,
105  GeomShapePtr& theShape,
106  ModuleBase_IWorkshop* theWorkshop,
107  const CompositeFeaturePtr& theSketch,
108  const bool isInValidate);
109 
110 protected:
117  void removeExternalObject(const ObjectPtr& theObject,
118  const CompositeFeaturePtr& theSketch,
119  const FeaturePtr& theFeature,
120  ModuleBase_IWorkshop* theWorkshop);
121 
123  static XGUI_Workshop* workshop(ModuleBase_IWorkshop* theWorkshop);
124 
125 protected:
128 
133 };
134 
135 #endif
Class which provides access to Workshop object services.
Definition: ModuleBase_IWorkshop.h:48
Presentation.
Definition: ModuleBase_ViewerPrs.h:37
Customosation of ModuleBase_WidgetShapeSelector in order to provide working with sketch specific obje...
Definition: PartSet_ExternalObjectsMgr.h:43
bool myUseExternal
Boolean value about the neccessity of the external object use.
Definition: PartSet_ExternalObjectsMgr.h:130
ObjectPtr getExternalObjectValidated() const
Returns created external object or NULL.
Definition: PartSet_ExternalObjectsMgr.h:87
bool useExternal() const
Returns the state whether the external object is used.
Definition: PartSet_ExternalObjectsMgr.h:56
bool myCanCreateExternal
Boolean value about the necessity of a new external object creation.
Definition: PartSet_ExternalObjectsMgr.h:132
bool canCreateExternal()
Returns if new external objects can be created.
Definition: PartSet_ExternalObjectsMgr.h:60
ObjectPtr myExternalObjectValidated
An external object.
Definition: PartSet_ExternalObjectsMgr.h:127
Class which defines a configuration of the application (Workshop) and launches it.
Definition: XGUI_Workshop.h:82