Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-06-25 08:30:05

0001 // Copyright (c) 2013-2014 OPEN CASCADE SAS
0002 //
0003 // This file is part of Open CASCADE Technology software library.
0004 //
0005 // This library is free software; you can redistribute it and/or modify it under
0006 // the terms of the GNU Lesser General Public License version 2.1 as published
0007 // by the Free Software Foundation, with special exception defined in the file
0008 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
0009 // distribution for complete text of the license and disclaimer of any warranty.
0010 //
0011 // Alternatively, this file may be used under the terms of Open CASCADE
0012 // commercial license or contractual agreement.
0013 
0014 #ifndef OpenGl_Flipper_HeaderFile
0015 #define OpenGl_Flipper_HeaderFile
0016 
0017 #include <OpenGl_Element.hxx>
0018 #include <OpenGl_Vec.hxx>
0019 
0020 class gp_Ax2;
0021 
0022 //! Being rendered, the elements modifies current model-view matrix such that the axes of
0023 //! the specified reference system (in model space) become oriented in the following way:
0024 //! - X    - heads to the right side of view.
0025 //! - Y    - heads to the up side of view.
0026 //! - N(Z) - heads towards the screen.
0027 //! Originally, this element serves for need of flipping the 3D text of dimension presentations.
0028 class OpenGl_Flipper : public OpenGl_Element
0029 {
0030 public:
0031   //! Construct rendering element to flip model-view matrix
0032   //! along the reference system to ensure up-Y, right-X orientation.
0033   //! @param[in] theReferenceSystem  the reference coordinate system.
0034   Standard_EXPORT OpenGl_Flipper(const gp_Ax2& theReferenceSystem);
0035 
0036   //! Set options for the element.
0037   //! @param[in] theIsEnabled  flag indicates whether the flipper
0038   //! matrix modification should be set up or restored back.
0039   void SetOptions(const Standard_Boolean theIsEnabled) { myIsEnabled = theIsEnabled; }
0040 
0041   Standard_EXPORT virtual void Render(const Handle(OpenGl_Workspace)& theWorkspace) const
0042     Standard_OVERRIDE;
0043   Standard_EXPORT virtual void Release(OpenGl_Context* theCtx) Standard_OVERRIDE;
0044 
0045   //! Dumps the content of me into the stream
0046   Standard_EXPORT virtual void DumpJson(Standard_OStream& theOStream,
0047                                         Standard_Integer  theDepth = -1) const Standard_OVERRIDE;
0048 
0049 public:
0050   DEFINE_STANDARD_ALLOC
0051 
0052 protected:
0053   OpenGl_Vec4      myReferenceOrigin;
0054   OpenGl_Vec4      myReferenceX;
0055   OpenGl_Vec4      myReferenceY;
0056   OpenGl_Vec4      myReferenceZ;
0057   Standard_Boolean myIsEnabled;
0058 };
0059 
0060 #endif // OpenGl_Flipper_Header