1218 lines
43 KiB
C++
1218 lines
43 KiB
C++
|
#pragma execution_character_set("utf-8")
|
|||
|
#include "ToolUIFunction.h"
|
|||
|
#include "Logger.h"
|
|||
|
#include "CommandStreamProcessing.h"
|
|||
|
#include <mutex>
|
|||
|
|
|||
|
#define BIND(func) std::bind(&ToolUIFunction::func, this, std::placeholders::_1)
|
|||
|
std::mutex lupdate3dMutex;
|
|||
|
|
|||
|
ToolUIFunction::ToolUIFunction()
|
|||
|
{
|
|||
|
connect(this, &ToolUIFunction::update3dFunction, this, &ToolUIFunction::onUpdate3dFunction);
|
|||
|
|
|||
|
ccsMessageHandle::instance()->register_callback(BIND(snap_start_point), CMD_tool_snap_start_point);
|
|||
|
ccsMessageHandle::instance()->register_callback(BIND(snap_end_point), CMD_tool_snap_end_point);
|
|||
|
ccsMessageHandle::instance()->register_callback(BIND(snap_line_point), CMD_tool_snap_line_point);
|
|||
|
ccsMessageHandle::instance()->register_callback(BIND(snap_any_point), CMD_tool_snap_any_point);
|
|||
|
ccsMessageHandle::instance()->register_callback(BIND(snap_cross_point), CMD_tool_snap_cross_point);
|
|||
|
ccsMessageHandle::instance()->register_callback(BIND(create_point), CMD_tool_create_point);
|
|||
|
ccsMessageHandle::instance()->register_callback(BIND(create_line), CMD_tool_create_line);
|
|||
|
ccsMessageHandle::instance()->register_callback(BIND(create_surface), CMD_tool_create_surface);
|
|||
|
ccsMessageHandle::instance()->register_callback(BIND(create_solid), CMD_tool_create_solid);
|
|||
|
ccsMessageHandle::instance()->register_callback(BIND(setObjVisible), CMD_value_from);
|
|||
|
ccsMessageHandle::instance()->register_callback(BIND(create_hull), CMD_tool_create_mainbody);
|
|||
|
ccsMessageHandle::instance()->register_callback(BIND(create_unit), CMD_tool_create_unit);
|
|||
|
ccsMessageHandle::instance()->register_callback(BIND(create_space), CMD_tool_create_space);
|
|||
|
ccsMessageHandle::instance()->register_callback(BIND(create_appendage), CMD_tool_create_appendage);
|
|||
|
ccsMessageHandle::instance()->register_callback(BIND(stab_model_editor_hydro_static), CMD_stab_model_editor_hydro_static);
|
|||
|
ccsMessageHandle::instance()->register_callback(BIND(stab_model_editor_tank_cap), CMD_stab_model_editor_tank_cap);
|
|||
|
ccsMessageHandle::instance()->register_callback(BIND(stab_model_editor_intact), CMD_stab_model_editor_intact);
|
|||
|
ccsMessageHandle::instance()->register_callback(BIND(stab_model_editor_allow_kg), CMD_stab_model_editor_allow_kg);
|
|||
|
ccsMessageHandle::instance()->register_callback(BIND(stab_model_editor_damage), CMD_stab_model_editor_damage);
|
|||
|
ccsMessageHandle::instance()->register_callback(BIND(stab_model_editor_damage_prob), CMD_stab_model_editor_damage_prob);
|
|||
|
ccsMessageHandle::instance()->register_callback(BIND(stab_model_editor_inclining), CMD_stab_model_editor_inclining);
|
|||
|
ccsMessageHandle::instance()->register_callback(BIND(stab_model_editor_save), CMD_stab_model_editor_save);
|
|||
|
ccsMessageHandle::instance()->register_callback(BIND(stab_model_editor_check), CMD_stab_model_editor_check);
|
|||
|
|
|||
|
ccsMessageHandle::instance()->register_callback(BIND(cmd_copy), CMD_tool_copy);
|
|||
|
ccsMessageHandle::instance()->register_callback(BIND(cmd_trim), CMD_tool_trim);
|
|||
|
ccsMessageHandle::instance()->register_callback(BIND(cmd_mirror), CMD_tool_mirror);
|
|||
|
ccsMessageHandle::instance()->register_callback(BIND(cmd_intersection), CMD_tool_intersection);
|
|||
|
ccsMessageHandle::instance()->register_callback(BIND(cmd_join), CMD_tool_join);
|
|||
|
ccsMessageHandle::instance()->register_callback(BIND(cmd_delete), CMD_tool_delete);
|
|||
|
ccsMessageHandle::instance()->register_callback(BIND(cmd_undo), CMD_tool_undo);
|
|||
|
ccsMessageHandle::instance()->register_callback(BIND(cmd_redo), CMD_tool_redo);
|
|||
|
|
|||
|
|
|||
|
ccsMessageHandle::instance()->register_callback(BIND(hull_show_tree), CMD_hull_show_tree);
|
|||
|
ccsMessageHandle::instance()->register_callback(BIND(structure_show_tree), CMD_structure_show_tree);
|
|||
|
ccsMessageHandle::instance()->register_callback(BIND(analysis_show_tree), CMD_analysis_show_tree);
|
|||
|
ccsMessageHandle::instance()->register_callback(BIND(result_show_tree), CMD_result_show_tree);
|
|||
|
|
|||
|
ccsMessageHandle::instance()->register_callback(BIND(cmd_tool_show_obj_command), CMD_tool_show_obj_command);
|
|||
|
ccsMessageHandle::instance()->register_callback(BIND(cmd_tool_show_pt_curve_xyz), CMD_tool_show_pt_curve_xyz);
|
|||
|
ccsMessageHandle::instance()->register_callback(BIND(cmd_tool_show_curve_rib_crd), CMD_tool_show_curve_rib_crd);
|
|||
|
ccsMessageHandle::instance()->register_callback(BIND(cmd_tool_show_curve_station_points_crd), CMD_tool_show_curve_station_points_crd);
|
|||
|
ccsMessageHandle::instance()->register_callback(BIND(cmd_tool_find_and_locate_obj), CMD_tool_find_and_locate_obj);
|
|||
|
ccsMessageHandle::instance()->register_callback(BIND(cmd_tool_find_obj_crd), CMD_tool_find_obj_crd);
|
|||
|
ccsMessageHandle::instance()->register_callback(BIND(cmd_tool_find_obj_V), CMD_tool_find_obj_V);
|
|||
|
|
|||
|
ccsMessageHandle::instance()->register_callback(BIND(command_stream_modeling), CMD_command_stream_modeling);
|
|||
|
|
|||
|
ccsMessageHandle::instance()->register_callback(BIND(certify_Tonnage), CMD_certify_Tonnage);
|
|||
|
|
|||
|
ccsMessageHandle::instance()->register_callback(BIND(certify_save_Tonnage), CMD_certify_save_Tonnage);
|
|||
|
|
|||
|
ccsMessageHandle::instance()->register_callback(BIND(certify_check_Tonnage), CMD_certify_check_Tonnage);
|
|||
|
|
|||
|
ccsMessageHandle::instance()->register_callback(BIND(certify_create_cal), CMD_certify_create_cal);
|
|||
|
ccsMessageHandle::instance()->register_callback(BIND(certify_cal), CMD_certify_cal);
|
|||
|
ccsMessageHandle::instance()->register_callback(BIND(certify_delete_cal), CMD_certify_delete_cal);
|
|||
|
|
|||
|
ccsMessageHandle::instance()->register_callback(BIND(certify_EEDI), CMD_certify_EEDI);
|
|||
|
|
|||
|
ccsMessageHandle::instance()->register_callback(BIND(certify_EEDI_save), CMD_certify_save_EEDI);
|
|||
|
ccsMessageHandle::instance()->register_callback(BIND(certify_EEDI_check), CMD_certify_check_EEDI);
|
|||
|
|
|||
|
|
|||
|
LOG_DEBUG("ToolUIFunction Constructed");
|
|||
|
}
|
|||
|
|
|||
|
ToolUIFunction::~ToolUIFunction()
|
|||
|
{
|
|||
|
ccsMessageHandle::instance()->unregister_callback(CMD_tool_snap_start_point);
|
|||
|
ccsMessageHandle::instance()->unregister_callback(CMD_tool_snap_end_point);
|
|||
|
ccsMessageHandle::instance()->unregister_callback(CMD_tool_snap_line_point);
|
|||
|
ccsMessageHandle::instance()->unregister_callback(CMD_tool_snap_any_point);
|
|||
|
ccsMessageHandle::instance()->unregister_callback(CMD_tool_snap_cross_point);
|
|||
|
ccsMessageHandle::instance()->unregister_callback(CMD_tool_create_point);
|
|||
|
ccsMessageHandle::instance()->unregister_callback(CMD_tool_create_line);
|
|||
|
ccsMessageHandle::instance()->unregister_callback(CMD_tool_create_surface);
|
|||
|
ccsMessageHandle::instance()->unregister_callback(CMD_tool_create_solid);
|
|||
|
ccsMessageHandle::instance()->unregister_callback(CMD_value_from);
|
|||
|
ccsMessageHandle::instance()->unregister_callback(CMD_stab_model_editor_hydro_static);
|
|||
|
ccsMessageHandle::instance()->unregister_callback(CMD_stab_model_editor_tank_cap);
|
|||
|
ccsMessageHandle::instance()->unregister_callback(CMD_stab_model_editor_save);
|
|||
|
ccsMessageHandle::instance()->unregister_callback(CMD_stab_model_editor_check);
|
|||
|
ccsMessageHandle::instance()->unregister_callback(CMD_stab_model_editor_intact);
|
|||
|
ccsMessageHandle::instance()->unregister_callback(CMD_stab_model_editor_allow_kg);
|
|||
|
ccsMessageHandle::instance()->unregister_callback(CMD_stab_model_editor_damage);
|
|||
|
ccsMessageHandle::instance()->unregister_callback(CMD_stab_model_editor_damage_prob);
|
|||
|
ccsMessageHandle::instance()->unregister_callback(CMD_stab_model_editor_inclining);
|
|||
|
ccsMessageHandle::instance()->unregister_callback(CMD_tool_create_mainbody);
|
|||
|
ccsMessageHandle::instance()->unregister_callback(CMD_tool_create_unit);
|
|||
|
ccsMessageHandle::instance()->unregister_callback(CMD_tool_create_space);
|
|||
|
ccsMessageHandle::instance()->unregister_callback(CMD_tool_create_appendage);
|
|||
|
ccsMessageHandle::instance()->unregister_callback(CMD_tool_copy);
|
|||
|
ccsMessageHandle::instance()->unregister_callback(CMD_tool_trim);
|
|||
|
ccsMessageHandle::instance()->unregister_callback(CMD_tool_mirror);
|
|||
|
ccsMessageHandle::instance()->unregister_callback(CMD_tool_intersection);
|
|||
|
ccsMessageHandle::instance()->unregister_callback(CMD_tool_join);
|
|||
|
ccsMessageHandle::instance()->unregister_callback(CMD_tool_delete);
|
|||
|
|
|||
|
ccsMessageHandle::instance()->unregister_callback(CMD_hull_show_tree);
|
|||
|
ccsMessageHandle::instance()->unregister_callback(CMD_structure_show_tree);
|
|||
|
ccsMessageHandle::instance()->unregister_callback(CMD_analysis_show_tree);
|
|||
|
ccsMessageHandle::instance()->unregister_callback(CMD_result_show_tree);
|
|||
|
|
|||
|
ccsMessageHandle::instance()->unregister_callback(CMD_tool_show_obj_command);
|
|||
|
ccsMessageHandle::instance()->unregister_callback(CMD_tool_show_pt_curve_xyz);
|
|||
|
ccsMessageHandle::instance()->unregister_callback(CMD_tool_show_curve_rib_crd);
|
|||
|
ccsMessageHandle::instance()->unregister_callback(CMD_tool_show_curve_station_points_crd);
|
|||
|
ccsMessageHandle::instance()->unregister_callback(CMD_tool_find_and_locate_obj);
|
|||
|
ccsMessageHandle::instance()->unregister_callback(CMD_tool_find_obj_crd);
|
|||
|
ccsMessageHandle::instance()->unregister_callback(CMD_tool_find_obj_V);
|
|||
|
|
|||
|
ccsMessageHandle::instance()->unregister_callback(CMD_command_stream_modeling);
|
|||
|
|
|||
|
ccsMessageHandle::instance()->unregister_callback(CMD_certify_Tonnage);
|
|||
|
ccsMessageHandle::instance()->unregister_callback(CMD_certify_save_Tonnage);
|
|||
|
ccsMessageHandle::instance()->unregister_callback(CMD_certify_check_Tonnage);
|
|||
|
ccsMessageHandle::instance()->unregister_callback(CMD_certify_create_cal);
|
|||
|
ccsMessageHandle::instance()->unregister_callback(CMD_certify_cal);
|
|||
|
ccsMessageHandle::instance()->unregister_callback(CMD_certify_delete_cal);
|
|||
|
ccsMessageHandle::instance()->unregister_callback(CMD_certify_EEDI);
|
|||
|
ccsMessageHandle::instance()->unregister_callback(CMD_certify_save_EEDI);
|
|||
|
ccsMessageHandle::instance()->unregister_callback(CMD_certify_check_EEDI);
|
|||
|
|
|||
|
LOG_DEBUG("ToolUIFunction Destroyed");
|
|||
|
}
|
|||
|
|
|||
|
void ToolUIFunction::setObjVisible(const QString &message)
|
|||
|
{
|
|||
|
QString outMsg;
|
|||
|
int errorCode = 0;
|
|||
|
QString outJsonData = "";
|
|||
|
|
|||
|
std::string cmdstring;
|
|||
|
bool isCancel = false;
|
|||
|
bool bRet = getMessageString(message, cmdstring, outMsg, isCancel);
|
|||
|
int cmd = CMD_value_from;
|
|||
|
if (isCancel)
|
|||
|
{
|
|||
|
QString strLog = QString::fromStdString(cmdstring);
|
|||
|
strLog += "命令放弃执行" + PathUtil::getEndMark();
|
|||
|
addShowWindowsLog(strLog);
|
|||
|
bRet = false;
|
|||
|
}
|
|||
|
|
|||
|
if (!bRet)
|
|||
|
{
|
|||
|
QtToWebFunction::getInstance().qt2web(cmd, EXECUTE_FAIL, "创建失败", "");
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
|
|||
|
bRet = getStabilityModelPtr()->setObjVisible(cmdstring, outJsonData);
|
|||
|
if (!bRet)
|
|||
|
{
|
|||
|
QtToWebFunction::getInstance().qt2web(cmd, EXECUTE_FAIL, "创建失败", "");
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
QtToWebFunction::getInstance().qt2web(cmd, EXECUTE_SUCCESS, outMsg, "");
|
|||
|
QtToWebFunction::getInstance().qt2web(CMD_update_3d, EXECUTE_SUCCESS, outMsg, outJsonData);
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
void ToolUIFunction::from(const QString &message)
|
|||
|
{
|
|||
|
}
|
|||
|
|
|||
|
void ToolUIFunction::to(json)
|
|||
|
{
|
|||
|
}
|
|||
|
|
|||
|
void ToolUIFunction::snap_start_point(const QString &message)
|
|||
|
{
|
|||
|
int errorCode = 0;
|
|||
|
QString data = "";
|
|||
|
QString outMsg;
|
|||
|
getStabilityModelPtr()->snap_point(SNAP_POINTS_Type_START, errorCode, outMsg, data, message);
|
|||
|
// QString jsonMsg = QtToWebFunction::getInstance().createMsg(CMD_tool_snap_start_point, errorCode, outMsg, data);
|
|||
|
QtToWebFunction::getInstance().qt2web(CMD_tool_snap_start_point, errorCode, outMsg, data);
|
|||
|
}
|
|||
|
void ToolUIFunction::snap_end_point(const QString &message)
|
|||
|
{
|
|||
|
int errorCode = 0;
|
|||
|
QString data = "";
|
|||
|
QString outMsg;
|
|||
|
getStabilityModelPtr()->snap_point(SNAP_POINTS_Type_END, errorCode, outMsg, data, message);
|
|||
|
// QString jsonMsg = QtToWebFunction::getInstance().createMsg(CMD_tool_snap_end_point, errorCode, outMsg, data);
|
|||
|
QtToWebFunction::getInstance().qt2web(CMD_tool_snap_end_point, errorCode, outMsg, data);
|
|||
|
}
|
|||
|
void ToolUIFunction::snap_line_point(const QString &message)
|
|||
|
{
|
|||
|
int errorCode = 0;
|
|||
|
QString data = "";
|
|||
|
QString outMsg;
|
|||
|
getStabilityModelPtr()->snap_point(SNAP_POINTS_Type_LINE_POINT, errorCode, outMsg, data, message);
|
|||
|
// QString jsonMsg = QtToWebFunction::getInstance().createMsg(CMD_tool_snap_line_point, errorCode, outMsg, data);
|
|||
|
QtToWebFunction::getInstance().qt2web(CMD_tool_snap_line_point, errorCode, outMsg, data);
|
|||
|
}
|
|||
|
void ToolUIFunction::snap_any_point(const QString &message)
|
|||
|
{
|
|||
|
int errorCode = 0;
|
|||
|
QString data = "";
|
|||
|
QString outMsg;
|
|||
|
getStabilityModelPtr()->snap_point(SNAP_POINTS_Type_ANY_POINT, errorCode, outMsg, data, message);
|
|||
|
// QString jsonMsg = QtToWebFunction::getInstance().createMsg(CMD_tool_snap_any_point, errorCode, outMsg, data);
|
|||
|
QtToWebFunction::getInstance().qt2web(CMD_tool_snap_any_point, errorCode, outMsg, data);
|
|||
|
}
|
|||
|
void ToolUIFunction::snap_cross_point(const QString &message)
|
|||
|
{
|
|||
|
int errorCode = 0;
|
|||
|
QString data = "";
|
|||
|
QString outMsg;
|
|||
|
getStabilityModelPtr()->snap_point(SNAP_POINTS_Type_CROSS_POINT, errorCode, outMsg, data, message);
|
|||
|
// QString jsonMsg = QtToWebFunction::getInstance().createMsg(CMD_tool_snap_cross_point, errorCode, outMsg, data);
|
|||
|
QtToWebFunction::getInstance().qt2web(CMD_tool_snap_cross_point, errorCode, outMsg, data);
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
|
|||
|
void ToolUIFunction::create_point(const QString &message)
|
|||
|
{
|
|||
|
QString outMsg;
|
|||
|
int errorCode = 0;
|
|||
|
QString outJsonData = "";
|
|||
|
|
|||
|
std::string cmdstring;
|
|||
|
bool isCancel = false;
|
|||
|
bool bRet = getMessageString(message, cmdstring, outMsg, isCancel);
|
|||
|
int cmd = CMD_tool_create_point;
|
|||
|
if (isCancel)
|
|||
|
{
|
|||
|
QString strLog = QString::fromStdString(cmdstring);
|
|||
|
strLog += "命令放弃执行" + PathUtil::getEndMark();
|
|||
|
addShowWindowsLog(strLog);
|
|||
|
bRet = false;
|
|||
|
}
|
|||
|
|
|||
|
if (!bRet)
|
|||
|
{
|
|||
|
QtToWebFunction::getInstance().qt2web(cmd, EXECUTE_FAIL, "创建失败", "");
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
|
|||
|
bRet = getStabilityModelPtr()->create_point(cmdstring, outJsonData);
|
|||
|
if (!bRet)
|
|||
|
{
|
|||
|
QtToWebFunction::getInstance().qt2web(cmd, EXECUTE_FAIL, "创建失败", "");
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
getStabilityModelPtr()->autoAddExecutingCmdID();
|
|||
|
QtToWebFunction::getInstance().qt2web(cmd, EXECUTE_SUCCESS, outMsg, "");
|
|||
|
QtToWebFunction::getInstance().qt2web(CMD_update_3d, EXECUTE_SUCCESS, outMsg, outJsonData);
|
|||
|
update_ui_state();
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
void ToolUIFunction::create_line(const QString &message)
|
|||
|
{
|
|||
|
QString outMsg;
|
|||
|
int errorCode = 0;
|
|||
|
QString outJsonData = "";
|
|||
|
|
|||
|
std::string cmdstring;
|
|||
|
bool isCancel = false;
|
|||
|
bool bRet = getMessageString(message, cmdstring, outMsg, isCancel);
|
|||
|
int cmd = CMD_tool_create_line;
|
|||
|
|
|||
|
if (isCancel)
|
|||
|
{
|
|||
|
QString strLog = QString::fromStdString(cmdstring);
|
|||
|
strLog += "命令放弃执行" + PathUtil::getEndMark();
|
|||
|
addShowWindowsLog(strLog);
|
|||
|
bRet = false;
|
|||
|
}
|
|||
|
|
|||
|
if (!bRet)
|
|||
|
{
|
|||
|
QtToWebFunction::getInstance().qt2web(cmd, EXECUTE_FAIL, "创建失败", "");
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
|
|||
|
bRet = getStabilityModelPtr()->create_line(cmdstring, outJsonData);
|
|||
|
if (!bRet)
|
|||
|
{
|
|||
|
QtToWebFunction::getInstance().qt2web(cmd, EXECUTE_FAIL, "创建失败", "");
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
getStabilityModelPtr()->autoAddExecutingCmdID();
|
|||
|
QtToWebFunction::getInstance().qt2web(cmd, EXECUTE_SUCCESS, outMsg, "");
|
|||
|
QtToWebFunction::getInstance().qt2web(CMD_update_3d, EXECUTE_SUCCESS, outMsg, outJsonData);
|
|||
|
update_ui_state();
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
void ToolUIFunction::create_surface(const QString &message)
|
|||
|
{
|
|||
|
QString outMsg;
|
|||
|
int errorCode = 0;
|
|||
|
QString outJsonData = "";
|
|||
|
|
|||
|
std::string cmdstring;
|
|||
|
bool isCancel = false;
|
|||
|
bool bRet = getMessageString(message, cmdstring, outMsg, isCancel);
|
|||
|
int cmd = CMD_tool_create_surface;
|
|||
|
if (isCancel)
|
|||
|
{
|
|||
|
QString strLog = QString::fromStdString(cmdstring);
|
|||
|
strLog += "命令放弃执行" + PathUtil::getEndMark();
|
|||
|
addShowWindowsLog(strLog);
|
|||
|
bRet = false;
|
|||
|
}
|
|||
|
|
|||
|
if (!bRet)
|
|||
|
{
|
|||
|
QtToWebFunction::getInstance().qt2web(cmd, EXECUTE_FAIL, "创建失败", "");
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
|
|||
|
bRet = getStabilityModelPtr()->create_surface(cmdstring, outJsonData);
|
|||
|
if (!bRet)
|
|||
|
{
|
|||
|
QtToWebFunction::getInstance().qt2web(cmd, EXECUTE_FAIL, "创建失败", "");
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
getStabilityModelPtr()->autoAddExecutingCmdID();
|
|||
|
QtToWebFunction::getInstance().qt2web(cmd, EXECUTE_SUCCESS, outMsg, "");
|
|||
|
QtToWebFunction::getInstance().qt2web(CMD_update_3d, EXECUTE_SUCCESS, outMsg, outJsonData);
|
|||
|
update_ui_state();
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
void ToolUIFunction::create_solid(const QString &message)
|
|||
|
{
|
|||
|
QString outMsg;
|
|||
|
int errorCode = 0;
|
|||
|
QString outJsonData = "";
|
|||
|
|
|||
|
std::string cmdstring;
|
|||
|
bool isCancel = false;
|
|||
|
bool bRet = getMessageString(message, cmdstring, outMsg, isCancel);
|
|||
|
int cmd = CMD_tool_create_solid;
|
|||
|
|
|||
|
if (isCancel)
|
|||
|
{
|
|||
|
QString strLog = QString::fromStdString(cmdstring);
|
|||
|
strLog += "命令放弃执行" + PathUtil::getEndMark();
|
|||
|
addShowWindowsLog(strLog);
|
|||
|
bRet = false;
|
|||
|
}
|
|||
|
|
|||
|
if (!bRet)
|
|||
|
{
|
|||
|
QtToWebFunction::getInstance().qt2web(cmd, EXECUTE_FAIL, "创建失败", "");
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
bRet = getStabilityModelPtr()->create_solid(cmdstring, outJsonData);
|
|||
|
if (!bRet)
|
|||
|
{
|
|||
|
QtToWebFunction::getInstance().qt2web(cmd, EXECUTE_FAIL, "创建失败", "");
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
getStabilityModelPtr()->autoAddExecutingCmdID();
|
|||
|
QtToWebFunction::getInstance().qt2web(cmd, EXECUTE_SUCCESS, outMsg, "");
|
|||
|
QtToWebFunction::getInstance().qt2web(CMD_update_3d, EXECUTE_SUCCESS, outMsg, outJsonData);
|
|||
|
update_ui_state();
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
void ToolUIFunction::create_hull(const QString &message)
|
|||
|
{
|
|||
|
QString outMsg;
|
|||
|
int errorCode = 0;
|
|||
|
QString outJsonData = "";
|
|||
|
|
|||
|
std::string cmdstring;
|
|||
|
bool isCancel = false;
|
|||
|
bool bRet = getMessageString(message, cmdstring, outMsg, isCancel);
|
|||
|
int cmd = CMD_tool_create_mainbody;
|
|||
|
|
|||
|
if (isCancel)
|
|||
|
{
|
|||
|
QString strLog = QString::fromStdString(cmdstring);
|
|||
|
strLog += "命令放弃执行" + PathUtil::getEndMark();
|
|||
|
addShowWindowsLog(strLog);
|
|||
|
bRet = false;
|
|||
|
}
|
|||
|
if (!bRet)
|
|||
|
{
|
|||
|
QtToWebFunction::getInstance().qt2web(cmd, EXECUTE_FAIL, "创建失败", "");
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
bRet = getStabilityModelPtr()->create_Hull(cmdstring, outJsonData);
|
|||
|
if (!bRet)
|
|||
|
{
|
|||
|
QtToWebFunction::getInstance().qt2web(cmd, EXECUTE_FAIL, "创建失败", "");
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
getStabilityModelPtr()->autoAddExecutingCmdID();
|
|||
|
QtToWebFunction::getInstance().qt2web(cmd, EXECUTE_SUCCESS, outMsg, "");
|
|||
|
QtToWebFunction::getInstance().qt2web(CMD_update_3d, EXECUTE_SUCCESS, outMsg, outJsonData);
|
|||
|
update_ui_state();
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
void ToolUIFunction::create_unit(const QString &message)
|
|||
|
{
|
|||
|
QString outMsg;
|
|||
|
int errorCode = 0;
|
|||
|
QString outJsonData = "";
|
|||
|
|
|||
|
std::string cmdstring;
|
|||
|
bool isCancel = false;
|
|||
|
bool bRet = getMessageString(message, cmdstring, outMsg, isCancel);
|
|||
|
int cmd = CMD_tool_create_unit;
|
|||
|
if (isCancel)
|
|||
|
{
|
|||
|
QString strLog = QString::fromStdString(cmdstring);
|
|||
|
strLog += "命令放弃执行" + PathUtil::getEndMark();
|
|||
|
addShowWindowsLog(strLog);
|
|||
|
bRet = false;
|
|||
|
}
|
|||
|
|
|||
|
if (!bRet)
|
|||
|
{
|
|||
|
QtToWebFunction::getInstance().qt2web(cmd, EXECUTE_FAIL, "创建失败", "");
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
|
|||
|
bRet = getStabilityModelPtr()->create_unit_and_space(cmdstring, outJsonData);
|
|||
|
if (!bRet)
|
|||
|
{
|
|||
|
QtToWebFunction::getInstance().qt2web(cmd, EXECUTE_FAIL, "创建失败", "");
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
getStabilityModelPtr()->autoAddExecutingCmdID();
|
|||
|
QtToWebFunction::getInstance().qt2web(cmd, EXECUTE_SUCCESS, outMsg, "");
|
|||
|
QtToWebFunction::getInstance().qt2web(CMD_update_3d, EXECUTE_SUCCESS, outMsg, outJsonData);
|
|||
|
update_ui_state();
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
void ToolUIFunction::create_space(const QString &message)
|
|||
|
{
|
|||
|
QString outMsg;
|
|||
|
int errorCode = 0;
|
|||
|
QString outJsonData = "";
|
|||
|
|
|||
|
std::string cmdstring;
|
|||
|
bool isCancel = false;
|
|||
|
bool bRet = getMessageString(message, cmdstring, outMsg, isCancel);
|
|||
|
int cmd = CMD_tool_create_space;
|
|||
|
if (isCancel)
|
|||
|
{
|
|||
|
QString strLog = QString::fromStdString(cmdstring);
|
|||
|
strLog += "命令放弃执行" + PathUtil::getEndMark();
|
|||
|
addShowWindowsLog(strLog);
|
|||
|
bRet = false;
|
|||
|
}
|
|||
|
|
|||
|
if (!bRet)
|
|||
|
{
|
|||
|
QtToWebFunction::getInstance().qt2web(cmd, EXECUTE_FAIL, "创建失败", "");
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
|
|||
|
bRet = getStabilityModelPtr()->create_unit_and_space(cmdstring, outJsonData);
|
|||
|
if (!bRet)
|
|||
|
{
|
|||
|
QtToWebFunction::getInstance().qt2web(cmd, EXECUTE_FAIL, "创建失败", "");
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
getStabilityModelPtr()->autoAddExecutingCmdID();
|
|||
|
QtToWebFunction::getInstance().qt2web(cmd, EXECUTE_SUCCESS, outMsg, "");
|
|||
|
QtToWebFunction::getInstance().qt2web(CMD_update_3d, EXECUTE_SUCCESS, outMsg, outJsonData);
|
|||
|
update_ui_state();
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
void ToolUIFunction::create_appendage(const QString &message)
|
|||
|
{
|
|||
|
QString outMsg;
|
|||
|
int errorCode = 0;
|
|||
|
QString outJsonData = "";
|
|||
|
|
|||
|
std::string cmdstring;
|
|||
|
bool isCancel = false;
|
|||
|
bool bRet = getMessageString(message, cmdstring, outMsg, isCancel);
|
|||
|
int cmd = CMD_tool_create_appendage;
|
|||
|
if (isCancel)
|
|||
|
{
|
|||
|
QString strLog = QString::fromStdString(cmdstring);
|
|||
|
strLog += "命令放弃执行" + PathUtil::getEndMark();
|
|||
|
addShowWindowsLog(strLog);
|
|||
|
bRet = false;
|
|||
|
}
|
|||
|
if (!bRet)
|
|||
|
{
|
|||
|
QtToWebFunction::getInstance().qt2web(cmd, EXECUTE_FAIL, "创建失败", "");
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
|
|||
|
bRet = getStabilityModelPtr()->create_Appendage(cmdstring, outJsonData);
|
|||
|
if (!bRet)
|
|||
|
{
|
|||
|
QtToWebFunction::getInstance().qt2web(cmd, EXECUTE_FAIL, "创建失败", "");
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
getStabilityModelPtr()->autoAddExecutingCmdID();
|
|||
|
QtToWebFunction::getInstance().qt2web(cmd, EXECUTE_SUCCESS, outMsg, "");
|
|||
|
QtToWebFunction::getInstance().qt2web(CMD_update_3d, EXECUTE_SUCCESS, outMsg, outJsonData);
|
|||
|
update_ui_state();
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
void ToolUIFunction::onUpdate3dFunction(const QString message)
|
|||
|
{
|
|||
|
|
|||
|
std::lock_guard<std::mutex> lock(lupdate3dMutex); // 使用互斥锁保护 UI 操作
|
|||
|
// 更新日志窗口的内容
|
|||
|
QtToWebFunction::getInstance().qt2web(CMD_update_3d, EXECUTE_SUCCESS, "update_ok", message);
|
|||
|
|
|||
|
int a = 0;
|
|||
|
// 可以在这里更新 UI(例如通过信号连接)
|
|||
|
}
|
|||
|
|
|||
|
void ToolUIFunction::command_stream_modeling(const QString &message)
|
|||
|
{
|
|||
|
QString outMsg;
|
|||
|
int errorCode = 0;
|
|||
|
QString outJsonData = "";
|
|||
|
|
|||
|
std::string cmdstring;
|
|||
|
bool isCancel = false;
|
|||
|
bool bRet = getMessageString(message, cmdstring, outMsg, isCancel);
|
|||
|
int cmd = CMD_command_stream_modeling;
|
|||
|
if (isCancel)
|
|||
|
{
|
|||
|
QString strLog = QString::fromStdString(cmdstring);
|
|||
|
strLog += "命令放弃执行" + PathUtil::getEndMark();
|
|||
|
addShowWindowsLog(strLog);
|
|||
|
bRet = false;
|
|||
|
}
|
|||
|
|
|||
|
if (!bRet)
|
|||
|
{
|
|||
|
QtToWebFunction::getInstance().qt2web(cmd, EXECUTE_FAIL, "创建失败", "");
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
// Create a thread and pass the `this` pointer to the async function
|
|||
|
std::thread t(&ToolUIFunction::command_stream_modeling_async, this, cmdstring);
|
|||
|
t.detach();
|
|||
|
|
|||
|
QtToWebFunction::getInstance().qt2web(cmd, EXECUTE_SUCCESS, "创建成功", "");
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
|
|||
|
void ToolUIFunction::stab_model_editor_intact(const QString &message)
|
|||
|
{
|
|||
|
int errorCode = 0;
|
|||
|
QString data = "";
|
|||
|
QString outMsg;
|
|||
|
getStabilityModelPtr()->stab_model_editor_intact(errorCode, outMsg, data, message);
|
|||
|
// QString jsonMsg = QtToWebFunction::getInstance().createMsg(CMD_stab_model_editor_intact, errorCode, outMsg, data);
|
|||
|
QtToWebFunction::getInstance().qt2web(CMD_stab_model_editor_intact, errorCode, outMsg, data);
|
|||
|
}
|
|||
|
|
|||
|
void ToolUIFunction::stab_model_editor_allow_kg(const QString &message)
|
|||
|
{
|
|||
|
int errorCode = 0;
|
|||
|
QString data = "";
|
|||
|
QString outMsg;
|
|||
|
getStabilityModelPtr()->stab_model_editor_allow_kg(errorCode, outMsg, data, message);
|
|||
|
// QString jsonMsg = QtToWebFunction::getInstance().createMsg(CMD_stab_model_editor_allow_kg, errorCode, outMsg, data);
|
|||
|
QtToWebFunction::getInstance().qt2web(CMD_stab_model_editor_allow_kg, errorCode, outMsg, data);
|
|||
|
}
|
|||
|
|
|||
|
void ToolUIFunction::stab_model_editor_damage(const QString &message)
|
|||
|
{
|
|||
|
int errorCode = 0;
|
|||
|
QString data = "";
|
|||
|
QString outMsg;
|
|||
|
getStabilityModelPtr()->stab_model_editor_damage(errorCode, outMsg, data, message);
|
|||
|
// QString jsonMsg = QtToWebFunction::getInstance().createMsg(CMD_stab_model_editor_damage, errorCode, outMsg, data);
|
|||
|
QtToWebFunction::getInstance().qt2web(CMD_stab_model_editor_damage, errorCode, outMsg, data);
|
|||
|
}
|
|||
|
|
|||
|
void ToolUIFunction::stab_model_editor_damage_prob(const QString &message)
|
|||
|
{
|
|||
|
int errorCode = 0;
|
|||
|
QString data = "";
|
|||
|
QString outMsg;
|
|||
|
getStabilityModelPtr()->stab_model_editor_damage_prob(errorCode, outMsg, data, message);
|
|||
|
// QString jsonMsg = QtToWebFunction::getInstance().createMsg(CMD_stab_model_editor_damage_prob, errorCode, outMsg, data);
|
|||
|
QtToWebFunction::getInstance().qt2web(CMD_stab_model_editor_damage_prob, errorCode, outMsg, data);
|
|||
|
}
|
|||
|
|
|||
|
void ToolUIFunction::stab_model_editor_inclining(const QString &message)
|
|||
|
{
|
|||
|
int errorCode = 0;
|
|||
|
QString data = "";
|
|||
|
QString outMsg;
|
|||
|
getStabilityModelPtr()->stab_model_editor_inclining(errorCode, outMsg, data, message);
|
|||
|
// QString jsonMsg = QtToWebFunction::getInstance().createMsg(CMD_stab_model_editor_inclining, errorCode, outMsg, data);
|
|||
|
QtToWebFunction::getInstance().qt2web(CMD_stab_model_editor_inclining, errorCode, outMsg, data);
|
|||
|
}
|
|||
|
|
|||
|
void ToolUIFunction::stab_model_editor_save(const QString &message)
|
|||
|
{
|
|||
|
int errorCode = 0;
|
|||
|
QString data = "";
|
|||
|
QString outMsg;
|
|||
|
getStabilityModelPtr()->stab_model_editor_save(errorCode, outMsg, data, message);
|
|||
|
// QString jsonMsg = QtToWebFunction::getInstance().createMsg(CMD_stab_model_editor_hydro_static, errorCode, outMsg, data);
|
|||
|
QtToWebFunction::getInstance().qt2web(CMD_stab_model_editor_hydro_static, errorCode, outMsg, data);
|
|||
|
}
|
|||
|
|
|||
|
void ToolUIFunction::stab_model_editor_check(const QString &message)
|
|||
|
{
|
|||
|
int errorCode = 0;
|
|||
|
QString data = "";
|
|||
|
QString outMsg;
|
|||
|
getStabilityModelPtr()->stab_model_editor_check(errorCode, outMsg, data, message);
|
|||
|
// QString jsonMsg = QtToWebFunction::getInstance().createMsg(CMD_stab_model_editor_tank_cap, errorCode, outMsg, data);
|
|||
|
QtToWebFunction::getInstance().qt2web(CMD_stab_model_editor_tank_cap, errorCode, outMsg, data);
|
|||
|
}
|
|||
|
|
|||
|
void ToolUIFunction::hull_show_tree(const QString &message)
|
|||
|
{
|
|||
|
int errorCode = 0;
|
|||
|
QString data = "";
|
|||
|
QString outMsg;
|
|||
|
getStabilityModelPtr()->hull_show_tree(errorCode, outMsg, data, message);
|
|||
|
// QString jsonMsg = QtToWebFunction::getInstance().createMsg(CMD_hull_show_tree, errorCode, outMsg, data);
|
|||
|
QtToWebFunction::getInstance().qt2web(CMD_hull_show_tree, errorCode, outMsg, data);
|
|||
|
}
|
|||
|
|
|||
|
void ToolUIFunction::structure_show_tree(const QString &message)
|
|||
|
{
|
|||
|
int errorCode = 0;
|
|||
|
QString data = "";
|
|||
|
QString data_2d = "";
|
|||
|
QString msg = "";
|
|||
|
|
|||
|
QString outMsg;
|
|||
|
|
|||
|
json outjson = json::object();
|
|||
|
getStructureModelPtr()->structure_show_tree(errorCode, outMsg, data, message);
|
|||
|
|
|||
|
// QString jsonMsg = QtToWebFunction::getInstance().createMsg(CMD_structure_show_tree, errorCode, outMsg, data);
|
|||
|
QtToWebFunction::getInstance().qt2web(CMD_structure_show_tree, errorCode, outMsg, data);
|
|||
|
|
|||
|
// 发送2d数据
|
|||
|
json outjson_2d = json::object();
|
|||
|
getStructureModelPtr()->update2dToJson(outjson_2d);
|
|||
|
|
|||
|
data_2d = QString::fromStdString(outjson_2d.dump());
|
|||
|
|
|||
|
QtToWebFunction::getInstance().qt2web(CMD_update_2d, errorCode, msg, data_2d);
|
|||
|
}
|
|||
|
|
|||
|
void ToolUIFunction::analysis_show_tree(const QString &message)
|
|||
|
{
|
|||
|
int errorCode = 0;
|
|||
|
QString data = "";
|
|||
|
QString data_2d = "";
|
|||
|
QString msg = "";
|
|||
|
|
|||
|
QString outMsg;
|
|||
|
getStabilityModelPtr()->analysis_show_tree(errorCode, outMsg, data, message);
|
|||
|
|
|||
|
// QString jsonMsg = QtToWebFunction::getInstance().createMsg(CMD_analysis_show_tree, errorCode, outMsg, data);
|
|||
|
QtToWebFunction::getInstance().qt2web(CMD_analysis_show_tree, errorCode, outMsg, data);
|
|||
|
|
|||
|
// 发送2d数据
|
|||
|
json outjson_2d = json::object();
|
|||
|
getStructureModelPtr()->update2dToJson(outjson_2d);
|
|||
|
|
|||
|
data_2d = QString::fromStdString(outjson_2d.dump());
|
|||
|
|
|||
|
QtToWebFunction::getInstance().qt2web(CMD_update_2d, errorCode, msg, data_2d);
|
|||
|
}
|
|||
|
|
|||
|
void ToolUIFunction::result_show_tree(const QString &message)
|
|||
|
{
|
|||
|
int errorCode = 0;
|
|||
|
QString data = "";
|
|||
|
QString outMsg;
|
|||
|
// getStabilityModelPtr()->result_show_tree(errorCode, outMsg, data, message);
|
|||
|
// QString jsonMsg = QtToWebFunction::getInstance().createMsg(CMD_result_show_tree, errorCode, outMsg, data);
|
|||
|
QtToWebFunction::getInstance().qt2web(CMD_result_show_tree, errorCode, outMsg, data);
|
|||
|
}
|
|||
|
|
|||
|
void ToolUIFunction::cmd_copy(const QString &message)
|
|||
|
{
|
|||
|
QString outMsg;
|
|||
|
int errorCode = 0;
|
|||
|
QString outJsonData = "";
|
|||
|
|
|||
|
std::string cmdstring;
|
|||
|
bool isCancel = false;
|
|||
|
bool bRet = getMessageString(message, cmdstring, outMsg, isCancel);
|
|||
|
int cmd = CMD_tool_copy;
|
|||
|
if (isCancel)
|
|||
|
{
|
|||
|
QString strLog = QString::fromStdString(cmdstring);
|
|||
|
strLog += "命令放弃执行" + PathUtil::getEndMark();
|
|||
|
addShowWindowsLog(strLog);
|
|||
|
bRet = false;
|
|||
|
}
|
|||
|
if (!bRet)
|
|||
|
{
|
|||
|
QtToWebFunction::getInstance().qt2web(cmd, EXECUTE_FAIL, "创建失败", "");
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
|
|||
|
bRet = getStabilityModelPtr()->cmd_copy(cmdstring, outJsonData);
|
|||
|
if (!bRet)
|
|||
|
{
|
|||
|
QtToWebFunction::getInstance().qt2web(cmd, EXECUTE_FAIL, "创建失败", "");
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
getStabilityModelPtr()->autoAddExecutingCmdID();
|
|||
|
QtToWebFunction::getInstance().qt2web(cmd, EXECUTE_SUCCESS, outMsg, "");
|
|||
|
QtToWebFunction::getInstance().qt2web(CMD_update_3d, EXECUTE_SUCCESS, outMsg, outJsonData);
|
|||
|
update_ui_state();
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
void ToolUIFunction::cmd_trim(const QString &message)
|
|||
|
{
|
|||
|
QString outMsg;
|
|||
|
int errorCode = 0;
|
|||
|
QString outJsonData = "";
|
|||
|
|
|||
|
std::string cmdstring;
|
|||
|
bool isCancel = false;
|
|||
|
bool bRet = getMessageString(message, cmdstring, outMsg, isCancel);
|
|||
|
int cmd = CMD_tool_trim;
|
|||
|
if (isCancel)
|
|||
|
{
|
|||
|
QString strLog = QString::fromStdString(cmdstring);
|
|||
|
strLog += "命令放弃执行" + PathUtil::getEndMark();
|
|||
|
addShowWindowsLog(strLog);
|
|||
|
bRet = false;
|
|||
|
}
|
|||
|
if (!bRet)
|
|||
|
{
|
|||
|
QtToWebFunction::getInstance().qt2web(cmd, EXECUTE_FAIL, "创建失败", "");
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
|
|||
|
bRet = getStabilityModelPtr()->cmd_trim(cmdstring, outJsonData);
|
|||
|
if (!bRet)
|
|||
|
{
|
|||
|
QtToWebFunction::getInstance().qt2web(cmd, EXECUTE_FAIL, "创建失败", "");
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
getStabilityModelPtr()->autoAddExecutingCmdID();
|
|||
|
QtToWebFunction::getInstance().qt2web(cmd, EXECUTE_SUCCESS, outMsg, "");
|
|||
|
QtToWebFunction::getInstance().qt2web(CMD_update_3d, EXECUTE_SUCCESS, outMsg, outJsonData);
|
|||
|
update_ui_state();
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
void ToolUIFunction::cmd_mirror(const QString &message)
|
|||
|
{
|
|||
|
QString outMsg;
|
|||
|
int errorCode = 0;
|
|||
|
QString outJsonData = "";
|
|||
|
|
|||
|
std::string cmdstring;
|
|||
|
bool isCancel = false;
|
|||
|
bool bRet = getMessageString(message, cmdstring, outMsg, isCancel);
|
|||
|
int cmd = CMD_tool_mirror;
|
|||
|
if (isCancel)
|
|||
|
{
|
|||
|
QString strLog = QString::fromStdString(cmdstring);
|
|||
|
strLog += "命令放弃执行" + PathUtil::getEndMark();
|
|||
|
addShowWindowsLog(strLog);
|
|||
|
bRet = false;
|
|||
|
}
|
|||
|
if (!bRet)
|
|||
|
{
|
|||
|
QtToWebFunction::getInstance().qt2web(cmd, EXECUTE_FAIL, "创建失败", "");
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
|
|||
|
bRet = getStabilityModelPtr()->cmd_mirror(cmdstring, outJsonData);
|
|||
|
if (!bRet)
|
|||
|
{
|
|||
|
QtToWebFunction::getInstance().qt2web(cmd, EXECUTE_FAIL, "创建失败", "");
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
getStabilityModelPtr()->autoAddExecutingCmdID();
|
|||
|
QtToWebFunction::getInstance().qt2web(cmd, EXECUTE_SUCCESS, outMsg, "");
|
|||
|
QtToWebFunction::getInstance().qt2web(CMD_update_3d, EXECUTE_SUCCESS, outMsg, outJsonData);
|
|||
|
update_ui_state();
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
void ToolUIFunction::cmd_intersection(const QString &message)
|
|||
|
{
|
|||
|
|
|||
|
QString outMsg;
|
|||
|
int errorCode = 0;
|
|||
|
QString outJsonData = "";
|
|||
|
|
|||
|
std::string cmdstring;
|
|||
|
bool isCancel = false;
|
|||
|
bool bRet = getMessageString(message, cmdstring, outMsg, isCancel);
|
|||
|
int cmd = CMD_tool_intersection;
|
|||
|
if (isCancel)
|
|||
|
{
|
|||
|
QString strLog = QString::fromStdString(cmdstring);
|
|||
|
strLog += "命令放弃执行" + PathUtil::getEndMark();
|
|||
|
addShowWindowsLog(strLog);
|
|||
|
bRet = false;
|
|||
|
}
|
|||
|
if (!bRet)
|
|||
|
{
|
|||
|
QtToWebFunction::getInstance().qt2web(cmd, EXECUTE_FAIL, "创建失败", "");
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
|
|||
|
bRet = getStabilityModelPtr()->cmd_intersection(cmdstring, outJsonData);
|
|||
|
if (!bRet)
|
|||
|
{
|
|||
|
QtToWebFunction::getInstance().qt2web(cmd, EXECUTE_FAIL, "创建失败", "");
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
getStabilityModelPtr()->autoAddExecutingCmdID();
|
|||
|
QtToWebFunction::getInstance().qt2web(cmd, EXECUTE_SUCCESS, outMsg, "");
|
|||
|
QtToWebFunction::getInstance().qt2web(CMD_update_3d, EXECUTE_SUCCESS, outMsg, outJsonData);
|
|||
|
update_ui_state();
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
void ToolUIFunction::cmd_join(const QString &message)
|
|||
|
{
|
|||
|
QString outMsg;
|
|||
|
int errorCode = 0;
|
|||
|
QString outJsonData = "";
|
|||
|
|
|||
|
std::string cmdstring;
|
|||
|
bool isCancel = false;
|
|||
|
bool bRet = getMessageString(message, cmdstring, outMsg, isCancel);
|
|||
|
int cmd = CMD_tool_join;
|
|||
|
if (isCancel)
|
|||
|
{
|
|||
|
QString strLog = QString::fromStdString(cmdstring);
|
|||
|
strLog += "命令放弃执行" + PathUtil::getEndMark();
|
|||
|
addShowWindowsLog(strLog);
|
|||
|
bRet = false;
|
|||
|
}
|
|||
|
if (!bRet)
|
|||
|
{
|
|||
|
QtToWebFunction::getInstance().qt2web(cmd, EXECUTE_FAIL, "创建失败", "");
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
|
|||
|
bRet = getStabilityModelPtr()->cmd_join(cmdstring, outJsonData);
|
|||
|
if (!bRet)
|
|||
|
{
|
|||
|
QtToWebFunction::getInstance().qt2web(cmd, EXECUTE_FAIL, "创建失败", "");
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
getStabilityModelPtr()->autoAddExecutingCmdID();
|
|||
|
QtToWebFunction::getInstance().qt2web(cmd, EXECUTE_SUCCESS, outMsg, "");
|
|||
|
QtToWebFunction::getInstance().qt2web(CMD_update_3d, EXECUTE_SUCCESS, outMsg, outJsonData);
|
|||
|
|
|||
|
update_ui_state();
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
void ToolUIFunction::cmd_delete(const QString &message)
|
|||
|
{
|
|||
|
QString outMsg;
|
|||
|
int errorCode = 0;
|
|||
|
QString outJsonData = "";
|
|||
|
|
|||
|
std::string cmdstring;
|
|||
|
bool isCancel = false;
|
|||
|
bool bRet = getMessageString(message, cmdstring, outMsg, isCancel);
|
|||
|
int cmd = CMD_tool_delete;
|
|||
|
if (isCancel)
|
|||
|
{
|
|||
|
QString strLog = QString::fromStdString(cmdstring);
|
|||
|
strLog += "命令放弃执行" + PathUtil::getEndMark();
|
|||
|
addShowWindowsLog(strLog);
|
|||
|
bRet = false;
|
|||
|
}
|
|||
|
if (!bRet)
|
|||
|
{
|
|||
|
QtToWebFunction::getInstance().qt2web(cmd, EXECUTE_FAIL, "创建失败", "");
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
|
|||
|
bRet = getStabilityModelPtr()->cmd_delete(cmdstring, outJsonData);
|
|||
|
if (!bRet)
|
|||
|
{
|
|||
|
QtToWebFunction::getInstance().qt2web(cmd, EXECUTE_FAIL, "创建失败", "");
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
getStabilityModelPtr()->autoAddExecutingCmdID();
|
|||
|
QtToWebFunction::getInstance().qt2web(cmd, EXECUTE_SUCCESS, outMsg, outJsonData);
|
|||
|
|
|||
|
update_ui_state();
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
void ToolUIFunction::cmd_undo(const QString &message)
|
|||
|
{
|
|||
|
QString strDeleteJson = "";
|
|||
|
QString strChangeJson = "";
|
|||
|
|
|||
|
getStabilityModelPtr()->cmd_undo(strDeleteJson, strChangeJson);
|
|||
|
if (!strDeleteJson.isEmpty())
|
|||
|
{
|
|||
|
QtToWebFunction::getInstance().qt2web(CMD_tool_delete, EXECUTE_SUCCESS, "", strDeleteJson);
|
|||
|
}
|
|||
|
|
|||
|
if (!strChangeJson.isEmpty())
|
|||
|
{
|
|||
|
QtToWebFunction::getInstance().qt2web(CMD_update_3d, EXECUTE_SUCCESS, "", strChangeJson);
|
|||
|
}
|
|||
|
|
|||
|
QtToWebFunction::getInstance().qt2web(CMD_tool_undo, EXECUTE_SUCCESS, "", "");
|
|||
|
|
|||
|
update_ui_state();
|
|||
|
}
|
|||
|
void ToolUIFunction::cmd_redo(const QString &message)
|
|||
|
{
|
|||
|
QString strDeleteJson = "";
|
|||
|
QString strChangeJson = "";
|
|||
|
getStabilityModelPtr()->cmd_redo(strDeleteJson, strChangeJson);
|
|||
|
if (!strDeleteJson.isEmpty())
|
|||
|
{
|
|||
|
QtToWebFunction::getInstance().qt2web(CMD_tool_delete, EXECUTE_SUCCESS, "", strDeleteJson);
|
|||
|
}
|
|||
|
|
|||
|
if (!strChangeJson.isEmpty())
|
|||
|
{
|
|||
|
QtToWebFunction::getInstance().qt2web(CMD_update_3d, EXECUTE_SUCCESS, "", strChangeJson);
|
|||
|
}
|
|||
|
|
|||
|
QtToWebFunction::getInstance().qt2web(CMD_tool_redo, EXECUTE_SUCCESS, "", "");
|
|||
|
|
|||
|
update_ui_state();
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
// 显示命令 命令
|
|||
|
void ToolUIFunction::cmd_tool_show_obj_command(const QString &message)
|
|||
|
{
|
|||
|
QString outMsg;
|
|||
|
int errorCode = 0;
|
|||
|
QString outJsonData = "";
|
|||
|
|
|||
|
std::string cmdstring = ""; //= "REGENCMD P P1\n" ;
|
|||
|
bool isCancel = false;
|
|||
|
bool bRet = getMessageString(message, cmdstring, outMsg, isCancel);
|
|||
|
int cmd = CMD_tool_show_obj_command;
|
|||
|
if (!bRet)
|
|||
|
{
|
|||
|
QtToWebFunction::getInstance().qt2web(cmd, EXECUTE_FAIL, "创建失败", "");
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
|
|||
|
bool bRet = getStabilityModelPtr()->cmd_tool_show_obj_command(cmdstring, outJsonData);
|
|||
|
if (!bRet)
|
|||
|
{
|
|||
|
QtToWebFunction::getInstance().qt2web(cmd, EXECUTE_FAIL, "创建失败", "");
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
QtToWebFunction::getInstance().qt2web(cmd, EXECUTE_SUCCESS, outMsg, outJsonData);
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
// 显示 点、线 坐标 XYZ
|
|||
|
void ToolUIFunction::cmd_tool_show_pt_curve_xyz(const QString &message)
|
|||
|
{
|
|||
|
int errorCode = 0;
|
|||
|
QString data = "";
|
|||
|
QString outMsg = "";
|
|||
|
std::vector<std::string> vObjList;
|
|||
|
nlohmann::json myjson = nlohmann::json::parse(message.toStdString());
|
|||
|
if (myjson.contains("obj_ids"))
|
|||
|
{
|
|||
|
nlohmann::json ids = myjson["obj_ids"];
|
|||
|
for (const auto &id : ids)
|
|||
|
{
|
|||
|
vObjList.emplace_back(id);
|
|||
|
}
|
|||
|
}
|
|||
|
QString outStr = "";
|
|||
|
getStabilityModelPtr()->Menu_toolbar_show_obj_infor_XYZ(vObjList, outStr);
|
|||
|
|
|||
|
QtToWebFunction::getInstance().qt2web(CMD_tool_show_pt_curve_xyz, errorCode, outMsg, data);
|
|||
|
}
|
|||
|
// 显示曲线肋位坐标 #
|
|||
|
void ToolUIFunction::cmd_tool_show_curve_rib_crd(const QString &message)
|
|||
|
{
|
|||
|
int errorCode = 0;
|
|||
|
QString data = "";
|
|||
|
QString outMsg = "";
|
|||
|
std::vector<std::string> vObjList;
|
|||
|
nlohmann::json myjson = nlohmann::json::parse(message.toStdString());
|
|||
|
if (myjson.contains("obj_ids"))
|
|||
|
{
|
|||
|
nlohmann::json ids = myjson["obj_ids"];
|
|||
|
for (const auto &id : ids)
|
|||
|
{
|
|||
|
vObjList.emplace_back(id);
|
|||
|
}
|
|||
|
}
|
|||
|
QString outStr = "";
|
|||
|
getStabilityModelPtr()->cmd_tool_show_curve_rib_crd(vObjList, true, outStr);
|
|||
|
|
|||
|
QtToWebFunction::getInstance().qt2web(CMD_tool_show_curve_rib_crd, errorCode, outMsg, data);
|
|||
|
}
|
|||
|
// 显示曲线站位点坐标 $
|
|||
|
void ToolUIFunction::cmd_tool_show_curve_station_points_crd(const QString &message)
|
|||
|
{
|
|||
|
int errorCode = 0;
|
|||
|
QString data = "";
|
|||
|
QString outMsg = "";
|
|||
|
std::vector<std::string> vObjList;
|
|||
|
nlohmann::json myjson = nlohmann::json::parse(message.toStdString());
|
|||
|
if (myjson.contains("obj_ids"))
|
|||
|
{
|
|||
|
nlohmann::json ids = myjson["obj_ids"];
|
|||
|
for (const auto &id : ids)
|
|||
|
{
|
|||
|
vObjList.emplace_back(id);
|
|||
|
}
|
|||
|
}
|
|||
|
QString outStr = "";
|
|||
|
getStabilityModelPtr()->cmd_tool_show_curve_rib_crd(vObjList, false, outStr);
|
|||
|
|
|||
|
QtToWebFunction::getInstance().qt2web(CMD_tool_show_curve_station_points_crd, errorCode, outMsg, data);
|
|||
|
}
|
|||
|
// 查找并定位图元
|
|||
|
void ToolUIFunction::cmd_tool_find_and_locate_obj(const QString &message)
|
|||
|
{
|
|||
|
}
|
|||
|
// 查询坐标
|
|||
|
void ToolUIFunction::cmd_tool_find_obj_crd(const QString &message)
|
|||
|
{
|
|||
|
}
|
|||
|
// 查询体积
|
|||
|
void ToolUIFunction::cmd_tool_find_obj_V(const QString &message)
|
|||
|
{
|
|||
|
}
|
|||
|
|
|||
|
void ToolUIFunction::stab_model_editor_hydro_static(const QString& message)
|
|||
|
{
|
|||
|
int errorCode = 0;
|
|||
|
QString data = "";
|
|||
|
QString outMsg;
|
|||
|
getStabilityModelPtr()->stab_model_editor_hydro_static(errorCode, outMsg, data, message);
|
|||
|
//QString jsonMsg = QtToWebFunction::getInstance().createMsg(CMD_stab_model_editor_hydro_static, errorCode, outMsg, data);
|
|||
|
QtToWebFunction::getInstance().qt2web(CMD_stab_model_editor_hydro_static, errorCode, outMsg, data);
|
|||
|
}
|
|||
|
|
|||
|
void ToolUIFunction::stab_model_editor_tank_cap(const QString& message)
|
|||
|
{
|
|||
|
int errorCode = 0;
|
|||
|
QString data = "";
|
|||
|
QString outMsg;
|
|||
|
getStabilityModelPtr()->stab_model_editor_tank_cap(errorCode, outMsg, data, message);
|
|||
|
//QString jsonMsg = QtToWebFunction::getInstance().createMsg(CMD_stab_model_editor_tank_cap, errorCode, outMsg, data);
|
|||
|
QtToWebFunction::getInstance().qt2web(CMD_stab_model_editor_tank_cap, errorCode, outMsg, data);
|
|||
|
}
|
|||
|
void ToolUIFunction::certify_Tonnage(const QString& message)
|
|||
|
{
|
|||
|
int errorCode = 0;
|
|||
|
QString data = "";
|
|||
|
QString outMsg;
|
|||
|
getCertiModelPtr()->certify_Tonnage(errorCode, outMsg, data, message);
|
|||
|
|
|||
|
//QString jsonMsg = QtToWebFunction::getInstance().createMsg(CMD_analysis_show_tree, errorCode, outMsg, data);
|
|||
|
QtToWebFunction::getInstance().qt2web(CMD_certify_Tonnage, errorCode, outMsg, data);
|
|||
|
}
|
|||
|
|
|||
|
void ToolUIFunction::certify_save_Tonnage(const QString& message)
|
|||
|
{
|
|||
|
int errorCode = 0;
|
|||
|
QString data = "";
|
|||
|
QString outMsg;
|
|||
|
getCertiModelPtr()->certify_save_Tonnage(errorCode, outMsg, data, message);
|
|||
|
QtToWebFunction::getInstance().qt2web(CMD_certify_save_Tonnage, errorCode, outMsg, data);
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
void ToolUIFunction::certify_check_Tonnage(const QString& message)
|
|||
|
{
|
|||
|
int errorCode = 0;
|
|||
|
QString data = "";
|
|||
|
QString outMsg;
|
|||
|
getCertiModelPtr()->certify_check_Tonnage(errorCode, outMsg, data, message);
|
|||
|
QtToWebFunction::getInstance().qt2web(CMD_certify_check_Tonnage, errorCode, outMsg, data);
|
|||
|
}
|
|||
|
|
|||
|
void ToolUIFunction::certify_create_cal(const QString& message)
|
|||
|
{
|
|||
|
int errorCode = 0;
|
|||
|
QString data = "";
|
|||
|
QString outMsg;
|
|||
|
getCertiModelPtr()->certify_create_cal(errorCode, outMsg, data, message);
|
|||
|
QtToWebFunction::getInstance().qt2web(CMD_certify_create_cal, errorCode, outMsg, data);
|
|||
|
}
|
|||
|
|
|||
|
void ToolUIFunction::certify_cal(const QString& message)
|
|||
|
{
|
|||
|
int errorCode = 0;
|
|||
|
QString data = "";
|
|||
|
QString outMsg;
|
|||
|
getCertiModelPtr()->certify_cal(errorCode, outMsg, data, message);
|
|||
|
QtToWebFunction::getInstance().qt2web(CMD_certify_cal, errorCode, outMsg, data);
|
|||
|
}
|
|||
|
|
|||
|
void ToolUIFunction::certify_delete_cal(const QString& message)
|
|||
|
{
|
|||
|
int errorCode = 0;
|
|||
|
QString data = "";
|
|||
|
QString outMsg;
|
|||
|
getCertiModelPtr()->certify_delete_cal(errorCode, outMsg, data, message);
|
|||
|
QtToWebFunction::getInstance().qt2web(CMD_certify_delete_cal, errorCode, outMsg, data);
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
void ToolUIFunction::certify_EEDI(const QString& message)
|
|||
|
{
|
|||
|
int errorCode = 0;
|
|||
|
QString data = "";
|
|||
|
QString outMsg;
|
|||
|
getCertiModelPtr()->certify_EEDI(errorCode, outMsg, data, message);
|
|||
|
QtToWebFunction::getInstance().qt2web(CMD_certify_EEDI, errorCode, outMsg, data);
|
|||
|
}
|
|||
|
|
|||
|
void ToolUIFunction::certify_EEDI_save(const QString& message)
|
|||
|
{
|
|||
|
int errorCode = 0;
|
|||
|
QString data = "";
|
|||
|
QString outMsg;
|
|||
|
getCertiModelPtr()->certify_EEDI_save(errorCode, outMsg, data, message);
|
|||
|
QtToWebFunction::getInstance().qt2web(CMD_certify_save_EEDI, errorCode, outMsg, data);
|
|||
|
}
|
|||
|
|
|||
|
void ToolUIFunction::certify_EEDI_check(const QString& message)
|
|||
|
{
|
|||
|
int errorCode = 0;
|
|||
|
QString data = "";
|
|||
|
QString outMsg;
|
|||
|
getCertiModelPtr()->certify_EEDI_check(errorCode, outMsg, data, message);
|
|||
|
QtToWebFunction::getInstance().qt2web(CMD_certify_check_EEDI, errorCode, outMsg, data);
|
|||
|
}
|
|||
|
|