SciDAVis
1.D4
Main Page
Related Pages
Namespaces
Classes
Files
File List
File Members
scidavis
src
future
core
datatypes
Double2DayOfWeekFilter.h
Go to the documentation of this file.
1
/***************************************************************************
2
File : Double2DayOfWeekFilter.h
3
Project : SciDAVis
4
--------------------------------------------------------------------
5
Copyright : (C) 2007 by Knut Franke, Tilman Benkert
6
Email (use @ for *) : knut.franke*gmx.de, thzs@gmx.net
7
Description : Conversion filter double -> QDateTime, interpreting
8
the input numbers as days of the week (1 -> Monday).
9
10
***************************************************************************/
11
12
/***************************************************************************
13
* *
14
* This program is free software; you can redistribute it and/or modify *
15
* it under the terms of the GNU General Public License as published by *
16
* the Free Software Foundation; either version 2 of the License, or *
17
* (at your option) any later version. *
18
* *
19
* This program is distributed in the hope that it will be useful, *
20
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
21
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
22
* GNU General Public License for more details. *
23
* *
24
* You should have received a copy of the GNU General Public License *
25
* along with this program; if not, write to the Free Software *
26
* Foundation, Inc., 51 Franklin Street, Fifth Floor, *
27
* Boston, MA 02110-1301 USA *
28
* *
29
***************************************************************************/
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
39
class
Double2DayOfWeekFilter
:
public
AbstractSimpleFilter
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
58
virtual
SciDAVis::ColumnDataType
dataType
()
const
{
return
SciDAVis::TypeQDateTime
; }
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
Generated by
1.8.1