|
Mantid
|
Class to represent a text axis of a workspace. More...
#include <TextAxis.h>
Public Member Functions | |
| Axis * | clone (const MatrixWorkspace *const parentWorkspace) override |
| Virtual constructor. More... | |
| Axis * | clone (const std::size_t length, const MatrixWorkspace *const parentWorkspace) override |
| Virtual constructor for axis of different length. More... | |
| double | getMax () const override |
| returns max value defined on axis More... | |
| double | getMin () const override |
| returns min value defined on axis More... | |
| size_t | indexOfValue (const double value) const override |
| Returns the value that has been passed to it as a size_t. More... | |
| bool | isText () const override |
| If this is a TextAxis, always return true for this class. More... | |
| std::string | label (const std::size_t &index) const override |
| Get the label at the specified index. More... | |
| std::size_t | length () const override |
| Get the length of the axis. More... | |
| double | operator() (const std::size_t &index, const std::size_t &verticalIndex=0) const override |
| Get a value at the specified index. More... | |
| bool | operator== (const Axis &) const override |
| Check if two axis defined as spectra or numeric axis are equivalent. More... | |
| void | setLabel (const std::size_t &index, const std::string &lbl) |
| Set the label at the given index. More... | |
| void | setValue (const std::size_t &index, const double &value) override |
| Set the value at the specified index. More... | |
| TextAxis (const std::size_t &length) | |
| Constructor. More... | |
Public Member Functions inherited from Mantid::API::Axis | |
| Axis () | |
| Constructor. More... | |
| virtual Axis * | clone (const MatrixWorkspace *const parentWorkspace)=0 |
| Virtual constructor. More... | |
| virtual Axis * | clone (const std::size_t length, const MatrixWorkspace *const parentWorkspace)=0 |
| Virtual constructor for axis of different length. More... | |
| virtual double | getMax () const =0 |
| returns max value defined on axis More... | |
| virtual double | getMin () const =0 |
| returns min value defined on axis More... | |
| double | getValue (const std::size_t &index, const std::size_t &verticalIndex=0) const |
| Gets the value at the specified index. More... | |
| virtual size_t | indexOfValue (const double value) const =0 |
| Find the index of the given double value. More... | |
| virtual bool | isNumeric () const |
| Returns true if the axis is numeric. More... | |
| virtual bool | isSpectra () const |
| Returns true is the axis is a Spectra axis. More... | |
| virtual bool | isText () const |
| Returns true if the axis is Text. More... | |
| virtual std::string | label (const std::size_t &index) const =0 |
| Returns a text label of for a value Note that the index here is not the index of a value, but the effective index of the bin. More... | |
| virtual std::size_t | length () const =0 |
| Get the length of the axis. More... | |
| virtual double | operator() (const std::size_t &index, const std::size_t &verticalIndex=0) const =0 |
| Returns the value at a specified index. More... | |
| virtual bool | operator== (const Axis &) const =0 |
| Check whether two axis are the same, i.e same length and same spectra_values for all elements in the axis. More... | |
| virtual const std::shared_ptr< Kernel::Unit > & | setUnit (const std::string &unitName) |
| Set the unit on the Axis. More... | |
| virtual void | setValue (const std::size_t &index, const double &value)=0 |
| Sets the value at the specified index. More... | |
| virtual specnum_t | spectraNo (const std::size_t &index) const |
| Get the spectrum number. More... | |
| std::string & | title () |
| Returns a reference to the user-defined title for this axis. More... | |
| const std::string & | title () const |
| Returns the user-defined title for this axis. More... | |
| std::shared_ptr< Kernel::Unit > & | unit () |
| The unit object for this workspace (non const version) More... | |
| const std::shared_ptr< Kernel::Unit > & | unit () const |
| The unit for this axis. More... | |
| virtual | ~Axis ()=default |
Private Attributes | |
| std::vector< std::string > | m_values |
| A vector holding the axis values for the axis. More... | |
Additional Inherited Members | |
Protected Member Functions inherited from Mantid::API::Axis | |
| Axis (const Axis &)=default | |
| Axis & | operator= (const Axis &)=default |
Class to represent a text axis of a workspace.
Definition at line 36 of file TextAxis.h.
| Mantid::API::TextAxis::TextAxis | ( | const std::size_t & | length | ) |
|
overridevirtual |
Virtual constructor.
| parentWorkspace | :: The workspace is not used in this implementation |
Implements Mantid::API::Axis.
Definition at line 26 of file TextAxis.cpp.
References UNUSED_ARG.
|
overridevirtual |
Virtual constructor for axis of different length.
Implements Mantid::API::Axis.
Definition at line 31 of file TextAxis.cpp.
References length(), and UNUSED_ARG.
|
overridevirtual |
returns max value defined on axis
Implements Mantid::API::Axis.
Definition at line 122 of file TextAxis.cpp.
|
overridevirtual |
returns min value defined on axis
Implements Mantid::API::Axis.
Definition at line 113 of file TextAxis.cpp.
References m_values.
Referenced by getMax().
|
overridevirtual |
Returns the value that has been passed to it as a size_t.
Implements Mantid::API::Axis.
Definition at line 68 of file TextAxis.cpp.
References Mantid::Kernel::VectorHelper::indexOfValueFromCenters(), length(), spectraNumbers, and value.
|
inlineoverridevirtual |
If this is a TextAxis, always return true for this class.
Reimplemented from Mantid::API::Axis.
Definition at line 43 of file TextAxis.h.
|
overridevirtual |
Get the label at the specified index.
Returns a text label which shows the value at index and identifies the type of the axis.
| index | :: The index of an axis value |
Implements Mantid::API::Axis.
Definition at line 97 of file TextAxis.cpp.
References index, and m_values.
Referenced by export_TextAxis(), and Mantid::Algorithms::AppendSpectra::fixSpectrumNumbers().
|
inlineoverridevirtual |
Get the length of the axis.
Implements Mantid::API::Axis.
Definition at line 41 of file TextAxis.h.
Referenced by clone(), indexOfValue(), operator()(), operator==(), setLabel(), and TextAxis().
|
overridevirtual |
Get a value at the specified index.
Get the axis value at the position given.
| index | The position along the axis for which the value is required |
| verticalIndex | Needed for the subclass (RefAxis) method, but ignored (and defaulted) here |
| IndexError | If the index requested is not in the range of this axis |
Implements Mantid::API::Axis.
Definition at line 46 of file TextAxis.cpp.
References Mantid::EMPTY_DBL(), index, length(), and UNUSED_ARG.
|
overridevirtual |
Check if two axis defined as spectra or numeric axis are equivalent.
| axis2 | :: Reference to the axis to compare to |
Implements Mantid::API::Axis.
Definition at line 81 of file TextAxis.cpp.
References Mantid::API::Axis::length(), length(), and m_values.
| void Mantid::API::TextAxis::setLabel | ( | const std::size_t & | index, |
| const std::string & | lbl | ||
| ) |
Set the label at the given index.
Set the label for value at index.
| index | :: Index |
| lbl | :: The text label |
Definition at line 104 of file TextAxis.cpp.
References index, length(), and m_values.
Referenced by Mantid::CurveFitting::IMWDomainCreator::createOutputWorkspace(), Mantid::CurveFitting::TableWorkspaceDomainCreator::createOutputWorkspace(), Mantid::Algorithms::ExtractSpectra2::exec(), Mantid::Algorithms::Integration::exec(), export_TextAxis(), and Mantid::DataHandling::LoadNexusProcessed::loadNonSpectraAxis().
|
overridevirtual |
Set the value at the specified index.
Sets the axis value at a given position.
| index | :: The position along the axis for which to set the value |
| value | :: The new value |
| IndexError | If the index requested is not in the range of this axis |
Implements Mantid::API::Axis.
Definition at line 60 of file TextAxis.cpp.
References index, UNUSED_ARG, and value.
|
private |
A vector holding the axis values for the axis.
Definition at line 62 of file TextAxis.h.
Referenced by getMax(), getMin(), label(), operator==(), setLabel(), and TextAxis().