コード例 #1
0
ファイル: PlotAxis.cpp プロジェクト: dezed/mantid
/**
 * @param workspace  The workspace containing the axis information
 * @param index Index of the axis in the workspace to inspect
 */
void PlotAxis::titleFromIndex(const Mantid::API::IMDWorkspace &workspace,
                              const size_t index) {
  auto dim = workspace.getDimension(index);
  titleFromDimension(*dim);
  if (m_title.isEmpty()) {
    m_title = (index == 0) ? "X axis" : "Y axis";
  }
}
コード例 #2
0
ファイル: PlotAxis.cpp プロジェクト: dezed/mantid
/**
 * The title will be filled with the caption & units from the given Axis object
 * of the workspace
 * @param workspace The workspace containing the axis information
 * @param index Index of the axis in the workspace to inspect
 */
PlotAxis::PlotAxis(const Mantid::API::IMDWorkspace &workspace,
                   const size_t index)
    : m_title() {
  if (index < workspace.getNumDims())
    titleFromIndex(workspace, index);
  else
    throw std::invalid_argument("PlotAxis() - Unknown axis index: '" +
                                boost::lexical_cast<std::string>(index) + "'");
}
コード例 #3
0
/**
 * Returns a time for a time slice
 * @param workspace: the workspace
 * @return either the first time entry in case of a 4D workspace or else 0.0
 */
double SaveMDWorkspaceToVTKImpl::selectTimeSliceValue(
    const Mantid::API::IMDWorkspace &workspace) const {
  double time = 0.0;
  if (is4DWorkspace(workspace)) {
    auto timeLikeDimension = workspace.getDimension(3);
    time = static_cast<double>(timeLikeDimension->getMinimum());
  }
  return time;
}