当前位置: 首页>>代码示例>>C++>>正文


C++ WorkspaceGroup_sptr::getName方法代码示例

本文整理汇总了C++中WorkspaceGroup_sptr::getName方法的典型用法代码示例。如果您正苦于以下问题:C++ WorkspaceGroup_sptr::getName方法的具体用法?C++ WorkspaceGroup_sptr::getName怎么用?C++ WorkspaceGroup_sptr::getName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在WorkspaceGroup_sptr的用法示例。


在下文中一共展示了WorkspaceGroup_sptr::getName方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1:

/**
 * Groups together a vector of workspaces.  This is done "manually", since the
 * workspaces being passed will be outside of the ADS and so the GroupWorkspaces
 * alg is not an option here.
 *
 * @param wsList :: the list of workspaces to group
 */
API::WorkspaceGroup_sptr
Load::groupWsList(const std::vector<API::Workspace_sptr> &wsList) {
  auto group = boost::make_shared<WorkspaceGroup>();

  for (const auto &ws : wsList) {
    WorkspaceGroup_sptr isGroup =
        boost::dynamic_pointer_cast<WorkspaceGroup>(ws);
    // If the ws to add is already a group, then add its children individually.
    if (isGroup) {
      std::vector<std::string> childrenNames = isGroup->getNames();
      size_t count = 1;
      for (auto childName = childrenNames.begin();
           childName != childrenNames.end(); ++childName, ++count) {
        Workspace_sptr childWs = isGroup->getItem(*childName);
        isGroup->remove(*childName);
        // childWs->setName(isGroup->getName() + "_" +
        // boost::lexical_cast<std::string>(count));
        group->addWorkspace(childWs);
      }

      // Remove the old group from the ADS
      AnalysisDataService::Instance().remove(isGroup->getName());
    } else {
      group->addWorkspace(ws);
    }
  }

  return group;
}
开发者ID:mantidproject,项目名称:mantid,代码行数:36,代码来源:Load.cpp

示例2: processViewImg

void TomographyIfacePresenter::processViewImg() {
  std::string ip = m_view->showImagePath();
  QString suf = QFileInfo(QString::fromStdString(ip)).suffix();
  // This is not so great, as we check extensions and not really file
  // content/headers, as it should be.
  if ((0 == QString::compare(suf, "fit", Qt::CaseInsensitive)) ||
      (0 == QString::compare(suf, "fits", Qt::CaseInsensitive))) {
    WorkspaceGroup_sptr wsg = m_model->loadFITSImage(ip);
    if (!wsg)
      return;
    MatrixWorkspace_sptr ws =
        boost::dynamic_pointer_cast<MatrixWorkspace>(wsg->getItem(0));
    if (!ws)
      return;

    m_view->showImage(ws);

    // clean-up container group workspace
    if (wsg)
      AnalysisDataService::Instance().remove(wsg->getName());
  } else if ((0 == QString::compare(suf, "tif", Qt::CaseInsensitive)) ||
             (0 == QString::compare(suf, "tiff", Qt::CaseInsensitive)) ||
             (0 == QString::compare(suf, "png", Qt::CaseInsensitive))) {
    m_view->showImage(ip);
  } else {
    m_view->userWarning(
        "Failed to load image - format issue",
        "Could not load image because the extension of the file " + ip +
            ", suffix: " + suf.toStdString() +
            " does not correspond to FITS or TIFF files.");
  }
}
开发者ID:nimgould,项目名称:mantid,代码行数:32,代码来源:TomographyIfacePresenter.cpp


注:本文中的WorkspaceGroup_sptr::getName方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。