0031313: Foundation Classes - Dump improvement for classes
[occt.git] / src / XCAFPrs / XCAFPrs_AISObject.hxx
1 // Copyright (c) 2014 OPEN CASCADE SAS
2 //
3 // This file is part of Open CASCADE Technology software library.
4 //
5 // This library is free software; you can redistribute it and/or modify it under
6 // the terms of the GNU Lesser General Public License version 2.1 as published
7 // by the Free Software Foundation, with special exception defined in the file
8 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
9 // distribution for complete text of the license and disclaimer of any warranty.
10 //
11 // Alternatively, this file may be used under the terms of Open CASCADE
12 // commercial license or contractual agreement.
13
14 #ifndef _XCAFPrs_AISObject_HeaderFile
15 #define _XCAFPrs_AISObject_HeaderFile
16
17 #include <AIS_ColoredShape.hxx>
18
19 #include <TDF_Label.hxx>
20
21 class XCAFPrs_Style;
22
23 //! Implements AIS_InteractiveObject functionality for shape in DECAF document.
24 class XCAFPrs_AISObject : public AIS_ColoredShape
25 {
26 public:
27
28   //! Creates an object to visualise the shape label.
29   Standard_EXPORT XCAFPrs_AISObject (const TDF_Label& theLabel);
30
31   //! Returns the label which was visualised by this presentation
32   const TDF_Label& GetLabel() const { return myLabel; }
33
34   //! Assign the label to this presentation
35   //! (but does not mark it outdated with SetToUpdate()).
36   void SetLabel (const TDF_Label& theLabel)
37   {
38     myLabel = theLabel;
39   }
40
41   //! Fetch the Shape from associated Label and fill the map of sub-shapes styles.
42   //! By default, this method is called implicitly within first ::Compute().
43   //! Application might call this method explicitly to manipulate styles afterwards.
44   //! @param theToSyncStyles flag indicating if method ::Compute() should call this method again
45   //!                        on first compute or re-compute
46   Standard_EXPORT virtual void DispatchStyles (const Standard_Boolean theToSyncStyles = Standard_False);
47
48   //! Sets the material aspect.
49   //! This method assigns the new default material without overriding XDE styles.
50   //! Re-computation of existing presentation is not required after calling this method.
51   Standard_EXPORT virtual void SetMaterial (const Graphic3d_MaterialAspect& theMaterial) Standard_OVERRIDE;
52
53 protected:
54
55   //! Redefined method to compute presentation.
56   Standard_EXPORT virtual  void Compute (const Handle(PrsMgr_PresentationManager3d)& thePresentationManager,
57                                          const Handle(Prs3d_Presentation)&           thePresentation,
58                                          const Standard_Integer                      theMode) Standard_OVERRIDE;
59
60   //! Fills out a default style object which is used when styles are
61   //! not explicitly defined in the document.
62   //! By default, the style uses white color for curves and surfaces.
63   Standard_EXPORT virtual  void DefaultStyle (XCAFPrs_Style& theStyle) const;
64
65 protected:
66
67   //! Assign style to drawer.
68   static void setStyleToDrawer (const Handle(Prs3d_Drawer)& theDrawer,
69                                 const XCAFPrs_Style& theStyle,
70                                 const XCAFPrs_Style& theDefStyle,
71                                 const Graphic3d_MaterialAspect& theDefMaterial);
72
73 protected:
74
75   TDF_Label        myLabel;        //!< label pointing onto the shape
76   Standard_Boolean myToSyncStyles; //!< flag indicating that shape and sub-shapes should be updates within Compute()
77
78 public:
79
80   DEFINE_STANDARD_RTTIEXT(XCAFPrs_AISObject,AIS_ColoredShape)
81
82 };
83
84 DEFINE_STANDARD_HANDLE(XCAFPrs_AISObject, AIS_ColoredShape)
85
86 #endif // _XCAFPrs_AISObject_HeaderFile