Class TX3DRoute

Unit

Declaration

type TX3DRoute = class(TX3DFileItem)

Description

Route makes a connection between two X3D events, making the destination event occur when the source event happened.

Hierarchy

Overview

Methods

Public constructor Create;
Public destructor Destroy; override;
Public procedure SetSource( const SourceNodeName, SourceFieldOrEventName: string; Reader: TX3DReaderNames);
Public procedure SetDestination( const DestinationNodeName, DestinationFieldOrEventName: string; Reader: TX3DReaderNames);
Public procedure SetSourceDirectly( const NewNode: TX3DNode; const FieldOrEvent: TX3DFieldOrEvent); overload;
Public procedure SetDestinationDirectly( const NewNode: TX3DNode; const FieldOrEvent: TX3DFieldOrEvent); overload;
Public procedure SetSourceDirectly(const FieldOrEvent: TX3DFieldOrEvent); overload;
Public procedure SetDestinationDirectly(const FieldOrEvent: TX3DFieldOrEvent); overload;
Public procedure Parse(Lexer: TX3DLexer; Reader: TX3DReaderNames);
Public procedure ParseXML(Element: TDOMElement; Reader: TX3DReaderNames);
Public procedure SaveToStream(Writer: TX3DWriter); override;
Public procedure ResetLastEventTime;
Public function DeepCopy(const CopyState: TX3DNodeDeepCopyState): TX3DRoute;

Properties

Public property SourceNode: TX3DNode read FSourceNode;
Public property SourceEvent: TX3DEvent read FSourceEvent;
Public property DestinationNode: TX3DNode read FDestinationNode;
Public property DestinationEvent: TX3DEvent read FDestinationEvent;
Public property Internal: boolean read FInternal write FInternal default false;

Description

Methods

Public constructor Create;

This item has no description.

Public destructor Destroy; override;

This item has no description.

Public 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 successful — sets route properties.

If something goes wrong, WritelnWarning is generated and route ending is left unset.

Public procedure SetDestination( const DestinationNodeName, DestinationFieldOrEventName: string; Reader: TX3DReaderNames);

This item has no description.

Public procedure SetSourceDirectly( const NewNode: TX3DNode; const FieldOrEvent: TX3DFieldOrEvent); overload;

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.

Public procedure SetDestinationDirectly( const NewNode: TX3DNode; const FieldOrEvent: TX3DFieldOrEvent); overload;

This item has no description.

Public procedure SetSourceDirectly(const FieldOrEvent: TX3DFieldOrEvent); overload;

This item has no description.

Public procedure SetDestinationDirectly(const FieldOrEvent: TX3DFieldOrEvent); overload;

This item has no description.

Public procedure Parse(Lexer: TX3DLexer; Reader: TX3DReaderNames);

Parse the route (classic VRML encoding). Implementation should be able to safely assume that current token is ROUTE.

Public procedure ParseXML(Element: TDOMElement; Reader: TX3DReaderNames);

Parse the route (XML encoding). Given Element here must have TagName = 'ROUTE'.

Public procedure SaveToStream(Writer: TX3DWriter); override;

Save a ROUTE to VRML file.

Will generate WritelnWarning 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.

Public 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.

Public function DeepCopy(const CopyState: TX3DNodeDeepCopyState): TX3DRoute;

This item has no description.

Properties

Public 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.

Public property SourceEvent: TX3DEvent read FSourceEvent;

This item has no description.

Public property DestinationNode: TX3DNode read FDestinationNode;

Destination event properties. Analogous to SourceEvent, SourceNode.

Public property DestinationEvent: TX3DEvent read FDestinationEvent;

This item has no description.

Public 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.16.0-snapshot.