Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:04:21

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 
0032   //! Construct rendering element to flip model-view matrix
0033   //! along the reference system to ensure up-Y, right-X orientation.
0034   //! @param theReferenceSystem [in] the reference coordinate system.
0035   Standard_EXPORT OpenGl_Flipper (const gp_Ax2& theReferenceSystem);
0036 
0037   //! Set options for the element.
0038   //! @param theIsEnabled [in] flag indicates whether the flipper
0039   //! matrix modification should be set up or restored back.
0040   void SetOptions (const Standard_Boolean theIsEnabled) { myIsEnabled = theIsEnabled; }
0041 
0042   Standard_EXPORT virtual void Render (const Handle(OpenGl_Workspace)& theWorkspace) const 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, Standard_Integer theDepth = -1) const Standard_OVERRIDE;
0047 
0048 public:
0049 
0050   DEFINE_STANDARD_ALLOC
0051 
0052 protected:
0053 
0054   OpenGl_Vec4      myReferenceOrigin;
0055   OpenGl_Vec4      myReferenceX;
0056   OpenGl_Vec4      myReferenceY;
0057   OpenGl_Vec4      myReferenceZ;
0058   Standard_Boolean myIsEnabled;
0059 
0060 };
0061 
0062 #endif // OpenGl_Flipper_Header