scidavis  2.3.0
About: SciDAVis is a free application for Scientific Data Analysis and Visualization (a fork off of QtiPlot).
  Fossies Dox: scidavis-2.3.0.tar.gz  ("unofficial" and yet experimental doxygen-generated source code documentation)  

Double2DayOfWeekFilter.h
Go to the documentation of this file.
1 
12 
30 #ifndef DOUBLE2DAY_OF_WEEK_FILTER_H
31 #define DOUBLE2DAY_OF_WEEK_FILTER_H
32 
33 #include "../AbstractSimpleFilter.h"
34 #include <QDateTime>
35 #include "lib/XmlStreamReader.h"
36 #include <QXmlStreamWriter>
37 
40 {
41  Q_OBJECT
42  public:
43  virtual QDate dateAt(int row) const {
44  if (!d_inputs.value(0)) return QDate();
45  // Don't use Julian days here since support for years < 1 is bad
46  // Use 1900-01-01 instead (a Monday)
47  return QDate(1900,1,1).addDays(qRound(d_inputs.value(0)->valueAt(row) - 1.0));
48  }
49  virtual QTime timeAt(int row) const {
50  Q_UNUSED(row)
51  return QTime(0,0,0,0);
52  }
53  virtual QDateTime dateTimeAt(int row) const {
54  return QDateTime(dateAt(row), timeAt(row));
55  }
56 
59 
60  protected:
62  virtual bool inputAcceptable(int, const AbstractColumn *source) {
63  return source->dataType() == SciDAVis::TypeDouble;
64  }
65 };
66 
67 #endif // ifndef DOUBLE2DAY_OF_WEEK_FILTER_H
Double2DayOfWeekFilter::dateAt
virtual QDate dateAt(int row) const
Return the date part of row 'row'.
Definition: Double2DayOfWeekFilter.h:43
Double2DayOfWeekFilter::inputAcceptable
virtual bool inputAcceptable(int, const AbstractColumn *source)
Using typed ports: only double inputs are accepted.
Definition: Double2DayOfWeekFilter.h:62
Double2DayOfWeekFilter::dataType
virtual SciDAVis::ColumnDataType dataType() const
Return the data type of the column.
Definition: Double2DayOfWeekFilter.h:58
SciDAVis::ColumnDataType
ColumnDataType
Column data type.
Definition: globals.h:77
Double2DayOfWeekFilter::timeAt
virtual QTime timeAt(int row) const
Return the time part of row 'row'.
Definition: Double2DayOfWeekFilter.h:49
AbstractColumn::dataType
virtual SciDAVis::ColumnDataType dataType() const =0
Return the data type of the column.
XmlStreamReader.h
SciDAVis::TypeDouble
@ TypeDouble
Definition: globals.h:78
AbstractSimpleFilter
Simplified filter interface for filters with only one output port.
Definition: AbstractSimpleFilter.h:129
SciDAVis::TypeQDateTime
@ TypeQDateTime
Definition: globals.h:80
AbstractFilter::d_inputs
QVector< const AbstractColumn * > d_inputs
The data sources connected to my input ports.
Definition: AbstractFilter.h:275
Double2DayOfWeekFilter
Conversion filter double -> QDateTime, interpreting the input numbers as days of the week (1 = Monday...
Definition: Double2DayOfWeekFilter.h:40
Double2DayOfWeekFilter::dateTimeAt
virtual QDateTime dateTimeAt(int row) const
Set the content of row 'row'.
Definition: Double2DayOfWeekFilter.h:53
AbstractColumn
Interface definition for data with column logic.
Definition: AbstractColumn.h:82