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.

221 lines
6.5 KiB
C

/**
*
* @file FITKAbstractGraphObject.h
* @brief
* @author LiBaojun (libaojunqd@foxmail.com)
* @date 2024-04-18
*
*/
#ifndef _FITKABSTRACTGRAPH_OBJECT_H__
#define _FITKABSTRACTGRAPH_OBJECT_H__
#include <QObject>
#include "FITKAbstractObject.hpp"
#include "FITKCoreAPI.h"
#include <QList>
namespace Core
{
class FITKAbstractDataObject;
class FITKAbstractGraphWidget;
/**
* @brief
* @author LiBaojun (libaojunqd@foxmail.com)
* @date 2024-04-18
*/
class FITKCoreAPI FITKAbstractGraphObject
:public QObject, public FITKAbstractObject
{
Q_OBJECT
public:
/**
* @brief
* @param data
* @author LiBaojun (libaojunqd@foxmail.com)
* @date 2024-04-18
*/
explicit FITKAbstractGraphObject(FITKAbstractDataObject* data);
/**
* @brief Destroy the FITKAbstractGraphObject object
* @author LiBaojun (libaojunqd@foxmail.com)
* @date 2024-04-18
*/
virtual ~FITKAbstractGraphObject() = 0;
/**
* @brief
* @param[i] dataobj
* @author LiBaojun (libaojunqd@foxmail.com)
* @date 2024-04-18
*/
void setDataObject(FITKAbstractDataObject* dataobj);
/**
* @brief
* @param[i] gwidget
* @author LiBaojun (libaojunqd@foxmail.com)
* @date 2024-04-18
*/
void setGraphWidget(FITKAbstractGraphWidget* gwidget );
/**
* @brief
* @return FITKAbstractGraphWidget*
* @author LiBaojun (libaojunqd@foxmail.com)
* @date 2024-04-18
*/
FITKAbstractGraphWidget* getGraphWidget();
/**
* @brief
* @return FITKAbstractDataObject*
* @author LiBaojun (libaojunqd@foxmail.com)
* @date 2024-04-18
*/
FITKAbstractDataObject* getDataOject();
/**
* @brief
* @author LiBaojun (libaojunqd@foxmail.com)
* @date 2024-04-18
*/
void removeFromGraphWidget();
/**
* @brief
* @param[i] mandatory
* @author LiBaojun (libaojunqd@foxmail.com)
* @date 2024-04-18
*/
virtual void update(bool mandatory = false);
signals:
/**
* @brief
* @param[i] gobj
* @author LiBaojun (libaojunqd@foxmail.com)
* @date 2024-04-18
*/
void graphObjDestroyedSig(FITKAbstractGraphObject* gobj);
protected:
/**
* @brief
* @author LiBaojun (libaojunqd@foxmail.com)
* @date 2024-04-18
*/
FITKAbstractDataObject* _dataObj{};
/**
* @brief
* @author LiBaojun (libaojunqd@foxmail.com)
* @date 2024-04-18
*/
FITKAbstractGraphWidget* _graphWidget{};
};
/**
* @brief delete
* @author LiBaojun (libaojunqd@foxmail.com)
* @date 2024-04-18
*/
class FITKCoreAPI FITKGraphObjManager
: public QObject, public FITKAbstractObject
{
Q_OBJECT
public:
/**
* @brief Construct a new FITKGraphObjManager object
* @author LiBaojun (libaojunqd@foxmail.com)
* @date 2024-04-18
*/
explicit FITKGraphObjManager() = default;
/**
* @brief Destroy the FITKGraphObjManager object
* @author LiBaojun (libaojunqd@foxmail.com)
* @date 2024-04-18
*/
virtual ~FITKGraphObjManager();
/**
* @brief
* @author LiBaojun (libaojunqd@foxmail.com)
* @date 2024-04-18
*/
virtual void clear();
/**
* @brief
* @param[i] gobj
* @author LiBaojun (libaojunqd@foxmail.com)
* @date 2024-04-18
*/
virtual void appendGraphObj(FITKAbstractGraphObject* gobj);
/**
* @brief
* @param[i] obj
* @author LiBaojun (libaojunqd@foxmail.com)
* @date 2024-04-18
*/
virtual void removeGraphObj(FITKAbstractGraphObject* obj);
/**
* @brief
* @param[i] index
* @author LiBaojun (libaojunqd@foxmail.com)
* @date 2024-04-18
*/
virtual void removeGraphObj(const int index);
/**
* @brief
* @param[i] gobj
* @return true
* @return false
* @author LiBaojun (libaojunqd@foxmail.com)
* @date 2024-04-18
*/
virtual bool isContains(FITKAbstractGraphObject* gobj);
/**
* @brief
* @return int
* @author LiBaojun (libaojunqd@foxmail.com)
* @date 2024-04-18
*/
int getGraphObjCount();
/**
* @brief
* @param[i] index
* @return FITKAbstractGraphObject*
* @author LiBaojun (libaojunqd@foxmail.com)
* @date 2024-04-18
*/
FITKAbstractGraphObject* getGraphObjAt(const int index);
template <class T>
/**
* @brief
* @param[i] index
* @return T*
* @author LiBaojun (libaojunqd@foxmail.com)
* @date 2024-04-18
*/
T* getGraphObjTAt(const int index)
{
return dynamic_cast<T*>(this->getGraphObjAt(index));
}
private slots:
/**
* @brief
* @param[i] obj
* @author LiBaojun (libaojunqd@foxmail.com)
* @date 2024-04-18
*/
void removeGraphObjSlot(FITKAbstractGraphObject* obj);
protected:
/**
* @brief
* @author LiBaojun (libaojunqd@foxmail.com)
* @date 2024-04-18
*/
QList<FITKAbstractGraphObject*> _graphObjList{};
};
}
#endif // !_FITKABSTRACTGRAPH_OBJECT_H__