Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-06-01 08:33:52

0001 // Copyright (c) 2014 OPEN CASCADE SAS
0002 //
0003 // This file is part of Open CASCADE Technology software library.
0004 //
0005 // This library is free software; you can redistribute it and/or modify it under
0006 // the terms of the GNU Lesser General Public License version 2.1 as published
0007 // by the Free Software Foundation, with special exception defined in the file
0008 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
0009 // distribution for complete text of the license and disclaimer of any warranty.
0010 //
0011 // Alternatively, this file may be used under the terms of Open CASCADE
0012 // commercial license or contractual agreement.
0013 
0014 #ifndef _XCAFPrs_AISObject_HeaderFile
0015 #define _XCAFPrs_AISObject_HeaderFile
0016 
0017 #include <AIS_ColoredShape.hxx>
0018 
0019 #include <TDF_Label.hxx>
0020 
0021 class XCAFPrs_Style;
0022 
0023 //! Implements AIS_InteractiveObject functionality for shape in DECAF document.
0024 class XCAFPrs_AISObject : public AIS_ColoredShape
0025 {
0026 public:
0027   //! Creates an object to visualise the shape label.
0028   Standard_EXPORT XCAFPrs_AISObject(const TDF_Label& theLabel);
0029 
0030   //! Returns the label which was visualised by this presentation
0031   const TDF_Label& GetLabel() const { return myLabel; }
0032 
0033   //! Assign the label to this presentation
0034   //! (but does not mark it outdated with SetToUpdate()).
0035   void SetLabel(const TDF_Label& theLabel) { myLabel = theLabel; }
0036 
0037   //! Fetch the Shape from associated Label and fill the map of sub-shapes styles.
0038   //! By default, this method is called implicitly within first ::Compute().
0039   //! Application might call this method explicitly to manipulate styles afterwards.
0040   //! @param theToSyncStyles flag indicating if method ::Compute() should call this method again
0041   //!                        on first compute or re-compute
0042   Standard_EXPORT virtual void DispatchStyles(
0043     const Standard_Boolean theToSyncStyles = Standard_False);
0044 
0045   //! Sets the material aspect.
0046   //! This method assigns the new default material without overriding XDE styles.
0047   //! Re-computation of existing presentation is not required after calling this method.
0048   Standard_EXPORT virtual void SetMaterial(const Graphic3d_MaterialAspect& theMaterial)
0049     Standard_OVERRIDE;
0050 
0051 protected:
0052   //! Redefined method to compute presentation.
0053   Standard_EXPORT virtual void Compute(const Handle(PrsMgr_PresentationManager)& thePrsMgr,
0054                                        const Handle(Prs3d_Presentation)&         thePrs,
0055                                        const Standard_Integer theMode) Standard_OVERRIDE;
0056 
0057   //! Fills out a default style object which is used when styles are
0058   //! not explicitly defined in the document.
0059   //! By default, the style uses white color for curves and surfaces.
0060   Standard_EXPORT virtual void DefaultStyle(XCAFPrs_Style& theStyle) const;
0061 
0062 protected:
0063   //! Assign style to drawer.
0064   static void setStyleToDrawer(const Handle(Prs3d_Drawer)&     theDrawer,
0065                                const XCAFPrs_Style&            theStyle,
0066                                const XCAFPrs_Style&            theDefStyle,
0067                                const Graphic3d_MaterialAspect& theDefMaterial);
0068 
0069 protected:
0070   TDF_Label myLabel; //!< label pointing onto the shape
0071   // clang-format off
0072   Standard_Boolean myToSyncStyles; //!< flag indicating that shape and sub-shapes should be updates within Compute()
0073   // clang-format on
0074 
0075 public:
0076   DEFINE_STANDARD_RTTIEXT(XCAFPrs_AISObject, AIS_ColoredShape)
0077 };
0078 
0079 DEFINE_STANDARD_HANDLE(XCAFPrs_AISObject, AIS_ColoredShape)
0080 
0081 #endif // _XCAFPrs_AISObject_HeaderFile