0029807: [Regression to 7.0.0] Impossible to cut cone from prism
[occt.git] / tools / VInspector / VInspector_ItemSensitiveEntity.hxx
CommitLineData
14bbbdcb 1// Created on: 2017-06-16
2// Created by: Natalia ERMOLAEVA
3// Copyright (c) 2017 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_ItemSensitiveEntity_H
17#define VInspector_ItemSensitiveEntity_H
18
19#include <SelectMgr_SensitiveEntity.hxx>
20#include <SelectBasics_SensitiveEntity.hxx>
21#include <Standard.hxx>
0cb512c0 22#include <inspector/VInspector_ItemBase.hxx>
14bbbdcb 23
24class SelectBasics_EntityOwner;
25class VInspector_ItemSensitiveEntity;
26
27typedef QExplicitlySharedDataPointer<VInspector_ItemSensitiveEntity> VInspector_ItemSensitiveEntityPtr;
28
29//! \class VInspector_ItemSensitiveEntity
30//! The item shows information about SelectBasics_EntityOwner.
31//! The parent is item selection, children are item entity owners
32class VInspector_ItemSensitiveEntity : public VInspector_ItemBase
33{
34
35public:
36
37 //! Creates an item wrapped by a shared pointer
38 static VInspector_ItemSensitiveEntityPtr CreateItem (TreeModel_ItemBasePtr theParent, const int theRow, const int theColumn)
39 { return VInspector_ItemSensitiveEntityPtr (new VInspector_ItemSensitiveEntity (theParent, theRow, theColumn)); }
40
41 //! Destructor
42 virtual ~VInspector_ItemSensitiveEntity() Standard_OVERRIDE {};
43
44 //! \return the current sensitive entity
45 Standard_EXPORT Handle(SelectMgr_SensitiveEntity) GetSensitiveEntity() const;
46
47 //! Inits the item, fills internal containers
48 Standard_EXPORT virtual void Init() Standard_OVERRIDE;
49
50 //! Resets cached values
51 Standard_EXPORT virtual void Reset() Standard_OVERRIDE;
52
53protected:
54
55 //! Initialize the current item. It is empty because Reset() is also empty.
56 virtual void initItem() const Standard_OVERRIDE;
57
58 //! \return number of children.
59 virtual int initRowCount() const Standard_OVERRIDE { return !GetSensitiveEntity()->BaseSensitive().IsNull() ? 1 : 0; }
60
61 //! Returns item information for the given role. Fills internal container if it was not filled yet
62 //! \param theItemRole a value role
63 //! \return the value
64 virtual QVariant initValue (const int theItemRole) const Standard_OVERRIDE;
65
66protected:
67
68 //! Creates a child item in the given position.
69 //! \param theRow the child row position
70 //! \param theColumn the child column position
71 //! \return the created item
72 virtual TreeModel_ItemBasePtr createChild (int theRow, int theColumn) Standard_OVERRIDE;
73
74 //! Returns owner of the current sensitive entity
75 //! \return owner
76 Handle(SelectBasics_EntityOwner) getEntityOwner() const;
77
78private:
79
80 //! Constructor
81 //! param theParent a parent item
82 VInspector_ItemSensitiveEntity(TreeModel_ItemBasePtr theParent, const int theRow, const int theColumn)
83 : VInspector_ItemBase(theParent, theRow, theColumn) {}
84
85private:
86
87 Handle(SelectMgr_SensitiveEntity) myEntity; //!< the current entity owner
88};
89
90#endif