NeTrainSim 0.1.1 beta
The Open-Source Network Trains Simulator
 
Loading...
Searching...
No Matches
netnode.h
Go to the documentation of this file.
1
18#ifndef NeTrainSim_NetNode_h
19#define NeTrainSim_NetNode_h
20
21#include <string>
22#include <iostream>
23#include "../util/vector.h"
24#include "../util/map.h"
25
26class NetSignal; // Forward declaration of NetSignal class
27class NetLink; // Forward declaration of NetLink class
28
29using namespace std;
30
35class NetNode {
36private:
37 static unsigned int NumberOfNodesInSimulator;
39public:
40 int id = -1;
41 int userID;
42 double x;
43 double y;
44 std::string alphaDesc;
45 double xScale;
46 double yScale;
48 bool isDepot;
53 // Graph search variables
56 std::shared_ptr<NetNode> graphSearchPreviousNode;
68 NetNode(int simulatorID, int userID, double xCoord, double yCoord, string Desc, double xScale, double yScale);
69
73 ~NetNode();
74
79 void setNodeSimulatorID(int newID);
80
86
92
97 static unsigned int getNumberOfNodesInSimulator();
98
103 void addSignal(std::shared_ptr<NetSignal> networkSignal);
104
109 void updateXScale(const double& newScale);
110
115 void updateYScale(const double& newScale);
116
121 pair<double, double> coordinates();
122
123 // Other methods and friend function declarations...
124};
125
132ostream& operator<<(ostream& ostr, const NetNode& node);
133
134#endif // NeTrainSim_NetNode_h
A map.
Definition map.h:26
The NetNode class represents a network node in a simulation.
Definition netnode.h:35
Vector< std::shared_ptr< NetNode > > getNeighbors()
Gets the neighbors of the node.
Definition netnode.cpp:40
void setNodeSimulatorID(int newID)
Sets the simulator identifier of the node.
Definition netnode.cpp:36
void updateYScale(const double &newScale)
Updates the y-coordinate scale of the node.
Definition netnode.cpp:65
double y
The y-coordinate of the node.
Definition netnode.h:43
int userID
The user identifier of the node.
Definition netnode.h:41
double dwellTimeIfDepot
The dwell time at the depot.
Definition netnode.h:49
void addSignal(std::shared_ptr< NetSignal > networkSignal)
Adds a network signal to the node.
Definition netnode.cpp:55
std::string alphaDesc
The description of the node.
Definition netnode.h:44
double xScale
The x-value scale of the node.
Definition netnode.h:45
double graphSearchDistanceFromStart
The graph search distance from the start node.
Definition netnode.h:54
double yScale
The y-value scale of the node.
Definition netnode.h:46
Vector< std::shared_ptr< NetSignal > > networkSignals
The network signals associated with the node.
Definition netnode.h:47
void updateXScale(const double &newScale)
Updates the x-coordinate scale of the node.
Definition netnode.cpp:59
bool isDepot
Indicates whether the node is a stopping station or depot for all trains.
Definition netnode.h:48
double x
The x-coordinate of the node.
Definition netnode.h:42
bool refillTanksAndBatteries
Indicates whether trains refill tanks and batteries when passing through this node.
Definition netnode.h:50
Map< std::shared_ptr< NetNode >, Vector< std::shared_ptr< NetLink > > > linkTo
The neighbor nodes and their link connections.
Definition netnode.h:51
void clearGraphSearchParams()
Clears the graph search parameters.
Definition netnode.cpp:44
bool graphSearchVisited
Indicates whether the node has been visited in graph search.
Definition netnode.h:55
~NetNode()
Destructor.
Definition netnode.cpp:32
std::shared_ptr< NetNode > graphSearchPreviousNode
The previous node in the path during graph search.
Definition netnode.h:56
pair< double, double > coordinates()
Gets the coordinates of the node.
Definition netnode.cpp:71
static unsigned int getNumberOfNodesInSimulator()
Gets the number of nodes in the simulator.
Definition netnode.cpp:50
The NetSignal class represents a network signal in a simulation.
Definition netsignal.h:35
A vector.
Definition vector.h:24
ostream & operator<<(ostream &ostr, const NetNode &node)
Overloaded ostream operator for printing the NetNode object.
Definition netnode.cpp:75