0027818: Visualization - provide an interface to define highlight presentation properties
[occt.git] / src / Graphic3d / Graphic3d_StructureManager.hxx
CommitLineData
42cf5bc1 1// Created on: 1991-09-05
2// Created by: NW,JPB,CAL
3// Copyright (c) 1991-1999 Matra Datavision
4// Copyright (c) 1999-2014 OPEN CASCADE SAS
5//
6// This file is part of Open CASCADE Technology software library.
7//
8// This library is free software; you can redistribute it and/or modify it under
9// the terms of the GNU Lesser General Public License version 2.1 as published
10// by the Free Software Foundation, with special exception defined in the file
11// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
12// distribution for complete text of the license and disclaimer of any warranty.
13//
14// Alternatively, this file may be used under the terms of Open CASCADE
15// commercial license or contractual agreement.
16
17#ifndef _Graphic3d_StructureManager_HeaderFile
18#define _Graphic3d_StructureManager_HeaderFile
19
c357e426 20#include <Aspect_GenId.hxx>
21#include <Aspect_TypeOfHighlightMethod.hxx>
42cf5bc1 22#include <Aspect_TypeOfUpdate.hxx>
c357e426 23#include <Graphic3d_CView.hxx>
42cf5bc1 24#include <Graphic3d_MapOfObject.hxx>
c357e426 25#include <Graphic3d_MapOfStructure.hxx>
26#include <Graphic3d_ViewAffinity.hxx>
42cf5bc1 27#include <Graphic3d_ZLayerId.hxx>
28#include <Graphic3d_ZLayerSettings.hxx>
c357e426 29#include <MMgt_TShared.hxx>
30#include <NCollection_IndexedMap.hxx>
31#include <Standard.hxx>
42cf5bc1 32#include <Standard_Boolean.hxx>
c357e426 33#include <Standard_Integer.hxx>
34#include <Standard_Type.hxx>
42cf5bc1 35#include <TColStd_Array2OfReal.hxx>
c357e426 36
37typedef NCollection_IndexedMap<Graphic3d_CView*> Graphic3d_IndexedMapOfView;
38
42cf5bc1 39class Graphic3d_GraphicDriver;
42cf5bc1 40class Graphic3d_Structure;
41class Graphic3d_DataStructureManager;
42class Standard_Transient;
43
42cf5bc1 44class Graphic3d_StructureManager;
45DEFINE_STANDARD_HANDLE(Graphic3d_StructureManager, MMgt_TShared)
46
47//! This class allows the definition of a manager to
48//! which the graphic objects are associated.
49//! It allows them to be globally manipulated.
50//! It defines the global attributes.
51//! Keywords: Structure, Structure Manager, Update Mode,
52//! Destroy, Highlight, Visible
53class Graphic3d_StructureManager : public MMgt_TShared
54{
42cf5bc1 55public:
56
c357e426 57 //! Initializes the ViewManager.
58 //! Currently creating of more than 100 viewer instances
59 //! is not supported and leads to InitializationError and
60 //! initialization failure.
61 //! This limitation might be addressed in some future OCCT releases.
62 //! Warning: Raises InitialisationError if the initialization
63 //! of the ViewManager failed.
64 Standard_EXPORT Graphic3d_StructureManager (const Handle(Graphic3d_GraphicDriver)& theDriver);
65
42cf5bc1 66 //! Deletes the manager <me>.
e6f550da 67 Standard_EXPORT ~Graphic3d_StructureManager();
c357e426 68
42cf5bc1 69 //! Modifies the screen update mode.
70 //!
c357e426 71 //! TOU_ASAP - as soon as possible
72 //! TOU_WAIT - on demand (with the Update function)
42cf5bc1 73 //! Note : Dynamic Operations and Update Mode
74 //! Use SetUpdateMode to control when changes to
75 //! the display are made. Use one of the following
76 //! functions to update one or more views:
c357e426 77 //! - Update all views of the viewer: Graphic3d_StructureManager::Update()
78 //! - Update one view of the viewer: Graphic3d_View::Update()
79 //! Use one of the following functions to update the entire display:
80 //! - Redraw all structures in all views: Graphic3d_StructureManager::Redraw()
81 //! - Redraw all structures in one view: Graphic3d_View::Redraw()
59ec40f8 82 void SetUpdateMode (const Aspect_TypeOfUpdate theType) { myUpdateMode = theType; }
c357e426 83
84 //! Returns the screen update mode.
85 //!
86 //! TOU_ASAP as soon as possible
87 //! TOU_WAIT on demand (Update)
59ec40f8 88 Aspect_TypeOfUpdate UpdateMode() const { return myUpdateMode; }
c357e426 89
50d06d8f 90 //! Updates screen in function of modifications of the structures
91 //! and invalidates bounding box of specified ZLayerId.
92 Standard_EXPORT virtual void Update (const Aspect_TypeOfUpdate theMode = Aspect_TOU_ASAP,
93 const Graphic3d_ZLayerId theLayerId = Graphic3d_ZLayerId_UNKNOWN) const;
c357e426 94
95 //! Deletes and erases the 3D structure manager.
96 Standard_EXPORT virtual void Remove();
97
98 //! Erases all the structures.
99 Standard_EXPORT virtual void Erase();
100
42cf5bc1 101 //! Returns the set of structures displayed in
102 //! visualiser <me>.
103 Standard_EXPORT void DisplayedStructures (Graphic3d_MapOfStructure& SG) const;
c357e426 104
42cf5bc1 105 //! Returns the set of highlighted structures
106 //! in a visualiser <me>.
107 Standard_EXPORT void HighlightedStructures (Graphic3d_MapOfStructure& SG) const;
c357e426 108
c357e426 109 //! Forces a new construction of the structure.
110 //! if <theStructure> is displayed and TOS_COMPUTED.
111 Standard_EXPORT virtual void ReCompute (const Handle(Graphic3d_Structure)& theStructure);
112
113 //! Forces a new construction of the structure.
114 //! if <theStructure> is displayed in <theProjector> and TOS_COMPUTED.
115 Standard_EXPORT virtual void ReCompute (const Handle(Graphic3d_Structure)& theStructure, const Handle(Graphic3d_DataStructureManager)& theProjector);
116
117 //! Clears the structure.
118 Standard_EXPORT virtual void Clear (const Handle(Graphic3d_Structure)& theStructure, const Standard_Boolean theWithDestruction);
119
120 //! Connects the structures.
121 Standard_EXPORT virtual void Connect (const Handle(Graphic3d_Structure)& theMother, const Handle(Graphic3d_Structure)& theDaughter);
122
123 //! Disconnects the structures.
124 Standard_EXPORT virtual void Disconnect (const Handle(Graphic3d_Structure)& theMother, const Handle(Graphic3d_Structure)& theDaughter);
125
126 //! Display the structure.
127 Standard_EXPORT virtual void Display (const Handle(Graphic3d_Structure)& theStructure);
128
129 //! Erases the structure.
130 Standard_EXPORT virtual void Erase (const Handle(Graphic3d_Structure)& theStructure);
131
132 //! Highlights the structure.
8e5fb5ea 133 Standard_EXPORT virtual void Highlight (const Handle(Graphic3d_Structure)& theStructure);
c357e426 134
135 //! Transforms the structure.
1f7f5a90 136 Standard_EXPORT virtual void SetTransform (const Handle(Graphic3d_Structure)& theStructure, const Handle(Geom_Transformation)& theTrsf);
c357e426 137
138 //! Changes the display priority of the structure <AStructure>.
139 Standard_EXPORT virtual void ChangeDisplayPriority (const Handle(Graphic3d_Structure)& theStructure, const Standard_Integer theOldPriority, const Standard_Integer theNewPriority);
140
141 //! Change Z layer for structure. The Z layer mechanism allows to display structures in higher
142 //! layers in overlay of structures in lower layers.
143 Standard_EXPORT virtual void ChangeZLayer (const Handle(Graphic3d_Structure)& theStructure, const Graphic3d_ZLayerId theLayerId);
144
42cf5bc1 145 //! Returns the graphic driver of <me>.
146 Standard_EXPORT const Handle(Graphic3d_GraphicDriver)& GraphicDriver() const;
c357e426 147
148 //! Attaches the view to this structure manager and sets its identification number within the manager.
149 Standard_EXPORT Standard_Integer Identification (Graphic3d_CView* theView);
150
151 //! Detach the view from this structure manager and release its identification.
152 Standard_EXPORT void UnIdentification (Graphic3d_CView* theView);
153
154 //! Returns the group of views defined in the structure manager.
155 Standard_EXPORT const Graphic3d_IndexedMapOfView& DefinedViews() const;
156
157 //! Returns the theoretical maximum number of definable views in the manager.
158 //! Warning: It's not possible to accept an infinite number of definable views because each
159 //! view must have an identification and we have different managers.
160 Standard_EXPORT Standard_Integer MaxNumOfViews() const;
161
42cf5bc1 162 //! Returns the structure with the identification number <AId>.
163 Standard_EXPORT virtual Handle(Graphic3d_Structure) Identification (const Standard_Integer AId) const;
c357e426 164
42cf5bc1 165 //! Suppress the highlighting on the structure <AStructure>.
c357e426 166 Standard_EXPORT virtual void UnHighlight (const Handle(Graphic3d_Structure)& AStructure);
167
168 //! Suppresses the highlighting on all the structures in <me>.
169 Standard_EXPORT virtual void UnHighlight();
170
42cf5bc1 171 Standard_EXPORT void RecomputeStructures();
c357e426 172
42cf5bc1 173 //! Recomputes all structures from theStructures.
174 Standard_EXPORT void RecomputeStructures (const Graphic3d_MapOfStructure& theStructures);
c357e426 175
42cf5bc1 176 Standard_EXPORT Handle(Graphic3d_ViewAffinity) RegisterObject (const Handle(Standard_Transient)& theObject);
c357e426 177
42cf5bc1 178 Standard_EXPORT void UnregisterObject (const Handle(Standard_Transient)& theObject);
42cf5bc1 179
c357e426 180 Standard_EXPORT Handle(Graphic3d_ViewAffinity) ObjectAffinity (const Handle(Standard_Transient)& theObject) const;
42cf5bc1 181
c357e426 182 friend class Graphic3d_Structure;
42cf5bc1 183
92efcf78 184 DEFINE_STANDARD_RTTIEXT(Graphic3d_StructureManager,MMgt_TShared)
42cf5bc1 185
186protected:
187
42cf5bc1 188 //! Returns the number of structures displayed in
c357e426 189 //! visualizer <me>.
190 //! Returns the structure displayed in visualizer <me>.
42cf5bc1 191 Standard_EXPORT Standard_Integer NumberOfDisplayedStructures() const;
192
59ec40f8 193protected:
194
c357e426 195 Aspect_GenId myViewGenId;
196 Aspect_TypeOfUpdate myUpdateMode;
c357e426 197 Graphic3d_MapOfStructure myDisplayedStructure;
198 Graphic3d_MapOfStructure myHighlightedStructure;
199 Graphic3d_MapOfObject myRegisteredObjects;
200 Handle(Graphic3d_GraphicDriver) myGraphicDriver;
201 Graphic3d_IndexedMapOfView myDefinedViews;
42cf5bc1 202};
203
42cf5bc1 204#endif // _Graphic3d_StructureManager_HeaderFile