CCircle.h
Go to the documentation of this file.
1 #ifndef i2d_CCircle_included
2 #define i2d_CCircle_included
3 
4 
5 #include <i2d/CPosition2d.h>
6 #include <i2d/CLine2d.h>
7 
8 
9 namespace i2d
10 {
11 
12 
13 class CRectangle;
14 class CPolygon;
15 
16 
21 class CCircle: public CPosition2d
22 {
23 public:
25 
26  static QByteArray GetTypeName();
27 
28  CCircle();
29  CCircle(double radius, const CVector2d& center);
30 
31  double GetRadius() const;
32  void SetRadius(double radius);
33 
34  bool operator==(const CCircle& circle) const;
35  bool operator!=(const CCircle& circle) const;
36 
41  virtual bool ConvertToPolygon(i2d::CPolygon& result, int segmentsCount = 0) const;
42 
48  bool IsIntersectedBy(const CCircle& circle, bool isFilled = false) const;
49 
55  bool IsIntersectedBy(const CLine2d& line, bool isFilled = false) const;
56 
65  int GetIntersectionAlphas(const CLine2d& line, double result[2]) const;
66 
74  int GetIntersectionPoints(const CLine2d& line, i2d::CVector2d& result1, i2d::CVector2d& result2) const;
75 
76  // reimplemented (i2d::IObject2d)
77  virtual CRectangle GetBoundingBox() const;
78  virtual bool Transform(
79  const ITransformation2d& transformation,
81  double* errorFactorPtr = NULL);
82  virtual bool InvTransform(
83  const ITransformation2d& transformation,
85  double* errorFactorPtr = NULL);
86  virtual bool GetTransformed(
87  const ITransformation2d& transformation,
88  IObject2d& result,
90  double* errorFactorPtr = NULL) const;
91  virtual bool GetInvTransformed(
92  const ITransformation2d& transformation,
93  IObject2d& result,
95  double* errorFactorPtr = NULL) const;
96 
97  // reimplemented (iser::IObject)
98  virtual QByteArray GetFactoryId() const;
99 
100  // reimplemented istd::IChangeable
101  virtual int GetSupportedOperations() const;
102  virtual bool CopyFrom(const IChangeable& object, CompatibilityMode mode = CM_WITHOUT_REFS);
104 
105  // reimplemented (iser::ISerializable)
106  virtual bool Serialize(iser::IArchive& archive);
107 
108 protected:
109  double m_radius;
110 };
111 
112 
113 // inline methods
114 
115 inline double CCircle::GetRadius() const
116 {
117  return m_radius;
118 }
119 
120 
121 } // namespace i2d
122 
123 
124 #endif // !i2d_CCircle_included
125 
126 
static QByteArray GetTypeName()
Definition of the data model for a polygon.
Definition: CPolygon.h:16
bool operator==(const CCircle &circle) const
int GetIntersectionAlphas(const CLine2d &line, double result[2]) const
Get points of intersection circle by line.
External references are simple ignored.
Definition: IChangeable.h:197
double GetRadius() const
Definition: CCircle.h:115
CompatibilityMode
Control how relationship betweeen objects are interpreted.
Definition: IChangeable.h:186
virtual QByteArray GetFactoryId() const
Definition of a line in 2D-space.
Definition: CLine2d.h:24
virtual CRectangle GetBoundingBox() const
Get bounding box of this shape.
Common interface for all calibration objects.
virtual bool ConvertToPolygon(i2d::CPolygon &result, int segmentsCount=0) const
Performs conversion of the circle splitting it to segmentsCount segments to the polygon result...
virtual int GetSupportedOperations() const
Get set of flags for supported operations.
There are no preferences, should be automatically selected.
virtual bool CopyFrom(const IChangeable &object, CompatibilityMode mode=CM_WITHOUT_REFS)
Represent input/output persistence archive.
Definition: IArchive.h:30
Common interface for data model objects, which can be changed.
Definition: IChangeable.h:24
void SetRadius(double radius)
Definition of rectangle area orthogonal to axis of coordination system.
Definition: CRectangle.h:26
virtual bool Serialize(iser::IArchive &archive)
Load or store state of this object as a archive stream.
Definition of position or mathematical vector on 2D plane.
Definition: CVector2d.h:28
virtual bool InvTransform(const ITransformation2d &transformation, ITransformation2d::ExactnessMode mode=ITransformation2d::EM_NONE, double *errorFactorPtr=NULL)
Do inverse transformation of this object.
CPosition2d BaseClass
Definition: CCircle.h:24
bool operator!=(const CCircle &circle) const
Definition of graphical circle object.
Definition: CCircle.h:21
#define NULL
Definition: istd.h:64
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 istd::IChangeable * CloneMe(CompatibilityMode mode=CM_WITHOUT_REFS) const
Make a copy of this object.
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.
Common interface for describing the 2D-objects.
Definition: IObject2d.h:22
virtual bool Transform(const ITransformation2d &transformation, ITransformation2d::ExactnessMode mode=ITransformation2d::EM_NONE, double *errorFactorPtr=NULL)
Transform this object using some transformation.
int GetIntersectionPoints(const CLine2d &line, i2d::CVector2d &result1, i2d::CVector2d &result2) const
Get points of intersection circle by line.
double m_radius
Definition: CCircle.h:109
Definition of graphical point object.
Definition: CPosition2d.h:17
bool IsIntersectedBy(const CCircle &circle, bool isFilled=false) const
Check if this circle is intersected by another circle (or disk).

© 2007-2017 Witold Gantzke and Kirill Lepskiy