CAffineTransformation2dShape.h
Go to the documentation of this file.
1 #ifndef iview_CAffineTransformation2dShape_included
2 #define iview_CAffineTransformation2dShape_included
3 
4 
5 // ACF includes
8 
9 
10 namespace iview
11 {
12 
13 
18 {
19 public:
21  {
22  NO_POINT = 0,
23  POINT1 = 1,
24  POINT2 = 2,
25  POINT3 = 4,
26  POINT4 = 8,
27  POINT5 = 16,
29  };
30 
32 
37 
38  // reimplemented (iview::IVisualizable)
39  virtual void Draw(QPainter& drawContext) const;
40 
41  // reimplemented (imod::IObserver)
42  virtual bool OnModelAttached(imod::IModel* modelPtr, istd::IChangeable::ChangeSet& changeMask);
43 
44  // reimplemented (iview::ITouchable)
45  virtual TouchState IsTouched(istd::CIndex2d position) const;
46 
47 protected:
48  enum{
51  };
53 
60  static const ControlPoints& GetControlPoints();
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;
71 
72  // reimplemented (iview::CInteractiveShapeBase)
73  virtual void BeginLogDrag(const i2d::CVector2d& reference);
74  virtual void SetLogDragPosition(const i2d::CVector2d& position);
75 
76 private:
77  i2d::CVector2d m_referencePosition;
78  int m_activeControlPoints;
79 
80  ControlPoint m_currentPoint;
81 };
82 
83 
84 } // namespace iview
85 
86 
87 #endif // !iview_CAffineTransformation2dShape_included
88 
89 
virtual i2d::CRect CalcBoundingBox() const
Calculate bounding box.
virtual TouchState IsTouched(istd::CIndex2d position) const
Check, if any shape is touched.
virtual bool OnModelAttached(imod::IModel *modelPtr, istd::IChangeable::ChangeSet &changeMask)
This call back function will be called, if an observable object is about to be attached.
Simple rectangle with integer bounds.
Definition: CRect.h:21
Index implementation for addressing elements in 2D-space.
Definition: CIndex2d.h:20
static const ControlPoints & GetControlPoints()
Generate transformed points using given transformation.
virtual void Draw(QPainter &drawContext) const
Draw this shape using draw context.
void SetActiveControlPoints(ControlPoint points=ALL_POINTS)
Set control points that can be moved by the user (OR'ed ControlPoints).
Definition of position or mathematical vector on 2D plane.
Definition: CVector2d.h:28
virtual void BeginLogDrag(const i2d::CVector2d &reference)
void GetScreenPoints(const ControlPoints &points, ControlPoints &result) const
Transform control points from logical to screen coordinates.
TouchState
Enumeration for possible shape touch states.
Definition: ITouchable.h:24
virtual void SetLogDragPosition(const i2d::CVector2d &position)
Common interface for model objects, that supports Model/Observer design pattern.
Definition: IModel.h:23
Set of change flags (its IDs).
Definition: IChangeable.h:30
i2d::CVector2d ControlPoints[CONTROL_POINTS_COUNT]
Interactive shape to visualize i2d::CAffineTransformation2d.
static void GetTransformedPoints(const ControlPoints &points, ControlPoints &result, const i2d::CAffineTransformation2d &transformation)
Definition of an affine transformation for 2D-spaces.

© 2007-2017 Witold Gantzke and Kirill Lepskiy