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/GraphDataProvider/GraphProviderManager.h

183 lines
5.2 KiB
C

/*****************************************************************//**
* @file GraphProviderManager.h
* @brief
*
* @author ChengHaotian (yeguangbaozi@foxmail.com)
* @date 2024-06-12
*********************************************************************/
#ifndef __GRAPHPROVIDERMANAGER_H__
#define __GRAPHPROVIDERMANAGER_H__
#include <QObject>
#include "GraphDataProviderAPI.h"
#include <QMutex>
#include <QMutexLocker>
#include <QHash>
#include "FITK_Kernel/FITKCore/FITKCoreMacros.h"
// 前置声明
namespace Comp
{
class FITKGraph3DWindowVTK;
}
namespace GraphData
{
class GraphProviderBase;
class GraphModelProvider;
class GraphMarkProvider;
}
namespace GraphData
{
/**
* @brief
* @author ChengHaotian (yeguangbaozi@foxmail.com)
* @date 2024-03-27
*/
class GRAPHDATAPROVIDERAPI GraphProviderManager : public QObject
{
Q_OBJECT
public:
/**
* @brief []
* @return
* @author ChengHaotian (yeguangbaozi@foxmail.com)
* @date 2024-06-12
*/
static GraphProviderManager* getInstance();
/**
* @brief []
* @author ChengHaotian (yeguangbaozi@foxmail.com)
* @date 2024-06-12
*/
static void Delete();
/**
* @brief
* @param graphWidget
* @return
* @author ChengHaotian (yeguangbaozi@foxmail.com)
* @date 2024-06-12
*/
GraphModelProvider* getModelProvider(Comp::FITKGraph3DWindowVTK* graphWidget);
/**
* @brief
* @param graphWidget
* @return
* @author ChengHaotian (yeguangbaozi@foxmail.com)
* @date 2024-07-26
*/
GraphMarkProvider* getMarkProvider(Comp::FITKGraph3DWindowVTK* graphWidget);
/**
* @brief ID
* @param dataIdID
* @author ChengHaotian (yeguangbaozi@foxmail.com)
* @date 2024-06-12
*/
void updateObjectById(int dataId);
/**
* @brief
* @param pickObjType
* @param pickMethod
* @param dataObjIdID-1[]
* @author ChengHaotian (yeguangbaozi@foxmail.com)
* @date 2024-07-19
*/
void setActorStateByPickInfo(int pickObjType, int pickMethod, int dataObjId = -1);
private:
/**
* @brief
* @author ChengHaotian (yeguangbaozi@foxmail.com)
* @date 2024-06-12
*/
GraphProviderManager();
/**
* @brief
* @author ChengHaotian (yeguangbaozi@foxmail.com)
* @date 2024-06-12
*/
~GraphProviderManager();
/**
* @brief
* @param provider[]
* @author ChengHaotian (yeguangbaozi@foxmail.com)
* @date 2024-06-12
*/
template<class T>
void deleteProvider(T*& provider)
{
if (provider)
{
delete provider;
}
provider = nullptr;
}
/**
* @brief
* @param providers[]
* @author ChengHaotian (yeguangbaozi@foxmail.com)
* @date 2024-06-12
*/
template<class T>
void deleteProviders(QList<T*>& providers)
{
// 清除数据管理指针。
for (T* obj : providers)
{
if (obj)
{
delete obj;
}
}
providers.clear();
}
private:
/**
* @brief
* @author ChengHaotian (yeguangbaozi@foxmail.com)
* @date 2024-06-12
*/
static GraphProviderManager* s_instance;
/**
* @brief
* @author ChengHaotian (yeguangbaozi@foxmail.com)
* @date 2024-06-12
*/
static QMutex m_mutex;
/**
* @brief
* @author ChengHaotian (yeguangbaozi@foxmail.com)
* @date 2024-06-12
*/
GraphModelProvider* m_modelProvider{ nullptr };
/**
* @brief
* @author ChengHaotian (yeguangbaozi@foxmail.com)
* @date 2024-07-26
*/
GraphMarkProvider* m_markProvider{ nullptr };
};
} // namespace GraphData
#endif // __GRAPHPROVIDERMANAGER_H__