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

A network train simulation GUI. More...

#include <netrainsimmainwindow.h>

Inheritance diagram for NeTrainSim:

Public Slots

void setNodesData (QVector< double > &xData, QVector< double > &yData, QVector< QString > &labels)
 Slot for setting the nodes data.
 
void setLinksData (QVector< QString > &startNodeIDs, QVector< QString > endNodeIDs)
 Slot for setting the links data.
 
void updateTrainsPlot (Vector< std::pair< std::string, Vector< std::pair< double, double > > > > trainsStartEndPoints)
 Slot for updating the trains plot.
 
void closeApplication ()
 Slot for closing the application.
 
void clearForm ()
 Slot for clearing the form.
 
void handleSampleProject ()
 Slot for handling loading the sample project files.
 
void pauseSimulation ()
 
void resumeSimulation ()
 

Signals

void nodesDataChanged (QVector< double > &xData, QVector< double > &yData, QVector< QString > &labels)
 Signal emitted when the nodes data is changed.
 
void linksDataChanged (QVector< QString > &startNodeID, QVector< QString > endNodeID)
 Signal emitted when the links data is changed.
 

Public Member Functions

void loadDefaults ()
 load default settings
 
bool saveDefaults (QStringList defaults)
 NeTrainSim::save Default values.
 
 NeTrainSim (QWidget *parent=nullptr)
 Constructor.
 
 ~NeTrainSim ()
 Destructor.
 
void showNotification (QString text)
 Displays a notification with the given text for 3000 millisecond.
 
void showWarning (QString text)
 Displays a warning message with the given text.
 
void loadProjectFiles (QString projectFilename)
 load the Project Files to the simulator GUI
 

Public Attributes

QString defaultBrowsePath
 default Browse Path
 
QString userBrowsePath
 

Protected Member Functions

void closeEvent (QCloseEvent *event) override
 Event handler for the close event of the NeTrainSim window.
 

Detailed Description

A network train simulation GUI.

This class represents the main window of the NeTrainSim application, which is used for simulating train networks. It provides functionality for setting up the simulation, managing network nodes and links, visualizing the network, running simulations, and generating reports.

The class emits signals for notifying changes in the nodes and links data, and provides slots for handling events and updating the GUI based on these signals. It also includes several private methods for setting up the application, handling user interactions, and performing internal tasks.

Author
Ahmed Aredah
Date
6/7/2023

Constructor & Destructor Documentation

◆ NeTrainSim()

NeTrainSim::NeTrainSim ( QWidget *  parent = nullptr)

Constructor.

Parameters
[in,out]parent(Optional) If non-null, the parent.
Author
Ahmed Aredah
Date
2/28/2023

◆ ~NeTrainSim()

NeTrainSim::~NeTrainSim ( )

Destructor.

Author
Ahmed Aredah
Date
2/28/2023

Member Function Documentation

◆ clearForm

void NeTrainSim::clearForm ( )
slot

Slot for clearing the form.

Author
Ahmed Aredah
Date
6/7/2023

◆ closeApplication

void NeTrainSim::closeApplication ( )
slot

Slot for closing the application.

Author
Ahmed Aredah
Date
6/7/2023

◆ closeEvent()

void NeTrainSim::closeEvent ( QCloseEvent *  event)
overrideprotected

Event handler for the close event of the NeTrainSim window.

Parameters
eventPointer to the QCloseEvent object.
Author
Ahmed Aredah
Date
6/7/2023

◆ handleSampleProject

void NeTrainSim::handleSampleProject ( )
slot

Slot for handling loading the sample project files.

Author
Ahmed Aredah
Date
6/7/2023

◆ linksDataChanged

void NeTrainSim::linksDataChanged ( QVector< QString > &  startNodeID,
QVector< QString >  endNodeID 
)
signal

Signal emitted when the links data is changed.

Parameters
startNodeIDsThe updated start node IDs of the links.
endNodeIDsThe updated end node IDs of the links.
Author
Ahmed Aredah
Date
6/7/2023

◆ loadDefaults()

void NeTrainSim::loadDefaults ( )

load default settings

Author
Ahmed Aredah
Date
7/1/2023

◆ loadProjectFiles()

void NeTrainSim::loadProjectFiles ( QString  projectFilename)

load the Project Files to the simulator GUI

Parameters
projectFilenamethe file NTS that has the files address
Author
Ahmed Aredah
Date
6/7/2023

◆ nodesDataChanged

void NeTrainSim::nodesDataChanged ( QVector< double > &  xData,
QVector< double > &  yData,
QVector< QString > &  labels 
)
signal

Signal emitted when the nodes data is changed.

Parameters
xDataThe updated X-coordinate data of the nodes.
yDataThe updated Y-coordinate data of the nodes.
labelsThe updated labels of the nodes.
Author
Ahmed Aredah
Date
6/7/2023

◆ pauseSimulation

void NeTrainSim::pauseSimulation ( )
slot

◆ resumeSimulation

void NeTrainSim::resumeSimulation ( )
slot

◆ saveDefaults()

bool NeTrainSim::saveDefaults ( QStringList  defaults)

NeTrainSim::save Default values.

Parameters
defaults
Returns

◆ setLinksData

void NeTrainSim::setLinksData ( QVector< QString > &  startNodeIDs,
QVector< QString >  endNodeIDs 
)
slot

Slot for setting the links data.

Parameters
startNodeIDsThe start node IDs of the links.
endNodeIDsThe end node IDs of the links.
Author
Ahmed Aredah
Date
6/7/2023

◆ setNodesData

void NeTrainSim::setNodesData ( QVector< double > &  xData,
QVector< double > &  yData,
QVector< QString > &  labels 
)
slot

Slot for setting the nodes data.

Parameters
xDataThe X-coordinate data of the nodes.
yDataThe Y-coordinate data of the nodes.
labelsThe labels of the nodes.
Author
Ahmed Aredah
Date
6/7/2023

◆ showNotification()

void NeTrainSim::showNotification ( QString  text)

Displays a notification with the given text for 3000 millisecond.

Parameters
textThe text of the notification to be displayed.
Author
Ahmed Aredah
Date
6/7/2023

◆ showWarning()

void NeTrainSim::showWarning ( QString  text)

Displays a warning message with the given text.

Parameters
textThe text of the warning message to be displayed.
Author
Ahmed Aredah
Date
6/7/2023

◆ updateTrainsPlot

void NeTrainSim::updateTrainsPlot ( Vector< std::pair< std::string, Vector< std::pair< double, double > > > >  trainsStartEndPoints)
slot

Slot for updating the trains plot.

Parameters
trainsStartEndPointsThe start and end points of trains.
Author
Ahmed Aredah
Date
6/7/2023

Member Data Documentation

◆ defaultBrowsePath

QString NeTrainSim::defaultBrowsePath

default Browse Path

◆ userBrowsePath

QString NeTrainSim::userBrowsePath