0026885: Visualization - drop redundant aspects from structure level
[occt.git] / src / PrsMgr / PrsMgr_PresentationManager.hxx
CommitLineData
42cf5bc1 1// Created on: 1995-01-25
2// Created by: Jean-Louis Frenkel
3// Copyright (c) 1995-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 _PrsMgr_PresentationManager_HeaderFile
18#define _PrsMgr_PresentationManager_HeaderFile
19
c357e426 20#include <Graphic3d_NameOfMaterial.hxx>
21#include <Graphic3d_StructureManager.hxx>
22#include <Graphic3d_ZLayerId.hxx>
23#include <MMgt_TShared.hxx>
42cf5bc1 24#include <PrsMgr_ListOfPresentations.hxx>
25#include <Quantity_Color.hxx>
42cf5bc1 26#include <Quantity_NameOfColor.hxx>
c357e426 27#include <Standard.hxx>
28#include <Standard_Boolean.hxx>
29#include <Standard_Integer.hxx>
30#include <Standard_Type.hxx>
31
42cf5bc1 32class Geom_Transformation;
c357e426 33class Prs3d_Presentation;
c357e426 34class PrsMgr_PresentableObject;
42cf5bc1 35class PrsMgr_Presentation;
c357e426 36class Standard_NoSuchObject;
37class V3d_Viewer;
42cf5bc1 38
39class PrsMgr_PresentationManager;
40DEFINE_STANDARD_HANDLE(PrsMgr_PresentationManager, MMgt_TShared)
41
42//! A framework to manage 3D displays, graphic entities and their updates.
43//! Used in the AIS package (Application Interactive Services), to enable the advanced user to define the
44//! default display mode of a new interactive object which extends the list of signatures and types.
45//! Definition of new display types is handled by calling the presentation algorithms provided by the StdPrs package.
46class PrsMgr_PresentationManager : public MMgt_TShared
47{
48
49public:
50
51
52
53 //! Creates a framework to manage displays and graphic entities with the 3D view theStructureManager.
c357e426 54 Standard_EXPORT PrsMgr_PresentationManager(const Handle(Graphic3d_StructureManager)& theStructureManager);
42cf5bc1 55
56 //! Displays the presentation of the object in the given Presentation manager with the given mode.
57 //! The mode should be enumerated by the object which inherits PresentableObject.
58 Standard_EXPORT void Display (const Handle(PrsMgr_PresentableObject)& thePrsObject, const Standard_Integer theMode = 0);
59
60 //! erases the presentation of the object in the given
61 //! Presentation manager with the given mode.
62 Standard_EXPORT void Erase (const Handle(PrsMgr_PresentableObject)& thePrsObject, const Standard_Integer theMode = 0);
63
64
65 //! Clears the presentation of the presentable object thePrsObject in this framework with the display mode theMode.
66 Standard_EXPORT virtual void Clear (const Handle(PrsMgr_PresentableObject)& thePrsObject, const Standard_Integer theMode = 0);
67
68 //! Sets the visibility of presentable object.
69 Standard_EXPORT void SetVisibility (const Handle(PrsMgr_PresentableObject)& thePrsObject, const Standard_Integer theMode, const Standard_Boolean theValue);
70
71 //! Highlights the presentation of the presentable object
72 //! thePrsObject in this framework with the display mode theMode.
73 Standard_EXPORT void Highlight (const Handle(PrsMgr_PresentableObject)& thePrsObject, const Standard_Integer theMode = 0);
74
75 //! Removes highlighting from the presentation of the
76 //! presentable object thePrsObject in this framework with the display mode theMode.
77 Standard_EXPORT void Unhighlight (const Handle(PrsMgr_PresentableObject)& thePrsObject, const Standard_Integer theMode = 0);
78
79
80 //! Sets the display priority theNewPrior of the
81 //! presentable object thePrsObject in this framework with the display mode theMode.
82 Standard_EXPORT void SetDisplayPriority (const Handle(PrsMgr_PresentableObject)& thePrsObject, const Standard_Integer theMode, const Standard_Integer theNewPrior) const;
83
84
85 //! Returns the display priority of the presentable object
86 //! thePrsObject in this framework with the display mode theMode.
87 Standard_EXPORT Standard_Integer DisplayPriority (const Handle(PrsMgr_PresentableObject)& thePrsObject, const Standard_Integer theMode) const;
88
89 //! Set Z layer ID for all presentations of the object.
90 Standard_EXPORT void SetZLayer (const Handle(PrsMgr_PresentableObject)& thePrsObject, const Standard_Integer theLayerId);
91
92 //! Get Z layer ID assigned to all presentations of the object.
93 //! Method returns -1 value if object has no presentations and is
94 //! impossible to get layer index.
95 Standard_EXPORT Standard_Integer GetZLayer (const Handle(PrsMgr_PresentableObject)& thePrsObject) const;
96
97 Standard_EXPORT Standard_Boolean IsDisplayed (const Handle(PrsMgr_PresentableObject)& thePrsObject, const Standard_Integer theMode = 0) const;
98
99 //! Returns true if the presentation of the presentable
100 //! object thePrsObject in this framework with the display mode theMode is highlighted.
101 Standard_EXPORT Standard_Boolean IsHighlighted (const Handle(PrsMgr_PresentableObject)& thePrsObject, const Standard_Integer theMode = 0) const;
102
103 //! Updates the presentation of the presentable object
104 //! thePrsObject in this framework with the display mode theMode.
105 Standard_EXPORT void Update (const Handle(PrsMgr_PresentableObject)& thePrsObject, const Standard_Integer theMode = 0) const;
106
107 //! Resets the transient list of presentations previously displayed in immediate mode
108 //! and begins accumulation of new list by following AddToImmediateList()/Color()/Highlight() calls.
109 Standard_EXPORT void BeginImmediateDraw();
110
111 //! Resets the transient list of presentations previously displayed in immediate mode.
112 Standard_EXPORT void ClearImmediateDraw();
113
114 //! Stores thePrs in the transient list of presentations to be displayed in immediate mode.
115 //! Will be taken in account in EndImmediateDraw method.
116 Standard_EXPORT void AddToImmediateList (const Handle(Prs3d_Presentation)& thePrs);
c3282ec1 117
118 //! Allows rapid drawing of the each view in theViewer by avoiding an update of the whole background.
119 Standard_EXPORT void EndImmediateDraw (const Handle(V3d_Viewer)& theViewer);
120
121 //! Clears and redisplays immediate structures of the viewer taking into account its affinity.
122 Standard_EXPORT void RedrawImmediate (const Handle(V3d_Viewer)& theViewer);
123
42cf5bc1 124 //! Returns true if Presentation Manager is accumulating transient list of presentations to be displayed in immediate mode.
be5c3602 125 Standard_Boolean IsImmediateModeOn() const;
c3282ec1 126
42cf5bc1 127 //! Highlights the graphic object thePrsObject in the color theColor.
128 //! thePrsObject has the display mode theMode;
129 //! this has the default value of 0, that is, the wireframe display mode.
c3282ec1 130 Standard_EXPORT void Color (const Handle(PrsMgr_PresentableObject)& thePrsObject,
131 const Quantity_NameOfColor theColor = Quantity_NOC_YELLOW,
132 const Standard_Integer theMode = 0,
133 const Handle(PrsMgr_PresentableObject)& theSelObj = NULL,
134 const Graphic3d_ZLayerId theImmediateStructLayerId = Graphic3d_ZLayerId_Topmost);
135
42cf5bc1 136 //! highlights the boundbox of the presentation
137 Standard_EXPORT void BoundBox (const Handle(PrsMgr_PresentableObject)& thePrsObject, const Standard_Integer theMode = 0);
138
139 Standard_EXPORT void Connect (const Handle(PrsMgr_PresentableObject)& thePrsObject, const Handle(PrsMgr_PresentableObject)& theOtherObject, const Standard_Integer theMode = 0, const Standard_Integer theOtherMode = 0);
140
141
142 //! Sets the transformation theTransformation for the presentable object thePrsObject.
143 //! thePrsObject has the display mode theMode; this has the default value of 0, that is, the wireframe display mode.
144 Standard_EXPORT void Transform (const Handle(PrsMgr_PresentableObject)& thePrsObject, const Handle(Geom_Transformation)& theTransformation, const Standard_Integer theMode = 0);
145
146 //! Returns the structure manager.
2831708b 147 const Handle(Graphic3d_StructureManager)& StructureManager() const;
148
42cf5bc1 149 //! Returns true if there is a presentation of the
150 //! presentable object thePrsObject in this framework, thePrsObject having the display mode theMode.
151 Standard_EXPORT Standard_Boolean HasPresentation (const Handle(PrsMgr_PresentableObject)& thePrsObject, const Standard_Integer theMode = 0) const;
152
153 //! Returns the presentation Presentation of the presentable object thePrsObject in this framework.
154 //! When theToCreate is true - automatically creates presentation for specified mode when not exist.
155 //! Optional argument theSelObj specifies parent decomposed object to inherit its view affinity.
156 Standard_EXPORT Handle(PrsMgr_Presentation) Presentation (const Handle(PrsMgr_PresentableObject)& thePrsObject, const Standard_Integer theMode = 0, const Standard_Boolean theToCreate = Standard_False, const Handle(PrsMgr_PresentableObject)& theSelObj = NULL) const;
157
5396886c 158 //! Allows to apply location transformation to shadow highlight presentation immediately.
159 //! @param theObj defines the base object, it local transformation will be applied to corresponding highlight structure
160 //! @param theMode defines display mode of the base object
161 //! @param theSelObj defines the object produced after decomposition of the base object for local selection
162 Standard_EXPORT void UpdateHighlightTrsf (const Handle(V3d_Viewer)& theViewer,
163 const Handle(PrsMgr_PresentableObject)& theObj,
164 const Standard_Integer theMode = 0,
165 const Handle(PrsMgr_PresentableObject)& theSelObj = NULL);
42cf5bc1 166
167
168
92efcf78 169 DEFINE_STANDARD_RTTIEXT(PrsMgr_PresentationManager,MMgt_TShared)
42cf5bc1 170
171protected:
172
173
174 //! Removes a presentation of the presentable object thePrsObject to this framework. thePrsObject has the display mode theMode.
175 Standard_EXPORT Standard_Boolean RemovePresentation (const Handle(PrsMgr_PresentableObject)& thePrsObject, const Standard_Integer theMode = 0);
176
c357e426 177 Handle(Graphic3d_StructureManager) myStructureManager;
42cf5bc1 178 Standard_Integer myImmediateModeOn;
179 PrsMgr_ListOfPresentations myImmediateList;
c3282ec1 180 PrsMgr_ListOfPresentations myViewDependentImmediateList;
42cf5bc1 181 Quantity_Color mySelectionColor;
182
183
184private:
185
c3282ec1 186 //! Handles the structures from <myImmediateList> and displays it separating view-dependent structures and taking into account
187 //! structure visibility by setting proper affinity.
188 void displayImmediate (const Handle(V3d_Viewer)& theViewer);
42cf5bc1 189};
190
191
192#include <PrsMgr_PresentationManager.lxx>
193
194
195
196
197
198#endif // _PrsMgr_PresentationManager_HeaderFile