|
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.nodes.proto.AbstractProto
org.web3d.vrml.nodes.proto.PrototypeDecl
public class PrototypeDecl
Denotes an ordinary prototype node declaration.
The prototype declaration has no concrete representation in the scenegraph. It is used as a data creator for when someone declares an instance of the proto within the current scenegraph.
The proto can act in either VRML97 mode or VRML3.0 mode. The primary difference is the handling of IS values when mapping fields. To catch errors early, we check IS access type mapping as they are being inserted, rather than at runtime. The handling of this is defined in VRML97 Part 1, Section 4, Table 4.4. For VRML 3.0 all field access is expected to be exposedField so we can add an IS from any field to any declaration field. Of course, when being added, we do check for fields types and field names being valid too.
| Field Summary |
|---|
| Fields inherited from class org.web3d.vrml.nodes.proto.AbstractProto |
|---|
BAD_NODE_MSG, errorReporter, FIELD_CLASH_MSG, fieldDeclList, fieldIndexMap, fieldLocalData, isVrml97, nodeName, protoCreator, VRML97_FIELD_MSG, vrmlMajorVersion, vrmlMinorVersion |
| Constructor Summary | |
|---|---|
PrototypeDecl(java.lang.String name,
int majorVersion,
int minorVersion,
NodeTemplateToInstanceCreator creator)
Create a new instance of a proto that has the given name that may have its IS semantics defined according to the different specification models. |
|
| Method Summary | |
|---|---|
void |
addFieldNodeValue(int index,
VRMLNodeType node)
Used to set the field value where the field represents a SFNode or MFNode. |
void |
addImportDecl(java.lang.String name,
ImportNodeProxy node)
The IMPORT node proxy to be registered with the node declaration at this level. |
void |
addIS(java.lang.String declFieldName,
VRMLNodeType destNode,
int destField)
Register an IS setup between the incoming field and the destination node. |
void |
addPrototypeDecl(VRMLNodeTemplate proto)
Add a nested proto or externproto declaration to this proto. |
void |
addRouteDecl(ProtoROUTE route)
The route declaration to be registered with the node declaration at this level. |
VRMLNode |
createNewInstance(VRMLNode root,
boolean isStatic)
Create a new instance of a real node from this template. |
VRMLGroupingNodeType |
getBodyGroup()
Get the grouping node that represents the body of the proto. |
java.util.Map |
getDEFMap()
Fetch the internal mapping of DEF names to nodes. |
VRMLFieldData |
getFieldValue(int index)
Get the value of a field. |
java.util.Map |
getImportDecls()
Return the internal mapping of the import proxy nodes mapped from their name. |
java.util.Map |
getISMaps()
Get the IS mappings for this proto declaration. |
int |
getPrimaryType()
Get the primary type of this node. |
java.util.List<VRMLNodeTemplate> |
getPrototypeDecls()
Fetch the list of all proto declarations in this proto. |
java.util.Set |
getRouteDecls()
Get the set of the current route declarations that are available for this definitions. |
void |
setDEFMap(java.util.Map map)
Update the internal DEF map collection with the contents of this map. |
void |
setValue(int index,
boolean value)
Set the value of the field at the given index as an boolean. |
void |
setValue(int index,
boolean[] value,
int numValid)
Set the value of the field at the given index as an array of boolean. |
void |
setValue(int index,
double value)
Set the value of the field at the given index as an double. |
void |
setValue(int index,
double[] value,
int numValid)
Set the value of the field at the given index as an array of doubles. |
void |
setValue(int index,
float value)
Set the value of the field at the given index as a float. |
void |
setValue(int index,
float[] value,
int numValid)
Set the value of the field at the given index as an array of floats. |
void |
setValue(int index,
int value)
Set the value of the field at the given index as an integer. |
void |
setValue(int index,
int[] value,
int numValid)
Set the value of the field at the given index as an array of integers. |
void |
setValue(int index,
long value)
Set the value of the field at the given index as an long. |
void |
setValue(int index,
long[] value,
int numValid)
Set the value of the field at the given index as an array of longs. |
void |
setValue(int index,
java.lang.String value)
Set the value of the field at the given index as a string. |
void |
setValue(int index,
java.lang.String[] value,
int numValid)
Set the value of the field at the given index as an array of strings. |
| Methods inherited from class org.web3d.vrml.nodes.proto.AbstractProto |
|---|
addNodeListener, appendField, checkNodeType, deleteField, deleteField, fireFieldChanged, getAllFields, getFieldCount, getFieldDeclaration, getFieldIndex, getNumFields, getVRMLNodeName, isVRML97, removeNodeListener, setErrorReporter |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface org.web3d.vrml.lang.VRMLNodeTemplate |
|---|
appendField, deleteField, deleteField, getAllFields, getFieldCount, getFieldDeclaration, getFieldIndex, getNumFields, getVRMLNodeName, setErrorReporter |
| Constructor Detail |
|---|
public PrototypeDecl(java.lang.String name,
int majorVersion,
int minorVersion,
NodeTemplateToInstanceCreator creator)
name - The name of the proto to usemajorVersion - The major version number of this sceneminorVersion - The minor version number of this scenecreator - The node creator for generating instances of ourself| Method Detail |
|---|
public VRMLNode createNewInstance(VRMLNode root,
boolean isStatic)
throws InvalidNodeTypeException
createNewInstance in interface VRMLNodeTemplateroot - The node that represents the root node of the
VRMLExecutionSpace that we're in.isStatic - true if this is created within a StaticGroup
InvalidNodeTypeException - The root node is not a node capable
of representing a root of a scene graphVRMLProtoInstance,
VRMLWorldRootNodeType
public void addFieldNodeValue(int index,
VRMLNodeType node)
throws InvalidFieldException,
InvalidFieldValueException
addFieldNodeValue in interface VRMLProtoDeclareindex - The index of destination field to setnode - The node to set or add to this field
InvalidFieldException - The field index is not known
InvalidFieldValueException - The value provided is not in range
or not appropriate for this field
public VRMLFieldData getFieldValue(int index)
throws InvalidFieldException
getFieldValue in interface VRMLProtoDeclareindex - The index of the field to change.
InvalidFieldException - The field index is not knownpublic int getPrimaryType()
getPrimaryType in interface VRMLNodeTemplatepublic void addPrototypeDecl(VRMLNodeTemplate proto)
proto - The prototype declaration to addpublic java.util.List<VRMLNodeTemplate> getPrototypeDecls()
public void addRouteDecl(ProtoROUTE route)
route - The route representation to storepublic java.util.Set getRouteDecls()
getRouteDecls in interface VRMLProtoDeclare
public void addImportDecl(java.lang.String name,
ImportNodeProxy node)
name - The local name this is imported asnode - The proxy instance representing that nodepublic java.util.Map getImportDecls()
ImportNodeProxypublic void setDEFMap(java.util.Map map)
map - The new map to copypublic java.util.Map getDEFMap()
public VRMLGroupingNodeType getBodyGroup()
getBodyGroup in interface VRMLProtoDeclare
public void addIS(java.lang.String declFieldName,
VRMLNodeType destNode,
int destField)
throws InvalidFieldException,
InvalidFieldConnectionException
declFieldName - The name of the field we are copying in the proto
declarationdestNode - Reference to the node containing the fielddestField - Index of the recieving field
InvalidFieldException - Something is not valid in the fields defs
InvalidFieldConnectionException - The types of the field don't
match or access doesn't match in VRML97 modepublic java.util.Map getISMaps()
List where the list contains
all the matching ProtoFieldInfo instances.
public void setValue(int index,
int value)
throws InvalidFieldException,
InvalidFieldValueException
setValue in interface VRMLProtoDeclareindex - The index of destination field to setvalue - The new value to use for the node
InvalidFieldException - The field index is not known
InvalidFieldValueException - The value provided is not in range
or not appropriate for this field
public void setValue(int index,
int[] value,
int numValid)
throws InvalidFieldException,
InvalidFieldValueException
setValue in interface VRMLProtoDeclareindex - The index of destination field to setvalue - The new value to use for the nodenumValid - The number of valid values to copy from the array
InvalidFieldException - The field index is not known
InvalidFieldValueException - The value provided is not in range
or not appropriate for this field
public void setValue(int index,
boolean value)
throws InvalidFieldException,
InvalidFieldValueException
setValue in interface VRMLProtoDeclareindex - The index of destination field to setvalue - The new value to use for the node
InvalidFieldException - The field index is not known
InvalidFieldValueException - The value provided is not in range
or not appropriate for this field
public void setValue(int index,
boolean[] value,
int numValid)
throws InvalidFieldException,
InvalidFieldValueException
setValue in interface VRMLProtoDeclareindex - The index of destination field to setvalue - The new value to use for the nodenumValid - The number of valid values to copy from the array
InvalidFieldException - The field index is not known
InvalidFieldValueException - The value provided is not in range
or not appropriate for this field
public void setValue(int index,
float value)
throws InvalidFieldException,
InvalidFieldValueException
setValue in interface VRMLProtoDeclareindex - The index of destination field to setvalue - The new value to use for the node
InvalidFieldException - The field index is not known
InvalidFieldValueException - The value provided is not in range
or not appropriate for this field
public void setValue(int index,
float[] value,
int numValid)
throws InvalidFieldException,
InvalidFieldValueException
setValue in interface VRMLProtoDeclareindex - The index of destination field to setvalue - The new value to use for the nodenumValid - The number of valid values to copy from the array
InvalidFieldException - The field index is not known
InvalidFieldValueException - The value provided is not in range
or not appropriate for this field
public void setValue(int index,
long value)
throws InvalidFieldException,
InvalidFieldValueException
setValue in interface VRMLProtoDeclareindex - The index of destination field to setvalue - The new value to use for the node
InvalidFieldException - The field index is not known
InvalidFieldValueException - The value provided is not in range
or not appropriate for this field
public void setValue(int index,
long[] value,
int numValid)
throws InvalidFieldException,
InvalidFieldValueException
setValue in interface VRMLProtoDeclareindex - The index of destination field to setvalue - The new value to use for the nodenumValid - The number of valid values to copy from the array
InvalidFieldException - The field index is not known
InvalidFieldValueException - The value provided is not in range
or not appropriate for this field
public void setValue(int index,
double value)
throws InvalidFieldException,
InvalidFieldValueException
setValue in interface VRMLProtoDeclareindex - The index of destination field to setvalue - The new value to use for the node
InvalidFieldException - The field index is not known
InvalidFieldValueException - The value provided is not in range
or not appropriate for this field
public void setValue(int index,
double[] value,
int numValid)
throws InvalidFieldException,
InvalidFieldValueException
setValue in interface VRMLProtoDeclareindex - The index of destination field to setvalue - The new value to use for the nodenumValid - The number of valid values to copy from the array
InvalidFieldException - The field index is not known
InvalidFieldValueException - The value provided is not in range
or not appropriate for this field
public void setValue(int index,
java.lang.String value)
throws InvalidFieldException,
InvalidFieldValueException
setValue in interface VRMLProtoDeclareindex - The index of destination field to setvalue - The new value to use for the node
InvalidFieldException - The field index is not known
InvalidFieldValueException - The value provided is not in range
or not appropriate for this field
public void setValue(int index,
java.lang.String[] value,
int numValid)
throws InvalidFieldException,
InvalidFieldValueException
setValue in interface VRMLProtoDeclareindex - The index of destination field to setvalue - The new value to use for the nodenumValid - The number of valid values to copy from the array
InvalidFieldException - The field index is not known
InvalidFieldValueException - The value provided is not in range
or not appropriate for this field
|
Xj3D 2.0 VRML/X3D Code API | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||