1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-04 13:13:25 +03:00

0031362: Inspectors - MessageView plugin for message alerts

- append new MessageView plugin to display content of Message_Report;

- correct DumpJson of TDataStd array attributes to print Lower/Upper values;
- correct remove level of Message_Report to store stop time during removing all levels;
- append DumpJson for TFunction, TPrsStd attributes;
- correct DumpJson of XCAFDoc tools due to simplify performance of it;
- move AttributeInfo functionality from XDEDRAW into a static public method of XCAFDoc to call it outside;
- remove obsolete pane classes in DFBrowser plugin, now we may use DumpJSon panel to visualize this content of attributes;
- add new property panel in DFBrowser (synchronized with the same in other plugins);
- add button to switch ON DumpJson in DFBrowser(OFF by default, for better performance), also there is a context menu item in tree view;
- rename in DFBrowser "Property Panel" into "Property Panel (custom)";
- implement ViewControl_ColorSeletor and setting color in TreeModel_ItemProperties. Use only for light in VInspector now;
- implement setting false for all created AIS_Shape presentation to don't modify source TopoDS_Shape;
- remove not use VInspector_CallBack. It's possible using Message_Report/MessageView to track commands way;
- remove History panel in VInspector as not used, MessageView will be better solution for this;
- implement item and actions in VInspector for setting Lights in the view.
This commit is contained in:
nds
2021-04-26 18:01:38 +03:00
committed by bugmaster
parent 9a5bfc1c07
commit d16ecfe28e
239 changed files with 6001 additions and 8009 deletions

View File

@@ -18,6 +18,7 @@
#include <inspector/DFBrowser_ItemRole.hxx>
#include <inspector/DFBrowser_Module.hxx>
#include <inspector/DFBrowser_Tools.hxx>
#include <inspector/DFBrowser_Window.hxx>
#include <inspector/DFBrowserPane_AttributePane.hxx>
#include <inspector/DFBrowserPane_ItemRole.hxx>
@@ -31,8 +32,6 @@
#include <QObject>
#include <Standard_WarningsRestore.hxx>
//#define USE_DUMPJSON
// =======================================================================
// function : hasAttribute
// purpose :
@@ -158,13 +157,14 @@ void DFBrowser_Item::initStream (Standard_OStream& theOStream) const
if (!HasAttribute())
return;
#ifdef USE_DUMPJSON
Handle(TDF_Attribute) anAttribute = GetAttribute();
if (!anAttribute.IsNull())
anAttribute->DumpJson (theOStream);
#else
(void)theOStream;
#endif
if (DFBrowser_Window::IsUseDumpJson())
{
Handle(TDF_Attribute) anAttribute = GetAttribute();
if (!anAttribute.IsNull())
{
anAttribute->DumpJson (theOStream);
}
}
}
// =======================================================================

View File

@@ -27,10 +27,8 @@
#include <inspector/DFBrowserPane_ItemRole.hxx>
#include <inspector/DFBrowserPane_Tools.hxx>
#include <inspector/DFBrowserPaneXDE_AttributePaneCreator.hxx>
#include <inspector/DFBrowserPaneXDE_Tools.hxx>
#include <XCAFApp_Application.hxx>
#include <XCAFDoc.hxx>
#include <Standard_WarningsDisable.hxx>
#include <QItemSelectionModel>
@@ -68,8 +66,6 @@ void DFBrowser_Module::SetApplication (const Handle(TDocStd_Application)& theApp
myPaneCreators.clear();
RegisterPaneCreator (new DFBrowserPane_AttributePaneCreator());
if (!theApplication.IsNull() && DFBrowserPaneXDE_Tools::IsXDEApplication (theApplication))
RegisterPaneCreator (new DFBrowserPaneXDE_AttributePaneCreator (myPaneCreators[0]));
}
// =======================================================================
@@ -185,8 +181,17 @@ QVariant DFBrowser_Module::GetAttributeInfo (Handle(TDF_Attribute) theAttribute,
anAttributePane = dynamic_cast<DFBrowserPane_AttributePane*> (anAPIPane);
}
TCollection_AsciiString anInfo;
if (theRole == DFBrowser_ItemRole_AdditionalInfo)
{
anInfo = XCAFDoc::AttributeInfo (theAttribute);
}
QVariant aValue;
if (anAttributePane)
if (!anInfo.IsEmpty())
{
aValue = anInfo.ToCString();
}
else if (anAttributePane)
aValue = anAttributePane->GetAttributeInfo (theAttribute,
theRole == DFBrowser_ItemRole_AdditionalInfo ? DFBrowserPane_ItemRole_ShortInfo : theRole,
theColumnId);

View File

@@ -126,7 +126,7 @@ QVariant DFBrowser_TreeLevelViewModel::data (const QModelIndex& theIndex, int th
Qt::ItemFlags DFBrowser_TreeLevelViewModel::flags (const QModelIndex& theIndex) const
{
if (!theIndex.isValid())
return 0;
return Qt::NoItemFlags;
Qt::ItemFlags aFlags = Qt::ItemIsEnabled | Qt::ItemIsSelectable;
return aFlags;

View File

@@ -49,7 +49,7 @@ DFBrowser_TreeModel::DFBrowser_TreeModel (QObject* theParent)
// =======================================================================
void DFBrowser_TreeModel::InitColumns()
{
SetHeaderItem (0, TreeModel_HeaderSection ("Name"));
setHeaderItem (0, TreeModel_HeaderSection ("Name"));
}
// =======================================================================

View File

@@ -51,7 +51,7 @@
#include <OSD_Directory.hxx>
#include <OSD_Environment.hxx>
#include <OSD_Protection.hxx>
#include <OSD_Thread.hxx>
#include <inspector/View_Displayer.hxx>
#include <inspector/View_ToolBar.hxx>
#include <inspector/View_Viewer.hxx>
@@ -62,7 +62,6 @@
#include <inspector/ViewControl_Tools.hxx>
#include <Standard_WarningsDisable.hxx>
#include <Standard_ThreadId.hxx>
#include <QAction>
#include <QApplication>
#include <QComboBox>
@@ -72,6 +71,7 @@
#include <QList>
#include <QMainWindow>
#include <QItemSelectionModel>
#include <QPushButton>
#include <QTabWidget>
#include <QToolBar>
#include <QTreeView>
@@ -99,7 +99,7 @@ const int DFBROWSER_DEFAULT_POSITION_Y = 60;
const int DEFAULT_PROPERTY_PANEL_HEIGHT = 200;
const int DEFAULT_BROWSER_HEIGHT = 800;
//#define USE_DUMPJSON
static Standard_Boolean MyIsUseDumpJson = Standard_False;
// =======================================================================
// function : Constructor
@@ -160,23 +160,30 @@ DFBrowser_Window::DFBrowser_Window()
connect (aLevelView, SIGNAL (indexDoubleClicked (const QModelIndex&)),
this, SLOT (onLevelDoubleClicked (const QModelIndex&)));
// property widget
QDockWidget* aPropertyPanelWidget = new QDockWidget (tr ("PropertyPanel"), myMainWindow);
// property custom panel with specific parameters of attributes
QDockWidget* aPropertyPanelWidget = new QDockWidget (tr ("PropertyPanel (custom)"), myMainWindow);
aPropertyPanelWidget->setObjectName (aPropertyPanelWidget->windowTitle());
aPropertyPanelWidget->setTitleBarWidget (new QWidget(myMainWindow));
aPropertyPanelWidget->setWidget (myPropertyPanel->GetControl());
myMainWindow->addDockWidget (Qt::RightDockWidgetArea, aPropertyPanelWidget);
// property view
#ifdef USE_DUMPJSON
myPropertyPanelWidget = new QDockWidget (tr ("PropertyPanel (DumpJson)"), myMainWindow);
// property panel
myUseDumpJson = new QWidget(myMainWindow);
QVBoxLayout* aLay = new QVBoxLayout(myUseDumpJson);
QPushButton* aUseDumpJson = new QPushButton ("Use DumpJson", myMainWindow);
aLay->addWidget (aUseDumpJson);
aLay->addStretch(1);
connect(aUseDumpJson, SIGNAL (clicked (bool)), this, SLOT (onUseDumpJson()));
myUseDumpJson->setVisible (false);
myPropertyPanelWidget = new QDockWidget (tr ("PropertyPanel"), myMainWindow);
myPropertyView = new ViewControl_PropertyView (myMainWindow,
QSize(DFBROWSER_DEFAULT_VIEW_WIDTH, DFBROWSER_DEFAULT_VIEW_HEIGHT));
myPropertyPanelWidget->setObjectName (myPropertyPanelWidget->windowTitle());
myPropertyPanelWidget->setTitleBarWidget (new QWidget(myMainWindow));
myPropertyPanelWidget->setWidget (myPropertyView->GetControl());
updatePropertyPanelWidget();
myMainWindow->addDockWidget (Qt::RightDockWidgetArea, myPropertyPanelWidget);
#endif
// dump view window
QWidget* aDumpWidget = new QWidget(myMainWindow);
@@ -204,14 +211,10 @@ DFBrowser_Window::DFBrowser_Window()
myViewWindow->Displayer()->SetAttributeColor (Quantity_Color(aHColor.red() / 255., aHColor.green() / 255.,
aHColor.blue() / 255., Quantity_TOC_sRGB), View_PresentationType_Additional);
myMainWindow->splitDockWidget (aPropertyPanelWidget, aViewDockWidget, Qt::Vertical);
myMainWindow->splitDockWidget (myPropertyPanelWidget, aViewDockWidget, Qt::Vertical);
myMainWindow->tabifyDockWidget (myPropertyPanelWidget, aPropertyPanelWidget);
#ifdef USE_DUMPJSON
myMainWindow->tabifyDockWidget (aDumpDockWidget, myPropertyPanelWidget);
myMainWindow->tabifyDockWidget (myPropertyPanelWidget, aViewDockWidget);
#else
myMainWindow->tabifyDockWidget (aDumpDockWidget, aViewDockWidget);
#endif
myTreeView->resize (DFBROWSER_DEFAULT_TREE_VIEW_WIDTH, DFBROWSER_DEFAULT_TREE_VIEW_HEIGHT);
@@ -641,6 +644,24 @@ TCollection_AsciiString DFBrowser_Window::TmpDirectory()
return aTmpDir;
}
// =======================================================================
// function : SetUseDumpJson
// purpose :
// =======================================================================
void DFBrowser_Window::SetUseDumpJson (const Standard_Boolean theValue)
{
MyIsUseDumpJson = theValue;
}
// =======================================================================
// function : IsUseDumpJson
// purpose :
// =======================================================================
Standard_Boolean DFBrowser_Window::IsUseDumpJson()
{
return MyIsUseDumpJson;
}
// =======================================================================
// function : onTreeViewContextMenuRequested
// purpose :
@@ -652,6 +673,12 @@ void DFBrowser_Window::onTreeViewContextMenuRequested (const QPoint& thePosition
aMenu->addAction (ViewControl_Tools::CreateAction (tr ("Expand All"), SLOT (onExpandAll()), GetMainWindow(), this));
aMenu->addAction (ViewControl_Tools::CreateAction (tr ("Collapse All"), SLOT (onCollapseAll()), GetMainWindow(), this));
aMenu->addSeparator();
QAction* aUseDumpJsonAction = ViewControl_Tools::CreateAction (tr ("Use DumpJson"), SLOT (onUseDumpJson()), GetMainWindow(), this);
aUseDumpJsonAction->setCheckable(true);
aUseDumpJsonAction->setChecked (IsUseDumpJson());
aMenu->addAction (aUseDumpJsonAction);
QPoint aPoint = myTreeView->mapToGlobal (thePosition);
aMenu->exec (aPoint);
}
@@ -706,6 +733,20 @@ void DFBrowser_Window::onCollapseAll()
}
}
// =======================================================================
// function : onUseDumpJson
// purpose :
// =======================================================================
void DFBrowser_Window::onUseDumpJson()
{
SetUseDumpJson(!IsUseDumpJson());
updatePropertyPanelWidget();
QApplication::setOverrideCursor (Qt::WaitCursor);
myModule->UpdateTreeModel();
QApplication::restoreOverrideCursor();
}
// =======================================================================
// function : onTreeViewSelectionChanged
// purpose :
@@ -716,10 +757,10 @@ void DFBrowser_Window::onTreeViewSelectionChanged (const QItemSelection& theSele
if (!myModule)
return;
#ifdef USE_DUMPJSON
if (myPropertyPanelWidget->toggleViewAction()->isChecked())
myPropertyView->Init (ViewControl_Tools::CreateTableModelValues (myTreeView->selectionModel()));
#endif
if (IsUseDumpJson() && myPropertyPanelWidget->toggleViewAction()->isChecked())
{
myPropertyView->Init (ViewControl_Tools::CreateTableModelValues (myTreeView->selectionModel()));
}
// previuos selection should be cleared in the panel selectors
DFBrowser_AttributePaneStack* anAttributePaneStack = myPropertyPanel->GetAttributesStack();
@@ -1004,3 +1045,15 @@ void DFBrowser_Window::findPresentations (const QModelIndexList& theIndices, AIS
thePresentations.Append (aPresentation);
}
}
// =======================================================================
// function : updatePropertyPanelWidget
// purpose :
// =======================================================================
void DFBrowser_Window::updatePropertyPanelWidget()
{
bool aUseDumpJson = IsUseDumpJson();
myUseDumpJson->setVisible (!aUseDumpJson);
myPropertyPanelWidget->setWidget (aUseDumpJson ? myPropertyView->GetControl() : myUseDumpJson);
}

View File

@@ -118,6 +118,12 @@ public:
//! \return string value
Standard_EXPORT static TCollection_AsciiString TmpDirectory();
//! Sets whether DumpJson is used when the tree view is generated
Standard_EXPORT static void SetUseDumpJson(const Standard_Boolean theValue);
//! Returns whether DumpJson is used when the tree view is generated
Standard_EXPORT static Standard_Boolean IsUseDumpJson();
private slots:
//! Cleans history in tree level line, clears cache of thread processing, starts threads for application
@@ -136,6 +142,9 @@ private slots:
//! Collapses all levels for all selected items
void onCollapseAll();
//! Setting flag whether DumpJSon should be applied to build tree model items structure
void onUseDumpJson();
//! Updates all controls by changed selection in OCAF tree view
//! \param theSelected list of selected tree view items
//! \param theDeselected list of deselected tree view items
@@ -208,6 +217,9 @@ protected:
//! \return container of presentations or NULL
void findPresentations (const QModelIndexList& theIndices, AIS_ListOfInteractive& thePresentations);
//! Updates content of Property Panel dock widget. It contains button to activate DumpJson or view with content of it.
void updatePropertyPanelWidget();
private:
DFBrowser_Module* myModule; //!< current module
@@ -216,6 +228,7 @@ private:
DFBrowser_TreeLevelLine* myTreeLevelLine; //!< navigate line of tree levels to the selected item
QTreeView* myTreeView; //!< OCAF tree view
QDockWidget* myPropertyPanelWidget; //!< property pane dockable widget
QWidget* myUseDumpJson; //!< button to activate/deactivate using of DumpJson
DFBrowser_PropertyPanel* myPropertyPanel; //!< property panel shows full information about attribute or search view
ViewControl_PropertyView* myPropertyView; //!< property control to display model item values if exist
View_Window* myViewWindow; //!< V3d view to visualize presentations/references if it can be build for a selected item