Back to home page

EIC code displayed by LXR

 
 

    


Warning, file /include/opencascade/Graphic3d_PresentationAttributes.hxx was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 // Created on: 2016-08-24
0002 // Created by: Varvara POSKONINA
0003 // Copyright (c) 2016 OPEN CASCADE SAS
0004 //
0005 // This file is part of Open CASCADE Technology software library.
0006 //
0007 // This library is free software; you can redistribute it and/or modify it under
0008 // the terms of the GNU Lesser General Public License version 2.1 as published
0009 // by the Free Software Foundation, with special exception defined in the file
0010 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
0011 // distribution for complete text of the license and disclaimer of any warranty.
0012 //
0013 // Alternatively, this file may be used under the terms of Open CASCADE
0014 // commercial license or contractual agreement.
0015 
0016 #ifndef _Graphic3d_PresentationAttributes_HeaderFile
0017 #define _Graphic3d_PresentationAttributes_HeaderFile
0018 
0019 #include <Aspect_TypeOfHighlightMethod.hxx>
0020 #include <Graphic3d_AspectFillArea3d.hxx>
0021 #include <Graphic3d_ZLayerId.hxx>
0022 #include <Standard_Transient.hxx>
0023 #include <Standard_Type.hxx>
0024 #include <Quantity_ColorRGBA.hxx>
0025 
0026 //! Class defines presentation properties.
0027 class Graphic3d_PresentationAttributes : public Standard_Transient
0028 {
0029   DEFINE_STANDARD_RTTIEXT(Graphic3d_PresentationAttributes, Standard_Transient)
0030 public:
0031 
0032   //! Empty constructor.
0033   Graphic3d_PresentationAttributes()
0034   : myBasicColor (Quantity_NOC_WHITE),
0035     myHiMethod (Aspect_TOHM_COLOR),
0036     myZLayer   (Graphic3d_ZLayerId_Default),
0037     myDispMode (0)
0038   {
0039     //
0040   }
0041 
0042   //! Destructor.
0043   virtual ~Graphic3d_PresentationAttributes() {}
0044 
0045   //! Returns highlight method, Aspect_TOHM_COLOR by default.
0046   Aspect_TypeOfHighlightMethod Method() const { return myHiMethod; }
0047 
0048   //! Changes highlight method to the given one.
0049   virtual void SetMethod (const Aspect_TypeOfHighlightMethod theMethod) { myHiMethod = theMethod; }
0050 
0051   //! Returns basic presentation color (including alpha channel).
0052   const Quantity_ColorRGBA& ColorRGBA() const { return myBasicColor; }
0053 
0054   //! Returns basic presentation color, Quantity_NOC_WHITE by default.
0055   const Quantity_Color& Color() const { return myBasicColor.GetRGB(); }
0056 
0057   //! Sets basic presentation color (RGB components, does not modifies transparency).
0058   virtual void SetColor (const Quantity_Color& theColor)
0059   {
0060     myBasicColor.ChangeRGB() = theColor;
0061   }
0062 
0063   //! Returns basic presentation transparency (0 - opaque, 1 - fully transparent), 0 by default (opaque).
0064   Standard_ShortReal Transparency() const { return 1.0f - myBasicColor.Alpha(); }
0065 
0066   //! Sets basic presentation transparency (0 - opaque, 1 - fully transparent).
0067   virtual void SetTransparency (const Standard_ShortReal theTranspCoef)
0068   {
0069     myBasicColor.SetAlpha (1.0f - theTranspCoef);
0070   }
0071 
0072   //! Returns presentation Zlayer, Graphic3d_ZLayerId_Default by default.
0073   //! Graphic3d_ZLayerId_UNKNOWN means undefined (a layer of main presentation to be used).
0074   Graphic3d_ZLayerId ZLayer() const { return myZLayer; }
0075 
0076   //! Sets presentation Zlayer.
0077   virtual void SetZLayer (const Graphic3d_ZLayerId theLayer) { myZLayer = theLayer; }
0078 
0079   //! Returns display mode, 0 by default.
0080   //! -1 means undefined (main display mode of presentation to be used).
0081   Standard_Integer DisplayMode() const { return myDispMode; }
0082 
0083   //! Sets display mode.
0084   virtual void SetDisplayMode (const Standard_Integer theMode) { myDispMode = theMode; }
0085 
0086   //! Return basic presentation fill area aspect, NULL by default.
0087   //! When set, might be used instead of Color() property.
0088   const Handle(Graphic3d_AspectFillArea3d)& BasicFillAreaAspect() const { return myBasicFillAreaAspect; }
0089 
0090   //! Sets basic presentation fill area aspect.
0091   virtual void SetBasicFillAreaAspect (const Handle(Graphic3d_AspectFillArea3d)& theAspect) { myBasicFillAreaAspect = theAspect; }
0092 
0093   //! Dumps the content of me into the stream
0094   Standard_EXPORT virtual void DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth = -1) const;
0095 
0096 protected:
0097 
0098   Handle(Graphic3d_AspectFillArea3d) myBasicFillAreaAspect; //!< presentation fill area aspect
0099   Quantity_ColorRGBA                 myBasicColor;          //!< presentation color
0100   Aspect_TypeOfHighlightMethod       myHiMethod;            //!< box or color highlighting
0101   Graphic3d_ZLayerId                 myZLayer;              //!< Z-layer
0102   Standard_Integer                   myDispMode;            //!< display mode
0103 
0104 };
0105 
0106 DEFINE_STANDARD_HANDLE (Graphic3d_PresentationAttributes, Standard_Transient)
0107 
0108 #endif // _Graphic3d_PresentationAttributes_HeaderFile