Class TX3DPrototypeNode

Unit

Declaration

type TX3DPrototypeNode = class(TX3DNode)

Description

Node with information about X3D prototype.

This node will have fields initialized according to associated Prototype.InterfaceDeclarations. This way you can simply parse this node (just like any other node) to parse prototype instance.

The prototype may be instantiated. After parsing you can do it by Instantiate method. In case of non-external prototype, this should always be possible (for a valid X3D files, that is), in case of external prototype this may requite loading the external prototype file.

This node cannot be created by standard Create method, always use CreatePrototypeNode.

Hierarchy

Overview

Methods

Protected function DeepCopyCreate(CopyState: TX3DNodeDeepCopyState): TX3DNode; override;
Public constructor Create(const AName, ABaseUrl: string); override;
Public constructor CreatePrototypeNode(const AName, ABaseUrl: string; APrototype: TX3DPrototypeBase);
Public function X3DType: string; override;
Public function Instantiate: TX3DNode;

Properties

Public property Prototype: TX3DPrototypeBase read FPrototype;

Description

Methods

Protected function DeepCopyCreate(CopyState: TX3DNodeDeepCopyState): TX3DNode; override;
 
Public constructor Create(const AName, ABaseUrl: string); override;

This constructor will raise exception for TX3DPrototypeNode. Always use CreatePrototypeNode for this node class.

Public constructor CreatePrototypeNode(const AName, ABaseUrl: string; APrototype: TX3DPrototypeBase);
 
Public function X3DType: string; override;
 
Public function Instantiate: TX3DNode;

Instantiate the prototype, that is create new X3D node (of "normal" classs, not TX3DPrototypeNode) using prototype description.

For non-external prototype, in essense it just takes Prototype.Node and returns it's copy. For external prototype it first loads external file, and then uses non-external prototype there. Eventually, for external prototype we may also use build-in node (if URN will indicate so).

Actually, the process is a little more involved (see below for details), but the idea is that returned node can be simply inserted into VRML hierarchy and works just like a normal node. The important feature is that returned instance class is the same that was specified as a first prototype node. For example, if the prototype should expand to Material node, then this returns TMaterialNode. Just like Material node would be normally specified, not created by some prototype.

Note that this TX3DPrototypeNode becomes "owned" by returned node instance, in PrototypeInstanceSourceNode. (that's needed for returned node's SaveToStream to work correctly).

Details:

Exceptions raised
EX3DPrototypeInstantiateError
If for some reason the prototype cannot be instantiated. Outside code should catch this and replace with ApplicationProperties.OnWarning, if possible.

Properties

Public property Prototype: TX3DPrototypeBase read FPrototype;
 

Generated by PasDoc 0.16.0.