zl程序教程

您现在的位置是:首页 >  其它

当前栏目

ParaView中实现远程渲染与前台显示的对接

实现 远程 显示 渲染 对接 前台
2023-09-11 14:19:51 时间


pqViewFrame *pqMultiViewWidget::newFrame(vtkSMProxy *view)
{
  pqViewFrame *frame = new pqViewFrame();
  QObject::connect(frame, SIGNAL(buttonPressed(int)), this, SLOT(standardButtonPressed(int)));
  QObject::connect(frame, SIGNAL(swapPositions(const QString &)), this, SLOT(swapPositions(const QString &)), Qt::QueuedConnection);
  // 从服务管理器中查找可用的pqView
  pqServerManagerModel *smmodel = pqApplicationCore::instance()->getServerManagerModel();
  pqView *pqview = smmodel->findItem<pqView *>(view);

  // 将 pqView 与 显示的pqViewFrame进行联接
  // it's possible that pqview is nullptr, if the view proxy hasn't been registered
  // yet. This happens often when initialization state is being loaded in
  // collaborative sessions.
  ConnectFrameToView(frame, pqview);

  // Search for view frame actions plugins and allow them to decide
  // whether to add their actions to this view type's frame or not.
  pqInterfaceTracker *tracker = pqApplicationCore::instance()->interfaceTracker();
  Q_FOREACH (pqViewFrameActionsInterface *vfai, tracker->interfaces<pqViewFrameActionsInterface *>())
  {
    vfai->frameConnected(frame, pqview);
  }
  return frame;
}


void ConnectFrameToView(pqViewFrame *frame, pqView *pqview)
  {
    assert(frame);
    // if pqview == nullptr, then the frame is either being assigned to a empty
    // view, or pqview for a view-proxy just isn't present yet.
    // it's possible that pqview is nullptr, if the view proxy hasn't been registered
    // yet. This happens often when initialization state is being loaded in
    // collaborative sessions.
    if (pqview != nullptr)
    {
      // 把 pqView 中的 widget 放入 pqViewFrame 的容器中
      QWidget *viewWidget = pqview->widget();
      frame->setCentralWidget(viewWidget, pqview);
    }
  }