NeTrainSim 0.1.1 beta
The Open-Source Network Trains Simulator
 
Loading...
Searching...
No Matches
NetNode Class Reference

The NetNode class represents a network node in a simulation. More...

#include <netnode.h>

Public Member Functions

 NetNode (int simulatorID, int userID, double xCoord, double yCoord, string Desc, double xScale, double yScale)
 Constructor.
 
 ~NetNode ()
 Destructor.
 
void setNodeSimulatorID (int newID)
 Sets the simulator identifier of the node.
 
Vector< std::shared_ptr< NetNode > > getNeighbors ()
 Gets the neighbors of the node.
 
void clearGraphSearchParams ()
 Clears the graph search parameters.
 
void addSignal (std::shared_ptr< NetSignal > networkSignal)
 Adds a network signal to the node.
 
void updateXScale (const double &newScale)
 Updates the x-coordinate scale of the node.
 
void updateYScale (const double &newScale)
 Updates the y-coordinate scale of the node.
 
pair< double, double > coordinates ()
 Gets the coordinates of the node.
 

Static Public Member Functions

static unsigned int getNumberOfNodesInSimulator ()
 Gets the number of nodes in the simulator.
 

Public Attributes

int id = -1
 The identifier of the node.
 
int userID
 The user identifier of the node.
 
double x
 The x-coordinate of the node.
 
double y
 The y-coordinate of the node.
 
std::string alphaDesc
 The description of the node.
 
double xScale
 The x-value scale of the node.
 
double yScale
 The y-value scale of the node.
 
Vector< std::shared_ptr< NetSignal > > networkSignals
 The network signals associated with the node.
 
bool isDepot
 Indicates whether the node is a stopping station or depot for all trains.
 
double dwellTimeIfDepot
 The dwell time at the depot.
 
bool refillTanksAndBatteries
 Indicates whether trains refill tanks and batteries when passing through this node.
 
Map< std::shared_ptr< NetNode >, Vector< std::shared_ptr< NetLink > > > linkTo
 The neighbor nodes and their link connections.
 
double graphSearchDistanceFromStart
 The graph search distance from the start node.
 
bool graphSearchVisited
 Indicates whether the node has been visited in graph search.
 
std::shared_ptr< NetNodegraphSearchPreviousNode
 The previous node in the path during graph search.
 

Detailed Description

The NetNode class represents a network node in a simulation.

Constructor & Destructor Documentation

◆ NetNode()

NetNode::NetNode ( int  simulatorID,
int  userID,
double  xCoord,
double  yCoord,
string  Desc,
double  xScale,
double  yScale 
)

Constructor.

Parameters
simulatorIDThe simulator identifier of the node.
userIDThe user identifier of the node.
xCoordThe x-coordinate of the node.
yCoordThe y-coordinate of the node.
DescThe description of the node.
xScaleThe x-value scale of the node.
yScaleThe y-value scale of the node.

◆ ~NetNode()

NetNode::~NetNode ( )

Destructor.

Member Function Documentation

◆ addSignal()

void NetNode::addSignal ( std::shared_ptr< NetSignal networkSignal)

Adds a network signal to the node.

Parameters
networkSignalThe network signal to add.

◆ clearGraphSearchParams()

void NetNode::clearGraphSearchParams ( )

Clears the graph search parameters.

This should be called before running the graph search.

◆ coordinates()

pair< double, double > NetNode::coordinates ( )

Gets the coordinates of the node.

Returns
A pair containing the x and y coordinates.

◆ getNeighbors()

Vector< std::shared_ptr< NetNode > > NetNode::getNeighbors ( )

Gets the neighbors of the node.

Returns
A vector of shared pointers to the neighbor nodes.

◆ getNumberOfNodesInSimulator()

unsigned int NetNode::getNumberOfNodesInSimulator ( )
static

Gets the number of nodes in the simulator.

Returns
The number of nodes.

◆ setNodeSimulatorID()

void NetNode::setNodeSimulatorID ( int  newID)

Sets the simulator identifier of the node.

Parameters
newIDThe new simulator identifier.

◆ updateXScale()

void NetNode::updateXScale ( const double &  newScale)

Updates the x-coordinate scale of the node.

Parameters
newScaleThe new scale value.

◆ updateYScale()

void NetNode::updateYScale ( const double &  newScale)

Updates the y-coordinate scale of the node.

Parameters
newScaleThe new scale value.

Member Data Documentation

◆ alphaDesc

std::string NetNode::alphaDesc

The description of the node.

◆ dwellTimeIfDepot

double NetNode::dwellTimeIfDepot

The dwell time at the depot.

◆ graphSearchDistanceFromStart

double NetNode::graphSearchDistanceFromStart

The graph search distance from the start node.

◆ graphSearchPreviousNode

std::shared_ptr<NetNode> NetNode::graphSearchPreviousNode

The previous node in the path during graph search.

◆ graphSearchVisited

bool NetNode::graphSearchVisited

Indicates whether the node has been visited in graph search.

◆ id

int NetNode::id = -1

The identifier of the node.

◆ isDepot

bool NetNode::isDepot

Indicates whether the node is a stopping station or depot for all trains.

◆ linkTo

Map<std::shared_ptr<NetNode>, Vector<std::shared_ptr<NetLink> > > NetNode::linkTo

The neighbor nodes and their link connections.

◆ networkSignals

Vector<std::shared_ptr<NetSignal> > NetNode::networkSignals

The network signals associated with the node.

◆ refillTanksAndBatteries

bool NetNode::refillTanksAndBatteries

Indicates whether trains refill tanks and batteries when passing through this node.

◆ userID

int NetNode::userID

The user identifier of the node.

◆ x

double NetNode::x

The x-coordinate of the node.

◆ xScale

double NetNode::xScale

The x-value scale of the node.

◆ y

double NetNode::y

The y-coordinate of the node.

◆ yScale

double NetNode::yScale

The y-value scale of the node.