6e27895299ff5b2582ff7f38d425fb06c5aae2ab
[occt.git] / src / PrsMgr / PrsMgr_Presentation.hxx
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_Presentation_HeaderFile
18 #define _PrsMgr_Presentation_HeaderFile
19
20 #include <Aspect_TypeOfHighlightMethod.hxx>
21 #include <Prs3d_Presentation.hxx>
22
23 class PrsMgr_PresentationManager;
24 class PrsMgr_PresentableObject;
25 class Quantity_Color;
26 class Graphic3d_Camera;
27 class Geom_Transformation;
28 class Prs3d_Drawer;
29 class Graphic3d_Structure;
30 class Graphic3d_DataStructureManager;
31
32 DEFINE_STANDARD_HANDLE(PrsMgr_Presentation, Graphic3d_Structure)
33
34 class PrsMgr_Presentation : public Graphic3d_Structure
35 {
36   DEFINE_STANDARD_RTTIEXT(PrsMgr_Presentation, Graphic3d_Structure)
37   friend class PrsMgr_PresentationManager;
38   friend class PrsMgr_PresentableObject;
39 public:
40
41   //! Destructor
42   Standard_EXPORT ~PrsMgr_Presentation();
43
44   Standard_DEPRECATED("Dummy to simplify porting - returns self")
45   Prs3d_Presentation* Presentation() { return this; }
46
47   //! returns the PresentationManager in which the presentation has been created.
48   const Handle(PrsMgr_PresentationManager)& PresentationManager() const { return myPresentationManager; }
49
50   void SetUpdateStatus (const Standard_Boolean theUpdateStatus) { myMustBeUpdated = theUpdateStatus; }
51
52   Standard_Boolean MustBeUpdated() const { return myMustBeUpdated; }
53
54   //! Return display mode index.
55   Standard_Integer Mode() const { return myMode; }
56
57   //! Display structure.
58   Standard_EXPORT virtual void Display() Standard_OVERRIDE;
59
60   //! Remove structure.
61   Standard_EXPORT virtual void Erase() Standard_OVERRIDE;
62
63   //! Highlight structure.
64   Standard_EXPORT void Highlight (const Handle(Prs3d_Drawer)& theStyle);
65
66   //! Unhighlight structure.
67   Standard_EXPORT void Unhighlight();
68
69   //! Return TRUE if structure has been displayed and in no hidden state.
70   virtual Standard_Boolean IsDisplayed() const Standard_OVERRIDE
71   {
72     return base_type::IsDisplayed()
73         && base_type::IsVisible();
74   }
75
76   //! removes the whole content of the presentation.
77   //! Does not remove the other connected presentations.
78   Standard_EXPORT virtual void Clear (const Standard_Boolean theWithDestruction = Standard_True) Standard_OVERRIDE;
79
80   //! Compute structure using presentation manager.
81   Standard_EXPORT virtual void Compute() Standard_OVERRIDE;
82
83   //! Dumps the content of me into the stream
84   Standard_EXPORT virtual void DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth = -1) const Standard_OVERRIDE;
85
86 protected:
87
88   //! Main constructor.
89   Standard_EXPORT PrsMgr_Presentation (const Handle(PrsMgr_PresentationManager)& thePresentationManager,
90                                        const Handle(PrsMgr_PresentableObject)& thePresentableObject,
91                                        const Standard_Integer theMode);
92
93   //! Displays myStructure.
94   Standard_EXPORT void display (const Standard_Boolean theIsHighlight);
95
96   Standard_EXPORT virtual void computeHLR (const Handle(Graphic3d_Camera)& theProjector,
97                                            Handle(Graphic3d_Structure)& theGivenStruct) Standard_OVERRIDE;
98 protected:
99
100   Handle(PrsMgr_PresentationManager) myPresentationManager;
101   PrsMgr_PresentableObject* myPresentableObject;
102   Standard_Integer myBeforeHighlightState;
103   Standard_Integer myMode;
104   Standard_Boolean myMustBeUpdated;
105
106 };
107
108 #endif // _PrsMgr_Presentation_HeaderFile