Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-06-20 08:18:29

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_ClippingIterator_Header
0015 #define OpenGl_ClippingIterator_Header
0016 
0017 #include <OpenGl_Clipping.hxx>
0018 
0019 //! The iterator through clipping planes.
0020 class OpenGl_ClippingIterator
0021 {
0022 public:
0023   //! Main constructor.
0024   OpenGl_ClippingIterator(const OpenGl_Clipping& theClipping)
0025       : myDisabled(&theClipping.myDisabledPlanes),
0026         myCurrIndex(1)
0027   {
0028     myIter1.Init(theClipping.myPlanesGlobal);
0029     myIter2.Init(theClipping.myPlanesLocal);
0030   }
0031 
0032   //! Return true if iterator points to the valid clipping plane.
0033   bool More() const { return myIter1.More() || myIter2.More(); }
0034 
0035   //! Go to the next clipping plane.
0036   void Next()
0037   {
0038     ++myCurrIndex;
0039     if (myIter1.More())
0040     {
0041       myIter1.Next();
0042     }
0043     else
0044     {
0045       myIter2.Next();
0046     }
0047   }
0048 
0049   //! Return true if plane has been temporarily disabled either by Graphic3d_ClipPlane->IsOn()
0050   //! property or by temporary filter. Beware that this method does NOT handle a Chain filter for
0051   //! Capping algorithm OpenGl_Clipping::CappedChain()!
0052   bool IsDisabled() const { return myDisabled->Value(myCurrIndex) || !Value()->IsOn(); }
0053 
0054   //! Return the plane at current iterator position.
0055   const Handle(Graphic3d_ClipPlane)& Value() const
0056   {
0057     return myIter1.More() ? myIter1.Value() : myIter2.Value();
0058   }
0059 
0060   //! Return true if plane from the global (view) list.
0061   bool IsGlobal() const { return myIter1.More(); }
0062 
0063   //! Return the plane index.
0064   Standard_Integer PlaneIndex() const { return myCurrIndex; }
0065 
0066 private:
0067   Graphic3d_SequenceOfHClipPlane::Iterator    myIter1;
0068   Graphic3d_SequenceOfHClipPlane::Iterator    myIter2;
0069   const NCollection_Vector<Standard_Boolean>* myDisabled;
0070   Standard_Integer                            myCurrIndex;
0071 };
0072 
0073 #endif // OpenGl_ClippingIterator_Header