Browse Source

0705 修改动画中加载多个dat文件bug

caizm 2 năm trước cách đây
mục cha
commit
b075a80a2a

+ 49 - 35
CAE_Solution/src/threadPool_and_statemachine/dealWith/handlepool.cpp

@@ -727,14 +727,14 @@ bool handlePool::result_contourinimationdisplay(boostJsonObject *object_, QVTKRe
         }
     }
 
-//    object_->ci_struct->filenames.clear();测试
-//    object_->ci_struct->filenames.resize(1);
-//    object_->ci_struct->filenames[0] = "dynamicResponse-transient1.vtk";
-//    object_->ci_struct->steps.clear();
-//    object_->ci_struct->steps.resize(1);
-//    object_->ci_struct->steps[0] = 1;
-//    object_->filePath = "F:\\czm\\vtkfile";
-//    object_->cd_struct->scalarName = "Displacement-magnitude";
+    //    object_->ci_struct->filenames.clear();测试
+    //    object_->ci_struct->filenames.resize(1);
+    //    object_->ci_struct->filenames[0] = "dynamicResponse-transient1.vtk";
+    //    object_->ci_struct->steps.clear();
+    //    object_->ci_struct->steps.resize(1);
+    //    object_->ci_struct->steps[0] = 1;
+    //    object_->filePath = "F:\\czm\\vtkfile";
+    //    object_->cd_struct->scalarName = "Displacement-magnitude";
 
     for(int i =0;i<object_->ci_struct->filenames.size();i++){
         animation_render(object_->ci_struct->filenames[i],object_->ci_struct->steps[i],render_,object_);
@@ -1194,13 +1194,14 @@ void handlePool::get_init_scalar_range(ResultManager* cmanager)
  */
 void handlePool::animation_render(string filename,int step,QVTKRenderer* renderer_,boostJsonObject* object_)
 {
+    vector<string> temp;
+    if(filename.find_first_of(",")!=string::npos){
+        temp = stringSplit(filename,',');
+    }else {
+        temp.push_back(filename);
+    }
 
-    vector<string> tmp = stringSplit(filename,'.');
-#ifdef _WIN32
-    string fname_ = object_->filePath+"\\"+filename;
-#else
-    string fname_ = object_->filePath+"/"+filename;
-#endif
+    vector<string> tmp = stringSplit(temp[0],'.');
     string type_;
 
     if(tmp[1]=="vtk"){
@@ -1210,17 +1211,6 @@ void handlePool::animation_render(string filename,int step,QVTKRenderer* rendere
     }else if(tmp[1]=="plt"){
         type_ = "one_plt_binary_file";
     }
-    vector<string> hidezonenames_tmp;
-    if(type_!="vtkfile"){
-        if(!object_->ci_struct->hideZones.empty()){
-            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,',');
-            }
-        }
-    }
-
 
     ResultManager* rsManager = NULL;
     if(type_ == "one_plt_ascii_file"||type_ == "one_plt_binary_file"){
@@ -1228,17 +1218,21 @@ void handlePool::animation_render(string filename,int step,QVTKRenderer* rendere
         bool flag = true;
         rsManager = new ResultMeshManager();
         rsManager->Clear();
-        bool f =rsManager->LoadData(QString::fromStdString(fname_));
-        if(!hidezonenames_tmp.empty()){
-            set_hidezone_animation(hidezonenames_tmp,rsManager);
-        }
-        if(f){
-            rsManager->SetSaveIndex(0);
-            if(renderer_){
-                rsManager->DisplayMesh(renderer_);
+        for(int i =0;i<temp.size();i++){
+#ifdef _WIN32
+            string fname_ = object_->filePath+"\\"+temp[i];
+#else
+            string fname_ = object_->filePath+"/"+temp[i];
+#endif
+            bool f =rsManager->LoadData(QString::fromStdString(fname_));
+            if(f){
+                rsManager->SetSaveIndex(0);
+                if(renderer_){
+                    rsManager->DisplayMesh(renderer_);
+                }
+            }else{
+                flag = false;
             }
-        }else{
-            flag = false;
         }
         if(flag)
         {
@@ -1255,6 +1249,11 @@ void handlePool::animation_render(string filename,int step,QVTKRenderer* rendere
         rsManager->Clear();
         rsManager->fileType = "VTK";
         bool flag = true;
+#ifdef _WIN32
+            string fname_ = object_->filePath+"\\"+temp[0];
+#else
+            string fname_ = object_->filePath+"/"+temp[0];
+#endif
         bool f = rsManager->LoadData(QString::fromStdString(fname_));//加载
         rsManager->uncontourVec_.clear();
         if(f){
@@ -1270,6 +1269,21 @@ void handlePool::animation_render(string filename,int step,QVTKRenderer* rendere
             renderer_->ZoomToExtents();
         }
     }
+
+    vector<string> hidezonenames_tmp;
+    if(type_!="vtkfile"){
+        if(!object_->ci_struct->hideZones.empty()){
+            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,',');
+            }
+        }
+    }
+    if(!hidezonenames_tmp.empty()){
+        set_hidezone_animation(hidezonenames_tmp,rsManager);
+    }
+
     renderer_->camera_->TransformToIsometric();
     if(object_->ci_struct->displaytype=="ContourDisplay"){
         ContourDisplayW *contourdw = new ContourDisplayW();//云图窗口参数初始化