ACF $AcfVersion:0$
CRectControlledShapeBase.h
Go to the documentation of this file.
1// SPDX-License-Identifier: LGPL-2.1-or-later OR GPL-2.0-or-later OR GPL-3.0-or-later OR LicenseRef-ACF-Commercial
2#pragma once
3
4
5// ACF includes
7
8
9namespace iview
10{
11
12
14{
15public:
18
20
24 virtual bool IsEditableRotation();
25 virtual void SetEditableRotation(bool state = true);
26
30 virtual bool IsEditableWidth();
31 virtual void SetEditableWidth(bool state = true);
32
36 virtual bool IsEditableHeight();
37 virtual void SetEditableHeight(bool state = true);
38
42 virtual bool IsProportionalScaled() const;
43 virtual void SetProportionalScaled(bool state = true);
44
45 // reimplemented (iview::CInteractiveShapeBase)
46 virtual void InvalidateBoundingBox() override;
47
48 // reimplemented (iview::IInteractiveShape)
49 virtual TouchState IsTouched(istd::CIndex2d position) const override;
50
51 // reimplemented (iview::IShape)
52 virtual void Draw(QPainter& drawContext) const override;
53
54 // reimplemented (iview::IMouseActionObserver)
55 virtual bool OnMouseButton(istd::CIndex2d position, Qt::MouseButton buttonType, bool downFlag) override;
56
57protected:
73
88
89 void CalcNodes(const i2d::CAffine2d& parallTransform) const;
90 void ResetNodes() const;
91 bool AreNodesValid() const;
92
94
95 virtual bool IsTickerTouched(istd::CIndex2d position) const;
96 virtual void DrawTickers(QPainter& drawContext) const;
97 virtual void DrawFigure(QPainter& drawContext) const;
98
100 const i2d::CAffine2d& parallTransform,
101 istd::CIndex2d position) const;
103 const i2d::CVector2d& center,
104 const i2d::CVector2d& isPos,
105 const i2d::CVector2d& shouldPos);
107 const i2d::CVector2d& center,
108 const i2d::CVector2d& isPos,
109 const i2d::CVector2d& shouldPos);
111 const i2d::CVector2d& center,
112 const i2d::CVector2d& isPos,
113 const i2d::CVector2d& shouldPos);
114
115 // reimplemented (iview::CInteractiveShapeBase)
116 virtual void BeginLogDrag(const i2d::CVector2d& reference) override;
117 virtual void SetLogDragPosition(const i2d::CVector2d& position) override;
118
119 // reimplemented (iview::CShapeBase)
120 virtual i2d::CRect CalcBoundingBox() const override;
121
122 // abstract methods
123 virtual void EnsureValidNodes() const = 0;
124 virtual bool IsCurveTouched(istd::CIndex2d position) const = 0;
125
128
129private:
130 bool m_isEditableRotation;
131 bool m_isEditableWidth;
132 bool m_isEditableHeight;
133 bool m_isProportionalScaled;
134
135 mutable i2d::CVector2d m_screenNodes[EN_LAST + 1];
136 mutable bool m_areNodesValid;
137};
138
139
140// inline methods
141
143{
144 return m_isEditableRotation;
145}
146
147
149{
150 m_isEditableRotation = state;
151}
152
153
155{
156 return m_isEditableWidth;
157}
158
159
161{
162 m_isEditableWidth = state;
163}
164
165
167{
168 return m_isEditableHeight;
169}
170
171
173{
174 m_isEditableHeight = state;
175}
176
177
179{
180 return m_isProportionalScaled;
181}
182
183
185{
186 m_isProportionalScaled = state;
187}
188
189
190// protected methods
191
193{
194 return m_areNodesValid;
195}
196
197
198} // namespace iview
199
200
201
202
203
This class defines an affine 2D-transformation.
Definition CAffine2d.h:18
Simple rectangle with integer bounds.
Definition CRect.h:22
Definition of position or mathematical vector on 2D plane.
Definition CVector2d.h:29
Index implementation for addressing elements in 2D-space.
Definition CIndex2d.h:21
virtual void SetEditableHeight(bool state=true)
virtual void BeginLogDrag(const i2d::CVector2d &reference) override
virtual bool IsEditableHeight()
Check, if height is editable.
virtual void EnsureValidNodes() const =0
virtual i2d::CRect CalcBoundingBox() const override
Calculate bounding box.
virtual void InvalidateBoundingBox() override
Invalidate bounding box.
virtual TouchState IsTouched(istd::CIndex2d position) const override
Check, if any shape is touched.
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 bool OnMouseButton(istd::CIndex2d position, Qt::MouseButton buttonType, bool downFlag) override
It is called, when mouse button is pushed down or up on this object.
void CalcNodes(const i2d::CAffine2d &parallTransform) const
virtual void SetEditableRotation(bool state=true)
virtual void SetLogDragPosition(const i2d::CVector2d &position) override
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 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 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.
virtual void Draw(QPainter &drawContext) const override
Draw this shape using draw context.
TouchState
Enumeration for possible shape touch states.
Definition ITouchable.h:25
In this library is defined 2D view concept and standard visualisation objects.