Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-11-28 10:22:25

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(const bool theToSyncStyles = false);
0043 
0044   //! Sets the material aspect.
0045   //! This method assigns the new default material without overriding XDE styles.
0046   //! Re-computation of existing presentation is not required after calling this method.
0047   Standard_EXPORT void SetMaterial(const Graphic3d_MaterialAspect& theMaterial) override;
0048 
0049 protected:
0050   //! Redefined method to compute presentation.
0051   Standard_EXPORT void Compute(const occ::handle<PrsMgr_PresentationManager>& thePrsMgr,
0052                                const occ::handle<Prs3d_Presentation>&         thePrs,
0053                                const int                                      theMode) override;
0054 
0055   //! Fills out a default style object which is used when styles are
0056   //! not explicitly defined in the document.
0057   //! By default, the style uses white color for curves and surfaces.
0058   Standard_EXPORT virtual void DefaultStyle(XCAFPrs_Style& theStyle) const;
0059 
0060 protected:
0061   //! Assign style to drawer.
0062   static void setStyleToDrawer(const occ::handle<Prs3d_Drawer>& theDrawer,
0063                                const XCAFPrs_Style&             theStyle,
0064                                const XCAFPrs_Style&             theDefStyle,
0065                                const Graphic3d_MaterialAspect&  theDefMaterial);
0066 
0067 protected:
0068   TDF_Label myLabel; //!< label pointing onto the shape
0069   // clang-format off
0070   bool myToSyncStyles; //!< flag indicating that shape and sub-shapes should be updates within Compute()
0071   // clang-format on
0072 
0073 public:
0074   DEFINE_STANDARD_RTTIEXT(XCAFPrs_AISObject, AIS_ColoredShape)
0075 };
0076 
0077 #endif // _XCAFPrs_AISObject_HeaderFile