Rise
The Vieneo Province
TurnByTurn Class Reference

#include <TurnByTurn.h>

Collaboration diagram for TurnByTurn:
[legend]

Public Member Functions

 TurnByTurn (Bus *pBus, Logger *pLoggger, Networking *pNetworking)
 
 ~TurnByTurn ()
 
void Update (bool pIsGrndVehicle, float pElasedTime)
 
void Draw (IDirect3DDevice9 *pd3dDevice)
 
void UpdateVB (IDirect3DDevice9 *pd3dDevice)
 
void CreateVB (IDirect3DDevice9 *pd3dDevice)
 
void LookAhead ()
 
void ReleaseResources ()
 

Private Types

enum  UpdateType {
  TYPE_APPROACHING_NEXT_NODE = 0, TYPE_NEXT_NODE = 1, TYPE_CONTINUE_TO_NEXT_NODE = 2, TYPE_RECALCULATING = 4,
  TYPE_NAVIGATION_COMPLETED = 5
}
 
enum  Direction {
  STRAIGHT = 0, BEAR_LEFT = 1, TURN_LEFT = 2, BEAR_RIGHT = 3,
  TURN_RIGHT = 4, U_TURN = 5
}
 
enum  State { APPROACHING_HEADING_CHANGE = 1, IN_HEADING_CHANGE = 2, COMPLETED_HEADING_CHANGE = 3 }
 

Private Member Functions

D3DXVECTOR2 convertWorldPositionToMapPosition (const D3DXVECTOR2 &pos)
 
void sendUpdateToServer (int pEdgeId, float pDistance, size_t pDirection, size_t pType)
 
float angleBetweenPositionsDeg (const D3DXVECTOR2 &vectorA, const D3DXVECTOR2 &vectorB)
 
float distanceBetweenPositions (const D3DXVECTOR2 &vectorA, const D3DXVECTOR2 &vectorB)
 
float convertDistanceToMeters (float dist)
 
float vectorToDegrees (const D3DXVECTOR2 &vec)
 
float getHeadingChange (float targetHeading, float currentHeading)
 
float customModulo (float a, float n)
 
void checkForCue ()
 
void updateHeadingState ()
 

Private Attributes

const float cReachedWaypointThreshold = 0.005f
 
const float cDistanceBetweenCues = 0.02f
 
const float cDistanceToCheckAhead = 0.8f
 
const float cDirectionChangeThreshold = 30.0f
 
const float cWaitDistanceAfterHeadingChangeForNextCheck = -0.006f
 
const float sectorSize = 682.666666667f
 
const float mapStartTcpU = 519.0f
 
const float mapStartTcpV = 1101.0f
 
Busbus = nullptr
 
Loggerlogger = nullptr
 
Networkingnetworking = nullptr
 
LPDIRECT3DVERTEXBUFFER9 m_avRouteMap = nullptr
 
D3DXVECTOR2 vehiclePos
 
D3DXVECTOR2 lastVehiclePos { 0.0f , 0.0f }
 
float distanceTraveled = 0.0f
 
float mapMagnifier = 0.0f
 
float elapsedCounter = 0.0f
 
float distanceTraveledAtLastCue = 0.0f
 
float distanceUntilFirstHeadingChange = 0.0f
 
float distanceUntilAfterFirstHeadingChange = 0.0f
 
float firstHeadingChangeDegrees = 0.0f
 
size_t firstHeadingChangeDirection = 0
 
int edgeIdAfterFirstHeadingChange = 0
 
bool nextNodeUpdateSent = false
 
float approachingNodeLastDistanceSent = 0.0f
 
int headingChangeStartWaypointIndex = -1
 
int headingChangeEndWaypointIndex = -1
 
int headingState = 0
 
size_t closestWaypointIndex = 0
 
size_t activeWaypointIndex = 0
 
size_t nextWaypointIndex = 0
 
size_t lineCount = 0
 

Detailed Description

Definition at line 7 of file TurnByTurn.h.

Member Enumeration Documentation

◆ Direction

enum TurnByTurn::Direction
private
Enumerator
STRAIGHT 
BEAR_LEFT 
TURN_LEFT 
BEAR_RIGHT 
TURN_RIGHT 
U_TURN 

Definition at line 61 of file TurnByTurn.h.

◆ State

enum TurnByTurn::State
private
Enumerator
APPROACHING_HEADING_CHANGE 
IN_HEADING_CHANGE 
COMPLETED_HEADING_CHANGE 

Definition at line 72 of file TurnByTurn.h.

◆ UpdateType

enum TurnByTurn::UpdateType
private
Enumerator
TYPE_APPROACHING_NEXT_NODE 
TYPE_NEXT_NODE 
TYPE_CONTINUE_TO_NEXT_NODE 
TYPE_RECALCULATING 
TYPE_NAVIGATION_COMPLETED 

Definition at line 52 of file TurnByTurn.h.

Constructor & Destructor Documentation

◆ TurnByTurn()

TurnByTurn::TurnByTurn ( Bus pBus,
Logger pLoggger,
Networking pNetworking 
)

Definition at line 7 of file TurnByTurn.cpp.

Here is the call graph for this function:

◆ ~TurnByTurn()

TurnByTurn::~TurnByTurn ( )

Definition at line 14 of file TurnByTurn.cpp.

Member Function Documentation

◆ angleBetweenPositionsDeg()

float TurnByTurn::angleBetweenPositionsDeg ( const D3DXVECTOR2 &  vectorA,
const D3DXVECTOR2 &  vectorB 
)
private

Definition at line 320 of file TurnByTurn.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ checkForCue()

void TurnByTurn::checkForCue ( )
private

Definition at line 362 of file TurnByTurn.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ convertDistanceToMeters()

float TurnByTurn::convertDistanceToMeters ( float  dist)
private

Definition at line 344 of file TurnByTurn.cpp.

◆ convertWorldPositionToMapPosition()

D3DXVECTOR2 TurnByTurn::convertWorldPositionToMapPosition ( const D3DXVECTOR2 &  pos)
private

Definition at line 204 of file TurnByTurn.cpp.

Here is the caller graph for this function:

◆ CreateVB()

void TurnByTurn::CreateVB ( IDirect3DDevice9 *  pd3dDevice)

Definition at line 151 of file TurnByTurn.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ customModulo()

float TurnByTurn::customModulo ( float  a,
float  n 
)
private

Definition at line 358 of file TurnByTurn.cpp.

Here is the caller graph for this function:

◆ distanceBetweenPositions()

float TurnByTurn::distanceBetweenPositions ( const D3DXVECTOR2 &  vectorA,
const D3DXVECTOR2 &  vectorB 
)
private

Definition at line 339 of file TurnByTurn.cpp.

Here is the caller graph for this function:

◆ Draw()

void TurnByTurn::Draw ( IDirect3DDevice9 *  pd3dDevice)

Definition at line 121 of file TurnByTurn.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getHeadingChange()

float TurnByTurn::getHeadingChange ( float  targetHeading,
float  currentHeading 
)
private

Definition at line 350 of file TurnByTurn.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ LookAhead()

void TurnByTurn::LookAhead ( )

Definition at line 247 of file TurnByTurn.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ReleaseResources()

void TurnByTurn::ReleaseResources ( )

Definition at line 227 of file TurnByTurn.cpp.

Here is the caller graph for this function:

◆ sendUpdateToServer()

void TurnByTurn::sendUpdateToServer ( int  pEdgeId,
float  pDistance,
size_t  pDirection,
size_t  pType 
)
private

Definition at line 232 of file TurnByTurn.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ Update()

void TurnByTurn::Update ( bool  pIsGrndVehicle,
float  pElasedTime 
)

Definition at line 18 of file TurnByTurn.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ updateHeadingState()

void TurnByTurn::updateHeadingState ( )
private

Definition at line 390 of file TurnByTurn.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ UpdateVB()

void TurnByTurn::UpdateVB ( IDirect3DDevice9 *  pd3dDevice)

Definition at line 165 of file TurnByTurn.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ vectorToDegrees()

float TurnByTurn::vectorToDegrees ( const D3DXVECTOR2 &  vec)
private

Definition at line 327 of file TurnByTurn.cpp.

Here is the caller graph for this function:

Member Data Documentation

◆ activeWaypointIndex

size_t TurnByTurn::activeWaypointIndex = 0
private

Definition at line 48 of file TurnByTurn.h.

◆ approachingNodeLastDistanceSent

float TurnByTurn::approachingNodeLastDistanceSent = 0.0f
private

Definition at line 42 of file TurnByTurn.h.

◆ bus

Bus* TurnByTurn::bus = nullptr
private

Definition at line 26 of file TurnByTurn.h.

◆ cDirectionChangeThreshold

const float TurnByTurn::cDirectionChangeThreshold = 30.0f
private

Definition at line 17 of file TurnByTurn.h.

◆ cDistanceBetweenCues

const float TurnByTurn::cDistanceBetweenCues = 0.02f
private

Definition at line 13 of file TurnByTurn.h.

◆ cDistanceToCheckAhead

const float TurnByTurn::cDistanceToCheckAhead = 0.8f
private

Definition at line 15 of file TurnByTurn.h.

◆ closestWaypointIndex

size_t TurnByTurn::closestWaypointIndex = 0
private

Definition at line 47 of file TurnByTurn.h.

◆ cReachedWaypointThreshold

const float TurnByTurn::cReachedWaypointThreshold = 0.005f
private

Definition at line 11 of file TurnByTurn.h.

◆ cWaitDistanceAfterHeadingChangeForNextCheck

const float TurnByTurn::cWaitDistanceAfterHeadingChangeForNextCheck = -0.006f
private

Definition at line 19 of file TurnByTurn.h.

◆ distanceTraveled

float TurnByTurn::distanceTraveled = 0.0f
private

Definition at line 32 of file TurnByTurn.h.

◆ distanceTraveledAtLastCue

float TurnByTurn::distanceTraveledAtLastCue = 0.0f
private

Definition at line 35 of file TurnByTurn.h.

◆ distanceUntilAfterFirstHeadingChange

float TurnByTurn::distanceUntilAfterFirstHeadingChange = 0.0f
private

Definition at line 37 of file TurnByTurn.h.

◆ distanceUntilFirstHeadingChange

float TurnByTurn::distanceUntilFirstHeadingChange = 0.0f
private

Definition at line 36 of file TurnByTurn.h.

◆ edgeIdAfterFirstHeadingChange

int TurnByTurn::edgeIdAfterFirstHeadingChange = 0
private

Definition at line 40 of file TurnByTurn.h.

◆ elapsedCounter

float TurnByTurn::elapsedCounter = 0.0f
private

Definition at line 34 of file TurnByTurn.h.

◆ firstHeadingChangeDegrees

float TurnByTurn::firstHeadingChangeDegrees = 0.0f
private

Definition at line 38 of file TurnByTurn.h.

◆ firstHeadingChangeDirection

size_t TurnByTurn::firstHeadingChangeDirection = 0
private

Definition at line 39 of file TurnByTurn.h.

◆ headingChangeEndWaypointIndex

int TurnByTurn::headingChangeEndWaypointIndex = -1
private

Definition at line 44 of file TurnByTurn.h.

◆ headingChangeStartWaypointIndex

int TurnByTurn::headingChangeStartWaypointIndex = -1
private

Definition at line 43 of file TurnByTurn.h.

◆ headingState

int TurnByTurn::headingState = 0
private

Definition at line 45 of file TurnByTurn.h.

◆ lastVehiclePos

D3DXVECTOR2 TurnByTurn::lastVehiclePos { 0.0f , 0.0f }
private

Definition at line 31 of file TurnByTurn.h.

◆ lineCount

size_t TurnByTurn::lineCount = 0
private

Definition at line 50 of file TurnByTurn.h.

◆ logger

Logger* TurnByTurn::logger = nullptr
private

Definition at line 27 of file TurnByTurn.h.

◆ m_avRouteMap

LPDIRECT3DVERTEXBUFFER9 TurnByTurn::m_avRouteMap = nullptr
private

Definition at line 29 of file TurnByTurn.h.

◆ mapMagnifier

float TurnByTurn::mapMagnifier = 0.0f
private

Definition at line 33 of file TurnByTurn.h.

◆ mapStartTcpU

const float TurnByTurn::mapStartTcpU = 519.0f
private

Definition at line 23 of file TurnByTurn.h.

◆ mapStartTcpV

const float TurnByTurn::mapStartTcpV = 1101.0f
private

Definition at line 24 of file TurnByTurn.h.

◆ networking

Networking* TurnByTurn::networking = nullptr
private

Definition at line 28 of file TurnByTurn.h.

◆ nextNodeUpdateSent

bool TurnByTurn::nextNodeUpdateSent = false
private

Definition at line 41 of file TurnByTurn.h.

◆ nextWaypointIndex

size_t TurnByTurn::nextWaypointIndex = 0
private

Definition at line 49 of file TurnByTurn.h.

◆ sectorSize

const float TurnByTurn::sectorSize = 682.666666667f
private

Definition at line 22 of file TurnByTurn.h.

◆ vehiclePos

D3DXVECTOR2 TurnByTurn::vehiclePos
private

Definition at line 30 of file TurnByTurn.h.


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