ICF 3.1.1.10
Technical documentation of ICF Libraries
CPosition2d.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#pragma once
7
8
9// ICF includes
10#include <i2d/CObject2dBase.h>
11#include <i2d/CVector2d.h>
12
13
14namespace i2d
15{
16
17
22{
23public:
24 static QByteArray GetTypeName();
25
27 CPosition2d(const CVector2d& center);
28
29 const CVector2d& GetPosition() const;
30 void SetPosition(const CVector2d& position);
31 void Translate(const i2d::CVector2d& vector);
32 CPosition2d GetTranslated(const i2d::CVector2d& vector) const;
33
34 // reimplemented (i2d::IObject2d)
35 CVector2d GetCenter() const override;
36 void MoveCenterTo(const CVector2d& position) override;
37 CRectangle GetBoundingBox() const override;
39 const ITransformation2d& transformation,
41 double* errorFactorPtr = nullptr) override;
43 const ITransformation2d& transformation,
45 double* errorFactorPtr = nullptr) override;
47 const ITransformation2d& transformation,
48 IObject2d& result,
50 double* errorFactorPtr = nullptr) const override;
52 const ITransformation2d& transformation,
53 IObject2d& result,
55 double* errorFactorPtr = nullptr) const override;
56
57 // reimplemented (iser::IObject)
58 QByteArray GetFactoryId() const override;
59
60 // reimplemented (iser::ISerializable)
61 bool Serialize(iser::IArchive& archive) override;
62
63 // reimplemented (istd::IChangeable)
64 int GetSupportedOperations() const override;
65 bool CopyFrom(const IChangeable& object, CompatibilityMode mode = CM_WITHOUT_REFS) override;
66 bool IsEqual(const istd::IChangeable& object) const override;
67 std::unique_ptr<istd::IChangeable> CloneMe(CompatibilityMode mode = CM_WITHOUT_REFS) const override;
68
69protected:
71};
72
73
74// inline methods
75
77{
78 return m_position;
79}
80
81
82inline void CPosition2d::Translate(const i2d::CVector2d& vector)
83{
84 m_position += vector;
85}
86
87
89{
90 CPosition2d translatedPosition = *this;
91
92 translatedPosition.Translate(vector);
93
94 return translatedPosition;
95}
96
97
98} // namespace i2d
99
100
Base class for 2D-objects implementing interface i2d::IObject2d.
Definition of graphical point object.
Definition CPosition2d.h:22
QByteArray GetFactoryId() const override
CPosition2d GetTranslated(const i2d::CVector2d &vector) const
Definition CPosition2d.h:88
void MoveCenterTo(const CVector2d &position) override
Move object to position position.
const CVector2d & GetPosition() const
Definition CPosition2d.h:76
bool InvTransform(const ITransformation2d &transformation, ITransformation2d::ExactnessMode mode=ITransformation2d::EM_NONE, double *errorFactorPtr=nullptr) override
Do inverse transformation of this object.
static QByteArray GetTypeName()
int GetSupportedOperations() const override
Get set of flags for supported operations.
void SetPosition(const CVector2d &position)
bool CopyFrom(const IChangeable &object, CompatibilityMode mode=CM_WITHOUT_REFS) override
std::unique_ptr< istd::IChangeable > CloneMe(CompatibilityMode mode=CM_WITHOUT_REFS) const override
Make a copy of this object.
CVector2d GetCenter() const override
Returns center of this 2D-object.
CRectangle GetBoundingBox() const override
Get bounding box of this shape.
bool Transform(const ITransformation2d &transformation, ITransformation2d::ExactnessMode mode=ITransformation2d::EM_NONE, double *errorFactorPtr=nullptr) override
Transform this object using some transformation.
bool Serialize(iser::IArchive &archive) override
Load or store state of this object as a archive stream.
bool IsEqual(const istd::IChangeable &object) const override
Compare this object with another object.
CVector2d m_position
Definition CPosition2d.h:70
bool GetTransformed(const ITransformation2d &transformation, IObject2d &result, ITransformation2d::ExactnessMode mode=ITransformation2d::EM_NONE, double *errorFactorPtr=nullptr) const override
Calulate transformation of the object into second one.
void Translate(const i2d::CVector2d &vector)
Definition CPosition2d.h:82
CPosition2d(const CVector2d &center)
bool GetInvTransformed(const ITransformation2d &transformation, IObject2d &result, ITransformation2d::ExactnessMode mode=ITransformation2d::EM_NONE, double *errorFactorPtr=nullptr) const override
Calulate inverse transformation of the object into second one.
Definition of rectangle area orthogonal to axis of coordination system.
Definition CRectangle.h:31
Definition of position or mathematical vector on 2D plane.
Definition CVector2d.h:29
Common interface for describing the 2D-objects.
Definition IObject2d.h:30
Common interface for all calibration objects.
@ EM_NONE
There are no preferences, should be automatically selected.
Represent input/output persistence archive.
Definition IArchive.h:34
Common interface for data model objects, which can be changed.
Definition IChangeable.h:32
CompatibilityMode
Control how relationship betweeen objects are interpreted.
@ CM_WITHOUT_REFS
External references are simple ignored.
Contains the 2D objects.
Definition CAffine2d.h:15

© Witold Gantzke and Kirill Lepskiy