|
@@ -201,8 +201,8 @@ void handlePool::operateRender(boostJsonObject* object,QVTKRenderer* render_)
|
|
|
cout<<"please import tecplot result first!"<<endl;
|
|
|
}
|
|
|
return;
|
|
|
- }else if(object->action == ""){
|
|
|
- if(!result_contourinimationdisplay(object,render_,"")){
|
|
|
+ }else if(object->action == "ContourInimationwDisplay"){
|
|
|
+ if(!result_contourinimationdisplay(object,render_)){
|
|
|
cout<<"please import tecplot result forst!"<<endl;
|
|
|
}
|
|
|
return;
|
|
@@ -291,6 +291,7 @@ void handlePool::judgeLoaddata(boostJsonObject *object, QVTKRenderer *render_)
|
|
|
bool handlePool::resultImport(boostJsonObject *object_, QVTKRenderer *renderer_)
|
|
|
{
|
|
|
string type_;
|
|
|
+ //object_->fileName = "tfg_part1_tec_volume_timestep100.dat,tfg_part1_tec_volume_timestep200.dat";//单个文件?
|
|
|
//object_->fileName = "whole_part1.plt,whole_part2.plt";
|
|
|
size_t found = object_->fileName.find_first_of(',');
|
|
|
if(found==string::npos){//单个文件
|
|
@@ -333,7 +334,7 @@ bool handlePool::resultImport(boostJsonObject *object_, QVTKRenderer *renderer_)
|
|
|
}
|
|
|
}
|
|
|
//object_->filePath = "C:\\Users\\Administrator\\Desktop\\Postprocess_Binary";//测试路径
|
|
|
- //object_->filePath = "C:\\Users\\Administrator\\Desktop\\VTK";//测试路径
|
|
|
+ //object_->filePath = "C:\\Users\\Administrator\\Documents\\WeChat Files\\wxid_18qjhi0tq90d22\\FileStorage\\File\\2023-06";//测试路径
|
|
|
QDir dir(QString::fromStdString(object_->filePath));
|
|
|
if(!dir.exists()){
|
|
|
return false;
|
|
@@ -356,11 +357,15 @@ bool handlePool::resultImport(boostJsonObject *object_, QVTKRenderer *renderer_)
|
|
|
bool flag = true;
|
|
|
rsManager = new ResultMeshManager();
|
|
|
rsManager->Clear();
|
|
|
- rsManager->fileType = "plt";
|
|
|
+ if(object_->fileType == "ascii"){
|
|
|
+ rsManager->fileType ="plt_ascii";
|
|
|
+ }else if(object_->fileType == "binary"){
|
|
|
+ rsManager->fileType = "plt_binary";
|
|
|
+ }
|
|
|
for(int i =0;i<fileName_list.size();i++){
|
|
|
- bool f =rsManager->LoadData(QString::fromStdString(object_->filePath)+"/"+fileName_list[i]);//加载
|
|
|
+ bool f =rsManager->LoadData(QString::fromStdString(object_->filePath)+"/"+fileName_list[0]);//加载
|
|
|
if(f){
|
|
|
- rsManager->SetSaveIndex(i);
|
|
|
+ rsManager->SetSaveIndex(0);
|
|
|
if(renderer_){
|
|
|
rsManager->DisplayMesh(renderer_);
|
|
|
}
|
|
@@ -430,6 +435,9 @@ bool handlePool::resultImport(boostJsonObject *object_, QVTKRenderer *renderer_)
|
|
|
|
|
|
StreamDisplayWidget* streamW = new StreamDisplayWidget();//流线窗口初始化参数
|
|
|
rsManager->SetStremWidget(streamW);
|
|
|
+
|
|
|
+ ContourInimationW* cinimationW = new ContourInimationW();
|
|
|
+ rsManager->SetAnimationWidget(cinimationW);
|
|
|
/********************************************/
|
|
|
renderer_->widgetFlag = QVTKRenderer::WidgetModel::ResultModel;//设置当前窗口模型状态
|
|
|
if(qmapResultmanager.contains(object_->proId)){//加载不同的结果文件
|
|
@@ -445,6 +453,7 @@ bool handlePool::resultImport(boostJsonObject *object_, QVTKRenderer *renderer_)
|
|
|
emit sendImg_handlePoolToSendstate(object_->ToJson("importResult_vector",buildResultImport_msg("Vector",rsManager)));//发送矢量结果数据
|
|
|
emit sendImg_handlePoolToSendstate(object_->ToJson("importResult_solidsurface",buildResultImport_msg("Solidsurface",rsManager)));//发送实体表面结果数据
|
|
|
emit sendImg_handlePoolToSendstate(object_->ToJson("importResult_stream",buildResultImport_msg("Stream",rsManager)));//发送流线结果数据
|
|
|
+ emit sendImg_handlePoolToSendstate(object_->ToJson("importResult_animation",buildResultImport_msg("animation",rsManager)));
|
|
|
send_picture(object_,renderer_);
|
|
|
return true;
|
|
|
}
|
|
@@ -659,8 +668,69 @@ bool handlePool::result_streamdisplay(boostJsonObject *object_, QVTKRenderer *re
|
|
|
* @ret: bool
|
|
|
* @birth: created by czm in 20230606
|
|
|
*/
|
|
|
-bool handlePool::result_contourinimationdisplay(boostJsonObject *, QVTKRenderer *, QString)
|
|
|
+bool handlePool::result_contourinimationdisplay(boostJsonObject *object_, QVTKRenderer *render_)
|
|
|
{
|
|
|
+ contourinimationDisplay* cidisplay = NULL;
|
|
|
+ string order_ = object_->ci_struct->order;
|
|
|
+ if(!qmapResultmanager.contains(object_->proId))return false;
|
|
|
+ render_ = qmapRender[object_->proId];
|
|
|
+ ResultManager* resultmm = qmapResultmanager[object_->proId]->resultManager_;
|
|
|
+ if(map_cinimationDisplay.contains(object_->proId)){
|
|
|
+ cidisplay = map_cinimationDisplay[object_->proId];
|
|
|
+ }else{
|
|
|
+ cidisplay = new contourinimationDisplay(resultmm);
|
|
|
+ map_cinimationDisplay.insert(object_->proId,cidisplay);
|
|
|
+ }
|
|
|
+
|
|
|
+ ContourInimationW* ciw = resultmm->animationWidget_;
|
|
|
+ if(order_ == "quick"){
|
|
|
+ ciw->SlotQuick();
|
|
|
+ emit sendImg_handlePoolToSendstate(object_->ToJson("animation_quick",buildResultImport_msg("animation_quick",resultmm,object_)));
|
|
|
+ return true;
|
|
|
+ }else if(order_ == "low"){
|
|
|
+ ciw->SlotLow();
|
|
|
+ emit sendImg_handlePoolToSendstate(object_->ToJson("animation_low",buildResultImport_msg("animation_low",resultmm,object_)));
|
|
|
+ return true;
|
|
|
+ }else if(order_ == "play"){
|
|
|
+ ciw->slider = object_->ci_struct->slider;
|
|
|
+ for(int i = ciw->slider;i<ciw->max;i++){
|
|
|
+ animationSliderChanged(QString::fromStdString(object_->proId));
|
|
|
+ send_picture(object_,render_,i);
|
|
|
+ }
|
|
|
+ return true;
|
|
|
+ }else if(order_ == "start"){
|
|
|
+ ciw->SlotStart();
|
|
|
+ animationSliderChanged(QString::fromStdString(object_->proId));
|
|
|
+ emit sendImg_handlePoolToSendstate(object_->ToJson("animation_slider",buildResultImport_msg("animation_slider",resultmm,object_)));
|
|
|
+ }else if(order_ == "end"){
|
|
|
+ ciw->SlotEnd();
|
|
|
+ animationSliderChanged(QString::fromStdString(object_->proId));
|
|
|
+ emit sendImg_handlePoolToSendstate(object_->ToJson("animation_slider",buildResultImport_msg("animation_slider",resultmm,object_)));
|
|
|
+ }else if(order_ == "next"){
|
|
|
+ ciw->SlotNext();
|
|
|
+ animationSliderChanged(QString::fromStdString(object_->proId));
|
|
|
+ emit sendImg_handlePoolToSendstate(object_->ToJson("animation_slider",buildResultImport_msg("animation_slider",resultmm,object_)));
|
|
|
+ }else if(order_ == "last"){
|
|
|
+ ciw->SlotLast();
|
|
|
+ animationSliderChanged(QString::fromStdString(object_->proId));
|
|
|
+ emit sendImg_handlePoolToSendstate(object_->ToJson("animation_slider",buildResultImport_msg("animation_slider",resultmm,object_)));
|
|
|
+ }else if(order_ == "edit"){//interval apply
|
|
|
+ ciw->FrameNumberEdit();
|
|
|
+ return true;
|
|
|
+ }else if(order_ == "apply"){//interval apply
|
|
|
+ ciw->SetFrameNumber();
|
|
|
+ return true;
|
|
|
+ }else if(order_ == "scaleApply"){//scale apply
|
|
|
+ resultmm->UpdataZoomModel(ciw->GetScaleFactor());
|
|
|
+ emit sendImg_handlePoolToSendstate(object_->ToJson("animation_slider",buildResultImport_msg("animation_slider",resultmm,object_)));
|
|
|
+ }else if(order_ == "typeChange"){//下拉框改变
|
|
|
+ resultmm->ChangeMeshType(object_->ci_struct->type);
|
|
|
+ emit sendImg_handlePoolToSendstate(object_->ToJson("animation_slider",buildResultImport_msg("animation_slider",resultmm,object_)));
|
|
|
+ }else if(order_ == "checkboxchange"){//checkbox选择
|
|
|
+ //resultmm->SetShowHideState(vec);
|
|
|
+ resultmm->DisplayMeshByIndex(resultmm->animationWidget_->GetIndex());
|
|
|
+ }
|
|
|
+ send_picture(object_,render_);
|
|
|
return true;
|
|
|
}
|
|
|
|
|
@@ -680,7 +750,7 @@ QMap<QString,string> handlePool::buildResultImport_msg(QString type,ResultManage
|
|
|
map<string,int> map_ = cmanager->GetNameTypeMap();
|
|
|
string msg;
|
|
|
for(map<string,int>::iterator it=map_.begin();it!=map_.end();it++){
|
|
|
- if(cmanager->fileType!="VTK"){
|
|
|
+ if(cmanager->fileType =="plt_binary"){
|
|
|
msg+=removeSpaces(it->first);
|
|
|
}else{
|
|
|
msg+=it->first;
|
|
@@ -693,7 +763,7 @@ QMap<QString,string> handlePool::buildResultImport_msg(QString type,ResultManage
|
|
|
map_tmp.insert("nameTypes",msg);
|
|
|
msg.clear();
|
|
|
for(int i=0;i<cmanager->GetMeshScalarNameVec().size();i++){
|
|
|
- if(cmanager->fileType!="VTK"){
|
|
|
+ if(cmanager->fileType=="plt_binary"){
|
|
|
msg += removeSpaces(cmanager->GetMeshScalarNameVec()[i]);
|
|
|
}else{
|
|
|
msg+=cmanager->GetMeshScalarNameVec()[i];
|
|
@@ -711,7 +781,7 @@ QMap<QString,string> handlePool::buildResultImport_msg(QString type,ResultManage
|
|
|
map_tmp.insert("range1",msg);
|
|
|
msg.clear();
|
|
|
msg = cmanager->GetMeshScalarNameVec()[0];
|
|
|
- if(cmanager->fileType!="VTK"){
|
|
|
+ if(cmanager->fileType=="plt_binary"){
|
|
|
map_tmp.insert("scalarName",removeSpaces(msg));
|
|
|
}else{
|
|
|
map_tmp.insert("scalarName",msg);
|
|
@@ -759,7 +829,7 @@ QMap<QString,string> handlePool::buildResultImport_msg(QString type,ResultManage
|
|
|
string msg;
|
|
|
StreamDisplayWidget* smdW = cmanager->streamW_;
|
|
|
for(int i = 0; i<smdW->dataU.size();i++){
|
|
|
- if(cmanager->fileType!="VTK"){
|
|
|
+ if(cmanager->fileType=="plt_binary"){
|
|
|
msg+=removeSpaces(smdW->dataU[i]);
|
|
|
}else{
|
|
|
msg+=smdW->dataU[i];
|
|
@@ -770,7 +840,7 @@ QMap<QString,string> handlePool::buildResultImport_msg(QString type,ResultManage
|
|
|
map_tmp.insert("dataU",msg);
|
|
|
msg.clear();
|
|
|
for(int j = 0;j<smdW->dataV.size();j++){
|
|
|
- if(cmanager->fileType!="VTK"){
|
|
|
+ if(cmanager->fileType=="plt_binary"){
|
|
|
msg+=removeSpaces(smdW->dataV[j]);
|
|
|
}else{
|
|
|
msg+=smdW->dataV[j];
|
|
@@ -781,7 +851,7 @@ QMap<QString,string> handlePool::buildResultImport_msg(QString type,ResultManage
|
|
|
map_tmp.insert("dataV",msg);
|
|
|
msg.clear();
|
|
|
for(int k = 0; k <smdW->dataW.size();k++){
|
|
|
- if(cmanager->fileType!="VTK"){
|
|
|
+ if(cmanager->fileType=="plt_binary"){
|
|
|
msg+=removeSpaces(smdW->dataW[k]);
|
|
|
}else{
|
|
|
msg+=smdW->dataW[k];
|
|
@@ -791,6 +861,25 @@ QMap<QString,string> handlePool::buildResultImport_msg(QString type,ResultManage
|
|
|
msg = msg.erase(msg.size()-1);
|
|
|
map_tmp.insert("dataW",msg);
|
|
|
msg.clear();
|
|
|
+ }else if(type=="Animation"){
|
|
|
+ string msg;
|
|
|
+ ContourInimationW* ciw = cmanager->animationWidget_;
|
|
|
+ map_tmp.insert("min_slider","0");
|
|
|
+ map_tmp.insert("slider","0");
|
|
|
+ map_tmp.insert("max_slider",to_string(ciw->max-1));
|
|
|
+ map_tmp.insert("firststep",to_string(ciw->le_firstStep));
|
|
|
+ map_tmp.insert("endstep",to_string(ciw->le_endStep));
|
|
|
+ map_tmp.insert("currstep",to_string(ciw->le_currStep));
|
|
|
+ for(int i =0;i<ciw->ZoneNameVec.size();i++){
|
|
|
+ msg+=ciw->ZoneNameVec[i];
|
|
|
+ msg+=",";
|
|
|
+ }
|
|
|
+ msg=msg.erase(msg.size()-1);
|
|
|
+ map_tmp.insert("zone",msg);
|
|
|
+ msg.clear();
|
|
|
+ map_tmp.insert("le_time","40");
|
|
|
+ map_tmp.insert("ldt_scale","1");
|
|
|
+ map_tmp.insert("lb_solvtime",to_string(ciw->m_time[0]));//time后的值
|
|
|
}
|
|
|
return map_tmp;
|
|
|
}
|
|
@@ -819,7 +908,7 @@ QMap<QString, string> handlePool::buildResultImport_msg(QString type, ResultMana
|
|
|
map_tmp.insert("min_position_z",to_string(sdwidget->GetPositionRange()[4]));
|
|
|
map_tmp.insert("max_position_z",to_string(sdwidget->GetPositionRange()[5]));
|
|
|
for(int i =0; i<sdwidget->GetVariableName_vector().size();i++){
|
|
|
- if(cmanager->fileType!="VTK"){
|
|
|
+ if(cmanager->fileType=="plt_binary"){
|
|
|
msg+= removeSpaces(sdwidget->GetVariableName_vector()[i]);
|
|
|
}else{
|
|
|
msg+= sdwidget->GetVariableName_vector()[i];
|
|
@@ -846,6 +935,18 @@ QMap<QString, string> handlePool::buildResultImport_msg(QString type, ResultMana
|
|
|
map_tmp.insert("initialStep",to_string(smdW->initialStep));
|
|
|
map_tmp.insert("maxPropagation",to_string(smdW->MaxPropagation));
|
|
|
map_tmp.insert("minimumStep",to_string(smdW->MinimumStep));
|
|
|
+ }else if(type == "animation_quick")
|
|
|
+ {
|
|
|
+ ContourInimationW* ciw = cmanager->animationWidget_;
|
|
|
+ map_tmp.insert("le_time",to_string(ciw->le_time));
|
|
|
+ }else if(type == "animation_low")
|
|
|
+ {
|
|
|
+ ContourInimationW* ciw = cmanager->animationWidget_;
|
|
|
+ map_tmp.insert("le_time",to_string(ciw->le_time));
|
|
|
+ }else if(type == "animation_slider")
|
|
|
+ {
|
|
|
+ ContourInimationW* ciw = cmanager->animationWidget_;
|
|
|
+ map_tmp.insert("slider",to_string(ciw->slider));
|
|
|
}
|
|
|
return map_tmp;
|
|
|
}
|
|
@@ -883,6 +984,20 @@ void handlePool::send_picture(boostJsonObject *object, QVTKRenderer *render_)
|
|
|
object = NULL;
|
|
|
}
|
|
|
|
|
|
+void handlePool::send_picture(boostJsonObject *object, QVTKRenderer *render_, int step)
|
|
|
+{
|
|
|
+ render_->CaptureWindowImages();
|
|
|
+ if(!render_->img.isEmpty()){
|
|
|
+ std::string img_ = render_->img.toStdString();
|
|
|
+ QMap<QString,string> map;
|
|
|
+ map["img"] = img_;
|
|
|
+ std::string json_ = object->ToJson("img",map,step);
|
|
|
+ emit sendImg_handlePoolToSendstate(json_);//信号
|
|
|
+ }
|
|
|
+ delete object;
|
|
|
+ object = NULL;
|
|
|
+}
|
|
|
+
|
|
|
/*
|
|
|
* @brief: remove string's spaces
|
|
|
* @param: string
|
|
@@ -951,6 +1066,24 @@ pid_resultManager *handlePool::set_map_resultManager(boostJsonObject *object, Re
|
|
|
return resultManager_p;
|
|
|
}
|
|
|
|
|
|
+/*
|
|
|
+ * @brief: animation slider change
|
|
|
+ * @param: proid
|
|
|
+ * @ret: void
|
|
|
+ * @birth: created by czm in 20230608
|
|
|
+ */
|
|
|
+void handlePool::animationSliderChanged(QString str)
|
|
|
+{
|
|
|
+ if(qmapResultmanager[str.toStdString()]->resultManager_!=NULL){
|
|
|
+ ResultManager* resultmm = qmapResultmanager[str.toStdString()]->resultManager_;
|
|
|
+ if(!resultmm->animationWidget_->getm_time().isEmpty()){
|
|
|
+ resultmm->HideAllActors();
|
|
|
+ resultmm->DisplayMeshByIndex(resultmm->animationWidget_->getSlider());
|
|
|
+ resultmm->animationWidget_->SlotChange();
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
/*
|
|
|
* @brief: get map which save meshmanager
|
|
|
* @param: void
|