0030748: Visualization - Marker displayed in immediate layer ruins QT Quick view...
[occt.git] / src / OpenGl / OpenGl_Group.hxx
CommitLineData
b311480e 1// Created on: 2011-08-01
2// Created by: Sergey ZERCHANINOV
973c2be1 3// Copyright (c) 2011-2014 OPEN CASCADE SAS
b311480e 4//
973c2be1 5// This file is part of Open CASCADE Technology software library.
b311480e 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.
b311480e 12//
973c2be1 13// Alternatively, this file may be used under the terms of Open CASCADE
14// commercial license or contractual agreement.
b311480e 15
2166f0fa
SK
16#ifndef _OpenGl_Group_Header
17#define _OpenGl_Group_Header
18
b64d84be 19#include <Graphic3d_Group.hxx>
20#include <Graphic3d_Structure.hxx>
2166f0fa 21
b64d84be 22#include <NCollection_List.hxx>
bf5f0ca2 23#include <OpenGl_Aspects.hxx>
b64d84be 24#include <OpenGl_Element.hxx>
2166f0fa 25
4269bd1b 26class OpenGl_Group;
e276548b 27class OpenGl_Structure;
4269bd1b 28
2166f0fa
SK
29struct OpenGl_ElementNode
30{
5322131b 31 OpenGl_Element* elem;
32 OpenGl_ElementNode* next;
1c35b92f 33 DEFINE_STANDARD_ALLOC
2166f0fa
SK
34};
35
b64d84be 36//! Implementation of low-level graphic group.
37class OpenGl_Group : public Graphic3d_Group
2166f0fa 38{
5e27df78 39public:
40
b64d84be 41 //! Create empty group.
42 //! Will throw exception if not created by OpenGl_Structure.
43 Standard_EXPORT OpenGl_Group (const Handle(Graphic3d_Structure)& theStruct);
44
79104795 45 Standard_EXPORT virtual void Clear (const Standard_Boolean theToUpdateStructureMgr) Standard_OVERRIDE;
b64d84be 46
b6472664 47 //! Return line aspect.
bf5f0ca2 48 virtual Handle(Graphic3d_Aspects) Aspects() const Standard_OVERRIDE
b6472664 49 {
bf5f0ca2 50 return myAspects != NULL
51 ? myAspects->Aspect()
52 : Handle(Graphic3d_Aspects)();
b6472664 53 }
54
bf5f0ca2 55 //! Update aspect.
56 Standard_EXPORT virtual void SetGroupPrimitivesAspect (const Handle(Graphic3d_Aspects)& theAspect) Standard_OVERRIDE;
b6472664 57
bf5f0ca2 58 //! Append aspect as an element.
59 Standard_EXPORT virtual void SetPrimitivesAspect (const Handle(Graphic3d_Aspects)& theAspect) Standard_OVERRIDE;
2166f0fa 60
eaac0866 61 //! Update presentation aspects after their modification.
62 Standard_EXPORT virtual void SynchronizeAspects() Standard_OVERRIDE;
63
bf5f0ca2 64 //! Replace aspects specified in the replacement map.
65 Standard_EXPORT virtual void ReplaceAspects (const Graphic3d_MapOfAspectsToAspects& theMap) Standard_OVERRIDE;
66
b64d84be 67 //! Add primitive array element
871fa103 68 Standard_EXPORT virtual void AddPrimitiveArray (const Graphic3d_TypeOfPrimitiveArray theType,
69 const Handle(Graphic3d_IndexBuffer)& theIndices,
70 const Handle(Graphic3d_Buffer)& theAttribs,
71 const Handle(Graphic3d_BoundBuffer)& theBounds,
79104795 72 const Standard_Boolean theToEvalMinMax) Standard_OVERRIDE;
2166f0fa 73
b64d84be 74 //! Add text element
75 Standard_EXPORT virtual void Text (const Standard_CString theTextUtf,
76 const Graphic3d_Vertex& thePoint,
77 const Standard_Real theHeight,
ee2be2a8 78 const Standard_Real theAngle,
b64d84be 79 const Graphic3d_TextPath theTp,
80 const Graphic3d_HorizontalTextAlignment theHta,
81 const Graphic3d_VerticalTextAlignment theVta,
79104795 82 const Standard_Boolean theToEvalMinMax) Standard_OVERRIDE;
2166f0fa 83
ce01ec26 84 //! Add text element in 3D space.
85 Standard_EXPORT virtual void Text (const Standard_CString theTextUtf,
86 const gp_Ax2& theOrientation,
87 const Standard_Real theHeight,
ee2be2a8 88 const Standard_Real theAngle,
ce01ec26 89 const Graphic3d_TextPath theTp,
90 const Graphic3d_HorizontalTextAlignment theHTA,
91 const Graphic3d_VerticalTextAlignment theVTA,
3f1eb0ab 92 const Standard_Boolean theToEvalMinMax,
93 const Standard_Boolean theHasOwnAnchor = Standard_True) Standard_OVERRIDE;
ce01ec26 94
b64d84be 95 //! Add flipping element
96 Standard_EXPORT virtual void SetFlippingOptions (const Standard_Boolean theIsEnabled,
79104795 97 const gp_Ax2& theRefPlane) Standard_OVERRIDE;
b64d84be 98
99 //! Add stencil test element
79104795 100 Standard_EXPORT virtual void SetStencilTestOptions (const Standard_Boolean theIsEnabled) Standard_OVERRIDE;
b64d84be 101
102public:
103
104 OpenGl_Structure* GlStruct() const { return (OpenGl_Structure* )(myStructure->CStructure().operator->()); }
105
106 Standard_EXPORT void AddElement (OpenGl_Element* theElem);
107
108 Standard_EXPORT virtual void Render (const Handle(OpenGl_Workspace)& theWorkspace) const;
109 Standard_EXPORT virtual void Release (const Handle(OpenGl_Context)& theGlCtx);
2166f0fa 110
e276548b 111 //! Returns first OpenGL element node of the group.
112 const OpenGl_ElementNode* FirstNode() const { return myFirst; }
113
bf5f0ca2 114 //! Returns OpenGL aspect.
115 const OpenGl_Aspects* GlAspects() const { return myAspects; }
e276548b 116
e276548b 117 //! Is the group ray-tracable (contains ray-tracable elements)?
118 Standard_Boolean IsRaytracable() const { return myIsRaytracable; }
119
5e27df78 120protected:
2166f0fa 121
b64d84be 122 Standard_EXPORT virtual ~OpenGl_Group();
5e27df78 123
124protected:
2166f0fa 125
bf5f0ca2 126 OpenGl_Aspects* myAspects;
127 OpenGl_ElementNode* myFirst;
128 OpenGl_ElementNode* myLast;
129 Standard_Boolean myIsRaytracable;
5e27df78 130
131public:
2166f0fa 132
92efcf78 133 DEFINE_STANDARD_RTTIEXT(OpenGl_Group,Graphic3d_Group) // Type definition
5e27df78 134
2166f0fa
SK
135};
136
b64d84be 137DEFINE_STANDARD_HANDLE(OpenGl_Group, Graphic3d_Group)
138
139#endif // _OpenGl_Group_Header