SHAPER  9.12.0
PartSet_PreviewPlanes.h
1 // Copyright (C) 2014-2023 CEA, EDF
2 //
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.
7 //
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.
12 //
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
16 //
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18 //
19 
20 #ifndef PartSet_PreviewPlanes_H
21 #define PartSet_PreviewPlanes_H
22 
23 #include <GeomAPI_AISObject.h>
24 
25 #include <GeomAPI_Pnt.h>
26 #include <GeomAPI_Dir.h>
27 #include <GeomAPI_AISObject.h>
28 
30 
37 {
38 public:
41 
43 
47  static bool hasVisualizedBodies(ModuleBase_IWorkshop* theWorkshop);
48 
52  static bool hasVisualizedSketch(ModuleBase_IWorkshop* theWorkshop);
53 
56  bool isPreviewDisplayed() const { return myPreviewDisplayed; }
57 
61  bool isPreviewShape(std::shared_ptr<GeomAPI_Shape> theShape);
62 
65  void erasePreviewPlanes(ModuleBase_IWorkshop* theWorkshop);
66 
69  void showPreviewPlanes(ModuleBase_IWorkshop* theWorkshop);
70 
71 private:
76  AISObjectPtr createPreviewPlane(std::shared_ptr<GeomAPI_Pnt> theOrigin,
77  std::shared_ptr<GeomAPI_Dir> theNorm,
78  const int theRGB[3]);
79 
80 private:
81  bool myPreviewDisplayed;
82 
83  AISObjectPtr myYZPlane;
84  AISObjectPtr myXZPlane;
85  AISObjectPtr myXYPlane;
86 };
87 
88 #endif
Class which provides access to Workshop object services.
Definition: ModuleBase_IWorkshop.h:48
A class to show/hide sketch preview planes.
Definition: PartSet_PreviewPlanes.h:37
static bool hasVisualizedSketch(ModuleBase_IWorkshop *theWorkshop)
Returns true if there is at least one Sketch visualized in the viewer.
Definition: PartSet_PreviewPlanes.cpp:67
bool isPreviewDisplayed() const
Returns if the preview was displayed.
Definition: PartSet_PreviewPlanes.h:56
bool isPreviewShape(std::shared_ptr< GeomAPI_Shape > theShape)
Returns true if the shape is one of the preview shapes.
Definition: PartSet_PreviewPlanes.cpp:92
PartSet_PreviewPlanes()
Constructor.
Definition: PartSet_PreviewPlanes.cpp:37
static bool hasVisualizedBodies(ModuleBase_IWorkshop *theWorkshop)
Returns true if there is body visualized in the viewer.
Definition: PartSet_PreviewPlanes.cpp:42
void erasePreviewPlanes(ModuleBase_IWorkshop *theWorkshop)
Erase preview planes.
Definition: PartSet_PreviewPlanes.cpp:99
void showPreviewPlanes(ModuleBase_IWorkshop *theWorkshop)
Show preview planes.
Definition: PartSet_PreviewPlanes.cpp:110