0033661: Data Exchange, Step Import - Tessellated GDTs are not imported
[occt.git] / src / Graphic3d / Graphic3d_SequenceOfHClipPlane.hxx
CommitLineData
4269bd1b 1// Created on: 2013-07-15
2// Created by: Anton POLETAEV
d5f74e42 3// Copyright (c) 2013-2014 OPEN CASCADE SAS
4269bd1b 4//
973c2be1 5// This file is part of Open CASCADE Technology software library.
4269bd1b 6//
d5f74e42 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
973c2be1 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.
4269bd1b 12//
973c2be1 13// Alternatively, this file may be used under the terms of Open CASCADE
14// commercial license or contractual agreement.
4269bd1b 15
51b10cd4 16#ifndef _Graphic3d_SequenceOfHClipPlane_HeaderFile
17#define _Graphic3d_SequenceOfHClipPlane_HeaderFile
4269bd1b 18
4269bd1b 19#include <Graphic3d_ClipPlane.hxx>
20
25c35042 21//! Class defines a Clipping Volume as a logical OR (disjunction) operation between Graphic3d_ClipPlane in sequence.
22//! Each Graphic3d_ClipPlane represents either a single Plane clipping a halfspace (direction is specified by normal),
23//! or a sub-chain of planes defining a logical AND (conjunction) operation.
24//! Therefore, this collection allows defining a Clipping Volume through the limited set of Boolean operations between clipping Planes.
25//!
26//! The Clipping Volume can be assigned either to entire View or to a specific Object;
27//! in the latter case property ToOverrideGlobal() will specify if Object planes should override (suppress) globally defined ones
28//! or extend their definition through logical OR (disjunction) operation.
29//!
30//! Note that defining (many) planes will lead to performance degradation, and Graphics Driver may limit
31//! the overall number of simultaneously active clipping planes - but at least 6 planes should be supported on all configurations.
32class Graphic3d_SequenceOfHClipPlane : public Standard_Transient
3202bf1e 33{
25c35042 34 DEFINE_STANDARD_RTTIEXT(Graphic3d_SequenceOfHClipPlane, Standard_Transient)
35public:
36
37 //! Iterator through clipping planes.
38 class Iterator : public NCollection_Sequence<Handle(Graphic3d_ClipPlane)>::Iterator
39 {
40 public:
41 Iterator() {}
42 Iterator (const Graphic3d_SequenceOfHClipPlane& thePlanes) : NCollection_Sequence<Handle(Graphic3d_ClipPlane)>::Iterator (thePlanes.myItems) {}
43 Iterator (const Handle(Graphic3d_SequenceOfHClipPlane)& thePlanes) { Init (thePlanes); }
44
45 void Init (const Graphic3d_SequenceOfHClipPlane& thePlanes) { NCollection_Sequence<Handle(Graphic3d_ClipPlane)>::Iterator::Init (thePlanes.myItems); }
46 void Init (const Handle(Graphic3d_SequenceOfHClipPlane)& thePlanes)
47 {
48 if (!thePlanes.IsNull())
49 {
50 NCollection_Sequence<Handle(Graphic3d_ClipPlane)>::Iterator::Init (thePlanes->myItems);
51 }
52 else
53 {
54 *this = Iterator();
55 }
56 }
57 };
58
3202bf1e 59public:
4269bd1b 60
3202bf1e 61 //! Empty constructor.
25c35042 62 Standard_EXPORT Graphic3d_SequenceOfHClipPlane();
3202bf1e 63
64 //! Return true if local properties should override global properties.
65 Standard_Boolean ToOverrideGlobal() const { return myToOverrideGlobal; }
66
67 //! Setup flag defining if local properties should override global properties.
68 void SetOverrideGlobal (const Standard_Boolean theToOverride) { myToOverrideGlobal = theToOverride; }
69
25c35042 70 //! Return TRUE if sequence is empty.
71 bool IsEmpty() const { return myItems.IsEmpty(); }
72
73 //! Return the number of items in sequence.
74 Standard_Integer Size() const { return myItems.Size(); }
75
76 //! Append a plane.
77 //! @return TRUE if new item has been added (FALSE if item already existed)
78 Standard_EXPORT bool Append (const Handle(Graphic3d_ClipPlane)& theItem);
79
80 //! Remove a plane.
81 //! @return TRUE if item has been found and removed
82 Standard_EXPORT bool Remove (const Handle(Graphic3d_ClipPlane)& theItem);
83
84 //! Remove a plane.
85 void Remove (Iterator& theItem) { myItems.Remove (theItem); }
86
87 //! Clear the items out.
88 void Clear()
89 {
90 myItems.Clear();
91 }
92
93 //! Return the first item in sequence.
94 const Handle(Graphic3d_ClipPlane)& First() const { return myItems.First(); }
95
bc73b006 96 //! Dumps the content of me into the stream
97 Standard_EXPORT virtual void DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth = -1) const;
98
25c35042 99protected:
3202bf1e 100
25c35042 101 NCollection_Sequence<Handle(Graphic3d_ClipPlane)> myItems;
3202bf1e 102 Standard_Boolean myToOverrideGlobal;
103
104};
105
106DEFINE_STANDARD_HANDLE(Graphic3d_SequenceOfHClipPlane, Standard_Transient)
107
108#endif // _Graphic3d_SequenceOfHClipPlane_HeaderFile