BPoint.h
Go to the documentation of this file.
1 /*--------------------------------------------------------------------------------------+
2 |
3 | Supplied under applicable software license agreement.
4 |
6 |
7 +---------------------------------------------------------------------------------------*/
8 #pragma once
9
10 #include <UI\UIFramework.h>
11 #include <UI\Core\MathUtils.h>
13
15
16 //=======================================================================================
33 //=======================================================================================
34 class DLLEXPORT BPoint : public Point2d
35  {
36  public:
38  BPoint ();
40  BPoint (int xpos, int ypos);
41
43  bool IsNull () const;
44
46  int X () const;
48  int Y () const;
50  void SetX (int x);
52  void SetY (int y);
53
55  BPoint &operator += (const BPoint &p);
57  BPoint &operator -= (const BPoint &p);
59  BPoint &operator *= (double c);
61  BPoint &operator /= (double c);
62
64  friend bool operator == (const BPoint &, const BPoint &);
66  friend bool operator != (const BPoint &, const BPoint &);
67
69  friend const BPoint operator + (const BPoint &, const BPoint &);
71  friend const BPoint operator - (const BPoint &, const BPoint &);
73  friend const BPoint operator * (const BPoint &, double);
75  friend const BPoint operator * (double, const BPoint &);
77  friend const BPoint operator - (const BPoint &);
79  friend const BPoint operator / (const BPoint &, double);
80  };
81
82
83 /*****************************************************************************
84  BPoint inline friend operators
85  *****************************************************************************/
86
88 inline bool operator == (const BPoint &p1, const BPoint &p2)
89  {
90  return p1.X () == p2.X () && p1.Y () == p2.Y ();
91  }
92
94 inline bool operator != (const BPoint &p1, const BPoint &p2)
95  {
96  return p1.X () != p2.X () || p1.Y () != p2.Y ();
97  }
98
100 inline const BPoint operator + (const BPoint &p1, const BPoint &p2)
101  {
102  return BPoint (p1.X () + p2.X (), p1.Y () + p2.Y ());
103  }
104
106 inline const BPoint operator - (const BPoint &p1, const BPoint &p2)
107  {
108  return BPoint (p1.X () - p2.X (), p1.Y () - p2.Y ());
109  }
110
112 inline const BPoint operator * (const BPoint &p, double c)
113  {
114  return BPoint (Round (p.X ()*c), Round (p.Y ()*c));
115  }
116
118 inline const BPoint operator * (double c, const BPoint &p)
119  {
120  return BPoint (Round (p.X ()*c), Round (p.Y ()*c));
121  }
122
124 inline const BPoint operator - (const BPoint &p)
125  {
126  return BPoint (-p.X (), -p.Y ());
127  }
128
130 inline const BPoint operator / (const BPoint &p, double c)
131  {
132  return BPoint (Round (p.X () / c), Round (p.Y () / c));
133  }
134
135
bool operator!=(const BPoint &p1, const BPoint &p2)
Operator overload for BPoint != (not equal test).
Definition: BPoint.h:94
void operator+=(DPoint3d &point, DVec3d const &vector)
const BPoint operator*(const BPoint &p, double c)
Operator overload for BPoint * (multiply with a double).
Definition: BPoint.h:112
An integer 2d point, useful for screen pixel references, but not for real geometry: Point...
const BPoint operator-(const BPoint &p1, const BPoint &p2)
Operator overload for BPoint - (subtract).
Definition: BPoint.h:106
const BPoint operator+(const BPoint &p1, const BPoint &p2)
Definition: BPoint.h:100
The BPoint class defines a point in the plane using integer precision.
Definition: BPoint.h:34
#define BEGIN_BENTLEY_UIFRAMEWORK_NAMESPACE
Definition: UIFramework.h:14
void operator*=(DVec3d &vector, double const scalar)
operator overload for in-place multiplication of a vector times a scalar,
#define DLLEXPORT
Definition: basedefs.h:137
int X() const
Retrieves the X value.
void operator-=(DPoint3d &point, DVec3d const &vector)
operator overload for in-place subtraction of a point minus a vector
const BPoint operator/(const BPoint &p, double c)
Operator overload for BPoint / (divide).
Definition: BPoint.h:130
#define END_BENTLEY_UIFRAMEWORK_NAMESPACE
Definition: UIFramework.h:15
int Y() const
Retrieves the Y value.
bool operator==(const BPoint &p1, const BPoint &p2)
Operator overload for BPoint == (equality test).
Definition: BPoint.h:88