-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnode.cpp
75 lines (58 loc) · 1.11 KB
/
node.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
/*node.cpp*/
//
// A node / position in the Open Street Map.
//
#include "node.h"
using namespace std;
//
// constructor
//
Node::Node(long long id, double lat, double lon, bool entrance)
: ID(id), Lat(lat), Lon(lon), IsEntrance(entrance)
{
//
// the proper technique is to use member initialization list above,
// in the same order as the data members are declared:
//
//this->ID = id;
//this->Lat = lat;
//this->Lon = lon;
//this->IsEntrance = entrance;
Node::Created++;
}
//
// copy constructor:
//
Node::Node(const Node& other)
{
this->ID = other.ID;
this->Lat = other.Lat;
this->Lon = other.Lon;
this->IsEntrance = other.IsEntrance;
Node::Copied++;
}
//
// accessors / getters
//
long long Node::getID() const {
Node::CallsToGetID++;
return this->ID;
}
double Node::getLat() const {
return this->Lat;
}
double Node::getLon() const {
return this->Lon;
}
bool Node::getIsEntrance() const {
return this->IsEntrance;
}
int Node::getCallsToGetID() {
return Node::CallsToGetID;
}
int Node::getCreated() {
return Node::Created;
}
int Node::getCopied() {
return Node::Copied;
}