0025137: The methods "Convert" point defined in the reference frame of the view into...
[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 DEFINE_STANDARD_HANDLE (V3d_Plane, MMgt_TShared)
24
25 //! Obsolete clip plane presentation class.
26 //! Ported on new core of Graphic3d_ClipPlane approach.
27 //! Please access Graphic3d_ClipPlane via ClipPlane() method
28 //! to use it for standard clipping workflow.
29 //! Example of use:
30 //! @code
31 //!
32 //! Handle(V3d_Plane) aPlane (0, 1, 0, -20);
33 //! Handle(V3d_View) aView;
34 //! aView->AddClipPlane (aPlane->ClipPlane());
35 //!
36 //! aPlane->Display (aView);
37 //! aPlane->SetPlane (0, 1, 0, -30);
38 //! aView->RemoveClipPlane (aPlane->ClipPlane());
39 //!
40 //! @endcode
41 //! Use interface of this class to modify plane equation synchronously
42 //! with clipping equation.
43 class V3d_Plane : public MMgt_TShared
44 {
45 public:
46
47   //! Creates a clipping plane from plane coefficients.
48   Standard_EXPORT V3d_Plane (const Quantity_Parameter theA = 0.0,
49                              const Quantity_Parameter theB = 0.0,
50                              const Quantity_Parameter theC = 1.0,
51                              const Quantity_Parameter theD = 0.0);
52
53   //! Change plane equation.
54   Standard_EXPORT void SetPlane (const Quantity_Parameter theA,
55                                  const Quantity_Parameter theB,
56                                  const Quantity_Parameter theC,
57                                  const Quantity_Parameter theD);
58
59   //! Display the plane representation in the choosen view.
60   Standard_EXPORT virtual void Display (const Handle(V3d_View)& theView,
61                                         const Quantity_Color& theColor = Quantity_NOC_GRAY);
62
63   //! Erase the plane representation.
64   Standard_EXPORT void Erase();
65
66   //! Returns the parameters of the plane.
67   Standard_EXPORT void Plane (Quantity_Parameter& theA,
68                               Quantity_Parameter& theB,
69                               Quantity_Parameter& theC,
70                               Quantity_Parameter& theD) const;
71
72   //! Returns TRUE when the plane representation is displayed.
73   Standard_EXPORT Standard_Boolean IsDisplayed() const;
74
75   //! Use this method to pass clipping plane implementation for
76   //! standard clipping workflow.
77   //! @return clipping plane implementation handle.
78   const Handle(Graphic3d_ClipPlane)& ClipPlane() const
79   {
80     return myPlane;
81   }
82
83 private:
84
85   //! Updates the the plane representation.
86   Standard_EXPORT void Update();
87
88 protected:
89
90   Handle(Graphic3d_Structure) myGraphicStructure;
91
92 private:
93
94   Handle(Graphic3d_ClipPlane) myPlane; //!< clip plane implementation.
95
96 public:
97
98   DEFINE_STANDARD_RTTI(V3d_Plane)
99 };
100
101 #endif