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/GUIWidget/PickedData.h

481 lines
14 KiB
C

/*****************************************************************//**
* @file PickedData.h
* @brief
*
* @author ChengHaotian (yeguangbaozi@foxmail.com)
* @date 2024-07-19
*********************************************************************/
#ifndef __PICKEDDATA_H__
#define __PICKEDDATA_H__
#include <QObject>
#include "GUIWidgetAPI.h"
#include "GUIPickInfo.h"
#include "FITK_Interface/FITKInterfaceModel/FITKModelEnum.h"
#include <QHash>
// 前置声明
class vtkActor;
class vtkActor2D;
class vtkPlanes;
class vtkUnstructuredGrid;
namespace Exchange
{
class FITKFluidVTKGraphObject3D;
}
namespace GraphData
{
/**
* @brief
* @author ChengHaotian (yeguangbaozi@foxmail.com)
* @date 2024-04-18
*/
enum PickedDataType
{
OtherPick = -1,
// 模型。
ModelVertPick = 0,
ModelEdgePick,
ModelFacePick,
ModelSolidPick,
// 网格。
MeshNodePick,
MeshElementPick
};
/**
* @brief
* @author ChengHaotian (yeguangbaozi@foxmail.com)
* @date 2024-07-19
*/
enum PickedMouseType
{
PickedNoneType = -1,
PickedMouseClick = 0,
PickedMouseRubber
};
/**
* @brief
* @author ChengHaotian (yeguangbaozi@foxmail.com)
* @date 2024-07-19
*/
class GUIWIDGETAPI PickedData : public QObject
{
Q_OBJECT
public:
/**
* @brief
* @param pickedInfo
* @param pickedActor
* @param pickedIndex
* @param pickedWorldPos
* @param isPreview
* @author ChengHaotian (yeguangbaozi@foxmail.com)
* @date 2024-07-19
*/
PickedData(GUI::GUIPickInfoStru pickedInfo, vtkActor* pickedActor, int pickedIndex, double* pickedWorldPos, bool isPreview = false);
/**
* @brief
* @param pickedInfo
* @param pickedActor
* @param cutPlane
* @author ChengHaotian (yeguangbaozi@foxmail.com)
* @date 2024-07-19
*/
PickedData(GUI::GUIPickInfoStru pickedInfo, vtkActor* pickedActor, vtkPlanes* cutPlane);
/**
* @brief
* @param pickedInfo
* @param pickedActor
* @param isPreview
* @author ChengHaotian (yeguangbaozi@foxmail.com)
* @date 2024-07-19
*/
PickedData(GUI::GUIPickInfoStru pickedInfo, vtkActor2D* pickedActor, bool isPreview = false);
/**
* @brief
* @param pType
* @param dataObjectIdID
* @param indice[]
* @author ChengHaotian (yeguangbaozi@foxmail.com)
* @date 2024-07-23
*/
PickedData(Interface::FITKModelEnum::FITKModelSetType pType, int dataObjectId, QList<int> & indice);
/**
* @brief
* @author ChengHaotian (yeguangbaozi@foxmail.com)
* @date 2024-07-19
*/
~PickedData();
/**
* @brief 使
* @return
* @author ChengHaotian (yeguangbaozi@foxmail.com)
* @date 2024-07-19
*/
PickedData* getCopy();
/**
* @brief
* @author ChengHaotian (yeguangbaozi@foxmail.com)
* @date 2024-07-24
*/
void sortIds();
/**
* @brief
* @param data
* @return
* @author ChengHaotian (yeguangbaozi@foxmail.com)
* @date 2024-07-19
*/
bool isSameAs(PickedData* data);
/**
* @brief ID
* @author ChengHaotian (yeguangbaozi@foxmail.com)
* @date 2024-07-19
*/
void sort();
/**
* @brief
* @param data
* @author ChengHaotian (yeguangbaozi@foxmail.com)
* @date 2024-07-19
*/
void add(PickedData* data);
/**
* @brief
* @param data
* @author ChengHaotian (yeguangbaozi@foxmail.com)
* @date 2024-07-19
*/
void subtract(PickedData* data);
/**
* @brief
* @return
* @author ChengHaotian (yeguangbaozi@foxmail.com)
* @date 2024-07-19
*/
bool isValid();
/**
* @brief
* @return
* @author ChengHaotian (yeguangbaozi@foxmail.com)
* @date 2024-07-19
*/
bool isEmpty();
/**
* @brief
* @param actor
* @param index
* @return
* @author ChengHaotian (yeguangbaozi@foxmail.com)
* @date 2024-07-19
*/
bool contains(vtkActor* actor, int index);
/**
* @brief
* @param actor
* @return
* @author ChengHaotian (yeguangbaozi@foxmail.com)
* @date 2024-07-19
*/
bool contains(vtkActor2D* actor);
/**
* @brief
* @return
* @author ChengHaotian (yeguangbaozi@foxmail.com)
* @date 2024-07-19
*/
GUI::GUIPickInfoStru getPickedInfo();
/**
* @brief
* @return
* @author ChengHaotian (yeguangbaozi@foxmail.com)
* @date 2024-07-19
*/
vtkActor* getPickedActor();
/**
* @brief
* @return
* @author ChengHaotian (yeguangbaozi@foxmail.com)
* @date 2024-07-19
*/
int getPickedIndex();
/**
* @brief
* @return -1
* @author ChengHaotian (yeguangbaozi@foxmail.com)
* @date 2024-07-19
*/
PickedMouseType getPickedMouseType();
/**
* @brief
* @return
* @author ChengHaotian (yeguangbaozi@foxmail.com)
* @date 2024-07-19
*/
vtkPlanes* getCutPlane();
/**
* @brief VTK
* @param ugrid
* @author ChengHaotian (yeguangbaozi@foxmail.com)
* @date 2024-07-19
*/
void getDataSet(vtkUnstructuredGrid* ugrid);
/**
* @brief
* @param pos
* @author ChengHaotian (yeguangbaozi@foxmail.com)
* @date 2024-07-19
*/
void getPickedWorldPosition(double* pos);
/**
* @brief /
* @author ChengHaotian (yeguangbaozi@foxmail.com)
* @date 2024-07-19
*/
void highlight();
/**
* @brief
* @author ChengHaotian (yeguangbaozi@foxmail.com)
* @date 2024-07-19
*/
void clearHighlight();
/**
* @brief
* @author ChengHaotian (yeguangbaozi@foxmail.com)
* @date 2024-07-19
*/
void calculateFinsish();
/**
* @brief
* @return /
* @author ChengHaotian (yeguangbaozi@foxmail.com)
* @date 2024-07-19
*/
bool needToCalculate();
/**
* @brief
* @return
* @author ChengHaotian (yeguangbaozi@foxmail.com)
* @date 2024-07-23
*/
PickedDataType getPickedDataType();
/**
* @brief ID
* @return []
* @author ChengHaotian (yeguangbaozi@foxmail.com)
* @date 2024-07-23
*/
QList<int> & getPickedIds();
/**
* @brief ID
* @return ID
* @author ChengHaotian (yeguangbaozi@foxmail.com)
* @date 2024-07-23
*/
int getPickedDataObjId();
/**
* @brief
* @return
* @author ChengHaotian (yeguangbaozi@foxmail.com)
* @date 2024-07-23
*/
Exchange::FITKFluidVTKGraphObject3D* getPickedGraphObejct();
private:
/**
* @brief
* @author ChengHaotian (yeguangbaozi@foxmail.com)
* @date 2024-07-19
*/
PickedData();
/**
* @brief
* @author ChengHaotian (yeguangbaozi@foxmail.com)
* @date 2024-07-19
*/
void init();
/**
* @brief 2D
* @author ChengHaotian (yeguangbaozi@foxmail.com)
* @date 2024-07-19
*/
void init2D();
/**
* @brief
* @author ChengHaotian (yeguangbaozi@foxmail.com)
* @date 2024-07-23
*/
void initManual();
/**
* @brief
* @param obj
* @author ChengHaotian (yeguangbaozi@foxmail.com)
* @date 2024-07-23
*/
void setPickedGraphObject(Exchange::FITKFluidVTKGraphObject3D* obj);
// 获取数据方法。
//@{
//@}
private slots:
/**
* @brief
* @author ChengHaotian (yeguangbaozi@foxmail.com)
* @date 2024-07-23
*/
void slot_resetGraphObject();
private:
// 拾取时的信息。
//@{
/**
* @brief
* @author ChengHaotian (yeguangbaozi@foxmail.com)
* @date 2024-07-19
*/
GUI::GUIPickInfoStru m_pickedInfo;
/**
* @brief
* @author ChengHaotian (yeguangbaozi@foxmail.com)
* @date 2024-07-19
*/
vtkActor* m_pickedActor{ nullptr };
/**
* @brief 2D
* @author ChengHaotian (yeguangbaozi@foxmail.com)
* @date 2024-07-19
*/
vtkActor2D* m_pickedActor2D{ nullptr };
/**
* @brief VTK
* @author ChengHaotian (yeguangbaozi@foxmail.com)
* @date 2024-07-19
*/
int m_pickedIndex = -1;
/**
* @brief
* @author ChengHaotian (yeguangbaozi@foxmail.com)
* @date 2024-07-19
*/
PickedMouseType m_mouseOper = PickedMouseType::PickedNoneType;
/**
* @brief
* @author ChengHaotian (yeguangbaozi@foxmail.com)
* @date 2024-07-19
*/
double m_pickedWorldPos[3]{ 0, 0, 0 };
/**
* @brief
* @author ChengHaotian (yeguangbaozi@foxmail.com)
* @date 2024-07-19
*/
vtkPlanes* m_cutPlane{ nullptr };
/**
* @brief
* @author ChengHaotian (yeguangbaozi@foxmail.com)
* @date 2024-07-19
*/
bool m_needToCal = false;
/**
* @brief
* @author ChengHaotian (yeguangbaozi@foxmail.com)
* @date 2024-07-19
*/
bool m_isValid = false;
/**
* @brief
* @author ChengHaotian (yeguangbaozi@foxmail.com)
* @date 2024-07-19
*/
bool m_isPreview = false;
/**
* @brief
* @author ChengHaotian (yeguangbaozi@foxmail.com)
* @date 2024-07-19
*/
PickedDataType m_type = OtherPick;
/**
* @brief
* @author ChengHaotian (yeguangbaozi@foxmail.com)
* @date 2024-07-19
*/
Exchange::FITKFluidVTKGraphObject3D* m_graphObject{ nullptr };
/**
* @brief IDOCCID
* @author ChengHaotian (yeguangbaozi@foxmail.com)
* @date 2024-07-19
*/
QList<int> m_ids;
// 数据ID。
//@{
/**
* @brief ID
* @author ChengHaotian (yeguangbaozi@foxmail.com)
* @date 2024-07-19
*/
int m_dataObjId = -1;
//@}
};
}
#endif // __PICKEDDATA_H__