mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-14 13:30:48 +03:00
0029451: Information Message Alert to debug an algorithm or object functionality
Modifications:
- Message_AlertExtended to store additional parameters (attributes, composite alert container, performance meter)
- Message_Attribute and inherited classes to store custom information about alert
- Message_CompositeAlerts to have hierarchical structure of alerts
- Message_PerfMeter to automatically calculate time between alerts adding into report
- Message_ReportCall back to be able to react to message report filling.
- Import/Export message report report. Currently it is implemented using XmlDrivers_MessageReportStorage
- MessageView/MessageModel - Inspector plugin for GUI presentation of Message_Report
(cherry picked from commit e4529dcf83b12759e47efb89ded8207f802556a7)
Conflicts:
tools/ViewControl/FILES
tools/ViewControl/ViewControl_PropertyView.cxx
tools/ViewControl/ViewControl_PropertyView.hxx
tools/ViewControl/ViewControl_Table.cxx
tools/ViewControl/ViewControl_Table.hxx
tools/ViewControl/ViewControl_TableModel.hxx
tools/ViewControl/ViewControl_TableModelFilter.cxx
tools/ViewControl/ViewControl_TableModelFilter.hxx
tools/ViewControl/ViewControl_TableModelValues.hxx
tools/ViewControl/ViewControl_TableProperty.cxx
tools/ViewControl/ViewControl_TableProperty.hxx
tools/ViewControl/ViewControl_Tools.cxx
tools/ViewControl/ViewControl_Tools.hxx
(cherry picked from commit 68876fcc5a
)
(cherry picked from commit 9a3d03bedb29dbf0124f5d53478d331d7ba877ff)
This commit is contained in:
22
tools/MessageModel/FILES
Normal file
22
tools/MessageModel/FILES
Normal file
@@ -0,0 +1,22 @@
|
||||
MessageModel.qrc
|
||||
MessageModel_Actions.cxx
|
||||
MessageModel_Actions.hxx
|
||||
MessageModel_ActionType.hxx
|
||||
MessageModel_ItemAlert.cxx
|
||||
MessageModel_ItemAlert.hxx
|
||||
MessageModel_ItemBase.cxx
|
||||
MessageModel_ItemBase.hxx
|
||||
MessageModel_ItemReport.cxx
|
||||
MessageModel_ItemReport.hxx
|
||||
MessageModel_ItemRoot.cxx
|
||||
MessageModel_ItemRoot.hxx
|
||||
MessageModel_ReportCallBack.cxx
|
||||
MessageModel_ReportCallBack.hxx
|
||||
MessageModel_TableModelRealValues.cxx
|
||||
MessageModel_TableModelRealValues.hxx
|
||||
MessageModel_TableModelRealVec3Values.cxx
|
||||
MessageModel_TableModelRealVec3Values.hxx
|
||||
MessageModel_Tools.cxx
|
||||
MessageModel_Tools.hxx
|
||||
MessageModel_TreeModel.cxx
|
||||
MessageModel_TreeModel.hxx
|
7
tools/MessageModel/MessageModel.qrc
Normal file
7
tools/MessageModel/MessageModel.qrc
Normal file
@@ -0,0 +1,7 @@
|
||||
<!DOCTYPE RCC><RCC version="1.0">
|
||||
<qresource>
|
||||
<file>icons/item_shape.png</file>
|
||||
<file>icons/item_vectorOfReal.png</file>
|
||||
<file>icons/item_vectorOfRealVec3.png</file>
|
||||
</qresource>
|
||||
</RCC>
|
27
tools/MessageModel/MessageModel_ActionType.hxx
Normal file
27
tools/MessageModel/MessageModel_ActionType.hxx
Normal file
@@ -0,0 +1,27 @@
|
||||
// Created on: 2017-06-16
|
||||
// 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 MessageModel_ActionType_H
|
||||
#define MessageModel_ActionType_H
|
||||
|
||||
//! Kind of action type for tree view context menu item
|
||||
enum MessageModel_ActionType
|
||||
{
|
||||
MessageModel_ActionType_Activate, //!< set Message_Report active
|
||||
MessageModel_ActionType_Deactivate, //!< set Message_Report not active
|
||||
MessageModel_ActionType_ExportToShapeView //!< export TopoDS_Shape of selected item into TKShapeView plugin
|
||||
};
|
||||
|
||||
#endif
|
221
tools/MessageModel/MessageModel_Actions.cxx
Normal file
221
tools/MessageModel/MessageModel_Actions.cxx
Normal file
@@ -0,0 +1,221 @@
|
||||
// Created on: 2017-06-16
|
||||
// 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/MessageModel_Actions.hxx>
|
||||
|
||||
#include <inspector/MessageModel_ItemReport.hxx>
|
||||
#include <inspector/MessageModel_ItemRoot.hxx>
|
||||
#include <inspector/MessageModel_ItemAlert.hxx>
|
||||
#include <inspector/MessageModel_Tools.hxx>
|
||||
#include <inspector/MessageModel_TreeModel.hxx>
|
||||
#include <inspector/TInspectorAPI_PluginParameters.hxx>
|
||||
#include <inspector/ViewControl_Tools.hxx>
|
||||
|
||||
#include <TCollection_AsciiString.hxx>
|
||||
#include <TopoDS_AlertWithShape.hxx>
|
||||
|
||||
#include <QAction>
|
||||
#include <QFileDialog>
|
||||
#include <QItemSelectionModel>
|
||||
#include <QMenu>
|
||||
#include <QMessageBox>
|
||||
#include <QWidget>
|
||||
|
||||
// =======================================================================
|
||||
// function : Constructor
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
MessageModel_Actions::MessageModel_Actions (QWidget* theParent,
|
||||
MessageModel_TreeModel* theTreeModel, QItemSelectionModel* theModel)
|
||||
: QObject (theParent), myTreeModel (theTreeModel), mySelectionModel (theModel)
|
||||
{
|
||||
myActions.insert (MessageModel_ActionType_Deactivate,
|
||||
ViewControl_Tools::CreateAction ("Deactivate", SLOT (OnDeactivateReport()), parent(), this));
|
||||
myActions.insert (MessageModel_ActionType_Activate,
|
||||
ViewControl_Tools::CreateAction ("Activate", SLOT (OnActivateReport()), parent(), this));
|
||||
myActions.insert (MessageModel_ActionType_ExportToShapeView,
|
||||
ViewControl_Tools::CreateAction (tr ("Export to ShapeView"), SLOT (OnExportToShapeView()), parent(), this));
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : GetAction
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
QAction* MessageModel_Actions::GetAction (const MessageModel_ActionType& theType)
|
||||
{
|
||||
if (myActions.contains (theType))
|
||||
return myActions[theType];
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : AddMenuActions
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void MessageModel_Actions::AddMenuActions (const QModelIndexList& theSelectedIndices, QMenu* theMenu)
|
||||
{
|
||||
MessageModel_ItemRootPtr aRootItem;
|
||||
MessageModel_ItemReportPtr aReportItem;
|
||||
MessageModel_ItemAlertPtr anAlertItem;
|
||||
for (QModelIndexList::const_iterator aSelIt = theSelectedIndices.begin(); aSelIt != theSelectedIndices.end(); aSelIt++)
|
||||
{
|
||||
QModelIndex anIndex = *aSelIt;
|
||||
if (anIndex.column() != 0)
|
||||
continue;
|
||||
|
||||
TreeModel_ItemBasePtr anItemBase = TreeModel_ModelBase::GetItemByIndex (anIndex);
|
||||
if (!anItemBase)
|
||||
continue;
|
||||
|
||||
aRootItem = itemDynamicCast<MessageModel_ItemRoot> (anItemBase);
|
||||
if (aRootItem)
|
||||
break;
|
||||
|
||||
aReportItem = itemDynamicCast<MessageModel_ItemReport> (anItemBase);
|
||||
if (aReportItem)
|
||||
break;
|
||||
|
||||
anAlertItem = itemDynamicCast<MessageModel_ItemAlert> (anItemBase);
|
||||
if (anAlertItem)
|
||||
break;
|
||||
}
|
||||
|
||||
if (aReportItem && !aReportItem->GetReport().IsNull())
|
||||
{
|
||||
theMenu->addAction (myActions[MessageModel_ActionType_Deactivate]);
|
||||
theMenu->addAction (myActions[MessageModel_ActionType_Activate]);
|
||||
}
|
||||
else if (anAlertItem)
|
||||
theMenu->addAction (myActions[MessageModel_ActionType_ExportToShapeView]);
|
||||
|
||||
theMenu->addSeparator();
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : onImportReport
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
Handle(Message_Report) MessageModel_Actions::getSelectedReport (QModelIndex& theReportIndex) const
|
||||
{
|
||||
MessageModel_ItemReportPtr aReportItem;
|
||||
QModelIndexList aSelectedIndices = mySelectionModel->selectedIndexes();
|
||||
for (QModelIndexList::const_iterator aSelIt = aSelectedIndices.begin(); aSelIt != aSelectedIndices.end(); aSelIt++)
|
||||
{
|
||||
QModelIndex anIndex = *aSelIt;
|
||||
if (anIndex.column() != 0)
|
||||
continue;
|
||||
|
||||
TreeModel_ItemBasePtr anItemBase = TreeModel_ModelBase::GetItemByIndex (anIndex);
|
||||
if (!anItemBase)
|
||||
continue;
|
||||
|
||||
aReportItem = itemDynamicCast<MessageModel_ItemReport> (anItemBase);
|
||||
theReportIndex = anIndex;
|
||||
if (aReportItem)
|
||||
break;
|
||||
}
|
||||
if (!aReportItem)
|
||||
return NULL;
|
||||
|
||||
return aReportItem->GetReport();
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : OnDeactivateReport
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void MessageModel_Actions::OnDeactivateReport()
|
||||
{
|
||||
QModelIndex aReportIndex;
|
||||
Handle(Message_Report) aReport = getSelectedReport (aReportIndex);
|
||||
if (aReport.IsNull())
|
||||
return;
|
||||
|
||||
aReport->SetActive (Standard_False);
|
||||
((MessageModel_TreeModel*)mySelectionModel)->EmitDataChanged (aReportIndex, aReportIndex);
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : OnActivateReport
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void MessageModel_Actions::OnActivateReport()
|
||||
{
|
||||
QModelIndex aReportIndex;
|
||||
Handle(Message_Report) aReport = getSelectedReport (aReportIndex);
|
||||
if (aReport.IsNull())
|
||||
return;
|
||||
|
||||
aReport->SetActive (Standard_True);
|
||||
((MessageModel_TreeModel*)mySelectionModel)->EmitDataChanged (aReportIndex, aReportIndex);
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : OnExportToShapeView
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void MessageModel_Actions::OnExportToShapeView()
|
||||
{
|
||||
TCollection_AsciiString aPluginName ("TKShapeView");
|
||||
|
||||
NCollection_List<Handle(Standard_Transient)> aPluginParameters;
|
||||
if (myParameters->FindParameters (aPluginName))
|
||||
aPluginParameters = myParameters->Parameters (aPluginName);
|
||||
NCollection_List<TCollection_AsciiString> anItemNames;
|
||||
if (myParameters->FindSelectedNames (aPluginName))
|
||||
anItemNames = myParameters->GetSelectedNames (aPluginName);
|
||||
|
||||
QModelIndexList aSelectedIndices = mySelectionModel->selectedIndexes();
|
||||
QStringList anExportedPointers;
|
||||
for (QModelIndexList::const_iterator aSelIt = aSelectedIndices.begin(); aSelIt != aSelectedIndices.end(); aSelIt++)
|
||||
{
|
||||
QModelIndex anIndex = *aSelIt;
|
||||
if (anIndex.column() != 0)
|
||||
continue;
|
||||
|
||||
TreeModel_ItemBasePtr anItemBase = TreeModel_ModelBase::GetItemByIndex (anIndex);
|
||||
if (!anItemBase)
|
||||
continue;
|
||||
|
||||
MessageModel_ItemAlertPtr anAlertItem = itemDynamicCast<MessageModel_ItemAlert> (anItemBase);
|
||||
if (!anAlertItem)
|
||||
continue;
|
||||
|
||||
Handle(Message_Alert) anAlert = anAlertItem->GetAlert();
|
||||
if (anAlert.IsNull())
|
||||
continue;
|
||||
|
||||
Handle(TopoDS_AlertWithShape) aShapeAlert = Handle(TopoDS_AlertWithShape)::DownCast (anAlert);
|
||||
if (aShapeAlert.IsNull() || aShapeAlert->GetShape().IsNull())
|
||||
continue;
|
||||
|
||||
const TopoDS_Shape aShape = aShapeAlert->GetShape();
|
||||
if (aShape.IsNull())
|
||||
continue;
|
||||
aPluginParameters.Append (aShape.TShape());
|
||||
anItemNames.Append (TInspectorAPI_PluginParameters::ParametersToString (aShape));
|
||||
|
||||
anExportedPointers.append (MessageModel_Tools::GetPointerInfo (aShape.TShape(), true).ToCString());
|
||||
}
|
||||
|
||||
if (anExportedPointers.empty())
|
||||
return;
|
||||
myParameters->SetSelectedNames (aPluginName, anItemNames);
|
||||
myParameters->SetParameters (aPluginName, aPluginParameters);
|
||||
QMessageBox::information (0, "Information", QString ("TShapes '%1' are sent to %2 tool.")
|
||||
.arg (anExportedPointers.join (", ")).arg (QString (aPluginName.ToCString())));
|
||||
}
|
97
tools/MessageModel/MessageModel_Actions.hxx
Normal file
97
tools/MessageModel/MessageModel_Actions.hxx
Normal file
@@ -0,0 +1,97 @@
|
||||
// Created on: 2017-06-16
|
||||
// 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 MessageModel_Actions_H
|
||||
#define MessageModel_Actions_H
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(disable : 4127 4718) // conditional expression is constant, recursive call has no side effects
|
||||
#endif
|
||||
|
||||
#include <Standard.hxx>
|
||||
#include <Standard_Transient.hxx>
|
||||
|
||||
#include <inspector/MessageModel_ActionType.hxx>
|
||||
#include <inspector/TInspectorAPI_PluginParameters.hxx>
|
||||
|
||||
#include <QObject>
|
||||
#include <QMap>
|
||||
#include <QModelIndexList>
|
||||
#include <QPoint>
|
||||
#include <QString>
|
||||
|
||||
class Message_Report;
|
||||
class MessageModel_TreeModel;
|
||||
|
||||
class QAction;
|
||||
class QItemSelectionModel;
|
||||
class QMenu;
|
||||
class QWidget;
|
||||
|
||||
//! \class MessageModel_Actions
|
||||
//! \brief This is a listener of popup context menu items and selection change in message model
|
||||
class MessageModel_Actions : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
|
||||
//! Constructor
|
||||
Standard_EXPORT MessageModel_Actions (QWidget* theParent,
|
||||
MessageModel_TreeModel* theTreeModel,
|
||||
QItemSelectionModel* theModel);
|
||||
|
||||
//! Destructor
|
||||
virtual ~MessageModel_Actions() Standard_OVERRIDE {}
|
||||
|
||||
//! Returns action by the type
|
||||
//! \param theType an action type
|
||||
//! \return an action instance if it exists
|
||||
Standard_EXPORT QAction* GetAction (const MessageModel_ActionType& theType);
|
||||
|
||||
//! Fills popup menu with actions depending on the current selection
|
||||
//! \param theSelectedIndices tree model selected indices
|
||||
//! \param theMenu menu to be filled
|
||||
Standard_EXPORT void AddMenuActions (const QModelIndexList& theSelectedIndices, QMenu* theMenu);
|
||||
|
||||
//! Sets parameters container, it should be used when the plugin is initialized or in update content
|
||||
//! \param theParameters a parameters container
|
||||
void SetParameters (const Handle(TInspectorAPI_PluginParameters)& theParameters)
|
||||
{ myParameters = theParameters; }
|
||||
|
||||
public slots:
|
||||
//! Set selected report not active
|
||||
void OnDeactivateReport();
|
||||
|
||||
//! Set selected report active
|
||||
void OnActivateReport();
|
||||
|
||||
//! Exports the first selected shape into ShapeViewer plugin.
|
||||
void OnExportToShapeView();
|
||||
|
||||
protected:
|
||||
//! Returns report of selected tree view item if a report item is selected
|
||||
//! \param theReportIndex tree model index of the found report
|
||||
//! \return report instance or NULL
|
||||
Handle(Message_Report) getSelectedReport (QModelIndex& theReportIndex) const;
|
||||
|
||||
protected:
|
||||
MessageModel_TreeModel* myTreeModel; //< tree model
|
||||
QItemSelectionModel* mySelectionModel; //< selection model
|
||||
Handle(TInspectorAPI_PluginParameters) myParameters; //!< plugins parameters container
|
||||
QMap<MessageModel_ActionType, QAction*> myActions; //!< container of all actions
|
||||
};
|
||||
|
||||
#endif
|
342
tools/MessageModel/MessageModel_ItemAlert.cxx
Normal file
342
tools/MessageModel/MessageModel_ItemAlert.cxx
Normal file
@@ -0,0 +1,342 @@
|
||||
// Created on: 2017-06-16
|
||||
// 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/MessageModel_ItemAlert.hxx>
|
||||
|
||||
#include <inspector/MessageModel_ItemRoot.hxx>
|
||||
#include <inspector/MessageModel_ItemReport.hxx>
|
||||
#include <inspector/MessageModel_Tools.hxx>
|
||||
#include <inspector/TreeModel_Tools.hxx>
|
||||
|
||||
#include <Message_AlertExtended.hxx>
|
||||
#include <Message_AttributeVectorOfReal.hxx>
|
||||
#include <Message_AttributeVectorOfRealVec3.hxx>
|
||||
#include <Message_CompositeAlerts.hxx>
|
||||
|
||||
#include <TCollection_AsciiString.hxx>
|
||||
#include <TopoDS_AlertWithShape.hxx>
|
||||
|
||||
#include <QColor>
|
||||
#include <QIcon>
|
||||
|
||||
// =======================================================================
|
||||
// function : initValue
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
QVariant MessageModel_ItemAlert::initValue (const int theRole) const
|
||||
{
|
||||
if (theRole == Qt::ForegroundRole)
|
||||
{
|
||||
MessageModel_ItemReportPtr aReportItem = MessageModel_ItemReport::FindReportItem (Parent());
|
||||
if (!aReportItem)
|
||||
return QVariant();
|
||||
|
||||
Handle(Message_Report) aReport = aReportItem->GetReport();
|
||||
if (aReport.IsNull())
|
||||
return QVariant();
|
||||
|
||||
if (!aReport->GetAlerts (Message_Fail).IsEmpty())
|
||||
return QColor(Qt::darkRed);
|
||||
|
||||
for (int aGravityId = (int)Message_Trace; aGravityId <= (int)Message_Fail; aGravityId++)
|
||||
{
|
||||
if (!aReport->IsActive ((Message_Gravity)aGravityId))
|
||||
return QColor(Qt::darkGray);
|
||||
}
|
||||
return QVariant();
|
||||
}
|
||||
|
||||
Handle(Message_Alert) anAlert = getAlert();
|
||||
if (anAlert.IsNull())
|
||||
return QVariant();
|
||||
|
||||
// if the alert is composite, process the real alert
|
||||
if (theRole == Qt::DecorationRole && Column() == 0)
|
||||
{
|
||||
if (anAlert->IsKind (STANDARD_TYPE (TopoDS_AlertWithShape)))
|
||||
return QIcon (":/icons/item_shape.png");
|
||||
else if (anAlert->IsKind (STANDARD_TYPE (Message_AttributeVectorOfReal)))
|
||||
return QIcon (":/icons/item_vectorOfReal.png");
|
||||
else if (anAlert->IsKind (STANDARD_TYPE (Message_AttributeVectorOfRealVec3)))
|
||||
return QIcon (":/icons/item_vectorOfRealVec3.png");
|
||||
else
|
||||
return QVariant();
|
||||
}
|
||||
|
||||
if (theRole != Qt::DisplayRole && theRole != Qt::ToolTipRole)
|
||||
return QVariant();
|
||||
|
||||
const Message_ListOfAlert& aUnitedAlerts = GetUnitedAlerts();
|
||||
if (anAlert.IsNull() && !aUnitedAlerts.IsEmpty()) // give information about last united alert
|
||||
anAlert = !isReversed() ? aUnitedAlerts.Last() : aUnitedAlerts.First();
|
||||
if (anAlert.IsNull())
|
||||
return QVariant();
|
||||
|
||||
switch (Column())
|
||||
{
|
||||
case 0:
|
||||
return theRole == Qt::DisplayRole ? anAlert->GetMessageKey() : anAlert->DynamicType()->Name();
|
||||
case 1: return QVariant(); // visibility state
|
||||
case 2: return rowCount() > 0 ? QVariant (rowCount()) : QVariant();
|
||||
//case 3: return anAlert->ElapsedTime() < 0 ? QVariant() : anAlert->ElapsedTime();
|
||||
case 3: return AmountElapsedTime (anAlert);
|
||||
case 4:
|
||||
{
|
||||
TreeModel_ItemBasePtr aParentItem = Parent();
|
||||
MessageModel_ItemReportPtr aReportItem = itemDynamicCast<MessageModel_ItemReport> (aParentItem);
|
||||
while (!aReportItem)
|
||||
{
|
||||
aParentItem = aParentItem->Parent();
|
||||
aReportItem = itemDynamicCast<MessageModel_ItemReport> (aParentItem);
|
||||
}
|
||||
double aDivideTo = MessageModel_ItemReport::AmountElapsedTime (aReportItem->GetReport());
|
||||
return aDivideTo == 0 ? QVariant() : 100. * AmountElapsedTime (anAlert) / aDivideTo;
|
||||
}
|
||||
case 5: return MessageModel_Tools::GetPointerAlertInfo (anAlert).ToCString();
|
||||
case 6: return MessageModel_Tools::GetShapeTypeAlertInfo (anAlert).ToCString();
|
||||
case 7: return MessageModel_Tools::GetStandardTypeAlertInfo (anAlert).ToCString();
|
||||
case 8:
|
||||
{
|
||||
Handle(Message_AlertExtended) anExtendedAlert = Handle(Message_AlertExtended)::DownCast(anAlert);
|
||||
if (!anExtendedAlert.IsNull() && !anExtendedAlert->Attribute().IsNull())
|
||||
{
|
||||
TCollection_AsciiString aDescription = anExtendedAlert->Attribute()->GetDescription();
|
||||
return theRole == Qt::DisplayRole ? TreeModel_Tools::CutString (aDescription.ToCString())
|
||||
: aDescription.ToCString();
|
||||
}
|
||||
}
|
||||
default: break;
|
||||
}
|
||||
return QVariant();
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : initRowCount
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
int MessageModel_ItemAlert::initRowCount() const
|
||||
{
|
||||
const Handle(Message_Alert)& anAlert = getAlert();
|
||||
if (anAlert.IsNull())
|
||||
return GetUnitedAlerts().Size();
|
||||
|
||||
Handle(Message_AlertExtended) anExtendedAlert = Handle(Message_AlertExtended)::DownCast(anAlert);
|
||||
if (anExtendedAlert.IsNull())
|
||||
return GetUnitedAlerts().Size();
|
||||
|
||||
Handle(Message_CompositeAlerts) aCompositeAlert = anExtendedAlert->GetCompositeAlerts();
|
||||
if (aCompositeAlert.IsNull())
|
||||
return GetUnitedAlerts().Size();
|
||||
|
||||
int aRowCount = 0;
|
||||
NCollection_Vector<Message_ListOfAlert> aUnitedAlerts;
|
||||
for (int aGravityId = Message_Trace; aGravityId <= Message_Fail; aGravityId++)
|
||||
{
|
||||
const Message_ListOfAlert& anAlerts = aCompositeAlert->GetAlerts ((Message_Gravity)aGravityId);
|
||||
if (isUniteAlerts())
|
||||
GetUnitedAlerts (anAlerts, aUnitedAlerts);
|
||||
else
|
||||
aRowCount += anAlerts.Size();
|
||||
}
|
||||
return isUniteAlerts() ? aUnitedAlerts.Size() : aRowCount;
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : createChild
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
TreeModel_ItemBasePtr MessageModel_ItemAlert::createChild (int theRow, int theColumn)
|
||||
{
|
||||
return MessageModel_ItemAlert::CreateItem (currentItem(), theRow, theColumn);
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : Init
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void MessageModel_ItemAlert::Init()
|
||||
{
|
||||
MessageModel_ItemReportPtr aReportItem = itemDynamicCast<MessageModel_ItemReport> (Parent());
|
||||
MessageModel_ItemAlertPtr anAlertItem;
|
||||
Handle(Message_Report) aReport;
|
||||
Handle(Message_Alert) anAlert;
|
||||
if (aReportItem)
|
||||
aReport = aReportItem->GetReport();
|
||||
else
|
||||
{
|
||||
anAlertItem = itemDynamicCast<MessageModel_ItemAlert> (Parent());
|
||||
if (anAlertItem)
|
||||
anAlert = anAlertItem->GetAlert();
|
||||
}
|
||||
if (aReport.IsNull() && anAlert.IsNull() && !anAlertItem)
|
||||
return;
|
||||
|
||||
if (anAlert.IsNull() && anAlertItem) // union folder item
|
||||
{
|
||||
int aCurrentSubId = 0;
|
||||
for (Message_ListOfAlert::Iterator anAlertsIt (anAlertItem->GetUnitedAlerts()); anAlertsIt.More();
|
||||
anAlertsIt.Next(), aCurrentSubId++)
|
||||
{
|
||||
if (aCurrentSubId != Row())
|
||||
continue;
|
||||
myAlert = anAlertsIt.Value();
|
||||
MessageModel_ItemBase::Init();
|
||||
return;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
// iterates through all gravity types, skip types where report is empty, if report is not empty, increment
|
||||
// current index until it equal to the current row index
|
||||
Message_ListOfAlert anAlerts;
|
||||
NCollection_Vector<Message_ListOfAlert> aUnitedAlerts;
|
||||
int aRowId = Row();
|
||||
int aPreviousAlertsCount = 0;
|
||||
for (int aGravityId = Message_Trace; aGravityId <= Message_Fail; aGravityId++)
|
||||
{
|
||||
if (!aReport.IsNull())
|
||||
anAlerts = aReport->GetAlerts ((Message_Gravity)aGravityId);
|
||||
else if (!anAlert.IsNull())
|
||||
{
|
||||
Handle(Message_AlertExtended) anExtendedAlert = Handle(Message_AlertExtended)::DownCast(anAlert);
|
||||
Handle(Message_CompositeAlerts) aCompositeAlert = !anExtendedAlert.IsNull() ? anExtendedAlert->GetCompositeAlerts()
|
||||
: Handle(Message_CompositeAlerts)();
|
||||
if (!aCompositeAlert.IsNull())
|
||||
anAlerts = aCompositeAlert->GetAlerts ((Message_Gravity)aGravityId);
|
||||
}
|
||||
|
||||
if (isReversed())
|
||||
anAlerts.Reverse();
|
||||
|
||||
if (isUniteAlerts())
|
||||
{
|
||||
GetUnitedAlerts (anAlerts, aUnitedAlerts);
|
||||
if (aRowId < aUnitedAlerts.Size())
|
||||
{
|
||||
anAlerts = aUnitedAlerts.Value (aRowId);
|
||||
|
||||
if (anAlerts.Size() == 1)
|
||||
myAlert = anAlerts.First();
|
||||
else
|
||||
myUnitedAlerts = anAlerts;
|
||||
|
||||
MessageModel_ItemBase::Init();
|
||||
return;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (aRowId < aPreviousAlertsCount + anAlerts.Size())
|
||||
{
|
||||
aRowId = aRowId - aPreviousAlertsCount;
|
||||
int aCurrentId = 0;
|
||||
for (Message_ListOfAlert::Iterator anAlertsIt (anAlerts); anAlertsIt.More(); anAlertsIt.Next(), aCurrentId++)
|
||||
{
|
||||
if (aCurrentId != Row())
|
||||
continue;
|
||||
myAlert = anAlertsIt.Value();
|
||||
MessageModel_ItemBase::Init();
|
||||
return;
|
||||
}
|
||||
}
|
||||
aPreviousAlertsCount += anAlerts.Size();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : Reset
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void MessageModel_ItemAlert::Reset()
|
||||
{
|
||||
MessageModel_ItemBase::Reset();
|
||||
myAlert = Handle(Message_Alert)();
|
||||
myUnitedAlerts.Clear();
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : initItem
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void MessageModel_ItemAlert::initItem() const
|
||||
{
|
||||
if (IsInitialized())
|
||||
return;
|
||||
const_cast<MessageModel_ItemAlert*>(this)->Init();
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : getAlert
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
const Handle(Message_Alert)& MessageModel_ItemAlert::getAlert() const
|
||||
{
|
||||
initItem();
|
||||
return myAlert;
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : getUnitedAlerts
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
const Message_ListOfAlert& MessageModel_ItemAlert::getUnitedAlerts() const
|
||||
{
|
||||
initItem();
|
||||
return myUnitedAlerts;
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : AmountElapsedTime
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
double MessageModel_ItemAlert::AmountElapsedTime(const Handle(Message_Alert)& theAlert)
|
||||
{
|
||||
if (theAlert.IsNull())
|
||||
return 0;
|
||||
|
||||
double anAmountTime = 0;
|
||||
Handle(Message_AlertExtended) anExtendedAlert = Handle(Message_AlertExtended)::DownCast(theAlert);
|
||||
if (anExtendedAlert->GetCumulativeTime() > 0)
|
||||
anAmountTime = anExtendedAlert->GetCumulativeTime();
|
||||
|
||||
return anAmountTime;
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : GetUnitedAlerts
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void MessageModel_ItemAlert::GetUnitedAlerts(const Message_ListOfAlert& theAlerts,
|
||||
NCollection_Vector<Message_ListOfAlert>& theUnitedAlerts)
|
||||
{
|
||||
//theUnitedAlerts.Clear();
|
||||
TCollection_AsciiString anAlertMessageKey;
|
||||
for (Message_ListOfAlert::Iterator anAlertsIt (theAlerts); anAlertsIt.More(); anAlertsIt.Next())
|
||||
{
|
||||
Handle(Message_Alert) anAlert = anAlertsIt.Value();
|
||||
if (anAlertMessageKey.IsEqual (anAlert->GetMessageKey())) {
|
||||
Message_ListOfAlert anAlerts = theUnitedAlerts.Last();
|
||||
anAlerts.Append (anAlert);
|
||||
theUnitedAlerts.SetValue(theUnitedAlerts.Size()-1, anAlerts);
|
||||
}
|
||||
else {
|
||||
Message_ListOfAlert anAlerts;
|
||||
anAlerts.Append (anAlert);
|
||||
theUnitedAlerts.Append (anAlerts);
|
||||
anAlertMessageKey = anAlert->GetMessageKey();
|
||||
}
|
||||
}
|
||||
}
|
128
tools/MessageModel/MessageModel_ItemAlert.hxx
Normal file
128
tools/MessageModel/MessageModel_ItemAlert.hxx
Normal file
@@ -0,0 +1,128 @@
|
||||
// Created on: 2017-06-16
|
||||
// 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 MessageModel_ItemAlert_H
|
||||
#define MessageModel_ItemAlert_H
|
||||
|
||||
#include <inspector/MessageModel_ItemBase.hxx>
|
||||
#include <Message_Alert.hxx>
|
||||
#include <Message_ListOfAlert.hxx>
|
||||
#include <Message_Report.hxx>
|
||||
#include <Standard.hxx>
|
||||
#include <TopoDS_Shape.hxx>
|
||||
|
||||
#include <QMap>
|
||||
#include <QVariant>
|
||||
|
||||
#include <NCollection_Vector.hxx>
|
||||
|
||||
class QAbstractTableModel;
|
||||
|
||||
class MessageModel_ItemAlert;
|
||||
typedef QExplicitlySharedDataPointer<MessageModel_ItemAlert> MessageModel_ItemAlertPtr;
|
||||
|
||||
//! \class MessageModel_ItemAlert
|
||||
//! This item is connected to Message_Alert.
|
||||
//! Parent is either MessageModel_ItemRoot or MessageModel_ItemAlert, children are MessageModel_ItemAlert or no children
|
||||
class MessageModel_ItemAlert : public MessageModel_ItemBase
|
||||
{
|
||||
public:
|
||||
|
||||
//! Creates an item wrapped by a shared pointer
|
||||
//! \param theRow the item row positition in the parent item
|
||||
//! \param theColumn the item column positition in the parent item
|
||||
//! \return the pointer to the created item
|
||||
static MessageModel_ItemAlertPtr CreateItem (TreeModel_ItemBasePtr theParent, const int theRow, const int theColumn)
|
||||
{ return MessageModel_ItemAlertPtr (new MessageModel_ItemAlert (theParent, theRow, theColumn)); }
|
||||
|
||||
//! Destructor
|
||||
virtual ~MessageModel_ItemAlert() Standard_OVERRIDE {};
|
||||
|
||||
//! Returns the current shape
|
||||
const Handle(Message_Alert)& GetAlert() const { return myAlert; }
|
||||
|
||||
//! Returns united alerts or empty list
|
||||
const Message_ListOfAlert& GetUnitedAlerts() const { return myUnitedAlerts; }
|
||||
|
||||
//! Inits the item, fills internal containers
|
||||
Standard_EXPORT virtual void Init() Standard_OVERRIDE;
|
||||
|
||||
//! Resets cached values
|
||||
Standard_EXPORT virtual void Reset() Standard_OVERRIDE;
|
||||
|
||||
//! Return data value for the role.
|
||||
//! \param theRole a value role
|
||||
//! \return the value
|
||||
Standard_EXPORT virtual QVariant initValue (const int theRole) const Standard_OVERRIDE;
|
||||
|
||||
//! \return number of children.
|
||||
Standard_EXPORT virtual int initRowCount() const Standard_OVERRIDE;
|
||||
|
||||
//! Sets some shape to present the item
|
||||
//! \param theShape shape instance
|
||||
void SetCustomShape (const TopoDS_Shape& theShape) { myCustomShape = theShape; }
|
||||
|
||||
//! Returns custom shape to present the item
|
||||
//! \return instance of the shape
|
||||
const TopoDS_Shape& GetCustomShape() const { return myCustomShape; }
|
||||
|
||||
//! Returns summ of children alert elapsed times. The method is recusive.
|
||||
//! \param theAlert a message alert
|
||||
//! \return double value
|
||||
Standard_EXPORT static double AmountElapsedTime (const Handle(Message_Alert)& theAlert);
|
||||
|
||||
//! Returns alerts united by Message Key
|
||||
//! \param theAlerts source message alert
|
||||
//! \param theUnitedAlerts arranged source message alerts
|
||||
Standard_EXPORT static void GetUnitedAlerts (const Message_ListOfAlert& theAlerts,
|
||||
NCollection_Vector<Message_ListOfAlert> & theUnitedAlerts);
|
||||
|
||||
protected:
|
||||
|
||||
//! Initialize the current item. It is empty because Reset() is also empty.
|
||||
virtual void initItem() 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
|
||||
virtual TreeModel_ItemBasePtr createChild (int theRow, int theColumn) Standard_OVERRIDE;
|
||||
|
||||
//! Returns current alert, initialized item if it has not been initialized yet
|
||||
//! \return alert value
|
||||
const Handle(Message_Alert)& getAlert() const;
|
||||
|
||||
//! Returns current united alert, initialized item if it has not been initialized yet
|
||||
//! \return container of united alert value
|
||||
const Message_ListOfAlert& getUnitedAlerts() const;
|
||||
|
||||
//! Returns summ of children alert elapsed times. The method is recusive.
|
||||
//! \param theAlert a message alert
|
||||
//! \return double value
|
||||
double getAmountElapsedTime() const;
|
||||
|
||||
private:
|
||||
|
||||
//! Constructor
|
||||
MessageModel_ItemAlert (TreeModel_ItemBasePtr theParent, const int theRow, const int theColumn)
|
||||
: MessageModel_ItemBase (theParent, theRow, theColumn) {}
|
||||
|
||||
private:
|
||||
Handle(Message_Alert) myAlert;
|
||||
Message_ListOfAlert myUnitedAlerts;
|
||||
TopoDS_Shape myCustomShape;
|
||||
};
|
||||
|
||||
#endif
|
58
tools/MessageModel/MessageModel_ItemBase.cxx
Normal file
58
tools/MessageModel/MessageModel_ItemBase.cxx
Normal file
@@ -0,0 +1,58 @@
|
||||
// Created on: 2017-06-16
|
||||
// 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/MessageModel_ItemBase.hxx>
|
||||
#include <inspector/MessageModel_ItemRoot.hxx>
|
||||
|
||||
// =======================================================================
|
||||
// function : isReversed
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
Standard_Boolean MessageModel_ItemBase::isReversed() const
|
||||
{
|
||||
TreeModel_ItemBasePtr aParentItem = GetRootItem();
|
||||
MessageModel_ItemRootPtr aRootItem = itemDynamicCast<MessageModel_ItemRoot> (aParentItem);
|
||||
return aRootItem ? aRootItem->IsReversed() : Standard_False;
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : isUniteAlerts
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
Standard_Boolean MessageModel_ItemBase::isUniteAlerts() const
|
||||
{
|
||||
TreeModel_ItemBasePtr aParentItem = GetRootItem();
|
||||
MessageModel_ItemRootPtr aRootItem = itemDynamicCast<MessageModel_ItemRoot> (aParentItem);
|
||||
return aRootItem ? aRootItem->IsUniteAlerts() : Standard_False;
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : GetRootItem
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
TreeModel_ItemBasePtr MessageModel_ItemBase::GetRootItem() const
|
||||
{
|
||||
TreeModel_ItemBasePtr anItem = Parent();
|
||||
while (anItem)
|
||||
{
|
||||
if (MessageModel_ItemRootPtr aThisRootItem = itemDynamicCast<MessageModel_ItemRoot> (anItem))
|
||||
{
|
||||
return aThisRootItem;
|
||||
}
|
||||
anItem = anItem->Parent();
|
||||
}
|
||||
return TreeModel_ItemBasePtr();
|
||||
}
|
60
tools/MessageModel/MessageModel_ItemBase.hxx
Normal file
60
tools/MessageModel/MessageModel_ItemBase.hxx
Normal file
@@ -0,0 +1,60 @@
|
||||
// Created on: 2017-06-16
|
||||
// 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 MessageModel_ItemBase_H
|
||||
#define MessageModel_ItemBase_H
|
||||
|
||||
#include <Standard.hxx>
|
||||
#include <TopoDS_Shape.hxx>
|
||||
#include <inspector/TreeModel_ItemBase.hxx>
|
||||
|
||||
class MessageModel_ItemBase;
|
||||
typedef QExplicitlySharedDataPointer<MessageModel_ItemBase> MessageModel_ItemBasePtr;
|
||||
|
||||
//! \class MessageModel_ItemBase
|
||||
// \brief Declaration of the tree model base item.
|
||||
class MessageModel_ItemBase : public TreeModel_ItemBase
|
||||
{
|
||||
public:
|
||||
|
||||
//! Resets cached values
|
||||
virtual void Reset() Standard_OVERRIDE { TreeModel_ItemBase::Reset(); }
|
||||
|
||||
protected:
|
||||
|
||||
//! Initialize the current item. It creates a backup of the specific item information
|
||||
virtual void initItem() const {};
|
||||
|
||||
//! Constructor
|
||||
//! param theParent a parent item
|
||||
//! \param theRow the item row positition in the parent item
|
||||
//! \param theColumn the item column positition in the parent item
|
||||
MessageModel_ItemBase (TreeModel_ItemBasePtr theParent, const int theRow, const int theColumn)
|
||||
: TreeModel_ItemBase (theParent, theRow, theColumn) {}
|
||||
|
||||
//! Return whether the view is reversed or not
|
||||
//! \return boolean value
|
||||
Standard_Boolean isReversed() const;
|
||||
|
||||
//! Return whether the view is reversed or not
|
||||
//! \return boolean value
|
||||
Standard_Boolean isUniteAlerts() const;
|
||||
|
||||
//! Return root item
|
||||
//! \return an item instance
|
||||
TreeModel_ItemBasePtr GetRootItem() const;
|
||||
};
|
||||
|
||||
#endif
|
191
tools/MessageModel/MessageModel_ItemReport.cxx
Normal file
191
tools/MessageModel/MessageModel_ItemReport.cxx
Normal file
@@ -0,0 +1,191 @@
|
||||
// Created on: 2017-06-16
|
||||
// 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/MessageModel_ItemReport.hxx>
|
||||
|
||||
#include <inspector/MessageModel_ItemRoot.hxx>
|
||||
#include <inspector/MessageModel_ItemAlert.hxx>
|
||||
|
||||
#include <OSD_Path.hxx>
|
||||
|
||||
#include <QColor>
|
||||
|
||||
// =======================================================================
|
||||
// function : initValue
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
QVariant MessageModel_ItemReport::initValue (const int theRole) const
|
||||
{
|
||||
const Handle(Message_Report)& aReport = getReport();
|
||||
if (aReport.IsNull())
|
||||
return QVariant();
|
||||
|
||||
if (theRole == Qt::ForegroundRole)
|
||||
{
|
||||
if (!aReport->GetAlerts (Message_Fail).IsEmpty())
|
||||
return QColor(Qt::darkRed);
|
||||
|
||||
for (int aGravityId = (int)Message_Trace; aGravityId <= (int)Message_Fail; aGravityId++)
|
||||
{
|
||||
if (!aReport->IsActive ((Message_Gravity)aGravityId))
|
||||
return QColor(Qt::darkGray);
|
||||
}
|
||||
return QVariant();
|
||||
}
|
||||
if (theRole == Qt::ToolTipRole && !myDescription.IsEmpty() && Column() == 8)
|
||||
return myDescription.ToCString();
|
||||
|
||||
if (theRole != Qt::DisplayRole)
|
||||
return QVariant();
|
||||
|
||||
switch (Column())
|
||||
{
|
||||
case 0: return aReport->DynamicType()->Name();
|
||||
case 1: return QVariant(); // visibility state
|
||||
case 2: return rowCount() > 0 ? QVariant (rowCount()) : QVariant();
|
||||
case 3:
|
||||
{
|
||||
double anAmountTime = AmountElapsedTime (aReport);
|
||||
return anAmountTime < 1 ? QVariant() : anAmountTime;
|
||||
}
|
||||
case 4: return "100";
|
||||
case 8:
|
||||
{
|
||||
if (myDescription.IsEmpty())
|
||||
return QVariant();
|
||||
|
||||
OSD_Path aPath(myDescription);
|
||||
return QString ("%1%2").arg (aPath.Name().ToCString()).arg (aPath.Extension().ToCString());
|
||||
}
|
||||
default: break;
|
||||
}
|
||||
return QVariant();
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : initRowCount
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
int MessageModel_ItemReport::initRowCount() const
|
||||
{
|
||||
const Handle(Message_Report)& aReport = getReport();
|
||||
if (aReport.IsNull())
|
||||
return 0;
|
||||
|
||||
int aRowCount = 0;
|
||||
NCollection_Vector<Message_ListOfAlert> aUnitedAlerts;
|
||||
for (int aGravityId = Message_Trace; aGravityId <= Message_Fail; aGravityId++)
|
||||
{
|
||||
const Message_ListOfAlert& anAlerts = aReport->GetAlerts ((Message_Gravity)aGravityId);
|
||||
if (isUniteAlerts())
|
||||
{
|
||||
MessageModel_ItemAlert::GetUnitedAlerts (anAlerts, aUnitedAlerts);
|
||||
aRowCount += aUnitedAlerts.Size();
|
||||
}
|
||||
else
|
||||
aRowCount += anAlerts.Size();
|
||||
}
|
||||
return isUniteAlerts() ? aUnitedAlerts.Size() : aRowCount;
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : createChild
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
TreeModel_ItemBasePtr MessageModel_ItemReport::createChild (int theRow, int theColumn)
|
||||
{
|
||||
return MessageModel_ItemAlert::CreateItem (currentItem(), theRow, theColumn);
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : Init
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void MessageModel_ItemReport::Init()
|
||||
{
|
||||
MessageModel_ItemRootPtr aRootItem = itemDynamicCast<MessageModel_ItemRoot> (Parent());
|
||||
myReport = aRootItem ? aRootItem->GetReport (Row(), myDescription) : Handle(Message_Report)();
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : getReport
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
const Handle(Message_Report)& MessageModel_ItemReport::getReport() const
|
||||
{
|
||||
initItem();
|
||||
return myReport;
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : Reset
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void MessageModel_ItemReport::Reset()
|
||||
{
|
||||
MessageModel_ItemBase::Reset();
|
||||
myReport = Handle(Message_Report)();
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : initItem
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void MessageModel_ItemReport::initItem() const
|
||||
{
|
||||
if (IsInitialized())
|
||||
return;
|
||||
const_cast<MessageModel_ItemReport*>(this)->Init();
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : FindReportItem
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
MessageModel_ItemReportPtr MessageModel_ItemReport::FindReportItem (const TreeModel_ItemBasePtr& theItem)
|
||||
{
|
||||
TreeModel_ItemBasePtr anItem = theItem;
|
||||
while (anItem)
|
||||
{
|
||||
if (MessageModel_ItemReportPtr aReportItem = itemDynamicCast<MessageModel_ItemReport>(anItem))
|
||||
return aReportItem;
|
||||
|
||||
anItem = anItem->Parent();
|
||||
}
|
||||
return MessageModel_ItemReportPtr();
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : AmountElapsedTime
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
double MessageModel_ItemReport::AmountElapsedTime (const Handle(Message_Report)& theReport)
|
||||
{
|
||||
if (theReport.IsNull())
|
||||
return 0;
|
||||
|
||||
double anAmountTime = 0;
|
||||
|
||||
for (int aGravityId = Message_Trace; aGravityId <= Message_Fail; aGravityId++)
|
||||
{
|
||||
for (Message_ListOfAlert::Iterator anAlertsIt (theReport->GetAlerts ((Message_Gravity)aGravityId)); anAlertsIt.More(); anAlertsIt.Next())
|
||||
{
|
||||
double aSubItemTime = MessageModel_ItemAlert::AmountElapsedTime (anAlertsIt.Value());
|
||||
if (aSubItemTime > 0)
|
||||
anAmountTime += aSubItemTime;
|
||||
}
|
||||
}
|
||||
return anAmountTime;
|
||||
}
|
106
tools/MessageModel/MessageModel_ItemReport.hxx
Normal file
106
tools/MessageModel/MessageModel_ItemReport.hxx
Normal file
@@ -0,0 +1,106 @@
|
||||
// Created on: 2017-06-16
|
||||
// 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 MessageModel_ItemReport_H
|
||||
#define MessageModel_ItemReport_H
|
||||
|
||||
#include <inspector/MessageModel_ItemBase.hxx>
|
||||
#include <Standard.hxx>
|
||||
#include <TCollection_AsciiString.hxx>
|
||||
#include <Message_Report.hxx>
|
||||
|
||||
#include <QMap>
|
||||
#include <QVariant>
|
||||
|
||||
class MessageModel_ItemReport;
|
||||
typedef QExplicitlySharedDataPointer<MessageModel_ItemReport> MessageModel_ItemReportPtr;
|
||||
|
||||
//! \class MessageModel_ItemReport
|
||||
//! This item is connected to Message_Alert.
|
||||
//! Parent is MessageModel_ItemRoot, children are MessageModel_ItemAlert or no children
|
||||
class MessageModel_ItemReport : public MessageModel_ItemBase
|
||||
{
|
||||
public:
|
||||
|
||||
//! Creates an item wrapped by a shared pointer
|
||||
//! \param theRow the item row positition in the parent item
|
||||
//! \param theColumn the item column positition in the parent item
|
||||
//! \return the pointer to the created item
|
||||
static MessageModel_ItemReportPtr CreateItem (TreeModel_ItemBasePtr theParent, const int theRow, const int theColumn)
|
||||
{ return MessageModel_ItemReportPtr (new MessageModel_ItemReport (theParent, theRow, theColumn)); }
|
||||
|
||||
//! Destructor
|
||||
virtual ~MessageModel_ItemReport() Standard_OVERRIDE {};
|
||||
|
||||
//! Returns the current shape
|
||||
const Handle(Message_Report)& GetReport() const { return myReport; }
|
||||
|
||||
const TCollection_AsciiString& GetDescription() const { return myDescription; }
|
||||
|
||||
//! Inits the item, fills internal containers
|
||||
Standard_EXPORT virtual void Init() Standard_OVERRIDE;
|
||||
|
||||
//! Resets cached values
|
||||
Standard_EXPORT virtual void Reset() Standard_OVERRIDE;
|
||||
|
||||
//! Return data value for the role.
|
||||
//! \param theRole a value role
|
||||
//! \return the value
|
||||
Standard_EXPORT virtual QVariant initValue (const int theRole) const Standard_OVERRIDE;
|
||||
|
||||
//! \return number of children.
|
||||
Standard_EXPORT virtual int initRowCount() const Standard_OVERRIDE;
|
||||
|
||||
//! Returns report of the tree model item. Iterates up by parents intil the report item is found.
|
||||
//! \return an item or NULL
|
||||
Standard_EXPORT static MessageModel_ItemReportPtr FindReportItem (const TreeModel_ItemBasePtr& theItem);
|
||||
|
||||
//! Returns summ of children alert elapsed times. The method is recusive.
|
||||
//! \param theAlert a message alert
|
||||
//! \return double value
|
||||
Standard_EXPORT static double AmountElapsedTime (const Handle(Message_Report)& theReport);
|
||||
|
||||
protected:
|
||||
|
||||
//! Initialize the current item. It is empty because Reset() is also empty.
|
||||
virtual void initItem() 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
|
||||
virtual TreeModel_ItemBasePtr createChild (int theRow, int theColumn) Standard_OVERRIDE;
|
||||
|
||||
//! Returns number of child shapes. Init item if it is not initialized
|
||||
//! \return integer value
|
||||
int getRowCount() const;
|
||||
|
||||
//! Returns current shape, initialized item if it has not been initialized yet
|
||||
//! \return shape value
|
||||
const Handle(Message_Report)& getReport() const;
|
||||
|
||||
private:
|
||||
|
||||
//! Constructor
|
||||
MessageModel_ItemReport (TreeModel_ItemBasePtr theParent, const int theRow, const int theColumn)
|
||||
: MessageModel_ItemBase (theParent, theRow, theColumn) {}
|
||||
|
||||
private:
|
||||
|
||||
Handle(Message_Report) myReport; //!< current report
|
||||
TCollection_AsciiString myDescription; //!< description
|
||||
};
|
||||
|
||||
#endif
|
77
tools/MessageModel/MessageModel_ItemRoot.cxx
Normal file
77
tools/MessageModel/MessageModel_ItemRoot.cxx
Normal file
@@ -0,0 +1,77 @@
|
||||
// Created on: 2017-06-16
|
||||
// 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/MessageModel_ItemRoot.hxx>
|
||||
#include <inspector/MessageModel_ItemReport.hxx>
|
||||
|
||||
// =======================================================================
|
||||
// function : SetReport
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void MessageModel_ItemRoot::SetReport (const int theRowId, const Handle(Message_Report)& theReport,
|
||||
const TCollection_AsciiString& theReportDescription)
|
||||
{
|
||||
NCollection_List<MessageModel_ReportInformation>::Iterator aReportsIt (myReports);
|
||||
for (int aRowId = 0; aReportsIt.More(); aReportsIt.Next(), aRowId++)
|
||||
{
|
||||
if (aRowId == theRowId)
|
||||
break;
|
||||
}
|
||||
aReportsIt.Value().myReport = theReport;
|
||||
aReportsIt.Value().myDescription = theReportDescription;
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : GetReport
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
const Handle(Message_Report)& MessageModel_ItemRoot::GetReport (const int theRowId,
|
||||
TCollection_AsciiString& theReportDescription)
|
||||
{
|
||||
NCollection_List<MessageModel_ReportInformation>::Iterator aReportsIt (myReports);
|
||||
for (int aRowId = 0; aReportsIt.More(); aReportsIt.Next(), aRowId++)
|
||||
{
|
||||
if (aRowId == theRowId)
|
||||
break;
|
||||
}
|
||||
theReportDescription = aReportsIt.Value().myDescription;
|
||||
return aReportsIt.Value().myReport;
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : initValue
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
QVariant MessageModel_ItemRoot::initValue (const int theRole) const
|
||||
{
|
||||
if (Column() != 0)
|
||||
return QVariant();
|
||||
|
||||
if (theRole == Qt::DisplayRole)
|
||||
return myName.IsEmpty() ? "Message_Reports" : myName.ToCString();
|
||||
|
||||
return QVariant();
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : createChild
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
TreeModel_ItemBasePtr MessageModel_ItemRoot::createChild (int theRow, int theColumn)
|
||||
{
|
||||
return MessageModel_ItemReport::CreateItem (currentItem(), theRow, theColumn);
|
||||
}
|
||||
|
127
tools/MessageModel/MessageModel_ItemRoot.hxx
Normal file
127
tools/MessageModel/MessageModel_ItemRoot.hxx
Normal file
@@ -0,0 +1,127 @@
|
||||
// Created on: 2017-06-16
|
||||
// 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 MessageModel_ItemRoot_H
|
||||
#define MessageModel_ItemRoot_H
|
||||
|
||||
#include <Message_Alert.hxx>
|
||||
#include <Message_Report.hxx>
|
||||
#include <NCollection_List.hxx>
|
||||
#include <Standard.hxx>
|
||||
#include <TCollection_AsciiString.hxx>
|
||||
|
||||
#include <inspector/MessageModel_ItemBase.hxx>
|
||||
|
||||
class MessageModel_ItemRoot;
|
||||
typedef QExplicitlySharedDataPointer<MessageModel_ItemRoot> MessageModel_ItemRootPtr;
|
||||
|
||||
//! \class MessageModel_ItemRoot
|
||||
//! Collects message reports that should be visualized in tree view. Reports are cached and if reports are not needed,
|
||||
//! cache should be cleared using RemoveAllReports
|
||||
//! Parent is NULL, children are MessageModel_ItemReport items.
|
||||
class MessageModel_ItemRoot : public MessageModel_ItemBase
|
||||
{
|
||||
private:
|
||||
//! \struct to extend report by description
|
||||
struct MessageModel_ReportInformation
|
||||
{
|
||||
//! Constructor
|
||||
MessageModel_ReportInformation (Handle(Message_Report) theReport, const TCollection_AsciiString& theDescription)
|
||||
: myReport (theReport), myDescription (theDescription) {}
|
||||
|
||||
Handle(Message_Report) myReport; //! report
|
||||
TCollection_AsciiString myDescription; //! report description
|
||||
};
|
||||
public:
|
||||
|
||||
//! Creates an item wrapped by a shared pointer
|
||||
static MessageModel_ItemRootPtr CreateItem (TreeModel_ItemBasePtr theParent, const int theRow, const int theColumn)
|
||||
{ return MessageModel_ItemRootPtr (new MessageModel_ItemRoot (theParent, theRow, theColumn)); }
|
||||
|
||||
//! Destructor
|
||||
virtual ~MessageModel_ItemRoot() Standard_OVERRIDE {};
|
||||
|
||||
//! Appends new report
|
||||
//! \param theReport a report instance
|
||||
//! \param theReportDescription an additional report information
|
||||
void AddReport (const Handle(Message_Report)& theReport, const TCollection_AsciiString& theReportDescription)
|
||||
{ myReports.Append (MessageModel_ReportInformation (theReport, theReportDescription)); }
|
||||
|
||||
//! Set report, se it into the given row index
|
||||
//! \param theRowId a report child row
|
||||
//! \param theReport a report instance
|
||||
//! \param theReportDescription an additional report information
|
||||
Standard_EXPORT void SetReport (const int theRowId, const Handle(Message_Report)& theReport,
|
||||
const TCollection_AsciiString& theReportDescription = "");
|
||||
|
||||
//! Clears internal container of added reports
|
||||
void RemoveAllReports() { myReports.Clear(); }
|
||||
|
||||
//! Returns report by the number
|
||||
//! \param theRowId an index of the report in the internal container.
|
||||
Standard_EXPORT const Handle(Message_Report)& GetReport (const int theRowId, TCollection_AsciiString& theReportDescription);
|
||||
|
||||
//! Set the view reversed. If reversed, the last report alert is upper item in the tree view
|
||||
//! \param theReversed boolean flag
|
||||
void SetReversed (const Standard_Boolean& theReversed) { myIsReversed = theReversed; }
|
||||
|
||||
//! Return whether the view is reversed or not
|
||||
//! \return boolean value
|
||||
Standard_Boolean IsReversed() const { return myIsReversed; };
|
||||
|
||||
//! Set the view reversed. If reversed, the last report alert is upper item in the tree view
|
||||
//! \param theReversed boolean flag
|
||||
void SetUniteAlerts (const Standard_Boolean& theUniteAlerts) { myIsUniteAlerts = theUniteAlerts; }
|
||||
|
||||
//! Return whether the view is reversed or not
|
||||
//! \return boolean value
|
||||
Standard_Boolean IsUniteAlerts() const { return myIsUniteAlerts; };
|
||||
|
||||
//! Set the view reversed. If reversed, the last report alert is upper item in the tree view
|
||||
//! \param theReversed boolean flag
|
||||
void SetName (const TCollection_AsciiString& theName) { myName = theName; }
|
||||
|
||||
protected:
|
||||
|
||||
//! Return data value for the role.
|
||||
//! \param theRole a value role
|
||||
//! \return the value
|
||||
virtual QVariant initValue (const int theRole) const Standard_OVERRIDE;
|
||||
|
||||
//! \return number of children.
|
||||
virtual int initRowCount() const Standard_OVERRIDE { return myReports.Size(); }
|
||||
|
||||
//! 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 createChild (int theRow, int theColumn) Standard_OVERRIDE;
|
||||
|
||||
private:
|
||||
|
||||
//! Constructor
|
||||
//! param theParent a parent item
|
||||
MessageModel_ItemRoot (TreeModel_ItemBasePtr theParent, const int theRow, const int theColumn)
|
||||
: MessageModel_ItemBase (theParent, theRow, theColumn), myIsReversed (Standard_False) {}
|
||||
|
||||
private:
|
||||
|
||||
NCollection_List<MessageModel_ReportInformation> myReports; //!< reports sent by algorithms
|
||||
Standard_Boolean myIsReversed; //!< state if the model is reversed
|
||||
Standard_Boolean myIsUniteAlerts; //!< state whether equal named alerts should be united in a folder
|
||||
TCollection_AsciiString myName; //!< DisplayRole data, if defined
|
||||
};
|
||||
|
||||
#endif
|
18
tools/MessageModel/MessageModel_ReportCallBack.cxx
Normal file
18
tools/MessageModel/MessageModel_ReportCallBack.cxx
Normal file
@@ -0,0 +1,18 @@
|
||||
// Created on: 2018-06-20
|
||||
// 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 "MessageModel_ReportCallBack.hxx"
|
||||
|
||||
IMPLEMENT_STANDARD_RTTIEXT(MessageModel_ReportCallBack, Message_ReportCallBack)
|
48
tools/MessageModel/MessageModel_ReportCallBack.hxx
Normal file
48
tools/MessageModel/MessageModel_ReportCallBack.hxx
Normal file
@@ -0,0 +1,48 @@
|
||||
// Created on: 2018-06-20
|
||||
// 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 _MessageModel_ReportCallBack_HeaderFile
|
||||
#define _MessageModel_ReportCallBack_HeaderFile
|
||||
|
||||
#include <Message_ReportCallBack.hxx>
|
||||
|
||||
#include "inspector/TInspectorAPI_Communicator.hxx"
|
||||
|
||||
class TInspectorAPI_Communicator;
|
||||
DEFINE_STANDARD_HANDLE(MessageModel_ReportCallBack, Message_ReportCallBack)
|
||||
|
||||
//! Class to update tree view model by message report events.
|
||||
class MessageModel_ReportCallBack : public Message_ReportCallBack
|
||||
{
|
||||
public:
|
||||
|
||||
//! Constructor
|
||||
MessageModel_ReportCallBack (TInspectorAPI_Communicator* theWindow) : Message_ReportCallBack(), myCommunicator (theWindow) {}
|
||||
|
||||
//! Destructor
|
||||
~MessageModel_ReportCallBack() {}
|
||||
|
||||
// Interface to be implemented in the child to process the message report event
|
||||
// \theAlert updated alert
|
||||
virtual void Update(const Handle(Message_Alert)& theAlert) { (void)theAlert; myCommunicator->UpdateContent(); }
|
||||
|
||||
// OCCT RTTI
|
||||
DEFINE_STANDARD_RTTIEXT(MessageModel_ReportCallBack, Message_ReportCallBack)
|
||||
|
||||
private:
|
||||
TInspectorAPI_Communicator* myCommunicator; //< communicator
|
||||
};
|
||||
|
||||
#endif // _MessageModel_ReportCallBack_HeaderFile
|
106
tools/MessageModel/MessageModel_TableModelRealValues.cxx
Normal file
106
tools/MessageModel/MessageModel_TableModelRealValues.cxx
Normal file
@@ -0,0 +1,106 @@
|
||||
// Created on: 2017-06-16
|
||||
// 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/MessageModel_TableModelRealValues.hxx>
|
||||
|
||||
#include <inspector/ViewControl_TableModel.hxx>
|
||||
|
||||
const int REAL_SIGNS = 16;
|
||||
|
||||
// =======================================================================
|
||||
// function : Constructor
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
|
||||
MessageModel_TableModelRealValues::MessageModel_TableModelRealValues (const Handle(Message_Attribute)& theAttribute,
|
||||
const int theSectionWidth)
|
||||
: myAttribute (Handle(Message_AttributeVectorOfReal)::DownCast (theAttribute))
|
||||
{
|
||||
SetUseTableProperties (true);
|
||||
SetUseTablePropertiesXStep (true, -1);
|
||||
|
||||
SetDefaultSectionSize (Qt::Horizontal, theSectionWidth);
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : ColumnCount
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
|
||||
int MessageModel_TableModelRealValues::ColumnCount (const QModelIndex&) const
|
||||
{
|
||||
return myAttribute->GetValues().Length();
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : Data
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
|
||||
QVariant MessageModel_TableModelRealValues::Data (const int, const int theColumn, int theRole) const
|
||||
{
|
||||
if (theRole == Qt::DisplayRole && theColumn < myAttribute->GetValues().Length())
|
||||
{
|
||||
return myAttribute->GetValues().Value(theColumn);
|
||||
}
|
||||
|
||||
return QVariant();
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : GetRangeValues
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
|
||||
void MessageModel_TableModelRealValues::GetRangeValues (QString& theMinValue, QString& theMaxValue, const QModelIndexList& theSelected) const
|
||||
{
|
||||
double aMinValue, aMaxValue;
|
||||
aMinValue = DBL_MAX;
|
||||
aMaxValue = DBL_MIN;
|
||||
|
||||
NCollection_Vector<double> aValues = myAttribute->GetValues();
|
||||
int aValuesSize = aValues.Length();
|
||||
if (aValuesSize < 1)
|
||||
return;
|
||||
|
||||
if (theSelected.isEmpty())
|
||||
{
|
||||
aMinValue = aMaxValue = aValues.First();
|
||||
for (int i = 1; i < aValuesSize; i++)
|
||||
{
|
||||
double aValue = aValues.Value (i);
|
||||
if (aValue < aMinValue) aMinValue = aValue;
|
||||
if (aValue > aMaxValue) aMaxValue = aValue;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
ViewControl_TableModel* aModel = (ViewControl_TableModel*)theSelected[0].model();
|
||||
int aRow, aColumn;
|
||||
for (QModelIndexList::const_iterator aSelIt = theSelected.begin(); aSelIt != theSelected.end(); aSelIt++)
|
||||
{
|
||||
aModel->GetSourcePosition (*aSelIt, aRow, aColumn);
|
||||
if (aColumn >= aValuesSize)
|
||||
continue;
|
||||
|
||||
double aValue = aValues.Value (aColumn);
|
||||
if (aValue < aMinValue) aMinValue = aValue;
|
||||
if (aValue > aMaxValue) aMaxValue = aValue;
|
||||
}
|
||||
}
|
||||
|
||||
theMinValue = QString::number(aMinValue, 'g', REAL_SIGNS);
|
||||
theMaxValue = QString::number(aMaxValue, 'g', REAL_SIGNS);
|
||||
}
|
66
tools/MessageModel/MessageModel_TableModelRealValues.hxx
Normal file
66
tools/MessageModel/MessageModel_TableModelRealValues.hxx
Normal file
@@ -0,0 +1,66 @@
|
||||
// Created on: 2017-06-16
|
||||
// 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 MessageModel_TableModelRealValues_H
|
||||
#define MessageModel_TableModelRealValues_H
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(disable : 4127 4718) // conditional expression is constant, recursive call has no side effects
|
||||
#endif
|
||||
|
||||
#include <inspector/ViewControl_TableModelValues.hxx>
|
||||
|
||||
#include <Message_AttributeVectorOfReal.hxx>
|
||||
|
||||
//! \class MessageModel_TableModelRealValues
|
||||
//! \brief This is an implementation for ViewControl_TableModel to present Message_AttributeVectorOfReal object
|
||||
class MessageModel_TableModelRealValues : public ViewControl_TableModelValues
|
||||
{
|
||||
public:
|
||||
|
||||
//! Constructor
|
||||
Standard_EXPORT MessageModel_TableModelRealValues (const Handle(Message_Attribute)& theAttribute, const int theSectionWidth);
|
||||
|
||||
//! Destructor
|
||||
virtual ~MessageModel_TableModelRealValues() Standard_OVERRIDE {}
|
||||
|
||||
//! Returns number of columns, size of header values
|
||||
//! \param theParent an index of the parent item
|
||||
//! \return an integer value
|
||||
Standard_EXPORT virtual int ColumnCount (const QModelIndex& theParent = QModelIndex()) const;
|
||||
|
||||
//! Returns number of rows, depending on orientation: myColumnCount or size of values container
|
||||
//! \param theParent an index of the parent item
|
||||
//! \return an integer value
|
||||
virtual int RowCount (const QModelIndex& theParent = QModelIndex()) const { (void)theParent; return 1; }
|
||||
|
||||
//! Returns content of the model index for the given role, it is obtained from internal container of values
|
||||
//! It returns value only for DisplayRole.
|
||||
//! \param theIndex a model index
|
||||
//! \param theRole a view role
|
||||
//! \return value intepreted depending on the given role
|
||||
Standard_EXPORT virtual QVariant Data (const int theRow, const int theColumn, int theRole = Qt::DisplayRole) const;
|
||||
|
||||
//! Returns minimum and maximum values of selected items or the table content (if selected list is empty)
|
||||
//! \param theMinValue minimum
|
||||
//! \param theMaxValue maximum
|
||||
//! \param theSelected selected cells
|
||||
virtual void GetRangeValues (QString& theMinValue, QString& theMaxValue, const QModelIndexList& theSelected) const;
|
||||
|
||||
private:
|
||||
Handle(Message_AttributeVectorOfReal) myAttribute; //!< alert attribute, container of table values
|
||||
};
|
||||
|
||||
#endif
|
122
tools/MessageModel/MessageModel_TableModelRealVec3Values.cxx
Normal file
122
tools/MessageModel/MessageModel_TableModelRealVec3Values.cxx
Normal file
@@ -0,0 +1,122 @@
|
||||
// Created on: 2017-06-16
|
||||
// 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/MessageModel_TableModelRealVec3Values.hxx>
|
||||
|
||||
#include <inspector/ViewControl_TableModel.hxx>
|
||||
|
||||
// =======================================================================
|
||||
// function : Constructor
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
|
||||
MessageModel_TableModelRealVec3Values::MessageModel_TableModelRealVec3Values (const Handle(Message_Attribute)& theAttribute,
|
||||
const int theSectionWidth)
|
||||
: myAttribute (Handle(Message_AttributeVectorOfRealVec3)::DownCast (theAttribute))
|
||||
{
|
||||
SetUseTableProperties (true);
|
||||
|
||||
SetDefaultSectionSize (Qt::Horizontal, theSectionWidth);
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : ColumnCount
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
|
||||
int MessageModel_TableModelRealVec3Values::ColumnCount (const QModelIndex&) const
|
||||
{
|
||||
return myAttribute->GetValues().Length();
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : Data
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
|
||||
QVariant MessageModel_TableModelRealVec3Values::Data (const int, const int theColumn, int theRole) const
|
||||
{
|
||||
if (theRole != Qt::DisplayRole || theColumn > myAttribute->GetValues().Length())
|
||||
return QVariant();
|
||||
|
||||
NCollection_Vec3<double> aValue = myAttribute->GetValues().Value(theColumn);
|
||||
return QString ("%1, %2, %3").arg (aValue.x()).arg (aValue.y()).arg (aValue.z());
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : GetRangeValues
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
|
||||
void MessageModel_TableModelRealVec3Values::GetRangeValues (QString& theMinValue, QString& theMaxValue,
|
||||
const QModelIndexList& theSelected) const
|
||||
{
|
||||
theMinValue = DBL_MAX;
|
||||
theMaxValue = DBL_MIN;
|
||||
|
||||
QList<int> aValuePositions;
|
||||
if (!theSelected.isEmpty())
|
||||
{
|
||||
ViewControl_TableModel* aModel = (ViewControl_TableModel*)theSelected[0].model();
|
||||
int aRow, aColumn;
|
||||
for (QModelIndexList::const_iterator aSelIt = theSelected.begin(); aSelIt != theSelected.end(); aSelIt++)
|
||||
{
|
||||
aModel->GetSourcePosition (*aSelIt, aRow, aColumn);
|
||||
aValuePositions.append (aColumn);
|
||||
}
|
||||
}
|
||||
|
||||
NCollection_Vector<NCollection_Vec3<double>> aValues = myAttribute->GetValues();
|
||||
int aValuesSize = aValues.Length();
|
||||
if (aValuesSize < 1)
|
||||
return;
|
||||
|
||||
double aXMinValue = aValues.First().x(), aXMaxValue = aValues.First().x();
|
||||
NCollection_Vec3<double> aValue;
|
||||
for (int i = 1; i < aValuesSize; i++)
|
||||
{
|
||||
if (!aValuePositions.empty() && !aValuePositions.contains (i))
|
||||
continue;
|
||||
|
||||
aValue = aValues.Value (i);
|
||||
if (aValue.x() < aXMinValue) aXMinValue = aValue.x();
|
||||
if (aValue.x() > aXMaxValue) aXMaxValue = aValue.x();
|
||||
}
|
||||
|
||||
double anYMinValue = aValues.First().y(), anYMaxValue = aValues.First().y();
|
||||
for (int i = 1; i < aValuesSize; i++)
|
||||
{
|
||||
if (!aValuePositions.empty() && !aValuePositions.contains (i))
|
||||
continue;
|
||||
|
||||
aValue = aValues.Value (i);
|
||||
if (aValue.x() == aXMinValue && aValue.y() < anYMinValue) anYMinValue = aValue.y();
|
||||
if (aValue.x() == aXMaxValue && aValue.y() > anYMaxValue) anYMaxValue = aValue.y();
|
||||
}
|
||||
|
||||
double aZMinValue = aValues.First().z(), aZMaxValue = aValues.First().z();
|
||||
for (int i = 1; i < aValuesSize; i++)
|
||||
{
|
||||
if (!aValuePositions.empty() && !aValuePositions.contains (i))
|
||||
continue;
|
||||
aValue = aValues.Value (i);
|
||||
if (aValue.x() == aXMinValue && aValue.y() == anYMinValue && aValue.z() < aZMinValue) aZMinValue = aValue.z();
|
||||
if (aValue.x() == aXMaxValue && aValue.y() == anYMaxValue && aValue.z() > aZMaxValue) aZMaxValue = aValue.z();
|
||||
}
|
||||
|
||||
theMinValue = QString ("%1, %2, %3").arg (aXMinValue).arg (anYMinValue).arg (aZMinValue);
|
||||
theMaxValue = QString ("%1, %2, %3").arg (aXMaxValue).arg (anYMaxValue).arg (aZMaxValue);
|
||||
}
|
67
tools/MessageModel/MessageModel_TableModelRealVec3Values.hxx
Normal file
67
tools/MessageModel/MessageModel_TableModelRealVec3Values.hxx
Normal file
@@ -0,0 +1,67 @@
|
||||
// Created on: 2017-06-16
|
||||
// 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 MessageModel_TableModelRealVec3Values_H
|
||||
#define MessageModel_TableModelRealVec3Values_H
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(disable : 4127 4718) // conditional expression is constant, recursive call has no side effects
|
||||
#endif
|
||||
|
||||
#include <inspector/ViewControl_TableModelValues.hxx>
|
||||
|
||||
#include <Message_AttributeVectorOfRealVec3.hxx>
|
||||
|
||||
//! \class MessageModel_TableModelRealVec3Values
|
||||
//! \brief This is an implementation for ViewControl_TableModel to present Message_AttributeVectorOfRealVec3 object
|
||||
class MessageModel_TableModelRealVec3Values : public ViewControl_TableModelValues
|
||||
{
|
||||
public:
|
||||
|
||||
//! Constructor
|
||||
Standard_EXPORT MessageModel_TableModelRealVec3Values (const Handle(Message_Attribute)& theAttribute, const int theSectionWidth);
|
||||
|
||||
//! Destructor
|
||||
virtual ~MessageModel_TableModelRealVec3Values() Standard_OVERRIDE {}
|
||||
|
||||
//! Returns number of columns, size of header values
|
||||
//! \param theParent an index of the parent item
|
||||
//! \return an integer value
|
||||
Standard_EXPORT virtual int ColumnCount (const QModelIndex& theParent = QModelIndex()) const;
|
||||
|
||||
//! Returns number of rows, depending on orientation: myColumnCount or size of values container
|
||||
//! \param theParent an index of the parent item
|
||||
//! \return an integer value
|
||||
virtual int RowCount (const QModelIndex& theParent = QModelIndex()) const { (void)theParent; return 1; }
|
||||
|
||||
//! Returns content of the model index for the given role, it is obtained from internal container of values
|
||||
//! It returns value only for DisplayRole.
|
||||
//! \param theIndex a model index
|
||||
//! \param theRole a view role
|
||||
//! \return value intepreted depending on the given role
|
||||
Standard_EXPORT virtual QVariant Data (const int theRow, const int theColumn, int theRole = Qt::DisplayRole) const;
|
||||
|
||||
//! Returns minimum and maximum values of selected items or the table content (if selected list is empty)
|
||||
//! It finds firstly Xmax, then Ymax, after that Zmax. The same for min values.
|
||||
//! \param theMinValue minimum
|
||||
//! \param theMaxValue maximum
|
||||
//! \param theSelected selected cells
|
||||
virtual void GetRangeValues (QString& theMinValue, QString& theMaxValue, const QModelIndexList& theSelected) const;
|
||||
|
||||
private:
|
||||
Handle(Message_AttributeVectorOfRealVec3) myAttribute; //!< alert attribute, container of table values
|
||||
};
|
||||
|
||||
#endif
|
239
tools/MessageModel/MessageModel_Tools.cxx
Normal file
239
tools/MessageModel/MessageModel_Tools.cxx
Normal file
@@ -0,0 +1,239 @@
|
||||
// Created on: 2017-06-16
|
||||
// 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/MessageModel_Tools.hxx>
|
||||
#include <inspector/MessageModel_TableModelRealValues.hxx>
|
||||
#include <inspector/MessageModel_TableModelRealVec3Values.hxx>
|
||||
|
||||
#include <inspector/ViewControl_Table.hxx>
|
||||
#include <inspector/ViewControl_TableModelValues.hxx>
|
||||
|
||||
#include <BRep_Builder.hxx>
|
||||
#include <BRepBuilderAPI_MakeVertex.hxx>
|
||||
#include <BRepBuilderAPI_MakeEdge.hxx>
|
||||
#include <BRepTools.hxx>
|
||||
#include <Message_AlertExtended.hxx>
|
||||
#include <Message_AttributeObject.hxx>
|
||||
#include <Message_AttributeVectorOfReal.hxx>
|
||||
#include <Message_AttributeVectorOfRealVec3.hxx>
|
||||
#include <Precision.hxx>
|
||||
#include <TopoDS_AlertWithShape.hxx>
|
||||
#include <TopoDS_Edge.hxx>
|
||||
|
||||
// =======================================================================
|
||||
// function : GetPointerInfo
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
TCollection_AsciiString MessageModel_Tools::GetPointerInfo (const Handle(Standard_Transient)& thePointer, const bool isShortInfo)
|
||||
{
|
||||
if (thePointer.IsNull())
|
||||
return TCollection_AsciiString();
|
||||
|
||||
std::ostringstream aPtrStr;
|
||||
aPtrStr << thePointer.operator->();
|
||||
if (!isShortInfo)
|
||||
return aPtrStr.str().c_str();
|
||||
|
||||
TCollection_AsciiString anInfoPtr (aPtrStr.str().c_str());
|
||||
for (int aSymbolId = 1; aSymbolId < anInfoPtr.Length(); aSymbolId++)
|
||||
{
|
||||
if (anInfoPtr.Value(aSymbolId) != '0')
|
||||
{
|
||||
anInfoPtr = anInfoPtr.SubString (aSymbolId, anInfoPtr.Length());
|
||||
anInfoPtr.Prepend("0x");
|
||||
return anInfoPtr;
|
||||
}
|
||||
}
|
||||
return aPtrStr.str().c_str();
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : GetPointerAlertInfo
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
TCollection_AsciiString MessageModel_Tools::GetPointerAlertInfo (const Handle(Message_Alert)& theAlert)
|
||||
{
|
||||
if (theAlert->IsKind (STANDARD_TYPE (TopoDS_AlertWithShape)))
|
||||
return GetPointerInfo (Handle(TopoDS_AlertWithShape)::DownCast (theAlert)->GetShape().TShape());
|
||||
else if (theAlert->IsKind (STANDARD_TYPE (Message_AttributeObject)))
|
||||
return GetPointerInfo (Handle(Message_AttributeObject)::DownCast (theAlert)->GetObject());
|
||||
return TCollection_AsciiString();
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : GetShapeTypeAlertInfo
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
TCollection_AsciiString MessageModel_Tools::GetShapeTypeAlertInfo (const Handle(Message_Alert)& theAlert)
|
||||
{
|
||||
TopoDS_Shape aShape;
|
||||
|
||||
if (theAlert->IsKind (STANDARD_TYPE (TopoDS_AlertWithShape)))
|
||||
aShape = Handle(TopoDS_AlertWithShape)::DownCast (theAlert)->GetShape();
|
||||
|
||||
if (aShape.IsNull())
|
||||
return TCollection_AsciiString();
|
||||
|
||||
TopAbs_ShapeEnum aShapeType = aShape.ShapeType();
|
||||
Standard_SStream aSStream;
|
||||
TopAbs::Print ((TopAbs_ShapeEnum)aShapeType, aSStream);
|
||||
return aSStream.str().c_str();
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : GetStandardTypeAlertInfo
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
TCollection_AsciiString MessageModel_Tools::GetStandardTypeAlertInfo (const Handle(Message_Alert)& theAlert)
|
||||
{
|
||||
Handle(Standard_Transient) aPointer;
|
||||
if (theAlert->IsKind (STANDARD_TYPE (TopoDS_AlertWithShape)))
|
||||
aPointer = Handle(TopoDS_AlertWithShape)::DownCast (theAlert)->GetShape().TShape();
|
||||
else if (theAlert->IsKind (STANDARD_TYPE (Message_AttributeObject)))
|
||||
aPointer = Handle(Message_AttributeObject)::DownCast (theAlert)->GetObject();
|
||||
|
||||
if (aPointer.IsNull())
|
||||
return TCollection_AsciiString();
|
||||
|
||||
return aPointer->DynamicType()->Name();
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : GetPropertyTableValues
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void MessageModel_Tools::GetPropertyTableValues (const Handle(Message_Alert)& theAlert,
|
||||
QList<ViewControl_TableModelValues*>& theTableValues)
|
||||
{
|
||||
ViewControl_TableModelValues* aTableValues = 0;
|
||||
|
||||
Handle(Message_AlertExtended) anExtendedAlert = Handle(Message_AlertExtended)::DownCast(theAlert);
|
||||
if (anExtendedAlert.IsNull())
|
||||
return;
|
||||
|
||||
Handle(Message_Attribute) anAttribute = anExtendedAlert->Attribute();
|
||||
if (anAttribute.IsNull())
|
||||
return;
|
||||
|
||||
if (anAttribute->IsKind (STANDARD_TYPE (Message_AttributeVectorOfReal)))
|
||||
{
|
||||
int aSectionSize = 60;
|
||||
aTableValues = new MessageModel_TableModelRealValues (anAttribute, aSectionSize);
|
||||
theTableValues.append (aTableValues);
|
||||
}
|
||||
else if (anAttribute->IsKind (STANDARD_TYPE (Message_AttributeVectorOfRealVec3)))
|
||||
{
|
||||
int aSectionSize = 160;
|
||||
aTableValues = new MessageModel_TableModelRealVec3Values (anAttribute, aSectionSize);
|
||||
theTableValues.append (aTableValues);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!anAttribute->GetDescription().IsEmpty())
|
||||
{
|
||||
aTableValues = new ViewControl_TableModelValues();
|
||||
QList<TreeModel_HeaderSection> aHeaderValues;
|
||||
QVector<QVariant> aValues;
|
||||
aHeaderValues << TreeModel_HeaderSection ("Description", -2);
|
||||
aValues << anAttribute->GetDescription().ToCString();
|
||||
aTableValues->SetHeaderValues (aHeaderValues, Qt::Horizontal);
|
||||
|
||||
QString aValueStr = anAttribute->GetDescription().ToCString();
|
||||
QStringList aValueStrList = aValueStr.split ("\n");
|
||||
int aNbRows = aValueStrList.size();
|
||||
|
||||
QFontMetrics aFontMetrics (qApp->font());
|
||||
int aHeight = aFontMetrics.boundingRect(aValueStr).height();
|
||||
aHeight = (aHeight + TreeModel_Tools::HeaderSectionMargin()) * aNbRows;
|
||||
aTableValues->SetValues (aValues);
|
||||
aTableValues->SetDefaultSectionSize(Qt::Vertical, aHeight);
|
||||
|
||||
theTableValues.append (aTableValues);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : BuildShape
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
TopoDS_Shape MessageModel_Tools::BuildShape (const Handle(Message_Alert)& theAlert, QList<int> theSelectedIndices, ViewControl_Table* theTable)
|
||||
{
|
||||
if (theAlert.IsNull())
|
||||
return TopoDS_Shape();
|
||||
|
||||
BRep_Builder aBuilder;
|
||||
TopoDS_Compound aCompound;
|
||||
aBuilder.MakeCompound(aCompound);
|
||||
|
||||
if (theAlert->IsKind (STANDARD_TYPE (Message_AttributeVectorOfReal)))
|
||||
{
|
||||
Handle(Message_AttributeVectorOfReal) aValuesAlert = Handle(Message_AttributeVectorOfReal)::DownCast (theAlert);
|
||||
NCollection_Vector<double> aValues = aValuesAlert->GetValues();
|
||||
int aValuesSize = aValues.Size();
|
||||
|
||||
gp_Pnt aPreviousPoint(0, 0, 0), aCurrentPoint(0, 0, 0);
|
||||
double aXStep = theTable->GetProperty()->GetXStep();
|
||||
if (aXStep < 0)
|
||||
aXStep = 1;
|
||||
double aCurrentXValue = 0;
|
||||
for (QList<int>::const_iterator anIt = theSelectedIndices.begin(); anIt != theSelectedIndices.end(); anIt++)
|
||||
{
|
||||
if (*anIt >= aValuesSize)
|
||||
continue;
|
||||
|
||||
if (aCurrentXValue == 0)
|
||||
{ //just define the previous point
|
||||
aPreviousPoint.SetX (aCurrentXValue);
|
||||
aPreviousPoint.SetY (aValues.Value (*anIt));
|
||||
aCurrentXValue = aCurrentXValue + aXStep;
|
||||
continue;
|
||||
}
|
||||
aCurrentPoint.SetX (aCurrentXValue);
|
||||
aCurrentPoint.SetY (aValues.Value (*anIt));
|
||||
if (aPreviousPoint.Distance (aCurrentPoint) < Precision::Confusion())
|
||||
continue;
|
||||
|
||||
TopoDS_Edge anEdge = BRepBuilderAPI_MakeEdge (aPreviousPoint, aCurrentPoint);
|
||||
aBuilder.Add (aCompound, anEdge);
|
||||
aPreviousPoint = aCurrentPoint;
|
||||
aCurrentXValue = aCurrentXValue + aXStep;
|
||||
}
|
||||
}
|
||||
else if (theAlert->IsKind (STANDARD_TYPE (Message_AttributeVectorOfRealVec3)))
|
||||
{
|
||||
Handle(Message_AttributeVectorOfRealVec3) aValuesAlert = Handle(Message_AttributeVectorOfRealVec3)::DownCast (theAlert);
|
||||
NCollection_Vector<NCollection_Vec3<double>> aValues = aValuesAlert->GetValues();
|
||||
int aValuesSize = aValues.Size();
|
||||
|
||||
gp_Pnt aCurrentPoint(0, 0, 0);
|
||||
NCollection_Vec3<double> aValue;
|
||||
for (QList<int>::const_iterator anIt = theSelectedIndices.begin(); anIt != theSelectedIndices.end(); anIt++)
|
||||
{
|
||||
if (*anIt >= aValuesSize)
|
||||
continue;
|
||||
|
||||
aValue = aValues.Value (*anIt);
|
||||
aCurrentPoint.SetX (aValue.x());
|
||||
aCurrentPoint.SetY (aValue.y());
|
||||
aCurrentPoint.SetZ (aValue.z());
|
||||
|
||||
TopoDS_Vertex aVertex = BRepBuilderAPI_MakeVertex (aCurrentPoint);
|
||||
aBuilder.Add (aCompound, aVertex);
|
||||
}
|
||||
}
|
||||
|
||||
return aCompound;
|
||||
}
|
75
tools/MessageModel/MessageModel_Tools.hxx
Normal file
75
tools/MessageModel/MessageModel_Tools.hxx
Normal file
@@ -0,0 +1,75 @@
|
||||
// Created on: 2017-06-16
|
||||
// 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 MessageModel_Tools_H
|
||||
#define MessageModel_Tools_H
|
||||
|
||||
#include <Standard.hxx>
|
||||
|
||||
#include <TCollection_AsciiString.hxx>
|
||||
#include <Standard_Transient.hxx>
|
||||
#include <TopoDS_Shape.hxx>
|
||||
|
||||
#include <QList>
|
||||
//#include <QColor>
|
||||
|
||||
class Message_Alert;
|
||||
class ViewControl_TableModelValues;
|
||||
|
||||
class ViewControl_Table;
|
||||
|
||||
//! \class MessageModel_Tools
|
||||
//! It gives auxiliary methods for Message classes manipulation
|
||||
class MessageModel_Tools
|
||||
{
|
||||
public:
|
||||
|
||||
//! Convert pointer to string value
|
||||
//! \param thePointer a pointer
|
||||
//! \param isShortInfo if true, all '0' symbols in the beginning of the pointer are skipped
|
||||
//! \return the string value
|
||||
Standard_EXPORT static TCollection_AsciiString GetPointerInfo (const Handle(Standard_Transient)& thePointer,
|
||||
const bool isShortInfo = true);
|
||||
|
||||
//! Returns pointer alert information depening on type of alert (Transient_Object or TopoDS_TShape)
|
||||
//! \param theAlert a message alert
|
||||
//! \return text presentation
|
||||
Standard_EXPORT static TCollection_AsciiString GetPointerAlertInfo (const Handle(Message_Alert)& theAlert);
|
||||
|
||||
//! Returns TopoDS_Shape type alert information or empty string
|
||||
//! \param theAlert a message alert
|
||||
//! \return text presentation
|
||||
Standard_EXPORT static TCollection_AsciiString GetShapeTypeAlertInfo (const Handle(Message_Alert)& theAlert);
|
||||
|
||||
//! Returns dynamic type of an alert object/shape
|
||||
//! \param theAlert a message alert
|
||||
//! \return text presentation
|
||||
Standard_EXPORT static TCollection_AsciiString GetStandardTypeAlertInfo (const Handle(Message_Alert)& theAlert);
|
||||
|
||||
//! Fills container of table values
|
||||
//! \param theAlert a message alert
|
||||
//! \param theTableValue container of values
|
||||
Standard_EXPORT static void GetPropertyTableValues (const Handle(Message_Alert)& theAlert,
|
||||
QList<ViewControl_TableModelValues*>& theTableValues);
|
||||
|
||||
//! Creates TopoDS_Compound with TopoDS_Edge/Vertex on alert data
|
||||
//! \param theAlert a message alert
|
||||
//! \parm theSelectedIndices a container of indices
|
||||
//! \param theTableView source view
|
||||
Standard_EXPORT TopoDS_Shape static BuildShape (const Handle(Message_Alert)& theAlert, QList<int> aSelectedIndices,
|
||||
ViewControl_Table* theTableView);
|
||||
};
|
||||
|
||||
#endif
|
155
tools/MessageModel/MessageModel_TreeModel.cxx
Normal file
155
tools/MessageModel/MessageModel_TreeModel.cxx
Normal file
@@ -0,0 +1,155 @@
|
||||
// Created on: 2017-06-16
|
||||
// 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/MessageModel_TreeModel.hxx>
|
||||
|
||||
#include <inspector/MessageModel_ItemAlert.hxx>
|
||||
#include <inspector/MessageModel_ItemRoot.hxx>
|
||||
#include <inspector/MessageModel_ItemReport.hxx>
|
||||
|
||||
const int COLUMN_NAME_WIDTH = 310;
|
||||
const int COLUMN_SIZE_WIDTH = 30;
|
||||
const int COLUMN_POINTER_WIDTH = 70;
|
||||
const int COLUMN_SHAPE_TYPE_WIDTH = 75;
|
||||
const int COLUMN_STANDARD_TYPE_WIDTH = 120;
|
||||
|
||||
// =======================================================================
|
||||
// function : Constructor
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
MessageModel_TreeModel::MessageModel_TreeModel (QObject* theParent)
|
||||
: TreeModel_ModelBase (theParent), myIsReversed (Standard_False), myIsUniteAlerts (Standard_False)
|
||||
{
|
||||
SetHeaderItem (0, TreeModel_HeaderSection ("Name", COLUMN_NAME_WIDTH));
|
||||
// column 1 is reserved for visiblity state
|
||||
SetHeaderItem (2, TreeModel_HeaderSection ("Size", COLUMN_SIZE_WIDTH));
|
||||
|
||||
SetHeaderItem (3, TreeModel_HeaderSection ("Whole Time", -1));
|
||||
SetHeaderItem (4, TreeModel_HeaderSection ("Percent", -1));
|
||||
|
||||
SetHeaderItem (5, TreeModel_HeaderSection ("Pointer", COLUMN_POINTER_WIDTH));
|
||||
SetHeaderItem (6, TreeModel_HeaderSection ("Shape Type", COLUMN_SHAPE_TYPE_WIDTH));
|
||||
SetHeaderItem (7, TreeModel_HeaderSection ("Standard Type", COLUMN_STANDARD_TYPE_WIDTH));
|
||||
SetHeaderItem (8, TreeModel_HeaderSection ("Description", -1));
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : createRootItem
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void MessageModel_TreeModel::createRootItem (const int theColumnId)
|
||||
{
|
||||
myRootItems.insert (theColumnId, MessageModel_ItemRoot::CreateItem (TreeModel_ItemBasePtr(), 0, theColumnId));
|
||||
if (theColumnId == 0)
|
||||
m_pRootItem = myRootItems[0];
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : AddShape
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void MessageModel_TreeModel::AddReport (const Handle(Message_Report)& theReport,
|
||||
const TCollection_AsciiString& theReportDescription)
|
||||
{
|
||||
for (int aColId = 0, aNbColumns = columnCount(); aColId < aNbColumns; aColId++)
|
||||
{
|
||||
MessageModel_ItemRootPtr aRootItem = itemDynamicCast<MessageModel_ItemRoot> (RootItem (aColId));
|
||||
if (!aRootItem)
|
||||
continue;
|
||||
aRootItem->AddReport (theReport, theReportDescription);
|
||||
aRootItem->SetReversed (myIsReversed);
|
||||
aRootItem->SetUniteAlerts (myIsUniteAlerts);
|
||||
}
|
||||
|
||||
Reset();
|
||||
EmitLayoutChanged();
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : SetReport
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void MessageModel_TreeModel::SetReport (const int theRowId, const Handle(Message_Report)& theReport,
|
||||
const TCollection_AsciiString& theReportDescription)
|
||||
{
|
||||
for (int aColId = 0, aNbColumns = columnCount(); aColId < aNbColumns; aColId++)
|
||||
{
|
||||
MessageModel_ItemRootPtr aRootItem = itemDynamicCast<MessageModel_ItemRoot> (RootItem (aColId));
|
||||
if (!aRootItem)
|
||||
continue;
|
||||
aRootItem->SetReport (theRowId, theReport, theReportDescription);
|
||||
}
|
||||
Reset();
|
||||
EmitLayoutChanged();
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : SetReversed
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void MessageModel_TreeModel::SetReversed (const Standard_Boolean& theReversed)
|
||||
{
|
||||
myIsReversed = theReversed;
|
||||
|
||||
for (int aColId = 0, aNbColumns = columnCount(); aColId < aNbColumns; aColId++)
|
||||
{
|
||||
MessageModel_ItemRootPtr aRootItem = itemDynamicCast<MessageModel_ItemRoot> (RootItem (aColId));
|
||||
if (aRootItem)
|
||||
aRootItem->SetReversed (myIsReversed);
|
||||
}
|
||||
|
||||
Reset();
|
||||
EmitLayoutChanged();
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : SetUniteAlerts
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void MessageModel_TreeModel::SetUniteAlerts (const Standard_Boolean& theUniteAlerts)
|
||||
{
|
||||
myIsUniteAlerts = theUniteAlerts;
|
||||
|
||||
for (int aColId = 0, aNbColumns = columnCount(); aColId < aNbColumns; aColId++)
|
||||
{
|
||||
MessageModel_ItemRootPtr aRootItem = itemDynamicCast<MessageModel_ItemRoot> (RootItem (aColId));
|
||||
if (aRootItem)
|
||||
aRootItem->SetUniteAlerts (myIsUniteAlerts);
|
||||
}
|
||||
|
||||
Reset();
|
||||
EmitLayoutChanged();
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : UpdateTreeModel
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void MessageModel_TreeModel::SetRootItemName (const TCollection_AsciiString& theName)
|
||||
{
|
||||
MessageModel_ItemRootPtr aRootItem = itemDynamicCast<MessageModel_ItemRoot> (RootItem (0));
|
||||
if (aRootItem)
|
||||
aRootItem->SetName (theName);
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : UpdateTreeModel
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void MessageModel_TreeModel::UpdateTreeModel()
|
||||
{
|
||||
Reset();
|
||||
EmitLayoutChanged();
|
||||
}
|
95
tools/MessageModel/MessageModel_TreeModel.hxx
Normal file
95
tools/MessageModel/MessageModel_TreeModel.hxx
Normal file
@@ -0,0 +1,95 @@
|
||||
// Created on: 2017-06-16
|
||||
// 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 MessageModel_TreeModel_H
|
||||
#define MessageModel_TreeModel_H
|
||||
|
||||
#include <inspector/MessageModel_ItemBase.hxx>
|
||||
#include <Standard.hxx>
|
||||
#include <TCollection_AsciiString.hxx>
|
||||
#include <Message_Report.hxx>
|
||||
#include <inspector/TreeModel_ModelBase.hxx>
|
||||
|
||||
#include <QMap>
|
||||
#include <QObject>
|
||||
|
||||
class MessageModel_TreeModel;
|
||||
|
||||
//! \class MessageModel_TreeModel
|
||||
//! View model to visualize MessageReport/s content
|
||||
class MessageModel_TreeModel : public TreeModel_ModelBase
|
||||
{
|
||||
public:
|
||||
|
||||
//! Constructor
|
||||
Standard_EXPORT MessageModel_TreeModel (QObject* theParent);
|
||||
|
||||
//! Destructor
|
||||
virtual ~MessageModel_TreeModel() Standard_OVERRIDE {};
|
||||
|
||||
//! Add shape, append it to the model root item
|
||||
//! \param theReport a report instance
|
||||
//! \param theReportDescription an additional report information
|
||||
Standard_EXPORT void AddReport (const Handle(Message_Report)& theReport,
|
||||
const TCollection_AsciiString& theReportDescription = "");
|
||||
|
||||
//! Set report, se it into the given row index
|
||||
//! \param theRowId a report child row
|
||||
//! \param theReport a report instance
|
||||
//! \param theReportDescription an additional report information
|
||||
Standard_EXPORT void SetReport (const int theRowId, const Handle(Message_Report)& theReport,
|
||||
const TCollection_AsciiString& theReportDescription = "");
|
||||
|
||||
//! Set the view reversed. If reversed, the last report alert is upper item in the tree view
|
||||
//! \param theReversed boolean flag
|
||||
Standard_EXPORT void SetReversed (const Standard_Boolean& theReversed);
|
||||
|
||||
//! Return whether the view is reversed or not
|
||||
//! \return boolean value
|
||||
Standard_Boolean IsReversed() const { return myIsReversed; };
|
||||
|
||||
//! Set union of alerts having equal message in additional folder item.
|
||||
//! \param theUniteAlerts boolean flag
|
||||
Standard_EXPORT void SetUniteAlerts (const Standard_Boolean& theUniteAlerts);
|
||||
|
||||
//! Return whether the alerts should be united
|
||||
//! \return boolean value
|
||||
Standard_Boolean IsUniteAlerts() const { return myIsUniteAlerts; };
|
||||
|
||||
//! Sets the text value of the Root item, only "Name" column accepts the parameter value
|
||||
//! \theName visulized text of root item
|
||||
Standard_EXPORT void SetRootItemName (const TCollection_AsciiString& theName);
|
||||
|
||||
//! Returns root item by column
|
||||
//! \param theColumn an index of the column
|
||||
//! \return root item instance
|
||||
virtual TreeModel_ItemBasePtr RootItem (const int theColumn) const Standard_OVERRIDE
|
||||
{ return myRootItems.contains (theColumn) ? myRootItems[theColumn] : TreeModel_ItemBasePtr(); }
|
||||
|
||||
//! Updates tree model
|
||||
Standard_EXPORT void UpdateTreeModel();
|
||||
|
||||
protected:
|
||||
//! Creates root item
|
||||
//! \param theColumnId index of a column
|
||||
virtual void createRootItem (const int theColumnId) Standard_OVERRIDE;
|
||||
|
||||
private:
|
||||
QMap<int, TreeModel_ItemBasePtr> myRootItems; //!< container of root items, for each column own root item
|
||||
Standard_Boolean myIsReversed; //!< state if the model is reversed
|
||||
Standard_Boolean myIsUniteAlerts; //!< state if alerts should be united
|
||||
};
|
||||
|
||||
#endif
|
BIN
tools/MessageModel/icons/item_shape.png
Normal file
BIN
tools/MessageModel/icons/item_shape.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 614 B |
122
tools/MessageModel/icons/item_shape.svg
Normal file
122
tools/MessageModel/icons/item_shape.svg
Normal file
@@ -0,0 +1,122 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!-- Created with Inkscape (http://www.inkscape.org/) -->
|
||||
|
||||
<svg
|
||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||
xmlns:cc="http://creativecommons.org/ns#"
|
||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:svg="http://www.w3.org/2000/svg"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
width="20"
|
||||
height="20"
|
||||
viewBox="0 0 5.2916664 5.2916666"
|
||||
version="1.1"
|
||||
id="svg8"
|
||||
inkscape:version="0.92.2 (5c3e80d, 2017-08-06)"
|
||||
sodipodi:docname="item_shape.svg"
|
||||
inkscape:export-filename="D:\OCCT\master_CR29451_1\tools\MessageModel\icons\item_shape.png"
|
||||
inkscape:export-xdpi="96"
|
||||
inkscape:export-ydpi="96">
|
||||
<defs
|
||||
id="defs2">
|
||||
<inkscape:perspective
|
||||
sodipodi:type="inkscape:persp3d"
|
||||
inkscape:vp_x="-2.6544163 : -0.28690906 : 1"
|
||||
inkscape:vp_y="0 : 1028.295 : 0"
|
||||
inkscape:vp_z="9.504499 : -1.1228559 : 1"
|
||||
inkscape:persp3d-origin="2.7661607 : -1.3768436 : 1"
|
||||
id="perspective3711" />
|
||||
</defs>
|
||||
<sodipodi:namedview
|
||||
id="base"
|
||||
pagecolor="#ffffff"
|
||||
bordercolor="#666666"
|
||||
borderopacity="1.0"
|
||||
inkscape:pageopacity="0.0"
|
||||
inkscape:pageshadow="2"
|
||||
inkscape:zoom="15.839192"
|
||||
inkscape:cx="4.9829441"
|
||||
inkscape:cy="7.75434"
|
||||
inkscape:document-units="px"
|
||||
inkscape:current-layer="layer1"
|
||||
showgrid="false"
|
||||
fit-margin-top="0"
|
||||
fit-margin-left="0"
|
||||
fit-margin-right="0"
|
||||
fit-margin-bottom="0"
|
||||
inkscape:window-width="1446"
|
||||
inkscape:window-height="676"
|
||||
inkscape:window-x="1766"
|
||||
inkscape:window-y="124"
|
||||
inkscape:window-maximized="0"
|
||||
units="px" />
|
||||
<metadata
|
||||
id="metadata5">
|
||||
<rdf:RDF>
|
||||
<cc:Work
|
||||
rdf:about="">
|
||||
<dc:format>image/svg+xml</dc:format>
|
||||
<dc:type
|
||||
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
||||
<dc:title></dc:title>
|
||||
</cc:Work>
|
||||
</rdf:RDF>
|
||||
</metadata>
|
||||
<g
|
||||
inkscape:label="Layer 1"
|
||||
inkscape:groupmode="layer"
|
||||
id="layer1"
|
||||
transform="translate(71.966667,-93.642022)">
|
||||
<g
|
||||
sodipodi:type="inkscape:box3d"
|
||||
id="g3741"
|
||||
inkscape:perspectiveID="#perspective3711"
|
||||
inkscape:corner0="0.78884625 : 0.0054590483 : 0 : 1"
|
||||
inkscape:corner7="-0.14713316 : 0.0022509206 : 0.25 : 1">
|
||||
<path
|
||||
sodipodi:type="inkscape:box3dside"
|
||||
id="path3743"
|
||||
style="fill:#353564;fill-rule:evenodd;stroke:none;stroke-width:1.45609081;stroke-linejoin:round"
|
||||
inkscape:box3dsidetype="6"
|
||||
d="m -71.590875,96.691829 v 1.844151 l 1.119347,0.186449 v -1.618024 z"
|
||||
points="-71.590875,98.53598 -70.471528,98.722429 -70.471528,97.104405 -71.590875,96.691829 " />
|
||||
<path
|
||||
sodipodi:type="inkscape:box3dside"
|
||||
id="path3753"
|
||||
style="fill:#e9e9ff;fill-rule:evenodd;stroke:none;stroke-width:1.45609081;stroke-linejoin:round"
|
||||
inkscape:box3dsidetype="11"
|
||||
d="m -70.471528,97.104405 3.521639,-1.795967 v 2.991206 l -3.521639,0.422785 z"
|
||||
points="-66.949889,95.308438 -66.949889,98.299644 -70.471528,98.722429 -70.471528,97.104405 " />
|
||||
<path
|
||||
sodipodi:type="inkscape:box3dside"
|
||||
id="path3745"
|
||||
style="fill:#4d4d9f;fill-rule:evenodd;stroke:none;stroke-width:1.45609081;stroke-linejoin:round"
|
||||
inkscape:box3dsidetype="5"
|
||||
d="m -71.590875,96.691829 3.325505,-2.775198 1.315481,1.391807 -3.521639,1.795967 z"
|
||||
points="-68.26537,93.916631 -66.949889,95.308438 -70.471528,97.104405 -71.590875,96.691829 " />
|
||||
<path
|
||||
sodipodi:type="inkscape:box3dside"
|
||||
id="path3751"
|
||||
style="fill:#afafde;fill-rule:evenodd;stroke:none;stroke-width:1.45609081;stroke-linejoin:round"
|
||||
inkscape:box3dsidetype="13"
|
||||
d="m -71.590875,98.53598 3.325505,-0.751334 1.315481,0.514998 -3.521639,0.422785 z"
|
||||
points="-68.26537,97.784646 -66.949889,98.299644 -70.471528,98.722429 -71.590875,98.53598 " />
|
||||
<path
|
||||
sodipodi:type="inkscape:box3dside"
|
||||
id="path3749"
|
||||
style="fill:#d7d7ff;fill-rule:evenodd;stroke:none;stroke-width:1.45609081;stroke-linejoin:round"
|
||||
inkscape:box3dsidetype="14"
|
||||
d="m -68.26537,93.916631 v 3.868015 l 1.315481,0.514998 v -2.991206 z"
|
||||
points="-68.26537,97.784646 -66.949889,98.299644 -66.949889,95.308438 -68.26537,93.916631 " />
|
||||
<path
|
||||
sodipodi:type="inkscape:box3dside"
|
||||
id="path3747"
|
||||
style="fill:#8686bf;fill-rule:evenodd;stroke:none;stroke-width:1.45609081;stroke-linejoin:round"
|
||||
inkscape:box3dsidetype="3"
|
||||
d="m -71.590875,96.691829 3.325505,-2.775198 v 3.868015 l -3.325505,0.751334 z"
|
||||
points="-68.26537,93.916631 -68.26537,97.784646 -71.590875,98.53598 -71.590875,96.691829 " />
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
After Width: | Height: | Size: 4.8 KiB |
BIN
tools/MessageModel/icons/item_vectorOfReal.png
Normal file
BIN
tools/MessageModel/icons/item_vectorOfReal.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 347 B |
103
tools/MessageModel/icons/item_vectorOfReal.svg
Normal file
103
tools/MessageModel/icons/item_vectorOfReal.svg
Normal file
@@ -0,0 +1,103 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!-- Created with Inkscape (http://www.inkscape.org/) -->
|
||||
|
||||
<svg
|
||||
xmlns:osb="http://www.openswatchbook.org/uri/2009/osb"
|
||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||
xmlns:cc="http://creativecommons.org/ns#"
|
||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:svg="http://www.w3.org/2000/svg"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
width="20"
|
||||
height="20"
|
||||
viewBox="0 0 5.2916664 5.2916666"
|
||||
version="1.1"
|
||||
id="svg8"
|
||||
inkscape:version="0.92.2 (5c3e80d, 2017-08-06)"
|
||||
sodipodi:docname="item_vectorOfReal.svg"
|
||||
inkscape:export-filename="D:\OCCT\master_CR29451_1\tools\MessageModel\icons\item_vectorOfRealVec3.png"
|
||||
inkscape:export-xdpi="96"
|
||||
inkscape:export-ydpi="96">
|
||||
<defs
|
||||
id="defs2">
|
||||
<linearGradient
|
||||
id="linearGradient4578"
|
||||
osb:paint="solid">
|
||||
<stop
|
||||
style="stop-color:#000000;stop-opacity:1;"
|
||||
offset="0"
|
||||
id="stop4576" />
|
||||
</linearGradient>
|
||||
<inkscape:perspective
|
||||
sodipodi:type="inkscape:persp3d"
|
||||
inkscape:vp_x="-2.6544163 : -0.28690906 : 1"
|
||||
inkscape:vp_y="0 : 1028.295 : 0"
|
||||
inkscape:vp_z="9.504499 : -1.1228559 : 1"
|
||||
inkscape:persp3d-origin="2.7661607 : -1.3768436 : 1"
|
||||
id="perspective3711" />
|
||||
</defs>
|
||||
<sodipodi:namedview
|
||||
id="base"
|
||||
pagecolor="#ffffff"
|
||||
bordercolor="#666666"
|
||||
borderopacity="1.0"
|
||||
inkscape:pageopacity="0.0"
|
||||
inkscape:pageshadow="2"
|
||||
inkscape:zoom="15.839192"
|
||||
inkscape:cx="-10.548151"
|
||||
inkscape:cy="10.279721"
|
||||
inkscape:document-units="px"
|
||||
inkscape:current-layer="layer1"
|
||||
showgrid="false"
|
||||
fit-margin-top="0"
|
||||
fit-margin-left="0"
|
||||
fit-margin-right="0"
|
||||
fit-margin-bottom="0"
|
||||
inkscape:window-width="1446"
|
||||
inkscape:window-height="838"
|
||||
inkscape:window-x="1733"
|
||||
inkscape:window-y="67"
|
||||
inkscape:window-maximized="0"
|
||||
units="px" />
|
||||
<metadata
|
||||
id="metadata5">
|
||||
<rdf:RDF>
|
||||
<cc:Work
|
||||
rdf:about="">
|
||||
<dc:format>image/svg+xml</dc:format>
|
||||
<dc:type
|
||||
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
||||
<dc:title />
|
||||
</cc:Work>
|
||||
</rdf:RDF>
|
||||
</metadata>
|
||||
<g
|
||||
inkscape:label="Layer 1"
|
||||
inkscape:groupmode="layer"
|
||||
id="layer1"
|
||||
transform="translate(71.966667,-93.642022)">
|
||||
<rect
|
||||
id="rect3769"
|
||||
width="4.660512"
|
||||
height="4.443356"
|
||||
x="-71.632576"
|
||||
y="94.056023"
|
||||
style="opacity:1;fill:none;fill-opacity:1;stroke:#8c8c8c;stroke-width:0.26458332;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
|
||||
<rect
|
||||
id="rect3769-3"
|
||||
width="4.7041783"
|
||||
height="2.2966287"
|
||||
x="-71.676239"
|
||||
y="96.202751"
|
||||
style="opacity:1;fill:none;fill-opacity:1;stroke:#8c8c8c;stroke-width:0.19110738;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
|
||||
<rect
|
||||
id="rect3769-9"
|
||||
width="2.3560426"
|
||||
height="4.4502382"
|
||||
x="-71.617508"
|
||||
y="94.071091"
|
||||
style="opacity:1;fill:none;fill-opacity:1;stroke:#8c8c8c;stroke-width:0.18826659;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
|
||||
</g>
|
||||
</svg>
|
After Width: | Height: | Size: 3.3 KiB |
BIN
tools/MessageModel/icons/item_vectorOfRealVec3.png
Normal file
BIN
tools/MessageModel/icons/item_vectorOfRealVec3.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 421 B |
124
tools/MessageModel/icons/item_vectorOfRealVec3.svg
Normal file
124
tools/MessageModel/icons/item_vectorOfRealVec3.svg
Normal file
@@ -0,0 +1,124 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!-- Created with Inkscape (http://www.inkscape.org/) -->
|
||||
|
||||
<svg
|
||||
xmlns:osb="http://www.openswatchbook.org/uri/2009/osb"
|
||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||
xmlns:cc="http://creativecommons.org/ns#"
|
||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:svg="http://www.w3.org/2000/svg"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
width="20"
|
||||
height="20"
|
||||
viewBox="0 0 5.2916664 5.2916666"
|
||||
version="1.1"
|
||||
id="svg8"
|
||||
inkscape:version="0.92.2 (5c3e80d, 2017-08-06)"
|
||||
sodipodi:docname="item_vectorOfRealVec3.svg"
|
||||
inkscape:export-filename="D:\OCCT\master_CR29451_1\tools\MessageModel\icons\item_vectorOfRealVec3.png"
|
||||
inkscape:export-xdpi="96"
|
||||
inkscape:export-ydpi="96">
|
||||
<defs
|
||||
id="defs2">
|
||||
<linearGradient
|
||||
id="linearGradient4578"
|
||||
osb:paint="solid">
|
||||
<stop
|
||||
style="stop-color:#000000;stop-opacity:1;"
|
||||
offset="0"
|
||||
id="stop4576" />
|
||||
</linearGradient>
|
||||
<inkscape:perspective
|
||||
sodipodi:type="inkscape:persp3d"
|
||||
inkscape:vp_x="-2.6544163 : -0.28690906 : 1"
|
||||
inkscape:vp_y="0 : 1028.295 : 0"
|
||||
inkscape:vp_z="9.504499 : -1.1228559 : 1"
|
||||
inkscape:persp3d-origin="2.7661607 : -1.3768436 : 1"
|
||||
id="perspective3711" />
|
||||
</defs>
|
||||
<sodipodi:namedview
|
||||
id="base"
|
||||
pagecolor="#ffffff"
|
||||
bordercolor="#666666"
|
||||
borderopacity="1.0"
|
||||
inkscape:pageopacity="0.0"
|
||||
inkscape:pageshadow="2"
|
||||
inkscape:zoom="15.839192"
|
||||
inkscape:cx="-10.548151"
|
||||
inkscape:cy="10.279721"
|
||||
inkscape:document-units="px"
|
||||
inkscape:current-layer="layer1"
|
||||
showgrid="false"
|
||||
fit-margin-top="0"
|
||||
fit-margin-left="0"
|
||||
fit-margin-right="0"
|
||||
fit-margin-bottom="0"
|
||||
inkscape:window-width="1446"
|
||||
inkscape:window-height="838"
|
||||
inkscape:window-x="1733"
|
||||
inkscape:window-y="67"
|
||||
inkscape:window-maximized="0"
|
||||
units="px" />
|
||||
<metadata
|
||||
id="metadata5">
|
||||
<rdf:RDF>
|
||||
<cc:Work
|
||||
rdf:about="">
|
||||
<dc:format>image/svg+xml</dc:format>
|
||||
<dc:type
|
||||
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
||||
<dc:title></dc:title>
|
||||
</cc:Work>
|
||||
</rdf:RDF>
|
||||
</metadata>
|
||||
<g
|
||||
inkscape:label="Layer 1"
|
||||
inkscape:groupmode="layer"
|
||||
id="layer1"
|
||||
transform="translate(71.966667,-93.642022)">
|
||||
<rect
|
||||
id="rect3769"
|
||||
width="4.660512"
|
||||
height="4.443356"
|
||||
x="-71.632576"
|
||||
y="94.056023"
|
||||
style="opacity:1;fill:none;fill-opacity:1;stroke:#8c8c8c;stroke-width:0.26458332;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
|
||||
<rect
|
||||
id="rect3769-3"
|
||||
width="4.7041783"
|
||||
height="2.2966287"
|
||||
x="-71.676239"
|
||||
y="96.202751"
|
||||
style="opacity:1;fill:none;fill-opacity:1;stroke:#8c8c8c;stroke-width:0.19110738;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
|
||||
<rect
|
||||
id="rect3769-9"
|
||||
width="2.3560426"
|
||||
height="4.4502382"
|
||||
x="-71.617508"
|
||||
y="94.071091"
|
||||
style="opacity:1;fill:none;fill-opacity:1;stroke:#8c8c8c;stroke-width:0.18826659;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
|
||||
<rect
|
||||
id="rect3769-9-6"
|
||||
width="0.78304976"
|
||||
height="2.0045512"
|
||||
x="-71.618477"
|
||||
y="94.141006"
|
||||
style="opacity:1;fill:#dc8c8c;fill-opacity:1;stroke:#8c8c8c;stroke-width:0.07284392;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
|
||||
<rect
|
||||
id="rect3769-9-6-0"
|
||||
width="0.78304976"
|
||||
height="2.0045512"
|
||||
x="-70.835426"
|
||||
y="94.141006"
|
||||
style="opacity:1;fill:#8cdc8c;fill-opacity:1;stroke:#8c8c8c;stroke-width:0.07284392;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
|
||||
<rect
|
||||
id="rect3769-9-6-5"
|
||||
width="0.78304976"
|
||||
height="2.0045512"
|
||||
x="-70.052376"
|
||||
y="94.141006"
|
||||
style="opacity:1;fill:#8c8cdc;fill-opacity:1;stroke:#8c8c8c;stroke-width:0.07284392;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
|
||||
</g>
|
||||
</svg>
|
After Width: | Height: | Size: 4.1 KiB |
Reference in New Issue
Block a user