Model Railroad System
2.2.1
|
File to parse an XTrkCad layout file and create a track graph. More...
#include <ParseFile.h>
Public Member Functions | |
LayoutFile (const char *filename, MRRXtrkCad *p) | |
Constructor. More... | |
virtual | ~LayoutFile () |
Destructor. More... | |
void | Emit (ostream &outstream) |
Function to Emit a track graph to an output stream. More... | |
bool | IsNodeP (int nid) const |
Tests if a node id exists in the graph. More... | |
int | NumEdges (int nid) const |
Returns the number of edges for the specificed node id. More... | |
int | EdgeIndex (int nid, int edgenum) const |
Returns the node id of the specificed edge of the node. More... | |
float | EdgeX (int nid, int edgenum) const |
Returns the $X$ coordinate of the specificed edge of the node. More... | |
float | EdgeY (int nid, int edgenum) const |
Returns the $Y$ coordinate of the specificed edge of the node. More... | |
float | EdgeA (int nid, int edgenum) const |
Returns the angle of the specificed edge of the node. More... | |
float | EdgeLength (int nid, int edgenum) const |
Returns the length of an edge. More... | |
TrackGraph::NodeType | TypeOfNode (int nid) const |
Returns the type of the node. More... | |
const TurnoutGraphic * | NodeTurnoutGraphic (int nid) const |
Returns the TurnoutGraphic of the node. More... | |
const TurnoutRoutelist * | NodeTurnoutRoutelist (int nid) const |
Returns the TurnoutRoutelist of the node. More... | |
float | LengthOfNode (int nid) const |
Return the track length of a node. More... | |
const IntegerList * | TrackList (int nid) const |
Return a block's tracklist. More... | |
int | TurnoutNumber (int nid) const |
Return a switchmotor's turnout number. More... | |
const char * | NameOfNode (int nid) const |
Return a block's or switchmotor's name. More... | |
const char * | SenseScript (int nid) const |
Return a block's or switchmotor's sense script. More... | |
const char * | NormalActionScript (int nid) const |
Return a switchmotor's normal action script. More... | |
const char * | ReverseActionScript (int nid) const |
Return a block's or switchmotor's reverse action script. More... | |
int | NumberOfHeads (int nid) const |
Return a Signal's number of heads. More... | |
const StringPairList * | SignalAspects (int nid) const |
Return a Signal's aspect list. More... | |
float | OrigX (int nid) const |
Return the $x$ coordinate of the signal base. More... | |
float | OrigY (int nid) const |
Return the $y$ coordinate of the signal base. More... | |
float | Angle (int nid) const |
Return the angle of the signal. More... | |
const char * | OnScript (int nid) const |
Return the on action script. More... | |
const char * | OffScript (int nid) const |
Return the off action script. More... | |
int | LowestNode () const |
Returns the lowest numbered node id. More... | |
int | HighestNode () const |
Returns the highest numbered node id. More... | |
void | CompressGraph () |
Create a compressed graph. More... | |
int | CompressedEdgeCount (int cnid) const |
Number of compressed graph edges. More... | |
float | CompressedEdgeLength (int cnid, int edgenum) const |
Length of a compressed graph edge. More... | |
int | CompressedEdgeNode (int cnid, int edgenum) const |
Next Edge node. More... | |
IntegerList * | CompressedNodeSegments (int cnid) const |
Raw nodes in a compressed graph node. More... | |
bool | IsCompressed () const |
const IntegerList * | Heads () |
bool | IsCompressedNode (int cnid) const |
Is cid a node in the compressed graph? More... | |
const IntegerList * | Roots () |
Compressed graph roots. More... | |
double | CompressedNodePositionX (int cnid) const |
X Coordinate of a Compressed Node position. More... | |
double | CompressedNodePositionY (int cnid) const |
X Coordinate of a Compressed Node position. More... | |
void | CompressedGraphCircleLayout (double radius) |
Run the BGL circle_graph_layout for a given radius. More... | |
bool | CompressedGraphKamadaKawaiSpring (double sidelength) |
Run the BGL kamada_kawai_spring_layout for a given side length. More... | |
TrackGraph::CompressedEdgePairVector | CompressedGraphKruskalMinimumSpanningTree () |
Run the kruskal_minimum_spanning_tree algorithm and return a vector of edge pairs. More... | |
TrackGraph::CompressedEdgePairVector | CompressedGraphPrimMinimumSpanningTree () |
Run the prim_minimum_spanning_tree algorithm and return a vector of edge pairs. More... | |
![]() | |
const char * | SourceFile () const |
Return the name of the source file. More... | |
ParseFile (const char *filename) | |
Constructor. More... | |
virtual | ~ParseFile () |
Destructor. More... | |
int | ProcessFile (ostream &err) |
open file and parse it. More... | |
Protected Member Functions | |
virtual int | Parse () |
Parseer function. More... | |
virtual void | ParseError (const char *m) |
Parse error handler. More... | |
Protected Attributes | |
MRRXtrkCad * | parser |
Parser. More... | |
TrackGraph * | trackGraph |
Track graph, a graph of all of the trackwork in the layput file. More... | |
![]() | |
char * | lp |
Input line buffer pointer. More... | |
FILE * | fp |
Input file pointer. More... | |
int | source_line |
Source line number. More... | |
char | line_buffer [buffersize] |
Input line buffer. More... | |
ostream * | errorstream |
Stream for error reporting. More... | |
char * | source_file |
Name of the source file. More... | |
Additional Inherited Members | |
![]() | |
static const int | buffersize = 1024 |
Size of line buffer. More... | |
File to parse an XTrkCad layout file and create a track graph.
Parsers::LayoutFile::LayoutFile | ( | const char * | filename, |
MRRXtrkCad * | p | ||
) |
Constructor.
See MRRXtrkCad. User code normally creates a MRRXtrkCad object and the MRRXtrkCad constructor calls this constructor. User code then accesses the inherited methods of LayoutFile and ParseFile from the MRRXtrkCad object.
|
virtual |
Destructor.
|
inline |
Return the angle of the signal.
nid | The node to look at. |
References Parsers::TrackGraph::Angle().
|
inline |
Number of compressed graph edges.
References Parsers::TrackGraph::CompressedEdgeCount().
|
inline |
Length of a compressed graph edge.
References Parsers::TrackGraph::CompressedEdgeLength().
|
inline |
Next Edge node.
References Parsers::TrackGraph::CompressedEdgeNode().
|
inline |
Run the BGL circle_graph_layout for a given radius.
References Parsers::TrackGraph::CompressedGraphCircleLayout().
|
inline |
Run the BGL kamada_kawai_spring_layout for a given side length.
References Parsers::TrackGraph::CompressedGraphKamadaKawaiSpring().
|
inline |
Run the kruskal_minimum_spanning_tree algorithm and return a vector of edge pairs.
References Parsers::TrackGraph::CompressedGraphKruskalMinimumSpanningTree().
|
inline |
Run the prim_minimum_spanning_tree algorithm and return a vector of edge pairs.
References Parsers::TrackGraph::CompressedGraphPrimMinimumSpanningTree().
|
inline |
X Coordinate of a Compressed Node position.
References Parsers::TrackGraph::CompressedNodePositionX().
|
inline |
X Coordinate of a Compressed Node position.
References Parsers::TrackGraph::CompressedNodePositionY().
|
inline |
Raw nodes in a compressed graph node.
References Parsers::TrackGraph::CompressedNodeSegments().
|
inline |
Create a compressed graph.
References Parsers::TrackGraph::CompressGraph().
|
inline |
Returns the angle of the specificed edge of the node.
References Parsers::TrackGraph::EdgeA().
|
inline |
Returns the node id of the specificed edge of the node.
References Parsers::TrackGraph::EdgeIndex().
|
inline |
Returns the length of an edge.
References Parsers::TrackGraph::EdgeLength().
|
inline |
Returns the $X$ coordinate of the specificed edge of the node.
References Parsers::TrackGraph::EdgeX().
|
inline |
Returns the $Y$ coordinate of the specificed edge of the node.
References Parsers::TrackGraph::EdgeY().
void Parsers::LayoutFile::Emit | ( | ostream & | outstream | ) |
Function to Emit a track graph to an output stream.
outstream | The output stream to write the graph to. |
|
inline |
References Parsers::TrackGraph::Heads().
|
inline |
Returns the highest numbered node id.
References Parsers::TrackGraph::HighestNode().
|
inline |
References Parsers::TrackGraph::IsCompressed().
|
inline |
Is cid a node in the compressed graph?
References Parsers::TrackGraph::IsCompressedNode().
|
inline |
Tests if a node id exists in the graph.
References Parsers::TrackGraph::IsNodeP().
|
inline |
Return the track length of a node.
References Parsers::TrackGraph::LengthOfNode().
|
inline |
Returns the lowest numbered node id.
References Parsers::TrackGraph::LowestNode().
|
inline |
Return a block's or switchmotor's name.
References Parsers::TrackGraph::NameOfNode().
|
inline |
Returns the TurnoutGraphic of the node.
References Parsers::TrackGraph::NodeTurnoutGraphic().
|
inline |
Returns the TurnoutRoutelist of the node.
References Parsers::TrackGraph::NodeTurnoutRoutelist().
|
inline |
Return a switchmotor's normal action script.
References Parsers::TrackGraph::NormalActionScript().
|
inline |
Return a Signal's number of heads.
References Parsers::TrackGraph::NumberOfHeads().
|
inline |
Returns the number of edges for the specificed node id.
References Parsers::TrackGraph::NumEdges().
|
inline |
Return the off action script.
nid | The node to look at. |
References Parsers::TrackGraph::OffScript().
|
inline |
Return the on action script.
nid | The node to look at. |
References Parsers::TrackGraph::OnScript().
|
inline |
Return the $x$ coordinate of the signal base.
nid | The node to look at. |
References Parsers::TrackGraph::OrigX().
|
inline |
Return the $y$ coordinate of the signal base.
nid | The node to look at. |
References Parsers::TrackGraph::OrigY().
|
protectedvirtual |
Parseer function.
Implements Parsers::ParseFile.
|
protectedvirtual |
Parse error handler.
Implements Parsers::ParseFile.
|
inline |
Return a block's or switchmotor's reverse action script.
References Parsers::TrackGraph::ReverseActionScript().
|
inline |
Compressed graph roots.
References Parsers::TrackGraph::Roots().
|
inline |
Return a block's or switchmotor's sense script.
References Parsers::TrackGraph::SenseScript().
|
inline |
Return a Signal's aspect list.
References Parsers::TrackGraph::SignalAspects().
|
inline |
Return a block's tracklist.
References Parsers::TrackGraph::TrackList().
|
inline |
Return a switchmotor's turnout number.
References Parsers::TrackGraph::TurnoutNumber().
|
inline |
Returns the type of the node.
References Parsers::TrackGraph::TypeOfNode().
|
protected |
Parser.
|
protected |
Track graph, a graph of all of the trackwork in the layput file.