ACF $AcfVersion:0$
CParallelogram.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
6// Qt includes
7#include <QtCore/QVector>
8
9// ACF includes
10#include <iser/CArchiveTag.h>
11#include <i2d/CObject2dBase.h>
12#include <i2d/CAffine2d.h>
13#include <i2d/CRectangle.h>
14
15
16namespace i2d
17{
18
19
27{
28public:
30
31 virtual const i2d::CAffine2d& GetTransform() const;
32 virtual void SetTransform(const i2d::CAffine2d& transform);
33 virtual const i2d::CMatrix2d& GetDeformMatrix() const;
34 virtual void SetDeformMatrix(const i2d::CMatrix2d& deform);
35
36 double GetWidth() const;
37 void SetWidth(double w);
38 double GetHeight() const;
39 void SetHeight(double h);
40 QVector<i2d::CVector2d> GetNodes() const;
41 double GetRotation() const;
42 void SetRotation(double angle);
44 void SetTranslation(const i2d::CVector2d& translation);
45
46 // reimplemented (i2d::IObject2d)
47 virtual i2d::CVector2d GetCenter() const override;
48 virtual void MoveCenterTo(const i2d::CVector2d& position) override;
49 virtual i2d::CRectangle GetBoundingBox() const override;
50 virtual bool Transform(
51 const i2d::ITransformation2d& transformation,
53 double* errorFactorPtr = NULL) override;
54 virtual bool InvTransform(
55 const i2d::ITransformation2d& transformation,
57 double* errorFactorPtr = NULL) override;
58 virtual bool GetTransformed(
59 const i2d::ITransformation2d& transformation,
60 i2d::IObject2d& result,
62 double* errorFactorPtr = NULL) const override;
63 virtual bool GetInvTransformed(
64 const i2d::ITransformation2d& transformation,
65 i2d::IObject2d& result,
67 double* errorFactorPtr = NULL) const override;
68
69 // reimplemented (istd::IChangeable)
70 virtual int GetSupportedOperations() const override;
71 virtual bool CopyFrom(const IChangeable& object, CompatibilityMode mode = CM_WITHOUT_REFS) override;
73
74 // reimplemented (iser::ISerializable)
75 virtual bool Serialize(iser::IArchive& archive) override;
76
77protected:
78 virtual i2d::CVector2d GetCenter(const i2d::CMatrix2d& deformMatrix) const;
79
80private:
81 i2d::CAffine2d m_transform;
82};
83
84
85// inline methods
86
88{
89 return m_transform;
90}
91
92
94{
95 return m_transform.GetDeformMatrix();
96}
97
98
100{
101 m_transform.SetDeformMatrix(deform);
102}
103
104
105} // namespace i2d
106
107
108
109
This class defines an affine 2D-transformation.
Definition CAffine2d.h:18
void SetDeformMatrix(const CMatrix2d &deform)
Set rotation, skew and scale part of this affine transformation.
Definition CAffine2d.h:246
const CMatrix2d & GetDeformMatrix() const
Get rotation, skew and scale part of this affine transformation.
Definition CAffine2d.h:240
2D matrix.
Definition CMatrix2d.h:19
Base class for 2D-objects implementing interface i2d::IObject2d.
This class defines parallelogram.
virtual int GetSupportedOperations() const override
Get set of flags for supported operations.
virtual i2d::CVector2d GetCenter(const i2d::CMatrix2d &deformMatrix) const
virtual void SetTransform(const i2d::CAffine2d &transform)
i2d::CVector2d GetTranslation() const
void SetHeight(double h)
void SetWidth(double w)
virtual const i2d::CAffine2d & GetTransform() const
virtual bool GetInvTransformed(const i2d::ITransformation2d &transformation, i2d::IObject2d &result, i2d::ITransformation2d::ExactnessMode mode=i2d::ITransformation2d::EM_NONE, double *errorFactorPtr=NULL) const override
Calulate inverse transformation of the object into second one.
virtual i2d::CRectangle GetBoundingBox() const override
Get bounding box of this shape.
double GetHeight() const
virtual i2d::CVector2d GetCenter() const override
Returns center of this 2D-object.
virtual bool CopyFrom(const IChangeable &object, CompatibilityMode mode=CM_WITHOUT_REFS) override
QVector< i2d::CVector2d > GetNodes() const
void SetRotation(double angle)
virtual const i2d::CMatrix2d & GetDeformMatrix() const
virtual bool Transform(const i2d::ITransformation2d &transformation, i2d::ITransformation2d::ExactnessMode mode=i2d::ITransformation2d::EM_NONE, double *errorFactorPtr=NULL) override
Transform this object using some transformation.
virtual bool InvTransform(const i2d::ITransformation2d &transformation, i2d::ITransformation2d::ExactnessMode mode=i2d::ITransformation2d::EM_NONE, double *errorFactorPtr=NULL) override
Do inverse transformation of this object.
virtual bool GetTransformed(const i2d::ITransformation2d &transformation, i2d::IObject2d &result, i2d::ITransformation2d::ExactnessMode mode=i2d::ITransformation2d::EM_NONE, double *errorFactorPtr=NULL) const override
Calulate transformation of the object into second one.
virtual void SetDeformMatrix(const i2d::CMatrix2d &deform)
virtual void MoveCenterTo(const i2d::CVector2d &position) override
Move object to position position.
double GetRotation() const
virtual bool Serialize(iser::IArchive &archive) override
Load or store state of this object as a archive stream.
void SetTranslation(const i2d::CVector2d &translation)
virtual istd::TUniqueInterfacePtr< istd::IChangeable > CloneMe(CompatibilityMode mode=CM_WITHOUT_REFS) const override
Make a copy of this object.
double GetWidth() const
Definition of rectangle area orthogonal to axis of coordination system.
Definition CRectangle.h:27
Definition of position or mathematical vector on 2D plane.
Definition CVector2d.h:29
Common interface for describing the 2D-objects.
Definition IObject2d.h:26
Common interface for all calibration objects.
@ EM_NONE
There are no preferences, should be automatically selected.
Represents an input/output persistence archive for object serialization.
Definition IArchive.h:164
CompatibilityMode
Control how relationship betweeen objects are interpreted.
@ CM_WITHOUT_REFS
External references are simple ignored.
Unique ownership smart pointer for interface types.
#define NULL
Definition istd.h:74
Contains the 2D objects.
Definition CAffine2d.h:11