1 // Copyright (c) 1995-1999 Matra Datavision
2 // Copyright (c) 1999-2014 OPEN CASCADE SAS
4 // This file is part of Open CASCADE Technology software library.
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.
12 // Alternatively, this file may be used under the terms of Open CASCADE
13 // commercial license or contractual agreement.
15 #ifndef _Graphic3d_CStructure_HeaderFile
16 #define _Graphic3d_CStructure_HeaderFile
18 #include <Graphic3d_BndBox4f.hxx>
19 #include <Graphic3d_Group.hxx>
20 #include <Graphic3d_SequenceOfGroup.hxx>
21 #include <Graphic3d_SequenceOfHClipPlane.hxx>
22 #include <Graphic3d_TypeOfComposition.hxx>
23 #include <Graphic3d_ViewAffinity.hxx>
24 #include <Graphic3d_TransformPers.hxx>
25 #include <Graphic3d_Vec3.hxx>
26 #include <Graphic3d_ZLayerId.hxx>
27 #include <InterfaceGraphic_Graphic3d.hxx>
29 class Graphic3d_GraphicDriver;
30 class Graphic3d_StructureManager;
32 //! Low-level graphic structure interface
33 class Graphic3d_CStructure : public Standard_Transient
38 //! @return graphic driver created this structure
39 const Handle(Graphic3d_GraphicDriver)& GraphicDriver() const
41 return myGraphicDriver;
44 //! @return graphic groups
45 const Graphic3d_SequenceOfGroup& Groups() const
50 //! @return associated clip planes
51 const Graphic3d_SequenceOfHClipPlane& ClipPlanes() const
56 //! Pass clip planes to the associated graphic driver structure
57 void SetClipPlanes (const Graphic3d_SequenceOfHClipPlane& thePlanes) { myClipPlanes = thePlanes; }
59 //! @return bounding box of this presentation
60 const Graphic3d_BndBox4f& BoundingBox() const
65 //! @return bounding box of this presentation
66 //! without transformation matrix applied
67 Graphic3d_BndBox4f& ChangeBoundingBox()
72 //! Return structure visibility flag
73 bool IsVisible() const { return visible != 0; }
75 //! Set z layer ID to display the structure in specified layer
76 void SetZLayer (const Graphic3d_ZLayerId theLayerIndex) { myZLayer = theLayerIndex; }
79 Graphic3d_ZLayerId ZLayer() const { return myZLayer; }
83 //! Update structure visibility state
84 virtual void OnVisibilityChanged() = 0;
86 //! Clear graphic data
87 virtual void Clear() = 0;
89 //! Connect other structure to this one
90 virtual void Connect (Graphic3d_CStructure& theStructure) = 0;
92 //! Disconnect other structure to this one
93 virtual void Disconnect (Graphic3d_CStructure& theStructure) = 0;
95 //! Synchronize structure aspects
96 virtual void UpdateAspects() = 0;
98 //! Synchronize structure transformation
99 virtual void UpdateTransformation() = 0;
101 //! Highlight entire structure with color
102 virtual void HighlightWithColor (const Graphic3d_Vec3& theColor,
103 const Standard_Boolean theToCreate) = 0;
105 //! Highlight structure using boundary box
106 virtual void HighlightWithBndBox (const Handle(Graphic3d_Structure)& theStruct,
107 const Standard_Boolean theToCreate) = 0;
109 //! Create shadow link to this structure
110 virtual Handle(Graphic3d_CStructure) ShadowLink (const Handle(Graphic3d_StructureManager)& theManager) const = 0;
112 //! Create new group within this structure
113 virtual Handle(Graphic3d_Group) NewGroup (const Handle(Graphic3d_Structure)& theStruct) = 0;
115 //! Remove group from this structure
116 virtual void RemoveGroup (const Handle(Graphic3d_Group)& theGroup) = 0;
121 Graphic3d_ZLayerId myZLayer;
123 int PreviousPriority;
125 CALL_DEF_CONTEXTLINE ContextLine;
126 CALL_DEF_CONTEXTFILLAREA ContextFillArea;
127 CALL_DEF_CONTEXTMARKER ContextMarker;
128 CALL_DEF_CONTEXTTEXT ContextText;
130 CALL_DEF_COLOR HighlightColor;
132 Graphic3d_Mat4 Transformation;
136 Handle(Graphic3d_ViewAffinity) ViewAffinity; //!< view affinity mask
138 unsigned IsInfinite : 1;
139 unsigned stick : 1; //!< displaying state - should be set when structure has been added to scene graph (but can be in hidden state)
140 unsigned highlight : 1;
141 unsigned visible : 1; //!< visibility flag - can be used to suppress structure while leaving it in the scene graph
142 unsigned HLRValidation : 1;
143 unsigned IsForHighlight : 1;
144 unsigned IsMutable : 1;
145 unsigned Is2dText : 1;
147 Graphic3d_TransformPers TransformPersistence;
151 //! Create empty structure.
152 Standard_EXPORT Graphic3d_CStructure (const Handle(Graphic3d_StructureManager)& theManager);
156 Handle(Graphic3d_GraphicDriver) myGraphicDriver;
157 Graphic3d_SequenceOfGroup myGroups;
158 Graphic3d_BndBox4f myBndBox;
159 Graphic3d_SequenceOfHClipPlane myClipPlanes;
163 DEFINE_STANDARD_RTTI(Graphic3d_CStructure, Standard_Transient) // Type definition
167 DEFINE_STANDARD_HANDLE (Graphic3d_CStructure, Standard_Transient)
169 #endif // _Graphic3d_CStructure_HeaderFile