Ver código fonte

0511 添加异常处理

caizm 2 anos atrás
pai
commit
9c4c01651f

+ 2 - 2
CAE_Solution/conf/conf_recv.txt

@@ -4,6 +4,6 @@ userName:admin
 password:admin
 
 channel_id:1
-queue_name:BLOCKcaeint
+queue_name:BLOCKcaein
 exchange_name:BLOCKMQ-EXCHANGE
-keys_name:caeint
+keys_name:caein

+ 2 - 2
CAE_Solution/conf/conf_send.txt

@@ -4,6 +4,6 @@ userName:admin
 password:admin
 
 channel_id:1
-queue_name:BLOCKcaeoutt
+queue_name:BLOCKcaeout
 exchange_name:BLOCKMQ-EXCHANGE
-keys_name:caeoutt
+keys_name:caeout

+ 13 - 0
CAE_Solution/src/Rabbitmq/c_rabbitmq/crabbitmqclient.cpp

@@ -313,6 +313,19 @@ int32_t CRabbitMqClient::ConsumerMessage(std::string &message,
     }
 
     message = std::string((char *)envelope.message.body.bytes, (char *)envelope.message.body.bytes + envelope.message.body.len);
+
+//    stringstream  str_stream((char * )envelope.message.body.bytes);
+//    ptree root;
+//    read_json(str_stream,root);
+//    string  param= root.get<string>("paramJson");
+//    string age = root.get<string>("usrId");
+
+
+    /*char* p= new char[sizeof(envelope.message.body.bytes)];
+    memcpy( p, envelope.message.body.bytes, sizeof(envelope.message.body.bytes));
+    p[sizeof(envelope.message.body.bytes)] = 0;
+    std::string str(p);
+    message = str;*/
     amqp_destroy_envelope(&envelope);
 
     return 0;

+ 5 - 2
CAE_Solution/src/Rabbitmq/c_rabbitmq/crabbitmqclient.h

@@ -6,7 +6,9 @@
 #include "cmessage.hpp"
 #include "cqueue.hpp"
 #include <vector>
-
+#include <sstream>
+#include <boost/property_tree/ptree.hpp>
+#include <boost/property_tree/json_parser.hpp>
 #ifdef unix
 #include "../../../Libs/rabbitmq/centos8/include/amqp.h"
 #include "../../../Libs/rabbitmq/centos8/include/amqp_framing.h"
@@ -21,7 +23,8 @@
 #include "../../../Libs/rabbitmq/win/include/rabbitmq-c/export.h"
 #endif
 
-
+using namespace std;
+using namespace boost::property_tree;
 
 /**
 *   @brief RabbitMq封装类

+ 24 - 3
CAE_Solution/src/Rabbitmq/rabbitClient/rabbitclient.cpp

@@ -124,7 +124,26 @@ int rabbitClient::recvMsg()
             cout<<"t.c_str() = "<<t.c_str()<<endl;
             t.erase(0,1);//暂时移除首尾{}
             t.erase(t.end()-1);
-            int num1 = t.find_first_of('{',0);
+            /******************************/  //去除param数组里面的多余转义字符
+            int temp1 = t.find_first_of('[');
+            int temp2 = t.find_first_of(']');
+            if(-1 != temp1){
+                string array_first_t;
+                array_first_t = t.substr(0,temp1);
+                string array_middle_t;
+                for(int i = temp1;i<=temp2;i++){
+                    if(t[i] == '"'){
+                        array_middle_t += '\\';
+                    }
+                    array_middle_t+=t[i];
+                }
+                string array_end_t;
+                array_end_t = t.substr(temp2+1);
+                t.clear();
+                t = '{' + array_first_t+array_middle_t+array_end_t+'}';
+            }else{
+            /******************************/
+            int num1 = t.find_first_of('{',0);//去除paramjson里面的多余转义字符
             int num2 = t.find_first_of('}',0);
             if(num1!=-1){
                 string first_t;
@@ -143,9 +162,11 @@ int rabbitClient::recvMsg()
             }else{
                 t = '{' + t + '}';
             }
-            emit sendmsg_recvclientToRecvstate(t);//信号
+
+            }
+            emit sendmsg_recvclientToRecvstate(t);//信号*/
              //0509
-            //emit sendmsg_recvclientToRecvstate(str);
+            //emit sendmsg_recvclientToRecvstate(tmp);
         }
         QThread::sleep(1);
     }

+ 21 - 0
CAE_Solution/src/VTK/display/slicewidget.cpp

@@ -42,6 +42,27 @@ void SliceWidget::slicewidget_execute(boostJsonObject* object)
 //        static_cast<SsliceWidget*>(m_pWidget)->SetCurrWidget(index);
     this->Cmanager->InitSliceWidget();
     SsliceWidget * sswidget = this->Cmanager->sliceW_;
+    for(int i =0;i<object->vec_sd_struct.size();i++){
+        SliceDisplayWidget* sdw = sswidget->map_SliceDisplayWidget[object->vec_sd_struct[i]->index];
+        sliceDisplay_struct* sd_struct = object->vec_sd_struct[i];
+        sdw->SetSolidCondition(sd_struct->solid_state);
+        sdw->SetPlaneCondition(sd_struct->sectional_plane_state);
+        vector<double> normal_tmp;
+        normal_tmp.push_back(sd_struct->normal_x);
+        normal_tmp.push_back(sd_struct->normal_y);
+        normal_tmp.push_back(sd_struct->normal_z);
+        sdw->SetNormal(normal_tmp);
+        vector<double> position_tmp;
+        position_tmp.push_back(sd_struct->position_x);
+        position_tmp.push_back(sd_struct->position_y);
+        position_tmp.push_back(sd_struct->position_z);
+        sdw->SetPosition(position_tmp);
+        sdw->SetType(sd_struct->type);
+        sdw->SetcurrentVName(sd_struct->variableName);
+        sdw->SetColorLevel(sd_struct->level);
+        sdw->SetSectionalPlaneCondition(sd_struct->sectional_contour_state);
+        sdw->SetScalarValueCondition(sd_struct->scalar_value_state);
+    }
     this->Cmanager->SetAllSliceState(sswidget->GetSliceId(),
                                      sswidget->GetSolidState(),
                                      sswidget->GetPlaneWidgetState(),

+ 21 - 12
CAE_Solution/src/VTK/display/streamwidget.cpp

@@ -1,28 +1,22 @@
 #include "streamwidget.h"
 #include "../Manager/ResultMeshManager.h"
 
-StreamWidget::StreamWidget()
+StreamWidget::StreamWidget(ResultMeshManager* rs)
 {
-
+    this->Cmanager = rs;
    // ResultMeshManager::getInstance()->SetStremWidget(static_cast<StreamWidget*>(m_pWidget));
 }
 StreamWidget::~StreamWidget()
 {
+    this->Cmanager = NULL;
 }
 
-
-void StreamWidget::updateFromInters()
-{
-    //update setting data from widgets.
-}
-
-void StreamWidget::updateFromParams()
+ResultMeshManager *StreamWidget::getResultMeshManager()
 {
-    //update setting data from params.
-
+    return this->Cmanager;
 }
 
-void StreamWidget::StreamWidget_execute()
+void StreamWidget::StreamWidget_execute(boostJsonObject* object)
 {
 
     //apply setting data.
@@ -34,5 +28,20 @@ void StreamWidget::StreamWidget_execute()
 //                                                        static_cast<StreamWidget*>(m_pWidget)->GetShowHideState(),
 //                                                        static_cast<StreamWidget*>(m_pWidget)->GetToolState());
 
+    StreamDisplayWidget* m_pWidget = Cmanager->streamW_;
+    m_pWidget->current_direction = object->sm_struct->direction;
+    m_pWidget->current_StreamStyle = object->sm_struct->streamstyle;
+    m_pWidget->initialStep = object->sm_struct->initialstep;
+    m_pWidget->MaxPropagation = object->sm_struct->maxpropagation;
+    m_pWidget->MinimumStep = object->sm_struct->minimumstep;
+    m_pWidget->showstate = object->sm_struct->showstate;
+    m_pWidget->toolstate = object->sm_struct->toolstate;
+    Cmanager->DisplayStreamLine(m_pWidget->GetDirection(),
+                                m_pWidget->GetType(),
+                                m_pWidget->GetInitStepData(),
+                                m_pWidget->GetMaxPropgationData(),
+                                m_pWidget->GetMinStepData(),
+                                m_pWidget->GetShowHideState(),
+                                m_pWidget->GetToolState());
 }
 

+ 7 - 6
CAE_Solution/src/VTK/display/streamwidget.h

@@ -1,21 +1,22 @@
 #pragma once
 
 #include <QObject>
-
+#include "../Manager/ResultMeshManager.h"
+#include "../../threadPool_and_statemachine/dealWith/boostjsonobject.h"
+#include "../widget/streamDisplaywidget.h"
 
 
 
 class StreamWidget
 {
 public:
-    StreamWidget();
+    StreamWidget(ResultMeshManager* rs);
     virtual ~StreamWidget();
     virtual QString getName() { return QObject::tr("Stream"); }
-
-    virtual void updateFromInters();
-    virtual void updateFromParams();
-    virtual void StreamWidget_execute();
+    virtual void StreamWidget_execute(boostJsonObject*);
+    ResultMeshManager* getResultMeshManager();
 private:
+    ResultMeshManager* Cmanager;
 
 };
 

+ 506 - 0
CAE_Solution/src/VTK/widget/Sslicewidget.cpp

@@ -0,0 +1,506 @@
+#include "Sslicewidget.h"
+#include <QHBoxLayout>
+#include <QVBoxLayout>
+#include <QDebug>
+
+/**
+* @brief the constructor.
+*
+* @param[in]
+* @param[out]
+* @return
+* @author HeJingJing
+* @date 20230215
+*/
+SsliceWidget::SsliceWidget()
+{
+    scalarNameVec.clear();
+    zoneIdVec.clear();
+    //this->setFixedSize(300,500);
+    index = 0;
+    oldIndex = -1;
+}
+
+/**
+ * @brief add new page.
+ *
+ * @param[in]
+ * @param[out]
+ * @return
+ * @author HeJingJing
+ * @date 20230216
+ */
+void SsliceWidget::AddPage()
+{
+    Setting = new SliceDisplayWidget();
+    if (!zoneIdVec.empty())
+    {
+        Setting->SetAreaRange(zoneIdVec);
+    }
+    if (!scalarNameVec.empty())
+    {
+        Setting->SetVariableName(scalarNameVec);
+    }
+    //QString str = QString::number(index);
+    //TabWidget->addTab(Setting,str);
+    //TabWidget->setCurrentIndex(TabWidget->count()-1);
+    map_SliceDisplayWidget.insert(index,Setting);
+    //   Setting->SetPosition(ResultMeshManager::getInstance()->GetUnslicePosition(index));
+    //   Setting->SetPositionRange(ResultMeshManager::getInstance()->GetUnsliceSourceBounds(index));
+    //   index++;
+}
+/**
+ * @brief clear current page.
+ * @param[in]
+ * @param[out]
+ * @return
+ * @author HeJingJing
+ * @date 20230216
+ */
+void SsliceWidget::ClearPage()
+{
+    UpdateWidget();
+    //    int index = TabWidget->currentIndex();
+    //    TabWidget->removeTab(index);
+}
+/**
+ * @brief get page count.
+ * @param[in]
+ * @param[out]
+ * @return
+ * @author HeJingJing
+ * @date 20230216
+ */
+int SsliceWidget::GetPagecount()
+{
+    int count;
+    //count = TabWidget->count();
+    count = map_SliceDisplayWidget.size();
+    return count;
+}
+/**
+ * @brief get current page.
+ * @param[in]
+ * @param[out]
+ * @return
+ * @author HeJingJing
+ * @date 20230216
+ */
+vector<string> SsliceWidget::GetPageName()
+{
+    vector<string> str;
+    //for(int i = 0 ;i < TabWidget->count(); i++)
+    for(auto iter = map_SliceDisplayWidget.begin();iter!=map_SliceDisplayWidget.end();iter++)
+    {
+        //str.push_back(TabWidget->tabText(i).toStdString());
+        str.push_back(QString::number(iter.key()).toStdString());
+    }
+    return str;
+}
+/**
+ * @brief get pageId.
+ * @param[in]
+ * @param[out]
+ * @return
+ * @author HeJingJing
+ * @date 20230227
+ */
+vector<int> SsliceWidget::GetSliceId()
+{
+    vector<int> id;
+    //for(int i = 0; i < TabWidget->count(); i++)
+    for(auto iter = map_SliceDisplayWidget.begin();iter != map_SliceDisplayWidget.end();iter++)
+    {
+        //id.push_back(TabWidget->tabText(i).toInt());
+        id.push_back(iter.key());
+    }
+    return id;
+}
+/**
+ * @brief get solid state.
+ * @param[in]
+ * @param[out]
+ * @return
+ * @author HeJingJing
+ * @date 20230227
+ */
+vector<bool> SsliceWidget::GetSolidState()
+{
+    vector<bool> solidatate;
+    //for(int j = 0 ; j < TabWidget->count(); j++)
+    for(auto iter = map_SliceDisplayWidget.begin();iter!= map_SliceDisplayWidget.end();iter++)
+    {
+        //TabWidget->setCurrentIndex(j);
+        //Setting = static_cast<SliceWidget*>(TabWidget->currentWidget());
+        Setting = iter.value();
+        solidatate.push_back( Setting->GetSoildCondition());
+
+    }
+    return solidatate;
+}
+/**
+ * @brief get PlaneWidget state.
+ * @param[in]
+ * @param[out]
+ * @return
+ * @author HeJingJing
+ * @date 20230227
+ */
+vector<bool> SsliceWidget::GetPlaneWidgetState()
+{
+    vector<bool>planews;
+    //for(int i = 0 ; i < TabWidget->count(); i++)
+    for(auto iter = map_SliceDisplayWidget.begin();iter!= map_SliceDisplayWidget.end();iter++)
+    {
+        //TabWidget->setCurrentIndex(i);
+        //Setting = static_cast<SliceWidget*>(TabWidget->currentWidget());
+        Setting = iter.value();
+        planews.push_back(Setting->GetPlaneCondition());
+    }
+    return planews;
+}
+/**
+ * @brief get noarmal data.
+ * @param[in]
+ * @param[out]
+ * @return
+ * @author HeJingJing
+ * @date 20230227
+ */
+vector<vector<double>> SsliceWidget::GetNormal()
+{
+    vector<vector<double>> a;
+    //for(int i = 0 ; i < TabWidget->count(); i++)
+    for(auto iter = map_SliceDisplayWidget.begin();iter!= map_SliceDisplayWidget.end();iter++)
+    {
+        vector<double> b;
+        //TabWidget->setCurrentIndex(i);
+        //Setting = static_cast<SliceWidget*>(TabWidget->currentWidget());
+        Setting = iter.value();
+        b.push_back(Setting->GetNormal().at(0));
+        b.push_back(Setting->GetNormal().at(1));
+        b.push_back(Setting->GetNormal().at(2));
+        a.push_back(b);
+    }
+    return a;
+}
+/**
+ * @brief get position data.
+ * @param[in]
+ * @param[out]
+ * @return
+ * @author HeJingJing
+ * @date 20230227
+ */
+vector<vector<double>> SsliceWidget::GetPosition()
+{
+    vector<vector<double>> c;
+    //for(int i = 0 ; i < TabWidget->count(); i++)
+    for(auto iter = map_SliceDisplayWidget.begin();iter!= map_SliceDisplayWidget.end();iter++)
+    {
+        vector<double> d;
+        //TabWidget->setCurrentIndex(i);
+        //Setting = static_cast<SliceWidget*>(TabWidget->currentWidget());
+        Setting = iter.value();
+        d.push_back(Setting->GetPosition().at(0));
+        d.push_back(Setting->GetPosition().at(1));
+        d.push_back(Setting->GetPosition().at(2));
+        c.push_back(d);
+    }
+    return c;
+}
+/**
+ * @brief get type.
+ * @param[in]
+ * @param[out]
+ * @return
+ * @author HeJingJing
+ * @date 20230227
+ */
+vector<string> SsliceWidget::GetType()
+{
+    vector<string> type;
+    //for(int i = 0 ; i < TabWidget->count(); i++)
+    for(auto iter = map_SliceDisplayWidget.begin();iter!= map_SliceDisplayWidget.end();iter++)
+    {
+        //TabWidget->setCurrentIndex(i);
+        //Setting = static_cast<SliceWidget*>(TabWidget->currentWidget());
+        Setting = iter.value();
+        type.push_back(Setting->GetType().at(0));
+    }
+    return type;
+}
+/**
+ * @brief get variable name.
+ * @param[in]
+ * @param[out]
+ * @return
+ * @author HeJingJing
+ * @date 20230227
+ */
+vector<string> SsliceWidget::GetVName()
+{
+    vector<string> vname;
+    //for(int i = 0 ; i < TabWidget->count() ;i++)
+    for(auto iter = map_SliceDisplayWidget.begin();iter!= map_SliceDisplayWidget.end();iter++)
+    {
+        //TabWidget->setCurrentIndex(i);
+        //Setting = static_cast<SliceWidget*>(TabWidget->currentWidget());
+        Setting = iter.value();
+        vname.push_back(Setting->GetVariableName().at(0));
+    }
+    return vname;
+}
+/**
+ * @brief get level data.
+ * @param[in]
+ * @param[out]
+ * @return
+ * @author HeJingJing
+ * @date 20230227
+ */
+vector<int> SsliceWidget::GetLevel()
+{
+    vector<int> le;
+    //for(int i = 0 ; i < TabWidget->count(); i++)
+    for(auto iter = map_SliceDisplayWidget.begin();iter!= map_SliceDisplayWidget.end();iter++)
+    {
+        //TabWidget->setCurrentIndex(i);
+        //Setting = static_cast<SliceWidget*>(TabWidget->currentWidget());
+        Setting = iter.value();
+        le.push_back(Setting->GetColorLevel().at(0));
+    }
+    return le;
+}
+/**
+ * @brief get plane state.
+ * @param[in]
+ * @param[out]
+ * @return
+ * @author HeJingJing
+ * @date 20230227
+ */
+vector<bool> SsliceWidget::GetPlaneState()
+{
+    vector<bool> ps;
+    //for(int i = 0 ; i < TabWidget->count(); i++)
+    for(auto iter = map_SliceDisplayWidget.begin();iter!= map_SliceDisplayWidget.end();iter++)
+    {
+        //TabWidget->setCurrentIndex(i);
+        //Setting = static_cast<SliceWidget*>(TabWidget->currentWidget());
+        Setting = iter.value();
+        ps.push_back(Setting->GetSectionalPlaneCondition());
+    }
+    return ps;
+}
+/**
+ * @brief get label state.
+ * @param[in]
+ * @param[out]
+ * @return
+ * @author HeJingJing
+ * @date 20230227
+ */
+vector<bool> SsliceWidget::GetLabelState()
+{
+    vector<bool> ls;
+    //for(int i = 0 ; i < TabWidget->count(); i++)
+    for(auto iter = map_SliceDisplayWidget.begin();iter!= map_SliceDisplayWidget.end();iter++)
+    {
+        //TabWidget->setCurrentIndex(i);
+        //Setting = static_cast<SliceWidget*>(TabWidget->currentWidget());
+        Setting = iter.value();
+        ls.push_back(Setting->GetScalarValueCondition());
+    }
+    return ls;
+}
+/**
+ * @brief  pass parameters to the current page.
+ * @param[in]
+ * @param[out]
+ * @return
+ * @author HeJingJing
+ * @date 20230228
+ */
+void SsliceWidget::UpdateWidget()
+{
+    //ResultMeshManager::getInstance()->UpdataSliceWidgetParameter();
+    //oldIndex = TabWidget->currentIndex();
+    //for(int i = 0 ; i < map_SliceDisplayWidget.size() ; i++)
+    int i=0;
+    for(auto iter =map_SliceDisplayWidget.begin();iter!= map_SliceDisplayWidget.end();iter++)
+    {
+        //TabWidget->setCurrentIndex(i);
+        //Setting = static_cast<SliceWidget*>(TabWidget->currentWidget());
+        Setting = iter.value();
+        Setting->SetNormal(normal.at(i));
+        Setting->SetPosition(position.at(i));
+        i++;
+    }
+    //TabWidget->setCurrentIndex(oldIndex);
+}
+/**
+ * @brief  set scalar Name Vector.
+ * @param[in] scalar Name Vector
+ * @param[out]
+ * @return
+ * @author ZhaoYu
+ * @date 20230301
+ */
+void SsliceWidget::GetScalarName(vector<string> vec)
+{
+    scalarNameVec.clear();
+    scalarNameVec = vec;
+}
+/**
+ * @brief  set zone id Vector.
+ * @param[in] zone id Vector
+ * @param[out]
+ * @return
+ * @author ZhaoYu
+ * @date 20230301
+ */
+void SsliceWidget::GetZoneId(vector<int> vec)
+{
+    zoneIdVec.clear();
+    zoneIdVec = vec;
+}
+/**
+ * @brief the destructor.
+ *
+ * @param[in]
+ * @param[out]
+ * @return
+ * @author HeJingJing
+ * @date 20230216
+ */
+SsliceWidget::~SsliceWidget()
+{
+    qDeleteAll(map_SliceDisplayWidget);
+}
+
+/**
+ * @brief restore initial widget
+ *
+ * @param[in]
+ * @param[out]
+ * @return
+ * @author zhaoyu
+ * @date 20230316
+ */
+void SsliceWidget::RestoreWidget() //important
+{
+//    for (int i = TabWidget->count() - 1; TabWidget->count() > 0; i --)
+//    {
+//        TabWidget->removeTab(i);
+//    }
+    scalarNameVec.clear();
+    zoneIdVec.clear();
+    index = 0;
+    oldIndex = -1;
+}
+
+/**
+ * @brief get current index
+ *
+ * @param[in]
+ * @param[out] int currindex
+ * @return
+ * @author zhaoyu
+ * @date 20230316
+ */
+//int SsliceWidget::GetOldIndex()
+//{
+//    return TabWidget->currentIndex();
+//}
+/**
+ * @brief set current widget
+ *
+ * @param[in] int index
+ * @param[out]
+ * @return
+ * @author zhaoyu
+ * @date 20230316
+ */
+//void SsliceWidget::SetCurrWidget(int page)
+//{
+//    TabWidget->setCurrentIndex(page);
+//}
+/**
+* @brief set Text function
+*
+* detail data information
+* @param[in/out]
+* @return
+* @author hejingjing
+* @date 20230324
+*/
+//void SsliceWidget::initText()
+//{
+//    btn_add->setText(QApplication::translate("SsliceWidget","add"));
+//    btn_update->setText(QApplication::translate("SsliceWidget","update"));
+//    btn_delete->setText(QApplication::translate("SsliceWidget","delete"));
+//}
+/**
+* @brief qevent function
+*
+* detail data information
+* @param[in/out]
+* @return
+* @author hejingjing
+* @date 20230324
+*/
+//void SsliceWidget::changeEvent(QEvent *e)
+//{
+//    if(e->type() == QEvent::LanguageChange)
+//    {
+//        initText();
+//    }
+//}
+
+/*
+ * @brief: get map of slicedisplaywidget
+ * @param: void
+ * @ret: map
+ * @birth: created by czm in 20230506
+ */
+QMap<int, SliceDisplayWidget *> SsliceWidget::get_map_SliceDisplayWidget()
+{
+    return this->map_SliceDisplayWidget;
+}
+
+bool SsliceWidget::remove_map_SliceDisplayWidget(int index)
+{
+    int s;
+    delete this->map_SliceDisplayWidget[index];
+    this->map_SliceDisplayWidget[index] = NULL;
+    s= this->map_SliceDisplayWidget.remove(index);
+    if(s == 1){
+        return true;
+    }else{
+        return false;
+    }
+}
+
+/*
+ * @brief: get index
+ * @param: void
+ * @ret: int
+ * @birth: created by czm in 20230506
+ */
+int SsliceWidget::getIndex()
+{
+    return this->index;
+}
+
+/*
+ * @brief: set index
+ * @param: int
+ * @ret: void
+ * @birth: created by czm in 20230506
+ */
+void SsliceWidget::setIndex(int num)
+{
+    this->index = num;
+}
+

+ 59 - 0
CAE_Solution/src/VTK/widget/Sslicewidget.h

@@ -0,0 +1,59 @@
+#ifndef SWIDGET_H
+#define SWIDGET_H
+
+#include "slicedisplaywidget.h"
+#include <map>
+#include <QMap>
+#include <QList>
+#include "../Manager/ResultMeshManager.h"
+
+using namespace std;
+class SsliceWidget
+{
+public:
+    SsliceWidget();
+    ~SsliceWidget();
+
+    int GetPagecount();
+    vector<string> GetPageName();
+    vector<int> GetSliceId();
+    vector<bool> GetSolidState();
+    vector<bool> GetPlaneWidgetState();
+    vector<vector<double>> GetNormal();
+    vector<vector<double>> GetPosition();
+    vector<string> GetType();
+    vector<int> GetLevel();
+    vector<string> GetVName();
+    vector<bool> GetPlaneState();
+    vector<bool> GetLabelState();
+    vector<vector<double>> normal;
+    vector<vector<double>> position;
+    void GetScalarName(vector<string>);
+    void GetZoneId(vector<int>);
+    void RestoreWidget();
+    //int GetOldIndex();
+    //void SetCurrWidget(int page);
+    //void initText();
+    //void changeEvent(QEvent *e);
+
+    QMap<int,SliceDisplayWidget*> get_map_SliceDisplayWidget();
+    bool remove_map_SliceDisplayWidget(int index);
+    int getIndex();
+    void setIndex(int);
+    QMap<int,SliceDisplayWidget*> map_SliceDisplayWidget;
+private:
+
+    SliceDisplayWidget *Setting;
+    int index;
+    int oldIndex;
+    vector<string> scalarNameVec;
+    vector<int> zoneIdVec;
+
+
+public:
+     void AddPage();
+     void ClearPage();
+     void UpdateWidget();
+};
+
+#endif // SWIDGET_H

+ 10 - 0
CAE_Solution/src/VTK/widget/slicedisplaywidget.cpp

@@ -299,6 +299,16 @@ vector<string> SliceDisplayWidget::GetVectorType()
     return this->type_vector;
 }
 
+void SliceDisplayWidget::SetType(string tmp_type)
+{
+    this->current_type = tmp_type;
+}
+
+void SliceDisplayWidget::SetcurrentVName(string tmp_name)
+{
+    this->current_variablename = tmp_name;
+}
+
 /**
  * @brief accept data from variable_vector.
  *

+ 2 - 0
CAE_Solution/src/VTK/widget/slicedisplaywidget.h

@@ -33,6 +33,8 @@ public:
     vector<int> GetColorLevel();
     QString getAreaRange();
     vector<string> GetVectorType();
+    void SetType(string);
+    void SetcurrentVName(string);
 
 private:
     double normal_x;//normal

+ 17 - 51
CAE_Solution/src/VTK/widget/streamDisplaywidget.cpp

@@ -196,10 +196,11 @@ QStringList StreamDisplayWidget::GetSeedData_XYZ()
  */
 void StreamDisplayWidget::SetSize_step(vector<double> stepSize)
 {
-//    for(int i = 0 ; i < stepSize.size(); i++)
-//    {
-//        ldt_step->setText(QString::number(stepSize.at(i))); //to do
-//    }
+    for(int i = 0 ; i < stepSize.size(); i++)
+    {
+        //ldt_step->setText(QString::number(stepSize.at(i))); //to do
+        initialStep=stepSize[i];
+    }
 }
 /**
  * @brief get the size to max_size.
@@ -212,10 +213,11 @@ void StreamDisplayWidget::SetSize_step(vector<double> stepSize)
  */
 void StreamDisplayWidget::SetSize_max(vector<double> maxSize)
 {
-//    for(int j = 0 ; j < maxSize.size() ;j++)
-//    {
-//        ldt_max->setText(QString::number(maxSize.at(j)));
-//    }
+    for(int j = 0 ; j < maxSize.size() ;j++)
+    {
+        //ldt_max->setText(QString::number(maxSize.at(j)));
+        MaxPropagation = maxSize[j];
+    }
 }
 /**
  * @brief get the size to min_size.
@@ -228,10 +230,11 @@ void StreamDisplayWidget::SetSize_max(vector<double> maxSize)
  */
 void StreamDisplayWidget::SetSize_min(vector<double> minSize)
 {
-//    for(int k = 0 ; k < minSize.size() ; k++)
-//    {
-//        ldt_min->setText(QString::number(minSize.at(k)));
-//    }
+    for(int k = 0 ; k < minSize.size() ; k++)
+    {
+        //ldt_min->setText(QString::number(minSize.at(k)));
+        MinimumStep = minSize[k];
+    }
 }
 /**
  * @brief get stepsize data.
@@ -292,53 +295,16 @@ void StreamDisplayWidget::SetMinStepData(double d)
 bool StreamDisplayWidget::GetShowHideState()
 {
 //    return ckx_show->isChecked();
-    return true;
+    return showstate;
     //to do 选择show
 }
 bool StreamDisplayWidget::GetToolState()
 {
 //    return  ckx_tool->isChecked();
-    return true;
+    return toolstate;
     //to  do 选择tool
 }
 
-void StreamDisplayWidget::Select()
-{
-    //ResultMeshManager::getInstance()->SetStreamSelectState(true);
-    //to do
-}
-void StreamDisplayWidget::SelectOff()
-{
-    //ResultMeshManager::getInstance()->SetStreamSelectState(false);
-    // todo
-}
-void StreamDisplayWidget::DeleteAll()
-{
-    //ResultMeshManager::getInstance()->DeleteAllStream();
-    //to do
-}
-
-/**
- * @brief select scalar names creat datasource
- * @param[in]
- * @param[out]
- * @return
- * @author zhaoyu
- * @date 20230309
- */
-void StreamDisplayWidget::Creat()
-{
-   if(((!value_u.empty()) && (!value_v.empty()) && (!value_w.empty()))
-           &&(value_u != value_v && value_u != value_w && value_v != value_w))
-   {
-//       QString u = cbx_u->currentText();
-//       QString v = cbx_v->currentText();
-//       QString w = cbx_w->currentText();
-
-       //ResultMeshManager::getInstance()->CreatVectorSource(u.toStdString(), v.toStdString(), w.toStdString());
-   //to do
-   }
-}
 
 /**
  * @brief get direction type

+ 2 - 4
CAE_Solution/src/VTK/widget/streamDisplaywidget.h

@@ -56,9 +56,7 @@ public:
      string current_direction;
      string current_StreamStyle;
 
-    void Select();
-    void SelectOff();
-    void DeleteAll();
-    void Creat();
+     bool showstate;
+     bool toolstate;
 };
 #endif // STREAMWIDGET_H

+ 167 - 65
CAE_Solution/src/threadPool_and_statemachine/dealWith/boostjsonobject.cpp

@@ -54,21 +54,46 @@ boostJsonObject::~boostJsonObject()
  */
 void boostJsonObject::FromJson(string msg)
 {
-    stringstream msgs;
-    msgs<<msg;
+    //qDebug()<<QString::fromStdString(msg);
+    stringstream msgs(msg);
     ptree root;
     read_json(msgs,root);//boost 方法
-    try{
-        this->usrId = root.get<string>("usrId");
-        this->solverConfigid = root.get<string>("solverConfigid");
-        this->proId = root.get<string>("proId");
-        this->paramJson = root.get<string>("paramJson");
-        this->action = root.get<string>("action");
-    }catch(exception ex){
-        cout<<ex.what()<<endl;
-        return;
+
+    this->usrId = root.get<string>("usrId");
+    this->solverConfigid = root.get<string>("solverConfigid");
+    this->proId = root.get<string>("proId");
+    this->paramJson = root.get<string>("paramJson");
+    this->action = root.get<string>("action");
+
+    if(this->action == "SliceDisplayApply"){
+        ptree items_arr;
+        ptree items = root.get_child("paramJson");
+        for(ptree::iterator it = items.begin();it!= items.end();++it){
+            items_arr = it->second;
+            ptree::iterator it1 = items_arr.begin();
+            for(it1;it1!=items_arr.end();it1++){
+                sliceDisplay_struct *sd_struct_ = new sliceDisplay_struct();
+                sd_struct_->index = it1->second.get<int>("index");
+                sd_struct_->index = sd_struct_->index -1;
+                sd_struct_->solid_state = it1->second.get<bool>("solid_state");
+                sd_struct_->sectional_plane_state = it1->second.get<bool>("sectional_plane_state");
+                sd_struct_->normal_x = it1->second.get<double>("normal_x");
+                sd_struct_->normal_y = it1->second.get<double>("normal_y");
+                sd_struct_->normal_z = it1->second.get<double>("normal_z");
+                sd_struct_->position_x = it1->second.get<double>("position_x");
+                sd_struct_->position_y = it1->second.get<double>("position_y");
+                sd_struct_->position_z = it1->second.get<double>("position_z");
+                sd_struct_->type = it1->second.get<string>("type");
+                sd_struct_->variableName = it1->second.get<string>("variableName");
+                sd_struct_->level = it1->second.get<int>("level");
+                sd_struct_->sectional_contour_state = it1->second.get<bool>("sectional_contour_state");
+                sd_struct_->scalar_value_state = it1->second.get<bool>("scalar_value_state");
+                vec_sd_struct.push_back(sd_struct_);
+            }
+        }
+    }else{
+        FromParamJson(this->paramJson);
     }
-    FromParamJson(this->paramJson);
 }
 
 /*
@@ -144,19 +169,36 @@ string boostJsonObject::ToJson(string type, QMap<QString, string> map_)
         item.put("showHideState",map_["showHideState"]);
     }else if(type == "addPage_slice"){
         item.put("msgType","addPage_slice_param");
+        item.put("index",map_["index"]);
         item.put("position_x",map_["position_x"]);
         item.put("position_y",map_["position_y"]);
         item.put("position_z",map_["position_z"]);
-        item.put("min_position_x",map_["min_position_x"]);
-        item.put("max_position_x",map_["max_position_x"]);
-        item.put("min_position_y",map_["min_position_y"]);
-        item.put("max_position_y",map_["max_position_y"]);
-        item.put("min_position_z",map_["min_position_z"]);
-        item.put("max_position_z",map_["max_position_z"]);
+        string xrange = map_["min_position_x"];
+        xrange +=",";
+        xrange+=(map_["max_position_x"]);
+        item.put("xrange",xrange);
+        string yrange = map_["min_position_y"];
+        yrange+=",";
+        yrange+=(map_["max_position_y"]);
+        item.put("yrange",yrange);
+        string zrange = map_["min_position_z"];
+        zrange += ",";
+        zrange+=(map_["max_position_z"]);
+        item.put("zrange",zrange);
         item.put("variableName",map_["variableName"]);
-        item.put("arearange",map_["arearange"]);
-    }else if(type == "update_slice"){
-        //to do
+        item.put("areaRange",map_["arearange"]);
+    }else if(type == "create_stream"){
+        item.put("msgType","create_stream_param");
+        item.put("initialStep",map_["initialStep"]);
+        item.put("maxPropagation",map_["maxPropagation"]);
+        item.put("minimumStep",map_["minimumStep"]);
+    }else if(type == "importResult_stream"){
+        item.put("msgType","stream_param");
+        item.put("dataU",map_["dataU"]);
+        item.put("dataV",map_["dataV"]);
+        item.put("dataW",map_["dataW"]);
+    }else if(type == "exception"){
+        item.put("Error",map_["exception"]);
     }
     stringstream tmp;
     json_parser::write_json(tmp,item);
@@ -164,9 +206,6 @@ string boostJsonObject::ToJson(string type, QMap<QString, string> map_)
     stringstream mmsg;
     json_parser::write_json (mmsg,root);
     return mmsg.str();
-
-    //boost::json::object json_obj;
-
 }
 
 /*
@@ -182,54 +221,117 @@ void boostJsonObject::FromParamJson(string param)
     params<<param;
     ptree root;
     read_json(params,root);
-    try{
+
+    if(this->action == "loaddata"){
+        this->filePath = root.get<string>("filePath");
+    }
+    if(this->action == "ResultImport"){
         this->filePath = root.get<string>("filePath");
         this->fileType = root.get<string>("fileType");
         this->fileName = root.get<string>("fileName");
-        if(this->action == "ContourDisplay"){
-            this->cd_struct = new contourDisplay_struct();
-            cd_struct->level = root.get<int>("level");
-            QString range = QString::fromStdString(root.get<string>("range"));
-            QStringList range_list = range.split(",");
-            cd_struct->range[0] = range_list[0].toDouble();
-            cd_struct->range[1] = range_list[1].toDouble();
-            cd_struct->scalarName = root.get<string>("scalarName");
-        }else if(this->action == "LineDisplay"){
-            this->ld_struct = new contourDisplay_struct();
-            ld_struct->level = root.get<int>("level");
-            QString range = QString::fromStdString(root.get<string>("range"));
-            QStringList range_list = range.split(",");
-            ld_struct->range[0] = range_list[0].toDouble();
-            ld_struct->range[1] = range_list[1].toDouble();
-            ld_struct->scalarName = root.get<string>("scalarName");
-        }else if(this->action == "VectorDisplay"){
-            vc_struct = new vectorDisplay_struct();
-            vc_struct->dataU = root.get<string>("dataU");
-            vc_struct->dataV = root.get<string>("dataV");
-            vc_struct->dataW = root.get<string>("dataW");
-            vc_struct->scaleFactor = root.get<double>("scaleFactor");
-        }else if(this->action == "SolidSurfaceDisplay"){
-            sf_struct = new solidsurfaceDisplay_struct();
-            sf_struct->r = root.get<double>("r");
-            sf_struct->g = root.get<double>("g");
-            sf_struct->b = root.get<double>("b");
-            sf_struct->transparency = root.get<double>("transparency");
-            sf_struct->showhidestate = root.get<bool>("showHideState");
-        }else if(this->action == "SliceDisplayAdd"){
-            sd_struct = new sliceDisplay_struct();
-            sd_struct->index = root.get<double>("index");
-        }else if(this->action == "SliceDisplayUpdate"){
-            //do nothing
-        }else if(this->action == "SliceDisplayDel"){
+    }
+    if(this->action == "ContourDisplay"){
+        this->cd_struct = new contourDisplay_struct();
+        cd_struct->level = root.get<int>("level");
+        QString range = QString::fromStdString(root.get<string>("range"));
+        QStringList range_list = range.split(",");
+        cd_struct->range[0] = range_list[0].toDouble();
+        cd_struct->range[1] = range_list[1].toDouble();
+        cd_struct->scalarName = root.get<string>("scalarName");
+    }else if(this->action == "LineDisplay"){
+        this->ld_struct = new contourDisplay_struct();
+        ld_struct->level = root.get<int>("level");
+        QString range = QString::fromStdString(root.get<string>("range"));
+        QStringList range_list = range.split(",");
+        ld_struct->range[0] = range_list[0].toDouble();
+        ld_struct->range[1] = range_list[1].toDouble();
+        ld_struct->scalarName = root.get<string>("scalarName");
+    }else if(this->action == "VectorDisplay"){
+        vc_struct = new vectorDisplay_struct();
+        vc_struct->dataU = root.get<string>("dataU");
+        vc_struct->dataV = root.get<string>("dataV");
+        vc_struct->dataW = root.get<string>("dataW");
+        vc_struct->scaleFactor = root.get<double>("scaleFactor");
+    }else if(this->action == "SolidSurfaceDisplay"){
+        sf_struct = new solidsurfaceDisplay_struct();
+        sf_struct->r = root.get<double>("r");
+        sf_struct->g = root.get<double>("g");
+        sf_struct->b = root.get<double>("b");
+        sf_struct->transparency = root.get<double>("transparency");
+        sf_struct->showhidestate = root.get<bool>("showHideState");
+    }else if(this->action == "SliceDisplayAdd"){
+        try{
             sd_struct = new sliceDisplay_struct();
             sd_struct->index = root.get<double>("index");
-        }else if(this->action == "SliceDisplayApply"){
-            //to do
+            sd_struct->index = sd_struct->index-1;
+        }catch(exception ex){
+            throw ex;
+            return;
         }
-    }catch(exception ex){
-        cout<<ex.what()<<endl;;
-        return;
+    }else if(this->action == "SliceDisplayUpdate"){
+        //do nothing
+    }else if(this->action == "SliceDisplayDel"){
+        sd_struct = new sliceDisplay_struct();
+        sd_struct->index = root.get<double>("index");
+        sd_struct->index = sd_struct->index - 1;
+    }else if(this->action == "StreamDisplayCreate"){
+        sm_struct = new streamDisplay_struct();
+        sm_struct->u = root.get<string>("u");
+        sm_struct->v = root.get<string>("v");
+        sm_struct->w = root.get<string>("w");
+    }else if(this->action == "StreamDisplaySelect"){
+        //do nothing
+    }else if(this->action == "StreamDisplayDeleteLast"){
+        //do nothing
+    }else if(this->action == "StreamDisplayDeleteAll"){
+        //do nothing
+    }else if(this->action == "StreamDisplayApply"){
+        sm_struct = new streamDisplay_struct();
+        sm_struct->direction = root.get<string>("direction");
+        sm_struct->streamstyle = root.get<string>("streamstyle");
+        sm_struct->initialstep = root.get<double>("initialstep");
+        sm_struct->maxpropagation = root.get<double>("maxpropagation");
+        sm_struct->minimumstep = root.get<double>("minimumstep");
+        sm_struct->showstate = root.get<bool>("showstate");
+        sm_struct->toolstate = root.get<bool>("toolstate");
+    }
+
+}
+
+/*
+ * @brief: to json
+ * @param: map
+ * @ret: void
+ * @birth: created by czm in 20230508
+ */
+string boostJsonObject::ToJson_updateslice(QMap<int, SliceDisplayWidget *>map_)
+{
+    ptree root;
+    root.put("usrId",this->usrId);
+    root.put("solverConfigid",this->solverConfigid);
+    root.put("proId",this->proId);
+    root.put("action",this->action);
+    ptree children;
+    for(auto iter = map_.begin();iter!=map_.end();iter++){
+        ptree child;
+        child.put("index",iter.key()+1);
+        child.put("normal_x",iter.value()->GetNormal()[0]);
+        child.put("normal_y",iter.value()->GetNormal()[1]);
+        child.put("normal_z",iter.value()->GetNormal()[2]);
+        child.put("position_x",iter.value()->GetPosition()[0]);
+        child.put("position_y",iter.value()->GetPosition()[1]);
+        child.put("position_z",iter.value()->GetPosition()[2]);
+        children.push_back(make_pair("",child));
     }
+    ptree pt;
+    pt.add_child("update_param", children);
+    stringstream tmp_;
+    json_parser::write_json(tmp_,pt);
+    root.put("paramJson",tmp_.str());
+
+    stringstream mmsg;
+    json_parser::write_json (mmsg,root);
+    return mmsg.str();
 }
 
 

+ 7 - 2
CAE_Solution/src/threadPool_and_statemachine/dealWith/boostjsonobject.h

@@ -1,14 +1,17 @@
 #ifndef BOOSTJSONOBJECT_H
 #define BOOSTJSONOBJECT_H
 #include "display_struct.h"
+#include <boost/property_tree/ptree.hpp>
+#include <boost/property_tree/json_parser.hpp>
+#include "../../VTK/widget/slicedisplaywidget.h"
 #include <string>
 #include <vector>
 #include <QMap>
 #include <QString>
 #include <sstream>
 #include <iostream>
-#include "boost/property_tree/ptree.hpp"
-#include "boost/property_tree/json_parser.hpp"
+#include <QDebug>
+
 
 
 using namespace std;
@@ -23,6 +26,7 @@ public:
     boostJsonObject* operator=(boostJsonObject* object);
     string ToJson(string type,QMap<QString,string> map_);
     void FromParamJson(string);
+    string ToJson_updateslice(QMap<int,SliceDisplayWidget*>);
 public:
     string usrId;
     string solverConfigid;
@@ -38,6 +42,7 @@ public:
     solidsurfaceDisplay_struct* sf_struct;//solidsurface
     sliceDisplay_struct* sd_struct;//slice
     vector<sliceDisplay_struct*> vec_sd_struct;
+    streamDisplay_struct* sm_struct;//stream
 };
 
 #endif // BOOSTJSONOBJECT_H

+ 18 - 0
CAE_Solution/src/threadPool_and_statemachine/dealWith/display_struct.h

@@ -63,4 +63,22 @@ public:
     string yrange;
     string zrange;
 };
+//流线msg类
+class streamDisplay_struct
+{
+public:
+    streamDisplay_struct(){}
+    ~streamDisplay_struct(){}
+    string u;
+    string v;
+    string w;
+    string direction;
+    string streamstyle;
+    double initialstep;
+    double maxpropagation;
+    double minimumstep;
+    bool showstate;
+    bool toolstate;
+};
+
 #endif // DISPLAY_STRUCT_H

+ 132 - 19
CAE_Solution/src/threadPool_and_statemachine/dealWith/handlepool.cpp

@@ -65,10 +65,22 @@ void handlePool::getmsg_recvstateTohandlePool(std::string recvmsg)
     std::cout<<"recvmsg"<<recvmsg<<std::endl;
     boostJsonObject* json_object = new boostJsonObject();
     QVTKRenderer* render_=NULL;
-    json_object->FromJson(recvmsg);
-
-    operateRender(json_object,render_);//解析命令
-
+    try{//处理异常
+        json_object->FromJson(recvmsg);
+    }catch(exception ex){
+        QMap<QString,string> map_;
+        map_.insert("exception",ex.what());
+        emit sendImg_handlePoolToSendstate(json_object->ToJson("exception",map_));
+        return;
+    }
+    try{
+        operateRender(json_object,render_);//解析命令
+    }catch(exception ex){
+        QMap<QString,string> map_2;
+        map_2.insert("exception",ex.what());
+        emit sendImg_handlePoolToSendstate(json_object->ToJson("exception",map_2));
+        return;
+    }
 }
 
 /*
@@ -165,6 +177,31 @@ void handlePool::operateRender(boostJsonObject* object,QVTKRenderer* render_)
             cout<<"please import tecplot result first!"<<endl;
         }
         return;
+    }else if(object->action == "StreamDisplayCreate"){//流线创造
+        if(!result_streamdisplay(object,render_,"create")){
+            cout<<"please import tecplot result first!"<<endl;
+        }
+        return;
+    }else if(object->action == "StreamDisplaySelect"){//流线选择
+        if(!result_streamdisplay(object,render_,"select")){
+            cout<<"please import tecplot result first!"<<endl;
+        }
+        return;
+    }else if(object->action == "StreamDisplayDeleteLast"){//流线删除最后
+        if(!result_streamdisplay(object,render_,"deletelast")){
+            cout<<"please import tecplot result first!"<<endl;
+        }
+        return;
+    }else if(object->action == "StreamDisplayDeleteAll"){//流线删除全部
+        if(!result_streamdisplay(object,render_,"deleteall")){
+            cout<<"please import tecplot result first!"<<endl;
+        }
+        return;
+    }else if(object->action == "StreamDisplayApply"){//流线删除全部
+        if(!result_streamdisplay(object,render_,"apply")){
+            cout<<"please import tecplot result first!"<<endl;
+        }
+        return;
     }
     send_picture(object,render_);//发送图片
 }
@@ -198,8 +235,8 @@ void handlePool::judgeLoaddata(boostJsonObject *object, QVTKRenderer *render_)
             render_->RemoveAllActors();
         }
     }
-    //QString m_filePath = object->filePath;//测试路径
-    QString m_filePath = "F:\\czm\\vtkfile\\tfg.ugrid";
+     QString m_filePath = object->filePath;//测试路径
+    //QString m_filePath = "F:\\czm\\vtkfile\\tfg.ugrid";
     QFileInfo fileinfo_(m_filePath);
     if(!fileinfo_.isFile()){
         cout<<"file path is Empty!"<<endl;
@@ -269,7 +306,7 @@ bool handlePool::resultImport(boostJsonObject *object_, QVTKRenderer *renderer_)
             //            renderer_->RemoveAllActors();
         }
     }
-    object_->filePath = "C:\\Users\\Administrator\\Desktop\\Postprocess_Binary";//测试路径
+    //object_->filePath = "C:\\Users\\Administrator\\Desktop\\Postprocess_Binary";//测试路径
     QDir dir(QString::fromStdString(object_->filePath));
     if(!dir.exists()){
         return false;
@@ -316,8 +353,11 @@ bool handlePool::resultImport(boostJsonObject *object_, QVTKRenderer *renderer_)
     SolidSurfaceWidget* solidfW = new SolidSurfaceWidget();//实体表面窗口初始化参数
     rsMeshManager->SetSurfaceSolidWidget(solidfW);
 
-    //SsliceWidget * ssliceW = new SsliceWidget();
-    //rsMeshManager->SetSliceWidget(ssliceW);
+    SsliceWidget * ssliceW = new SsliceWidget();//切片窗口初始化参数
+    rsMeshManager->SetSliceWidget(ssliceW);
+
+    StreamDisplayWidget* streamW = new StreamDisplayWidget();//流线窗口初始化参数
+    rsMeshManager->SetStremWidget(streamW);
     /********************************************/
     renderer_->widgetFlag = QVTKRenderer::WidgetModel::ResultModel;//设置当前窗口模型状态
     if(qmapResultmanager.contains(object_->proId)){//加载不同的结果文件
@@ -332,6 +372,7 @@ bool handlePool::resultImport(boostJsonObject *object_, QVTKRenderer *renderer_)
     emit sendImg_handlePoolToSendstate(object_->ToJson("importResult_line",buildResultImport_msg("Line",rsMeshManager)));//发送等值线结果数据
     emit sendImg_handlePoolToSendstate(object_->ToJson("importResult_vector",buildResultImport_msg("Vector",rsMeshManager)));//发送矢量结果数据
     emit sendImg_handlePoolToSendstate(object_->ToJson("importResult_solidsurface",buildResultImport_msg("Solidsurface",rsMeshManager)));//发送矢量结果数据
+    emit sendImg_handlePoolToSendstate(object_->ToJson("importResult_stream",buildResultImport_msg("Stream",rsMeshManager)));//发送流线结果数据
     send_picture(object_,renderer_);
     return true;
 }
@@ -466,19 +507,61 @@ bool handlePool::result_slicedisplay(boostJsonObject *object_, QVTKRenderer *ren
         resultmm->MakeVISUnStructGrid();
         resultmm->DisplayUnstructGrid();
         resultmm->sliceW_->AddPage();
-        resultmm->sliceW_->get_map_SliceDisplayWidget().value(tmp_index)->SetPosition(resultmm->GetUnslicePosition(tmp_index));
-        resultmm->sliceW_->get_map_SliceDisplayWidget().value(tmp_index)->SetPositionRange(resultmm->GetUnsliceSourceBounds(tmp_index));
+        resultmm->sliceW_->get_map_SliceDisplayWidget()[tmp_index]->SetPosition(resultmm->GetUnslicePosition(tmp_index));
+        resultmm->sliceW_->get_map_SliceDisplayWidget()[tmp_index]->SetPositionRange(resultmm->GetUnsliceSourceBounds(tmp_index));
         emit sendImg_handlePoolToSendstate(object_->ToJson("addPage_slice",buildResultImport_msg("addpage_slice",resultmm,object_)));//发送切片结果数据
     }else if(type == "update"){
         resultmm->UpdataSliceWidgetParameter();
         resultmm->sliceW_->UpdateWidget();
-        emit sendImg_handlePoolToSendstate(object_->ToJson("update_slice",buildResultImport_msg("update_slice",resultmm,object_)));//发送切片结果数据
+        emit sendImg_handlePoolToSendstate(object_->ToJson_updateslice(resultmm->sliceW_->get_map_SliceDisplayWidget()));//发送切片刷新数据
     }else if(type == "clear"){
-        //resultmm->UpdataSliceWidgetParameter();//先刷新再删除会有问题?
-        //resultmm->sliceW_->UpdateWidget();
+        resultmm->UpdataSliceWidgetParameter();//先刷新再删除会有问题?
+        resultmm->sliceW_->UpdateWidget();
         resultmm->sliceW_->remove_map_SliceDisplayWidget(object_->sd_struct->index);
     }else if(type == "apply"){
         slicedis->slicewidget_execute(object_);
+    }
+    send_picture(object_,render_);
+    return true;
+}
+
+/*
+ * @brief: analysis msg about streamdisplay
+ * @param: object and render
+ * @ret: bool
+ * @birth: created by czm in 20230505
+ */
+bool handlePool::result_streamdisplay(boostJsonObject *object_, QVTKRenderer *render_,QString type)
+{
+    StreamWidget* streamdis = NULL;
+    if(!qmapResultmanager.contains(object_->proId))return false;
+    render_ = qmapRender[object_->proId];
+    ResultMeshManager* resultmm = qmapResultmanager[object_->proId]->resultMeshManager_;
+    if(map_streamdisplay.contains(object_->proId)){
+        streamdis = map_streamdisplay[object_->proId];
+    }else{
+        streamdis = new StreamWidget(resultmm);
+        map_streamdisplay.insert(object_->proId,streamdis);
+    }
+    if(type == "create"){
+        resultmm->streamW_->current_u = stoi(object_->sm_struct->u.c_str());
+        resultmm->streamW_->current_v = stoi(object_->sm_struct->v.c_str());
+        resultmm->streamW_->current_w = stoi(object_->sm_struct->w.c_str());
+        string u = resultmm->streamW_->GetUData();
+        string v = resultmm->streamW_->GetVData();
+        string w = resultmm->streamW_->GetWData();
+        resultmm->CreatVectorSource(u,v,w);
+        if(resultmm->currAddDataSource_){
+            emit sendImg_handlePoolToSendstate(object_->ToJson("create_stream",buildResultImport_msg("create_stream",resultmm,object_)));//发送流线数据
+        }
+    }else if(type == "select"){
+        resultmm->SetStreamSelectState(true);
+    }else if(type == "deletelast"){
+        resultmm->SetStreamSelectState(false);
+    }else if(type == "deleteall"){
+        resultmm->DeleteAllStream();
+    }else if(type == "apply"){
+        streamdis->StreamWidget_execute(object_);
         send_picture(object_,render_);
     }
     return true;
@@ -586,6 +669,30 @@ QMap<QString,string> handlePool::buildResultImport_msg(QString type,ResultMeshMa
         }else{
             map_tmp.insert("showHideState",QString("false").toStdString());
         }
+    }else if(type == "Stream"){
+        string msg;
+        StreamDisplayWidget* smdW = cmanager->streamW_;
+        for(int i = 0; i<smdW->dataU.size();i++){
+            msg+=removeSpaces(smdW->dataU[i]);
+            msg+=",";
+        }
+        msg = msg.erase(msg.size()-1);
+        map_tmp.insert("dataU",msg);
+        msg.clear();
+        for(int j = 0;j<smdW->dataV.size();j++){
+            msg+=removeSpaces(smdW->dataV[j]);
+            msg+=",";
+        }
+        msg=msg.erase(msg.size()-1);
+        map_tmp.insert("dataV",msg);
+        msg.clear();
+        for(int k = 0; k <smdW->dataW.size();k++){
+            msg+=removeSpaces(smdW->dataW[k]);
+            msg+=",";
+        }
+        msg = msg.erase(msg.size()-1);
+        map_tmp.insert("dataW",msg);
+        msg.clear();
     }
     return map_tmp;
 }
@@ -603,6 +710,7 @@ QMap<QString, string> handlePool::buildResultImport_msg(QString type, ResultMesh
         int tmp_index = object->sd_struct->index;
         SliceDisplayWidget* sdwidget = cmanager->sliceW_->get_map_SliceDisplayWidget().value(tmp_index);
         string msg;
+        map_tmp.insert("index",to_string(tmp_index+1));//修改index
         map_tmp.insert("position_x",to_string(sdwidget->GetPosition()[0]));
         map_tmp.insert("position_y",to_string(sdwidget->GetPosition()[1]));
         map_tmp.insert("position_z",to_string(sdwidget->GetPosition()[2]));
@@ -613,24 +721,29 @@ QMap<QString, string> handlePool::buildResultImport_msg(QString type, ResultMesh
         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++){
-            msg+=sdwidget->GetVariableName_vector()[i];
+            msg+= removeSpaces(sdwidget->GetVariableName_vector()[i]);
             msg+=",";
         }
         msg = msg.erase(msg.size()-1);
         map_tmp.insert("variableName",msg);
         msg.clear();
         map_tmp.insert("arearange",sdwidget->getAreaRange().toStdString());
-    }else if((type == "update_slice")|| (type == "clear_slice")){
+    }else if(type == "clear_slice"){
         QMap<int,SliceDisplayWidget*> sdw_map = cmanager->sliceW_->get_map_SliceDisplayWidget();
         for(auto iter = sdw_map.begin();iter!=sdw_map.end();iter++){
-            map_tmp.insert("index",to_string(iter.key()));
+            map_tmp.insert("index",to_string(iter.key()+1));//修改index
             map_tmp.insert("normal_x",to_string(iter.value()->GetNormal()[0]));
             map_tmp.insert("normal_y",to_string(iter.value()->GetNormal()[1]));
             map_tmp.insert("normal_z",to_string(iter.value()->GetNormal()[2]));
             map_tmp.insert("position_x",to_string(iter.value()->GetPosition()[0]));
-            map_tmp.insert("position_y",to_string(iter.value()->GetPosition()[0]));
-            map_tmp.insert("position_z",to_string(iter.value()->GetPosition()[0]));
+            map_tmp.insert("position_y",to_string(iter.value()->GetPosition()[1]));
+            map_tmp.insert("position_z",to_string(iter.value()->GetPosition()[2]));
         }
+    }else if(type == "create_stream"){
+        StreamDisplayWidget* smdW = cmanager->streamW_;
+        map_tmp.insert("initialStep",to_string(smdW->initialStep));
+        map_tmp.insert("maxPropagation",to_string(smdW->MaxPropagation));
+        map_tmp.insert("minimumStep",to_string(smdW->MinimumStep));
     }
     return map_tmp;
 }

+ 3 - 0
CAE_Solution/src/threadPool_and_statemachine/dealWith/handlepool.h

@@ -17,6 +17,7 @@
 #include "../../VTK/display/vectordisplay.h"
 #include "../../VTK/display/solidsurfacewidget.h"
 #include "../../VTK/display/slicewidget.h"
+#include "../../VTK/display/streamwidget.h"
 #include "../../VTK/visualization_VTK/vtkVISUnContour.h"
 #include "../../VTK/widget/contourdispalyWidget.h"
 #include "../../VTK/widget/linedisplayWidget.h"
@@ -49,6 +50,7 @@ public:
     bool result_vectordisplay(boostJsonObject*, QVTKRenderer *);
     bool result_solidsurfacedisplay(boostJsonObject*, QVTKRenderer *);
     bool result_slicedisplay(boostJsonObject*, QVTKRenderer *,QString);
+    bool result_streamdisplay(boostJsonObject*, QVTKRenderer *,QString);
     //QStringList getFileNameList(QString);
     QMap<QString,string> buildResultImport_msg(QString,ResultMeshManager*);
     QMap<QString,string> buildResultImport_msg(QString,ResultMeshManager*,boostJsonObject*);
@@ -72,6 +74,7 @@ private:
     QMap<string,Vectordisplay*> map_vectordisplay;
     QMap<string,SolidSurface*> map_solidsdisplay;
     QMap<string,SliceWidget*> map_slicedisplay;
+    QMap<string,StreamWidget*> map_streamdisplay;
     QTabWidget* w;
     bool contour_sendrange_flag;
     bool line_sendrange_flag;