1 // Copyright (c) 2014 OPEN CASCADE SAS
3 // This file is part of Open CASCADE Technology software library.
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.
11 // Alternatively, this file may be used under the terms of Open CASCADE
12 // commercial license or contractual agreement.
14 #ifndef _XCAFPrs_AISObject_HeaderFile
15 #define _XCAFPrs_AISObject_HeaderFile
17 #include <AIS_ColoredShape.hxx>
19 #include <TDF_Label.hxx>
23 //! Implements AIS_InteractiveObject functionality for shape in DECAF document.
24 class XCAFPrs_AISObject : public AIS_ColoredShape
28 //! Creates an object to visualise the shape label.
29 Standard_EXPORT XCAFPrs_AISObject (const TDF_Label& theLabel);
31 //! Returns the label which was visualised by this presentation
32 const TDF_Label& GetLabel() const { return myLabel; }
34 //! Assign the label to this presentation
35 //! (but does not mark it outdated with SetToUpdate()).
36 void SetLabel (const TDF_Label& theLabel)
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);
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;
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;
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;
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);
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()
80 DEFINE_STANDARD_RTTIEXT(XCAFPrs_AISObject,AIS_ColoredShape)
84 DEFINE_STANDARD_HANDLE(XCAFPrs_AISObject, AIS_ColoredShape)
86 #endif // _XCAFPrs_AISObject_HeaderFile