ICF 3.1.1.10
Technical documentation of ICF Libraries
CScreenTransform.h
Go to the documentation of this file.
1/********************************************************************************
2** This file is part of the ICF Framework. Copyright (C) Witold Gantzke & Kirill Lepskiy
3** ICF Framework may be used under the terms of the LGPL License v. 2.1 by the Free Software Foundation.
4********************************************************************************/
5
6#ifndef iview_CScreenTransform_included
7#define iview_CScreenTransform_included
8
9
10#include <i2d/CAffine2d.h>
11
12
13namespace iview
14{
15
16
18{
19public:
21
27
31 CScreenTransform(const CScreenTransform& transform);
32
36 CScreenTransform(const i2d::CAffine2d& transform);
37
42
46 istd::CIndex2d GetScreenPosition(const i2d::CVector2d& position) const;
47
51 const i2d::CAffine2d& GetInverted() const;
52
53 // reimplemented (i2d::CAffine2d)
54 void Reset();
55 void Reset(const i2d::CVector2d& position);
56 void Reset(const i2d::CVector2d& position, double angle, double scale = 1.0);
57 void Reset(const i2d::CVector2d& position, double angle, const i2d::CVector2d& scale);
59 void GetApply(const i2d::CAffine2d& transform, CScreenTransform& result) const;
60 void Apply(const i2d::CAffine2d& transform);
61 void ApplyLeft(const i2d::CAffine2d& transform);
62 i2d::CAffine2d& operator=(const i2d::CAffine2d& transform);
63
64protected:
65 void CalculateInvert();
66
67private:
68 i2d::CAffine2d m_invert;
69};
70
71
75
76
78 : i2d::CAffine2d(transform),
79 m_invert(transform.m_invert)
80{
81}
82
83
85 : i2d::CAffine2d(transform)
86{
88}
89
90
92{
93 i2d::CVector2d result;
94 i2d::CVector2d pos(position.GetX(), position.GetY());
95
96 m_invert.GetApply(pos, result);
97
98 return result;
99}
100
101
103{
104 i2d::CVector2d result;
105 GetApply(position, result);
106
107 return istd::CIndex2d(int(result.GetX()), int(result.GetY()));
108}
109
110
111// reimplemented (i2d::CAffine2d)
112
114{
116
118}
119
120
121inline void CScreenTransform::Reset(const i2d::CVector2d& position)
122{
123 BaseClass::Reset(position);
124
126}
127
128
129inline void CScreenTransform::Reset(const i2d::CVector2d& position, double angle, double scale)
130{
131 BaseClass::Reset(position, angle, scale);
132
134}
135
136
137inline void CScreenTransform::Reset(const i2d::CVector2d& position, double angle, const i2d::CVector2d& scale)
138{
139 BaseClass::Reset(position, angle, scale);
140
142}
143
144
145inline void CScreenTransform::Apply(const i2d::CAffine2d& transform)
146{
147 BaseClass::Apply(transform);
148
150}
151
152
154{
155 BaseClass::operator=(transform);
156
158
159 return *this;
160}
161
162
164{
165 BaseClass::GetInverted(m_invert);
166}
167
168
170{
171 return m_invert;
172}
173
174
175} // namespace iview
176
177
178#endif // !iview_CScreenTransform_included
179
180
This class defines an affine 2D-transformation.
Definition CAffine2d.h:22
CAffine2d & operator=(const CAffine2d &transform)
void Reset()
Set to identity transformation.
CVector2d GetApply(const CVector2d &position) const
Calculate transformed position.
Definition CAffine2d.h:280
void Apply(const CAffine2d &transform)
Combine this transformation with another transformation.
CAffine2d GetInverted() const
Get inverted transformation.
Definition CAffine2d.h:341
Definition of position or mathematical vector on 2D plane.
Definition CVector2d.h:29
double GetY() const
Get Y position of this vector.
Definition CVector2d.h:184
double GetX() const
Get X position of this vector.
Definition CVector2d.h:172
Index implementation for addressing elements in 2D-space.
Definition CIndex2d.h:25
int GetX() const
Definition CIndex2d.h:105
int GetY() const
Definition CIndex2d.h:117
CScreenTransform()
Default constructor.
i2d::CVector2d GetClientPosition(istd::CIndex2d position) const
Return position of point in logical coordinates.
i2d::CAffine2d & operator=(const i2d::CAffine2d &transform)
void Apply(const i2d::CAffine2d &transform)
void GetApply(const i2d::CAffine2d &transform, CScreenTransform &result) const
istd::CIndex2d GetScreenPosition(const i2d::CVector2d &position) const
Return position of point in screen coordinates.
void ApplyLeft(const i2d::CAffine2d &transform)
const i2d::CAffine2d & GetInverted() const
Return reference to invert transformation.
Contains the 2D objects.
Definition CAffine2d.h:15
In this library is defined 2D view concept and standard visualisation objects.

© Witold Gantzke and Kirill Lepskiy