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/FITK_Component/FITKRenderWindowVTK/FITKGraph3DWindowVTK.h

561 lines
18 KiB
C

/**
*
* @file FITKGraph3DWindow.h
* @brief
* @author BaGuijun (baguijun@163.com)
* @date 2024-03-14
*
*/
#ifndef _FITKGraph3D_H_VTK_
#define _FITKGraph3D_H_VTK_
#include "FITKRenderWindowVTKAPI.h"
#include "FITKGraph3DWindowInterface.h"
#include "FITK_Kernel/FITKCore/FITKAbstractGraphWidget.h"
#include <QWidget>
#include <QMutex>
#include <QVariant>
class vtkRenderWindow;
class vtkCamera;
class vtkRenderWindowInteractor;
class vtkOrientationMarkerWidget;
class vtkActor;
class vtkRenderer;
class QGridLayout;
class QToolBar;
class FITKLegendScaleActor;
namespace Ui
{
class FITKGraph3DWindowVTK;
}
namespace Comp
{
class FITKGraphRender;
class FITKGraphObjectVTK;
class FITKGraphInteractionStyle;
class FITKBoundaryActor;
class Graph3DWindowInitializer;
/**
* @brief toolbar
* @author BaGuijun (baguijun@163.com)
* @date 2024-06-05
*/
enum class FITKGraphWinToolBarPos
{
FITKLeftTop = 1, ///1左侧顶部
FITKLeftCenter, ///2左侧中部
FITKLeftBottom, ///3左侧底部
FITKBottomCenter, ///4底部中间
FITKRightBottom, ///5右侧底部
FITKRightCenter, ///6右侧中部
FITKRightTop, ///7右侧顶部
FITKTopCenter, ///8顶部中间
};
/**
* @brief
* @author BaGuijun (baguijun@163.com)
* @date 2024-03-14
*/
class FITKRenderWindowVTKAPI FITKGraph3DWindowVTK
: public Core::FITKAbstractGraph3DWidget
{
Q_OBJECT;
public:
/**
* @brief Construct a new FITKGraph3DWindow object
* @param[i] info
* @param[i] gInterface
* @author BaGuijun (baguijun@163.com)
* @date 2024-03-18
*/
FITKGraph3DWindowVTK(Graph3DWindowInitializer * initializer);
/**
* @brief Destroy the FITKGraph3DWindow object
* @author BaGuijun (baguijun@163.com)
* @date 2024-03-14
*/
virtual ~FITKGraph3DWindowVTK();
/**
* @brief
* @author BaGuijun (baguijun@163.com)
* @date 2024-03-14
*/
void reRender();
/**
* @brief
* @param[i] state turefalse
* @author BaGuijun (baguijun@163.com)
* @date 2024-03-14
*/
void setAxesEnable(bool state);
/**
* @brief
* @param[i] focalPoint
* @param[i] viewUp
* @param[i] position
* @author BaGuijun (baguijun@163.com)
* @date 2024-03-14
*/
void setView(double* focalPoint, double* viewUp, double* position) override;
/**
* @brief
* @param[o] pos
* @param[o] focual
* @param[o] viewup
* @return true
* @return false
* @author BaGuijun (baguijun@163.com)
* @date 2024-04-08
*/
bool getView(double* pos, double* focual, double* viewup) override;
/**
* @brief
* @param[i] index
* @param[i] object
* @param[i] fitview ()
* @author BaGuijun (baguijun@163.com)
* @date 2024-03-18
*/
void addObject(int index, FITKGraphObjectVTK* object, bool fitview = true);
/**
* @brief
* @author BaGuijun (baguijun@163.com)
* @date 2024-03-28
*/
void clear() override;
/**
* @brief
* @param[i] topValue
* @param[i] bottomValue
* @author BaGuijun (baguijun@163.com)
* @date 2024-03-14
*/
void setBackground(double topValue[3],double bottomValue[3]);
/**
* @brief
* @author BaGuijun (baguijun@163.com)
* @date 2024-03-14
*/
void fitView() override;
/**
* @brief
* @author LiBaojun (libaojunqd@foxmail.com)
* @date 2024-04-17
*/
virtual void flush() override;
/**
* @brief
* @param[i] rgb1
* @param[i] rgb2
* @author libaojun (libaojunqd@foxmail.com)
* @date 2024-05-08
*/
virtual void setBackgroundColor(float* rgb1, float* rgb2 =nullptr) override;
/**
* @brief
* @param[o] rgb1
* @param[o] rgb2
* @author BaGuijun (baguijun@163.com)
* @date 2024-03-14
*/
virtual void getBackgroundColor(float* rgb1, float* rgb2 = nullptr) override;
/**
* @brief
* @param[i] index
* @return FITKGraphRender*
* @author BaGuijun (baguijun@163.com)
* @date 2024-03-19
*/
FITKGraphRender* getRenderer(int index);
/**
* @brief
* @return int
* @author libaojun (libaojunqd@foxmail.com)
* @date 2024-04-17
*/
int getRenderCount();
/**
* @brief vtk
* @return int
* @author libaojun (libaojunqd@foxmail.com)
* @date 2024-04-17
*/
vtkRenderWindow* getVTKRenderWindow();
/**
* @brief
* @return
* @author ChengHaotian (yeguangbaozi@foxmail.com)
* @date 2024-05-17
*/
vtkCamera* getVTKCamera();
/**
* @brief
* @return -1[]
* @author ChengHaotian (yeguangbaozi@foxmail.com)
* @date 2024-05-17
*/
vtkRenderer* getVTKRenderer(int index = -1);
/**
* @brief
* @param[i] enable
* @author BaGuijun (baguijun@163.com)
* @date 2024-04-08
*/
virtual void setParallelProjection(bool on = true) override;
/**
* @brief
* @param[i] FITKAbstractGraphObject
* @author libaojun (libaojunqd@foxmail.com)
* @date 2024-04-11
*/
void removeGraphObj(Core::FITKAbstractGraphObject* gobj) override;
/**
* @brief
* @return int
* @author libaojun (libaojunqd@foxmail.com)
* @date 2024-04-26
*/
int getGraphObjCount();
/**
* @brief
* @param[o] center[3]
* @return bool
* @author libaojun (libaojunqd@foxmail.com)
* @date 2024-04-26
*/
bool getGraphObjCenter(double* center);
/**
* @brief []
* @param info
* @author ChengHaotian (yeguangbaozi@foxmail.com)
* @date 2024-05-11
*/
template<class T>
void setUserInformation(T info)
{
m_userInfo = QVariant::fromValue(info);
}
/**
* @brief []
* @return
* @author ChengHaotian (yeguangbaozi@foxmail.com)
* @date 2024-05-11
*/
template<class T>
T getUserInformationAs()
{
return m_userInfo.value<T>();
}
/**
* @brief
* @param info
* @author ChengHaotian (yeguangbaozi@foxmail.com)
* @date 2024-05-11
*/
void setUserInformation(QVariant info);
/**
* @brief
* @return
* @author ChengHaotian (yeguangbaozi@foxmail.com)
* @date 2024-05-11
*/
QVariant getUserInformation();
/**
* @brief
* @param[i] image
* @param[i] w
* @param[i] h
* @author BaGuijun (baguijun@163.com)
* @date 2024-05-28
*/
virtual void saveImage(const QString& image, int w = -1, int h = -1)override;
/**
* @brief /
* @param visibility
* @author ChengHaotian (yeguangbaozi@foxmail.com)
* @date 2024-05-29
*/
void showScaleLegend(bool visibility);
/**
* @brief action
* @param[i] actions action
* @param[i] beforeActions action
* @author BaGuijun (baguijun@163.com)
* @date 2024-06-04
*/
void addActionsToolBar(QList<QAction*> actions, QAction* beforeAction = nullptr);
/**
* @brief
* @param[i] pos
* 1 2 3 4 5 6 7 8
* @author BaGuijun (baguijun@163.com)
* @date 2024-06-04
*/
void setToolBarPos(FITKGraphWinToolBarPos pos);
/**
* @brief ()
*
* @param[i] iconPath
* @author BaGuijun (baguijun@163.com)
* @date 2024-06-05
*/
void initRenderIcon(const QPixmap& image, FITKGraphWinToolBarPos pos = FITKGraphWinToolBarPos::FITKRightTop);
/**
* @brief actions
* @return QList<QAction*> actio
* @author BaGuijun (baguijun@163.com)
* @date 2024-06-13
*/
QList<QAction*> getActions();
/**
* @brief action
* @param[i] isShow
* @author BaGuijun (baguijun@163.com)
* @date 2024-06-13
*/
void setIsShowActions(bool isShow);
public slots:
;
/**
* @brief
* @author BaGuijun (baguijun@163.com)
* @date 2024-06-13
*/
virtual void slotActionViewFrontEvent();
/**
* @brief
* @author BaGuijun (baguijun@163.com)
* @date 2024-06-13
*/
virtual void slotActionViewBackEvent();
/**
* @brief
* @author BaGuijun (baguijun@163.com)
* @date 2024-06-13
*/
virtual void slotActionViewTopEvent();
/**
* @brief
* @author BaGuijun (baguijun@163.com)
* @date 2024-06-13
*/
virtual void slotActionViewBottomEvent();
/**
* @brief
* @author BaGuijun (baguijun@163.com)
* @date 2024-06-13
*/
virtual void slotActionViewLeftEvent();
/**
* @brief
* @author BaGuijun (baguijun@163.com)
* @date 2024-06-13
*/
virtual void slotActionViewRightEvent();
/**
* @brief
* @author BaGuijun (baguijun@163.com)
* @date 2024-06-13
*/
virtual void slotActionViewIsoEvent();
/**
* @brief
* @author BaGuijun (baguijun@163.com)
* @date 2024-06-13
*/
virtual void slotActionViewPanEvent();
/**
* @brief
* @author BaGuijun (baguijun@163.com)
* @date 2024-06-13
*/
virtual void slotActionSaveImageEvent();
/**
* @brief
* @author BaGuijun (baguijun@163.com)
* @date 2024-06-13
*/
virtual void slotActionViewParallelEvent();
/**
* @brief
* @author BaGuijun (baguijun@163.com)
* @date 2024-06-13
*/
virtual void slotActionViewPerspectiveEvent();
protected:
/**
* @brief
* @author BaGuijun (baguijun@163.com)
* @date 2024-03-14
*/
virtual void init();
/**
* @brief action
* @author BaGuijun (baguijun@163.com)
* @date 2024-03-14
*/
virtual void initActions();
/**
* @brief
* @param[i] style
* @author BaGuijun (baguijun@163.com)
* @date 2024-03-18
*/
void setInteractionStyle(FITKGraphInteractionStyle* style);
/**
* @brief
* @param event
* @author ChengHaotian (yeguangbaozi@foxmail.com)
* @date 2024-05-28
*/
virtual void showEvent(QShowEvent* event) override;
/**
* @brief
* @author ChengHaotian (yeguangbaozi@foxmail.com)
* @date 2024-07-11
*/
void updateBoundray();
protected:
/**
* @brief
* @author BaGuijun (baguijun@163.com)
* @date 2024-03-18
*/
Graph3DWindowInitializer* _initializer{};
/**
* @brief
* @author BaGuijun (baguijun@163.com)
* @date 2024-03-11
*/
Ui::FITKGraph3DWindowVTK* m_ui = nullptr;
/**
* @brief VTK
* @author BaGuijun (baguijun@163.com)
* @date 2024-03-11
*/
QWidget* m_vtkWidget = nullptr;
/**
* @brief
* @author ChengHaotian (yeguangbaozi@foxmail.com)
* @date 2024-05-28
*/
FITKLegendScaleActor* m_legendScaleActor{ nullptr };
/**
* @brief
* @author BaGuijun (baguijun@163.com)
* @date 2024-03-11
*/
vtkRenderWindowInteractor* m_interactor = nullptr;
/**
* @brief
* @author BaGuijun (baguijun@163.com)
* @date 2024-03-11
*/
//#if VTK_MAJOR_VERSION >= 8
vtkRenderWindow* m_renderWindow = nullptr;
//#else
// vtkGenericOpenGLRenderWindow* m_renderWindow = nullptr;
//#endif
/**
* @brief
* @author BaGuijun (baguijun@163.com)
* @date 2024-03-11
*/
vtkCamera* m_camera = nullptr;
/**
* @brief
* @author BaGuijun (baguijun@163.com)
* @date 2024-03-11
*/
vtkOrientationMarkerWidget* m_axesWidget = nullptr;
/**
* @brief
* @author BaGuijun (baguijun@163.com)
* @date 2024-03-11
*/
QHash<int, FITKGraphRender*> m_renders = {};
/**
* @brief
* @author BaGuijun (baguijun@163.com)
* @date 2024-03-18
*/
FITKGraphInteractionStyle* m_interactionStyle = nullptr;
/**
* @brief
* @author BaGuijun (baguijun@163.com)
* @date 2024-03-18
*/
FITKBoundaryActor* m_actorBound = nullptr;
/**
* @brief
* @author ChengHaotian (yeguangbaozi@foxmail.com)
* @date 2024-05-11
*/
QVariant m_userInfo;
/**
* @brief VTKshowEvent
* @author ChengHaotian (yeguangbaozi@foxmail.com)
* @date 2024-05-29
*/
bool m_initFlag = false;
/**
* @brief
* @author BaGuijun (baguijun@163.com)
* @date 2024-03-18
*/
QGridLayout* _renderToolBarLayout = nullptr;
/**
* @brief
* @author BaGuijun (baguijun@163.com)
* @date 2024-03-18
*/
QToolBar* _renderToolBar = nullptr;
/**
* @brief
* @author BaGuijun (baguijun@163.com)
* @date 2024-03-18
*/
QToolBar* _renderIconToolBar = nullptr;
/**
* @brief
* @author BaGuijun (baguijun@163.com)
* @date 2024-03-18
*/
FITKGraphWinToolBarPos _renderBarStyle = FITKGraphWinToolBarPos::FITKLeftTop;
private:
/**
* @brief
* @author BaGuijun (baguijun@163.com)
* @date 2024-06-06
*/
static QMutex _mutex;
};
}
#endif