1 // Copyright (C) 2014-2017 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
18 // email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
21 #ifndef PartSet_PreviewPlanes_H
22 #define PartSet_PreviewPlanes_H
24 #include <GeomAPI_AISObject.h>
26 #include <GeomAPI_Pnt.h>
27 #include <GeomAPI_Dir.h>
28 #include <GeomAPI_AISObject.h>
30 class ModuleBase_IWorkshop;
33 * \class PartSet_PreviewPlanes
35 * A class to show/hide sketch preview planes
37 class PartSet_PreviewPlanes
41 PartSet_PreviewPlanes();
43 ~PartSet_PreviewPlanes() {};
45 /// Returns true if there is body visualized in the viewer
46 /// \param theWorkshop the application workshop
47 /// \return boolean value
48 static bool hasVisualizedBodies(ModuleBase_IWorkshop* theWorkshop);
50 /// Returns true if there is at least one Sketch visualized in the viewer
51 /// \param theWorkshop the application workshop
52 /// \return boolean value
53 static bool hasVisualizedSketch(ModuleBase_IWorkshop* theWorkshop);
55 /// Returns if the preview was displayed
56 /// \return boolean value
57 bool isPreviewDisplayed() const { return myPreviewDisplayed; }
59 /// Returns true if the shape is one of the preview shapes
60 /// \param theShape a shape to be checked
61 /// \return boolean value
62 bool isPreviewShape(std::shared_ptr<GeomAPI_Shape> theShape);
64 /// Erase preview planes
65 /// \param theWorkshop the application workshop
66 void erasePreviewPlanes(ModuleBase_IWorkshop* theWorkshop);
68 /// Show preview planes
69 /// \param theWorkshop the application workshop
70 void showPreviewPlanes(ModuleBase_IWorkshop* theWorkshop);
73 /// Create preview of planes for sketch plane selection
74 /// \param theOrigin an origin of the plane
75 /// \param theNorm a normal vector of the plane
76 /// \param theRGB a color of plane presentation [r, g, b] array
77 AISObjectPtr createPreviewPlane(std::shared_ptr<GeomAPI_Pnt> theOrigin,
78 std::shared_ptr<GeomAPI_Dir> theNorm,
82 bool myPreviewDisplayed;
84 AISObjectPtr myYZPlane;
85 AISObjectPtr myXZPlane;
86 AISObjectPtr myXYPlane;