Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-05-04 08:45:30

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   //! Empty constructor.
0028   Graphic3d_ViewAffinity() { SetVisible(Standard_True); }
0029 
0030   //! Return visibility flag.
0031   bool IsVisible(const Standard_Integer theViewId) const
0032   {
0033     const unsigned int aBit = 1 << theViewId;
0034     return (myMask & aBit) != 0;
0035   }
0036 
0037   //! Setup visibility flag for all views.
0038   void SetVisible(const Standard_Boolean theIsVisible)
0039   {
0040     ::memset(&myMask, theIsVisible ? 0xFF : 0x00, sizeof(myMask));
0041   }
0042 
0043   //! Setup visibility flag.
0044   void SetVisible(const Standard_Integer theViewId, const bool theIsVisible)
0045   {
0046     const unsigned int aBit = 1 << theViewId;
0047     if (theIsVisible)
0048     {
0049       myMask |= aBit;
0050     }
0051     else
0052     {
0053       myMask &= ~aBit;
0054     }
0055   }
0056 
0057   //! Dumps the content of me into the stream
0058   Standard_EXPORT void DumpJson(Standard_OStream& theOStream, Standard_Integer theDepth = -1) const;
0059 
0060 private:
0061   unsigned int myMask; //!< affinity mask
0062 
0063 public:
0064   DEFINE_STANDARD_RTTIEXT(Graphic3d_ViewAffinity, Standard_Transient)
0065 };
0066 
0067 DEFINE_STANDARD_HANDLE(Graphic3d_ViewAffinity, Standard_Transient)
0068 
0069 #endif // _Graphic3d_ViewAffinity_HeaderFile