ICF 3.1.1.10
Technical documentation of ICF Libraries
CRectControlledShapeBase.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_CRectControlledShapeBase_included
7#define iview_CRectControlledShapeBase_included
8
9
10// ICF includes
12
13
14namespace iview
15{
16
17
19{
20public:
23
25
29 virtual bool IsEditableRotation();
30 virtual void SetEditableRotation(bool state = true);
31
35 virtual bool IsEditableWidth();
36 virtual void SetEditableWidth(bool state = true);
37
41 virtual bool IsEditableHeight();
42 virtual void SetEditableHeight(bool state = true);
43
47 virtual bool IsProportionalScaled() const;
48 virtual void SetProportionalScaled(bool state = true);
49
50 // reimplemented (iview::CInteractiveShapeBase)
51 virtual void InvalidateBoundingBox();
52
53 // reimplemented (iview::IInteractiveShape)
54 virtual TouchState IsTouched(istd::CIndex2d position) const;
55
56 // reimplemented (iview::IShape)
57 virtual void Draw(QPainter& drawContext) const;
58
59 // reimplemented (iview::IMouseActionObserver)
60 virtual bool OnMouseButton(istd::CIndex2d position, Qt::MouseButton buttonType, bool downFlag);
61
62protected:
78
93
94 void CalcNodes(const i2d::CAffine2d& parallTransform) const;
95 void ResetNodes() const;
96 bool AreNodesValid() const;
97
99
100 virtual bool IsTickerTouched(istd::CIndex2d position) const;
101 virtual void DrawTickers(QPainter& drawContext) const;
102 virtual void DrawFigure(QPainter& drawContext) const;
103
105 const i2d::CAffine2d& parallTransform,
106 istd::CIndex2d position) const;
108 const i2d::CVector2d& center,
109 const i2d::CVector2d& isPos,
110 const i2d::CVector2d& shouldPos);
112 const i2d::CVector2d& center,
113 const i2d::CVector2d& isPos,
114 const i2d::CVector2d& shouldPos);
116 const i2d::CVector2d& center,
117 const i2d::CVector2d& isPos,
118 const i2d::CVector2d& shouldPos);
119
120 // reimplemented (iview::CInteractiveShapeBase)
121 virtual void BeginLogDrag(const i2d::CVector2d& reference);
122 virtual void SetLogDragPosition(const i2d::CVector2d& position);
123
124 // reimplemented (iview::CShapeBase)
126
127 // abstract methods
128 virtual void EnsureValidNodes() const = 0;
129 virtual bool IsCurveTouched(istd::CIndex2d position) const = 0;
130
133
134private:
135 bool m_isEditableRotation;
136 bool m_isEditableWidth;
137 bool m_isEditableHeight;
138 bool m_isProportionalScaled;
139
140 mutable i2d::CVector2d m_screenNodes[EN_LAST + 1];
141 mutable bool m_areNodesValid;
142};
143
144
145// inline methods
146
148{
149 return m_isEditableRotation;
150}
151
152
154{
155 m_isEditableRotation = state;
156}
157
158
160{
161 return m_isEditableWidth;
162}
163
164
166{
167 m_isEditableWidth = state;
168}
169
170
172{
173 return m_isEditableHeight;
174}
175
176
178{
179 m_isEditableHeight = state;
180}
181
182
184{
185 return m_isProportionalScaled;
186}
187
188
190{
191 m_isProportionalScaled = state;
192}
193
194
195// protected methods
196
198{
199 return m_areNodesValid;
200}
201
202
203} // namespace iview
204
205
206#endif // !iview_CRectControlledShapeBase_included
207
208
209
This class defines an affine 2D-transformation.
Definition CAffine2d.h:22
Simple rectangle with integer bounds.
Definition CRect.h:26
Definition of position or mathematical vector on 2D plane.
Definition CVector2d.h:29
Index implementation for addressing elements in 2D-space.
Definition CIndex2d.h:25
Base class of shape implementation with user interaction.
virtual void BeginLogDrag(const i2d::CVector2d &reference)
virtual void SetEditableHeight(bool state=true)
virtual bool IsEditableHeight()
Check, if height is editable.
virtual void EnsureValidNodes() const =0
virtual bool OnMouseButton(istd::CIndex2d position, Qt::MouseButton buttonType, bool downFlag)
It is called, when mouse button is pushed down or up on this object.
virtual void SetLogDragPosition(const i2d::CVector2d &position)
i2d::CAffine2d CalcMoveTransform(i2d::CVector2d position, const i2d::CAffine2d &transform)
virtual void SetEditableWidth(bool state=true)
virtual bool IsEditableRotation()
Check, if rotation is editable.
virtual i2d::CRect CalcBoundingBox() const
Calculate bounding box.
void CalcNodes(const i2d::CAffine2d &parallTransform) const
virtual void SetEditableRotation(bool state=true)
virtual void InvalidateBoundingBox()
Invalidate bounding box.
i2d::CAffine2d CalcScaleTransform(const i2d::CVector2d &center, const i2d::CVector2d &isPos, const i2d::CVector2d &shouldPos)
i2d::CAffine2d CalcSizeTransform(const i2d::CVector2d &center, const i2d::CVector2d &isPos, const i2d::CVector2d &shouldPos)
virtual bool IsProportionalScaled() const
Check, if both axis will be scaled proportional.
virtual TouchState IsTouched(istd::CIndex2d position) const
Check, if any shape is touched.
virtual bool IsTickerTouched(istd::CIndex2d position) const
virtual void DrawTickers(QPainter &drawContext) const
i2d::CAffine2d CalcRotatedTransform(const i2d::CVector2d &center, const i2d::CVector2d &isPos, const i2d::CVector2d &shouldPos)
virtual void SetProportionalScaled(bool state=true)
virtual void Draw(QPainter &drawContext) const
Draw this shape using draw context.
virtual bool IsCurveTouched(istd::CIndex2d position) const =0
virtual void DrawFigure(QPainter &drawContext) const
bool IsParallTouched(const i2d::CAffine2d &parallTransform, istd::CIndex2d position) const
virtual bool IsEditableWidth()
Check, if width is editable.
TouchState
Enumeration for possible shape touch states.
Definition ITouchable.h:30
In this library is defined 2D view concept and standard visualisation objects.

© Witold Gantzke and Kirill Lepskiy