386 lines
9.7 KiB
C
386 lines
9.7 KiB
C
|
#ifndef HULL_H
|
|||
|
#define HULL_H
|
|||
|
#include "DataManagerGlobal.h"
|
|||
|
#include "Interfaces.h"
|
|||
|
#include <QString>
|
|||
|
#include <QVector>
|
|||
|
|
|||
|
/// 主甲板面
|
|||
|
struct DATAMANAGER_DLL_API_EXPORTS MainDeckSurf_M : public IModel
|
|||
|
{
|
|||
|
public:
|
|||
|
MainDeckSurf_M()
|
|||
|
{
|
|||
|
setObjType(E_GEO_3D_OBJ_TYPE_MAINDECKSURF);
|
|||
|
}
|
|||
|
|
|||
|
};
|
|||
|
|
|||
|
// 外板面
|
|||
|
struct DATAMANAGER_DLL_API_EXPORTS ShellSurf_M : public IModel
|
|||
|
{
|
|||
|
ShellSurf_M()
|
|||
|
{
|
|||
|
setObjType(E_GEO_3D_OBJ_TYPE_SHELLSURF);
|
|||
|
}
|
|||
|
};
|
|||
|
|
|||
|
// 主船体
|
|||
|
struct DATAMANAGER_DLL_API_EXPORTS Hull_M : public IModel
|
|||
|
{
|
|||
|
// 体运算方式:0并,1差,2交.
|
|||
|
QVector<int> m_SolidAddMode;
|
|||
|
// 镜像面方向:1-X, 2-Y, 3-Z
|
|||
|
int m_MirrorDir;
|
|||
|
// 镜像面位置,与MirrorDir匹配的分量坐标
|
|||
|
double m_MirrorOrgin;
|
|||
|
// 复制偏移分量
|
|||
|
double m_CopyOffsetX; // 20170901 新增 by czb
|
|||
|
// 复制偏移分量
|
|||
|
double m_CopyOffsetY;
|
|||
|
// 复制偏移分量
|
|||
|
double m_CopyOffsetZ;
|
|||
|
|
|||
|
Hull_M()
|
|||
|
: m_SolidAddMode(), // 默认空体运算集合
|
|||
|
m_MirrorDir(0), // 不镜像
|
|||
|
m_MirrorOrgin(0.0),
|
|||
|
m_CopyOffsetX(0.0),
|
|||
|
m_CopyOffsetY(0.0),
|
|||
|
m_CopyOffsetZ(0.0)
|
|||
|
{
|
|||
|
setObjType(E_GEO_3D_OBJ_TYPE_HULL);
|
|||
|
}
|
|||
|
|
|||
|
IModel* Clone()
|
|||
|
{
|
|||
|
IModel* p = new Hull_M();
|
|||
|
*p = *this;
|
|||
|
return p;
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
Hull getGeoHull()
|
|||
|
{
|
|||
|
Hull hull;
|
|||
|
// QByteArray baName = itH->m_Name.toLatin1(); // must
|
|||
|
// char *persistentPtr = new char[baName.size() + 1]; // +1为'\0'
|
|||
|
// memset(persistentPtr, 0, baName.size() + 1);
|
|||
|
// strcpy(persistentPtr, baName.constData());
|
|||
|
hull.Name = this->m_Name.toStdString();// persistentPtr;
|
|||
|
// QByteArray baCommand = this->m_Command.toLatin1(); // must
|
|||
|
// char *persistentPtr1 = new char[baCommand.size() + 1]; // +1为'\0'
|
|||
|
// memset(persistentPtr1, 0, baCommand.size() + 1);
|
|||
|
// strcpy(persistentPtr1, baCommand.constData());
|
|||
|
hull.Command = this->m_Command.toStdString();// persistentPtr1;
|
|||
|
hull.ID = this->m_ID;
|
|||
|
hull.CmdID = this->m_CmdID;
|
|||
|
hull.Visible = this->m_Visible;
|
|||
|
hull.Color = this->m_Color;
|
|||
|
hull.Transparency = this->m_Transparency;
|
|||
|
hull.Type = this->m_Type;
|
|||
|
IModel::copyQVectorToArray<int>(this->m_Src, hull.Src);
|
|||
|
IModel::copyQVectorToArray<int>(this->m_SolidAddMode, hull.SolidAddMode);
|
|||
|
hull.MirrorDir = this->m_MirrorDir;
|
|||
|
hull.MirrorOrgin = this->m_MirrorOrgin; // 镜像面位置,与MirrorDir匹配的分量坐标
|
|||
|
hull.CopyOffsetX = this->m_CopyOffsetX; // 复制偏移分量,20170901 新增 by czb
|
|||
|
hull.CopyOffsetY = this->m_CopyOffsetY; // 复制偏移分量
|
|||
|
hull.CopyOffsetZ = this->m_CopyOffsetZ; // 复制偏移分量
|
|||
|
|
|||
|
hull.m_objType = (E_GEO_3D_OBJ_TYPE)this->m_objType;
|
|||
|
|
|||
|
return hull;
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
};
|
|||
|
|
|||
|
// 平台面
|
|||
|
struct DATAMANAGER_DLL_API_EXPORTS DeckSurf_M : public IModel
|
|||
|
{
|
|||
|
public:
|
|||
|
DeckSurf_M()
|
|||
|
{
|
|||
|
setObjType(E_GEO_3D_OBJ_TYPE_DECKSURF);
|
|||
|
}
|
|||
|
IModel* Clone()
|
|||
|
{
|
|||
|
IModel* p = new DeckSurf_M();
|
|||
|
*p = *this;
|
|||
|
return p;
|
|||
|
}
|
|||
|
|
|||
|
// 生成方式:0来自几何面,1参数化
|
|||
|
int m_GenType;
|
|||
|
// 面的位置或面边界起止位置
|
|||
|
double m_X1;
|
|||
|
double m_X2;
|
|||
|
double m_Y1;
|
|||
|
double m_Y2;
|
|||
|
double m_Z;
|
|||
|
};
|
|||
|
|
|||
|
// 上建外围面
|
|||
|
struct DATAMANAGER_DLL_API_EXPORTS BoundSurf_M : public IModel
|
|||
|
{
|
|||
|
public:
|
|||
|
BoundSurf_M()
|
|||
|
{
|
|||
|
setObjType(E_GEO_3D_OBJ_TYPE_BOUNDSURF);
|
|||
|
}
|
|||
|
|
|||
|
IModel* Clone()
|
|||
|
{
|
|||
|
IModel* p = new BoundSurf_M();
|
|||
|
*p = *this;
|
|||
|
return p;
|
|||
|
}
|
|||
|
|
|||
|
// 生成方式:0来自几何面,1参数化
|
|||
|
int m_GenType;
|
|||
|
// 面的位置或面边界起止位置
|
|||
|
double m_X1;
|
|||
|
double m_X2;
|
|||
|
double m_Y1;
|
|||
|
double m_Y2;
|
|||
|
double m_Z1;
|
|||
|
double m_Z2;
|
|||
|
// 上建外围面方向:0横向(X),1纵向(Y)
|
|||
|
int m_Dir;
|
|||
|
};
|
|||
|
|
|||
|
// 分舱面
|
|||
|
struct DATAMANAGER_DLL_API_EXPORTS SubdivSurf_M : public IModel
|
|||
|
{
|
|||
|
public:
|
|||
|
SubdivSurf_M()
|
|||
|
{
|
|||
|
setObjType(E_GEO_3D_OBJ_TYPE_SUBDIVSURF);
|
|||
|
}
|
|||
|
IModel* Clone()
|
|||
|
{
|
|||
|
IModel* p = new SubdivSurf_M();
|
|||
|
*p = *this;
|
|||
|
return p;
|
|||
|
}
|
|||
|
|
|||
|
// 生成方式:0来自几何面,1参数化
|
|||
|
int m_GenType;
|
|||
|
// 面的位置
|
|||
|
double m_XY;
|
|||
|
// 分舱面方向:0横向(X),1纵向(Y)
|
|||
|
int m_Dir;
|
|||
|
// 边界定义方式:0坐标,1限制面
|
|||
|
int m_BndType;
|
|||
|
// 面边界起止位置(坐标)
|
|||
|
double m_X1;
|
|||
|
double m_X2;
|
|||
|
double m_Y1;
|
|||
|
double m_Y2;
|
|||
|
double m_Z1;
|
|||
|
double m_Z2;
|
|||
|
// 面边界起止位置(限制面),若为0,则该方向以船壳(主甲板面+外板面)作为限制
|
|||
|
int m_RefX1;
|
|||
|
int m_RefX2;
|
|||
|
int m_RefY1;
|
|||
|
int m_RefY2;
|
|||
|
int m_RefZ1;
|
|||
|
int m_RefZ2;
|
|||
|
|
|||
|
// 是否槽形结构:0否,1是
|
|||
|
int m_Corrugated;
|
|||
|
// 槽条方向:0垂向,1水平
|
|||
|
int m_CorDir;
|
|||
|
// 槽形参数
|
|||
|
double m_S;
|
|||
|
double m_A;
|
|||
|
double m_D;
|
|||
|
double m_F;
|
|||
|
};
|
|||
|
|
|||
|
// 开敞客货区
|
|||
|
struct DATAMANAGER_DLL_API_EXPORTS OpenCargoRegion_M : public IModel
|
|||
|
{
|
|||
|
public:
|
|||
|
OpenCargoRegion_M()
|
|||
|
{
|
|||
|
setObjType(E_GEO_3D_OBJ_TYPE_OPENCARGOREGION);
|
|||
|
}
|
|||
|
};
|
|||
|
|
|||
|
// 舱室
|
|||
|
struct DATAMANAGER_DLL_API_EXPORTS Space_M : public IModel
|
|||
|
{
|
|||
|
int m_GenType;
|
|||
|
// 体运算方式:0并,1差,2交.
|
|||
|
QVector<int> m_SolidAddMode;
|
|||
|
// 面的位置或面边界起止位置
|
|||
|
double m_X1;
|
|||
|
double m_X2;
|
|||
|
// 首面特征点定义 characteristic points
|
|||
|
QVector<double> LCharacterPoints;
|
|||
|
QVector<double> FCharacterPoints;
|
|||
|
|
|||
|
double m_Y;
|
|||
|
double m_Z;
|
|||
|
int m_HullID;
|
|||
|
bool m_IsUnit;
|
|||
|
// 镜像面方向:1-X, 2-Y, 3-Z
|
|||
|
int m_MirrorDir;
|
|||
|
// 镜像面位置,与MirrorDir匹配的分量坐标
|
|||
|
double m_MirrorOrgin;
|
|||
|
// 复制偏移分量
|
|||
|
double m_CopyOffsetX; // 20170901 新增 by czb
|
|||
|
// 复制偏移分量
|
|||
|
double m_CopyOffsetY;
|
|||
|
// 复制偏移分量
|
|||
|
double m_CopyOffsetZ;
|
|||
|
// XUEFENG ADDED 202012
|
|||
|
int m_NumSections;
|
|||
|
Space_M()
|
|||
|
:
|
|||
|
m_GenType(0),
|
|||
|
m_SolidAddMode(),
|
|||
|
m_X1(0.0),
|
|||
|
m_X2(0.0),
|
|||
|
LCharacterPoints(),
|
|||
|
FCharacterPoints(),
|
|||
|
m_Y(0.0),
|
|||
|
m_Z(0.0),
|
|||
|
m_HullID(0),
|
|||
|
m_IsUnit(false),
|
|||
|
m_MirrorDir(0),
|
|||
|
m_MirrorOrgin(0.0),
|
|||
|
m_CopyOffsetX(0.0),
|
|||
|
m_CopyOffsetY(0.0),
|
|||
|
m_CopyOffsetZ(0.0),
|
|||
|
m_NumSections(0)
|
|||
|
{
|
|||
|
setObjType(E_GEO_3D_OBJ_TYPE_SPACE);
|
|||
|
}
|
|||
|
|
|||
|
IModel* Clone()
|
|||
|
{
|
|||
|
IModel* p = new Space_M();
|
|||
|
*p = *this;
|
|||
|
return p;
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
Space getGeoSpace()
|
|||
|
{
|
|||
|
Space space;
|
|||
|
// QByteArray baName = this->m_Name.toLatin1(); // must
|
|||
|
// char *persistentPtr = new char[baName.size() + 1]; // +1为'\0'
|
|||
|
// memset(persistentPtr, 0, baName.size() + 1);
|
|||
|
// strcpy(persistentPtr, baName.constData());
|
|||
|
space.Name = this->m_Name.toStdString();// persistentPtr;
|
|||
|
// QByteArray baCommand = this->m_Command.toLatin1(); // must
|
|||
|
// char *persistentPtr1 = new char[baCommand.size() + 1]; // +1为'\0'
|
|||
|
// memset(persistentPtr1, 0, baCommand.size() + 1);
|
|||
|
// strcpy(persistentPtr1, baCommand.constData());
|
|||
|
space.Command = this->m_Command.toStdString();// persistentPtr1;
|
|||
|
space.ID = this->m_ID;
|
|||
|
space.CmdID = this->m_CmdID;
|
|||
|
space.Visible = this->m_Visible;
|
|||
|
space.Color = this->m_Color;
|
|||
|
space.Transparency = this->m_Transparency;
|
|||
|
space.Type = this->m_Type;
|
|||
|
IModel::copyQVectorToArray<int>(this->m_Src, space.Src);
|
|||
|
IModel::copyQVectorToArray<int>(this->m_SolidAddMode, space.SolidAddMode);
|
|||
|
space.MirrorDir = this->m_MirrorDir;
|
|||
|
space.MirrorOrgin = this->m_MirrorOrgin; // 镜像面位置,与MirrorDir匹配的分量坐标
|
|||
|
space.CopyOffsetX = this->m_CopyOffsetX; // 复制偏移分量,20170901 新增 by czb
|
|||
|
space.CopyOffsetY = this->m_CopyOffsetY; // 复制偏移分量
|
|||
|
space.CopyOffsetZ = this->m_CopyOffsetZ; // 复制偏移分量
|
|||
|
space.X1 = this->m_X1;
|
|||
|
space.X2 = this->m_X2;
|
|||
|
IModel::copyQVectorToArray<double>(this->LCharacterPoints, space.LCharacterPoints);
|
|||
|
IModel::copyQVectorToArray<double>(this->FCharacterPoints, space.FCharacterPoints);
|
|||
|
space.Y = this->m_Y;
|
|||
|
space.Z = this->m_Z;
|
|||
|
space.HullID = this->m_HullID;
|
|||
|
space.isUnit = this->m_IsUnit;
|
|||
|
space.numSections = this->m_NumSections;
|
|||
|
space.m_objType = (E_GEO_3D_OBJ_TYPE)this->m_objType;
|
|||
|
|
|||
|
return space;
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
};
|
|||
|
|
|||
|
// 附体
|
|||
|
struct DATAMANAGER_DLL_API_EXPORTS Appendage_M : public IModel
|
|||
|
{
|
|||
|
// 体运算方式:0并,1差,2交.
|
|||
|
QVector<int> m_SolidAddMode;
|
|||
|
// 是否负体:0否,1是
|
|||
|
int m_Minus;
|
|||
|
// 镜像面方向:1-X, 2-Y, 3-Z
|
|||
|
int m_MirrorDir;
|
|||
|
// 镜像面位置,与MirrorDir匹配的分量坐标
|
|||
|
double m_MirrorOrgin;
|
|||
|
// 复制偏移分量
|
|||
|
double m_CopyOffsetX; // 20170901 新增 by czb
|
|||
|
// 复制偏移分量
|
|||
|
double m_CopyOffsetY;
|
|||
|
// 复制偏移分量
|
|||
|
double m_CopyOffsetZ;
|
|||
|
Appendage_M()
|
|||
|
: m_SolidAddMode(),
|
|||
|
m_Minus(0),
|
|||
|
m_MirrorDir(0),
|
|||
|
m_MirrorOrgin(0.0),
|
|||
|
m_CopyOffsetX(0.0),
|
|||
|
m_CopyOffsetY(0.0),
|
|||
|
m_CopyOffsetZ(0.0)
|
|||
|
{
|
|||
|
setObjType(E_GEO_3D_OBJ_TYPE_APPENDAGE);
|
|||
|
}
|
|||
|
|
|||
|
IModel* Clone()
|
|||
|
{
|
|||
|
IModel* p = new Appendage_M();
|
|||
|
*p = *this;
|
|||
|
return p;
|
|||
|
}
|
|||
|
|
|||
|
Appendage getGeoAppendage()
|
|||
|
{
|
|||
|
Appendage appendage;
|
|||
|
// QByteArray baName = this->m_Name.toLatin1(); // must
|
|||
|
// char *persistentPtr = new char[baName.size() + 1]; // +1为'\0'
|
|||
|
// memset(persistentPtr, 0, baName.size() + 1);
|
|||
|
// strcpy(persistentPtr, baName.constData());
|
|||
|
appendage.Name = this->m_Name.toStdString();// persistentPtr;
|
|||
|
// QByteArray baCommand = this->m_Command.toLatin1(); // must
|
|||
|
// char *persistentPtr1 = new char[baCommand.size() + 1]; // +1为'\0'
|
|||
|
// memset(persistentPtr1, 0, baCommand.size() + 1);
|
|||
|
// strcpy(persistentPtr1, baCommand.constData());
|
|||
|
appendage.Command = this->m_Command.toStdString();// persistentPtr1;
|
|||
|
appendage.ID = this->m_ID;
|
|||
|
appendage.CmdID = this->m_CmdID;
|
|||
|
appendage.Visible = this->m_Visible;
|
|||
|
appendage.Color = this->m_Color;
|
|||
|
appendage.Transparency = this->m_Transparency;
|
|||
|
appendage.Type = this->m_Type;
|
|||
|
IModel::copyQVectorToArray<int>(this->m_Src, appendage.Src);
|
|||
|
IModel::copyQVectorToArray<int>(this->m_SolidAddMode, appendage.SolidAddMode);
|
|||
|
appendage.Minus = this->m_Minus; // 负体
|
|||
|
appendage.MirrorDir = this->m_MirrorDir;
|
|||
|
appendage.MirrorOrgin = this->m_MirrorOrgin; // 镜像面位置,与MirrorDir匹配的分量坐标
|
|||
|
appendage.CopyOffsetX = this->m_CopyOffsetX; // 复制偏移分量,20170901 新增 by czb
|
|||
|
appendage.CopyOffsetY = this->m_CopyOffsetY; // 复制偏移分量
|
|||
|
appendage.CopyOffsetZ = this->m_CopyOffsetZ; // 复制偏移分量
|
|||
|
|
|||
|
appendage.m_objType = (E_GEO_3D_OBJ_TYPE)this->m_objType;
|
|||
|
|
|||
|
return appendage;
|
|||
|
}
|
|||
|
|
|||
|
};
|
|||
|
|
|||
|
#endif
|