272 lines
8.4 KiB
C
272 lines
8.4 KiB
C
|
#ifndef XLSXDataManager_H
|
|||
|
#define XLSXDataManager_H
|
|||
|
|
|||
|
#include <deque>
|
|||
|
#include <QString>
|
|||
|
#include <QSettings>
|
|||
|
#include <string>
|
|||
|
#include <vector>
|
|||
|
//#include <xlnt/xlnt.hpp>
|
|||
|
#include "DataManagerGlobal.h"
|
|||
|
#include "ModelData.h"
|
|||
|
#include "PathUtil.h"
|
|||
|
#include "xlnt/xlnt.hpp"
|
|||
|
using namespace std;
|
|||
|
|
|||
|
|
|||
|
class DATAMANAGER_DLL_API_EXPORTS ImportOffsetOption
|
|||
|
{
|
|||
|
public:
|
|||
|
ImportOffsetOption()
|
|||
|
{
|
|||
|
m_fSectionLen = 5;
|
|||
|
m_fBfY = 1;
|
|||
|
m_bCreateBL = true;
|
|||
|
m_bCreateWL = true;
|
|||
|
}
|
|||
|
|
|||
|
string m_szFilePath; // 导入型值表所在路径
|
|||
|
bool m_bCreateBL; // 是否导入控制点
|
|||
|
bool m_bCreateWL; // 是否创建水线
|
|||
|
double m_fSectionLen; // 船体分段长度,单位mm
|
|||
|
double m_fBfY; // 梁拱值
|
|||
|
public:
|
|||
|
// Getter and Setter functions
|
|||
|
string getFilePath() { return m_szFilePath; }
|
|||
|
void setFilePath( string& filePath) { m_szFilePath = filePath; }
|
|||
|
|
|||
|
bool getCreateBL() { return m_bCreateBL; }
|
|||
|
void setCreateBL(bool createBL) { m_bCreateBL = createBL; }
|
|||
|
|
|||
|
bool getCreateWL() { return m_bCreateWL; }
|
|||
|
void setCreateWL(bool createWL) { m_bCreateWL = createWL; }
|
|||
|
|
|||
|
float getSectionLen() { return m_fSectionLen; }
|
|||
|
void setSectionLen(float sectionLen) { m_fSectionLen = sectionLen; }
|
|||
|
|
|||
|
float getBfY() { return m_fBfY; }
|
|||
|
void setBfY(float bfY) { m_fBfY = bfY; }
|
|||
|
};
|
|||
|
|
|||
|
// 型值点
|
|||
|
class DATAMANAGER_DLL_API_EXPORTS OffsetPnt
|
|||
|
{
|
|||
|
public:
|
|||
|
int m_nStIdx; // 横剖线的编号
|
|||
|
double m_fStIdx; // 站号
|
|||
|
double m_fStOffset; // 相对于站号的偏移量
|
|||
|
double m_Y; // Y值
|
|||
|
double m_Z; // Z值
|
|||
|
bool m_bIsZhejiao; // 是否为折角点
|
|||
|
public:
|
|||
|
// Getter and Setter functions
|
|||
|
int getnStIdx() { return m_nStIdx; }
|
|||
|
void setnStIdx(int stIdx) { m_nStIdx = stIdx; }
|
|||
|
|
|||
|
double getfStIdxVal() { return m_fStIdx; }
|
|||
|
void setfStIdxVal(double stIdx) { m_fStIdx = stIdx; }
|
|||
|
|
|||
|
double getStOffset() { return m_fStOffset; }
|
|||
|
void setStOffset(double stOffset) { m_fStOffset = stOffset; }
|
|||
|
|
|||
|
double getY() { return m_Y; }
|
|||
|
void setY(double Y) { m_Y = Y; }
|
|||
|
|
|||
|
double getZ() { return m_Z; }
|
|||
|
void setZ(double Z) { m_Z = Z; }
|
|||
|
|
|||
|
bool isZhejiao() { return m_bIsZhejiao; }
|
|||
|
void setIsZhejiao(bool isZhejiao) { m_bIsZhejiao = isZhejiao; }
|
|||
|
};
|
|||
|
|
|||
|
// 横剖线
|
|||
|
class DATAMANAGER_DLL_API_EXPORTS STLine
|
|||
|
{
|
|||
|
public:
|
|||
|
string m_name; // 型线名称
|
|||
|
string m_cmdName; // 命令名称
|
|||
|
double m_fStIdx; // 站号
|
|||
|
double m_fStOffset; // 相对于站号的偏移量
|
|||
|
vector<OffsetPnt> m_ctrlPntLst; // 控制点集
|
|||
|
public:
|
|||
|
// Getter and Setter functions
|
|||
|
string getName() { return m_name; }
|
|||
|
void setName( string name) { m_name = name; }
|
|||
|
|
|||
|
string getCmdName() { return m_cmdName; }
|
|||
|
void setCmdName( string cmdName) { m_cmdName = cmdName; }
|
|||
|
|
|||
|
double getfStIdx() { return m_fStIdx; }
|
|||
|
void setfStIdx(double stIdx) { m_fStIdx = stIdx; }
|
|||
|
|
|||
|
double getStOffset() { return m_fStOffset; }
|
|||
|
void setStOffset(double stOffset) { m_fStOffset = stOffset; }
|
|||
|
|
|||
|
vector<OffsetPnt>& getCtrlPntLst() { return m_ctrlPntLst; }
|
|||
|
void setCtrlPntLst( vector<OffsetPnt>& ctrlPntLst) { m_ctrlPntLst = ctrlPntLst; }
|
|||
|
};
|
|||
|
|
|||
|
// 纵剖线
|
|||
|
class DATAMANAGER_DLL_API_EXPORTS BLLine
|
|||
|
{
|
|||
|
public:
|
|||
|
string m_name; // 型线名称
|
|||
|
double m_Y; // Y值
|
|||
|
vector<OffsetPnt> m_ctrlPntLst; // 控制点集
|
|||
|
public:
|
|||
|
// Getter and Setter functions
|
|||
|
string getName() { return m_name; }
|
|||
|
void setName( string& name) { m_name = name; }
|
|||
|
|
|||
|
double getY() { return m_Y; }
|
|||
|
void setY(double Y) { m_Y = Y; }
|
|||
|
|
|||
|
vector<OffsetPnt>& getCtrlPntLst() { return m_ctrlPntLst; }
|
|||
|
void setCtrlPntLst( vector<OffsetPnt>& ctrlPntLst) { m_ctrlPntLst = ctrlPntLst; }
|
|||
|
};
|
|||
|
|
|||
|
// 水线
|
|||
|
class DATAMANAGER_DLL_API_EXPORTS WLLine
|
|||
|
{
|
|||
|
public:
|
|||
|
string m_name; // 型线名称
|
|||
|
double m_Z; // Z值
|
|||
|
vector<OffsetPnt> m_ctrlPntLst; // 控制点集
|
|||
|
public:
|
|||
|
// Getter and Setter functions
|
|||
|
string getName() { return m_name; }
|
|||
|
void setName( string& name) { m_name = name; }
|
|||
|
|
|||
|
double getZ() { return m_Z; }
|
|||
|
void setZ(double Z) { m_Z = Z; }
|
|||
|
|
|||
|
vector<OffsetPnt>& getCtrlPntLst() { return m_ctrlPntLst; }
|
|||
|
void setCtrlPntLst( vector<OffsetPnt>& ctrlPntLst) { m_ctrlPntLst = ctrlPntLst; }
|
|||
|
};
|
|||
|
|
|||
|
// 空间线
|
|||
|
class DATAMANAGER_DLL_API_EXPORTS SpaceLine
|
|||
|
{
|
|||
|
public:
|
|||
|
string m_name; // 型线名称
|
|||
|
vector<OffsetPnt> m_ctrlPntLst; // 控制点集
|
|||
|
public:
|
|||
|
// Getter and Setter functions
|
|||
|
string getName() { return m_name; }
|
|||
|
void setName( string& name) { m_name = name; }
|
|||
|
|
|||
|
vector<OffsetPnt>& getCtrlPntLst() { return m_ctrlPntLst; }
|
|||
|
void setCtrlPntLst( vector<OffsetPnt>& ctrlPntLst) { m_ctrlPntLst = ctrlPntLst; }
|
|||
|
};
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
class DATAMANAGER_DLL_API_EXPORTS XLSXDataManager
|
|||
|
{
|
|||
|
public:
|
|||
|
XLSXDataManager();
|
|||
|
~XLSXDataManager();
|
|||
|
|
|||
|
void loadXLSXFile(std::string filePaht);
|
|||
|
|
|||
|
void setModeData(ModelData* _pModeData)
|
|||
|
{
|
|||
|
m_pModeData = _pModeData;
|
|||
|
}
|
|||
|
|
|||
|
void setImportOffsetOption(ImportOffsetOption& _option)
|
|||
|
{
|
|||
|
m_impOption = _option;
|
|||
|
}
|
|||
|
//横向横剖线 命令集
|
|||
|
std::vector<std::string>& getTransverseProfile_commad()
|
|||
|
{
|
|||
|
return m_vTransverseProfile_commad;
|
|||
|
}
|
|||
|
//梁拱命令
|
|||
|
std::vector<std::string>& getCamber_commad()
|
|||
|
{
|
|||
|
return m_vCamber_commad;
|
|||
|
}
|
|||
|
//绘制纵剖线
|
|||
|
std::vector<std::string>& getLongitudinalProfile_commad()
|
|||
|
{
|
|||
|
return m_vLongitudinalProfile_commad;
|
|||
|
}
|
|||
|
//水线
|
|||
|
std::vector<std::string>& getWaterLine_commad()
|
|||
|
{
|
|||
|
return m_vWaterLine_commad;
|
|||
|
}
|
|||
|
//空间线
|
|||
|
std::vector<std::string>& getSpaceLine_commad()
|
|||
|
{
|
|||
|
return m_vSpaceLine_commad;
|
|||
|
}
|
|||
|
private:
|
|||
|
void GetStLineIdxAndOffset(string stLinestr, float& fSTIdx, float& fStOffset, STLine& tempSTLine);
|
|||
|
//获取站号线的站号以及偏移量
|
|||
|
void GetStLineIdxAndOffset(const std::string& stLinestr, double& fSTIdx, double& fStOffset) ;
|
|||
|
bool IsDouble(const std::string& str);
|
|||
|
bool IsNullOrEmptyAfterTrim(const std::string& str);
|
|||
|
|
|||
|
bool GetStationLine_H(xlnt::worksheet& heightSheet, xlnt::worksheet& halfBreadthSheet, float xSubSectionLen, float fSTIdx, float fStOffset, int rowIndex, vector<OffsetPnt>& pntLst, vector<int>& nH);
|
|||
|
bool GetStationLine_W(xlnt::worksheet& halfBreadthSheet, float xSubSectionLen, float fSTIdx, float fStOffset, int rowIndex, std::vector<OffsetPnt>& pntLst, std::vector<int>& nW);
|
|||
|
|
|||
|
xlnt::cell_vector get_row_by_index(xlnt::worksheet& sheet, int row_idx) ;
|
|||
|
|
|||
|
void insertPnt1(OffsetPnt& pnt1, std::vector<OffsetPnt>& mergePntLst, int& np);
|
|||
|
void insertPnt(std::vector<OffsetPnt>& pntLst_W, std::vector<OffsetPnt>& mergePntLst);
|
|||
|
|
|||
|
bool GetHalfBreadth(xlnt::worksheet& halfBreadthSheet, string sLineName, int rowIndex, double& dHalfBreath);
|
|||
|
|
|||
|
bool GetFlatSideHalfBreath(xlnt::worksheet& halfBreadthSheet, int rowIndex, double& dHalfBreath);
|
|||
|
|
|||
|
void SortBLLine(vector<OffsetPnt>& srcLst, vector<OffsetPnt>& sortLst);
|
|||
|
|
|||
|
//生成带引用的空间线命令 cqr-20210927
|
|||
|
void CmdSpaceline(std::vector<STLine>& STLineLst,
|
|||
|
SpaceLine& SpaceLineLst,
|
|||
|
std::string& cmd) ;
|
|||
|
|
|||
|
void clear()
|
|||
|
{
|
|||
|
std::vector<std::string> _vTransverseProfile_commad;
|
|||
|
_vTransverseProfile_commad.swap(m_vTransverseProfile_commad);
|
|||
|
|
|||
|
//梁拱命令
|
|||
|
std::vector<std::string> _vCamber_commad;
|
|||
|
_vCamber_commad.swap(m_vCamber_commad);
|
|||
|
//绘制纵剖线
|
|||
|
std::vector<std::string> _vLongitudinalProfile_commad;
|
|||
|
_vLongitudinalProfile_commad.swap(m_vLongitudinalProfile_commad);
|
|||
|
|
|||
|
//水线
|
|||
|
std::vector<std::string> _vWaterLine_commad;
|
|||
|
_vWaterLine_commad.swap(m_vWaterLine_commad);
|
|||
|
//空间线
|
|||
|
std::vector<std::string> _vSpaceLine_commad;
|
|||
|
_vSpaceLine_commad.swap(m_vSpaceLine_commad);
|
|||
|
}
|
|||
|
private:
|
|||
|
|
|||
|
//横剖线 命令集
|
|||
|
std::vector<std::string> m_vTransverseProfile_commad;
|
|||
|
|
|||
|
//梁拱命令
|
|||
|
std::vector<std::string> m_vCamber_commad;
|
|||
|
//绘制纵剖线
|
|||
|
std::vector<std::string> m_vLongitudinalProfile_commad;
|
|||
|
|
|||
|
//水线
|
|||
|
std::vector<std::string> m_vWaterLine_commad;
|
|||
|
//空间线
|
|||
|
std::vector<std::string> m_vSpaceLine_commad;
|
|||
|
|
|||
|
|
|||
|
ImportOffsetOption m_impOption;
|
|||
|
ModelData* m_pModeData = nullptr;//外界赋值
|
|||
|
};
|
|||
|
|
|||
|
#endif // FIFOCONTAINER_H
|