]> SALOME platform Git repositories - modules/shaper.git/blob - src/PartSet/PartSet_PreviewPlanes.h
Salome HOME
Add ellipse data type
[modules/shaper.git] / src / PartSet / PartSet_PreviewPlanes.h
1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
2
3 // File:        PartSet_PreviewPlanes.h
4 // Created:     22 Mar 2016
5 // Author:      Natalia ERMOLAEVA
6
7 #ifndef PartSet_PreviewPlanes_H
8 #define PartSet_PreviewPlanes_H
9
10 #include <GeomAPI_AISObject.h>
11
12 #include <GeomAPI_Pnt.h>
13 #include <GeomAPI_Dir.h>
14 #include <GeomAPI_AISObject.h>
15
16 class ModuleBase_IWorkshop;
17
18 /**
19 * \class PartSet_PreviewPlanes
20 * \ingroup Modules
21 * A class to show/hide sketch preview planes
22 */
23 class PartSet_PreviewPlanes
24 {
25 public:
26   /// Constructor
27   PartSet_PreviewPlanes();
28
29   ~PartSet_PreviewPlanes() {};
30
31   /// Returns true if there is body visualized in the viewer
32   /// \param theWorkshop the application workshop
33   /// \return boolean value
34   static bool hasVisualizedBodies(ModuleBase_IWorkshop* theWorkshop);
35
36   /// Returns true if there is at least one Sketch visualized in the viewer
37   /// \param theWorkshop the application workshop
38   /// \return boolean value
39   static bool hasVisualizedSketch(ModuleBase_IWorkshop* theWorkshop);
40
41   /// Returns if the preview was displayed
42   /// \return boolean value
43   bool isPreviewDisplayed() const { return myPreviewDisplayed; }
44
45   /// Returns true if the shape is one of the preview shapes
46   /// \param theShape a shape to be checked
47   /// \return boolean value
48   bool isPreviewShape(std::shared_ptr<GeomAPI_Shape> theShape);
49
50   /// Erase preview planes
51   /// \param theWorkshop the application workshop
52   void erasePreviewPlanes(ModuleBase_IWorkshop* theWorkshop);
53
54   /// Show preview planes
55   /// \param theWorkshop the application workshop
56   void showPreviewPlanes(ModuleBase_IWorkshop* theWorkshop);
57
58 private:
59      /// Create preview of planes for sketch plane selection
60    /// \param theOrigin an origin of the plane
61    /// \param theNorm a normal vector of the plane
62    /// \param theRGB a color of plane presentation [r, g, b] array
63   AISObjectPtr createPreviewPlane(std::shared_ptr<GeomAPI_Pnt> theOrigin,
64                                   std::shared_ptr<GeomAPI_Dir> theNorm,
65                                   const int theRGB[3]);
66
67 private:
68   bool myPreviewDisplayed;
69
70   AISObjectPtr myYZPlane;
71   AISObjectPtr myXZPlane;
72   AISObjectPtr myXYPlane;
73 };
74
75 #endif