hmi.graphics.collada
Class Collada

java.lang.Object
  extended by hmi.xml.XMLStructureAdapter
      extended by hmi.graphics.collada.ColladaElement
          extended by hmi.graphics.collada.Collada
All Implemented Interfaces:
XMLStructure

public class Collada
extends ColladaElement

The class for parsing complete Collada documents.

Author:
Job Zwiers

Field Summary
private  Map<String,Integer> arrayTypes
           
private  Asset asset
           
static int BOOL
           
private  Map<String,boolean[]> boolArrays
           
private  Extra extra
           
static int FLOAT
           
private  Map<String,float[]> floatArrays
           
static int IDREF
           
private  Map<String,String[]> idrefArrays
           
static int INT
           
private  Map<String,int[]> intArrays
           
private  List<Library<AnimationClip>> librariesAnimationClips
           
private  List<Library<Animation>> librariesAnimations
           
private  List<Library<Camera>> librariesCameras
           
private  List<Library<Controller>> librariesControllers
           
private  List<Library<Effect>> librariesEffects
           
private  List<Library<ForceField>> librariesForceFields
           
private  List<Library<Geometry>> librariesGeometries
           
private  List<Library<ColladaImage>> librariesImages
           
private  List<Library<Light>> librariesLights
           
private  List<Library<Material>> librariesMaterials
           
private  List<Library<Node>> librariesNodes
           
private  List<Library<PhysicsMaterial>> librariesPhysicsMaterials
           
private  List<Library<PhysicsModel>> librariesPhysicsModels
           
private  List<Library<PhysicsScene>> librariesPhysicsScenes
           
private  List<Library<VisualScene>> librariesVisualScenes
           
private  Logger logger
           
static int NAME
           
private  Map<String,String[]> nameArrays
           
private  Resources resources
           
private  Scene scene
           
private  Map<String,Source> sources
           
private  String specifiedVersion
           
private static List<String> supportedVersion
           
private  String xmlns
           
private static String XMLTAG
          The XML Stag for XML encoding
 
Fields inherited from class hmi.graphics.collada.ColladaElement
COLLADANAMESPACE
 
Fields inherited from class hmi.xml.XMLStructureAdapter
ATTRIBUTE_TOKEN_DELIMITERS, COMMA_SEPARATOR, DECODEDARRAYSIZE, DEFAULT_RECOVER_MODE, NEWLINE, SYSTEMNEWLINE, TAB, TAB_STRING
 
Constructor Summary
Collada()
           
Collada(XMLTokenizer tokenizer)
           
Collada(XMLTokenizer tokenizer, Resources resources)
           
 
Method Summary
 void addBoolArray(String id, boolean[] bools)
          adds a boolean array to the global map, identified by id.
 void addFloatArray(String id, float[] floats)
          adds a float array to the global map, identified by id.
 void addIDREFArray(String id, String[] idrefs)
          adds a String array, used for Collada idRefs, to the global map, identified by id.
 void addIntArray(String id, int[] ints)
          adds an int array to the global map, identified by id.
 void addNameArray(String id, String[] names)
          adds a String array, used for Collada names, to the global map, identified by id.
 void addSource(String id, Source source)
          adds a Collada Source to the global map, identified by id.
 StringBuilder appendAttributes(StringBuilder buf)
          appends a String of attributes to buf.
 StringBuilder appendContent(StringBuilder buf, XMLFormatting fmt)
          Appends a String to buf that encodes the contents for the XML encoding.
 void decodeAttributes(HashMap<String,String> attrMap, XMLTokenizer tokenizer)
          decodes XML attributes
 void decodeContent(XMLTokenizer tokenizer)
          collada --> asset [library|scene]* asset is required, scene is optional, and can occur at most once, at the end.
 int getArrayType(String id)
          returns the Collada type of the array identified by id (null, if there is no such array)
 boolean[] getBoolArray(String id)
          returns the boolean array (possibly null) from the global map, identified by id.
 float[] getFloatArray(String id)
          returns the float array (possibly null) from the global map, identified by id.
 String[] getIDREFArray(String id)
          returns the String array (possibly null) from the global map, identified by id.
 int[] getIntArray(String id)
          returns the int array (possibly null) from the global map, identified by id.
<X extends ColladaElement>
X
getLibItem(List<Library<X>> libList, String url)
          Returns the Library item for id, which could be null.
 List<Library<AnimationClip>> getLibrariesAnimationClips()
           
 List<Library<Animation>> getLibrariesAnimations()
           
 List<Library<Camera>> getLibrariesCameras()
           
 List<Library<Controller>> getLibrariesControllers()
           
 List<Library<Effect>> getLibrariesEffects()
           
 List<Library<ForceField>> getLibrariesForceFields()
           
 List<Library<Geometry>> getLibrariesGeometries()
           
 List<Library<ColladaImage>> getLibrariesImages()
           
 List<Library<Light>> getLibrariesLights()
           
 List<Library<Material>> getLibrariesMaterials()
           
 List<Library<Node>> getLibrariesNodes()
           
 List<Library<PhysicsMaterial>> getLibrariesPhysicsMaterials()
           
 List<Library<PhysicsModel>> getLibrariesPhysicsModels()
           
 List<Library<PhysicsScene>> getLibrariesPhysicsScenes()
           
 List<Library<VisualScene>> getLibrariesVisualScenes()
           
 String[] getNameArray(String id)
          returns the String array (possibly null) from the global map, identified by id.
 Resources getResources()
           
 Scene getScene()
           
 Source getSource(String id)
          returns the Source (possibly null), identified by id.
 String getXMLTag()
          returns the XML Stag for XML encoding
 void info(String msg)
           
 void severe(String msg)
           
 void warning(String msg)
           
static String xmlTag()
          The XML Stag for XML encoding
 
Methods inherited from class hmi.graphics.collada.ColladaElement
addColladaNode, addColladaNodes, addToIdMap, getCollada, getColladaNodes, getId, getIdMap, getIdOrName, getIds, getName, getNamespace, getRecursiveColladaNodes, getRecursiveColladaNodes, getSid, report, reportNode, setCollada, setId, setName, setSid, urlToId
 
Methods inherited from class hmi.xml.XMLStructureAdapter
appendAttribute, appendAttribute, appendAttribute, appendAttribute, appendAttribute, appendAttribute, appendAttribute, appendAttribute, appendAttribute, appendAttribute, appendAttribute, appendAttribute, appendAttribute, appendAttribute, appendAttribute, appendAttribute, appendAttribute, appendAttribute, appendAttribute, appendAttribute, appendAttribute, appendAttribute, appendAttribute, appendAttribute, appendAttribute, appendAttribute, appendAttribute, appendAttribute, appendAttribute, appendAttribute, appendAttributes, appendAttributeString, appendAttributeString, appendBooleans, appendCloseEmptyTag, appendCloseSTag, appendComment, appendContent, appendDoubleElement, appendEmptyTag, appendEmptyTag, appendEmptyTag, appendEmptyTag, appendEmptyTag, appendEmptyTag, appendETag, appendETag, appendFloatArrayElement, appendFloatElement, appendFloats, appendIntArrayElement, appendIntElement, appendInts, appendLongElement, appendNewLine, appendNewLine, appendNewLine, appendOpenSTag, appendOptionalDoubleElement, appendOptionalFloatElement, appendOptionalIntElement, appendOptionalLongElement, appendSpaces, appendSpaces, appendSTag, appendSTag, appendSTag, appendStringArrayElement, appendStrings, appendSystemNewLine, appendTab, appendTextElement, appendXML, appendXML, appendXML, appendXML, appendXML, appendXMLStructure, appendXMLStructureList, appendXMLTextElementList, countTokens, countTokens, decodeAttribute, decodeAttribute, decodeBoolean, decodeBooleanArray, decodeBooleanArray, decodeBooleanArray, decodeBooleanArray, decodeDouble, decodeDoubleArray, decodeDoubleArray, decodeDoubleArray, decodeDoubleArray, decodeFloat, decodeFloatArray, decodeFloatArray, decodeFloatArray, decodeFloatArray, decodeInt, decodeIntArray, decodeIntArray, decodeIntArray, decodeIntArray, decodeLong, decodeStringArray, decodeStringArray, decodeStringArray, decodeStringArray, decodeXMLStructureList, decodeXMLValueElement, getOptionalAttribute, getOptionalAttribute, getOptionalBooleanAttribute, getOptionalDoubleAttribute, getOptionalFloatAttribute, getOptionalIntAttribute, getOptionalLongAttribute, getRequiredAttribute, getRequiredBooleanAttribute, getRequiredDoubleAttribute, getRequiredFloatAttribute, getRequiredIntAttribute, getRequiredLongAttribute, getTagLine, hasContent, parseXMLElement, postProcess, preProcess, readXML, readXML, readXML, setConsoleAttributeEnabled, setDefaultRecoverMode, setRecoverMode, spaces, toString, toXMLString, toXMLString, toXMLString, toXMLString, toXMLString, toXMLString, writeXML, writeXML, writeXML, writeXML
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

supportedVersion

private static List<String> supportedVersion

specifiedVersion

private String specifiedVersion

xmlns

private String xmlns

asset

private Asset asset

scene

private Scene scene

librariesAnimations

private List<Library<Animation>> librariesAnimations

librariesAnimationClips

private List<Library<AnimationClip>> librariesAnimationClips

librariesCameras

private List<Library<Camera>> librariesCameras

librariesControllers

private List<Library<Controller>> librariesControllers

librariesEffects

private List<Library<Effect>> librariesEffects

librariesForceFields

private List<Library<ForceField>> librariesForceFields

librariesGeometries

private List<Library<Geometry>> librariesGeometries

librariesImages

private List<Library<ColladaImage>> librariesImages

librariesLights

private List<Library<Light>> librariesLights

librariesMaterials

private List<Library<Material>> librariesMaterials

librariesNodes

private List<Library<Node>> librariesNodes

librariesPhysicsMaterials

private List<Library<PhysicsMaterial>> librariesPhysicsMaterials

librariesPhysicsModels

private List<Library<PhysicsModel>> librariesPhysicsModels

librariesPhysicsScenes

private List<Library<PhysicsScene>> librariesPhysicsScenes

librariesVisualScenes

private List<Library<VisualScene>> librariesVisualScenes

extra

private Extra extra

FLOAT

public static final int FLOAT
See Also:
Constant Field Values

INT

public static final int INT
See Also:
Constant Field Values

BOOL

public static final int BOOL
See Also:
Constant Field Values

NAME

public static final int NAME
See Also:
Constant Field Values

IDREF

public static final int IDREF
See Also:
Constant Field Values

arrayTypes

private Map<String,Integer> arrayTypes

floatArrays

private Map<String,float[]> floatArrays

intArrays

private Map<String,int[]> intArrays

boolArrays

private Map<String,boolean[]> boolArrays

nameArrays

private Map<String,String[]> nameArrays

idrefArrays

private Map<String,String[]> idrefArrays

sources

private Map<String,Source> sources

resources

private Resources resources

XMLTAG

private static final String XMLTAG
The XML Stag for XML encoding

See Also:
Constant Field Values

logger

private Logger logger
Constructor Detail

Collada

public Collada()

Collada

public Collada(XMLTokenizer tokenizer)
        throws IOException
Throws:
IOException

Collada

public Collada(XMLTokenizer tokenizer,
               Resources resources)
        throws IOException
Throws:
IOException
Method Detail

getLibrariesAnimations

public List<Library<Animation>> getLibrariesAnimations()

getLibrariesAnimationClips

public List<Library<AnimationClip>> getLibrariesAnimationClips()

getLibrariesCameras

public List<Library<Camera>> getLibrariesCameras()

getLibrariesControllers

public List<Library<Controller>> getLibrariesControllers()

getLibrariesEffects

public List<Library<Effect>> getLibrariesEffects()

getLibrariesForceFields

public List<Library<ForceField>> getLibrariesForceFields()

getLibrariesGeometries

public List<Library<Geometry>> getLibrariesGeometries()

getLibrariesImages

public List<Library<ColladaImage>> getLibrariesImages()

getLibrariesLights

public List<Library<Light>> getLibrariesLights()

getLibrariesMaterials

public List<Library<Material>> getLibrariesMaterials()

getLibrariesNodes

public List<Library<Node>> getLibrariesNodes()

getLibrariesPhysicsMaterials

public List<Library<PhysicsMaterial>> getLibrariesPhysicsMaterials()

getLibrariesPhysicsModels

public List<Library<PhysicsModel>> getLibrariesPhysicsModels()

getLibrariesPhysicsScenes

public List<Library<PhysicsScene>> getLibrariesPhysicsScenes()

getLibrariesVisualScenes

public List<Library<VisualScene>> getLibrariesVisualScenes()

getScene

public Scene getScene()

appendContent

public StringBuilder appendContent(StringBuilder buf,
                                   XMLFormatting fmt)
Description copied from class: XMLStructureAdapter
Appends a String to buf that encodes the contents for the XML encoding. MUST BE OVERWRITTEN BY IMPLEMENTATIONS. (The default implementation appends nothing). The encoding should start on a new line, using indentation equal to tab. There should be no newline after the encoding.

Overrides:
appendContent in class XMLStructureAdapter

decodeContent

public void decodeContent(XMLTokenizer tokenizer)
                   throws IOException
collada --> asset [library|scene]* asset is required, scene is optional, and can occur at most once, at the end.

Overrides:
decodeContent in class XMLStructureAdapter
Throws:
IOException

appendAttributes

public StringBuilder appendAttributes(StringBuilder buf)
appends a String of attributes to buf.

Overrides:
appendAttributes in class ColladaElement

decodeAttributes

public void decodeAttributes(HashMap<String,String> attrMap,
                             XMLTokenizer tokenizer)
decodes XML attributes

Overrides:
decodeAttributes in class ColladaElement

getLibItem

public <X extends ColladaElement> X getLibItem(List<Library<X>> libList,
                                               String url)
Returns the Library item for id, which could be null. The url parameter can optionally start with a # character. The first argument is a List of libraries to be searched., like the Collada libraries libraries_geometries etc.


addFloatArray

public void addFloatArray(String id,
                          float[] floats)
adds a float array to the global map, identified by id.


getFloatArray

public float[] getFloatArray(String id)
returns the float array (possibly null) from the global map, identified by id.


addIntArray

public void addIntArray(String id,
                        int[] ints)
adds an int array to the global map, identified by id.


getIntArray

public int[] getIntArray(String id)
returns the int array (possibly null) from the global map, identified by id.


addBoolArray

public void addBoolArray(String id,
                         boolean[] bools)
adds a boolean array to the global map, identified by id.


getBoolArray

public boolean[] getBoolArray(String id)
returns the boolean array (possibly null) from the global map, identified by id.


addNameArray

public void addNameArray(String id,
                         String[] names)
adds a String array, used for Collada names, to the global map, identified by id.


getNameArray

public String[] getNameArray(String id)
returns the String array (possibly null) from the global map, identified by id.


addIDREFArray

public void addIDREFArray(String id,
                          String[] idrefs)
adds a String array, used for Collada idRefs, to the global map, identified by id.


getIDREFArray

public String[] getIDREFArray(String id)
returns the String array (possibly null) from the global map, identified by id. The possible types are: FLOAT, INT, BOOL, NAME, IDREF, all defined as Collada int constants.


getArrayType

public int getArrayType(String id)
returns the Collada type of the array identified by id (null, if there is no such array)


addSource

public void addSource(String id,
                      Source source)
adds a Collada Source to the global map, identified by id. Assumption: Sources will always have globally unique is. (although this is not required by Collada(?))


getSource

public Source getSource(String id)
returns the Source (possibly null), identified by id.


getResources

public Resources getResources()
Overrides:
getResources in class ColladaElement

xmlTag

public static String xmlTag()
The XML Stag for XML encoding


getXMLTag

public String getXMLTag()
returns the XML Stag for XML encoding

Specified by:
getXMLTag in interface XMLStructure
Overrides:
getXMLTag in class XMLStructureAdapter

severe

public void severe(String msg)

warning

public void warning(String msg)

info

public void info(String msg)