Standard items

class PropertyItem : public mvvm::SessionItem

The PropertyItem class is an item to carry concrete editable entity (e.g. float64 value with limits).

Intended for use as a child or CompoundItem, not expected to have own children. For the moment, it has no extra behavior and it is here for historical reasons.

Public Functions

virtual std::unique_ptr<SessionItem> Clone() const override

Creates a clone of the item.

Creates an exact clone of the item together with all its children. All item identifiers will be the same. Please note, that cloned items can’t be used along with the original item in the same model due to memory pool identifiers collision. Use utils::CopyItem to create deep copies that have different item identifiers.

class VectorItem : public mvvm::CompoundItem

The VectorItem class is a compound item with three x,y,z property items.

Public Functions

virtual std::unique_ptr<SessionItem> Clone() const override

Creates a clone of the item.

Creates an exact clone of the item together with all its children. All item identifiers will be the same. Please note, that cloned items can’t be used along with the original item in the same model due to memory pool identifiers collision. Use utils::CopyItem to create deep copies that have different item identifiers.

class BasicAxisItem : public mvvm::CompoundItem

The BasicAxisItem class is a base class for all axes items.

It has min, max defined, but nothing else.

Subclassed by mvvm::BinnedAxisItem, mvvm::ViewportAxisItem

class ViewportAxisItem : public mvvm::BasicAxisItem

The ViewportAxisItem class represents viewport axis.

It can be a counterpart of either Qt’s QAbstractAxis or QCustomPlot::QCPAxis. Intended to cary title, fonts etc.

Public Functions

virtual std::unique_ptr<SessionItem> Clone() const override

Creates a clone of the item.

Creates an exact clone of the item together with all its children. All item identifiers will be the same. Please note, that cloned items can’t be used along with the original item in the same model due to memory pool identifiers collision. Use utils::CopyItem to create deep copies that have different item identifiers.

std::pair<double, double> GetRange() const

Returns pair of lower, upper axis range.

void SetRange(double lower, double upper)

Sets lower, upper range of axis to given values.

class BinnedAxisItem : public mvvm::BasicAxisItem

The BinnedAxisItem class represents an axis with arbitrary binning.

Base class to define an axis with specific binning (fixed, variable). Used in Data1DItem and Data2Ditem to store 1d and 2d data. Doesn’t carry any appearance info (e.g. axis title, label size, etc) and thus not intended for direct plotting.

Subclassed by mvvm::FixedBinAxisItem, mvvm::PointwiseAxisItem

class FixedBinAxisItem : public mvvm::BinnedAxisItem

The FixedBinAxisItem class represents fixed bin axis.

Defines an axis with equidistant binning.

Public Functions

virtual std::unique_ptr<SessionItem> Clone() const override

Creates a clone of the item.

Creates an exact clone of the item together with all its children. All item identifiers will be the same. Please note, that cloned items can’t be used along with the original item in the same model due to memory pool identifiers collision. Use utils::CopyItem to create deep copies that have different item identifiers.

class PointwiseAxisItem : public mvvm::BinnedAxisItem

The PointwiseAxisItem class represents a pointwise axis.

Defines an axis via an array of points representing point coordinates.

Public Functions

virtual std::unique_ptr<SessionItem> Clone() const override

Creates a clone of the item.

Creates an exact clone of the item together with all its children. All item identifiers will be the same. Please note, that cloned items can’t be used along with the original item in the same model due to memory pool identifiers collision. Use utils::CopyItem to create deep copies that have different item identifiers.

class ContainerItem : public mvvm::CompoundItem

The ContainerItem class is a simple container to store any type of child.

May be used as a convenience item to create a branch with uniform children beneath, for example.

Public Functions

virtual std::unique_ptr<SessionItem> Clone() const override

Creates a clone of the item.

Creates an exact clone of the item together with all its children. All item identifiers will be the same. Please note, that cloned items can’t be used along with the original item in the same model due to memory pool identifiers collision. Use utils::CopyItem to create deep copies that have different item identifiers.

bool IsEmpty() const

Checks if container is empty.

std::size_t GetSize() const

Returns number of children in the container.

std::vector<SessionItem*> GetChildren() const

Returns all children in the container.

void Clear()

Removes all children from the container.

class Data1DItem : public mvvm::CompoundItem

Represents one-dimensional data (axis and values). Values are stored in Data1DItem itself, axis is attached as a child. Corresponding plot properties will be served by GraphItem.

Public Functions

virtual std::unique_ptr<SessionItem> Clone() const override

Creates a clone of the item.

Creates an exact clone of the item together with all its children. All item identifiers will be the same. Please note, that cloned items can’t be used along with the original item in the same model due to memory pool identifiers collision. Use utils::CopyItem to create deep copies that have different item identifiers.

std::vector<double> GetBinCenters() const

Returns coordinates of bin centers.

void SetValues(const std::vector<double> &data)

Sets internal data buffer to given data. If size of axis doesn’t match the size of the data, exception will be thrown.

std::vector<double> GetValues() const

Returns values stored in bins.

void SetErrors(const std::vector<double> &errors)

Sets errors on values in bins.

std::vector<double> GetErrors() const

Returns value errors stored in bins.

template<typename T, typename ...Args>
T *SetAxis(Args&&... args)

Inserts axis of given type.

class GraphItem : public mvvm::CompoundItem

One-dimensional graph representation of Data1DItem. Contains plot properties (i.e. color, line type etc) and link to Data1DItem, which will provide actual data to plot. GraphItem is intended for plotting only via GraphViewportItem.

Public Functions

virtual std::unique_ptr<SessionItem> Clone() const override

Creates a clone of the item.

Creates an exact clone of the item together with all its children. All item identifiers will be the same. Please note, that cloned items can’t be used along with the original item in the same model due to memory pool identifiers collision. Use utils::CopyItem to create deep copies that have different item identifiers.

void SetDataItem(const Data1DItem *data_item)

Sets link to the data item.

void SetFromGraphItem(const GraphItem *graph_item)

Update item from the content of given graph. Link to the data will be set as in given item, other properties copied.

Data1DItem *GetDataItem() const

Returns data item linked to the given GraphItem.

std::string GetNamedColor() const

Returns color name in #RRGGBB format.

void SetNamedColor(const std::string &named_color)

Sets named color following schema from https://www.w3.org/TR/css-color-3/#svg-color. e.g. “mediumaquamarine”

class ViewportItem : public mvvm::CompoundItem

The ViewportItem class is a base class for all viewports representing 1D, and 2D data.

Contains x,y axis, to display graphs, line series, or 2D colormaps.

Subclassed by mvvm::ChartViewportItem, mvvm::GraphViewportItem

Public Functions

ViewportAxisItem *GetXAxis() const

Returns x-axis.

ViewportAxisItem *GetYAxis() const

Returns y-axis.

virtual void SetViewportToContent()

Sets the range of x,y window to show all data.

virtual void SetViewportToContent(double left, double top, double right, double bottom)

Sets range of x,y window to show all data.

Allows adding an additional margin to automatically calculated axis range. Margins are given in relative units wrt calculated axis range. For example, setViewportToContent(0.0, 0.1, 0.0, 0.1) will set axes to show all graphs with 10% gap above and below graph’s max and min.

class GraphViewportItem : public mvvm::ViewportItem

2D viewport specialized for showing multiple GraphItem’s. Provides calculation of viewport’s x-axis and y-axis range basing on GraphItem data. Provides functionality to hide selected graphs.

Public Functions

virtual std::unique_ptr<SessionItem> Clone() const override

Creates a clone of the item.

Creates an exact clone of the item together with all its children. All item identifiers will be the same. Please note, that cloned items can’t be used along with the original item in the same model due to memory pool identifiers collision. Use utils::CopyItem to create deep copies that have different item identifiers.

std::vector<GraphItem*> GetGraphItems() const

Returns the selected graph items.

std::vector<GraphItem*> GetVisibleGraphItems() const

Returns the selected graph items.

void SetVisibleGraphItems(const std::vector<GraphItem*> &visible_graph_items)

Set the graph selection.

void SetAllVisible()

Reset the graph selection.

class LinkedItem : public mvvm::SessionItem

Item to store a persistent link to other arbitrary items.

The identifier of the item intended for linking is stored as DataRole on board of LinkedItem and can be used to find the corresponding item via SessionModel::FindItem machinery. The machinery is persistent and outlives serialization. Can be used to find items in different models. For that being the case, models should use the same ItemPool.

Public Functions

virtual std::unique_ptr<SessionItem> Clone() const override

Creates a clone of the item.

Creates an exact clone of the item together with all its children. All item identifiers will be the same. Please note, that cloned items can’t be used along with the original item in the same model due to memory pool identifiers collision. Use utils::CopyItem to create deep copies that have different item identifiers.

void SetLink(const SessionItem *item)

Set link to given item.

template<typename T = SessionItem>
T *Get() const

Returns item linked to given item. Works only in model context.

class TextItem : public mvvm::CompoundItem

The TextItem class represent text item on plot.

Public Functions

virtual std::unique_ptr<SessionItem> Clone() const override

Creates a clone of the item.

Creates an exact clone of the item together with all its children. All item identifiers will be the same. Please note, that cloned items can’t be used along with the original item in the same model due to memory pool identifiers collision. Use utils::CopyItem to create deep copies that have different item identifiers.

class PenItem : public mvvm::CompoundItem

The PenItem class represents basics settings of QPen.

Public Functions

virtual std::unique_ptr<SessionItem> Clone() const override

Creates a clone of the item.

Creates an exact clone of the item together with all its children. All item identifiers will be the same. Please note, that cloned items can’t be used along with the original item in the same model due to memory pool identifiers collision. Use utils::CopyItem to create deep copies that have different item identifiers.

bool IsSelected() const

Checks if the pen style corresponds to the selected object.

void SetSelected(bool is_selected)

Set pen style as if the object is selected.

std::string GetNamedColor() const

Returns named color.

See also

SetNamedColor()

void SetNamedColor(const std::string &named_color)

Sets named color.

The color name can be the one from https://www.w3.org/TR/css-color-3/#svg-color database, like “red” or “deeppink”,

The color can also be a string of “#RRGGBB” format, e.g. #008000 is a green with (read:0, green:128, blue:0)