Model Railroad System  2.2.1
Public Member Functions | Private Member Functions | Private Attributes | Static Private Attributes | List of all members
CTCPanel::SWPlate Class Reference

Switch plate object type. More...

Public Member Functions

 SWPlate (name, _ctcpanel, _canvas,...)
 Construct a SWPlate object. More...
 
 ~SWPlate ()
 Clean up all data objects and free up all resources. More...
 
 getv ()
 Method to get our value (lever position). More...
 
 setv (state)
 Method to set out value (level position). More...
 
 geti (ind)
 Method to get the state of one of our indicators. More...
 
 seti (ind, value)
 Method to set an indicator's state. More...
 
 invoke ()
 Method to invoke the switch plate. More...
 

Private Member Functions

 _configureLabel (option, value)
 Method to update the label option. More...
 

Private Attributes

 ctcpanel
 The CTC Panel component (parent widget). More...
 
 canvas
 The canvas component (parent widget component). More...
 

Static Private Attributes

static _PlatePolygon
 Polygon coordinates for the plate. More...
 

Detailed Description

Switch plate object type.

These are on the control panel and represent levers for controlling track switches (aka turnouts). They have a lever that can be in two positions, normal (switch aligned for the main route) and reversed (switch aligned for the divergent route).

Parameters
_ctcpanelThe CTCPanel megawidget.
_canvasThe control panel canvas to draw the switch plate on.
...Options:
  • -x The x coordinate of the object (readonly, default 0).
  • -y The y coordinate of the object (readonly, default 0).
  • -label The label of the switch plate (default 1).
  • -controlpoint The name of the control point this switch is part of (readonly, default CP1).
  • -normalcommand The Tcl script to run when switch is set to normal (default {}).
  • -reversecommand The Tcl script to run when switch is set to reverse (default {}).
Defined coords terminals:
  • xy The base coords of the object.
Defined values (states):
  • N Normal.
  • R Reversed.
Defined indicators:
  • N Normal indicator (green if on).
  • R Reversed indicator (yellow if on).
Author
Robert Heller <heller@deepsoft.com>

Constructor & Destructor Documentation

◆ SWPlate()

CTCPanel::SWPlate::SWPlate ( name  ,
_ctcpanel  ,
_canvas  ,
  ... 
)

Construct a SWPlate object.

Parameters
_ctcpanelThe CTCPanel megawidget.
_canvasThe control panel canvas to draw the switch plate on.
...Option list.

◆ ~SWPlate()

CTCPanel::SWPlate::~SWPlate ( )

Clean up all data objects and free up all resources.

Member Function Documentation

◆ _configureLabel()

CTCPanel::SWPlate::_configureLabel ( option  ,
value   
)
private

Method to update the label option.

◆ geti()

CTCPanel::SWPlate::geti ( ind  )

Method to get the state of one of our indicators.

Parameters
indThe indicator to fetch state information for.

◆ getv()

CTCPanel::SWPlate::getv ( )

Method to get our value (lever position).

◆ invoke()

CTCPanel::SWPlate::invoke ( )

Method to invoke the switch plate.

One of the command scripts is executed depending on the lever position.

◆ seti()

CTCPanel::SWPlate::seti ( ind  ,
value   
)

Method to set an indicator's state.

Parameters
indThe indicator to set.
valueThe state to set it to.

◆ setv()

CTCPanel::SWPlate::setv ( state  )

Method to set out value (level position).

Parameters
stateThe new state to set.

Member Data Documentation

◆ _PlatePolygon

CTCPanel::SWPlate::_PlatePolygon
staticprivate

Polygon coordinates for the plate.

◆ canvas

CTCPanel::SWPlate::canvas
private

The canvas component (parent widget component).

◆ ctcpanel

CTCPanel::SWPlate::ctcpanel
private

The CTC Panel component (parent widget).