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/FITKAbsGeoDatum.h

471 lines
14 KiB
C

/*****************************************************************//**
* @file FITKAbsGeoDatum.h
* @brief
* @author ChengHaotian (yeguangbaozi@foxmail.com)
* @date 2024-08-30
*********************************************************************/
#ifndef FITKABSGEODATUM_H
#define FITKABSGEODATUM_H
#include "FITK_Kernel/FITKCore/FITKAbstractNDataObject.h"
#include "FITK_Kernel/FITKCore/FITKAbstractDataObject.h"
#include "FITK_Kernel/FITKCore/FITKAbstractDataManager.hpp"
#include "FITK_Kernel/FITKAppFramework/FITKAppFramework.h"
#include "FITK_Kernel/FITKAppFramework/FITKSignalTransfer.h"
#include "FITKGeoEnum.h"
#include "FITKInterfaceGeometryAPI.h"
namespace Interface
{
/**
* @brief .
* @author YanZhiHui (chanyuantiandao@126.com)
* @date 2024-08-22
*/
class SourceObject {
public:
/**
* @brief .
* @return truefalse
* @author YanZhiHui (chanyuantiandao@126.com)
* @date 2024-09-04
*/
bool isDatumObj() const { return m_IsDatum; }
/**
* @brief ID.
* @return ID0
* @author YanZhiHui (chanyuantiandao@126.com)
* @date 2024-09-04
*/
int datumId() const {
return m_IsDatum ? m_DatumId : 0;
}
/**
* @brief .
* @param id id
* @author YanZhiHui (chanyuantiandao@126.com)
* @date 2024-09-04
*/
void setDatum(int id) {
m_IsDatum = true;
m_DatumId = id;
}
/**
* @brief cmdID.
* @return ID0
* @author YanZhiHui (chanyuantiandao@126.com)
* @date 2024-09-04
*/
int cmdId() const {
return m_IsDatum ? 0 : m_CmdId;
}
/**
* @brief ID.
* @return ID0
* @author YanZhiHui (chanyuantiandao@126.com)
* @date 2024-09-04
*/
int virtualTopoId() const {
return m_IsDatum ? 0 : m_VirtualTopoId;
}
/**
* @brief .
* @param cmdId id
* @param virtualTopoId id
* @author YanZhiHui (chanyuantiandao@126.com)
* @date 2024-09-04
*/
void setVirtualTopo(int cmdId, int virtualTopoId) {
m_IsDatum = false;
m_CmdId = cmdId;
m_VirtualTopoId = virtualTopoId;
}
/**
* @brief .
* @author YanZhiHui (chanyuantiandao@126.com)
* @date 2024-08-22
*/
bool isNull() const {
return m_IsDatum ? m_DatumId <= 0 : (m_CmdId <= 0 || m_VirtualTopoId <= 0);
}
/**
* @brief (isNull() == true).
* @author YanZhiHui (chanyuantiandao@126.com)
* @date 2024-08-22
*/
void reset() { m_CmdId = 0; m_VirtualTopoId = 0; m_DatumId = 0; }
private:
/**
* @brief CommandID.
* @author YanZhiHui (chanyuantiandao@126.com)
* @date 2024-08-22
*/
int m_CmdId{ 0 };
/**
* @brief ID.
* @author YanZhiHui (chanyuantiandao@126.com)
* @date 2024-08-22
*/
int m_VirtualTopoId{ 0 };
/**
* @brief ID.
* @author YanZhiHui (chanyuantiandao@126.com)
* @date 2024-09-04
*/
int m_DatumId{ 0 };
/**
* @brief .
* @author YanZhiHui (chanyuantiandao@126.com)
* @date 2024-09-04
*/
bool m_IsDatum{};
};
/**
* @brief
* @author ChengHaotian (yeguangbaozi@foxmail.com)
* @date 2024-08-30
*/
class FITKInterfaceGeometryAPI FITKAbsGeoDatum : public Core::FITKAbstractNDataObject
{
FITKCLASS(Interface, FITKAbsGeoDatum);
public:
/**
* @brief
* @author ChengHaotian (yeguangbaozi@foxmail.com)
* @date 2024-08-31
*/
enum DatumCreatedType
{
DCT_System = 0,
DCT_UserDefine
};
/**
* @brief
* @author ChengHaotian (yeguangbaozi@foxmail.com)
* @date 2024-08-30
*/
FITKAbsGeoDatum() = default;
/**
* @brief []
* @author ChengHaotian (yeguangbaozi@foxmail.com)
* @date 2024-08-30
*/
virtual ~FITKAbsGeoDatum() = default;
/**
* @brief
* @param pos
* @author ChengHaotian (yeguangbaozi@foxmail.com)
* @date 2024-08-30
*/
void setPosition(double* pos);
/**
* @brief
* @param pos
* @author ChengHaotian (yeguangbaozi@foxmail.com)
* @date 2024-08-30
*/
void getPosition(double* pos);
/**
* @brief []
* @return
* @author ChengHaotian (yeguangbaozi@foxmail.com)
* @date 2024-08-30
*/
virtual FITKGeoEnum::FITKDatumType getDatumType() = 0;
/**
* @brief
* @return
* @author ChengHaotian (yeguangbaozi@foxmail.com)
* @date 2024-08-31
*/
bool editable();
/**
* @brief []
* @return
* @author ChengHaotian (yeguangbaozi@foxmail.com)
* @date 2024-09-04
*/
virtual bool update() { return true; };
/**
* @brief .
* @param type 1-normal 2-warning 3-error 4-info
* @param msg
* @author YanZhiHui (chanyuantiandao@126.com)
* @date 2024-08-28
*/
void printLog(QString msg, int type = 1)
{
AppFrame::FITKSignalTransfer* sigTrans = FITKAPP->getSignalTransfer();
if (sigTrans)
{
sigTrans->outputMessageSig(type, msg);
}
}
protected:
/**
* @brief
* @author ChengHaotian (yeguangbaozi@foxmail.com)
* @date 2024-08-30
*/
double m_pos[3]{ 0., 0., 0. };
/**
* @brief
* @author ChengHaotian (yeguangbaozi@foxmail.com)
* @date 2024-08-31
*/
DatumCreatedType m_createdType = DCT_UserDefine;
// 指定数据管理器为友元类。
friend class FITKDatumList;
};
/**
* @brief
* @author ChengHaotian (yeguangbaozi@foxmail.com)
* @date 2024-08-30
*/
class FITKInterfaceGeometryAPI FITKAbsGeoDatumPoint : public FITKAbsGeoDatum
{
public:
/**
* @brief
* @author ChengHaotian (yeguangbaozi@foxmail.com)
* @date 2024-08-30
*/
FITKAbsGeoDatumPoint() = default;
/**
* @brief []
* @author ChengHaotian (yeguangbaozi@foxmail.com)
* @date 2024-08-30
*/
virtual ~FITKAbsGeoDatumPoint() = default;
/**
* @brief []
* @return
* @author ChengHaotian (yeguangbaozi@foxmail.com)
* @date 2024-08-30
*/
FITKGeoEnum::FITKDatumType getDatumType() override;
};
/**
* @brief 线
* @author ChengHaotian (yeguangbaozi@foxmail.com)
* @date 2024-08-30
*/
class FITKInterfaceGeometryAPI FITKAbsGeoDatumLine : public FITKAbsGeoDatum
{
public:
/**
* @brief
* @author ChengHaotian (yeguangbaozi@foxmail.com)
* @date 2024-08-30
*/
FITKAbsGeoDatumLine() = default;
/**
* @brief []
* @author ChengHaotian (yeguangbaozi@foxmail.com)
* @date 2024-08-30
*/
virtual ~FITKAbsGeoDatumLine() = default;
/**
* @brief [][]
* @return
* @author ChengHaotian (yeguangbaozi@foxmail.com)
* @date 2024-08-30
*/
FITKGeoEnum::FITKDatumType getDatumType() override;
/**
* @brief 线
* @param pos11
* @param pos22
* @author ChengHaotian (yeguangbaozi@foxmail.com)
* @date 2024-09-05
*/
void setPositions(double* pos1, double* pos2);
/**
* @brief 线
* @param pos11
* @param pos22
* @author ChengHaotian (yeguangbaozi@foxmail.com)
* @date 2024-09-05
*/
void getPositions(double* pos1, double* pos2);
/**
* @brief 线
* @param pos
* @author ChengHaotian (yeguangbaozi@foxmail.com)
* @date 2024-09-04
*/
void setPosition2(double* pos);
/**
* @brief 线
* @param pos
* @author ChengHaotian (yeguangbaozi@foxmail.com)
* @date 2024-09-04
*/
void getPosition2(double* pos);
protected:
/**
* @brief 线
* @author ChengHaotian (yeguangbaozi@foxmail.com)
* @date 2024-08-30
*/
double m_pos2[3]{ 0., 0., 1. };
};
/**
* @brief (XOY)
* @author ChengHaotian (yeguangbaozi@foxmail.com)
* @date 2024-08-30
*/
class FITKInterfaceGeometryAPI FITKAbsGeoDatumPlane : public FITKAbsGeoDatum
{
public:
/**
* @brief
* @author ChengHaotian (yeguangbaozi@foxmail.com)
* @date 2024-08-30
*/
FITKAbsGeoDatumPlane() = default;
/**
* @brief []
* @author ChengHaotian (yeguangbaozi@foxmail.com)
* @date 2024-08-30
*/
virtual ~FITKAbsGeoDatumPlane() = default;
/**
* @brief []
* @return
* @author ChengHaotian (yeguangbaozi@foxmail.com)
* @date 2024-08-30
*/
FITKGeoEnum::FITKDatumType getDatumType() override;
/**
* @brief
* @param pos
* @param normal
* @param up
* @return
* @author ChengHaotian (yeguangbaozi@foxmail.com)
* @date 2024-09-05
*/
void setPlane(double* pos, double* normal, double* up);
/**
* @brief
* @param pos
* @param normal
* @param up
* @return
* @author ChengHaotian (yeguangbaozi@foxmail.com)
* @date 2024-09-05
*/
void getPlane(double* pos, double* normal, double* up);
/**
* @brief
* @param nor
* @author ChengHaotian (yeguangbaozi@foxmail.com)
* @date 2024-08-30
*/
void setNormal(double* nor);
/**
* @brief
* @param nor
* @author ChengHaotian (yeguangbaozi@foxmail.com)
* @date 2024-08-30
*/
void getNormal(double* nor);
/**
* @brief
* @param up
* @author ChengHaotian (yeguangbaozi@foxmail.com)
* @date 2024-08-30
*/
void setUp(double* up);
/**
* @brief
* @param up
* @author ChengHaotian (yeguangbaozi@foxmail.com)
* @date 2024-08-30
*/
void getUp(double* up);
protected:
/**
* @brief
* @author ChengHaotian (yeguangbaozi@foxmail.com)
* @date 2024-08-30
*/
double m_nor[3]{ 0., 0., 1. };
/**
* @brief
* @author ChengHaotian (yeguangbaozi@foxmail.com)
* @date 2024-08-30
*/
double m_up[3]{ 0., 1., 0. };
};
/**
* @brief
* @author ChengHaotian (yeguangbaozi@foxmail.com)
* @date 2024-08-30
*/
class FITKInterfaceGeometryAPI FITKDatumList :
public Core::FITKAbstractDataManager<Interface::FITKAbsGeoDatum>
{
public:
/**
* @brief
* @author ChengHaotian (yeguangbaozi@foxmail.com)
* @date 2024-08-30
*/
explicit FITKDatumList();
/**
* @brief
* @author ChengHaotian (yeguangbaozi@foxmail.com)
* @date 2024-08-30
*/
virtual ~FITKDatumList() = default;
};
}
#endif // !FITKABSGEODATUM_H