ACF $AcfVersion:0$
CAffineTransformation2dShape.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
8
9
10namespace iview
11{
12
13
18{
19public:
30
32
37
38 // reimplemented (iview::IVisualizable)
39 virtual void Draw(QPainter& drawContext) const override;
40
41 // reimplemented (imod::IObserver)
42 virtual bool OnModelAttached(imod::IModel* modelPtr, istd::IChangeable::ChangeSet& changeMask) override;
43
44 // reimplemented (iview::ITouchable)
45 virtual TouchState IsTouched(istd::CIndex2d position) const override;
46
47protected:
48 enum{
51 };
53
66 void GetScreenPoints(const ControlPoints& points, ControlPoints& result) const;
67 static void GetTransformedPoints(const ControlPoints& points, ControlPoints& result, const i2d::CAffineTransformation2d& transformation);
68
69 // reimplemented (iview::CShapeBase)
70 virtual i2d::CRect CalcBoundingBox() const override;
71
72 // reimplemented (iview::CInteractiveShapeBase)
73 virtual void BeginLogDrag(const i2d::CVector2d& reference) override;
74 virtual void SetLogDragPosition(const i2d::CVector2d& position) override;
75
76private:
77 i2d::CVector2d m_referencePosition;
78 int m_activeControlPoints;
79
80 ControlPoint m_currentPoint;
81};
82
83
84} // namespace iview
85
86
87
88
Definition of an affine transformation for 2D-spaces.
Simple rectangle with integer bounds.
Definition CRect.h:22
Definition of position or mathematical vector on 2D plane.
Definition CVector2d.h:29
Common interface for model objects, that supports Model/Observer design pattern.
Definition IModel.h:25
Index implementation for addressing elements in 2D-space.
Definition CIndex2d.h:21
Set of change flags (its IDs).
Definition IChangeable.h:36
Interactive shape to visualize i2d::CAffineTransformation2d.
virtual void Draw(QPainter &drawContext) const override
Draw this shape using draw context.
virtual void BeginLogDrag(const i2d::CVector2d &reference) override
virtual void SetLogDragPosition(const i2d::CVector2d &position) override
i2d::CVector2d ControlPoints[CONTROL_POINTS_COUNT]
virtual bool OnModelAttached(imod::IModel *modelPtr, istd::IChangeable::ChangeSet &changeMask) override
Callback invoked when an observable model is about to be attached to this observer.
static const ControlPoints & GetControlPoints()
Generate transformed points using given transformation.
static void GetTransformedPoints(const ControlPoints &points, ControlPoints &result, const i2d::CAffineTransformation2d &transformation)
void SetActiveControlPoints(ControlPoint points=ALL_POINTS)
Set control points that can be moved by the user (OR'ed ControlPoints).
void GetScreenPoints(const ControlPoints &points, ControlPoints &result) const
Transform control points from logical to screen coordinates.
virtual i2d::CRect CalcBoundingBox() const override
Calculate bounding box.
virtual TouchState IsTouched(istd::CIndex2d position) const override
Check, if any shape is touched.
TouchState
Enumeration for possible shape touch states.
Definition ITouchable.h:25
In this library is defined 2D view concept and standard visualisation objects.