SHAPER  9.12.0
PartSet_PreviewSketchPlane.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_PreviewSketchPlane_H
21 #define PartSet_PreviewSketchPlane_H
22 
23 #include <GeomAPI_Pnt.h>
24 
25 class GeomAPI_AISObject;
26 class GeomAPI_Shape;
27 
30 
31 #include <memory>
32 
39 {
40 public:
43 
45 
49  void eraseSketchPlane(ModuleBase_IWorkshop* theWorkshop, const bool isClearPlane = true);
50 
54  void createSketchPlane(const std::shared_ptr<ModelAPI_CompositeFeature>& theSketch,
55  ModuleBase_IWorkshop* theWorkshop);
56 
63  bool getDefaultSizeOfView(const std::shared_ptr<ModelAPI_CompositeFeature>& theSketch,
64  double& theSizeOfView,
65  std::shared_ptr<GeomAPI_Pnt>& theCentralPnt);
66 
69  bool isUseSizeOfView() const { return myIsUseSizeOfView; }
70 
74  void setSizeOfView(double theSizeOfView, bool isUseSizeOfView,
75  const std::shared_ptr<GeomAPI_Pnt>& theCentralPoint = std::shared_ptr<GeomAPI_Pnt>());
76 
78  bool isPlaneCreated() const {
79  return myPlane.get();
80  }
81 
83  bool isDisplayed() const { return myPreviewIsDisplayed; }
84 
87  void displaySketchPlane(ModuleBase_IWorkshop* theWorkshop);
88 
91  void clearPlanePreview();
92 
93 private:
95  std::shared_ptr<GeomAPI_AISObject> createPreviewPlane();
96 
97 private:
98  bool myPreviewIsDisplayed;
99  std::shared_ptr<GeomAPI_AISObject> myPlane;
100  std::shared_ptr<GeomAPI_Shape> myShape;
101  std::shared_ptr<GeomAPI_Pnt> myViewCentralPoint;
102 
103  double mySizeOfView;
104  bool myIsUseSizeOfView;
105  std::shared_ptr<GeomAPI_Pnt> myViewOrigin;
106 };
107 
108 #endif
Interface for AIS_InteractiveObject.
Definition: GeomAPI_AISObject.h:39
Interface to the topological shape object.
Definition: GeomAPI_Shape.h:43
Feature that consists of other features: like sketcher with edges inside.
Definition: ModelAPI_CompositeFeature.h:33
Class which provides access to Workshop object services.
Definition: ModuleBase_IWorkshop.h:48
A class to show/hide sketch preview plane.
Definition: PartSet_PreviewSketchPlane.h:39
void eraseSketchPlane(ModuleBase_IWorkshop *theWorkshop, const bool isClearPlane=true)
Erase preview planes.
Definition: PartSet_PreviewSketchPlane.cpp:50
void setSizeOfView(double theSizeOfView, bool isUseSizeOfView, const std::shared_ptr< GeomAPI_Pnt > &theCentralPoint=std::shared_ptr< GeomAPI_Pnt >())
Sets the size of default created face.
Definition: PartSet_PreviewSketchPlane.cpp:212
bool getDefaultSizeOfView(const std::shared_ptr< ModelAPI_CompositeFeature > &theSketch, double &theSizeOfView, std::shared_ptr< GeomAPI_Pnt > &theCentralPnt)
Returns bounding box size covered the sketch sub-elements.
Definition: PartSet_PreviewSketchPlane.cpp:156
PartSet_PreviewSketchPlane()
Constructor.
Definition: PartSet_PreviewSketchPlane.cpp:45
bool isDisplayed() const
Returns current state of the plane preview visibility.
Definition: PartSet_PreviewSketchPlane.h:83
void clearPlanePreview()
Nullyfies current plane preview object.
Definition: PartSet_PreviewSketchPlane.cpp:71
void displaySketchPlane(ModuleBase_IWorkshop *theWorkshop)
Displays preview planes.
Definition: PartSet_PreviewSketchPlane.cpp:61
bool isUseSizeOfView() const
Returns whether custom size of view is set.
Definition: PartSet_PreviewSketchPlane.h:69
bool isPlaneCreated() const
Returns True if the plane preview is already created.
Definition: PartSet_PreviewSketchPlane.h:78
void createSketchPlane(const std::shared_ptr< ModelAPI_CompositeFeature > &theSketch, ModuleBase_IWorkshop *theWorkshop)
Show preview planes.
Definition: PartSet_PreviewSketchPlane.cpp:78