Salome HOME
Issue #1941 Split auxiliary line.
[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 /// the plane edge width
19 #define SKETCH_WIDTH        "4"
20 /// face of the square-face displayed for selection of general plane
21 #define PLANE_SIZE          "200"
22
23 /**
24 * \class PartSet_PreviewPlanes
25 * \ingroup Modules
26 * A class to show/hide sketch preview planes
27 */
28 class PartSet_PreviewPlanes
29 {
30 public:
31   /// Constructor
32   PartSet_PreviewPlanes();
33
34   ~PartSet_PreviewPlanes() {};
35
36   /// Returns true if there is body visualized in the viewer
37   /// \param theWorkshop the application workshop
38   /// \return boolean value
39   static bool hasVisualizedBodies(ModuleBase_IWorkshop* theWorkshop);
40
41   /// Returns true if there is at least one Sketch visualized in the viewer
42   /// \param theWorkshop the application workshop
43   /// \return boolean value
44   static bool hasVisualizedSketch(ModuleBase_IWorkshop* theWorkshop);
45
46   /// Returns if the preview was displayed
47   /// \return boolean value
48   bool isPreviewDisplayed() const { return myPreviewDisplayed; }
49
50   /// Returns true if the shape is one of the preview shapes
51   /// \param theShape a shape to be checked
52   /// \return boolean value
53   bool isPreviewShape(std::shared_ptr<GeomAPI_Shape> theShape);
54
55   /// Erase preview planes
56   /// \param theWorkshop the application workshop
57   void erasePreviewPlanes(ModuleBase_IWorkshop* theWorkshop);
58
59   /// Show preview planes
60   /// \param theWorkshop the application workshop
61   void showPreviewPlanes(ModuleBase_IWorkshop* theWorkshop);
62
63 private:
64      /// Create preview of planes for sketch plane selection
65    /// \param theOrigin an origin of the plane
66    /// \param theNorm a normal vector of the plane
67    /// \param theRGB a color of plane presentation [r, g, b] array
68   AISObjectPtr createPreviewPlane(std::shared_ptr<GeomAPI_Pnt> theOrigin,
69                                   std::shared_ptr<GeomAPI_Dir> theNorm,
70                                   const int theRGB[3]);
71
72 private:
73   bool myPreviewDisplayed;
74
75   AISObjectPtr myYZPlane;
76   AISObjectPtr myXZPlane;
77   AISObjectPtr myXYPlane;
78 };
79
80 #endif