Castle Game Engine: X3DNodes: Class TX3DRoute

# Class TX3DRoute
Description | Hierarchy | Fields | Methods | Properties
## Unit X3DNodes ## Declaration `type TX3DRoute = class(TX3DFileItem)` ## Description no description available, TX3DFileItem description follows Base class for any item within VRML/X3D file: a node, a field, a route, a prototype etc. We need a common base class for all such things to store PositionInParent. About ancestry: TX3DFieldOrEvent make use of Assign mechanism and so need to descend from TPersistent. TX3DNode make use of interfaces and so must descend from something like TNonRefCountedInterfacedXxx. These are the only reasons, for now, why this descends from TNonRefCountedInterfacedPersistent. ## Hierarchy TPersistent TNonRefCountedInterfacedPersistent TX3DFileItem TX3DRoute ## Overview ### Methods
| `constructor Create;`
| `destructor Destroy; override;`
| `procedure SetSource( const SourceNodeName, SourceFieldOrEventName: string; Reader: TX3DReaderNames);`
| `procedure SetDestination( const DestinationNodeName, DestinationFieldOrEventName: string; Reader: TX3DReaderNames);`
| `procedure SetSourceDirectly( const NewNode: TX3DNode; const FieldOrEvent: TX3DFieldOrEvent);`
| `procedure SetDestinationDirectly( const NewNode: TX3DNode; const FieldOrEvent: TX3DFieldOrEvent);`
| `procedure SetSourceDirectly(const FieldOrEvent: TX3DFieldOrEvent);`
| `procedure SetDestinationDirectly(const FieldOrEvent: TX3DFieldOrEvent);`
| `procedure Parse(Lexer: TX3DLexer; Reader: TX3DReaderNames);`
| `procedure ParseXML(Element: TDOMElement; Reader: TX3DReaderNames);`
| `procedure SaveToStream(Writer: TX3DWriter); override;`
| `procedure ResetLastEventTime;`
| `function DeepCopy(CopyState: TX3DNodeDeepCopyState): TX3DRoute;`
### Properties
| `property SourceNode: TX3DNode read FSourceNode;`
| `property SourceEvent: TX3DEvent read FSourceEvent;`
| `property DestinationNode: TX3DNode read FDestinationNode;`
| `property DestinationEvent: TX3DEvent read FDestinationEvent;`
| `property Internal: boolean read FInternal write FInternal default false;`
## Description ### Methods
| `constructor Create;`
| `destructor Destroy; override;`
| `procedure SetSource( const SourceNodeName, SourceFieldOrEventName: string; Reader: TX3DReaderNames);`
Set source/destination of the route. This does everything that VRML parser should do when parsed VRML route. It looks for given node name (in Names.Nodes, then Names.Imported), then it looks for field/event within this node, and if everything is successfull — sets route properties. If something goes wrong, OnWarning is generated and route ending is left unset.
| `procedure SetDestination( const DestinationNodeName, DestinationFieldOrEventName: string; Reader: TX3DReaderNames);`
| `procedure SetSourceDirectly( const NewNode: TX3DNode; const FieldOrEvent: TX3DFieldOrEvent);`
These set source/destination of the route in more direct way. FieldOrEvent is used to set SourceEvent (or DestinationEvent). FieldOrEvent may be the actual event to set, or exposed field containing this event. You specify explictly NewNode, which is not checked in any way. We don't check whether it exists, whether it contains given FieldOrEvent, etc. — you have to guarantee this yourself. Also, remember that normal SetSource actually look for events inside PrototypeInstanceSourceNode, if exists — if you want this, you have to do this yourself when using these SetXxxDirectly. It is used to set SourceNode (or DestinationNode). Overloaded versions that don't take NewNode parameter just assume that NewNode can be taken from FieldOrEvent.ParentNode.
| `procedure SetDestinationDirectly( const NewNode: TX3DNode; const FieldOrEvent: TX3DFieldOrEvent);`
| `procedure SetSourceDirectly(const FieldOrEvent: TX3DFieldOrEvent);`
| `procedure SetDestinationDirectly(const FieldOrEvent: TX3DFieldOrEvent);`
| `procedure Parse(Lexer: TX3DLexer; Reader: TX3DReaderNames);`
Parse the route (classic VRML encoding). Implementation should be able to safely assume that current token is ROUTE.
| `procedure ParseXML(Element: TDOMElement; Reader: TX3DReaderNames);`
Parse the route (XML encoding). Given Element here must have TagName = 'ROUTE'.
| `procedure SaveToStream(Writer: TX3DWriter); override;`
Save a ROUTE to VRML file. Will generate OnWarning when route cannot be saved. This can happen when SourceNode or SourceEvent or DestinationNode or DestinationEvent are `Nil`. Also, if SourceNode and DestinationNode are without a name, or the name is not currently bound in Writer.NodeNames.
| `procedure ResetLastEventTime;`
Clear the memory when the last event passed through this route. Route must remember such thing, to avoid loops in routes. This is following VRML 2.0 / X3D specifications, that explicitly say that only one event per ROUTE per timestamp is allowed. Use `ResetLastEventTime` when you really want to reset this memory. In practice, this should be used only by TCastleSceneCore.ResetTime implementation.
| `function DeepCopy(CopyState: TX3DNodeDeepCopyState): TX3DRoute;`
### Properties
| `property SourceNode: TX3DNode read FSourceNode;`
Source event properties. Either all three are `Nil`, or: SourceEvent is assigned, meaning is self-explanatory. Note: if you want to get it's exposed field, remember this is available in SourceEvent.ParentExposedField. `SourceNode` must also be assigned and this must be the node enclosing SourceEvent. That is, the node that has SourceEvent as one of explicit (on TX3DNode.Events list) or implicit (exposed by some field) event.
| `property SourceEvent: TX3DEvent read FSourceEvent;`
| `property DestinationNode: TX3DNode read FDestinationNode;`
Destination event properties. Analogous to SourceEvent, SourceNode.
| `property DestinationEvent: TX3DEvent read FDestinationEvent;`
| `property Internal: boolean read FInternal write FInternal default false;`
Internal routes are created by PROTO expansion code, which needs to create internal routes to implement "IS" clauses for events. These routes work exactly like normal routes, except: They are not saved to file (SaveToStream will ignore internal route). It's allowed (in fact, this will always happen for current internal routes) to route one input event to another input event.
Generated by PasDoc 0.13.0 on 2015-06-15 04:43:17