0024752: Visualization - inherit OpenGl_Group from Graphic3d_Group
[occt.git] / src / Graphic3d / Graphic3d_CStructure.hxx
1 // Copyright (c) 1995-1999 Matra Datavision
2 // Copyright (c) 1999-2014 OPEN CASCADE SAS
3 //
4 // This file is part of Open CASCADE Technology software library.
5 //
6 // This library is free software; you can redistribute it and/or modify it under
7 // the terms of the GNU Lesser General Public License version 2.1 as published
8 // by the Free Software Foundation, with special exception defined in the file
9 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
10 // distribution for complete text of the license and disclaimer of any warranty.
11 //
12 // Alternatively, this file may be used under the terms of Open CASCADE
13 // commercial license or contractual agreement.
14
15 #ifndef _Graphic3d_CStructure_HeaderFile
16 #define _Graphic3d_CStructure_HeaderFile
17
18 #include <Graphic3d_CStructure_Handle.hxx>
19 #include <Graphic3d_Group.hxx>
20 #include <Graphic3d_SequenceOfGroup.hxx>
21 #include <Graphic3d_SequenceOfHClipPlane.hxx>
22 #include <Graphic3d_TypeOfComposition.hxx>
23 #include <Graphic3d_Vec3.hxx>
24 #include <Standard_Transient.hxx>
25 #include <Handle_Graphic3d_GraphicDriver.hxx>
26
27 class Handle(Graphic3d_StructureManager);
28
29 //! Low-level graphic structure interface
30 class Graphic3d_CStructure : public Standard_Transient
31 {
32
33 public:
34
35   //! @return graphic driver created this structure
36   const Handle(Graphic3d_GraphicDriver)& GraphicDriver() const
37   {
38     return myGraphicDriver;
39   }
40
41   //! @return graphic groups
42   const Graphic3d_SequenceOfGroup& Groups() const
43   {
44     return myGroups;
45   }
46
47   //! @return associated clip planes
48   const Graphic3d_SequenceOfHClipPlane& ClipPlanes() const
49   {
50     return myClipPlanes;
51   }
52
53   //! Pass clip planes to the associated graphic driver structure
54   void SetClipPlanes (const Graphic3d_SequenceOfHClipPlane& thePlanes) { myClipPlanes = thePlanes; }
55
56 public:
57
58   //! Update structure visibility state
59   virtual void UpdateNamedStatus() = 0;
60
61   //! Clear graphic data
62   virtual void Clear() = 0;
63
64   //! Connect other structure to this one
65   virtual void Connect    (Graphic3d_CStructure& theStructure) = 0;
66
67   //! Disconnect other structure to this one
68   virtual void Disconnect (Graphic3d_CStructure& theStructure) = 0;
69
70   //! Synchronize structure aspects
71   virtual void UpdateAspects() = 0;
72
73   //! Synchronize structure transformation
74   virtual void UpdateTransformation() = 0;
75
76   //! Highlight entire structure with color
77   virtual void HighlightWithColor  (const Graphic3d_Vec3&  theColor,
78                                     const Standard_Boolean theToCreate) = 0;
79
80   //! Highlight structure using boundary box
81   virtual void HighlightWithBndBox (const Handle(Graphic3d_Structure)& theStruct,
82                                     const Standard_Boolean             theToCreate) = 0;
83
84   //! Create shadow link to this structure
85   virtual Handle(Graphic3d_CStructure) ShadowLink (const Handle(Graphic3d_StructureManager)& theManager) const = 0;
86
87   //! Create new group within this structure
88   virtual Handle(Graphic3d_Group) NewGroup (const Handle(Graphic3d_Structure)& theStruct) = 0;
89
90   //! Remove group from this structure
91   virtual void RemoveGroup (const Handle(Graphic3d_Group)& theGroup) = 0;
92
93 public:
94
95   int   Id;
96   int   Priority;
97   int   PreviousPriority;
98
99   CALL_DEF_CONTEXTLINE     ContextLine;
100   CALL_DEF_CONTEXTFILLAREA ContextFillArea;
101   CALL_DEF_CONTEXTMARKER   ContextMarker;
102   CALL_DEF_CONTEXTTEXT     ContextText;
103
104   CALL_DEF_BOUNDBOX BoundBox;
105
106   float Transformation[4][4];
107   Graphic3d_TypeOfComposition Composition;
108
109   int   ContainsFacet;
110
111   unsigned IsInfinite    : 1;
112   unsigned stick         : 1;
113   unsigned highlight     : 1;
114   unsigned visible       : 1;
115   unsigned pick          : 1;
116   unsigned HLRValidation : 1;
117
118   CALL_DEF_TRANSFORM_PERSISTENCE TransformPersistence;
119
120 protected:
121
122   //! Create empty structure.
123   Standard_EXPORT Graphic3d_CStructure (const Handle(Graphic3d_StructureManager)& theManager);
124
125 protected:
126
127   Handle(Graphic3d_GraphicDriver) myGraphicDriver;
128   Graphic3d_SequenceOfGroup       myGroups;
129   Graphic3d_SequenceOfHClipPlane  myClipPlanes;
130
131 public:
132
133   DEFINE_STANDARD_RTTI(Graphic3d_CStructure) // Type definition
134
135 };
136
137 #endif // _Graphic3d_CStructure_HeaderFile