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)
10 namespace Scenario
11 {
12 struct Point
13 {
14  TimeVal date;
15  double y;
16 };
17 
18 inline Point
19 ConvertToScenarioPoint(const QPointF& point, ZoomRatio zoom, double height) noexcept
20 {
21  return {TimeVal::fromPixels(point.x(), zoom), point.y() / height};
22 }
23 
24 inline QPointF
25 ConvertFromScenarioPoint(const Point& point, ZoomRatio zoom, double height) noexcept
26 {
27  return {point.date.toPixels(zoom), point.y * height};
28 }
29 }
30 
31 inline QDataStream& operator<<(QDataStream& i, const Scenario::Point& sel)
32 {
33  SCORE_ABORT;
34  return i;
35 }
36 inline QDataStream& operator>>(QDataStream& i, Scenario::Point& sel)
37 {
38  SCORE_ABORT;
39  return i;
40 }
41 Q_DECLARE_METATYPE(Scenario::Point)
42 W_REGISTER_ARGTYPE(Scenario::Point)
Main plug-in of score.
Definition: score-plugin-dataflow/Dataflow/PortItem.hpp:14
Definition: ScenarioPoint.hpp:13
Definition: TimeValue.hpp:21