#ifndef STABILITY_MODEL_H #define STABILITY_MODEL_H #include "DataManager.h" #include "InlandModelGlobal.h" #include "OCC/OCCModeling/DllImportOccModeling.h" #include "ChangeFSPos.h" #include "OptionDataColorSetting.h" #include "CommandStreamProcessing.h" #include "StabilityUndoRedoManager.h" #ifdef __cplusplus extern "C" { #endif struct ModelBase3D { int color; // 颜色 }; struct Triangle3D : public ModelBase3D { std::vector v1; // 顶点1 std::vector v2; // 顶点2 std::vector v3; // 顶点3 int id; int visible; // 可见性 }; struct Line3D : public ModelBase3D { int id; std::vector dp; // 插值点 std::vector src; // 原始点 int visible; // 可见性 }; struct m_Point3D : public ModelBase3D { std::vector v1; // 起点 int id; int visible; // 可见性 }; struct m_Solid : public ModelBase3D//实体 { std::vector v1; // 顶点1 std::vector v2; // 顶点2 std::vector v3; // 顶点3 int id; int visible; // 可见性 }; struct m_mainbody : public ModelBase3D //主体 { std::vector v1; // 顶点1 std::vector v2; // 顶点2 std::vector v3; // 顶点3 int id; int visible; // 可见性 }; struct m_space : public ModelBase3D //舱室 { std::vector v1; // 顶点1 std::vector v2; // 顶点2 std::vector v3; // 顶点3 int id; int visible; // 可见性 bool isunit; // 是否是单元舱室 }; struct m_Appendage : public ModelBase3D //附体 { std::vector v1; // 顶点1 std::vector v2; // 顶点2 std::vector v3; // 顶点3 int id; int visible; // 可见性 }; // enum E_SHOW_OBJ_INFOR // { // E_SHOW_OBJ_INFOR_COMMAND = 0, // E_SHOW_OBJ_INFOR_XYZ, // E_SHOW_OBJ_INFOR_RIB_CRD, // E_SHOW_OBJ_INFOR_STATION_CRD, // E_SHOW_OBJ_INFOR_LOCATIE_OBJ, // E_SHOW_OBJ_INFOR_OBJ_CRD, // E_SHOW_OBJ_INFOR_OBJ_V, // E_SHOW_OBJ_INFOR_SIZE // }; class INLAND_DLL_API_EXPORTS StabilityModel { public: static StabilityModel *getStabilityModelInstance(); static void destroy(); DataManager *getDataManagerPtr(); static StabilityModel *getStabilityModelpPtr(); void loadXLSXFile(const QString &filePath); void get3DObjColor(int type,int& iColor,bool& isShowName); void readFile(XMLFile_Type type, const QString &filePath); ///----------------------------------------稳性计算-----------------start-------------------------------//// bool stabilityCalc(std::vector& commandLines, E_AnalysisModuleOperation_Type type); bool stabilityCalcMainContent(std::vector& commandLines); std::vector GetStabNodeOnly(std::vector& commandLines); void ExportBInfDef(); void ExportXLabel(); void CalFrame(std::map& Frames); void ExportFrame(string ID, double X); void CalStation(std::map& Stations); void ExportOffsetLabel(); ///----------------------------------------稳性计算-----------------end-------------------------------//// QString updateDelete3dToJson(vector& names); QString updateDelete3dToJson(string& name); void update3dToJson(json& outjson, E_GEO_3D_OBJ_TYPE type, int id = 0); QString getUpdate3dToJson(); QString getUpdate3dToJson(std::vector& ids); QString getUpdate_UI_StateJson(); void saveFile(QString& savefilePath); void modifyOutJson_color(json& j, const std::string& key, int new_color_value) ; void snap_point(SNAP_POINTS_Type iSelect, int &errorCode, QString &outMsg, QString &data, const QString &message); bool ShapeTom_mainBodyByFaceIndex(int &index, TopoDS_Shape &shape); bool ShapeToCellByFaceIndex(int &index, TopoDS_Shape &shape); bool ShapeToTriangleByFaceIndex(int &index, TopoDS_Shape &shape); std::vector DiscretePoints(TopoDS_Edge &curve, double dAngle, double dTol); std::vector DiscretePointsByAngle(Handle_Geom_BSplineCurve &curve, double dAngle, double dTol); bool ShapeToLineByFaceIndex(int &index, TopoDS_Shape &shape); bool ShapeTom_pointByFaceIndex(int &index, TopoDS_Shape &shape); bool ShapeToSolidByFaceIndex(int &index, TopoDS_Shape &shape); bool ShapeTom_spaceByFaceIndex(int &index, TopoDS_Shape &shape); bool ShapeTom_appendageByFaceIndex(int &index, TopoDS_Shape &shape); void ExportShapeToJsonFile(); void ExportShapeToJSON_nolhmann(nlohmann::json& jsonOutput); void ExportHullToJSON_nolhmann(nlohmann::json& jsonOutput); std::string CurveTypeToString(GeomAbs_CurveType type); bool create_point(std::string& singlecmdstring, QString &outJsonData); bool create_line(std::string& singlecmdstring, QString &outJsonData); bool create_surface(std::string& singlecmdstring, QString &outJsonData); bool create_solid(std::string& singlecmdstring, QString &outJsonData); bool create_Hull(std::string& singlecmdstring, QString &outJsonData); bool create_unit_and_space(std::string& singlecmdstring, QString &outJsonData); bool create_Appendage(std::string& singlecmdstring, QString &outJsonData); void stab_model_editor_hydro_static(int &errorCode, QString &outMsg, QString &data, const QString &message); void stab_model_editor_tank_cap(int &errorCode, QString &outMsg, QString &data, const QString &message); void stab_model_editor_intact(int &errorCode, QString &outMsg, QString &data, const QString &message); void stab_model_editor_allow_kg(int &errorCode, QString &outMsg, QString &data, const QString &message); void stab_model_editor_damage(int &errorCode, QString &outMsg, QString &data, const QString &message); void stab_model_editor_damage_prob(int &errorCode, QString &outMsg, QString &data, const QString &message); void stab_model_editor_inclining(int &errorCode, QString &outMsg, QString &data, const QString &message); void stab_model_editor_check(int &errorCode, QString &outMsg, QString &data, const QString &message); void stab_model_editor_save(int &errorCode, QString &outMsg, QString &data, const QString &message); void InitGeometry(); void InitHull(); void analysis_show_tree(int &errorCode, QString &outMsg, QString &data, const QString &message); void hull_show_tree(int &errorCode, QString &outMsg, QString &data, const QString &message); bool cmd_copy(std::string& singlecmdstring, QString &outJsonData); bool cmd_trim(std::string& singlecmdstring, QString &outJsonData); bool cmd_mirror(std::string& singlecmdstring, QString &outJsonData); bool cmd_intersection(std::string& singlecmdstring, QString &outJsonData); bool cmd_join(std::string& singlecmdstring, QString &outJsonData); bool cmd_delete(std::string& singlecmdstring, QString &outJsonData); void from(int &errorCode, QString &outMsg, QString &data, const QString &message); //bool setObjVisible(int id,int value); bool setObjVisible(std::string& singlecmdstring, QString &outJsonData); //void setvisible(int &errorCode, QString &outMsg, const nlohmann::json &j, const QString &originalStr); bool showWindowsLog(QString& log); //log 不能有空格 void addShowWindowsLog(QString log); //tool ship ------------start void tool_ship_prej_infor_from(const json& j); void tool_ship_prej_infor_to(json& j); void tool_ship_main_elements_from(const json& j); void tool_ship_main_elements_to(json& j); void tool_ship_hull_scale_from(const json& j); void tool_ship_hull_scale_to(json& j); //tool ship ------------end //bool Menu_toolbar_show_obj_infor(E_SHOW_OBJ_INFOR type,std::vector& ids,QString& outStr ); //获取obj infor bool Menu_toolbar_show_obj_infor_XYZ(std::vector& ids,QString& outStr ); //获取obj XYZ infor bool cmd_tool_show_obj_command(std::string& singlecmdstring, QString &outJsonData); //获取命令 bool cmd_tool_show_curve_rib_crd(std::vector& ids,bool isShowCoordF,QString& outStr ); //获取肋位号 //import iges file long ImportIGES(const json& j); long ImportIGES(std::string fileName, int impType, vector vTransfromParams, bool bIsAddMode); void ExportIGES(const json& j); void ImportDXF(QString filePath); void push_undo_redo_data(int icommandid, std::vector& data); void cmd_undo(QString& strDeleteJson, QString& strChangeJson); void cmd_redo(QString& strDeleteJson, QString& strChangeJson); //导入型值表 //横向横剖线 命令集 std::vector& getTransverseProfile_commad(); //梁拱命令 std::vector& getCamber_commad(); //绘制纵剖线 std::vector& getLongitudinalProfile_commad(); //水线 std::vector& getWaterLine_commad(); //空间线 std::vector& getSpaceLine_commad(); void setImportOffsetOption(ImportOffsetOption& _option); void autoAddExecutingCmdID() { if (m_pDataManager) { m_pDataManager->autoAddExecutingCmdID(); } } void setCurentUsingFilePath(QString filePath) { m_strCurentUsingFilePath = filePath; if(m_pDataManager) { m_pDataManager->setCurentUsingFilePath(m_strCurentUsingFilePath); } } QString getCurentUsingFilePath() { return m_strCurentUsingFilePath; } private: StabilityModel(); ~StabilityModel(); StabilityModel(const StabilityModel &) = delete; StabilityModel &operator=(const StabilityModel &) = delete; private: static StabilityModel *m_pStabilityModel; DataManager *m_pDataManager = nullptr; OCCStructDataMD *m_pDataMD = nullptr; std::map> m_solidsByFaceIndex; std::map> m_trianglesByFaceIndex; std::map> m_linesByFaceIndex; std::map> m_pointByFaceIndex; std::map> m_mainBodyByFaceIndex; //主体 std::map> m_spaceByFaceIndex; //舱室+单元体 ,tpye 0是舱室,1是单元体 std::map> m_appendageByFaceIndex; //附体 QString m_strCurentUsingFilePath = ""; XMLFile_Type m_eLoadDataType; }; #ifdef __cplusplus } #endif #endif // Stability_MODEL_H