1 // Copyright (C) 2014-2019 CEA/DEN, EDF R&D
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.
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.
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
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
20 #ifndef PartSet_PreviewPlanes_H
21 #define PartSet_PreviewPlanes_H
23 #include <GeomAPI_AISObject.h>
25 #include <GeomAPI_Pnt.h>
26 #include <GeomAPI_Dir.h>
27 #include <GeomAPI_AISObject.h>
29 class ModuleBase_IWorkshop;
32 * \class PartSet_PreviewPlanes
34 * A class to show/hide sketch preview planes
36 class PartSet_PreviewPlanes
40 PartSet_PreviewPlanes();
42 ~PartSet_PreviewPlanes() {};
44 /// Returns true if there is body visualized in the viewer
45 /// \param theWorkshop the application workshop
46 /// \return boolean value
47 static bool hasVisualizedBodies(ModuleBase_IWorkshop* theWorkshop);
49 /// Returns true if there is at least one Sketch visualized in the viewer
50 /// \param theWorkshop the application workshop
51 /// \return boolean value
52 static bool hasVisualizedSketch(ModuleBase_IWorkshop* theWorkshop);
54 /// Returns if the preview was displayed
55 /// \return boolean value
56 bool isPreviewDisplayed() const { return myPreviewDisplayed; }
58 /// Returns true if the shape is one of the preview shapes
59 /// \param theShape a shape to be checked
60 /// \return boolean value
61 bool isPreviewShape(std::shared_ptr<GeomAPI_Shape> theShape);
63 /// Erase preview planes
64 /// \param theWorkshop the application workshop
65 void erasePreviewPlanes(ModuleBase_IWorkshop* theWorkshop);
67 /// Show preview planes
68 /// \param theWorkshop the application workshop
69 void showPreviewPlanes(ModuleBase_IWorkshop* theWorkshop);
72 /// Create preview of planes for sketch plane selection
73 /// \param theOrigin an origin of the plane
74 /// \param theNorm a normal vector of the plane
75 /// \param theRGB a color of plane presentation [r, g, b] array
76 AISObjectPtr createPreviewPlane(std::shared_ptr<GeomAPI_Pnt> theOrigin,
77 std::shared_ptr<GeomAPI_Dir> theNorm,
81 bool myPreviewDisplayed;
83 AISObjectPtr myYZPlane;
84 AISObjectPtr myXZPlane;
85 AISObjectPtr myXYPlane;