TreeModel is extended by ItemPropertiesCreator (to customize items/panes outside tools),
ViewControl have TransientShape to use in interface TopoDS_Shape as a Handle(Standard_Transient)
ShapeView start of curve description for edge item
// function : GetTableEditType
// purpose :
// =======================================================================
-ViewControl_EditType MessageModel_ItemReportProperties::GetTableEditType (const int theRow, const int theColumn) const
+ViewControl_EditType MessageModel_ItemReportProperties::GetTableEditType (const int theRow, const int) const
{
switch (theRow)
{
Handle(Message_Report) MessageModel_ItemReportProperties::getItemReport() const
{
- MessageModel_ItemReportPtr aReportItem = itemDynamicCast<MessageModel_ItemReport>(myItem);
+ MessageModel_ItemReportPtr aReportItem = itemDynamicCast<MessageModel_ItemReport>(getItem());
if (!aReportItem)
return NULL;
//! Constructor
Standard_EXPORT MessageModel_ItemReportProperties (TreeModel_ItemBasePtr theItem)
- : TreeModel_ItemProperties(), myItem (theItem) {}
+ : TreeModel_ItemProperties (theItem) {}
//! Destructor
virtual ~MessageModel_ItemReportProperties() {}
protected:
//! Returns report
Handle(Message_Report) getItemReport() const;
-
-protected:
-
- TreeModel_ItemBasePtr myItem; //!< source item base
};
#endif
// function : Data
// purpose :
// =======================================================================
+#include <BRep_CurveRepresentation.hxx>
+#include <BRep_ListIteratorOfListOfCurveRepresentation.hxx>
+#include <BRep_TEdge.hxx>
QVariant ShapeView_ItemPropertiesEdge::GetTableData (const int theRow, const int theColumn, int theRole) const
{
: ShapeView_Tools::ToString (aCurve->IsPeriodic());
default: break;
}
+
int anOwnRows = 7;
+ /*int aTableRow = theRow - anOwnRows;
+ // BRep_Tool::PolygonOnTriangulation // find the representation
+
+ TopoDS_Edge E = TopoDS::Edge(aShape);
+ Handle(Poly_PolygonOnTriangulation) P;
+ Handle(Poly_Triangulation) T;
+ TopLoc_Location L;
+
+ const BRep_TEdge* TE = static_cast<const BRep_TEdge*>(anEdge.TShape().get());
+ BRep_ListIteratorOfListOfCurveRepresentation itcr(TE->Curves());
+
+ int aCurRow = 0;
+ while (itcr.More()) {
+ const Handle(BRep_CurveRepresentation)& cr = itcr.Value();
+ if (cr->IsPolygonOnTriangulation()) {
+ if (aCurRow < aTableRow)
+ continue;
+ const BRep_PolygonOnTriangulation* PT =
+ static_cast<const BRep_PolygonOnTriangulation*>(cr.get());
+ P = PT->PolygonOnTriangulation();
+ T = PT->Triangulation();
+ L = E.Location() * PT->Location();
+ return isFirstColumn ? QVariant("Polygon: ") : P.;
+ }
+ itcr.Next();
+ }
+ L.Identity();
+ P.Nullify();
+ T.Nullify();
+
+ anOwnRows += aTableRow;
+ */
return ShapeView_Tools::GetShapeGlobalProperties (aShape, theRow - anOwnRows, theColumn);
}
TopoDS_Shape ShapeView_ItemPropertiesEdge::getItemShape() const
{
- ShapeView_ItemShapePtr aShapeItem = itemDynamicCast<ShapeView_ItemShape>(myItem);
+ ShapeView_ItemShapePtr aShapeItem = itemDynamicCast<ShapeView_ItemShape>(getItem());
if (!aShapeItem)
return TopoDS_Shape();
public:
//! Constructor
- Standard_EXPORT ShapeView_ItemPropertiesEdge (TreeModel_ItemBasePtr theItem)
- : TreeModel_ItemProperties(), myItem (theItem) {}
+ Standard_EXPORT ShapeView_ItemPropertiesEdge (const TreeModel_ItemBasePtr& theItem)
+ : TreeModel_ItemProperties (theItem) {}
//! Destructor
virtual ~ShapeView_ItemPropertiesEdge() {}
//! Returns item shape
TopoDS_Shape getItemShape() const;
-protected:
-
- TreeModel_ItemBasePtr myItem; //!< source item base
};
#endif
TopoDS_Shape ShapeView_ItemPropertiesFace::getItemShape() const
{
- ShapeView_ItemShapePtr aShapeItem = itemDynamicCast<ShapeView_ItemShape>(myItem);
+ ShapeView_ItemShapePtr aShapeItem = itemDynamicCast<ShapeView_ItemShape>(getItem());
if (!aShapeItem)
return TopoDS_Shape();
public:
//! Constructor
- Standard_EXPORT ShapeView_ItemPropertiesFace (TreeModel_ItemBasePtr theItem)
- : TreeModel_ItemProperties(), myItem (theItem) {}
+ Standard_EXPORT ShapeView_ItemPropertiesFace (const TreeModel_ItemBasePtr& theItem)
+ : TreeModel_ItemProperties (theItem) {}
//! Destructor
virtual ~ShapeView_ItemPropertiesFace() {}
//! Returns item shape
TopoDS_Shape getItemShape() const;
-protected:
-
- TreeModel_ItemBasePtr myItem; //!< source item base
};
#endif
TopoDS_Shape ShapeView_ItemPropertiesVertex::getItemShape() const
{
- ShapeView_ItemShapePtr aShapeItem = itemDynamicCast<ShapeView_ItemShape>(myItem);
+ ShapeView_ItemShapePtr aShapeItem = itemDynamicCast<ShapeView_ItemShape>(getItem());
if (!aShapeItem)
return TopoDS_Shape();
public:
//! Constructor
- Standard_EXPORT ShapeView_ItemPropertiesVertex (TreeModel_ItemBasePtr theItem)
- : TreeModel_ItemProperties(), myItem (theItem) {}
+ Standard_EXPORT ShapeView_ItemPropertiesVertex (const TreeModel_ItemBasePtr& theItem)
+ : TreeModel_ItemProperties (theItem) {}
//! Destructor
virtual ~ShapeView_ItemPropertiesVertex() {}
//! Returns item shape
TopoDS_Shape getItemShape() const;
-protected:
-
- TreeModel_ItemBasePtr myItem; //!< source item base
};
#endif
switch (theRow)
{
- case 0: return isFirstColumn ? "Checked" : ToString (theShape.Checked());
- case 1: return isFirstColumn ? "Closed" : ToString (theShape.Closed());
- case 2: return isFirstColumn ? "Infinite" : ToString (theShape.Infinite());
- case 3: return isFirstColumn ? "Locked" : ToString (theShape.Locked());
- case 4: return isFirstColumn ? "Modified" : ToString (theShape.Modified());
- case 5: return isFirstColumn ? "Orientable" : ToString (theShape.Orientable());
+ case 0: return isFirstColumn ? "COMMON PROPERTIES" : "";
+ case 1: return isFirstColumn ? "Checked" : ToString (theShape.Checked());
+ case 2: return isFirstColumn ? "Closed" : ToString (theShape.Closed());
+ case 3: return isFirstColumn ? "Infinite" : ToString (theShape.Infinite());
+ case 4: return isFirstColumn ? "Locked" : ToString (theShape.Locked());
+ case 5: return isFirstColumn ? "Modified" : ToString (theShape.Modified());
+ case 6: return isFirstColumn ? "Orientable" : ToString (theShape.Orientable());
}
return QVariant();
}
\ No newline at end of file
TreeModel_ItemBase.hxx
TreeModel_ItemProperties.cxx
TreeModel_ItemProperties.hxx
+TreeModel_ItemPropertiesCreator.cxx
+TreeModel_ItemPropertiesCreator.hxx
TreeModel_ItemRole.hxx
TreeModel_ModelBase.cxx
TreeModel_ModelBase.hxx
// commercial license or contractual agreement.
#include <inspector/TreeModel_ItemBase.hxx>
-
+#include <inspector/TreeModel_ItemProperties.hxx>
#include <inspector/TreeModel_ItemRole.hxx>
#include <Standard_WarningsDisable.hxx>
m_iColumn = theColumn;
}
+// =======================================================================
+// function : SetProperties
+// purpose :
+// =======================================================================
+void TreeModel_ItemBase::SetProperties (const Handle(TreeModel_ItemProperties)& theProperties)
+{
+ myProperties = theProperties;
+}
+
+// =======================================================================
+// function : GetProperties
+// purpose :
+// =======================================================================
+Handle(TreeModel_ItemProperties) TreeModel_ItemBase::GetProperties() const
+{
+ return myProperties;
+}
+
// =======================================================================
// function : reset
// purpose :
TreeModel_ItemBasePtr anItem;
if (isToCreate) {
- anItem = createChild (theRow, theColumn);
+ int aRowCount = rowCount();
+ if (myProperties.IsNull() || theRow < aRowCount - myProperties->ChildItemCount())
+ anItem = createChild (theRow, theColumn);
+ else if (!myProperties.IsNull())
+ anItem = myProperties->CreateChildItem (theRow, theColumn);
+
if (anItem)
m_ChildItems[aPos] = anItem;
}
if (myCachedValues.contains (theItemRole))
return myCachedValues[theItemRole];
- const_cast<TreeModel_ItemBase*>(this)->myCachedValues.insert (theItemRole,
- theItemRole == TreeModel_ItemRole_RowCountRole ? QVariant (initRowCount()) : initValue (theItemRole));
+ QVariant aValueToCache;
+ if (theItemRole == TreeModel_ItemRole_RowCountRole)
+ {
+ aValueToCache = myProperties.IsNull() ? initRowCount() : (initRowCount() + myProperties->ChildItemCount());
+ }
+ else
+ aValueToCache = initValue (theItemRole);
+ const_cast<TreeModel_ItemBase*>(this)->myCachedValues.insert (theItemRole, aValueToCache);
return myCachedValues.contains (theItemRole) ? myCachedValues[theItemRole] : QVariant();
}
+
+// =======================================================================
+// function : initValue
+// purpose :
+// =======================================================================
+QVariant TreeModel_ItemBase::initValue (const int theItemRole) const
+{
+ if (theItemRole != Qt::DisplayRole && theItemRole != Qt::ToolTipRole)
+ return QVariant();
+
+ switch (Column())
+ {
+ case 1: { return rowCount(); }
+ //case 2: return ViewControl_Tools::GetPointerInfo (GetObject(), true).ToCString();
+ case 3: { return Row(); }
+ }
+
+ return QVariant();
+}
+
+// =======================================================================
+// function : RowCountWithoutProperties
+// purpose :
+// =======================================================================
+int TreeModel_ItemBase::RowCountWithoutProperties (const TreeModel_ItemBasePtr& theItem)
+{
+ if (!theItem->GetProperties())
+ return theItem->rowCount();
+
+ return theItem->rowCount() - theItem->GetProperties()->ChildItemCount();
+}
#include <Standard.hxx>
#include <Standard_Macro.hxx>
+#include <Standard_Handle.hxx>
#include <inspector/TreeModel_ItemRole.hxx>
-#include <inspector/TreeModel_ItemProperties.hxx>
#include <Standard_WarningsDisable.hxx>
#include <QExplicitlySharedDataPointer>
#include <Standard_WarningsRestore.hxx>
class TreeModel_ItemBase;
+class TreeModel_ItemProperties;
typedef QExplicitlySharedDataPointer<TreeModel_ItemBase> TreeModel_ItemBasePtr;
//! there should be initialized here.
virtual void Init() { m_bInitialized = true; }
+ //! Returns data object of the item.
+ //! \return object
+ virtual Handle(Standard_Transient) GetObject() const { return NULL; }
+
//! Resets the item and the child items content. Sets the initialized state to false.
//! If the item has internal values, there should be reseted here.
Standard_EXPORT virtual void Reset();
int rowCount() const { return cachedValue(TreeModel_ItemRole_RowCountRole).toInt(); }
//! Sets item table properties builder
- void SetProperties (const Handle(TreeModel_ItemProperties)& theProperties) { myProperties = theProperties; }
+ Standard_EXPORT void SetProperties (const Handle(TreeModel_ItemProperties)& theProperties);
//! Returns item table properties builder
- Handle(TreeModel_ItemProperties) GetProperties() const { return myProperties; }
+ Standard_EXPORT Handle(TreeModel_ItemProperties) GetProperties() const;
+
+ //! Returns number of item rows only
+ static Standard_EXPORT int RowCountWithoutProperties (const TreeModel_ItemBasePtr& theItem);
protected:
//! \param theColumn the item column positition in the parent item
Standard_EXPORT TreeModel_ItemBase (TreeModel_ItemBasePtr theParent, const int theRow, const int theColumn);
+ //! Initialize the current item. It creates a backup of the specific item information
+ virtual void initItem() const {}
+
//! Creates a child item in the given position.
//! \param theRow the child row position
//! \param theColumn the child column position
//! Return data value for the role. It should be reimplemented in child
//! \param theItemRole a value role
//! \return the value
- virtual QVariant initValue (const int theItemRole) const = 0;
+ Standard_EXPORT virtual QVariant initValue (const int theItemRole) const;
private:
#include <Standard_Type.hxx>
#include <Standard_Transient.hxx>
+#include <NCollection_List.hxx>
+
+#include <inspector/TreeModel_ItemBase.hxx>
#include <inspector/ViewControl_EditType.hxx>
#include <Standard_WarningsDisable.hxx>
{
public:
//! Constructor
- TreeModel_ItemProperties() {}
+ TreeModel_ItemProperties (const TreeModel_ItemBasePtr& theItem) : myItem (theItem) {}
//! Destructor
~TreeModel_ItemProperties() {}
+ //! Returns number of item children
+ //! \return an integer value, ZERO by default
+ virtual int ChildItemCount() const { return 0; }
+
+ //! Creates a child item in the given position.
+ //! \param theRow the child row position
+ //! \param theColumn the child column position
+ //! \return the created item
+ virtual TreeModel_ItemBasePtr CreateChildItem (int theRow, int theColumn) const
+ { (void)theRow; (void)theColumn; return TreeModel_ItemBasePtr(); }
+
//! Returns number of table rows
//! \return an integer value
virtual int GetTableColumnCount() const { return 2; }
virtual QList<QVariant> GetTableEnumValues (const int theRow, const int theColumn) const
{ (void)theRow; (void)theColumn; return QList<QVariant>(); }
- //! Returns flags for the item: ItemIsEnabled | Qt::ItemIsSelectable.
- //! Additional flag for the column 1 is Qt::ItemIsEditable.
- //! \param theIndex a model index
- //! \return flags
- Standard_EXPORT virtual Qt::ItemFlags GetTableFlags (const int theRow, const int theColumn) const;
-
//! Sets the value into the table cell. Only 1st column value might be modified.
//! \param theRow a model index row
//! \param theColumn a model index column
virtual bool SetTableData (const int theRow, const int theColumn, const QVariant& theValue)
{ (void)theRow; (void)theColumn; (void)theValue; return false; }
+ //! Returns presentation of the attribute to be visualized in the view
+ //! \param theRow a model index row
+ //! \param theColumn a model index column
+ //! \thePresentations [out] container of presentation handles to be visualized
+ virtual void GetPresentations (const int theRow, const int theColumn,
+ NCollection_List<Handle(Standard_Transient)>& thePresentations)
+ { (void)theRow; (void)theColumn; (void)thePresentations; }
+
+ //! Returns flags for the item: ItemIsEnabled | Qt::ItemIsSelectable.
+ //! Additional flag for the column 1 is Qt::ItemIsEditable.
+ //! \param theIndex a model index
+ //! \return flags
+ Standard_EXPORT virtual Qt::ItemFlags GetTableFlags (const int theRow, const int theColumn) const;
+
+
DEFINE_STANDARD_RTTIEXT (TreeModel_ItemProperties, Standard_Transient)
+
+protected:
+ //! Returns current item
+ TreeModel_ItemBasePtr getItem() const { return myItem; }
+
+private:
+ TreeModel_ItemBasePtr myItem; //! current item
};
#endif
\ No newline at end of file
--- /dev/null
+// Created on: 2019-04-12
+// Created by: Natalia ERMOLAEVA
+// Copyright (c) 2019 OPEN CASCADE SAS
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
+
+#include <inspector/TreeModel_ItemPropertiesCreator.hxx>
+
+IMPLEMENT_STANDARD_RTTIEXT(TreeModel_ItemPropertiesCreator, Standard_Transient)
--- /dev/null
+// Created on: 2019-04-12
+// Created by: Natalia ERMOLAEVA
+// Copyright (c) 2019 OPEN CASCADE SAS
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
+
+#ifndef TreeModel_ItemPropertiesCreator_H
+#define TreeModel_ItemPropertiesCreator_H
+
+#include <inspector/TreeModel_ItemBase.hxx>
+
+#include <Standard.hxx>
+#include <Standard_Handle.hxx>
+#include <Standard_Macro.hxx>
+#include <Standard_Type.hxx>
+#include <Standard_Transient.hxx>
+
+class TreeModel_ItemProperties;
+
+DEFINE_STANDARD_HANDLE (TreeModel_ItemPropertiesCreator, Standard_Transient)
+
+//! \class TreeModel_ItemPropertiesCreator
+//! \brief An interface to create custom panes by transient object name.
+class TreeModel_ItemPropertiesCreator : public Standard_Transient
+{
+public:
+
+ //! Constructor
+ TreeModel_ItemPropertiesCreator() {}
+
+ //! Destructor
+ virtual ~TreeModel_ItemPropertiesCreator() {}
+
+ //! Creates pane for type
+ //! \param theName a type name
+ //! \return a pane if it can be created for this type or NULL
+ virtual TreeModel_ItemProperties* GetProperties (const TreeModel_ItemBasePtr& theItem) = 0;
+
+ DEFINE_STANDARD_RTTIEXT (TreeModel_ItemPropertiesCreator, Standard_Transient)
+};
+
+#endif
#include <inspector/TreeModel_ModelBase.hxx>
#include <inspector/TreeModel_ItemBase.hxx>
+#include <inspector/TreeModel_ItemProperties.hxx>
+#include <inspector/TreeModel_ItemPropertiesCreator.hxx>
#include <inspector/TreeModel_Tools.hxx>
#include <inspector/TreeModel_VisibilityState.hxx>
+#include <Standard_Transient.hxx>
+
#include <Standard_WarningsDisable.hxx>
#include <QIcon>
#include <Standard_WarningsRestore.hxx>
else
aParentItem = GetItemByIndex (theParent);
+ if (!aParentItem)
+ return 0;
+ if (!aParentItem->IsInitialized())
+ {
+ TreeModel_ItemProperties* aProperties = 0;
+ if (!myPropertiesCreators.IsEmpty())
+ {
+ for (NCollection_List<Handle(TreeModel_ItemPropertiesCreator)>::Iterator anIterator (myPropertiesCreators); anIterator.More(); anIterator.Next())
+ {
+ Handle(TreeModel_ItemPropertiesCreator) aCreator = anIterator.Value();
+ aProperties = aCreator->GetProperties (aParentItem);
+ if (aProperties)
+ break;
+ }
+ }
+ aParentItem->SetProperties (aProperties);
+ }
+
return aParentItem ? aParentItem->rowCount() : 0;
}
#endif
}
+// =======================================================================
+// function : SetPropertiesCreator
+// purpose :
+// =======================================================================
+void TreeModel_ModelBase::AddPropertiesCreator (const Handle(TreeModel_ItemPropertiesCreator)& theCreator)
+{
+ if (myPropertiesCreators.Contains (theCreator))
+ return;
+ myPropertiesCreators.Append (theCreator);
+}
+
+// =======================================================================
+// function : GetProperties
+// purpose :
+// =======================================================================
+const NCollection_List<Handle(TreeModel_ItemPropertiesCreator)>& TreeModel_ModelBase::GetPropertiesCreators() const
+{
+ return myPropertiesCreators;
+}
+
// =======================================================================
// function : GetSelected
// purpose :
#include <inspector/TreeModel_ItemBase.hxx>
#include <inspector/TreeModel_HeaderSection.hxx>
+#include <NCollection_List.hxx>
+
#include <Standard_WarningsDisable.hxx>
#include <QAbstractItemModel>
#include <QExplicitlySharedDataPointer>
#include <QVector>
#include <Standard_WarningsRestore.hxx>
+class TreeModel_ItemPropertiesCreator;
class TreeModel_VisibilityState;
//! \class TreeModel_ModelBase
virtual int columnCount (const QModelIndex& theParent = QModelIndex()) const Standard_OVERRIDE
{ (void)theParent; return myHeaderValues.size(); }
+ //! Sets item table properties builder
+ Standard_EXPORT void AddPropertiesCreator (const Handle(TreeModel_ItemPropertiesCreator)& theCreator);
+
+ //! Returns item table properties builder
+ Standard_EXPORT const NCollection_List<Handle(TreeModel_ItemPropertiesCreator)>& GetPropertiesCreators() const;
+
//! Returns default value of the visibility column
//! \return integer value
static int ColumnVisibilityWidth() { return 20; }
QIcon myInvisibleIcon; //!< icon of invisible state
QModelIndexList myHighlightedIndices; //!< tree model indices that should be visualized as highlighted
+
+ NCollection_List<Handle(TreeModel_ItemPropertiesCreator)> myPropertiesCreators; //!< property pane creators for items
};
#endif
//! \return a context
Standard_EXPORT Handle(AIS_InteractiveContext) GetContext() const;
- //! Returns data object of the item.
- //! \return object
- virtual Handle(Standard_Transient) GetObject() const { return NULL; }
-
//! Returns item information for the given role. Fills internal container if it was not filled yet
//! \param theItemRole a value role
//! \return the value
protected:
- //! Initialize the current item. It creates a backup of the specific item information
- virtual void initItem() const {}
-
//! Build presentation shape
//! \return generated shape of the item parameters
virtual TopoDS_Shape buildPresentationShape() { return TopoDS_Shape(); }
int VInspector_ItemPrs3dDrawer::initRowCount() const
{
- VInspector_ItemFolderObjectPtr aParentItem = itemDynamicCast<VInspector_ItemFolderObject>(Parent());
- if (!aParentItem)
+ VInspector_ItemPrs3dDrawerPtr aParentDrawerItem = itemDynamicCast<VInspector_ItemPrs3dDrawer>(Parent());
+ if (aParentDrawerItem)
return 0;
Handle(Prs3d_Drawer) aDrawer = GetDrawer();
{
if (theRow == 0)
{
- VInspector_ItemFolderObjectPtr aParentItem = itemDynamicCast<VInspector_ItemFolderObject>(Parent());
- if (aParentItem)
- return VInspector_ItemPrs3dDrawer::CreateItem (currentItem(), theRow, theColumn); // "Link"
+ return VInspector_ItemPrs3dDrawer::CreateItem (currentItem(), theRow, theColumn); // "Link"
}
else
return VInspector_ItemPrs3dAspect::CreateItem (currentItem(), theRow, theColumn); // "Aspects"
//! \return the created item
virtual TreeModel_ItemBasePtr createChild (int theRow, int theColumn) Standard_OVERRIDE;
-private:
+protected:
//! Set interactive object into the current field
//! \param theIO a presentation
void setDrawer (const Handle(Prs3d_Drawer)& theDrawer, const TCollection_AsciiString& theName)
{ myDrawer = theDrawer; myName = theName; }
-private:
+protected:
//! Constructor
//! param theParent a parent item
QVariant VInspector_TableModelValues::Data (const int theRow, const int theColumn, int theRole) const
{
+ int aRow = theRow;
+ if (!myItem->GetProperties().IsNull())
+ {
+ int aPropertiesCount = myItem->GetProperties()->GetTableRowCount();
+ if (aRow < aPropertiesCount)
+ return myItem->GetProperties()->GetTableData (theRow, theColumn, theRole);
+ else
+ aRow = aRow - aPropertiesCount;
+ }
switch (theRole)
{
case Qt::FontRole:
{
if (theColumn == 0)
return QColor (Qt::darkGray).darker(150);
- else if (GetEditType (theRow, theColumn) != ViewControl_EditType_None)
+ else if (GetEditType (aRow, theColumn) != ViewControl_EditType_None)
return ViewControl_TableModelValues::EditCellColor();
}
default:
{
VInspector_ItemBasePtr anItem = GetItem();
+ if (!anItem)
+ return QVariant();
Handle(Standard_Transient) anObject = anItem->GetObject();
if (anObject.IsNull())
- return anItem->GetTableData (theRow, theColumn, theRole);
+ return anItem->GetTableData (aRow, theColumn, theRole);
- int aCurrentRow = theRow;
+ int aCurrentRow = aRow;
for (NCollection_List<Handle(ViewControl_PaneCreator)>::Iterator anIterator (myCreators); anIterator.More(); anIterator.Next())
{
Handle(ViewControl_PaneCreator) aCreator = anIterator.Value();
if (theRole != Qt::EditRole)
return false;
+ int aRow = theRow;
+ if (!myItem->GetProperties().IsNull())
+ {
+ int aPropertiesCount = myItem->GetProperties()->GetTableRowCount();
+ if (aRow < aPropertiesCount)
+ return myItem->GetProperties()->SetTableData (theRow, theColumn, theValue);
+ else
+ aRow = aRow - aPropertiesCount;
+ }
+
VInspector_ItemBasePtr anItem = GetItem();
+ if (!anItem)
+ return false;
+
Handle(Standard_Transient) anObject = anItem->GetObject();
if (anObject.IsNull())
- return anItem->SetTableData (theRow, theColumn, theValue);
+ return anItem->SetTableData (aRow, theColumn, theValue);
- int aCurrentRow = theRow;
+ int aCurrentRow = aRow;
for (NCollection_List<Handle(ViewControl_PaneCreator)>::Iterator anIterator (myCreators); anIterator.More(); anIterator.Next())
{
Handle(ViewControl_PaneCreator) aCreator = anIterator.Value();
int VInspector_TableModelValues::RowCount (const QModelIndex& theParent) const
{
+ int aRowCount = 0;
+ if (!myItem->GetProperties().IsNull())
+ aRowCount = myItem->GetProperties()->GetTableRowCount();
+
VInspector_ItemBasePtr anItem = GetItem();
+ if (!anItem)
+ return aRowCount;
- int aRowCount = anItem->GetTableRowCount();
+ aRowCount += anItem->GetTableRowCount();
Handle(Standard_Transient) anObject = anItem->GetObject();
if (anObject.IsNull())
return aRowCount;
ViewControl_EditType VInspector_TableModelValues::GetEditType (const int theRow, const int theColumn) const
{
+ int aRow = theRow;
+ if (!myItem->GetProperties().IsNull())
+ {
+ int aPropertiesCount = myItem->GetProperties()->GetTableRowCount();
+ if (aRow < aPropertiesCount)
+ return myItem->GetProperties()->GetTableEditType (theRow, theColumn);
+ else
+ aRow = aRow - aPropertiesCount;
+ }
+
if (theColumn == 0)
return ViewControl_EditType_None;
VInspector_ItemBasePtr anItem = GetItem();
+ if (!anItem)
+ return ViewControl_EditType_None;
+
Handle(Standard_Transient) anObject = anItem->GetObject();
if (anObject.IsNull())
- return anItem->GetTableEditType (theRow, theColumn);
+ return anItem->GetTableEditType (aRow, theColumn);
- int aCurrentRow = theRow;
+ int aCurrentRow = aRow;
for (NCollection_List<Handle(ViewControl_PaneCreator)>::Iterator anIterator (myCreators); anIterator.More(); anIterator.Next())
{
Handle(ViewControl_PaneCreator) aCreator = anIterator.Value();
if (theColumn != 1)
return QList<QVariant>();
+ int aRow = theRow;
+ if (!myItem->GetProperties().IsNull())
+ {
+ int aPropertiesCount = myItem->GetProperties()->GetTableRowCount();
+ if (aRow < aPropertiesCount)
+ return myItem->GetProperties()->GetTableEnumValues (theRow, theColumn);
+ else
+ aRow = aRow - aPropertiesCount;
+ }
+
VInspector_ItemBasePtr anItem = GetItem();
+ if (!anItem)
+ return QList<QVariant>();
+
Handle(Standard_Transient) anObject = anItem->GetObject();
if (anObject.IsNull())
- return anItem->GetTableEnumValues (theRow, theColumn);
+ return anItem->GetTableEnumValues (aRow, theColumn);
- int aCurrentRow = theRow;
+ int aCurrentRow = aRow;
for (NCollection_List<Handle(ViewControl_PaneCreator)>::Iterator anIterator (myCreators); anIterator.More(); anIterator.Next())
{
Handle(ViewControl_PaneCreator) aCreator = anIterator.Value();
void VInspector_TableModelValues::GetPaneShapes (const int theRow, const int theColumn, NCollection_List<TopoDS_Shape>& theShapes)
{
+ int aRow = theRow;
+ if (!myItem->GetProperties().IsNull())
+ {
+ int aPropertiesCount = myItem->GetProperties()->GetTableRowCount();
+ if (aRow < aPropertiesCount)
+ return;// myItem->GetProperties()->GetEnumValues (theRow, theColumn);
+ else
+ aRow = aRow - aPropertiesCount;
+ }
+
VInspector_ItemBasePtr anItem = GetItem();
+ if (!anItem)
+ return;
+
Handle(Standard_Transient) anObject = anItem->GetObject();
if (anObject.IsNull())
return;
if (!aPane)
continue;
- ViewControl_PaneItem* anItem = aPane->GetSelected (anObject, theRow, theColumn);
+ ViewControl_PaneItem* anItem = aPane->GetSelected (anObject, aRow, theColumn);
if (anItem && !anItem->GetShape().IsNull())
theShapes.Append (anItem->GetShape());
}
#include <inspector/VInspector_Window.hxx>
+#include <AIS_ColoredShape.hxx>
#include <AIS_Shape.hxx>
#include <AIS_Trihedron.hxx>
#include <BRep_Builder.hxx>
#include <Prs3d_PointAspect.hxx>
#include <TopoDS_Compound.hxx>
+#include <TopExp_Explorer.hxx>
+
#include <inspector/TreeModel_ColumnType.hxx>
#include <inspector/TreeModel_ContextMenu.hxx>
+#include <inspector/TreeModel_ItemProperties.hxx>
#include <inspector/TreeModel_Tools.hxx>
#include <inspector/ViewControl_MessageDialog.hxx>
#include <inspector/ViewControl_TableModel.hxx>
#include <inspector/ViewControl_Tools.hxx>
+#include <inspector/ViewControl_TransientShape.hxx>
#include <inspector/VInspector_ToolBar.hxx>
#include <inspector/VInspector_Tools.hxx>
#include <inspector/VInspector_ViewModelHistory.hxx>
#include <inspector/VInspectorPaneAIS_PaneCreator.hxx>
+#include <inspector/VInspectorPaneAIS_PropertiesCreator.hxx>
#include <inspector/ViewControl_PropertyView.hxx>
#include <inspector/ViewControl_TreeView.hxx>
// property view
myPaneCreators.Append (new VInspectorPaneAIS_PaneCreator());
+ aTreeModel->AddPropertiesCreator (new VInspectorPaneAIS_PropertiesCreator());
myPropertyView = new ViewControl_PropertyView (myMainWindow,
QSize(VINSPECTOR_DEFAULT_PROPERTY_VIEW_WIDTH, VINSPECTOR_DEFAULT_PROPERTY_VIEW_HEIGHT));
{
TreeModel_ItemBasePtr anItem = *anItemIt;
VInspector_ItemBasePtr aVItem = itemDynamicCast<VInspector_ItemBase>(anItem);
- if (!aVItem && aVItem->Row() == 0)
+ if (!aVItem || aVItem->Row() == 0)
continue;
TopoDS_Shape aShape = aVItem->GetPresentationShape();
NCollection_List<TopoDS_Shape>& theShapes)
{
QList<TreeModel_ItemBasePtr> anItems = TreeModel_ModelBase::GetSelectedItems (theTreeViewIndices);
+ NCollection_List<Handle(Standard_Transient)> aPropertyPresentations;
for (QList<TreeModel_ItemBasePtr>::const_iterator anItemIt = anItems.begin(); anItemIt != anItems.end(); anItemIt++)
{
TreeModel_ItemBasePtr anItem = *anItemIt;
- VInspector_ItemBasePtr aVItem = itemDynamicCast<VInspector_ItemBase>(anItem);
- if (!aVItem || aVItem->Column() != 0)
+ if (!anItem || anItem->Column() != 0)
continue;
QList<ViewControl_TableModelValues*> aTableValues;
- VInspector_Tools::GetPropertyTableValues (aVItem, myPaneCreators, aTableValues);
+ VInspector_Tools::GetPropertyTableValues (anItem, myPaneCreators, aTableValues);
if (aTableValues.isEmpty())
continue;
+ Handle(TreeModel_ItemProperties) anItemProperties = anItem->GetProperties();
for (int aTableIt = 0; aTableIt < aTableValues.size(); aTableIt++)
{
VInspector_TableModelValues* aTableVals = dynamic_cast<VInspector_TableModelValues*>(aTableValues[aTableIt]);
{
QModelIndex anIndex = *anIndicesIt;
aTableVals->GetPaneShapes (anIndex.row(), anIndex.column(), theShapes);
+
+ if (!anItemProperties.IsNull())
+ {
+ anItemProperties->GetPresentations (anIndex.row(), anIndex.column(), aPropertyPresentations);
+ }
}
}
}
+
+ if (!aPropertyPresentations.IsEmpty())
+ {
+ for (NCollection_List<Handle(Standard_Transient)>::Iterator aPrsIterator (aPropertyPresentations); aPrsIterator.More(); aPrsIterator.Next())
+ {
+ Handle(ViewControl_TransientShape) aShapePrs = Handle(ViewControl_TransientShape)::DownCast (aPrsIterator.Value());
+ if (!aShapePrs.IsNull())
+ theShapes.Append (aShapePrs->GetShape());
+ }
+ }
}
// =======================================================================
if (!myPaneCreators.Contains (aPaneCreator))
myPaneCreators.Append (aPaneCreator);
}
+ if (!Handle(TreeModel_ItemPropertiesCreator)::DownCast (anObject).IsNull())
+ {
+ Handle(TreeModel_ItemPropertiesCreator) aPropCreator = Handle(TreeModel_ItemPropertiesCreator)::DownCast (anObject);
+ VInspector_ViewModel* aViewModel = dynamic_cast<VInspector_ViewModel*>(myTreeView->model());
+ aViewModel->AddPropertiesCreator (aPropCreator);
+ }
}
if (aContext.IsNull())
return false;
if (aShape.IsNull())
return isModelUpdated;
+#ifndef DEBUG_COLORED_SHAPE
Handle(AIS_Shape) aPresentation = new AIS_Shape (aShape);
+#else
+ Handle(AIS_ColoredShape) aPresentation = new AIS_ColoredShape (aShape);
+ TopExp_Explorer expS(aShape, TopAbs_EDGE);
+ for (; expS.More(); expS.Next())
+ {
+ aPresentation->SetCustomColor (expS.Current(), Quantity_Color (Quantity_NOC_GREEN));
+ }
+#endif
View_Displayer* aDisplayer = myViewWindow->GetDisplayer();
aDisplayer->DisplayPresentation (aPresentation);
+VInspectorPaneAIS_ColoredShape.cxx
+VInspectorPaneAIS_ColoredShape.hxx
+VInspectorPaneAIS_ItemPrs3dDrawer.cxx
+VInspectorPaneAIS_ItemPrs3dDrawer.hxx
VInspectorPaneAIS_PaneCreator.cxx
VInspectorPaneAIS_PaneCreator.hxx
+VInspectorPaneAIS_PropertiesCreator.cxx
+VInspectorPaneAIS_PropertiesCreator.hxx
VInspectorPaneAIS_Shape.cxx
VInspectorPaneAIS_Shape.hxx
\ No newline at end of file
--- /dev/null
+// Created on: 2019-04-14
+// Created by: Natalia ERMOLAEVA
+// Copyright (c) 2019 OPEN CASCADE SAS
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
+
+#include <inspector/VInspectorPaneAIS_ColoredShape.hxx>
+#include <inspector/VInspectorPaneAIS_ItemPrs3dDrawer.hxx>
+
+#include <inspector/ViewControl_Table.hxx>
+#include <inspector/ViewControl_Tools.hxx>
+
+#include <inspector/VInspector_Tools.hxx>
+
+#include <AIS_ColoredShape.hxx>
+
+// =======================================================================
+// function : ChildItemCount
+// purpose :
+// =======================================================================
+int VInspectorPaneAIS_ColoredShape::ChildItemCount() const
+{
+ Handle(AIS_ColoredShape) aPrs = GetPresentation();
+ if (aPrs.IsNull())
+ return 0;
+
+ return aPrs->CustomAspectsMap().Size();
+}
+
+// =======================================================================
+// function : CreateChildItem
+// purpose :
+// =======================================================================
+TreeModel_ItemBasePtr VInspectorPaneAIS_ColoredShape::CreateChildItem (int theRow, int theColumn) const
+{
+ Handle(AIS_ColoredShape) aPrs = GetPresentation();
+ if (aPrs.IsNull())
+ return TreeModel_ItemBasePtr();
+
+ return VInspectorPaneAIS_ItemPrs3dDrawer::CreateItem (getItem(), theRow, theColumn);
+}
+
+// =======================================================================
+// function : GetPresentation
+// purpose :
+// =======================================================================
+Handle(AIS_ColoredShape) VInspectorPaneAIS_ColoredShape::GetPresentation() const
+{
+ return Handle(AIS_ColoredShape)::DownCast (getItem()->GetObject());
+}
--- /dev/null
+// Created on: 2019-04-14
+// Created by: Natalia ERMOLAEVA
+// Copyright (c) 2019 OPEN CASCADE SAS
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
+
+#ifndef VInspectorPaneAIS_ColoredShape_H
+#define VInspectorPaneAIS_ColoredShape_H
+
+#include <Standard.hxx>
+#include <Standard_Macro.hxx>
+#include <inspector/TreeModel_ItemProperties.hxx>
+
+class AIS_ColoredShape;
+
+//! \class VInspectorPaneAIS_ColoredShape
+//! Item presents information about AIS_InteractiveObject.
+//! Parent is item context, children are item selections.
+class VInspectorPaneAIS_ColoredShape : public TreeModel_ItemProperties
+{
+public:
+ //! Constructor
+ VInspectorPaneAIS_ColoredShape (const TreeModel_ItemBasePtr& theItem) : TreeModel_ItemProperties (theItem) {}
+
+ //! Destructor
+ ~VInspectorPaneAIS_ColoredShape() {}
+
+ //! Returns number of item children
+ //! \return an integer value, ZERO by default
+ Standard_EXPORT virtual int ChildItemCount() const Standard_OVERRIDE;
+
+ //! Creates a child item in the given position.
+ //! \param theRow the child row position
+ //! \param theColumn the child column position
+ //! \return the created item
+ Standard_EXPORT virtual TreeModel_ItemBasePtr CreateChildItem (int theRow, int theColumn) const Standard_OVERRIDE;
+
+protected:
+ //! Converts transient object to custom presentation type
+ //! \return custom presentation
+ Handle(AIS_ColoredShape) GetPresentation() const;
+};
+
+#endif
--- /dev/null
+// Created on: 2018-08-10
+// Created by: Natalia ERMOLAEVA
+// Copyright (c) 2017 OPEN CASCADE SAS
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
+
+#include <inspector/VInspectorPaneAIS_ItemPrs3dDrawer.hxx>
+
+#include <inspector/VInspector_ItemPresentableObject.hxx>
+#include <inspector/TreeModel_ItemProperties.hxx>
+
+#include <AIS_ColoredShape.hxx>
+
+// =======================================================================
+// function : Init
+// purpose :
+// =======================================================================
+
+void VInspectorPaneAIS_ItemPrs3dDrawer::Init()
+{
+ Handle(Prs3d_Drawer) aDrawer;
+ TCollection_AsciiString aName;
+ VInspector_ItemPresentableObjectPtr aParentItem = itemDynamicCast<VInspector_ItemPresentableObject>(Parent());
+ if (!aParentItem)
+ {
+ VInspector_ItemPrs3dDrawer::Init();
+ return;
+ }
+
+ Handle(AIS_ColoredShape) aPrs = Handle(AIS_ColoredShape)::DownCast (aParentItem->GetInteractiveObject());
+ const AIS_DataMapOfShapeDrawer& anAspectsMap = aPrs->CustomAspectsMap();
+
+ int aRowId = Row();
+ int anItemRows = TreeModel_ItemBase::RowCountWithoutProperties (aParentItem);
+ int aCurrentRow = anItemRows;
+ for (AIS_DataMapOfShapeDrawer::Iterator anIter (anAspectsMap); anIter.More(); anIter.Next(), aCurrentRow++)
+ {
+ if (aRowId != aCurrentRow)
+ continue;
+
+ aDrawer = anIter.Value();
+ break;
+ }
+ aName = aDrawer.IsNull() ? "NULL" : (TCollection_AsciiString(aDrawer->DynamicType()->Name()) + "_" + (aRowId - anItemRows));
+ setDrawer (aDrawer, aName);
+ TreeModel_ItemBase::Init(); // to use getIO() without circling initialization
+}
+
+// =======================================================================
+// function : Reset
+// purpose :
+// =======================================================================
+
+void VInspectorPaneAIS_ItemPrs3dDrawer::Reset()
+{
+ VInspector_ItemPrs3dDrawer::Reset();
+
+ myShape = TopoDS_Shape();
+}
+
+// =======================================================================
+// function : initItem
+// purpose :
+// =======================================================================
+
+void VInspectorPaneAIS_ItemPrs3dDrawer::initItem() const
+{
+ if (IsInitialized())
+ return;
+ const_cast<VInspectorPaneAIS_ItemPrs3dDrawer*>(this)->Init();
+}
+
+// =======================================================================
+// function : GetTableRowCount
+// purpose :
+// =======================================================================
+int VInspectorPaneAIS_ItemPrs3dDrawer::GetTableRowCount() const
+{
+ Handle(Prs3d_Drawer) aDrawer = GetDrawer();
+ if (aDrawer.IsNull())
+ return 0;
+
+ return 1 + VInspector_ItemPrs3dDrawer::GetTableRowCount();
+}
+
+// =======================================================================
+// function : GetTableData
+// purpose :
+// =======================================================================
+QVariant VInspectorPaneAIS_ItemPrs3dDrawer::GetTableData (const int theRow, const int theColumn, const int theRole) const
+{
+ Handle(Prs3d_Drawer) aDrawer = GetDrawer();
+ if (aDrawer.IsNull())
+ return QVariant();
+
+ if (theRow == 0)
+ {
+ if (theRole == Qt::DisplayRole)
+ return theColumn == 0 ? QVariant ("TopoDS_Shape") : QVariant();
+ else
+ return QVariant();
+ }
+
+ return VInspector_ItemPrs3dDrawer::GetTableData (theRow, theColumn, theRole);
+}
+
--- /dev/null
+// Created on: 2018-08-10
+// Created by: Natalia ERMOLAEVA
+// Copyright (c) 2017 OPEN CASCADE SAS
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
+
+#ifndef VInspectorPaneAIS_ItemPrs3dDrawer_H
+#define VInspectorPaneAIS_ItemPrs3dDrawer_H
+
+#include <Standard.hxx>
+#include <inspector/VInspector_ItemBase.hxx>
+#include <inspector/VInspector_ItemPrs3dDrawer.hxx>
+
+#include <TopoDS_Shape.hxx>
+
+class Prs3d_BasicAspect;
+class QItemSelectionModel;
+
+class VInspectorPaneAIS_ItemPrs3dDrawer;
+typedef QExplicitlySharedDataPointer<VInspectorPaneAIS_ItemPrs3dDrawer> VInspectorPaneAIS_ItemPrs3dDrawerPtr;
+
+//! \class VInspectorPaneAIS_ItemPrs3dDrawer
+//! Item presents information about AIS_InteractiveObject.
+//! Parent is item context, children are item selections.
+class VInspectorPaneAIS_ItemPrs3dDrawer : public VInspector_ItemPrs3dDrawer
+{
+
+public:
+
+ //! Creates an item wrapped by a shared pointer
+ static VInspectorPaneAIS_ItemPrs3dDrawerPtr CreateItem (TreeModel_ItemBasePtr theParent, const int theRow, const int theColumn)
+ { return VInspectorPaneAIS_ItemPrs3dDrawerPtr (new VInspectorPaneAIS_ItemPrs3dDrawer (theParent, theRow, theColumn)); }
+ //! Destructor
+ virtual ~VInspectorPaneAIS_ItemPrs3dDrawer() Standard_OVERRIDE {};
+
+ //! Inits the item, fills internal containers
+ Standard_EXPORT virtual void Init() Standard_OVERRIDE;
+
+ //! Resets cached values
+ Standard_EXPORT virtual void Reset() Standard_OVERRIDE;
+
+ //! Returns number of table rows
+ //! \return an integer value
+ virtual int GetTableRowCount() const Standard_OVERRIDE;
+
+ //! Returns table value for the row in form: <function name> <function value>
+ //! \param theRow a model index row
+ //! \param theColumn a model index column
+ virtual QVariant GetTableData (const int theRow, const int theColumn, const int theRole) const Standard_OVERRIDE;
+
+protected:
+
+ //! Initialize the current item. It is empty because Reset() is also empty.
+ virtual void initItem() const Standard_OVERRIDE;
+
+private:
+
+ //! Constructor
+ //! param theParent a parent item
+ VInspectorPaneAIS_ItemPrs3dDrawer (TreeModel_ItemBasePtr theParent, const int theRow, const int theColumn)
+ : VInspector_ItemPrs3dDrawer (theParent, theRow, theColumn) {}
+
+protected:
+
+ TopoDS_Shape myShape; //!< current shape
+
+ friend class VInspectorPaneAIS_ColoredShape;
+};
+
+#endif
--- /dev/null
+// Created on: 2019-04-14
+// Created by: Natalia ERMOLAEVA
+// Copyright (c) 2019 OPEN CASCADE SAS
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
+
+#include <inspector/VInspectorPaneAIS_PropertiesCreator.hxx>
+#include <inspector/VInspectorPaneAIS_ColoredShape.hxx>
+
+#include <AIS_ColoredShape.hxx>
+
+IMPLEMENT_STANDARD_RTTIEXT(VInspectorPaneAIS_PropertiesCreator, TreeModel_ItemPropertiesCreator)
+
+// =======================================================================
+// function : GetProperties
+// purpose :
+// =======================================================================
+TreeModel_ItemProperties* VInspectorPaneAIS_PropertiesCreator::GetProperties (const TreeModel_ItemBasePtr& theItem)
+{
+ Handle(Standard_Transient) anObject = theItem->GetObject();
+ if (anObject.IsNull())
+ return NULL;
+
+ if (!Handle(AIS_ColoredShape)::DownCast (anObject).IsNull())
+ return new VInspectorPaneAIS_ColoredShape (theItem);
+
+ return NULL;
+}
+
--- /dev/null
+// Created on: 2019-04-14
+// Created by: Natalia ERMOLAEVA
+// Copyright (c) 2019 OPEN CASCADE SAS
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
+
+#ifndef VInspectorPaneAIS_PropertiesCreator_H
+#define VInspectorPaneAIS_PropertiesCreator_H
+
+#include <Standard.hxx>
+#include <Standard_Macro.hxx>
+
+#include <inspector/TreeModel_ItemPropertiesCreator.hxx>
+#include <inspector/ViewControl_Pane.hxx>
+
+#include <NCollection_DataMap.hxx>
+#include <TCollection_AsciiString.hxx>
+
+DEFINE_STANDARD_HANDLE (VInspectorPaneAIS_PropertiesCreator, TreeModel_ItemPropertiesCreator)
+
+//! \class VInspectorPaneAIS_PropertiesCreator
+//! \brief An interface to create custom panes by transient object name.
+class VInspectorPaneAIS_PropertiesCreator : public TreeModel_ItemPropertiesCreator
+{
+public:
+
+ //! Constructor
+ VInspectorPaneAIS_PropertiesCreator() {}
+
+ //! Destructor
+ virtual ~VInspectorPaneAIS_PropertiesCreator() {}
+
+ //! Returns pane for the name, creates a new pane if it does not exist and possible to create
+ //! \param theName type of the pane
+ //! \return a pane instance or NULL
+ virtual TreeModel_ItemProperties* GetProperties (const TreeModel_ItemBasePtr& theItem) Standard_OVERRIDE;
+
+ DEFINE_STANDARD_RTTIEXT(VInspectorPaneAIS_PropertiesCreator, TreeModel_ItemPropertiesCreator)
+
+private:
+ NCollection_DataMap<TCollection_AsciiString, ViewControl_Pane*> myPanes; //!< created panes
+};
+
+#endif
ViewControl_TableModelValuesDefault.hxx
ViewControl_Tools.cxx
ViewControl_Tools.hxx
+ViewControl_TransientShape.cxx
+ViewControl_TransientShape.hxx
ViewControl_TreeView.hxx
--- /dev/null
+// Created on: 2019-04-15
+// Created by: Natalia ERMOLAEVA
+// Copyright (c) 2019 OPEN CASCADE SAS
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
+
+#include <inspector/ViewControl_TransientShape.hxx>
+
+IMPLEMENT_STANDARD_RTTIEXT(ViewControl_TransientShape, Standard_Transient)
--- /dev/null
+// Created on: 2019-04-15
+// Created by: Natalia ERMOLAEVA
+// Copyright (c) 2019 OPEN CASCADE SAS
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
+
+#ifndef ViewControl_TransientShape_H
+#define ViewControl_TransientShape_H
+
+#include <Standard.hxx>
+#include <Standard_Handle.hxx>
+#include <Standard_Macro.hxx>
+#include <Standard_Type.hxx>
+#include <Standard_Transient.hxx>
+
+#include <TopoDS_Shape.hxx>
+
+DEFINE_STANDARD_HANDLE (ViewControl_TransientShape, Standard_Transient)
+
+//! \class ViewControl_TransientShape
+//! \brief An interface to create custom panes by transient object name.
+class ViewControl_TransientShape : public Standard_Transient
+{
+public:
+
+ //! Constructor
+ ViewControl_TransientShape (const TopoDS_Shape& theShape) { SetShape (theShape); }
+
+ //! Destructor
+ virtual ~ViewControl_TransientShape() {}
+
+ //! Fills current shape
+ void SetShape (const TopoDS_Shape& theShape) { myShape = theShape; }
+
+ //! Returns current shape
+ const TopoDS_Shape GetShape() const { return myShape; }
+
+ DEFINE_STANDARD_RTTIEXT (ViewControl_TransientShape, Standard_Transient)
+
+private:
+ TopoDS_Shape myShape;
+};
+
+#endif