0029395: Visualization, V3d_View - Grid disappears forever after enabling RayTracing
[occt.git] / src / V3d / V3d_Plane.hxx
1 // Created by: GG
2 // Copyright (c) 1991-1999 Matra Datavision
3 // Copyright (c) 1999-2013 OPEN CASCADE SAS
4 //
5 // This file is part of Open CASCADE Technology software library.
6 //
7 // This library is free software; you can redistribute it and/or modify it under
8 // the terms of the GNU Lesser General Public License version 2.1 as published
9 // by the Free Software Foundation, with special exception defined in the file
10 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
11 // distribution for complete text of the license and disclaimer of any warranty.
12 //
13 // Alternatively, this file may be used under the terms of Open CASCADE
14 // commercial license or contractual agreement.
15
16 #ifndef _V3d_Plane_H__
17 #define _V3d_Plane_H__
18
19 #include <Graphic3d_ClipPlane.hxx>
20 #include <Graphic3d_Structure.hxx>
21 #include <V3d_View.hxx>
22
23 class V3d_Plane;
24 DEFINE_STANDARD_HANDLE (V3d_Plane, Standard_Transient)
25
26 //! Obsolete clip plane presentation class.
27 //! Ported on new core of Graphic3d_ClipPlane approach.
28 //! Please access Graphic3d_ClipPlane via ClipPlane() method
29 //! to use it for standard clipping workflow.
30 //! Example of use:
31 //! @code
32 //!
33 //! Handle(V3d_Plane) aPlane (0, 1, 0, -20);
34 //! Handle(V3d_View) aView;
35 //! aView->AddClipPlane (aPlane->ClipPlane());
36 //!
37 //! aPlane->Display (aView);
38 //! aPlane->SetPlane (0, 1, 0, -30);
39 //! aView->RemoveClipPlane (aPlane->ClipPlane());
40 //!
41 //! @endcode
42 //! Use interface of this class to modify plane equation synchronously
43 //! with clipping equation.
44 class V3d_Plane : public Standard_Transient
45 {
46 public:
47
48   //! Creates a clipping plane from plane coefficients.
49   Standard_EXPORT V3d_Plane (const Standard_Real theA = 0.0,
50                              const Standard_Real theB = 0.0,
51                              const Standard_Real theC = 1.0,
52                              const Standard_Real theD = 0.0);
53
54   //! Change plane equation.
55   Standard_EXPORT void SetPlane (const Standard_Real theA,
56                                  const Standard_Real theB,
57                                  const Standard_Real theC,
58                                  const Standard_Real theD);
59
60   //! Display the plane representation in the choosen view.
61   Standard_EXPORT virtual void Display (const Handle(V3d_View)& theView,
62                                         const Quantity_Color& theColor = Quantity_NOC_GRAY);
63
64   //! Erase the plane representation.
65   Standard_EXPORT void Erase();
66
67   //! Returns the parameters of the plane.
68   Standard_EXPORT void Plane (Standard_Real& theA,
69                               Standard_Real& theB,
70                               Standard_Real& theC,
71                               Standard_Real& theD) const;
72
73   //! Returns TRUE when the plane representation is displayed.
74   Standard_EXPORT Standard_Boolean IsDisplayed() const;
75
76   //! Use this method to pass clipping plane implementation for
77   //! standard clipping workflow.
78   //! @return clipping plane implementation handle.
79   const Handle(Graphic3d_ClipPlane)& ClipPlane() const
80   {
81     return myPlane;
82   }
83
84 private:
85
86   //! Updates the the plane representation.
87   Standard_EXPORT void Update();
88
89 protected:
90
91   Handle(Graphic3d_Structure) myGraphicStructure;
92
93 private:
94
95   Handle(Graphic3d_ClipPlane) myPlane; //!< clip plane implementation.
96
97 public:
98
99   DEFINE_STANDARD_RTTIEXT(V3d_Plane,Standard_Transient)
100 };
101
102 #endif