VR-Engage  2.2
Loading...
Searching...
No Matches
makVre::DtLoadingState Class Reference

Detailed Description

DtLoadingState is responsible for loading terrain and scenario data into VR-Engage. It presents a loading UI with progress information, coordinates the loading sequence between simulation and visualization components, and handles transitions to the appropriate state once loading is complete.

#include <loadingState.h>

Inheritance diagram for makVre::DtLoadingState:
[legend]

Public Member Functions

 DtLoadingState (DtPlayerStationApp &app)
 
virtual ~DtLoadingState () override
 
virtual void onEnter (const DtPlayerStationStateArgs *args) override
 
virtual void onExit () override
 
virtual void tick (double dt) override
 
- Public Member Functions inherited from makVre::DtPlayerStationState
 DtPlayerStationState (DtPlayerStationApp &app, std::string stateType)
 
virtual ~DtPlayerStationState ()
 
 DtPlayerStationState (const DtPlayerStationState &)=delete
 
DtPlayerStationStateoperator= (const DtPlayerStationState &)=delete
 
virtual void onEnter ()
 
virtual void onStacked ()
 
virtual void onExposed (const DtPlayerStationStateArgs *args)
 
virtual void onExposed ()
 
bool active () const
 
bool exposed () const
 
bool exiting () const
 
bool stacking () const
 
const std::string & stateType () const
 
DtPlayerStationAppapp () const
 

Protected Member Functions

virtual DtVreMessageResult handleBackendStatus (DtVreMessage *msg)
 
virtual DtVreMessageResult handleSmsLoadComplete (DtVreMessage *msg)
 
virtual DtVreMessageResult handleSessionStatus (DtVreMessage *msg)
 
virtual void loadSimTerrain ()
 
virtual void loadGuiTerrain ()
 
virtual bool loadScenarioObserverViews ()
 
virtual bool parseObserverViewsXml (const DtString &xml, makArchives::DtObserverStateRecordsList &record)
 
virtual bool findFileRecursive (const std::string &directory, const std::string &filenameToFind, DtFilename &foundPath)
 
virtual void setStatusText (const QString &msg)
 
virtual void setTimeToLoad (const int ms)
 
int getEstimatedTimeToLoad (const std::string &file)
 
void logEstimatedTimeToLoad (const std::string &file)
 
- Protected Member Functions inherited from makVre::DtPlayerStationState
bool pushState (const std::string &newState, DtPlayerStationStateArgs *args=NULL)
 
bool popSelf ()
 
bool popUntilSelf ()
 
bool popUntilState (const std::string &parentState, DtPlayerStationStateArgs *args=NULL)
 
bool switchToState (const std::string &newState, DtPlayerStationStateArgs *args=NULL)
 
bool pushSelf ()
 

Protected Attributes

std::shared_ptr< SessionLoadDataMessagemyLoadData
 
std::shared_ptr< DtVreLoadingPagemyLoadingPage
 
std::shared_ptr< DtVreExternalLoadingPageLogicmyExternalLoadingLogic
 
int mySmsLoadStatusBits
 
bool mySentTerrainLoad
 
bool myDidSimLoad
 
bool myDidGuiLoad
 
int myServerPort
 
std::chrono::time_point< std::chrono::steady_clock > myTimerStart
 
std::chrono::time_point< std::chrono::steady_clock > myTimerEnd
 
- Protected Attributes inherited from makVre::DtPlayerStationState
DtPlayerStationAppmyApp
 

Constructor & Destructor Documentation

◆ DtLoadingState()

makVre::DtLoadingState::DtLoadingState ( DtPlayerStationApp & app)

Constructor.

Parameters
appReference to the player station application

Creates a new loading state associated with the given application.

References makVre::DtPlayerStationState::app().

◆ ~DtLoadingState()

virtual makVre::DtLoadingState::~DtLoadingState ( )
overridevirtual

Virtual destructor.

Ensures proper cleanup of loading state resources.

Member Function Documentation

◆ onEnter()

virtual void makVre::DtLoadingState::onEnter ( const DtPlayerStationStateArgs * args)
overridevirtual

Called when the state is entered.

Parameters
argsPointer to arguments from the previous state

Initializes the loading process, sets up the loading UI, and begins the sequence of loading terrain and scenario data. The args parameter typically contains information about what needs to be loaded.

Reimplemented from makVre::DtPlayerStationState.

◆ onExit()

virtual void makVre::DtLoadingState::onExit ( )
overridevirtual

Called when the state is exited.

Cleans up loading resources, hides the loading UI, and prepares for the transition to the next state (typically a session state).

Reimplemented from makVre::DtPlayerStationState.

◆ tick()

virtual void makVre::DtLoadingState::tick ( double dt)
overridevirtual

Updates the state each frame.

Parameters
dtTime in seconds since the last update

Monitors loading progress, updates the loading UI, and checks for completion conditions to determine when to transition to the next state.

Reimplemented from makVre::DtPlayerStationState.

◆ handleBackendStatus()

virtual DtVreMessageResult makVre::DtLoadingState::handleBackendStatus ( DtVreMessage * msg)
protectedvirtual

Handles backend status update messages.

Parameters
msgPointer to the backend status message
Returns
Message handling result

Processes status updates from the backend system, updating the loading progress based on the current state of backend components.

◆ handleSmsLoadComplete()

virtual DtVreMessageResult makVre::DtLoadingState::handleSmsLoadComplete ( DtVreMessage * msg)
protectedvirtual

Handles SMS load completion messages.

Parameters
msgPointer to the load complete message
Returns
Message handling result

Processes notifications that the Simulation Management System has completed loading the requested terrain or scenario data.

◆ handleSessionStatus()

virtual DtVreMessageResult makVre::DtLoadingState::handleSessionStatus ( DtVreMessage * msg)
protectedvirtual

Handles session status messages.

Parameters
msgPointer to the session status message
Returns
Message handling result

Processes updates about the current session status, which may indicate when the session is ready for player engagement after loading.

◆ loadSimTerrain()

virtual void makVre::DtLoadingState::loadSimTerrain ( )
protectedvirtual

Initiates terrain loading in the simulation component.

Starts the loading process for terrain data in the simulation system. This prepares the terrain for simulation physics and entity interactions.

◆ loadGuiTerrain()

virtual void makVre::DtLoadingState::loadGuiTerrain ( )
protectedvirtual

Initiates terrain loading in the GUI/visualization component.

Starts the loading process for terrain data in the visualization system. This prepares the terrain for visual rendering and display.

◆ loadScenarioObserverViews()

virtual bool makVre::DtLoadingState::loadScenarioObserverViews ( )
protectedvirtual

Loads observer views defined in the scenario file.

Returns
True if observer views were loaded successfully, false otherwise

Attempts to load pre-defined observer views from the scenario file, which provide camera positions and orientations for observing the simulation.

◆ parseObserverViewsXml()

virtual bool makVre::DtLoadingState::parseObserverViewsXml ( const DtString & xml,
makArchives::DtObserverStateRecordsList & record )
protectedvirtual

◆ findFileRecursive()

virtual bool makVre::DtLoadingState::findFileRecursive ( const std::string & directory,
const std::string & filenameToFind,
DtFilename & foundPath )
protectedvirtual

Searches recursively for a file in a directory.

Parameters
directoryDirectory to start the search from
filenameToFindFilename to search for
foundPath[out] Path to the found file if successful
Returns
True if the file was found, false otherwise

Performs a recursive search for a specified file within a directory and its subdirectories. If found, the full path is stored in foundPath.

◆ setStatusText()

virtual void makVre::DtLoadingState::setStatusText ( const QString & msg)
protectedvirtual

Sets the status text in the loading UI.

Parameters
msgText message to display

Updates the status text shown in the loading UI to inform the user about the current loading activity or progress.

◆ setTimeToLoad()

virtual void makVre::DtLoadingState::setTimeToLoad ( const int ms)
protectedvirtual

Sets the estimated loading time.

Parameters
msEstimated time in milliseconds

Sets the estimated time required to complete the loading process, which may be used to update the progress indicator in the UI.

◆ getEstimatedTimeToLoad()

int makVre::DtLoadingState::getEstimatedTimeToLoad ( const std::string & file)
protected

Gets the estimated loading time for a file.

Parameters
filePath to the scenario or terrain file
Returns
Estimated loading time in milliseconds, or -1 if file not found

Calculates the estimated time needed to load the specified scenario or terrain file. This starts a timer if not already started and may use historical data to provide an estimate. Returns -1 if the file is not found.

◆ logEstimatedTimeToLoad()

void makVre::DtLoadingState::logEstimatedTimeToLoad ( const std::string & file)
protected

Stops the loading timer and logs statistics.

Parameters
filePath to the scenario or terrain file that was loaded

Stops the loading timer started by getEstimatedTimeToLoad() and logs the actual loading time to a data file for future reference. This helps improve future loading time estimates.

Member Data Documentation

◆ myLoadData

std::shared_ptr<SessionLoadDataMessage> makVre::DtLoadingState::myLoadData
protected

Data message containing loading parameters.

Contains information about what terrain or scenario to load and how it should be loaded.

◆ myLoadingPage

std::shared_ptr<DtVreLoadingPage> makVre::DtLoadingState::myLoadingPage
protected

Loading page UI component.

Provides the user interface for displaying loading progress.

◆ myExternalLoadingLogic

std::shared_ptr<DtVreExternalLoadingPageLogic> makVre::DtLoadingState::myExternalLoadingLogic
protected

External loading page logic.

Handles advanced loading UI functionality and interactions.

◆ mySmsLoadStatusBits

int makVre::DtLoadingState::mySmsLoadStatusBits
protected

SMS loading status bitmask.

Tracks which components of the Simulation Management System have completed loading through a bitmask of status flags.

◆ mySentTerrainLoad

bool makVre::DtLoadingState::mySentTerrainLoad
protected

Flag indicating if terrain load command was sent.

◆ myDidSimLoad

bool makVre::DtLoadingState::myDidSimLoad
protected

Flag indicating if simulation terrain loading is complete.

◆ myDidGuiLoad

bool makVre::DtLoadingState::myDidGuiLoad
protected

Flag indicating if GUI terrain loading is complete.

◆ myServerPort

int makVre::DtLoadingState::myServerPort
protected

Server port number for the loaded session.

◆ myTimerStart

std::chrono::time_point<std::chrono::steady_clock> makVre::DtLoadingState::myTimerStart
protected

Timer start timestamp.

Records when loading began for performance measurement.

◆ myTimerEnd

std::chrono::time_point<std::chrono::steady_clock> makVre::DtLoadingState::myTimerEnd
protected

Timer end timestamp.

Records when loading completed for performance measurement.


The documentation for this class was generated from the following file: