|
@@ -65,7 +65,6 @@ handlePool::~handlePool()
|
|
|
*/
|
|
|
void handlePool::getmsg_recvstateTohandlePool(std::string recvmsg)
|
|
|
{
|
|
|
- std::cout<<"recvmsg"<<recvmsg<<std::endl;
|
|
|
boostJsonObject* json_object = new boostJsonObject();
|
|
|
QVTKRenderer* render_=NULL;
|
|
|
try{//处理异常
|
|
@@ -245,13 +244,6 @@ void handlePool::judgeLoaddata(boostJsonObject *object, QVTKRenderer *render_)
|
|
|
}
|
|
|
}
|
|
|
QString m_filePath = QString::fromStdString(object->filePath);//测试路径
|
|
|
- //QString m_filePath = "F:\\czm\\vtkfile\\tfg.ugrid";
|
|
|
- // if(object->solverConfigid=="b867ebb4a49d4c7a8ce66d6b07b6f333"){
|
|
|
- // m_filePath = "F:\\czm\\vtkfile\\f.vtk";
|
|
|
- // //m_filePath = "F:\\czm\\vtkfile\\forward.ugrid";
|
|
|
- // }
|
|
|
-
|
|
|
- //QString m_filePath = "C:\\Users\\Administrator\\Desktop\\VTK\\f.vtk";
|
|
|
QFileInfo fileinfo_(m_filePath);
|
|
|
if(!fileinfo_.isFile()){
|
|
|
cout<<"file path is Empty!"<<endl;
|
|
@@ -289,9 +281,8 @@ void handlePool::judgeLoaddata(boostJsonObject *object, QVTKRenderer *render_)
|
|
|
bool handlePool::resultImport(boostJsonObject *object_, QVTKRenderer *renderer_)
|
|
|
{
|
|
|
string type_;
|
|
|
- //object_->ci_struct->filenames.push_back();
|
|
|
+ //object_->fileName = "dynamicResponse-transient36.vtk";//测试
|
|
|
//object_->fileName = "hcfd_tec_boundary_timestep100.dat";
|
|
|
- //object_->fileName = "whole_part1.plt,whole_part2.plt";
|
|
|
size_t found = object_->fileName.find_first_of(',');
|
|
|
if(found==string::npos){//单个文件
|
|
|
vector<string> tmp = stringSplit(object_->fileName,'.');
|
|
@@ -347,7 +338,7 @@ bool handlePool::resultImport(boostJsonObject *object_, QVTKRenderer *renderer_)
|
|
|
}
|
|
|
//object_->filePath = "F:\\czm\\vtkfile";
|
|
|
//object_->filePath = "C:\\Users\\Administrator\\Desktop\\Postprocess_Binary";//测试路径
|
|
|
- //object_->filePath = "C:\\Users\\Administrator\\Documents\\WeChat Files\\wxid_18qjhi0tq90d22\\FileStorage\\File\\2023-06";//测试路径
|
|
|
+ //object_->filePath = "C:\\Users\\Administrator\\Documents\\WeChat Files\\wxid_18qjhi0tq90d22\\FileStorage\\File\\2023-05";//测试路径
|
|
|
QDir dir(QString::fromStdString(object_->filePath));
|
|
|
if(!dir.exists()){
|
|
|
return false;
|
|
@@ -428,7 +419,6 @@ bool handlePool::resultImport(boostJsonObject *object_, QVTKRenderer *renderer_)
|
|
|
return false;
|
|
|
}
|
|
|
}else if(type_ == "vtkfile"){
|
|
|
- //object_->fileName = "dynamicResponse-transient36.vtk";//测试
|
|
|
rsManager = new ResultVTKManager();
|
|
|
rsManager->Clear();
|
|
|
rsManager->fileType = "VTK";
|
|
@@ -494,7 +484,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)));//发送流线结果数据
|
|
|
- if(type_!="vtkfile"){
|
|
|
+ if(type_!="vtkfile"){//vtk没有zone就不发
|
|
|
emit sendImg_handlePoolToSendstate(object_->ToJson("importResult_animation",buildResultImport_msg("animation",rsManager)));//发送动画所需的zonename
|
|
|
}
|
|
|
send_picture(object_,renderer_);
|
|
@@ -737,12 +727,7 @@ bool handlePool::result_contourinimationdisplay(boostJsonObject *object_, QVTKRe
|
|
|
}
|
|
|
}
|
|
|
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_);
|
|
|
+ animation_render(object_->ci_struct->filenames[i],object_->ci_struct->steps[i],render_,object_);
|
|
|
}
|
|
|
delete object_;
|
|
|
object_ = NULL;
|
|
@@ -1158,23 +1143,32 @@ vector<string> handlePool::stringSplit(const string& str, char delim) {
|
|
|
void handlePool::get_init_scalar_range(ResultManager* cmanager)
|
|
|
{
|
|
|
if(cmanager->solveTimes_.size()>1)return;
|
|
|
- double sltime = *(cmanager->solveTimes_.begin());
|
|
|
- map<double,map<string,vtkVISUnContour*>>::iterator it1 = cmanager->vtkVisZoneMeshMap_.find(sltime);
|
|
|
- vector<string> temp_scalar = cmanager->GetMeshScalarNameVec();
|
|
|
- if(cmanager->fileType == "plt_binary"){
|
|
|
+ if(cmanager->fileType!="VTK"){//非vtk文件标量范围
|
|
|
+ double sltime = *(cmanager->solveTimes_.begin());
|
|
|
+ map<double,map<string,vtkVISUnContour*>>::iterator it1 = cmanager->vtkVisZoneMeshMap_.find(sltime);
|
|
|
+ vector<string> temp_scalar = cmanager->GetMeshScalarNameVec();
|
|
|
+ if(cmanager->fileType == "plt_binary"){
|
|
|
+ for(int i =0;i<temp_scalar.size();i++){
|
|
|
+ temp_scalar[i] = removeSpaces(temp_scalar[i]);
|
|
|
+ }
|
|
|
+ }
|
|
|
for(int i =0;i<temp_scalar.size();i++){
|
|
|
- temp_scalar[i] = removeSpaces(temp_scalar[i]);
|
|
|
+ set<double> temp;
|
|
|
+ for(map<string,vtkVISUnContour*>::iterator unIt = it1->second.begin();unIt!=it1->second.end();unIt++){
|
|
|
+ double range[2];
|
|
|
+ unIt->second->GetScalarRange(range,(char*)temp_scalar[i].c_str());
|
|
|
+ temp.insert(range[0]);
|
|
|
+ temp.insert(range[1]);
|
|
|
+ }
|
|
|
+ allscalarrange[temp_scalar[i]] = temp;
|
|
|
+ }
|
|
|
+ }else{//vtk文件标量范围
|
|
|
+ for(int i=0;i<cmanager->source->scalarNumber_;i++){
|
|
|
+ set<double> temp;
|
|
|
+ temp.insert(cmanager->source->scalarRange[i][0]);
|
|
|
+ temp.insert(cmanager->source->scalarRange[i][1]);
|
|
|
+ allscalarrange[cmanager->source->scalarName[i]] =temp;
|
|
|
}
|
|
|
- }
|
|
|
- for(int i =0;i<temp_scalar.size();i++){
|
|
|
- set<double> temp;
|
|
|
- for(map<string,vtkVISUnContour*>::iterator unIt = it1->second.begin();unIt!=it1->second.end();unIt++){
|
|
|
- double range[2];
|
|
|
- unIt->second->GetScalarRange(range,(char*)temp_scalar[i].c_str());
|
|
|
- temp.insert(range[0]);
|
|
|
- temp.insert(range[1]);
|
|
|
- }
|
|
|
- allscalarrange[temp_scalar[i]] = temp;
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -1186,8 +1180,15 @@ void handlePool::get_init_scalar_range(ResultManager* cmanager)
|
|
|
*/
|
|
|
void handlePool::animation_render(string filename,int step,QVTKRenderer* renderer_,boostJsonObject* object_)
|
|
|
{
|
|
|
- string type_;
|
|
|
+
|
|
|
vector<string> tmp = stringSplit(filename,'.');
|
|
|
+#ifdef _WIN32
|
|
|
+ string fname_ = object_->filePath+"\\"+filename;
|
|
|
+#else
|
|
|
+ string fname_ = object_->filePath+"/"+filename;
|
|
|
+#endif
|
|
|
+ string type_;
|
|
|
+
|
|
|
if(tmp[1]=="vtk"){
|
|
|
type_ = "vtkfile";
|
|
|
}else if(tmp[1]=="dat"){
|
|
@@ -1197,22 +1198,26 @@ void handlePool::animation_render(string filename,int step,QVTKRenderer* rendere
|
|
|
}
|
|
|
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,',');
|
|
|
+ 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,',');
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- renderer_->widgetFlag = QVTKRenderer::WidgetModel::ResultModel;
|
|
|
+
|
|
|
ResultManager* rsManager = NULL;
|
|
|
if(type_ == "one_plt_ascii_file"||type_ == "one_plt_binary_file"){
|
|
|
+ renderer_->widgetFlag = QVTKRenderer::WidgetModel::ResultModel;
|
|
|
bool flag = true;
|
|
|
rsManager = new ResultMeshManager();
|
|
|
rsManager->Clear();
|
|
|
- bool f =rsManager->LoadData(QString::fromStdString(filename));
|
|
|
- set_hidezone_animation(hidezonenames_tmp,rsManager);
|
|
|
+ bool f =rsManager->LoadData(QString::fromStdString(fname_));
|
|
|
+ if(!hidezonenames_tmp.empty()){
|
|
|
+ set_hidezone_animation(hidezonenames_tmp,rsManager);
|
|
|
+ }
|
|
|
if(f){
|
|
|
rsManager->SetSaveIndex(0);
|
|
|
if(renderer_){
|
|
@@ -1231,11 +1236,12 @@ void handlePool::animation_render(string filename,int step,QVTKRenderer* rendere
|
|
|
renderer_->ZoomToExtents();
|
|
|
}
|
|
|
}else if(type_ == "vtkfile"){
|
|
|
+ renderer_->widgetFlag = QVTKRenderer::WidgetModel::VTKModel;
|
|
|
rsManager = new ResultVTKManager();
|
|
|
rsManager->Clear();
|
|
|
rsManager->fileType = "VTK";
|
|
|
bool flag = true;
|
|
|
- bool f = rsManager->LoadData(QString::fromStdString(filename));//加载
|
|
|
+ bool f = rsManager->LoadData(QString::fromStdString(fname_));//加载
|
|
|
rsManager->uncontourVec_.clear();
|
|
|
if(f){
|
|
|
if(renderer_){
|