Model Railroad System  2.2.1
Classes | Public Types | Public Member Functions | Static Public Member Functions | Private Attributes | Static Private Attributes | Friends | List of all members
Parsers::TurnoutBodyElt Class Reference

Turnout body elements: T, E, P, S, C, and J lines are collected. More...

#include <TurnoutBody.h>

Classes

struct  Pos
 Position structure. More...
 

Public Types

enum  TurnoutBodyEltType {
  None, TurnoutEnd, TurnoutRoute, TurnoutStraightSegment,
  TurnoutCurveSegment, TurnoutJointSegment
}
 Element types. More...
 

Public Member Functions

 TurnoutBodyElt ()
 Constructor. More...
 
 ~TurnoutBodyElt ()
 Destructor. More...
 
TurnoutBodyEltType TheType () const
 Type accessor. More...
 
void GetTurnoutRoute (char *&pName, IntegerList *&cList) const
 Fetch turnout route data. More...
 
int GetTurnoutStraightSegment (float &x1, float &y1, float &x2, float &y2) const
 Fetch turnout straight segment data. More...
 
int GetTurnoutCurveSegment (float &r, float &x, float &y, float &a0, float &a1) const
 Fetch turnout curve segment data. More...
 
int GetTurnoutJointSegment (float &x, float &y, float &a, float &l0, float &l1, float &r, float &l) const
 Fetch turnout joint segment data. More...
 

Static Public Member Functions

static void InitTSegId ()
 Segment count initializer. More...
 
static TurnoutBodyEltMakeTurnoutEnd (TrackBodyElt *tbe)
 Create an endpoint (T or E lines). More...
 
static TurnoutBodyEltMakeTurnoutRoute (char *pName, IntegerList *cList)
 Create a turnout route (P lines). More...
 
static TurnoutBodyEltMakeTurnoutStraightSegment (float x1, float y1, float x2, float y2)
 Create a turnout straight segment (S lines). More...
 
static TurnoutBodyEltMakeTurnoutCurveSegment (float r, float x, float y, float a0, float a1)
 Create a turnout curve segment (C lines). More...
 
static TurnoutBodyEltMakeTurnoutJointSegment (float x, float y, float a, float l0, float l1, float r, float l)
 Create a turnout joint segment (J lines). More...
 

Private Attributes

TurnoutBodyEltType theType
 Element type. More...
 
TrackBodyElttheEnd
 Pointer to T or E line data. More...
 
char * RouteName
 Route name (P lines). More...
 
IntegerListrouteList
 Segment list (P Lines). More...
 
int segmentId
 Segment index (S, C, or J lines). More...
 
Pos pos1
 First position. More...
 
Pos pos2
 Second position. More...
 
float radius
 A radius value. More...
 
float ang0
 An angle value. More...
 
float ang1
 Another angle value. More...
 
float R
 $R$ value (for J lines). More...
 
float L
 $L$ value (for J lines). More...
 

Static Private Attributes

static int segCount
 Counter for S, C, and J segments. More...
 

Friends

class TrackGraph
 
class TurnoutBody
 

Detailed Description

Turnout body elements: T, E, P, S, C, and J lines are collected.

others are discarded.

Author
Robert Heller <heller@deepsoft.com>

Member Enumeration Documentation

◆ TurnoutBodyEltType

Element types.

Enumerator
None 

Placeholder.

TurnoutEnd 

T or E line.

TurnoutRoute 

P line.

TurnoutStraightSegment 

S line.

TurnoutCurveSegment 

C line.

TurnoutJointSegment 

J Line.

Constructor & Destructor Documentation

◆ TurnoutBodyElt()

Parsers::TurnoutBodyElt::TurnoutBodyElt ( )
inline

Constructor.

◆ ~TurnoutBodyElt()

Parsers::TurnoutBodyElt::~TurnoutBodyElt ( )
inline

Destructor.

Member Function Documentation

◆ GetTurnoutCurveSegment()

int Parsers::TurnoutBodyElt::GetTurnoutCurveSegment ( float &  r,
float &  x,
float &  y,
float &  a0,
float &  a1 
) const
inline

Fetch turnout curve segment data.

References Parsers::TurnoutBodyElt::Pos::x, and Parsers::TurnoutBodyElt::Pos::y.

◆ GetTurnoutJointSegment()

int Parsers::TurnoutBodyElt::GetTurnoutJointSegment ( float &  x,
float &  y,
float &  a,
float &  l0,
float &  l1,
float &  r,
float &  l 
) const
inline

Fetch turnout joint segment data.

References angle, len0, len1, Parsers::TurnoutBodyElt::Pos::x, and Parsers::TurnoutBodyElt::Pos::y.

◆ GetTurnoutRoute()

void Parsers::TurnoutBodyElt::GetTurnoutRoute ( char *&  pName,
IntegerList *&  cList 
) const
inline

Fetch turnout route data.

◆ GetTurnoutStraightSegment()

int Parsers::TurnoutBodyElt::GetTurnoutStraightSegment ( float &  x1,
float &  y1,
float &  x2,
float &  y2 
) const
inline

Fetch turnout straight segment data.

References Parsers::TurnoutBodyElt::Pos::x, and Parsers::TurnoutBodyElt::Pos::y.

◆ InitTSegId()

static void Parsers::TurnoutBodyElt::InitTSegId ( )
inlinestatic

Segment count initializer.

◆ MakeTurnoutCurveSegment()

static TurnoutBodyElt* Parsers::TurnoutBodyElt::MakeTurnoutCurveSegment ( float  r,
float  x,
float  y,
float  a0,
float  a1 
)
inlinestatic

Create a turnout curve segment (C lines).

References ang0, ang1, pos1, radius, segmentId, theType, Parsers::TurnoutBodyElt::Pos::x, and Parsers::TurnoutBodyElt::Pos::y.

◆ MakeTurnoutEnd()

static TurnoutBodyElt* Parsers::TurnoutBodyElt::MakeTurnoutEnd ( TrackBodyElt tbe)
inlinestatic

Create an endpoint (T or E lines).

References theEnd, and theType.

◆ MakeTurnoutJointSegment()

static TurnoutBodyElt* Parsers::TurnoutBodyElt::MakeTurnoutJointSegment ( float  x,
float  y,
float  a,
float  l0,
float  l1,
float  r,
float  l 
)
inlinestatic

Create a turnout joint segment (J lines).

References L, pos1, R, segmentId, theType, Parsers::TurnoutBodyElt::Pos::x, and Parsers::TurnoutBodyElt::Pos::y.

◆ MakeTurnoutRoute()

static TurnoutBodyElt* Parsers::TurnoutBodyElt::MakeTurnoutRoute ( char *  pName,
IntegerList cList 
)
inlinestatic

Create a turnout route (P lines).

References routeList, RouteName, and theType.

◆ MakeTurnoutStraightSegment()

static TurnoutBodyElt* Parsers::TurnoutBodyElt::MakeTurnoutStraightSegment ( float  x1,
float  y1,
float  x2,
float  y2 
)
inlinestatic

Create a turnout straight segment (S lines).

References pos1, pos2, segmentId, theType, Parsers::TurnoutBodyElt::Pos::x, and Parsers::TurnoutBodyElt::Pos::y.

◆ TheType()

TurnoutBodyEltType Parsers::TurnoutBodyElt::TheType ( ) const
inline

Type accessor.

Friends And Related Function Documentation

◆ TrackGraph

friend class TrackGraph
friend

◆ TurnoutBody

friend class TurnoutBody
friend

Member Data Documentation

◆ ang0

float Parsers::TurnoutBodyElt::ang0
private

An angle value.

Referenced by MakeTurnoutCurveSegment().

◆ ang1

float Parsers::TurnoutBodyElt::ang1
private

Another angle value.

Referenced by MakeTurnoutCurveSegment().

◆ L

float Parsers::TurnoutBodyElt::L
private

$L$ value (for J lines).

Referenced by MakeTurnoutJointSegment().

◆ pos1

Pos Parsers::TurnoutBodyElt::pos1
private

◆ pos2

Pos Parsers::TurnoutBodyElt::pos2
private

Second position.

Referenced by MakeTurnoutStraightSegment().

◆ R

float Parsers::TurnoutBodyElt::R
private

$R$ value (for J lines).

Referenced by MakeTurnoutJointSegment().

◆ radius

float Parsers::TurnoutBodyElt::radius
private

A radius value.

Referenced by MakeTurnoutCurveSegment().

◆ routeList

IntegerList* Parsers::TurnoutBodyElt::routeList
private

Segment list (P Lines).

Referenced by MakeTurnoutRoute().

◆ RouteName

char* Parsers::TurnoutBodyElt::RouteName
private

Route name (P lines).

Referenced by MakeTurnoutRoute().

◆ segCount

int Parsers::TurnoutBodyElt::segCount
staticprivate

Counter for S, C, and J segments.

◆ segmentId

int Parsers::TurnoutBodyElt::segmentId
private

Segment index (S, C, or J lines).

Referenced by MakeTurnoutCurveSegment(), MakeTurnoutJointSegment(), and MakeTurnoutStraightSegment().

◆ theEnd

TrackBodyElt* Parsers::TurnoutBodyElt::theEnd
private

◆ theType

TurnoutBodyEltType Parsers::TurnoutBodyElt::theType
private