0028316: Coding Rules - Elimilate confusing aliases of Standard_Real type in V3d_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>
2166f0fa
SK
23#include <OpenGl_AspectLine.hxx>
24#include <OpenGl_AspectFace.hxx>
25#include <OpenGl_AspectMarker.hxx>
26#include <OpenGl_AspectText.hxx>
b64d84be 27#include <OpenGl_Element.hxx>
2166f0fa 28
4269bd1b 29class OpenGl_Group;
e276548b 30class OpenGl_Structure;
4269bd1b 31
2166f0fa
SK
32struct OpenGl_ElementNode
33{
5322131b 34 OpenGl_Element* elem;
35 OpenGl_ElementNode* next;
1c35b92f 36 DEFINE_STANDARD_ALLOC
2166f0fa
SK
37};
38
b64d84be 39//! Implementation of low-level graphic group.
40class OpenGl_Group : public Graphic3d_Group
2166f0fa 41{
5e27df78 42public:
43
b64d84be 44 //! Create empty group.
45 //! Will throw exception if not created by OpenGl_Structure.
46 Standard_EXPORT OpenGl_Group (const Handle(Graphic3d_Structure)& theStruct);
47
79104795 48 Standard_EXPORT virtual void Clear (const Standard_Boolean theToUpdateStructureMgr) Standard_OVERRIDE;
b64d84be 49
b6472664 50 //! Return line aspect.
51 virtual Handle(Graphic3d_AspectLine3d) LineAspect() const Standard_OVERRIDE
52 {
53 return myAspectLine != NULL
54 ? myAspectLine->Aspect()
55 : Handle(Graphic3d_AspectLine3d)();
56 }
57
58 //! Update line aspect.
59 Standard_EXPORT virtual void SetGroupPrimitivesAspect (const Handle(Graphic3d_AspectLine3d)& theAspect) Standard_OVERRIDE;
60
61 //! Append line aspect as an element.
62 Standard_EXPORT virtual void SetPrimitivesAspect (const Handle(Graphic3d_AspectLine3d)& theAspect) Standard_OVERRIDE;
63
64 //! Return marker aspect.
65 virtual Handle(Graphic3d_AspectMarker3d) MarkerAspect() const Standard_OVERRIDE
66 {
67 return myAspectMarker != NULL
68 ? myAspectMarker->Aspect()
69 : Handle(Graphic3d_AspectMarker3d)();
70 }
71
72 //! Update marker aspect.
73 Standard_EXPORT virtual void SetGroupPrimitivesAspect (const Handle(Graphic3d_AspectMarker3d)& theAspect) Standard_OVERRIDE;
74
75 //! Append marker aspect as an element.
76 Standard_EXPORT virtual void SetPrimitivesAspect (const Handle(Graphic3d_AspectMarker3d)& theAspect) Standard_OVERRIDE;
77
78 //! Return fill area aspect.
79 virtual Handle(Graphic3d_AspectFillArea3d) FillAreaAspect() const Standard_OVERRIDE
80 {
81 return myAspectFace != NULL
82 ? myAspectFace->Aspect()
83 : Handle(Graphic3d_AspectFillArea3d)();
84 }
85
86 //! Update face aspect.
87 Standard_EXPORT virtual void SetGroupPrimitivesAspect (const Handle(Graphic3d_AspectFillArea3d)& theAspect) Standard_OVERRIDE;
88
89 //! Append face aspect as an element.
90 Standard_EXPORT virtual void SetPrimitivesAspect (const Handle(Graphic3d_AspectFillArea3d)& theAspect) Standard_OVERRIDE;
91
92 //! Return marker aspect.
93 virtual Handle(Graphic3d_AspectText3d) TextAspect() const Standard_OVERRIDE
94 {
95 return myAspectText != NULL
96 ? myAspectText->Aspect()
97 : Handle(Graphic3d_AspectText3d)();
98 }
99
100 //! Update text aspect.
101 Standard_EXPORT virtual void SetGroupPrimitivesAspect (const Handle(Graphic3d_AspectText3d)& theAspect) Standard_OVERRIDE;
102
103 //! Append text aspect as an element.
104 Standard_EXPORT virtual void SetPrimitivesAspect (const Handle(Graphic3d_AspectText3d)& theAspect) Standard_OVERRIDE;
2166f0fa 105
b64d84be 106 //! Add primitive array element
871fa103 107 Standard_EXPORT virtual void AddPrimitiveArray (const Graphic3d_TypeOfPrimitiveArray theType,
108 const Handle(Graphic3d_IndexBuffer)& theIndices,
109 const Handle(Graphic3d_Buffer)& theAttribs,
110 const Handle(Graphic3d_BoundBuffer)& theBounds,
79104795 111 const Standard_Boolean theToEvalMinMax) Standard_OVERRIDE;
2166f0fa 112
b64d84be 113 //! Add text element
114 Standard_EXPORT virtual void Text (const Standard_CString theTextUtf,
115 const Graphic3d_Vertex& thePoint,
116 const Standard_Real theHeight,
ee2be2a8 117 const Standard_Real theAngle,
b64d84be 118 const Graphic3d_TextPath theTp,
119 const Graphic3d_HorizontalTextAlignment theHta,
120 const Graphic3d_VerticalTextAlignment theVta,
79104795 121 const Standard_Boolean theToEvalMinMax) Standard_OVERRIDE;
2166f0fa 122
ce01ec26 123 //! Add text element in 3D space.
124 Standard_EXPORT virtual void Text (const Standard_CString theTextUtf,
125 const gp_Ax2& theOrientation,
126 const Standard_Real theHeight,
ee2be2a8 127 const Standard_Real theAngle,
ce01ec26 128 const Graphic3d_TextPath theTp,
129 const Graphic3d_HorizontalTextAlignment theHTA,
130 const Graphic3d_VerticalTextAlignment theVTA,
3f1eb0ab 131 const Standard_Boolean theToEvalMinMax,
132 const Standard_Boolean theHasOwnAnchor = Standard_True) Standard_OVERRIDE;
ce01ec26 133
b64d84be 134 //! Add flipping element
135 Standard_EXPORT virtual void SetFlippingOptions (const Standard_Boolean theIsEnabled,
79104795 136 const gp_Ax2& theRefPlane) Standard_OVERRIDE;
b64d84be 137
138 //! Add stencil test element
79104795 139 Standard_EXPORT virtual void SetStencilTestOptions (const Standard_Boolean theIsEnabled) Standard_OVERRIDE;
b64d84be 140
141public:
142
143 OpenGl_Structure* GlStruct() const { return (OpenGl_Structure* )(myStructure->CStructure().operator->()); }
144
145 Standard_EXPORT void AddElement (OpenGl_Element* theElem);
146
147 Standard_EXPORT virtual void Render (const Handle(OpenGl_Workspace)& theWorkspace) const;
148 Standard_EXPORT virtual void Release (const Handle(OpenGl_Context)& theGlCtx);
2166f0fa 149
e276548b 150 //! Returns first OpenGL element node of the group.
151 const OpenGl_ElementNode* FirstNode() const { return myFirst; }
152
153 //! Returns OpenGL face aspect.
154 const OpenGl_AspectFace* AspectFace() const { return myAspectFace; }
155
e276548b 156 //! Is the group ray-tracable (contains ray-tracable elements)?
157 Standard_Boolean IsRaytracable() const { return myIsRaytracable; }
158
5e27df78 159protected:
2166f0fa 160
b64d84be 161 Standard_EXPORT virtual ~OpenGl_Group();
5e27df78 162
163protected:
2166f0fa 164
e276548b 165 OpenGl_AspectLine* myAspectLine;
166 OpenGl_AspectFace* myAspectFace;
167 OpenGl_AspectMarker* myAspectMarker;
168 OpenGl_AspectText* myAspectText;
169
170 OpenGl_ElementNode* myFirst;
171 OpenGl_ElementNode* myLast;
5322131b 172
b64d84be 173 Standard_Boolean myIsRaytracable;
5e27df78 174
175public:
2166f0fa 176
92efcf78 177 DEFINE_STANDARD_RTTIEXT(OpenGl_Group,Graphic3d_Group) // Type definition
5e27df78 178
2166f0fa
SK
179};
180
b64d84be 181DEFINE_STANDARD_HANDLE(OpenGl_Group, Graphic3d_Group)
182
183#endif // _OpenGl_Group_Header