You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
AppFlow/GUIFrame/RenderWidget.cpp

81 lines
2.8 KiB
C++

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

//#define OCCRENDERMODE
#include <QVariant>
#include <QStackedLayout>
#include <QPushButton>
#include "RenderWidget.h"
#include <QGroupBox>
#include <QGridLayout>
#include <QMdiSubWindow>
#include "FITK_Component/FITKWidget/FITKMdiArea.h"
#include "FITK_Kernel/FITKAppFramework/FITKAppFramework.h"
#include "FITK_Kernel/FITKAppFramework/FITKComponentFactory.h"
#include "FITK_Kernel/FITKAppFramework/FITKComponentInterface.h"
#include "FITK_Kernel/FITKAppFramework/FITKComponents.h"
#include "FITK_Component/FITKRenderWindowVTK/FITKGraph3DWindowInterface.h"
#include "FITK_Component/FITKRenderWindowVTK/FITKGraph3DWindowVTK.h"
//#include "FITK_Component/FITKRenderWindowOCC/FITKGraph3DWindowOCCInterface.h"
#include "FITK_Kernel/FITKCore/FITKOperatorRepo.h"
namespace GUI
{
RenderWidget::RenderWidget(MainWindow *mainWindow) : PanelWidgetBase(mainWindow)
{
this->setTitle(tr("Graphic Display"));
m_MdiArea = new Comp::FITKMdiArea(this);
// 如果当前没有FITK应用程序实例则不执行后续操作
if (!FITKAPP)
return;
#ifdef OCCRENDERMODE
// 尝试获取名为"Graph3DWindow"的三维渲染组件
AppFrame::FITKComponentInterface *graph3DCompBase =
FITKAPP->getComponents()->getComponentByName("Graph3DWindowOCC");
auto graph3DComp = dynamic_cast<Render::FITKGraph3DWindowOCCInterface *>(graph3DCompBase);
// 如果获取失败,则不执行后续操作
if (nullptr == graph3DComp)
return;
// 获取三维渲染组件的界面并将其作为一个子窗口添加到MDI区域
QWidget *graph3DWidget = graph3DComp->getWidget(1);
auto id = m_MdiArea->addSubWidget(graph3DWidget, "Graph3DWindowOCC");
#else
// 尝试获取名为"Graph3DWindow"的三维渲染组件
AppFrame::FITKComponentInterface *graph3DCompBase =
FITKAPP->getComponents()->getComponentByName("Graph3DWindowVTK");
auto graph3DComp = dynamic_cast<Comp::FITKGraph3DWindowInterface *>(graph3DCompBase);
// 如果获取失败,则不执行后续操作
if (nullptr == graph3DComp)
return;
// 获取三维渲染组件的界面并将其作为一个子窗口添加到MDI区域
QWidget *graph3DWidget = graph3DComp->getWidget(1);
Comp::FITKGraph3DWindowVTK* graph3DVTKWidget = dynamic_cast<Comp::FITKGraph3DWindowVTK*>(graph3DWidget);
if (graph3DVTKWidget != nullptr) {
graph3DVTKWidget->setIsShowActions(true);
}
auto id = m_MdiArea->addSubWidget(graph3DWidget, "");
#endif // OCCRENDERMODE
this->setWidget(m_MdiArea);
m_MdiArea->setLayoutType(Comp::FITKVportsLayoutType::CurrentMax);
// 最大化显示
/*auto currentSubWidget = m_MdiArea->getSubWidget(id);
if (currentSubWidget != nullptr)
{
currentSubWidget->showMaximized();
}*/
}
Comp::FITKMdiArea * RenderWidget::getMdiArea() const
{
return m_MdiArea;
}
}