e9312c0f |
1 | // Created on: 2015-12-15 |
2 | // Created by: Varvara POSKONINA |
3 | // Copyright (c) 2005-2014 OPEN CASCADE SAS |
4 | // |
5 | // This file is part of Open CASCADE Technology software library. |
6 | // |
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. |
12 | // |
13 | // Alternatively, this file may be used under the terms of Open CASCADE |
14 | // commercial license or contractual agreement. |
15 | |
16 | #ifndef _SelectMgr_ViewClipRange_HeaderFile |
17 | #define _SelectMgr_ViewClipRange_HeaderFile |
18 | |
25c35042 |
19 | #include <Bnd_Range.hxx> |
e9312c0f |
20 | #include <Standard_TypeDef.hxx> |
21 | |
22 | //! Class for handling depth clipping range. |
23 | //! It is used to perform checks in case if global (for the whole view) |
25c35042 |
24 | //! clipping planes are defined inside of SelectMgr_RectangularFrustum class methods. |
e9312c0f |
25 | class SelectMgr_ViewClipRange |
26 | { |
27 | public: |
25c35042 |
28 | //! Creates an empty clip range. |
e9312c0f |
29 | SelectMgr_ViewClipRange() |
30 | { |
25c35042 |
31 | SetVoid(); |
e9312c0f |
32 | } |
33 | |
25c35042 |
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 |
e9312c0f |
37 | { |
25c35042 |
38 | for (size_t aRangeIter = 0; aRangeIter < myRanges.size(); ++aRangeIter) |
39 | { |
40 | if (!myRanges[aRangeIter].IsOut (theDepth)) |
41 | { |
42 | return Standard_True; |
43 | } |
44 | } |
45 | return Standard_False; |
e9312c0f |
46 | } |
47 | |
25c35042 |
48 | //! Clears clipping range. |
49 | void SetVoid() |
e9312c0f |
50 | { |
25c35042 |
51 | myRanges.resize (1); |
52 | myRanges[0].SetVoid(); |
e9312c0f |
53 | } |
54 | |
25c35042 |
55 | //! Returns the main range. |
56 | Bnd_Range& ChangeMain() { return myRanges[0]; } |
e9312c0f |
57 | |
25c35042 |
58 | //! Adds a sub-range. |
59 | void AddSubRange (const Bnd_Range& theRange) { myRanges.push_back (theRange); } |
e9312c0f |
60 | |
61 | private: |
25c35042 |
62 | |
63 | std::vector<Bnd_Range> myRanges; |
64 | |
e9312c0f |
65 | }; |
66 | |
67 | #endif // _SelectMgr_ViewClipRange_HeaderFile |