Helper Classes

These are less-important helper classes to the main classes in the SDK.

class Background : public AbstractAspect

This class contains the background properties of worksheet elements like worksheet background, plot background, the area filling in XYCurve, Histogram, etc.

Public Functions

virtual void save(QXmlStreamWriter*) const override

Save as XML.

virtual bool load(XmlStreamReader*, bool preview) override

Load from XML.

class CartesianCoordinateSystem : public AbstractCoordinateSystem

Cartesian coordinate system for plots.

Public Functions

void mapLogicalToScene(const Points &logicalPoints, Points &scenePoints, std::vector<bool> &visiblePoints, MappingFlags flags = MappingFlag::DefaultMapping) const

Maps the points in logical coordinates from points and fills the visiblePoints with the points in logical coordinates restricted to the current intervals.

Parameters:
  • logicalPoints – List of points in logical coordinates

  • scenePoints – List for the points in scene coordinates

  • visiblePoints – List for the logical coordinates restricted to the current region of the coordinate system

  • flags

void mapLogicalToScene(int startIndex, int endIndex, const Points &logicalPoints, Points &scenePoints, std::vector<bool> &visiblePoints, MappingFlags flags = MappingFlag::DefaultMapping) const

Maps the points in logical coordinates from points and fills the visiblePoints with the points in logical coordinates restricted to the current intervals. If there are points, that lie on another one they will not be added a second time.

Parameters:
  • logicalPoints – List of points in logical coordinates

  • scenePoints – List for the points in scene coordinates

  • visiblePoints – List for the logical coordinates restricted to the current region of the coordinate system

int direction(const Dimension) const

Determine the direction relative to the page in different directions.

This function is needed for untransformed lengths such as axis tick length.

Returns:

1 or -1

class CartesianScale

Base class for cartesian coordinate system scales.

Subclassed by InverseScale, LinearScale, LogScale, SqrtScale, SquareScale

class ColumnStringIO : public AbstractColumn

String-IO interface of Column.

Public Functions

virtual AbstractColumn::ColumnMode columnMode() const override

Return the column mode.

This function is most used by tables but can also be used by plots. The column mode specifies how to interpret the values in the column additional to the data type.

virtual AbstractColumn::PlotDesignation plotDesignation() const override

Return the column plot designation.

virtual int rowCount() const override

Return the data vector size.

virtual QString textAt(int) const override

Return the content of row ‘row’.

Use this only when columnMode() is Text

virtual int availableRowCount(int max = -1) const override

Return the number of available data rows.

virtual void setTextAt(int, const QString&) override

Set the content of row ‘row’.

Use this only when columnMode() is Text

virtual bool copy(const AbstractColumn*) override

Copy another column of the same type.

This function will return false if the data type of ‘other’ is not the same as the type of ‘this’. Use a filter to convert a column to another type.

virtual bool copy(const AbstractColumn *source, int source_start, int dest_start, int num_rows) override

Copies part of another column of the same type.

This function will return false if the data type of ‘other’ is not the same as the type of ‘this’.

Parameters:
  • source – pointer to the column to copy

  • source_start – first row to copy in the column to copy

  • destination_start – first row to copy in

  • num_rows – the number of rows to copy

virtual void replaceTexts(int start_row, const QVector<QString> &texts) override

Replace a range of values.

Use this only when columnMode() is Text

inline virtual void save(QXmlStreamWriter*) const override

Save as XML.

inline virtual bool load(XmlStreamReader*, bool preview) override

Load from XML.

XmlStreamReader supports errors as well as warnings. If only warnings (non-critical errors) occur, this function must return the reader at the end element corresponding to the current element at the time the function was called.

This function is normally intended to be called directly after the ctor. If you want to call load on an aspect that has been altered, you must make sure beforehand that it is in the same state as after creation, e.g., remove all its child aspects.

Returns:

false on error

class ErrorBar : public AbstractAspect

This class contains the properties of the error bars used in different plot classes.

Public Functions

virtual void save(QXmlStreamWriter*) const override

Save as XML.

virtual bool load(XmlStreamReader*, bool preview) override

Load from XML.

QPainterPath painterPath(const QVector<QPointF>&, const CartesianCoordinateSystem*, WorksheetElement::Orientation = WorksheetElement::Orientation::Vertical) const

calculates and returns the painter path for the error bars. The error bars are placed at the points in logical coordinates points. The transformation to the scene coordinates is done via cSystem that is owned by the parent plot owning the error bar object. Some plot types like histogram, bar plot, etc. can have different orientations (vertical vs. horizontal) which is provided via orientation, the error is specified for the y-dimentions for such plot types and is drawn either vertically or horizontally depending on the orientation of the plot.

class Line : public AbstractAspect

This class contains the line properties of worksheet elements.

Public Functions

void setCreateXmlElement(bool)

defines whether an XML element needs to be create in write(). For objects where the line properties are serialized together with some other properties, the XML element is created in objects’s save() already and there is not need to create it once more in Line::save():

virtual void save(QXmlStreamWriter*) const override

Save as XML.

virtual bool load(XmlStreamReader*, bool preview) override

Load from XML.

class PlotArea : public WorksheetElement

Plot area (for background filling and clipping).

Public Functions

virtual QGraphicsItem *graphicsItem() const override

Return the graphics item representing this element.

virtual void save(QXmlStreamWriter*) const override

Save as XML.

virtual bool load(XmlStreamReader*, bool preview) override

Load from XML.

template<class T>
class Range : private RangeT

Public Functions

inline QString toString(bool round = true, QLocale locale = QLocale()) const

Return a string in the format ‘start .. end’ and uses system locale (specialization see below)

inline QString toLocaleString(bool round = true) const

Return a string in the format ‘start .. end’ and uses number locale.

inline void zoom(const double factor, const bool nice, const double relZoomPosScene = 0.5)

TODO: implement zooming depending on the relZoomPosScene also for non linear scales!

class StatisticsSpreadsheet : public Spreadsheet

Aspect providing a spreadsheet table with column logic.

Public Functions

virtual QIcon icon() const override

Returns an icon to be used for decorating my views.

virtual void save(QXmlStreamWriter*) const override

Saves as XML.

virtual bool load(XmlStreamReader*, bool preview) override

Loads from XML.

class Symbol : public AbstractAspect

Public Functions

virtual void save(QXmlStreamWriter*) const override

Save as XML.

virtual bool load(XmlStreamReader*, bool preview) override

Load from XML.

class Value : public AbstractAspect

This class contains the properties of values that are shown besides the data points in XYCurve, etc.

Public Functions

virtual void save(QXmlStreamWriter*) const override

Save as XML.

virtual bool load(XmlStreamReader*, bool preview) override

Load from XML.

class XmlStreamReader : public QXmlStreamReader

XML stream parser that supports errors as well as warnings. This class also adds line and column numbers to the error message.

Public Functions

bool failedCASMissing() const

returns true if the loading of an project object failed because of the missing CAS functionality (no CAS support or missing CAS plugin). returns false if the loadign failed because of other reasons like broken XML or missing important and required attributes.

bool skipToNextTag()

Go to the next start or end element tag If the end of the document is reached, an error is raised.

Returns:

false if end of document reached, otherwise true

bool skipToEndElement()

Go to the end element tag of the current element If the end of the document is reached, an error is raised.

Returns:

false if end of document reached, otherwise true

int readAttributeInt(const QString &name, bool *ok)

Read an XML attribute and convert it to int

Parameters:
  • name – attribute name

  • ok – pointer to report back whether the attribute value could be determined (may be NULL)

Returns:

the attribute value if found and converted, otherwise zero (in this case *ok is false)