-
Notifications
You must be signed in to change notification settings - Fork 0
/
Point.cpp
executable file
·111 lines (91 loc) · 2.23 KB
/
Point.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
/*
* File: Points.cpp
* Author: greg
*
* Created on January 14, 2012, 3:03 PM
*/
#include <sstream>
#include "Point.h"
#include "Color.h"
/*! Default constructor
* \param Column An integer representing the column in which the point exists
* \param Row An integer representing the row in which the point exists
* \param x The X coordinates of the point
* \param y The Y coordinates of the point
*
* This is the default constructor of the point object.
*/
Point::Point(int column_, int row_, int x_, int y_) {
//x(WIDTH-x-15), y(y-21), column(Column), row(Row
if (SHIFTY_SCREEN == 1) {
x = WIDTH - x_ - 15;
} else {
x = WIDTH - x_;
}
y = y_;
column = column_;
row = row_;
// /WIDTH-QPoint::y()-10;
//For testing purpose
//printf(" Added point: %x, %x, %x, %x", this->column, this->row, this->x(), this->y());
//std::cout<<"Added point: "<<this->x()<<" "<<this->y()<<std::endl;
}
Point::Point(int x_, int y_) {
x = x_;
y = y_;
column = 0;
row = 0;
}
/*! Copy constructor
* \param orig A reference to the original point that needs to be copied
*
* This is a copy constructor. It takes an Point object and creates an exact copy of it
*/
Point::Point(const Point& orig) : x(orig.x), y(orig.y), column(orig.column), row(orig.row) //orig.x(), orig.y()
{
}
/*! Constructor
*
* This constructor is needed because ??????????????????????????
*/
Point::Point() : x(0), y(0), column(0), row(0) {
}
/*! Default destructor
*
* This is the default destructor. The object does not use any pointer and therefore the destructor is empty for now.
*/
Point::~Point() {
}
//Getters
/*! Get column
*
* \return <i>Column</i> - An integer representing the column in which the point exists
*/
int Point::getColumn() const {
return column;
}
/*! Get row
*
* \returns <i>Row</i> - An integer representing the row n which the point exists
*/
int Point::getRow() const {
return row;
}
int Point::getX() {
return x;
}
int Point::getY() {
return y;
}
void Point::setX(int x_) {
x = x_;
}
void Point::setY(int y_) {
y = y_;
}
void Point::adjustForSaving() {
//819, 1092
//768, 1024
x = ((x - 33)*819 / WIDTH);
y = ((y - 33)*1092 / HEIGHT);
}