forked from rogii-com/SceneSample
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathI2DSceneCoordinatesMapper.hpp
63 lines (56 loc) · 1.86 KB
/
I2DSceneCoordinatesMapper.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#pragma once
class QPoint;
class QPointF;
class QRect;
class QRectF;
class QLine;
class QLineF;
namespace rogii
{
class I2DSceneCoordinatesMapper
{
public:
virtual ~I2DSceneCoordinatesMapper()
{
}
/**
* @param windowPosition In widget coordinates,
* so the coordinates of the scene topLeft point is not 0, 0
*/
virtual QPointF mapToScene(const QPoint & windowPosition) const = 0;
/**
* @brief Map screen \a windowRectangle coordinates to scene coordinates.
* TopLeft point of \a windowRectangle matches topLeft point of the result rectangle.
* Same about bottomRightPoint.
* Depending on the direction of the axis can return a not normalized rectangle.
* @param windowRectangle In widget coordinates,
* so the coordinates of the scene topLeft point is not 0, 0
*/
virtual QRectF mapToScene(const QRect & windowRectangle) const = 0;
/**
* @param windowLine In widget coordinates,
* so the coordinates of the scene topLeft point is not 0, 0
*/
virtual QLineF mapToScene(const QLine & windowLine) const = 0;
/**
* @return In widget coordinates,
* so the coordinates of the scene topLeft point is not 0, 0
*/
virtual QPoint mapFromScene(const QPointF & scenePosition) const = 0;
/**
* @brief Map scene \a sceneRectangle coordinates to screen coordinates.
* Normalized rectangle always returns regardless of the axis direction.
* @return In widget coordinates,
* so the coordinates of the scene topLeft point is not 0, 0
*/
virtual QRect mapFromScene(const QRectF & sceneRectangle) const = 0;
/**
* @return In widget coordinates,
* so the coordinates of the scene topLeft point is not 0, 0
*/
virtual QLine mapFromScene(const QLineF & sceneLine) const = 0;
/** Use this function to avoid float fail. See description in IChartController2.
*/
virtual QPointF mapDeltaToScene(const QPoint & deltaInScreen) const = 0;
};
} //~namespace rogii