Commit adeb8508 authored by Samuel Jones's avatar Samuel Jones
Browse files

Re #24997 Seperate MantidPlot crash fixes from ConjoinSpectra changes

parent 3e42bd9c
......@@ -414,8 +414,12 @@ public:
virtual Axis *getAxis(const std::size_t &axisIndex) const;
void replaceAxis(const std::size_t &axisIndex, Axis *const newAxis);
/// Returns true if the workspace contains data in histogram form (as opposed
/// to point-like)
/// Will return the number of Axis currently stored in the workspace it is not
/// always safe to assume it is just 2
size_t numberOfAxis() const;
/// Returns true if the workspace contains data in histogram form (as
/// opposed to point-like)
virtual bool isHistogramData() const;
/// Returns true if the workspace contains common X bins
......
......@@ -877,6 +877,14 @@ void MatrixWorkspace::replaceAxis(const std::size_t &axisIndex,
m_axes[axisIndex] = newAxis;
}
/**
* Return the number of Axis stored by this workspace
* @return int
*/
size_t MatrixWorkspace::numberOfAxis() const {
return m_axes.size();
}
/// Returns the units of the data in the workspace
std::string MatrixWorkspace::YUnit() const { return m_YUnit; }
......
......@@ -3381,8 +3381,7 @@ void MantidUI::drawColorFillPlots(const QStringList &wsNames,
* @param wsName :: The name of the workspace which provides data for the plot
* @param curveType :: The type of curve
* @param window :: An optional pointer to a plot window. If not NULL the window
* is cleared
* and reused
* is cleared and reused
* @param hidden
* @returns A pointer to the created plot
*/
......@@ -3395,6 +3394,16 @@ MultiLayer *MantidUI::drawSingleColorFillPlot(const QString &wsName,
if (!workspace)
return nullptr;
// Check if an axis is a String, if so then throw log without this, it will
// cause MantidPlot to get into an error loop forcing users to terminate.
for (auto i = 0u; i < workspace->numberOfAxis(); ++i) {
if (workspace->getAxis(i)->isText()) {
g_log.error("Colorfill Plot - Cannot plot a workspace which has an axis "
"of type text.");
return nullptr;
}
}
ScopedOverrideCursor waitCursor;
bool reusePlots = workspacesDockPlot1To1();
......@@ -4029,9 +4038,9 @@ void MantidUI::memoryImage2() {
}
#endif
//=======================================================================
// End of Windows specific stuff
//=======================================================================
//=======================================================================
// End of Windows specific stuff
//=======================================================================
#include "MantidGeometry/Instrument.h"
#include "MantidGeometry/Instrument/CompAssembly.h"
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment