|
|
|
|
#include "FITKAbsGeoDatum.h"
|
|
|
|
|
|
|
|
|
|
namespace Interface
|
|
|
|
|
{
|
|
|
|
|
// 基准元素抽象类。
|
|
|
|
|
//@{
|
|
|
|
|
void FITKAbsGeoDatum::setPosition(double* pos)
|
|
|
|
|
{
|
|
|
|
|
// 保存位置。
|
|
|
|
|
if (pos)
|
|
|
|
|
{
|
|
|
|
|
m_pos[0] = pos[0];
|
|
|
|
|
m_pos[1] = pos[1];
|
|
|
|
|
m_pos[2] = pos[2];
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void FITKAbsGeoDatum::getPosition(double* pos)
|
|
|
|
|
{
|
|
|
|
|
if (pos)
|
|
|
|
|
{
|
|
|
|
|
pos[0] = m_pos[0];
|
|
|
|
|
pos[1] = m_pos[1];
|
|
|
|
|
pos[2] = m_pos[2];
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool FITKAbsGeoDatum::editable()
|
|
|
|
|
{
|
|
|
|
|
return m_createdType != DCT_UserDefine;
|
|
|
|
|
}
|
|
|
|
|
//@}
|
|
|
|
|
|
|
|
|
|
// 基准点。
|
|
|
|
|
//@{
|
|
|
|
|
FITKGeoEnum::FITKDatumType FITKAbsGeoDatumPoint::getDatumType()
|
|
|
|
|
{
|
|
|
|
|
return FITKGeoEnum::FITKDatumType::FDTPoint;
|
|
|
|
|
}
|
|
|
|
|
//@}
|
|
|
|
|
|
|
|
|
|
// 基准线。
|
|
|
|
|
//@{
|
|
|
|
|
FITKGeoEnum::FITKDatumType FITKAbsGeoDatumLine::getDatumType()
|
|
|
|
|
{
|
|
|
|
|
return FITKGeoEnum::FITKDatumType::FDTLine;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void FITKAbsGeoDatumLine::setPositions(double* pos1, double* pos2)
|
|
|
|
|
{
|
|
|
|
|
// 保存线。
|
|
|
|
|
for (int i = 0; i < 3; i++)
|
|
|
|
|
{
|
|
|
|
|
m_pos[i] = pos1[i];
|
|
|
|
|
m_pos2[i] = pos2[i];
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void FITKAbsGeoDatumLine::getPositions(double* pos1, double* pos2)
|
|
|
|
|
{
|
|
|
|
|
// 获取线。
|
|
|
|
|
for (int i = 0; i < 3; i++)
|
|
|
|
|
{
|
|
|
|
|
pos1[i] = m_pos[i];
|
|
|
|
|
pos2[i] = m_pos2[i];
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void FITKAbsGeoDatumLine::setPosition2(double* pos)
|
|
|
|
|
{
|
|
|
|
|
// 保存方向。
|
|
|
|
|
if (pos)
|
|
|
|
|
{
|
|
|
|
|
m_pos2[0] = pos[0];
|
|
|
|
|
m_pos2[1] = pos[1];
|
|
|
|
|
m_pos2[2] = pos[2];
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void FITKAbsGeoDatumLine::getPosition2(double* pos)
|
|
|
|
|
{
|
|
|
|
|
if (pos)
|
|
|
|
|
{
|
|
|
|
|
pos[0] = m_pos2[0];
|
|
|
|
|
pos[1] = m_pos2[1];
|
|
|
|
|
pos[2] = m_pos2[2];
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
//@}
|
|
|
|
|
|
|
|
|
|
// 基准面。
|
|
|
|
|
//@{
|
|
|
|
|
FITKGeoEnum::FITKDatumType FITKAbsGeoDatumPlane::getDatumType()
|
|
|
|
|
{
|
|
|
|
|
return FITKGeoEnum::FITKDatumType::FDTPlane;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void FITKAbsGeoDatumPlane::setPlane(double* pos, double* normal, double* up)
|
|
|
|
|
{
|
|
|
|
|
// 设置全部信息。
|
|
|
|
|
if (!pos || !normal || !up)
|
|
|
|
|
{
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i < 3; i++)
|
|
|
|
|
{
|
|
|
|
|
m_pos[i] = pos[i];
|
|
|
|
|
m_nor[i] = normal[i];
|
|
|
|
|
m_up[i] = up[i];
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void FITKAbsGeoDatumPlane::getPlane(double* pos, double* normal, double* up)
|
|
|
|
|
{
|
|
|
|
|
// 获取全部信息。
|
|
|
|
|
if (!pos || !normal || !up)
|
|
|
|
|
{
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i < 3; i++)
|
|
|
|
|
{
|
|
|
|
|
pos[i] = m_pos[i];
|
|
|
|
|
normal[i] = m_nor[i];
|
|
|
|
|
up[i] = m_up[i];
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void FITKAbsGeoDatumPlane::setNormal(double* nor)
|
|
|
|
|
{
|
|
|
|
|
// 保存方向。
|
|
|
|
|
if (nor)
|
|
|
|
|
{
|
|
|
|
|
m_nor[0] = nor[0];
|
|
|
|
|
m_nor[1] = nor[1];
|
|
|
|
|
m_nor[2] = nor[2];
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void FITKAbsGeoDatumPlane::getNormal(double* nor)
|
|
|
|
|
{
|
|
|
|
|
if (nor)
|
|
|
|
|
{
|
|
|
|
|
nor[0] = m_nor[0];
|
|
|
|
|
nor[1] = m_nor[1];
|
|
|
|
|
nor[2] = m_nor[2];
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void FITKAbsGeoDatumPlane::setUp(double* up)
|
|
|
|
|
{
|
|
|
|
|
// 保存方向。
|
|
|
|
|
if (up)
|
|
|
|
|
{
|
|
|
|
|
m_up[0] = up[0];
|
|
|
|
|
m_up[1] = up[1];
|
|
|
|
|
m_up[2] = up[2];
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void FITKAbsGeoDatumPlane::getUp(double* up)
|
|
|
|
|
{
|
|
|
|
|
if (up)
|
|
|
|
|
{
|
|
|
|
|
up[0] = m_up[0];
|
|
|
|
|
up[1] = m_up[1];
|
|
|
|
|
up[2] = m_up[2];
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
//@}
|
|
|
|
|
|
|
|
|
|
// 基准元素管理器。
|
|
|
|
|
//@{
|
|
|
|
|
FITKDatumList::FITKDatumList()
|
|
|
|
|
{
|
|
|
|
|
// 初始化基准平面。
|
|
|
|
|
// XOY.
|
|
|
|
|
double norXOY[3]{ 0., 0., 1. };
|
|
|
|
|
double upXOY[3]{ 0., 1., 0. };
|
|
|
|
|
FITKAbsGeoDatumPlane* xoy = new FITKAbsGeoDatumPlane;
|
|
|
|
|
xoy->setDataObjectName("Plane XOY");
|
|
|
|
|
xoy->setNormal(norXOY);
|
|
|
|
|
xoy->setUp(upXOY);
|
|
|
|
|
xoy->m_createdType = FITKAbsGeoDatum::DCT_System;
|
|
|
|
|
this->appendDataObj(xoy);
|
|
|
|
|
|
|
|
|
|
// YOZ.
|
|
|
|
|
double norYOZ[3]{ 1., 0., 0. };
|
|
|
|
|
double upYOZ[3]{ 0., 0., 1. };
|
|
|
|
|
FITKAbsGeoDatumPlane* yoz = new FITKAbsGeoDatumPlane;
|
|
|
|
|
yoz->setDataObjectName("Plane YOZ");
|
|
|
|
|
yoz->setNormal(norYOZ);
|
|
|
|
|
yoz->setUp(upYOZ);
|
|
|
|
|
yoz->m_createdType = FITKAbsGeoDatum::DCT_System;
|
|
|
|
|
this->appendDataObj(yoz);
|
|
|
|
|
|
|
|
|
|
// ZOX.
|
|
|
|
|
double norZOX[3]{ 0., 1., 0. };
|
|
|
|
|
double upZOX[3]{ 0., 0., 1. };
|
|
|
|
|
FITKAbsGeoDatumPlane* zox = new FITKAbsGeoDatumPlane;
|
|
|
|
|
zox->setDataObjectName("Plane ZOX");
|
|
|
|
|
zox->setNormal(norZOX);
|
|
|
|
|
zox->setUp(upZOX);
|
|
|
|
|
zox->m_createdType = FITKAbsGeoDatum::DCT_System;
|
|
|
|
|
this->appendDataObj(zox);
|
|
|
|
|
}
|
|
|
|
|
//@}
|
|
|
|
|
}
|