/** Constructor * * @param workspace :: IMDWorkspace to plot * @param logScale :: true to plot Y in log scale * @param start :: start point in N-dimensions of the line * @param end :: end point in N-dimensions of the line * @param normalize :: method for normalizing the line * @param isDistribution :: is this a distribution (divide by bin width?) * @return */ MantidQwtIMDWorkspaceData::MantidQwtIMDWorkspaceData(Mantid::API::IMDWorkspace_const_sptr workspace, const bool logScale, Mantid::Kernel::VMD start, Mantid::Kernel::VMD end, Mantid::API::MDNormalization normalize, bool isDistribution) : m_workspace(workspace), m_logScale(logScale), m_minPositive(0), m_preview(false), m_start(start), m_end(end), m_normalization(normalize), m_isDistribution(isDistribution), m_transform(NULL), m_plotAxis(PlotDistance), m_currentPlotAxis(PlotDistance) { if (start.getNumDims() == 1 && end.getNumDims() == 1) { if (start[0] == 0.0 && end[0] == 0.0) { // Default start and end. Find the limits Mantid::Geometry::VecIMDDimension_const_sptr nonIntegDims = m_workspace->getNonIntegratedDimensions(); std::string alongDim = ""; if (!nonIntegDims.empty()) alongDim = nonIntegDims[0]->getName(); else alongDim = m_workspace->getDimension(0)->getName(); size_t nd = m_workspace->getNumDims(); m_start = VMD(nd); m_end = VMD(nd); for (size_t d=0; d<nd; d++) { IMDDimension_const_sptr dim = m_workspace->getDimension(d); if (dim->getDimensionId() == alongDim) { // All the way through in the single dimension m_start[d] = dim->getMinimum(); m_end[d] = dim->getMaximum(); } else { // Mid point along each dimension m_start[d] = (dim->getMaximum() + dim->getMinimum()) / 2.0f; m_end[d] = m_start[d]; } } } } // Unit direction of the line m_dir = m_end - m_start; m_dir.normalize(); // And cache the X/Y values this->cacheLinePlot(); }
bool operator()(IMDDimension_const_sptr b) { return _a->getDimensionId() == b->getDimensionId(); }