44 lines
1.0 KiB
C++
44 lines
1.0 KiB
C++
|
#include "PointCloudFactory.h"
|
|||
|
#include "PointCloudSet.h"
|
|||
|
#include "CgnsBCZone.h"
|
|||
|
#include "CgnsFamily.h"
|
|||
|
|
|||
|
namespace PointCloudData
|
|||
|
{
|
|||
|
QHash<int, CREATEPointCloudSET> PointCloudFactory::_createSetFun = QHash<int, CREATEPointCloudSET>();
|
|||
|
|
|||
|
PointCloudData::PointCloudSet* PointCloudFactory::CreatePointCloudSet(int type)
|
|||
|
{
|
|||
|
SetType stype = (SetType)type;
|
|||
|
PointCloudSet* set = nullptr;
|
|||
|
switch (stype)
|
|||
|
{
|
|||
|
case PointCloudData::Node:
|
|||
|
set = new PointCloudSet("", Node); break;
|
|||
|
case PointCloudData::Element:
|
|||
|
set = new PointCloudSet("", Element); break;
|
|||
|
case PointCloudData::Family:
|
|||
|
set = new CgnsFamily; break;
|
|||
|
case PointCloudData::BCZone:
|
|||
|
set = new CgnsBCZone; break;
|
|||
|
default:
|
|||
|
CREATEPointCloudSET fun = _createSetFun.value(type);
|
|||
|
if (fun!= nullptr)
|
|||
|
set = fun(type);
|
|||
|
break;
|
|||
|
}
|
|||
|
return set;
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
void PointCloudFactory::registerFunction(int type, CREATEPointCloudSET fun)
|
|||
|
{
|
|||
|
_createSetFun.insert(type, fun);
|
|||
|
}
|
|||
|
|
|||
|
void PointCloudFactory::remove(int type)
|
|||
|
{
|
|||
|
_createSetFun.remove(type);
|
|||
|
}
|
|||
|
|
|||
|
}
|