VR-Vantage
Loading...
Searching...
No Matches
DtExampleSimEngine Class Reference

Provide a basic sim engine to use in an example showing how to embed a sim engine into a driver that runs in a single thread. More...

Public Member Functions

 DtExampleSimEngine (makVrv::DtDe &de)
virtual ~DtExampleSimEngine ()
 DTOR.
bool init ()
bool uninit ()
bool tick (double simTime)
makVrv::DtEntity3dFacade * facade ()
 DtExampleSimEngine (makVrv::DtDe &de)
virtual ~DtExampleSimEngine ()
 DTOR.
bool init ()
bool uninit ()
bool tick (double simTime)
 DtExampleSimEngine (DtExampleSimulationConnection &connection)
virtual ~DtExampleSimEngine ()
 DTOR.
bool init ()
bool uninit ()
bool tick (double simTime)

Protected Member Functions

void slot_infoLabelsArePinned (const makVrv::DtSelectionManager::IdSet &pinOrUnpinList, bool pinAllLabels)
virtual void setHoverSignalsActive (bool active)
virtual void setEntityInfoWidgetActive (bool active)
 Sets whether the entity info widget is displayed or not.
virtual makVrv::DtUnicode generateInfoString () const
 Generates the information string displayed in the entity info widget.
virtual void updatePosition (double simTime)
 Updates the current position / orientation of the entity.
virtual void repositionAircraft (DtVector position, DtTaitBryan ori)
 Positions the aircraft at the given position with the given orientation.
virtual void slot_coordinateSystemChanged ()
 slot for when the coordinate system changes
void slot_infoLabelsArePinned (const makVrv::DtSelectionManager::IdSet &pinOrUnpinList, bool pinAllLabels)
virtual void setHoverSignalsActive (bool active)
virtual void setEntityInfoWidgetActive (bool active)
 Sets whether the entity info widget is displayed or not.
virtual makVrv::DtUnicode generateInfoString () const
 Generates the information string displayed in the entity info widget.
virtual void updatePosition (double simTime)
 Updates the current position / orientation of the entity.
virtual void repositionAircraft (DtVector position, DtTaitBryan ori)
 Positions the aircraft at the given position with the given orientation.
virtual void slot_coordinateSystemChanged ()
 slot for when the coordinate system changes
void slot_infoLabelsArePinned (const makVrv::DtSelectionManager::IdSet &pinOrUnpinList, bool pinAllLabels)
virtual void setHoverSignalsActive (bool active)
 Sets whether the sim engine is listening for mouseover events or not.
virtual void setEntityInfoWidgetActive (bool active)
 Sets whether the entity info widget is displayed or not.
virtual makVrv::DtUnicode generateInfoString () const
 Generates the information string displayed in the info widget.
virtual void updatePosition (double simTime)
 Updates the current position / orientation of the entity.
virtual void repositionAircraft (DtVector position, DtTaitBryan ori)
 Positions the aircraft at the given position with the given orientation.
virtual void slot_coordinateSystemChanged ()
 slot for when the coordinate system changes

Protected Attributes

makVrv::DtDe & myDe
makVrv::DtEntity3dFacade * myEntityFacade
makVrv::DtEntityIndicatorWidget * myEntityIndicator
makVrv::DtEntityInfoWidget * myEntityInfoWidget
makVrv::DtEntityHATLineFacade * myEntityHATLineFacade
std::string myEntityDisplayName
bool myEntityInfoWidgetPinnedFlag
DtTaitBryan myOrientation
DtVector myPosition
double myHeading
double myLastCommLineTime
double myLastUpdateTime
DtVector myOrbitCenter
double myAngularVelocity
double myClockAngle
double myRadius
double myRoll
makVrv::DtSignalConnectionManager myConnections
makVrv::DtCoordinateSystem * myCoordinateSystem = nullptr
makVrv::vrvSignalsLib::connection myMouseEnterConnection
makVrv::vrvSignalsLib::connection myMouseLeaveConnection
makVrv::DtSignalConnectionManager mySignalConnections
DtExampleSimulationConnection & mySimulationConnection

Detailed Description

Provide a basic sim engine to use in an example showing how to embed a sim engine into a driver that runs in a single thread.

Provide an example sim engine to use in an example showing how to embed a sim engine into a driver that runs in a separate thread.

The vast majority of this code is identical to the DtExampleSimEngine code in the exampleThreadedDriver example. Comparing the two is worthwhile. It creates an aircraft, with a HAT line and entity indicator, and updates it to fly in a circle and display the entity info widget when the mouse is over the entity indicator. The only significant difference between this code and the code in exampleThreadedDriver is that instead of using a connection, its using the display engine (DtDe) interface provided by the driver; and getting sim time from the DtDe instead of from the connection.

The vast majority of this code was extracted directly from DtExampleDriver. It creates an aircraft, with a HAT line and entity indicator, and updates it to fly in a circle and display the entity info widget when the mouse is over the entity indicator. The only significant difference between this code and the code extracted from exampleDriver is that instead of using the agent manager provided to the driver, its using the agent manager interface (sceneInterface()) provided by the connection; and getting sim time from the connection instead of from the DtDe. Note that we could have just grabbed clock time, but this demonstrates a way of moving this piece of data (sim time) from the driver to the connection.

Constructor & Destructor Documentation

◆ DtExampleSimEngine() [1/3]

DtExampleSimEngine::DtExampleSimEngine ( makVrv::DtDe & de)

CTOR

Parameters
[in]deis a a reference to the Display Engine

◆ ~DtExampleSimEngine() [1/3]

virtual DtExampleSimEngine::~DtExampleSimEngine ( )
virtual

DTOR.

◆ DtExampleSimEngine() [2/3]

DtExampleSimEngine::DtExampleSimEngine ( makVrv::DtDe & de)

CTOR

Parameters
[in]deis a a reference to the Display Engine

◆ ~DtExampleSimEngine() [2/3]

virtual DtExampleSimEngine::~DtExampleSimEngine ( )
virtual

DTOR.

◆ DtExampleSimEngine() [3/3]

DtExampleSimEngine::DtExampleSimEngine ( DtExampleSimulationConnection & connection)

CTOR

Parameters
[in]connectionis an simple example connection object.

◆ ~DtExampleSimEngine() [3/3]

virtual DtExampleSimEngine::~DtExampleSimEngine ( )
virtual

DTOR.

Member Function Documentation

◆ init() [1/3]

bool DtExampleSimEngine::init ( )

Initialize the simulation engine. In this case, the entity facade, indicators, and hat line are created.

Returns
true if the initialization succeeds; false otherwise

◆ uninit() [1/3]

bool DtExampleSimEngine::uninit ( )

Destroy what was created in init()

Returns
true if the initialization succeeds; false otherwise

◆ tick() [1/3]

bool DtExampleSimEngine::tick ( double simTime)

Perform updates param[in] simTime is he current simulation time

Returns
true on success; false otherwise

◆ facade()

makVrv::DtEntity3dFacade * DtExampleSimEngine::facade ( )
inline

References myEntityFacade.

◆ slot_infoLabelsArePinned() [1/3]

void DtExampleSimEngine::slot_infoLabelsArePinned ( const makVrv::DtSelectionManager::IdSet & pinOrUnpinList,
bool pinAllLabels )
protected

Boost slots.

Slot called by signal to indicate that the label state was changed for the elements listed in the IdSet. If our element ID is among them, we will call setEntityInfoWidgetActive. param[in] pinOrUnpinList is the list of the currently selected elements param[in] pinAllLabels If true, the informative labels belonging to elements, whose element ids are specified in pinOrUnpinList, will be pinned. If false, the informative labels of those same elements will be unpinned.

◆ setHoverSignalsActive() [1/3]

virtual void DtExampleSimEngine::setHoverSignalsActive ( bool active)
protectedvirtual

Sets whether the sim engine is listening for mouseover events or not in its entity indicator.

◆ setEntityInfoWidgetActive() [1/3]

virtual void DtExampleSimEngine::setEntityInfoWidgetActive ( bool active)
protectedvirtual

Sets whether the entity info widget is displayed or not.

◆ generateInfoString() [1/3]

virtual makVrv::DtUnicode DtExampleSimEngine::generateInfoString ( ) const
protectedvirtual

Generates the information string displayed in the entity info widget.

◆ updatePosition() [1/3]

virtual void DtExampleSimEngine::updatePosition ( double simTime)
protectedvirtual

Updates the current position / orientation of the entity.

◆ repositionAircraft() [1/3]

virtual void DtExampleSimEngine::repositionAircraft ( DtVector position,
DtTaitBryan ori )
protectedvirtual

Positions the aircraft at the given position with the given orientation.

◆ slot_coordinateSystemChanged() [1/3]

virtual void DtExampleSimEngine::slot_coordinateSystemChanged ( )
protectedvirtual

slot for when the coordinate system changes

◆ init() [2/3]

bool DtExampleSimEngine::init ( )

Initialize the simulation engine. In this case, the entity facade, indicators, and hat line are created.

Returns
true if the initialization succeeds; false otherwise

◆ uninit() [2/3]

bool DtExampleSimEngine::uninit ( )

Destroy what was created in init()

Returns
true if the initialization succeeds; false otherwise

◆ tick() [2/3]

bool DtExampleSimEngine::tick ( double simTime)

Perform updates param[in] simTime is he current simulation time

Returns
true on success; false otherwise

◆ slot_infoLabelsArePinned() [2/3]

void DtExampleSimEngine::slot_infoLabelsArePinned ( const makVrv::DtSelectionManager::IdSet & pinOrUnpinList,
bool pinAllLabels )
protected

Boost slots.

Slot called by signal to indicate that the label state was changed for the elements listed in the IdSet. If our element ID is among them, we will call setEntityInfoWidgetActive. param[in] pinOrUnpinList is the list of the currently selected elements param[in] pinAllLabels If true, the informative labels belonging to elements, whose element ids are specified in pinOrUnpinList, will be pinned. If false, the informative labels of those same elements will be unpinned.

◆ setHoverSignalsActive() [2/3]

virtual void DtExampleSimEngine::setHoverSignalsActive ( bool active)
protectedvirtual

Sets whether the sim engine is listening for mouseover events or not in its entity indicator.

◆ setEntityInfoWidgetActive() [2/3]

virtual void DtExampleSimEngine::setEntityInfoWidgetActive ( bool active)
protectedvirtual

Sets whether the entity info widget is displayed or not.

◆ generateInfoString() [2/3]

virtual makVrv::DtUnicode DtExampleSimEngine::generateInfoString ( ) const
protectedvirtual

Generates the information string displayed in the entity info widget.

◆ updatePosition() [2/3]

virtual void DtExampleSimEngine::updatePosition ( double simTime)
protectedvirtual

Updates the current position / orientation of the entity.

◆ repositionAircraft() [2/3]

virtual void DtExampleSimEngine::repositionAircraft ( DtVector position,
DtTaitBryan ori )
protectedvirtual

Positions the aircraft at the given position with the given orientation.

◆ slot_coordinateSystemChanged() [2/3]

virtual void DtExampleSimEngine::slot_coordinateSystemChanged ( )
protectedvirtual

◆ init() [3/3]

bool DtExampleSimEngine::init ( )

Initialize the simulation engine. In this case, the entity facade, indicators, and hat line are created.

Returns
true if the initialization succeeds; false otherwise

◆ uninit() [3/3]

bool DtExampleSimEngine::uninit ( )

Destroy what was created in init()

Returns
true if the initialization succeeds; false otherwise

◆ tick() [3/3]

bool DtExampleSimEngine::tick ( double simTime)

Perform updates param[in] simTime is he current simulation time

Returns
true on success; false otherwise

◆ slot_infoLabelsArePinned() [3/3]

void DtExampleSimEngine::slot_infoLabelsArePinned ( const makVrv::DtSelectionManager::IdSet & pinOrUnpinList,
bool pinAllLabels )
protected

Boost slots.

Slot called by signal to indicate that the label state was changed for the elements listed in the IdSet. If our element ID is among them, we will call setEntityInfoWidgetActive. param[in] pinOrUnpinList is the list of the currently selected elements param[in] pinAllLabels If true, the informative labels belonging to elements, whose element ids are specified in pinOrUnpinList, will be pinned. If false, the informative labels of those same elements will be unpinned.

◆ setHoverSignalsActive() [3/3]

virtual void DtExampleSimEngine::setHoverSignalsActive ( bool active)
protectedvirtual

Sets whether the sim engine is listening for mouseover events or not.

◆ setEntityInfoWidgetActive() [3/3]

virtual void DtExampleSimEngine::setEntityInfoWidgetActive ( bool active)
protectedvirtual

Sets whether the entity info widget is displayed or not.

◆ generateInfoString() [3/3]

virtual makVrv::DtUnicode DtExampleSimEngine::generateInfoString ( ) const
protectedvirtual

Generates the information string displayed in the info widget.

◆ updatePosition() [3/3]

virtual void DtExampleSimEngine::updatePosition ( double simTime)
protectedvirtual

Updates the current position / orientation of the entity.

◆ repositionAircraft() [3/3]

virtual void DtExampleSimEngine::repositionAircraft ( DtVector position,
DtTaitBryan ori )
protectedvirtual

Positions the aircraft at the given position with the given orientation.

◆ slot_coordinateSystemChanged() [3/3]

virtual void DtExampleSimEngine::slot_coordinateSystemChanged ( )
protectedvirtual

slot for when the coordinate system changes

Member Data Documentation

◆ myDe

makVrv::DtDe & DtExampleSimEngine::myDe
protected

◆ myEntityFacade

makVrv::DtEntity3dFacade * DtExampleSimEngine::myEntityFacade
protected

◆ myEntityIndicator

makVrv::DtEntityIndicatorWidget * DtExampleSimEngine::myEntityIndicator
protected

◆ myEntityInfoWidget

makVrv::DtEntityInfoWidget * DtExampleSimEngine::myEntityInfoWidget
protected

◆ myEntityHATLineFacade

makVrv::DtEntityHATLineFacade * DtExampleSimEngine::myEntityHATLineFacade
protected

◆ myEntityDisplayName

std::string DtExampleSimEngine::myEntityDisplayName
protected

◆ myEntityInfoWidgetPinnedFlag

bool DtExampleSimEngine::myEntityInfoWidgetPinnedFlag
protected

◆ myOrientation

DtTaitBryan DtExampleSimEngine::myOrientation
protected

◆ myPosition

DtVector DtExampleSimEngine::myPosition
protected

◆ myHeading

double DtExampleSimEngine::myHeading
protected

◆ myLastCommLineTime

double DtExampleSimEngine::myLastCommLineTime
protected

◆ myLastUpdateTime

double DtExampleSimEngine::myLastUpdateTime
protected

◆ myOrbitCenter

DtVector DtExampleSimEngine::myOrbitCenter
protected

◆ myAngularVelocity

double DtExampleSimEngine::myAngularVelocity
protected

◆ myClockAngle

double DtExampleSimEngine::myClockAngle
protected

◆ myRadius

double DtExampleSimEngine::myRadius
protected

◆ myRoll

double DtExampleSimEngine::myRoll
protected

◆ myConnections

makVrv::DtSignalConnectionManager DtExampleSimEngine::myConnections
protected

◆ myCoordinateSystem

makVrv::DtCoordinateSystem * DtExampleSimEngine::myCoordinateSystem = nullptr
protected

local clone of the system wide coordinate system. for thread safety.

◆ myMouseEnterConnection

makVrv::vrvSignalsLib::connection DtExampleSimEngine::myMouseEnterConnection
protected

◆ myMouseLeaveConnection

makVrv::vrvSignalsLib::connection DtExampleSimEngine::myMouseLeaveConnection
protected

◆ mySignalConnections

makVrv::DtSignalConnectionManager DtExampleSimEngine::mySignalConnections
protected

◆ mySimulationConnection

DtExampleSimulationConnection& DtExampleSimEngine::mySimulationConnection
protected

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