Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:05:34

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 
0028   //! Creates an object to visualise the shape label.
0029   Standard_EXPORT XCAFPrs_AISObject (const TDF_Label& theLabel);
0030 
0031   //! Returns the label which was visualised by this presentation
0032   const TDF_Label& GetLabel() const { return myLabel; }
0033 
0034   //! Assign the label to this presentation
0035   //! (but does not mark it outdated with SetToUpdate()).
0036   void SetLabel (const TDF_Label& theLabel)
0037   {
0038     myLabel = theLabel;
0039   }
0040 
0041   //! Fetch the Shape from associated Label and fill the map of sub-shapes styles.
0042   //! By default, this method is called implicitly within first ::Compute().
0043   //! Application might call this method explicitly to manipulate styles afterwards.
0044   //! @param theToSyncStyles flag indicating if method ::Compute() should call this method again
0045   //!                        on first compute or re-compute
0046   Standard_EXPORT virtual void DispatchStyles (const Standard_Boolean theToSyncStyles = Standard_False);
0047 
0048   //! Sets the material aspect.
0049   //! This method assigns the new default material without overriding XDE styles.
0050   //! Re-computation of existing presentation is not required after calling this method.
0051   Standard_EXPORT virtual void SetMaterial (const Graphic3d_MaterialAspect& theMaterial) Standard_OVERRIDE;
0052 
0053 protected:
0054 
0055   //! Redefined method to compute presentation.
0056   Standard_EXPORT virtual void Compute (const Handle(PrsMgr_PresentationManager)& thePrsMgr,
0057                                         const Handle(Prs3d_Presentation)& thePrs,
0058                                         const Standard_Integer theMode) Standard_OVERRIDE;
0059 
0060   //! Fills out a default style object which is used when styles are
0061   //! not explicitly defined in the document.
0062   //! By default, the style uses white color for curves and surfaces.
0063   Standard_EXPORT virtual void DefaultStyle (XCAFPrs_Style& theStyle) const;
0064 
0065 protected:
0066 
0067   //! Assign style to drawer.
0068   static void setStyleToDrawer (const Handle(Prs3d_Drawer)& theDrawer,
0069                                 const XCAFPrs_Style& theStyle,
0070                                 const XCAFPrs_Style& theDefStyle,
0071                                 const Graphic3d_MaterialAspect& theDefMaterial);
0072 
0073 protected:
0074 
0075   TDF_Label        myLabel;        //!< label pointing onto the shape
0076   Standard_Boolean myToSyncStyles; //!< flag indicating that shape and sub-shapes should be updates within Compute()
0077 
0078 public:
0079 
0080   DEFINE_STANDARD_RTTIEXT(XCAFPrs_AISObject,AIS_ColoredShape)
0081 
0082 };
0083 
0084 DEFINE_STANDARD_HANDLE(XCAFPrs_AISObject, AIS_ColoredShape)
0085 
0086 #endif // _XCAFPrs_AISObject_HeaderFile