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

© 2007-2017 Witold Gantzke and Kirill Lepskiy