VR-Forces 5.0.2 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
makVrv::DtShipFlagSwitchTickable Class Reference

The DtShipFlagSwitchTickable class is responsible for switching nodes based on the current wind speed and ship speed.

Inheritance diagram for makVrv::DtShipFlagSwitchTickable:
Inheritance graph
[legend]

Public Member Functions

 DtShipFlagSwitchTickable (DtDe &de, DtElementID elementId, DtUniqueID sceneObjectId, DtUniqueID uniqueId, unsigned int nodeTypeIndex, DtOsgArticulatedModel *osgArticulatedModel)
 
virtual ~DtShipFlagSwitchTickable ()
 
DtVector computeWindVec (DtSceneObject *sceneObj, float windDirRad)
 
virtual void update (DtTime tNow)
 
void SetWindNodeSwitch (double windSpeed)
 
virtual bool needsUpdate (DtTime tNow)
 
virtual void configure (osg::Node *n, const rapidjson::Value &windJsonData)
 
unsigned int getSwitchIndexForSpeed (double windSpeed)
 
virtual void modelToBeDestroyed (DtModel *model)
 
- Public Member Functions inherited from makVrv::DtDynamicFeatureTickable
virtual ~DtDynamicFeatureTickable ()
 
- Public Member Functions inherited from makVrv::DtTickable
virtual bool updateIfNeeded (DtTime tNow)
 
virtual ~DtTickable ()
 
virtual void setIsThreadSafe (bool safe)
 
virtual bool isThreadSafe () const
 
virtual void setTickableListState (TickableListState safeList)
 
virtual TickableListState tickableListState () const
 
virtual void setUpdatePeriod (unsigned int period)
 
virtual unsigned int updatePeriod () const
 
virtual bool lodSystemEnabled () const
 
- Public Member Functions inherited from makVrv::DtVirtualBaseClass
 DtVirtualBaseClass ()
 
virtual ~DtVirtualBaseClass ()
 

Static Public Attributes

static const chartheShipFlagSwitchFeatureName
 
static const chartheTagWindSpeeds
 
static const chartheTagSwitchIndices
 

Protected Member Functions

virtual void disconnectFromModel ()
 
virtual void slot_coordinateSystemChanged ()
 
- Protected Member Functions inherited from makVrv::DtDynamicFeatureTickable
 DtDynamicFeatureTickable (DtDe &de, DtElementID elementId, DtUniqueID sceneObjectId, DtUniqueID uniqueId, unsigned int nodeTypeIndex)
 
- Protected Member Functions inherited from makVrv::DtTickable
 DtTickable (DtTickableManagerInterface *manager)
 
 DtTickable ()
 
virtual void slot_managerAboutToBeDeleted ()
 

Protected Attributes

DtSceneObjectmySceneObject
 
float myLastWindSpeed
 
DtVector myLastPos
 
DtTime myLastTime
 
DtDoubleSmoother myFlagSpeedSmoother
 
const DtDisplayUnitsConvertermyConverter
 
osgSim::MultiSwitch * myWindSwitchNode
 
std::vector< doublemyWindSpeeds
 
std::vector< intmySwitchIndices
 
DtOsgArticulatedModelmyOsgArticulatedModel
 
DtSignalConnectionManager myConnections
 
DtCoordinateSystemmyCoordinateSystem = nullptr
 
- Protected Attributes inherited from makVrv::DtDynamicFeatureTickable
DtDemyDe
 
DtElementID myElementId
 
DtUniqueID mySceneObjectId
 
unsigned int myNodeTypeIndex
 
DtUniqueID myUniqueId
 
std::string myFeatureName
 
- Protected Attributes inherited from makVrv::DtTickable
DtTickableManagerInterfacemyManager
 
DtSignalConnectionManager myConnections
 
unsigned int myFrameCounter
 
unsigned int myFrameToUpdate
 
unsigned int myUpdatePeriod
 
DtTime myLastUpdateTime
 
bool myIsThreadSafe
 
TickableListState myTickableListState
 

Additional Inherited Members

- Public Types inherited from makVrv::DtTickable
enum  TickableListState { TickableNotOnList, TickableOnMainList, TickableOnThreadSafeList }
 

Constructor & Destructor Documentation

makVrv::DtShipFlagSwitchTickable::DtShipFlagSwitchTickable ( DtDe de,
DtElementID  elementId,
DtUniqueID  sceneObjectId,
DtUniqueID  uniqueId,
unsigned int  nodeTypeIndex,
DtOsgArticulatedModel osgArticulatedModel 
)

CTOR.

virtual makVrv::DtShipFlagSwitchTickable::~DtShipFlagSwitchTickable ( )
virtual

DTOR.

Member Function Documentation

DtVector makVrv::DtShipFlagSwitchTickable::computeWindVec ( DtSceneObject sceneObj,
float  windDirRad 
)

Convert the wind angle to a directional vector.

virtual void makVrv::DtShipFlagSwitchTickable::update ( DtTime  tNow)
virtual

Update the switch node based on the wind speed.

Implements makVrv::DtTickable.

void makVrv::DtShipFlagSwitchTickable::SetWindNodeSwitch ( double  windSpeed)
virtual bool makVrv::DtShipFlagSwitchTickable::needsUpdate ( DtTime  tNow)
virtual

The check function called by DtTickableManager to verify if an update is required.

If this function returns true, the DtTickableManager will then call update().

Parameters
[in]tNowis the current time-stamp.
Return values
trueif this object needs to be ticked.
falseotherwise.

Reimplemented from makVrv::DtTickable.

virtual void makVrv::DtShipFlagSwitchTickable::configure ( osg::Node *  n,
const rapidjson::Value &  windJsonData 
)
virtual

Configure the meta file tickable object.

unsigned int makVrv::DtShipFlagSwitchTickable::getSwitchIndexForSpeed ( double  windSpeed)

Get the switch index based on the wind speed (km/h)

virtual void makVrv::DtShipFlagSwitchTickable::modelToBeDestroyed ( DtModel model)
virtual

listen to the model to be destroyed signal

virtual void makVrv::DtShipFlagSwitchTickable::disconnectFromModel ( )
protectedvirtual

internal function to disconnect from the model

virtual void makVrv::DtShipFlagSwitchTickable::slot_coordinateSystemChanged ( )
protectedvirtual

slot for when the coordinate system changes

Member Data Documentation

const char* makVrv::DtShipFlagSwitchTickable::theShipFlagSwitchFeatureName
static

Strings to get the different parts of the meta file Use these instead of hardcoded strings.

const char* makVrv::DtShipFlagSwitchTickable::theTagWindSpeeds
static

Strings to get the different parts of the meta file Use these instead of hardcoded strings.

const char* makVrv::DtShipFlagSwitchTickable::theTagSwitchIndices
static

Strings to get the different parts of the meta file Use these instead of hardcoded strings.

DtSceneObject* makVrv::DtShipFlagSwitchTickable::mySceneObject
protected

The scene object.

float makVrv::DtShipFlagSwitchTickable::myLastWindSpeed
protected

Last update wind speed.

DtVector makVrv::DtShipFlagSwitchTickable::myLastPos
protected

Last position.

DtTime makVrv::DtShipFlagSwitchTickable::myLastTime
protected

Last update time.

DtDoubleSmoother makVrv::DtShipFlagSwitchTickable::myFlagSpeedSmoother
protected

Moving average of last 10 ship speeds.

const DtDisplayUnitsConverter& makVrv::DtShipFlagSwitchTickable::myConverter
protected

To convert the wind speed to display units (km/h)

osgSim::MultiSwitch* makVrv::DtShipFlagSwitchTickable::myWindSwitchNode
protected

The actual node that contains switch states.

std::vector<double> makVrv::DtShipFlagSwitchTickable::myWindSpeeds
protected

Windspeeds.

std::vector<int> makVrv::DtShipFlagSwitchTickable::mySwitchIndices
protected
DtOsgArticulatedModel* makVrv::DtShipFlagSwitchTickable::myOsgArticulatedModel
protected
DtSignalConnectionManager makVrv::DtShipFlagSwitchTickable::myConnections
protected
DtCoordinateSystem* makVrv::DtShipFlagSwitchTickable::myCoordinateSystem = nullptr
protected

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


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

Document ID: Generated on Sun Dec 4 20:22:03 EST 2022 from SVN revision 249613
Copyright © 2005-2021 MAK Technologies. All Rights Reserved (www.mak.com)