0024391: Erased AIS object can not be displayed in AIS_InteractiveContext after AIS_I...
[occt.git] / src / OpenGl / OpenGl_Flipper.hxx
1 // Copyright (c) 2013 OPEN CASCADE SAS
2 //
3 // The content of this file is subject to the Open CASCADE Technology Public
4 // License Version 6.5 (the "License"). You may not use the content of this file
5 // except in compliance with the License. Please obtain a copy of the License
6 // at http://www.opencascade.org and read it completely before using this file.
7 //
8 // The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
9 // main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
10 //
11 // The Original Code and all software distributed under the License is
12 // distributed on an "AS IS" basis, without warranty of any kind, and the
13 // Initial Developer hereby disclaims all such warranties, including without
14 // limitation, any warranties of merchantability, fitness for a particular
15 // purpose or non-infringement. Please see the License for the specific terms
16 // and conditions governing the rights and limitations under the License.
17
18 #ifndef OpenGl_Flipper_Header
19 #define OpenGl_Flipper_Header
20
21 #include <OpenGl_Element.hxx>
22 #include <OpenGl_Vec.hxx>
23 #include <Handle_OpenGl_Workspace.hxx>
24
25 class gp_Ax2;
26
27 //! Being rendered, the elements modifies current model-view matrix such that the axes of
28 //! the specified reference system (in model space) become oriented in the following way:
29 //! - X    - heads to the right side of view.
30 //! - Y    - heads to the up side of view.
31 //! - N(Z) - heads towards the screen.
32 //! Originally, this element serves for need of flipping the 3D text of dimension presentations.
33 class OpenGl_Flipper : public OpenGl_Element
34 {
35 public:
36
37   //! Construct rendering element to flip model-view matrix
38   //! along the reference system to ensure up-Y, right-X orientation.
39   //! @param theReferenceSystem [in] the reference coordinate system.
40   Standard_EXPORT OpenGl_Flipper (const gp_Ax2& theReferenceSystem);
41
42   //! Set options for the element.
43   //! @param theIsEnabled [in] flag indicates whether the flipper
44   //! matrix modification should be set up or restored back.
45   void SetOptions (const Standard_Boolean theIsEnabled) { myIsEnabled = theIsEnabled; }
46
47   Standard_EXPORT virtual void Render (const Handle(OpenGl_Workspace)& theWorkspace) const;
48   Standard_EXPORT virtual void Release (const Handle(OpenGl_Context)&  theCtx);
49
50 public:
51
52   DEFINE_STANDARD_ALLOC
53
54 protected:
55
56   OpenGl_Vec4      myReferenceOrigin;
57   OpenGl_Vec4      myReferenceX;
58   OpenGl_Vec4      myReferenceY;
59   OpenGl_Vec4      myReferenceZ;
60   Standard_Boolean myIsEnabled;
61
62 };
63
64 #endif // OpenGl_Flipper_Header