]> SALOME platform Git repositories - modules/shaper.git/blob - src/PartSet/PartSet_CustomPrs.h
Salome HOME
Issue #849 (#775) Crash in second study during sketch operation
[modules/shaper.git] / src / PartSet / PartSet_CustomPrs.h
1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
2
3 // File:        PartSet_CustomPrs.hxx
4 // Created:     30 Jun 2015
5 // Author:      Natalia ERMOLAEVA
6
7 #ifndef PartSet_CustomPrs_H
8 #define PartSet_CustomPrs_H
9
10 #include "PartSet.h"
11
12 #include "PartSet_OperationPrs.h"
13
14 #include <ModelAPI_Object.h>
15 #include <ModelAPI_Result.h>
16 #include <ModelAPI_Feature.h>
17
18 #include <GeomAPI_ICustomPrs.h>
19 #include <GeomAPI_AISObject.h>
20 #include <GeomAPI_Shape.h>
21
22 class ModuleBase_IWorkshop;
23 class XGUI_Workshop;
24
25 /**
26 * Interface of a class which can provide specific customization of
27 * object presentation
28 */
29 class PartSet_CustomPrs
30 {
31 public:
32   PARTSET_EXPORT PartSet_CustomPrs(ModuleBase_IWorkshop* theWorkshop);
33   PARTSET_EXPORT virtual ~PartSet_CustomPrs() {};
34
35   /// Returns true if the presentation is active
36   bool isActive();
37
38   /// Initializes the presentation by the parameter object
39   void activate(const FeaturePtr& theObject);
40
41   void deactivate();
42
43   /// Modifies the given presentation in the custom way.
44   void customize(const ObjectPtr& theObject);
45
46   void clearPrs();
47
48   void initPrs();
49
50 private:
51   /// Returns the AIS presentation
52   Handle(PartSet_OperationPrs) getPresentation();
53
54   //! Returns workshop
55   XGUI_Workshop* workshop() const;
56
57   /// Displays the internal presentation in the viewer of workshop
58   void displayPresentation();
59   /// Erases the internal presentation from the viewer of workshop
60   void erasePresentation();
61   /// Sets color, point size and width of the presentation
62   void customizePresentation();
63
64 private:
65   ModuleBase_IWorkshop* myWorkshop; /// current workshop
66   AISObjectPtr myOperationPrs; /// the AIS presentation, which is displayed/erased in the viewer
67 };
68
69 #endif