VR-Forces Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Public Member Functions | Protected Member Functions | Protected Attributes
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.

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.

Public Member Functions

 DtExampleSimEngine (makVrv::DtDe &de)
 
virtual ~DtExampleSimEngine ()
 
bool init ()
 
bool uninit ()
 
bool tick (double simTime)
 
makVrv::DtEntity3dFacadefacade ()
 
 DtExampleSimEngine (makVrv::DtDe &de)
 
virtual ~DtExampleSimEngine ()
 
bool init ()
 
bool uninit ()
 
bool tick (double simTime)
 
 DtExampleSimEngine (DtExampleSimulationConnection &connection)
 
virtual ~DtExampleSimEngine ()
 
bool init ()
 
bool uninit ()
 
bool tick (double simTime)
 

Protected Member Functions

virtual void setHoverSignalsActive (bool active)
 
virtual void setEntityInfoWidgetActive (bool active)
 
virtual makVrv::DtUnicode generateInfoString () const
 
virtual void updatePosition (double simTime)
 
virtual void repositionAircraft (DtVector position, DtTaitBryan ori)
 
virtual void slot_coordinateSystemChanged ()
 
virtual void setHoverSignalsActive (bool active)
 
virtual void setEntityInfoWidgetActive (bool active)
 
virtual makVrv::DtUnicode generateInfoString () const
 
virtual void updatePosition (double simTime)
 
virtual void repositionAircraft (DtVector position, DtTaitBryan ori)
 
virtual void slot_coordinateSystemChanged ()
 
void slot_infoLabelsArePinned (const makVrv::DtSelectionManager::IdSet &pinOrUnpinList, bool pinAllLabels)
 
void slot_infoLabelsArePinned (const makVrv::DtSelectionManager::IdSet &pinOrUnpinList, bool pinAllLabels)
 

Protected Attributes

makVrv::DtSignalConnectionManager myConnections
 
DtExampleSimulationConnectionmySimulationConnection
 
makVrv::DtDemyDe
 
makVrv::DtEntity3dFacademyEntityFacade
 
makVrv::DtEntityIndicatorWidgetmyEntityIndicator
 
makVrv::DtEntityInfoWidgetmyEntityInfoWidget
 
makVrv::DtEntityHATLineFacademyEntityHATLineFacade
 
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::DtCoordinateSystemmyCoordinateSystem = nullptr
 
makVrv::vrvSignalsLib::connection myMouseEnterConnection
 
makVrv::vrvSignalsLib::connection myMouseLeaveConnection
 
makVrv::DtSignalConnectionManager mySignalConnections
 
void slot_infoLabelsArePinned (const makVrv::DtSelectionManager::IdSet &pinOrUnpinList, bool pinAllLabels)
 
virtual void setHoverSignalsActive (bool active)
 
virtual void setEntityInfoWidgetActive (bool active)
 
virtual makVrv::DtUnicode generateInfoString () const
 
virtual void updatePosition (double simTime)
 
virtual void repositionAircraft (DtVector position, DtTaitBryan ori)
 
virtual void slot_coordinateSystemChanged ()
 

Constructor & Destructor Documentation

DtExampleSimEngine::DtExampleSimEngine ( makVrv::DtDe de)

CTOR.

Parameters
[in]deis a a reference to the Display Engine
virtual DtExampleSimEngine::~DtExampleSimEngine ( )
virtual

DTOR.

DtExampleSimEngine::DtExampleSimEngine ( makVrv::DtDe de)

CTOR.

Parameters
[in]deis a a reference to the Display Engine
virtual DtExampleSimEngine::~DtExampleSimEngine ( )
virtual

DTOR.

DtExampleSimEngine::DtExampleSimEngine ( DtExampleSimulationConnection connection)

CTOR.

Parameters
[in]connectionis an simple example connection object.
virtual DtExampleSimEngine::~DtExampleSimEngine ( )
virtual

DTOR.

Member Function Documentation

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
bool DtExampleSimEngine::uninit ( )

Destroy what was created in init()

Returns
true if the initialization succeeds; false otherwise
bool DtExampleSimEngine::tick ( double  simTime)

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

Returns
true on success; false otherwise
makVrv::DtEntity3dFacade* DtExampleSimEngine::facade ( )
inline

References myEntityFacade.

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.

virtual void DtExampleSimEngine::setHoverSignalsActive ( bool  active)
protectedvirtual

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

virtual void DtExampleSimEngine::setEntityInfoWidgetActive ( bool  active)
protectedvirtual

Sets whether the entity info widget is displayed or not.

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

Generates the information string displayed in the entity info widget.

virtual void DtExampleSimEngine::updatePosition ( double  simTime)
protectedvirtual

Updates the current position / orientation of the entity.

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

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

virtual void DtExampleSimEngine::slot_coordinateSystemChanged ( )
protectedvirtual

slot for when the coordinate system changes

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
bool DtExampleSimEngine::uninit ( )

Destroy what was created in init()

Returns
true if the initialization succeeds; false otherwise
bool DtExampleSimEngine::tick ( double  simTime)

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

Returns
true on success; false otherwise
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.

virtual void DtExampleSimEngine::setHoverSignalsActive ( bool  active)
protectedvirtual

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

virtual void DtExampleSimEngine::setEntityInfoWidgetActive ( bool  active)
protectedvirtual

Sets whether the entity info widget is displayed or not.

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

Generates the information string displayed in the entity info widget.

virtual void DtExampleSimEngine::updatePosition ( double  simTime)
protectedvirtual

Updates the current position / orientation of the entity.

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

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

virtual void DtExampleSimEngine::slot_coordinateSystemChanged ( )
protectedvirtual

slot for when the coordinate system changes

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
bool DtExampleSimEngine::uninit ( )

Destroy what was created in init()

Returns
true if the initialization succeeds; false otherwise
bool DtExampleSimEngine::tick ( double  simTime)

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

Returns
true on success; false otherwise
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.

virtual void DtExampleSimEngine::setHoverSignalsActive ( bool  active)
protectedvirtual

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

virtual void DtExampleSimEngine::setEntityInfoWidgetActive ( bool  active)
protectedvirtual

Sets whether the entity info widget is displayed or not.

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

Generates the information string displayed in the info widget.

virtual void DtExampleSimEngine::updatePosition ( double  simTime)
protectedvirtual

Updates the current position / orientation of the entity.

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

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

virtual void DtExampleSimEngine::slot_coordinateSystemChanged ( )
protectedvirtual

slot for when the coordinate system changes

Member Data Documentation

makVrv::DtDe & DtExampleSimEngine::myDe
protected

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

makVrv::DtEntity3dFacade * DtExampleSimEngine::myEntityFacade
protected

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

Referenced by facade().

makVrv::DtEntityIndicatorWidget * DtExampleSimEngine::myEntityIndicator
protected

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

makVrv::DtEntityInfoWidget * DtExampleSimEngine::myEntityInfoWidget
protected

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

makVrv::DtEntityHATLineFacade * DtExampleSimEngine::myEntityHATLineFacade
protected

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

std::string DtExampleSimEngine::myEntityDisplayName
protected

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

bool DtExampleSimEngine::myEntityInfoWidgetPinnedFlag
protected

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

DtTaitBryan DtExampleSimEngine::myOrientation
protected

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

DtVector DtExampleSimEngine::myPosition
protected

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

double DtExampleSimEngine::myHeading
protected

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

double DtExampleSimEngine::myLastCommLineTime
protected

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

double DtExampleSimEngine::myLastUpdateTime
protected

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

DtVector DtExampleSimEngine::myOrbitCenter
protected

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

double DtExampleSimEngine::myAngularVelocity
protected

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

double DtExampleSimEngine::myClockAngle
protected

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

double DtExampleSimEngine::myRadius
protected

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

double DtExampleSimEngine::myRoll
protected

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

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

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

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

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

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

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

makVrv::DtSignalConnectionManager DtExampleSimEngine::mySignalConnections
protected

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

DtExampleSimulationConnection& DtExampleSimEngine::mySimulationConnection
protected

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

Document ID: Generated on Wed Mar 27 22:49:11 EDT 2024 from SVN revision 264633
Copyright © 2005-2024 MAK Technologies. All Rights Reserved (www.mak.com)