4fac119726b258c905c081e417339ad88fd392b8
[occt.git] / tools / VInspector / VInspector_ItemGraphic3dCLight.hxx
1 // Created on: 2021-04-27
2 // Created by: Natalia ERMOLAEVA
3 // Copyright (c) 2021 OPEN CASCADE SAS
4 //
5 // This file is part of Open CASCADE Technology software library.
6 //
7 // This library is free software; you can redistribute it and/or modify it under
8 // the terms of the GNU Lesser General Public License version 2.1 as published
9 // by the Free Software Foundation, with special exception defined in the file
10 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
11 // distribution for complete text of the license and disclaimer of any warranty.
12 //
13 // Alternatively, this file may be used under the terms of Open CASCADE
14 // commercial license or contractual agreement. 
15
16 #ifndef VInspector_ItemGraphic3dCLight_H
17 #define VInspector_ItemGraphic3dCLight_H
18
19 #include <Standard.hxx>
20 #include <inspector/VInspector_ItemBase.hxx>
21
22 #include <Graphic3d_CLight.hxx>
23
24 class VInspector_ItemGraphic3dCLight;
25 typedef QExplicitlySharedDataPointer<VInspector_ItemGraphic3dCLight> VInspector_ItemGraphic3dCLightPtr;
26
27 //! \class VInspector_ItemGraphic3dCLight
28 //! Parent item is context properties, that corresponds to AIS_InteractiveContext
29 class VInspector_ItemGraphic3dCLight : public VInspector_ItemBase
30 {
31 public:
32
33   //! Creates an item wrapped by a shared pointer
34   static VInspector_ItemGraphic3dCLightPtr CreateItem (TreeModel_ItemBasePtr theParent, const int theRow, const int theColumn)
35   { return VInspector_ItemGraphic3dCLightPtr (new VInspector_ItemGraphic3dCLight (theParent, theRow, theColumn)); }
36
37   //! Destructor
38   virtual ~VInspector_ItemGraphic3dCLight() Standard_OVERRIDE {};
39
40   //! Inits the item, fills internal containers
41   Standard_EXPORT virtual void Init() Standard_OVERRIDE;
42
43   //! Resets cached values
44   Standard_EXPORT virtual void Reset() Standard_OVERRIDE;
45
46   //! Returns data object of the item.
47   //! \return object
48   virtual const Handle(Standard_Transient)& Object() const { initItem(); return myLight; }
49
50   //! Returns the current light, init item if it was not initialized yet
51   //! \return interactive object
52   Handle(Graphic3d_CLight) GetLight() const { return Handle(Graphic3d_CLight)::DownCast (Object()); }
53
54   //! Updates item by the item properties value
55   virtual void StoreItemProperties (const int theRow, const int theColumn, const QVariant& theValue) Standard_OVERRIDE;
56
57 protected:
58   //! Initializes the current item. It is empty because Reset() is also empty.
59   virtual void initItem() const Standard_OVERRIDE;
60
61   //! Returns number of displayed presentations
62   //! \return rows count
63   Standard_EXPORT virtual int initRowCount() const Standard_OVERRIDE;
64
65   //! Returns item information for the given role. Fills internal container if it was not filled yet
66   //! \param theItemRole a value role
67   //! \return the value
68   Standard_EXPORT virtual QVariant initValue (const int theItemRole) const Standard_OVERRIDE;
69
70   //! Returns stream value of the item to fulfill property panel.
71   //! \return stream value or dummy
72   Standard_EXPORT virtual void initStream (Standard_OStream& theOStream) const Standard_OVERRIDE;
73
74 private:
75
76   //! Constructor
77   //! param theParent a parent item
78   //! \param theRow the item row positition in the parent item
79   //! \param theColumn the item column positition in the parent item
80   VInspector_ItemGraphic3dCLight(TreeModel_ItemBasePtr theParent, const int theRow, const int theColumn)
81     : VInspector_ItemBase(theParent, theRow, theColumn) {}
82
83 protected:
84
85   Handle(Graphic3d_CLight) myLight; //!< the current light
86 };
87
88 #endif