|
Xj3D 2.0 VRML/X3D Code API | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.web3d.vrml.renderer.ProtoCopier
public class ProtoCopier
A class that is used to create real instances of protos from their definitions.
The creator strips the definition apart and builds a runtime node based on the details and the node factory provided. The creator can handle one instance at a time, athough it will correctly parse and build nested proto declarations without extra effort.
We have a small conundrum to deal with - if the proto definition contains SF/MFNode fields, we don't know whether the values should be also generated as real runtime nodes too. Maybe the usage of this node will provide values that are dealt with after this class has finished. Other times, these defaul values must be used. For this implementation, we have gone with the safety-first approach: Always parse the definition of any SF or MFNode field and turn those into runtime instances. Although this may create extra garbage, there seems to be no nice way of dealing with this issue without a completely different architecture for the library.
Note: Under the current implementation, EXTERNPROTOs are not yet catered for.
| Constructor Summary | |
|---|---|
ProtoCopier(VRMLNodeFactory fac,
java.lang.String worldURL)
Create a new copier that uses the given world URL and node factory. |
|
| Method Summary | |
|---|---|
void |
observedNode(VRMLNodeType parent,
VRMLNodeType child,
int field,
boolean used)
Notification of a child node. |
void |
protoNode(VRMLNodeType parent,
CRProtoInstance proto)
Notification of a completed proto instance that needs to be registered with its parent node. |
void |
setErrorReporter(ErrorReporter reporter)
Register an error reporter with the engine so that any errors generated by the script code can be reported in a nice, pretty fashion. |
void |
setFrameStateManager(FrameStateManager fsm)
Set the frame state manager to use for the builder after this point. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public ProtoCopier(VRMLNodeFactory fac,
java.lang.String worldURL)
fac - The factory to use (Must generate VRMLNodeType instances)| Method Detail |
|---|
public void setFrameStateManager(FrameStateManager fsm)
fsm - The state manager to usepublic void setErrorReporter(ErrorReporter reporter)
reporter - The instance to use or null
public void observedNode(VRMLNodeType parent,
VRMLNodeType child,
int field,
boolean used)
observedNode in interface SceneGraphTraversalSimpleObserverparent - The parent node of this nodechild - The child node that is being observedfield - The index of the child field in its parent nodeused - true if the node reference is actually a USE
public void protoNode(VRMLNodeType parent,
CRProtoInstance proto)
parent - The parent node of this nodeproto - The proto node that has been found
|
Xj3D 2.0 VRML/X3D Code API | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||