|
libkpl
5.0
A Library for Graphical Presentation of Data Sets and Functions
|
26 #include "scaleditem.h"
50 Type = UserType + Array
80 ArrayItem(
unsigned color,
int colX = 0,
int colY = 0,
int colErr = 0,
81 bool errorBars =
false,
Symbol symbol = OpenCircle,
83 double fx = 1,
double fy = 1, QGraphicsItem* parent = 0,
int n = 0,
84 int rowStart = 0,
FillStyle fillStyle = NoBrush,
85 double xOffset = 0,
double yOffset = 0,
bool visible =
true,
86 bool internal =
false,
double relSize = 1);
104 ArrayItem(
const KConfigGroup* plo,
const QUrl& urlPlo,
unsigned color = 0,
105 int colX = 0,
int colY = 0,
int colErr = 0,
bool errorBars =
false,
106 Symbol symbol = OpenCircle, QGraphicsItem* parent = 0);
121 inline int colErr()
const {
return m_colErr; };
123 inline int colX()
const {
return m_colX; };
125 inline int colY()
const {
return m_colY; };
133 static double**
copyArray(
double **data,
int nCols,
int nRows);
135 inline int count()
const {
return m_count; };
140 inline double**
data()
const {
return m_data; };
143 {
return m_decimalCharacter; };
153 void exponent(
int& expX,
int& expY,
double& fx,
double& fy)
const;
160 inline bool internal()
const {
return m_internal; };
168 void limits(
double& xMin,
double& xMax,
double& yMin,
double& yMax)
const;
170 inline int numCols()
const {
return m_numCols; };
172 inline int numRows()
const {
return m_numRows; };
174 virtual void paint(QPainter* painter,
const QStyleOptionGraphicsItem* option,
175 QWidget* widget = 0);
189 static int readFile(
const QUrl& url,
int& nCols,
double*** data,
199 static int readFile(QIODevice* device,
int& nCols,
double*** data,
209 static int readFile(QString* text,
int& nCols,
double*** data,
224 static int readLines(QTextStream& t,
int nCols,
double*** data,
227 inline int rowStart()
const {
return m_rowStart; };
232 inline void setColErr(
int colErr) { m_colErr = colErr; };
237 inline void setColX(
int colX) { m_colX = colX; };
242 inline void setColY(
int colY) { m_colY = colY; };
260 { m_decimalCharacter = decimalChar; };
270 inline void setInternal(
bool internal) { m_internal =
internal; };
297 inline void setUrl(
const QUrl& url) { m_url = url; };
307 virtual int type()
const {
return Type; };
309 inline const QUrl&
url()
const {
return m_url; };
316 void writePlo(KConfigGroup* plo,
const QUrl& urlPlo,
bool absolute)
const;
325 bool m_internal, m_errorBars;
326 int m_colX, m_colY, m_colErr, m_rowStart, m_count, m_numRows, m_numCols;
void setRowStart(int rowStart)
Sets start row index.
Definition: arrayitem.h:292
virtual ~ArrayItem()
Destructor.
int count() const
Returns number of data points to be plotted.
Definition: arrayitem.h:135
static double ** copyArray(double **data, int nCols, int nRows)
Copies array storage.
static void translate(QString &line, DecimalCharacter decimalChar)
Translates exponent and decimal symbols.
static int readFile(QString *text, int &nCols, double ***data, DecimalCharacter decimalChar=Point)
Reads double values from a string into an array.
void setCount(int n)
Sets number of data points.
Definition: arrayitem.h:247
void writePlo(KConfigGroup *plo, const QUrl &urlPlo, bool absolute) const
Writes into plot file.
@ Comma
Decimal comma.
Definition: arrayitem.h:45
void setUrl(const QUrl &url)
Sets URL.
Definition: arrayitem.h:297
void adjustCols()
Limits the column indices.
Definition: arrayitem.h:117
void setInternal(bool internal)
Sets storage mode.
Definition: arrayitem.h:270
int numRows() const
Returns number of rows.
Definition: arrayitem.h:172
const QUrl & url() const
Returns URL of data file.
Definition: arrayitem.h:309
ArrayItem(const ArrayItem &a)
Copy constructor.
virtual int readFile()
Reads double values from the URL.
FillStyle
Fill styles.
Definition: kplitem.h:45
virtual int type() const
Returns specific QGraphicsItem type number.
Definition: arrayitem.h:307
DecimalCharacter decimalCharacter() const
Returns decimal symbol of floating point numbers.
Definition: arrayitem.h:142
int rowStart() const
Returns start row index.
Definition: arrayitem.h:227
static void freeArray(double ***data)
Deallocates array storage.
void exponent(int &expX, int &expY, double &fx, double &fy) const
Calculates normalization factors.
static int readFile(QIODevice *device, int &nCols, double ***data, DecimalCharacter decimalChar=Point)
Reads double values from an I/O device into an array.
@ Point
Decimal point.
Definition: arrayitem.h:44
Scaled item class.
Definition: scaleditem.h:25
int readFile(QString *text)
Reads double values from a string.
static int readLines(QTextStream &t, int nCols, double ***data, DecimalCharacter decimalChar=Point)
Reads double values from a text stream into an array.
int colErr() const
Returns y error column index.
Definition: arrayitem.h:121
int colX() const
Returns x column index.
Definition: arrayitem.h:123
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=0)
Constructor.
virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget=0)
Paints item.
virtual QRectF boundingRect() const
Calculates bounding rectangle.
void setNumRows(int nRows)
Sets number of rows.
Definition: arrayitem.h:280
int numCols() const
Returns number of columns.
Definition: arrayitem.h:170
int colY() const
Returns y column index.
Definition: arrayitem.h:125
void paintCond(QPainter *painter) const
Paints or calculates bounding area.
void setColX(int colX)
Sets x column index.
Definition: arrayitem.h:237
void setData(double **data)
Sets array pointer.
void setDashOffset()
Sets offset for dashed lines.
void setNumCols(int nCols)
Sets number of columns.
Definition: arrayitem.h:275
bool errorBars() const
Returns true for plotting error bars.
Definition: arrayitem.h:145
void limits(double &xMin, double &xMax, double &yMin, double &yMax) const
Calculates minimum and maximum values.
DecimalCharacter
Decimal character.
Definition: arrayitem.h:43
void setRange(int rowStart, int n)
Sets and limits the start row index and the number of points to be plotted.
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=0, 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.
Symbol
Symbol types.
Definition: kplitem.h:83
void setErrorBars(bool errorBars)
Sets error bars plotting.
Definition: arrayitem.h:265
void setColErr(int colErr)
Sets error column index.
Definition: arrayitem.h:232
void setColY(int colY)
Sets y column index.
Definition: arrayitem.h:242
double ** data() const
Returns pointer to internal array.
Definition: arrayitem.h:140
void setDecimalCharacter(DecimalCharacter decimalChar)
Sets decimal character.
Definition: arrayitem.h:259
Array item class.
Definition: arrayitem.h:37
static int readFile(const QUrl &url, int &nCols, double ***data, DecimalCharacter decimalChar=Point)
Reads double values from a file into an array.
void adjustCols(int colX, int colY, int colErr)
Sets and limits the column indices.
virtual QPainterPath shape() const
Returns the shape of the plot item.