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_Interface/FITKInterfaceGeometry/FITKGeoInterfaceFactory.h

179 lines
5.3 KiB
C

/**
*
* @file FITKGeoInterfaceFactory.h
* @brief
* @author LiBaojun (libaojunqd@foxmail.com)
* @date 2024-07-12
*
*/
#ifndef _FITK_GEOMETRY_INTERFACE_FACTORY_H_
#define _FITK_GEOMETRY_INTERFACE_FACTORY_H_
#include "FITKInterfaceGeometryAPI.h"
#include "FITK_Kernel/FITKCore/FITKCoreMacros.h"
#include "FITKAbsGeoCommand.h"
#include "FITKAbsGeoDatum.h"
#include "FITKAbsVirtualTopo.h"
#include <QMutex>
#include <QObject>
#include <QHash>
#include <functional>
namespace Interface
{
class FITKAbsVirtualTopoCreator;
class FITKAbstractGeomToolsCreator;
/**
* @brief
* @author LiBaojun (libaojunqd@foxmail.com)
* @date 2024-07-12
*/
typedef std::function<FITKAbsGeoCommand*(void)> GeoCommandFuns;
/**
* @brief
* @author ChengHaotian (yeguangbaozi@foxmail.com)
* @date 2024-09-04
*/
typedef std::function<FITKAbsGeoDatum*(void)> GeoDatumFuns;
class FITKInterfaceGeometryFactoryDeleator;
/**
* @brief
* @author LiBaojun (libaojunqd@foxmail.com)
* @date 2024-07-12
*/
class FITKInterfaceGeometryAPI FITKInterfaceGeometryFactory : public QObject
{
friend FITKInterfaceGeometryFactoryDeleator;
//声明为单例
DeclSingleton(FITKInterfaceGeometryFactory);
public:
/**
* @brief
* @param[i] t
* @param[i] f
* @author LiBaojun (libaojunqd@foxmail.com)
* @date 2024-07-12
*/
void insertCommandCreateFun(FITKGeoEnum::FITKGeometryComType t, GeoCommandFuns f);
/**
* @brief
* @param t
* @param f
* @author ChengHaotian (yeguangbaozi@foxmail.com)
* @date 2024-09-04
*/
void insertDatumCreateFun(FITKGeoEnum::FITKDatumType t, GeoDatumFuns f);
/**
* @brief
* @param[i] t
* @return FITKAbsGeoCommand*
* @author LiBaojun (libaojunqd@foxmail.com)
* @date 2024-07-12
*/
FITKAbsGeoCommand* createCommand(FITKGeoEnum::FITKGeometryComType t);
template <class T>
/**
* @brief
* @param[i] t
* @return T*
* @author LiBaojun (libaojunqd@foxmail.com)
* @date 2024-07-12
*/
T* createCommandT(FITKGeoEnum::FITKGeometryComType t)
{
return dynamic_cast<T*>(this->createCommand(t));
}
/**
* @brief
* @param t
* @return
* @author ChengHaotian (yeguangbaozi@foxmail.com)
* @date 2024-09-04
*/
FITKAbsGeoDatum* createDatum(FITKGeoEnum::FITKDatumType t);
/**
* @brief
* @param t
* @return
* @author ChengHaotian (yeguangbaozi@foxmail.com)
* @date 2024-09-04
*/
template <class T>
T* createDatumT(FITKGeoEnum::FITKDatumType t)
{
return dynamic_cast<T*>(this->createDatum(t));
}
/**
* @brief
* @param[i] c
* @author LiBaojun (libaojunqd@foxmail.com)
* @date 2024-08-18
*/
void setGeomToolsCreator(FITKAbstractGeomToolsCreator* c);
/**
* @brief
* @return FITKAbstractGeomToolsCreator*
* @author LiBaojun (libaojunqd@foxmail.com)
* @date 2024-08-18
*/
FITKAbstractGeomToolsCreator* getGeomToolsCreator();
private:
/**
* @brief
* @author LiBaojun (libaojunqd@foxmail.com)
* @date 2024-07-12
*/
void initialize();
/**
* @brief
* @author LiBaojun (libaojunqd@foxmail.com)
* @date 2024-07-12
*/
void finalize();
private:
/**
* @brief
* @author LiBaojun (libaojunqd@foxmail.com)
* @date 2024-07-12
*/
QHash<FITKGeoEnum::FITKGeometryComType, GeoCommandFuns> _interfaceFuns{};
/**
* @brief
* @author ChengHaotian (yeguangbaozi@foxmail.com)
* @date 2024-09-04
*/
QHash<FITKGeoEnum::FITKDatumType, GeoDatumFuns> _interfaceDatumFuns{};
/**
* @brief
* @author LiBaojun (libaojunqd@foxmail.com)
* @date 2024-08-18
*/
FITKAbstractGeomToolsCreator* _geomToolsCreator{};
};
class FITKInterfaceGeometryFactoryDeleator
{
public:
explicit FITKInterfaceGeometryFactoryDeleator() = default;
virtual ~FITKInterfaceGeometryFactoryDeleator();
};
}
#endif