|
@@ -201,10 +201,8 @@ void handlePool::operateRender(boostJsonObject* object,QVTKRenderer* render_)
|
|
|
cout<<"please import tecplot result first!"<<endl;
|
|
|
}
|
|
|
return;
|
|
|
- }else if(object->action == "ContourInimationwDisplay"){
|
|
|
- if(!result_contourinimationdisplay(object,render_)){
|
|
|
- cout<<"please import tecplot result forst!"<<endl;
|
|
|
- }
|
|
|
+ }else if(object->action == "animation"){
|
|
|
+ result_contourinimationdisplay(object,render_);
|
|
|
return;
|
|
|
}
|
|
|
send_picture(object,render_);//发送图片
|
|
@@ -291,7 +289,7 @@ void handlePool::judgeLoaddata(boostJsonObject *object, QVTKRenderer *render_)
|
|
|
bool handlePool::resultImport(boostJsonObject *object_, QVTKRenderer *renderer_)
|
|
|
{
|
|
|
string type_;
|
|
|
- //object_->fileName = "test1.dat";
|
|
|
+ //object_->ci_struct->filenames.push_back();
|
|
|
//object_->fileName = "hcfd_tec_boundary_timestep100.dat";
|
|
|
//object_->fileName = "whole_part1.plt,whole_part2.plt";
|
|
|
size_t found = object_->fileName.find_first_of(',');
|
|
@@ -334,19 +332,16 @@ bool handlePool::resultImport(boostJsonObject *object_, QVTKRenderer *renderer_)
|
|
|
auto flag_ = renderer_->widgetFlag;
|
|
|
if(flag_==QVTKRenderer::WidgetModel::UgridModel){
|
|
|
renderer_ = qmapRender.value(object_->proId);
|
|
|
- renderer_->HideAllActors();//to do 有bug 先导入结果,在loaddata,再导入,会报错
|
|
|
+ renderer_->HideAllActors();
|
|
|
renderer_->RemoveAllActors();
|
|
|
}else if(flag_ ==QVTKRenderer::WidgetModel::ResultModel){
|
|
|
- if(qmapResultmanager.value(object_->proId)->fileName == (object_->fileName)){//to do 详细比对文件名
|
|
|
+ if(qmapResultmanager.value(object_->proId)->fileName == (object_->fileName)){
|
|
|
send_picture(object_,renderer_);
|
|
|
return true;
|
|
|
}
|
|
|
- //qmapResultmanager.value(object_->proId)->resultMeshManager_->HideAllActors();
|
|
|
- // renderer_->HideAllActors();
|
|
|
- // renderer_->RemoveAllActors();
|
|
|
}else if(flag_==QVTKRenderer::WidgetModel::VTKModel){
|
|
|
renderer_ = qmapRender.value(object_->proId);
|
|
|
- renderer_->HideAllActors();//to do 有bug 先导入结果,在loaddata,再导入,会报错
|
|
|
+ renderer_->HideAllActors();
|
|
|
renderer_->RemoveAllActors();
|
|
|
}
|
|
|
}
|
|
@@ -482,9 +477,6 @@ 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)){//加载不同的结果文件
|
|
@@ -502,7 +494,9 @@ 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)));
|
|
|
+ if(type_!="vtkfile"){
|
|
|
+ emit sendImg_handlePoolToSendstate(object_->ToJson("importResult_animation",buildResultImport_msg("animation",rsManager)));//发送动画所需的zonename
|
|
|
+ }
|
|
|
send_picture(object_,renderer_);
|
|
|
return true;
|
|
|
}
|
|
@@ -719,67 +713,39 @@ bool handlePool::result_streamdisplay(boostJsonObject *object_, QVTKRenderer *re
|
|
|
*/
|
|
|
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];
|
|
|
+ if(!qmapRender.contains(object_->proId)){
|
|
|
+ render_ = new QVTKRenderer();
|
|
|
+ qmapRender.insert(object_->proId,render_);
|
|
|
+ render_->init();
|
|
|
+ w->addTab(render_->GetWidget(),QString::fromStdString(object_->proId));
|
|
|
+ render_->widgetFlag = QVTKRenderer::WidgetModel::NoModel;
|
|
|
}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);
|
|
|
+ render_ = qmapRender[object_->proId];
|
|
|
+ auto flag_ = render_->widgetFlag;
|
|
|
+ if(flag_==QVTKRenderer::WidgetModel::UgridModel){
|
|
|
+ render_ = qmapRender.value(object_->proId);
|
|
|
+ render_->HideAllActors();
|
|
|
+ render_->RemoveAllActors();
|
|
|
+ }else if(flag_ ==QVTKRenderer::WidgetModel::ResultModel){
|
|
|
+ render_ = qmapRender.value(object_->proId);
|
|
|
+ render_->HideAllActors();
|
|
|
+ render_->RemoveAllActors();
|
|
|
+ }else if(flag_==QVTKRenderer::WidgetModel::VTKModel){
|
|
|
+ render_ = qmapRender.value(object_->proId);
|
|
|
+ render_->HideAllActors();
|
|
|
+ render_->RemoveAllActors();
|
|
|
}
|
|
|
- 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_);
|
|
|
+ for(int i =0;i<object_->ci_struct->filenames.size();i++){
|
|
|
+#ifdef _WIN32
|
|
|
+ string filename = object_->filePath+"\\"+object_->ci_struct->filenames[i];
|
|
|
+#else
|
|
|
+ string filename = object_->filePath+"/"+object_->ci_struct->filenames[i];
|
|
|
+#endif
|
|
|
+ animation_render(filename,object_->ci_struct->steps[i],render_,object_);
|
|
|
+ }
|
|
|
+ delete object_;
|
|
|
+ object_ = NULL;
|
|
|
return true;
|
|
|
}
|
|
|
|
|
@@ -942,25 +908,16 @@ 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"){
|
|
|
+ }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];
|
|
|
+ vector<string> zonename=cmanager->GetZoneNameVec();
|
|
|
+ for(int i =0;i<zonename.size();i++){
|
|
|
+ msg+=zonename[i];
|
|
|
msg+=",";
|
|
|
}
|
|
|
- msg=msg.erase(msg.size()-1);
|
|
|
- map_tmp.insert("zone",msg);
|
|
|
+ msg = msg.erase(msg.size()-1);
|
|
|
+ map_tmp.insert("zonename",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;
|
|
|
}
|
|
@@ -1016,18 +973,6 @@ 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;
|
|
|
}
|
|
@@ -1078,11 +1023,10 @@ void handlePool::send_picture(boostJsonObject *object, QVTKRenderer *render_, in
|
|
|
std::string img_ = render_->img.toStdString();
|
|
|
QMap<QString,string> map;
|
|
|
map["img"] = img_;
|
|
|
+ map["animationType"] = object->ci_struct->displaytype;
|
|
|
std::string json_ = object->ToJson("img",map,step);
|
|
|
emit sendImg_handlePoolToSendstate(json_);//信号
|
|
|
}
|
|
|
- delete object;
|
|
|
- object = NULL;
|
|
|
}
|
|
|
|
|
|
/*
|
|
@@ -1153,24 +1097,6 @@ 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: clear map when resultimported anew
|
|
|
* @param: void
|
|
@@ -1251,3 +1177,162 @@ void handlePool::get_init_scalar_range(ResultManager* cmanager)
|
|
|
allscalarrange[temp_scalar[i]] = temp;
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+/*
|
|
|
+ * @brief: render animation picture
|
|
|
+ * @param: filename and displaytype and step
|
|
|
+ * @ret: void
|
|
|
+ * @birth: created by czm in 20230626
|
|
|
+ */
|
|
|
+void handlePool::animation_render(string filename,int step,QVTKRenderer* renderer_,boostJsonObject* object_)
|
|
|
+{
|
|
|
+ string type_;
|
|
|
+ vector<string> tmp = stringSplit(filename,'.');
|
|
|
+ if(tmp[1]=="vtk"){
|
|
|
+ type_ = "vtkfile";
|
|
|
+ }else if(tmp[1]=="dat"){
|
|
|
+ type_ = "one_plt_ascii_file";
|
|
|
+ }else if(tmp[1]=="plt"){
|
|
|
+ type_ = "one_plt_binary_file";
|
|
|
+ }
|
|
|
+ vector<string> hidezonenames_tmp;
|
|
|
+ if(type_!="vtkfile"){
|
|
|
+
|
|
|
+ if(object_->ci_struct->hideZones.find_first_of(",")==string::npos){
|
|
|
+ hidezonenames_tmp.push_back(object_->ci_struct->hideZones);
|
|
|
+ }else{
|
|
|
+ hidezonenames_tmp=stringSplit(object_->ci_struct->hideZones,',');
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ renderer_->widgetFlag = QVTKRenderer::WidgetModel::ResultModel;
|
|
|
+ ResultManager* rsManager = NULL;
|
|
|
+ if(type_ == "one_plt_ascii_file"||type_ == "one_plt_binary_file"){
|
|
|
+ bool flag = true;
|
|
|
+ rsManager = new ResultMeshManager();
|
|
|
+ rsManager->Clear();
|
|
|
+ bool f =rsManager->LoadData(QString::fromStdString(filename));
|
|
|
+ set_hidezone_animation(hidezonenames_tmp,rsManager);
|
|
|
+ if(f){
|
|
|
+ rsManager->SetSaveIndex(0);
|
|
|
+ if(renderer_){
|
|
|
+ rsManager->DisplayMesh(renderer_);
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ flag = false;
|
|
|
+ }
|
|
|
+ if(flag)
|
|
|
+ {
|
|
|
+ rsManager->HideAllActors();
|
|
|
+ rsManager->ShowAll();
|
|
|
+ rsManager->DisplayMeshByIndex(0);
|
|
|
+ rsManager->SetNameTypeMap();
|
|
|
+ rsManager->InitWidgetsParameter();
|
|
|
+ renderer_->ZoomToExtents();
|
|
|
+ }
|
|
|
+ }else if(type_ == "vtkfile"){
|
|
|
+ rsManager = new ResultVTKManager();
|
|
|
+ rsManager->Clear();
|
|
|
+ rsManager->fileType = "VTK";
|
|
|
+ bool flag = true;
|
|
|
+ bool f = rsManager->LoadData(QString::fromStdString(filename));//加载
|
|
|
+ rsManager->uncontourVec_.clear();
|
|
|
+ if(f){
|
|
|
+ if(renderer_){
|
|
|
+ rsManager->DisplayMesh(renderer_);
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ flag = false;
|
|
|
+ }
|
|
|
+ if(flag){
|
|
|
+ rsManager->InitWidgetsParameter();
|
|
|
+ rsManager->SetNameTypeMap();
|
|
|
+ renderer_->ZoomToExtents();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if(object_->ci_struct->displaytype=="ContourDisplay"){
|
|
|
+ ContourDisplayW *contourdw = new ContourDisplayW();//云图窗口参数初始化
|
|
|
+ rsManager->SetCotourWidget(contourdw);
|
|
|
+ rsManager->SetWidgetRange();
|
|
|
+ rsManager->SetWidgetScalarName();
|
|
|
+ ContourDisplay* condis=new ContourDisplay(rsManager);
|
|
|
+ condis->contourdisplay_execute(object_);
|
|
|
+ send_picture(object_,renderer_,step);
|
|
|
+ if(contourdw!=NULL){
|
|
|
+ delete contourdw;
|
|
|
+ contourdw = NULL;
|
|
|
+ }
|
|
|
+ if(condis!=NULL){
|
|
|
+ delete condis;
|
|
|
+ condis = NULL;
|
|
|
+ }
|
|
|
+ }else if(object_->ci_struct->displaytype=="LineDisplay"){
|
|
|
+ LineDisplayW *linedw = new LineDisplayW();//等值线窗口初始化参数
|
|
|
+ rsManager->SetLineWidget(linedw);
|
|
|
+ LineDisplay* linedis = new LineDisplay(rsManager);
|
|
|
+ linedis->linedisplay_execute(object_);
|
|
|
+ send_picture(object_,renderer_,step);
|
|
|
+ if(linedw!=NULL){
|
|
|
+ delete linedw;
|
|
|
+ linedw = NULL;
|
|
|
+ }
|
|
|
+ if(linedis!=NULL){
|
|
|
+ delete linedis;
|
|
|
+ linedis = NULL;
|
|
|
+ }
|
|
|
+ }else if(object_->ci_struct->displaytype=="VectorDisplay"){
|
|
|
+ VectorW *vecdW = new VectorW();//矢量窗口初始化参数
|
|
|
+ rsManager->SetVectorWidget(vecdW);
|
|
|
+ Vectordisplay *vecdis = new Vectordisplay(rsManager);
|
|
|
+ vecdis->vectordisplay_execute(object_);
|
|
|
+ send_picture(object_,renderer_,step);
|
|
|
+ if(vecdW!=NULL){
|
|
|
+ delete vecdW;
|
|
|
+ vecdW = NULL;
|
|
|
+ }
|
|
|
+ if(vecdis!=NULL){
|
|
|
+ delete vecdis;
|
|
|
+ vecdis = NULL;
|
|
|
+ }
|
|
|
+ }else if(object_->ci_struct->displaytype=="SolidSurfaceDisplay"){
|
|
|
+ SolidSurfaceWidget* solidfW = new SolidSurfaceWidget();//实体表面窗口初始化参数
|
|
|
+ rsManager->SetSurfaceSolidWidget(solidfW);
|
|
|
+ SolidSurface *solidfdis = new SolidSurface(rsManager);
|
|
|
+ solidfdis->solidsurfce_execute(object_);
|
|
|
+ send_picture(object_,renderer_,step);
|
|
|
+ if(solidfW!=NULL){
|
|
|
+ delete solidfW;
|
|
|
+ solidfW = NULL;
|
|
|
+ }
|
|
|
+ if(solidfdis!=NULL){
|
|
|
+ delete solidfdis;
|
|
|
+ solidfdis = NULL;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if(rsManager!=NULL){
|
|
|
+ delete rsManager;
|
|
|
+ rsManager = NULL;
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+/*
|
|
|
+ * @brief: set animation hide zone in resultmanager
|
|
|
+ * @param: hidezone,resultmanager
|
|
|
+ * @ret: void
|
|
|
+ * @birth: created by czm in 20230627
|
|
|
+ */
|
|
|
+void handlePool::set_hidezone_animation(vector<string> &hidezonename, ResultManager *cmanager)
|
|
|
+{
|
|
|
+ int num = cmanager->meshObj_->GetZoneNumber();
|
|
|
+ vector<string> zonename_ = cmanager->meshObj_->GetZoneName();
|
|
|
+ vector<bool> vec_bool;
|
|
|
+ vec_bool.resize(num,true);
|
|
|
+ for(int i =0;i<hidezonename.size();i++){
|
|
|
+ for(int j =0;j<zonename_.size();j++){
|
|
|
+ if(hidezonename[i]==zonename_[j]){
|
|
|
+ vec_bool[j] = false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ cmanager->SetShowHideState(vec_bool);
|
|
|
+}
|