1 // Created on: 2015-12-15
2 // Created by: Varvara POSKONINA
3 // Copyright (c) 2005-2014 OPEN CASCADE SAS
5 // This file is part of Open CASCADE Technology software library.
7 // This library is free software; you can redistribute it and/or modify it under
8 // the terms of the GNU Lesser General Public License version 2.1 as published
9 // by the Free Software Foundation, with special exception defined in the file
10 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
11 // distribution for complete text of the license and disclaimer of any warranty.
13 // Alternatively, this file may be used under the terms of Open CASCADE
14 // commercial license or contractual agreement.
16 #ifndef _SelectMgr_ViewClipRange_HeaderFile
17 #define _SelectMgr_ViewClipRange_HeaderFile
19 #include <Bnd_Range.hxx>
20 #include <Standard_TypeDef.hxx>
22 //! Class for handling depth clipping range.
23 //! It is used to perform checks in case if global (for the whole view)
24 //! clipping planes are defined inside of SelectMgr_RectangularFrustum class methods.
25 class SelectMgr_ViewClipRange
28 //! Creates an empty clip range.
29 SelectMgr_ViewClipRange()
34 //! Check if the given depth is not within clipping range(s),
35 //! e.g. TRUE means depth is clipped.
36 Standard_Boolean IsClipped (const Standard_Real theDepth) const
38 if (myUnclipRange.IsOut (theDepth))
42 for (size_t aRangeIter = 0; aRangeIter < myClipRanges.size(); ++aRangeIter)
44 if (!myClipRanges[aRangeIter].IsOut (theDepth))
49 return Standard_False;
52 //! Clears clipping range.
55 myClipRanges.resize (0);
56 myUnclipRange = Bnd_Range (RealFirst(), RealLast());
59 //! Returns the main unclipped range; [-inf, inf] by default.
60 Bnd_Range& ChangeUnclipRange() { return myUnclipRange; }
62 //! Adds a clipping sub-range (for clipping chains).
63 void AddClipSubRange (const Bnd_Range& theRange) { myClipRanges.push_back (theRange); }
67 std::vector<Bnd_Range> myClipRanges;
68 Bnd_Range myUnclipRange;
72 #endif // _SelectMgr_ViewClipRange_HeaderFile