|
libkpl
6.0
A Library for Graphical Presentation of Data Sets and Functions
|
Array item class. More...
#include <arrayitem.h>

Public Member Functions | |
| ArrayItem () | |
| Constructor. | |
| ArrayItem (unsigned color, int colX=0, int colY=0, int colErr=0, bool errorBars=false, Symbol symbol=OpenCircle, DecimalCharacter decimalChar=Point, const QUrl &url=QUrl(), double fx=1, double fy=1, QGraphicsItem *parent=nullptr, int n=0, int rowStart=0, FillStyle fillStyle=NoBrush, double xOffset=0, double yOffset=0, bool visible=true, bool internal=false, double relSize=1) | |
| Constructor. | |
| ArrayItem (const ArrayItem &a) | |
| Copy constructor. | |
| ArrayItem (const KConfigGroup *plo, const QUrl &urlPlo, unsigned color=0, int colX=0, int colY=0, int colErr=0, bool errorBars=false, Symbol symbol=OpenCircle, QGraphicsItem *parent=nullptr) | |
| Constructor. | |
| virtual | ~ArrayItem () |
| Destructor. | |
| void | adjustCols (int colX, int colY, int colErr) |
| Sets and limits the column indices. | |
| void | adjustCols () |
| Limits the column indices. | |
| virtual QRectF | boundingRect () const override |
| Calculates bounding rectangle. | |
| int | colErr () const |
| Returns y error column index. | |
| int | colX () const |
| Returns x column index. | |
| int | colY () const |
| Returns y column index. | |
| int | count () const |
| Returns number of data points to be plotted. | |
| double ** | data () const |
| Returns pointer to internal array. | |
| DecimalCharacter | decimalCharacter () const |
| Returns decimal symbol of floating point numbers. | |
| bool | errorBars () const |
| Returns true for plotting error bars. | |
| void | exponent (int &expX, int &expY, double &fx, double &fy) const |
| Calculates normalization factors. | |
| bool | internal () const |
| Returns true for internal stored array data. | |
| void | limits (double &xMin, double &xMax, double &yMin, double &yMax) const |
| Calculates minimum and maximum values. | |
| int | numCols () const |
| Returns number of columns. | |
| int | numRows () const |
| Returns number of rows. | |
| virtual void | paint (QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget=nullptr) override |
| Paints item. | |
| virtual int | readFile () |
| Reads double values from the URL. | |
| int | readFile (QString *text) |
| Reads double values from a string. | |
| int | rowStart () const |
| Returns start row index. | |
| void | setColErr (int colErr) |
| Sets error column index. | |
| void | setColX (int colX) |
| Sets x column index. | |
| void | setColY (int colY) |
| Sets y column index. | |
| void | setCount (int n) |
| Sets number of data points. | |
| void | setDashOffset () |
| Sets offset for dashed lines. | |
| void | setData (double **data) |
| Sets array pointer. | |
| void | setDecimalCharacter (DecimalCharacter decimalChar) |
| Sets decimal character. | |
| void | setErrorBars (bool errorBars) |
| Sets error bars plotting. | |
| void | setInternal (bool internal) |
| Sets storage mode. | |
| void | setNumCols (int nCols) |
| Sets number of columns. | |
| void | setNumRows (int nRows) |
| Sets number of rows. | |
| void | setRange (int rowStart, int n) |
| Sets and limits the start row index and the number of points to be plotted. | |
| void | setRowStart (int rowStart) |
| Sets start row index. | |
| void | setUrl (const QUrl &url) |
| Sets URL. | |
| virtual QPainterPath | shape () const override |
| Returns the shape of the plot item. | |
| virtual int | type () const override |
| Returns specific QGraphicsItem type number. | |
| const QUrl & | url () const |
| Returns URL of data file. | |
| void | writePlo (KConfigGroup *plo, const QUrl &urlPlo, bool absolute) const |
| Writes into plot file. | |
Public Member Functions inherited from ScaledItem | |
| ScaledItem () | |
| Constructor. | |
| ScaledItem (const ScaledItem &a) | |
| Copy constructor. | |
| ScaledItem (const KConfigGroup *plo, Symbol symbol, unsigned color, QGraphicsItem *parent) | |
| Constructor. | |
| ScaledItem (FillStyle fillStyle, Symbol symbol, unsigned color, double fx, double fy, double xOffset, double yOffset, double relSize, QGraphicsItem *parent) | |
| Constructor. | |
| virtual | ~ScaledItem () |
| Destructor. | |
| unsigned | color () const |
| Returns color. | |
| FillStyle | fillStyle () const |
| Returns fill style. | |
| bool | isNormalized (double fx, double fy) const |
| Checks if both normalization factors are equal to given values. | |
| void | normalize (double fx, double fy) |
| Sets normalization factors. | |
| double | normX () const |
| Returns normalization factor for x values. | |
| double | normY () const |
| Returns normalization factor for y values. | |
| QPixmap | pixmap () const |
| Returns decoration pixmap for item list. | |
| void | readPlo (const KConfigGroup *plo, Symbol symbol, unsigned color) |
| Initializes corresponding to plot file. | |
| void | setColor (unsigned color) |
| Sets color. | |
| void | setFillStyle (FillStyle style) |
| Sets fill style. | |
| void | setNormX (double fx) |
| Sets normalization factor for x values. | |
| void | setNormY (double fy) |
| Sets normalization factor for y values. | |
| void | setProperties (const QTransform &m) |
| Sets properties according to transformation matrix. | |
| void | setSize () |
| Sets size according to transformation matrix. | |
| void | setSymbol (Symbol symbol) |
| Sets symbol type. | |
| void | setXOffset (double xOffset) |
| Sets offset for x values. | |
| void | setYOffset (double yOffset) |
| Sets offset for y values. | |
| Symbol | symbol () const |
| Returns symbol type. | |
| void | update () |
| Applies changes and forces redrawing. | |
| void | updateGeometry () |
| Updates geometry. | |
| void | writePlo (KConfigGroup *plo, bool visible) const |
| Writes into plot file. | |
| double | xOffset () const |
| Returns offset for x values. | |
| double | yOffset () const |
| Returns offset for y values. | |
Public Member Functions inherited from KplItem | |
| KplItem (double relSize=1) | |
| Constructor. | |
| KplItem (const KplItem &a) | |
| Copy constructor. | |
| KplItem (const KConfigGroup *plo) | |
| Constructor. | |
| virtual | ~KplItem () |
| Destructor. | |
| void | readPlo (const KConfigGroup *plo) |
| Initializes corresponding to plot file. | |
| double | relSize () const |
| Returns relative size of item. | |
| void | setRelSize (double relSize) |
| Sets relative size of item. | |
| void | writePlo (KConfigGroup *plo, bool visible=true) const |
| Writes into plot file. | |
Static Public Member Functions | |
| static double ** | copyArray (double **data, int nCols, int nRows) |
| Copies array storage. | |
| static void | freeArray (double ***data) |
| Deallocates array storage. | |
| static int | readFile (const QUrl &url, int &nCols, double ***data, DecimalCharacter decimalChar=Point) |
| Reads double values from a file into an array. | |
| static int | readFile (QIODevice *device, int &nCols, double ***data, DecimalCharacter decimalChar=Point) |
| Reads double values from an I/O device into an array. | |
| static int | readFile (QString *text, int &nCols, double ***data, DecimalCharacter decimalChar=Point) |
| Reads double values from a string into an array. | |
| static int | readLines (QTextStream &t, int nCols, double ***data, DecimalCharacter decimalChar=Point) |
| Reads double values from a text stream into an array. | |
| static void | translate (QString &line, DecimalCharacter decimalChar) |
| Translates exponent and decimal symbols. | |
Static Public Member Functions inherited from ScaledItem | |
| static void | exponent (double a, int &iExp, double &f) |
| Calculates normalization factor. | |
| static bool | limits (double &xMin, double &xMax, const double *values, int n) |
| Calculates minimum and maximum values of an array. | |
Static Public Member Functions inherited from KplItem | |
| static QUrl | absoluteUrl (const QString &path, const QUrl &urlPlo) |
| Constructs absolute file URL. | |
| static QBrush | createBrush (unsigned color, FillStyle fillStyle=NoBrush) |
| Creates brush. | |
| static QPen | createPen (double width, unsigned color, PenType penType, Symbol symbol) |
| Creates pen. | |
| static void | paintSymbol (QPainter *painter, const QRectF &rect, Symbol symbol=OpenCircle) |
| Paints symbol. | |
| static QPixmap | pixmap (Symbol symbol) |
| Returns black decoration pixmap of plot symbol for use in dialog GUI. | |
| static QPixmap | pixmap (QPen pen, Symbol symbol=SolidLine) |
| Returns decoration pixmap of plot symbol for use in item lists. | |
| static QString | path (const QUrl &urlPlo, const QUrl &url, bool absolute=false) |
| Constructs absolute or (if possible) relative file path. | |
| static void | resetDashOffset () |
| Resets offset for dashed lines. | |
| static unsigned | rgb (const QString &color) |
| Converts rgb string to QRgb. | |
| static unsigned | rgbQt1 (unsigned rgb) |
| Converts QRgb to Qt1 QRgb. | |
Protected Member Functions | |
| void | paintCond (QPainter *painter) const |
| Paints or calculates bounding area. | |
Protected Member Functions inherited from ScaledItem | |
| double | length (const double *x, const double *y, int n) const |
| Calculates line length. | |
| void | plotArray (QPainter *painter, const double *x, const double *y, int n) const |
| Plots array. | |
| void | setProperties () |
| Sets properties according to transformation matrix. | |
Protected Member Functions inherited from KplItem | |
| QPen & | changePenWidth (QPen &pen, double width) const |
| Changes pen width. | |
| QPen | createPen (QGraphicsItem *item, unsigned color=0, PenType penType=DataPen, Symbol symbol=SolidLine) const |
| Creates pen for plot item. | |
| double | penWidth (const QGraphicsItem *item, PenType penType=DataPen) const |
| Calculates pen width for plot item. | |
Protected Attributes | |
| bool | m_internal |
| bool | m_errorBars |
| int | m_colX |
| int | m_colY |
| int | m_colErr |
| int | m_rowStart |
| int | m_count |
| int | m_numRows |
| int | m_numCols |
| DecimalCharacter | m_decimalCharacter |
| double ** | m_data |
| QUrl | m_url |
Protected Attributes inherited from ScaledItem | |
| FillStyle | m_fillStyle |
| Symbol | m_symbol |
| unsigned | m_color |
| double | m_normX |
| double | m_normY |
| double | m_xOffset |
| double | m_yOffset |
| double | dydx |
| double | myDashOffset |
| QPen | m_pen |
| QPainterPath | bPath |
| QRectF | bRect |
| QRectF | symbRect |
| QTransform | m_matrix |
Protected Attributes inherited from KplItem | |
| double | m_relSize |
Additional Inherited Members | |
Static Protected Member Functions inherited from KplItem | |
| static double | parentWidth (const QGraphicsItem *item) |
| Returns width of item's parent frame or width of scene if the item has no parent item. | |
| static double | penWidthFactor (PenType penType) |
| Returns factor to calculate pen width from frame width. | |
Static Protected Attributes inherited from KplItem | |
| static double | m_dashOffset |
Array item class.
Class for array items showing data arrays by lines or markers.
| anonymous enum |
| ArrayItem::ArrayItem | ( | unsigned | color, |
| int | colX = 0, | ||
| int | colY = 0, | ||
| int | colErr = 0, | ||
| bool | errorBars = false, | ||
| Symbol | symbol = OpenCircle, | ||
| DecimalCharacter | decimalChar = Point, | ||
| const QUrl & | url = QUrl(), | ||
| double | fx = 1, | ||
| double | fy = 1, | ||
| QGraphicsItem * | parent = nullptr, | ||
| int | n = 0, | ||
| int | rowStart = 0, | ||
| FillStyle | fillStyle = NoBrush, | ||
| double | xOffset = 0, | ||
| double | yOffset = 0, | ||
| bool | visible = true, | ||
| bool | internal = false, | ||
| double | relSize = 1 ) |
Constructor.
Initializes corresponding to arguments.
| color | color for data plot. |
| colX | x column index. |
| colY | y column index. |
| colErr | y error column index. |
| errorBars | true to plot error bars. |
| symbol | symbol type. |
| decimalChar | decimal symbol of floating point numbers used in file. |
| url | URL of data file. |
| fx | normalization factor for x values. |
| fy | normalization factor for y values. |
| parent | pointer to parent item. |
| n | number of data points to be plotted. |
| rowStart | start row index. |
| fillStyle | fill style. |
| xOffset | offset for x values. |
| yOffset | offset for x values. |
| visible | true for visible item. |
| internal | true for internal stored array data. |
| relSize | relative size of lines or symbols. |
| ArrayItem::ArrayItem | ( | const ArrayItem & | a | ) |
Copy constructor.
| a | source item. |
| ArrayItem::ArrayItem | ( | const KConfigGroup * | plo, |
| const QUrl & | urlPlo, | ||
| unsigned | color = 0, | ||
| int | colX = 0, | ||
| int | colY = 0, | ||
| int | colErr = 0, | ||
| bool | errorBars = false, | ||
| Symbol | symbol = OpenCircle, | ||
| QGraphicsItem * | parent = nullptr ) |
Constructor.
Initializes corresponding to plot file.
| plo | pointer to KSimpleConfig object containing item data. |
| urlPlo | URL of plot file. |
| color | default color for data plot. |
| colX | default x column index. |
| colY | default y column index. |
| colErr | default y error column index. |
| errorBars | default, true to plot error bars. |
| symbol | default symbol type. |
| parent | pointer to parent item. |
| void ArrayItem::adjustCols | ( | int | colX, |
| int | colY, | ||
| int | colErr ) |
Sets and limits the column indices.
| colX | x column. |
| colY | y column. |
| colErr | error column. |
|
static |
Copies array storage.
| data | two-dimensional source array. |
| nCols | number of columns. |
| nRows | number of rows. |
|
inline |
Returns pointer to internal array.
| void ArrayItem::exponent | ( | int & | expX, |
| int & | expY, | ||
| double & | fx, | ||
| double & | fy ) const |
Calculates normalization factors.
| expX | reference to logarithm of x normalization factor. |
| expY | reference to logarithm of x normalization factor. |
| fx | reference to x normalization factor. |
| fy | reference to y normalization factor. |
|
static |
Deallocates array storage.
| data | pointer to two-dimensional array. |
| void ArrayItem::limits | ( | double & | xMin, |
| double & | xMax, | ||
| double & | yMin, | ||
| double & | yMax ) const |
Calculates minimum and maximum values.
| xMin | reference to minimum of x values. |
| xMax | reference to maximum of x values. |
| yMin | reference to minimum of y values. |
| yMax | reference to maximum of y values. |
|
protected |
Paints or calculates bounding area.
| painter | Pointer to QPainter object, 0 for calculating bounding area. |
|
virtual |
Reads double values from the URL.
|
static |
Reads double values from a file into an array.
| url | URL of data file. |
| nCols | reference to number of columns. |
| data | pointer to two-dimensional array. |
| decimalChar | decimal symbol of floating point numbers used in file. |
|
static |
Reads double values from an I/O device into an array.
| device | I/O device to read from. |
| nCols | reference to number of columns. |
| data | pointer to two-dimensional array. |
| decimalChar | decimal character: Point or Comma. |
| int ArrayItem::readFile | ( | QString * | text | ) |
Reads double values from a string.
|
static |
Reads double values from a string into an array.
| text | string to read from. |
| nCols | reference to number of columns. |
| data | pointer to two-dimensional array. |
| decimalChar | decimal character: Point or Comma. |
|
static |
Reads double values from a text stream into an array.
| t | text stream to read from. |
| nCols | number of columns. |
| data | pointer to array. |
| decimalChar | decimal character: Point or Comma. |
|
inline |
Sets error column index.
| colErr | y error column index. |
|
inline |
Sets x column index.
| colX | y error column index. |
|
inline |
Sets y column index.
| colY | y column index. |
|
inline |
Sets number of data points.
| n | number of data points. |
| void ArrayItem::setData | ( | double ** | data | ) |
Sets array pointer.
| data | two-dimensional array. |
|
inline |
Sets decimal character.
| decimalChar | decimal symbol of floating point numbers used in file. |
|
inline |
Sets error bars plotting.
| errorBars | true to plot error bars. |
|
inline |
Sets storage mode.
| internal | true for internal stored array data. |
|
inline |
Sets number of columns.
| nCols | number of columns. |
|
inline |
Sets number of rows.
| nRows | number of Rows. |
| void ArrayItem::setRange | ( | int | rowStart, |
| int | n ) |
Sets and limits the start row index and the number of points to be plotted.
| rowStart | start row index. |
| n | number of data points. |
|
inline |
Sets start row index.
| rowStart | start row index. |
|
inline |
Sets URL.
| url | URL of data file. |
|
static |
Translates exponent and decimal symbols.
| line | line from data or parameter file. |
| decimalChar | decimal symbol of floating point numbers used in file. |
| void ArrayItem::writePlo | ( | KConfigGroup * | plo, |
| const QUrl & | urlPlo, | ||
| bool | absolute ) const |
Writes into plot file.
| plo | KConfigGroup object. |
| urlPlo | URL of plot file. |
| absolute | true to save absolute paths. |