1 // Created on: 2017-06-16
2 // Created by: Natalia ERMOLAEVA
3 // Copyright (c) 2017 OPEN CASCADE SAS
5 // This file is part of Open CASCADE Technology software library.
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.
13 // Alternatively, this file may be used under the terms of Open CASCADE
14 // commercial license or contractual agreement.
16 #ifndef VInspector_ItemPresentableObject_H
17 #define VInspector_ItemPresentableObject_H
19 #include <Standard.hxx>
20 #include <inspector/VInspector_ItemBase.hxx>
22 #include <AIS_InteractiveObject.hxx>
23 #include <NCollection_List.hxx>
25 class QItemSelectionModel;
27 class VInspector_ItemPresentableObject;
28 typedef QExplicitlySharedDataPointer<VInspector_ItemPresentableObject> VInspector_ItemPresentableObjectPtr;
30 //! \class VInspector_ItemPresentableObject
31 //! Item presents information about AIS_InteractiveObject.
32 //! Parent is item context, children are item selections.
33 class VInspector_ItemPresentableObject : public VInspector_ItemBase
38 //! Creates an item wrapped by a shared pointer
39 static VInspector_ItemPresentableObjectPtr CreateItem (TreeModel_ItemBasePtr theParent, const int theRow, const int theColumn)
40 { return VInspector_ItemPresentableObjectPtr (new VInspector_ItemPresentableObject (theParent, theRow, theColumn)); }
42 virtual ~VInspector_ItemPresentableObject() {}
44 //! Returns data object of the item.
46 virtual const Handle(Standard_Transient)& Object() const Standard_OVERRIDE { initItem(); return myIO; }
48 //! Returns the current interactive object, init item if it was not initialized yet
49 //! \return interactive object
50 Handle(AIS_InteractiveObject) GetInteractiveObject() const { return Handle(AIS_InteractiveObject)::DownCast (Object()); }
52 //! Returns pointer information for the current interactive object, init item if it was not initialized yet
53 //! \return string value
54 Standard_EXPORT QString PointerInfo() const;
56 //! Inits the item, fills internal containers
57 Standard_EXPORT virtual void Init() Standard_OVERRIDE;
59 //! Resets cached values
60 Standard_EXPORT virtual void Reset() Standard_OVERRIDE;
62 //! Returns presentation of the attribute to be visualized in the view
63 //! \thePresentations [out] container of presentation handles to be visualized
64 Standard_EXPORT virtual void Presentations (NCollection_List<Handle(Standard_Transient)>& thePresentations) Standard_OVERRIDE;
68 //! Initialize the current item. It is empty because Reset() is also empty.
69 virtual void initItem() const Standard_OVERRIDE;
71 //! Returns number of item selected
72 //! \return rows count
73 virtual int initRowCount() const Standard_OVERRIDE;
75 //! Returns item information for the given role. Fills internal container if it was not filled yet
76 //! \param theItemRole a value role
78 virtual QVariant initValue (const int theItemRole) const Standard_OVERRIDE;
80 //! Returns stream value of the item to fulfill property panel.
81 //! \return stream value or dummy
82 Standard_EXPORT virtual void initStream (Standard_OStream& theOStream) const Standard_OVERRIDE;
85 //! Build presentation shape
86 //! \return generated shape of the item parameters
87 virtual TopoDS_Shape buildPresentationShape() Standard_OVERRIDE;
89 //! Set interactive object into the current field
90 //! \param theIO a presentation
91 void setInteractiveObject (Handle(AIS_InteractiveObject) theIO) { myIO = theIO; }
96 //! \param theParent a parent item
97 VInspector_ItemPresentableObject(TreeModel_ItemBasePtr theParent, const int theRow, const int theColumn)
98 : VInspector_ItemBase(theParent, theRow, theColumn) {}
102 Handle(AIS_InteractiveObject) myIO; //!< the current interactive context