Loading...
Searching...
No Matches
ScenarioPoint.hpp
1#pragma once
2#include <Process/TimeValue.hpp>
3
4#include <score/tools/Debug.hpp>
5
6#include <QPointF>
7
8#include <verdigris>
9// A coordinate : (t, y)
10namespace Scenario
11{
12struct Point
13{
14 TimeVal date;
15 double y;
16};
17
18inline Point
19ConvertToScenarioPoint(const QPointF& point, ZoomRatio zoom, double height) noexcept
20{
21 return {TimeVal::fromPixels(point.x(), zoom), point.y() / height};
22}
23
24inline QPointF
25ConvertFromScenarioPoint(const Point& point, ZoomRatio zoom, double height) noexcept
26{
27 return {point.date.toPixels(zoom), point.y * height};
28}
29}
30
31inline QDataStream& operator<<(QDataStream& i, const Scenario::Point& sel)
32{
33 SCORE_ABORT;
34 return i;
35}
36inline QDataStream& operator>>(QDataStream& i, Scenario::Point& sel)
37{
38 SCORE_ABORT;
39 return i;
40}
41Q_DECLARE_METATYPE(Scenario::Point)
42W_REGISTER_ARGTYPE(Scenario::Point)
Main plug-in of score.
Definition score-plugin-dataflow/Dataflow/PortItem.hpp:13
Definition ScenarioPoint.hpp:13
Definition TimeValue.hpp:21