OGS
|
A List of data points and all the necessary meta-information to draw a graph.
Definition at line 28 of file DiagramList.h.
#include <DiagramList.h>
Public Member Functions | |
DiagramList () | |
Constructor containing an empty list. | |
~DiagramList () | |
QColor | getColor () const |
Returns the colour of the graph. | |
float | height () const |
Returns the height of the bounding box of all data points within the list. | |
float | minXValue () const |
Returns the minimum x-value. | |
float | maxXValue () const |
Returns the maximum x-value. | |
float | minYValue () const |
Returns the minimum y-value. | |
float | maxYValue () const |
Returns the maximum y-value. | |
const QDateTime | getStartDate () const |
Returns the start date of this list. | |
QString | getName () const |
Returns the name of the diagram. | |
bool | getPath (QPainterPath &path, float scaleX, float scaleY) |
bool | getPoint (QPointF &p, std::size_t i) |
QString | getXLabel () const |
Returns the label associated with the x-axis. | |
QString | getYLabel () const |
Returns the label associated with the y-axis. | |
QString | getXUnit () const |
Returns the unit associated with the x-axis. | |
QString | getYUnit () const |
Returns the unit associated with the y-axis. | |
void | setColor (QColor c) |
Sets the colour of the graph. | |
void | setName (QString name) |
Sets the name of the graph to be displayed in the caption. | |
void | addNextPoint (float x, float y) |
Adds a point at (x,y) to the list. | |
void | truncateToRange (QDateTime const &start, QDateTime const &end) |
cut list entries not within the given range | |
void | setStartDate (QDateTime date) |
Sets the start date (i.e. the min-value of the x-axis). | |
void | setXLabel (QString label) |
Specifies the meaning of the x Axis. | |
void | setYLabel (QString label) |
Specifies the meaning of the y Axis. | |
void | setList (std::vector< std::pair< float, float > > const &coords) |
void | setList (std::vector< std::pair< QDateTime, float > > const &coords) |
void | setXUnit (QString unit) |
Specifies the unit of the x Axis. | |
void | setYUnit (QString unit) |
Specifies the unit of the y Axis. | |
std::size_t | size () const |
Returns the number of data points. | |
double | width () const |
Returns the width of the bounding box of all data points within the list. | |
Static Public Member Functions | |
static int | readList (const QString &path, std::vector< DiagramList * > &list) |
static int | readList (const SensorData *data, std::vector< DiagramList * > &list) |
Private Member Functions | |
float | calcMinXValue () |
Returns the minimum x-value of all the data points. | |
float | calcMaxXValue () |
Returns the maximum x-value of all the data points. | |
float | calcMinYValue () |
Returns the minimum y-value of all the data points. | |
float | calcMaxYValue () |
Returns the maximum y-value of all the data points. | |
int | readLine (std::ifstream inFile, QDateTime &cDate, float &cValue) |
void | update () |
Updates the bounds of the data points contained in the list. | |
Private Attributes | |
float | _maxX {0} |
float | _maxY {0} |
float | _minX {0} |
float | _minY {0} |
std::vector< std::pair< float, float > > | _coords |
QString | _name |
QString | _xLabel |
QString | _yLabel |
QString | _xUnit |
QString | _yUnit |
QColor | _colour |
QDateTime | _startDate |
DiagramList::DiagramList | ( | ) |
Constructor containing an empty list.
Definition at line 27 of file DiagramList.cpp.
Referenced by readList(), and readList().
|
default |
|
inline |
Adds a point at (x,y) to the list.
Definition at line 109 of file DiagramList.h.
References _coords.
|
private |
Returns the maximum x-value of all the data points.
Definition at line 43 of file DiagramList.cpp.
References _coords.
Referenced by update().
|
private |
Returns the maximum y-value of all the data points.
Definition at line 71 of file DiagramList.cpp.
References _coords.
Referenced by update().
|
private |
Returns the minimum x-value of all the data points.
Definition at line 31 of file DiagramList.cpp.
References _coords.
Referenced by update().
|
private |
Returns the minimum y-value of all the data points.
Definition at line 57 of file DiagramList.cpp.
References _coords.
Referenced by update().
|
inline |
Returns the colour of the graph.
Definition at line 36 of file DiagramList.h.
References _colour.
Referenced by DiagramScene::drawGraph().
|
inline |
Returns the name of the diagram.
Definition at line 57 of file DiagramList.h.
References _name.
Referenced by DiagramScene::drawGraph().
bool DiagramList::getPath | ( | QPainterPath & | path, |
float | scaleX, | ||
float | scaleY ) |
Returns all the data points in form of a QPainterPath in scene coordinates. The order of the points is the same as in the vector of coordinates.
path | The path containing all data points. |
scaleX | Scaling factor in x-direction. |
scaleY | Scaling factor in y-direction. |
Definition at line 85 of file DiagramList.cpp.
References _coords, and getPoint().
Referenced by DiagramScene::drawGraph().
bool DiagramList::getPoint | ( | QPointF & | p, |
std::size_t | i ) |
Returns the position of one point in the vector of coordinates.
p | The point-object that will be returned. |
i | Number of the point to be returned. |
Definition at line 105 of file DiagramList.cpp.
References _coords.
Referenced by getPath().
|
inline |
Returns the start date of this list.
Definition at line 54 of file DiagramList.h.
References _startDate.
Referenced by DiagramScene::setDiagramBoundaries().
|
inline |
Returns the label associated with the x-axis.
Definition at line 78 of file DiagramList.h.
References _xLabel.
Referenced by DiagramScene::addGraph().
|
inline |
Returns the unit associated with the x-axis.
Definition at line 84 of file DiagramList.h.
References _xUnit.
Referenced by DiagramScene::addGraph().
|
inline |
Returns the label associated with the y-axis.
Definition at line 81 of file DiagramList.h.
References _yLabel.
Referenced by DiagramScene::addGraph().
|
inline |
Returns the unit associated with the y-axis.
Definition at line 87 of file DiagramList.h.
References _yUnit.
Referenced by DiagramScene::addGraph().
|
inline |
Returns the height of the bounding box of all data points within the list.
Definition at line 39 of file DiagramList.h.
|
inline |
Returns the maximum x-value.
Definition at line 45 of file DiagramList.h.
References _maxX.
Referenced by DiagramScene::setDiagramBoundaries().
|
inline |
Returns the maximum y-value.
Definition at line 51 of file DiagramList.h.
References _maxY.
Referenced by DiagramScene::setDiagramBoundaries().
|
inline |
Returns the minimum x-value.
Definition at line 42 of file DiagramList.h.
References _minX.
Referenced by DiagramScene::setDiagramBoundaries().
|
inline |
Returns the minimum y-value.
Definition at line 48 of file DiagramList.h.
References _minY.
Referenced by DiagramScene::drawGraph(), and DiagramScene::setDiagramBoundaries().
|
private |
Reads an ASCII file containing the coordinates in the following format: date (tab) value where 'date' is given as 'dd.mm.yyyy'. (Changes to that format are easily implemented using QTimeDate)
|
static |
Reads information from a file. The reader assumes that values in the file are separated by tabstops. Also, the first row should contain identifiers for the values and the first column should contain timestamps. Currently accepted timestamps are of the following formats: "dd.mm.yyyy" "dd.mm.yyyy.hh.mm.ss" (this is the timestamp format used for the UFZ database) For each column after the timestamps a new diagram list is created.
Definition at line 157 of file DiagramList.cpp.
References DiagramList(), getDateTime(), BaseLib::replaceString(), and WARN().
Referenced by DetailWindow::DetailWindow(), DiagramPrefsDialog::DiagramPrefsDialog(), and DiagramPrefsDialog::loadFile().
|
static |
Definition at line 248 of file DiagramList.cpp.
References DiagramList(), SensorData::convertSensorDataType2String(), getDateTime(), SensorData::getEndTime(), SensorData::getStartTime(), SensorData::getStepSize(), SensorData::getTimeSeries(), SensorData::getTimeSeriesNames(), SensorData::getTimeSteps(), and BaseLib::int2date().
|
inline |
Sets the colour of the graph.
Definition at line 103 of file DiagramList.h.
References _colour.
Referenced by DetailWindow::addList().
void DiagramList::setList | ( | std::vector< std::pair< float, float > > const & | coords | ) |
Sets the list of x/y-coordinates.
coords | List of coordinates. |
Definition at line 376 of file DiagramList.cpp.
References _coords, _startDate, and update().
void DiagramList::setList | ( | std::vector< std::pair< QDateTime, float > > const & | coords | ) |
Sets the list of x/y-coordinates. Note: This function converts QDateTime values to float values of the number of days from the first date (which is set as day 0)
coords | List of coordinates. |
Definition at line 356 of file DiagramList.cpp.
References _coords, _startDate, and update().
|
inline |
Sets the name of the graph to be displayed in the caption.
Definition at line 106 of file DiagramList.h.
References _name.
Referenced by DiagramPrefsDialog::loadList().
|
inline |
Sets the start date (i.e. the min-value of the x-axis).
Definition at line 115 of file DiagramList.h.
References _startDate.
|
inline |
Specifies the meaning of the x Axis.
Definition at line 118 of file DiagramList.h.
References _xLabel.
|
inline |
Specifies the unit of the x Axis.
Definition at line 138 of file DiagramList.h.
References _xUnit.
|
inline |
Specifies the meaning of the y Axis.
Definition at line 121 of file DiagramList.h.
References _yLabel.
|
inline |
Specifies the unit of the y Axis.
Definition at line 141 of file DiagramList.h.
References _yUnit.
std::size_t DiagramList::size | ( | ) | const |
Returns the number of data points.
Definition at line 388 of file DiagramList.cpp.
References _coords.
void DiagramList::truncateToRange | ( | QDateTime const & | start, |
QDateTime const & | end ) |
cut list entries not within the given range
Definition at line 325 of file DiagramList.cpp.
References _coords, _startDate, and update().
|
private |
Updates the bounds of the data points contained in the list.
Definition at line 393 of file DiagramList.cpp.
References _maxX, _maxY, _minX, _minY, calcMaxXValue(), calcMaxYValue(), calcMinXValue(), and calcMinYValue().
Referenced by setList(), setList(), and truncateToRange().
|
inline |
|
private |
Definition at line 184 of file DiagramList.h.
Referenced by getColor(), and setColor().
|
private |
Definition at line 178 of file DiagramList.h.
Referenced by addNextPoint(), calcMaxXValue(), calcMaxYValue(), calcMinXValue(), calcMinYValue(), getPath(), getPoint(), setList(), setList(), size(), and truncateToRange().
|
private |
Definition at line 174 of file DiagramList.h.
Referenced by maxXValue(), update(), and width().
|
private |
Definition at line 175 of file DiagramList.h.
Referenced by height(), maxYValue(), and update().
|
private |
Definition at line 176 of file DiagramList.h.
Referenced by minXValue(), update(), and width().
|
private |
Definition at line 177 of file DiagramList.h.
Referenced by height(), minYValue(), and update().
|
private |
Definition at line 179 of file DiagramList.h.
|
private |
Definition at line 185 of file DiagramList.h.
Referenced by getStartDate(), setList(), setList(), setStartDate(), and truncateToRange().
|
private |
Definition at line 180 of file DiagramList.h.
Referenced by getXLabel(), and setXLabel().
|
private |
Definition at line 182 of file DiagramList.h.
Referenced by getXUnit(), and setXUnit().
|
private |
Definition at line 181 of file DiagramList.h.
Referenced by getYLabel(), and setYLabel().
|
private |
Definition at line 183 of file DiagramList.h.
Referenced by getYUnit(), and setYUnit().