2015-09-25 21:37:19 +02:00
|
|
|
// File: fpoint.cpp
|
|
|
|
// Provides: class FPoint
|
2015-05-23 13:35:12 +02:00
|
|
|
|
2017-09-17 21:32:46 +02:00
|
|
|
#include "final/fpoint.h"
|
2015-05-23 13:35:12 +02:00
|
|
|
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
// class FPoint
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
|
|
|
|
FPoint::~FPoint() // destructor
|
2015-09-22 04:18:20 +02:00
|
|
|
{ }
|
2015-05-23 13:35:12 +02:00
|
|
|
|
|
|
|
// public methods of FPoint
|
|
|
|
//----------------------------------------------------------------------
|
2016-11-02 00:37:58 +01:00
|
|
|
FPoint& FPoint::operator = (const FPoint& p)
|
2015-05-23 13:35:12 +02:00
|
|
|
{
|
2016-11-02 00:37:58 +01:00
|
|
|
xpos = p.xpos;
|
|
|
|
ypos = p.ypos;
|
|
|
|
return *this;
|
2015-05-23 13:35:12 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
2016-11-02 00:37:58 +01:00
|
|
|
FPoint& FPoint::operator += (const FPoint& p)
|
2015-05-23 13:35:12 +02:00
|
|
|
{
|
2016-11-02 00:37:58 +01:00
|
|
|
xpos = short(xpos + p.xpos);
|
|
|
|
ypos = short(ypos + p.ypos);
|
|
|
|
return *this;
|
2015-05-23 13:35:12 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
2016-11-02 00:37:58 +01:00
|
|
|
FPoint& FPoint::operator -= (const FPoint& p)
|
2015-05-23 13:35:12 +02:00
|
|
|
{
|
2016-11-02 00:37:58 +01:00
|
|
|
xpos = short(xpos - p.xpos);
|
|
|
|
ypos = short(ypos - p.ypos);
|
|
|
|
return *this;
|
2015-05-23 13:35:12 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
2016-11-02 00:37:58 +01:00
|
|
|
void FPoint::setX (int x)
|
2015-05-23 13:35:12 +02:00
|
|
|
{
|
|
|
|
xpos = short(x);
|
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
2016-11-02 00:37:58 +01:00
|
|
|
void FPoint::setY (int y)
|
2015-05-23 13:35:12 +02:00
|
|
|
{
|
2016-11-02 00:37:58 +01:00
|
|
|
ypos = short(y);
|
2015-05-23 13:35:12 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
2016-11-02 00:37:58 +01:00
|
|
|
void FPoint::setPoint (int x, int y)
|
2015-05-23 13:35:12 +02:00
|
|
|
{
|
2016-11-02 00:37:58 +01:00
|
|
|
xpos = short(x);
|
|
|
|
ypos = short(y);
|
2015-05-23 13:35:12 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
2016-11-02 00:37:58 +01:00
|
|
|
bool FPoint::isNull() const
|
2015-05-23 13:35:12 +02:00
|
|
|
{
|
2016-11-02 00:37:58 +01:00
|
|
|
return xpos == 0 && ypos == 0;
|
2015-05-23 13:35:12 +02:00
|
|
|
}
|