Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:03:50

0001 // Created on: 2014-12-18
0002 // Created by: Kirill Gavrilov
0003 // Copyright (c) 2014 OPEN CASCADE SAS
0004 //
0005 // This file is part of Open CASCADE Technology software library.
0006 //
0007 // This library is free software; you can redistribute it and/or modify it under
0008 // the terms of the GNU Lesser General Public License version 2.1 as published
0009 // by the Free Software Foundation, with special exception defined in the file
0010 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
0011 // distribution for complete text of the license and disclaimer of any warranty.
0012 //
0013 // Alternatively, this file may be used under the terms of Open CASCADE
0014 // commercial license or contractual agreement.
0015 
0016 #ifndef _Graphic3d_ViewAffinity_HeaderFile
0017 #define _Graphic3d_ViewAffinity_HeaderFile
0018 
0019 #include <Standard.hxx>
0020 #include <Standard_Transient.hxx>
0021 #include <Standard_Type.hxx>
0022 
0023 //! Structure display state.
0024 class Graphic3d_ViewAffinity : public Standard_Transient
0025 {
0026 public:
0027 
0028   //! Empty constructor.
0029   Graphic3d_ViewAffinity()
0030   {
0031     SetVisible (Standard_True);
0032   }
0033 
0034   //! Return visibility flag.
0035   bool IsVisible (const Standard_Integer theViewId) const
0036   {
0037     const unsigned int aBit = 1 << theViewId;
0038     return (myMask & aBit) != 0;
0039   }
0040 
0041   //! Setup visibility flag for all views.
0042   void SetVisible (const Standard_Boolean theIsVisible)
0043   {
0044     ::memset (&myMask, theIsVisible ? 0xFF : 0x00, sizeof(myMask));
0045   }
0046 
0047   //! Setup visibility flag.
0048   void SetVisible (const Standard_Integer theViewId,
0049                    const bool             theIsVisible)
0050   {
0051     const unsigned int aBit = 1 << theViewId;
0052     if (theIsVisible)
0053     {
0054       myMask |=  aBit;
0055     }
0056     else
0057     {
0058       myMask &= ~aBit;
0059     }
0060   }
0061 
0062   //! Dumps the content of me into the stream
0063   Standard_EXPORT void DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth = -1) const;
0064 
0065 private:
0066 
0067   unsigned int myMask; //!< affinity mask
0068 
0069 public:
0070 
0071   DEFINE_STANDARD_RTTIEXT(Graphic3d_ViewAffinity,Standard_Transient)
0072 
0073 };
0074 
0075 DEFINE_STANDARD_HANDLE(Graphic3d_ViewAffinity, Standard_Transient)
0076 
0077 #endif // _Graphic3d_ViewAffinity_HeaderFile