Example 30° Turnout Left/Right TypeA – step 0022 – December 2009
SrrTurnout(Left/Right)A can be used to create a 30° turnout of 545mm gauge within a module.
The graphical representation of the turnout will be created according to a double usage of the “ABI Track Geometry” and with the help of a small texture file.
Figure
1: Definition of the "ABI Track Geometry"
Figure
2: Texture file for display of a track element
The turnout geometry will be defined by the points A and B0 and by the radius R.
Figure
3: Definition of the geometry of a 30° turnout
The prototypes SrrTurnoutLeftA and SrrTurnoutRightA are external prototypes, available in the directory tg/.
They will require some prototypes of the SRR Framework and they will search them at ../srr/.
<ProtoDeclare name='SrrTurnout[Left|Right]A'>
<ProtoInterface>
<field accessType='inputOutput' name='objType' type='SFString' value='SrrTurnout(Left/Right)A'/>
<field accessType='inputOutput' name='version' type='SFFloat' value='0.0023'/>
<field accessType='inputOutput' name='objId' type='SFString'/>
<field accessType='inputOutput' name='vectorA' type='SFVec3f'/>
<field accessType='inputOutput' name='vectorB0' type='SFVec3f'/>
<field accessType='inputOutput' name='R' type='SFFloat'/>
<field accessType='inputOutput' name='neighbourA' type='SFString'/>
<field accessType='inputOutput' name='neighbourB0' type='SFString'/>
<field accessType='inputOutput' name='neighbourB1' type='SFString'/>
<field accessType='inputOutput' name='modParam' type='SFNode'/>
<field accessType='inputOutput' name='exitViewpoint' type='SFNode'/>
</ProtoInterface>
objId
The user sets the objId before initialization of the turnout object. The objId is unique within the module.
Turnout Geometry
The turnout geometry is defined by the parameters vectorA, vectorB0 and R, prior to initialization
Linking of track sections and turnouts
The names of the neighbour nodes are defined by the parameters neighbourA, neighbourB0 and neighbourB1, prior to initialization.
The own track nodes will get the object IDs <objId>.A, <objId>.B0 and <objId>.B1, respectively.
Initialization
The user forwards the modParam event from the SrrModCoord to the turnout to initialize the turnout.
Exit Viewpoint
The module author can assign an exit viewpoint to each turnout. The reference to this exit viewpoint will be forwarded to each vehicle passing this turnout. The vehicle model can bind this viewpoint, when the avatar exits (wants to exit) the vehicle.