Class ColladaDOMUtil
java.lang.Object
com.ardor3d.extension.model.collada.jdom.ColladaDOMUtil
Utility methods for parsing Collada data related to node hierarchy and arrays, using XPath or arrays extracted during
sax parsing.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionorg.jdom2.Element
findTargetWithId
(String baseUrl) Find element with specific idorg.jdom2.Element
findTargetWithSid
(String baseUrl) Find element with specific sidint
getAttributeIntValue
(org.jdom2.Element input, String attributeName, int defaultVal) Parse an int value in an attribute.Convert a Collada color description into an Ardor3D ColorRGBAorg.jdom2.Element
getPositionSource
(org.jdom2.Element v) Find Element with semantic POSITION under an element with inputsboolean[]
parseBooleanArray
(org.jdom2.Element node) Parses the text under a node and returns it as a boolean array.double[]
parseDoubleArray
(org.jdom2.Element node) Parses the text under a node and returns it as a double array.float[]
parseFloatArray
(org.jdom2.Element node) Parses the text under a node and returns it as a float array.int[]
parseIntArray
(org.jdom2.Element node) Parses the text under a node and returns it as an int array.String[]
parseStringArray
(org.jdom2.Element node) Parses the text under a node and returns it as a string array.List
<?> selectNodes
(org.jdom2.Element element, String query) Select nodes through an XPath query and return all hits as a ListselectSingleNode
(org.jdom2.Element element, String query) Select nodes through an XPath query and returns the first hitvoid
stripNamespace
(org.jdom2.Element rootElement) Strips the namespace from all nodes in a tree.
-
Constructor Details
-
ColladaDOMUtil
-
-
Method Details
-
findTargetWithId
Find element with specific id- Parameters:
baseUrl
- url specifying target id- Returns:
- element with specific id or null if not found
-
findTargetWithSid
Find element with specific sid- Parameters:
baseUrl
- url specifying target sid- Returns:
- element with specific id or null if not found
-
selectNodes
Select nodes through an XPath query and return all hits as a List- Parameters:
element
- root element to start search onquery
- XPath expression- Returns:
- the list of selected items, which may be of types:
Element
,Attribute
,Text
,CDATA
,Comment
,ProcessingInstruction
, Boolean, Double, or String.
-
selectSingleNode
Select nodes through an XPath query and returns the first hit- Parameters:
element
- root element to start search onquery
- XPath expression- Returns:
- the first selected item, which may be of types:
Element
,Attribute
,Text
,CDATA
,Comment
,ProcessingInstruction
, Boolean, Double, String, ornull
if no item was selected.
-
parseFloatArray
public float[] parseFloatArray(org.jdom2.Element node) Parses the text under a node and returns it as a float array.- Parameters:
node
- node to parse content from- Returns:
- parsed float array
-
parseDoubleArray
public double[] parseDoubleArray(org.jdom2.Element node) Parses the text under a node and returns it as a double array.- Parameters:
node
- node to parse content from- Returns:
- parsed double array
-
parseIntArray
public int[] parseIntArray(org.jdom2.Element node) Parses the text under a node and returns it as an int array.- Parameters:
node
- node to parse content from- Returns:
- parsed int array
-
parseBooleanArray
public boolean[] parseBooleanArray(org.jdom2.Element node) Parses the text under a node and returns it as a boolean array.- Parameters:
node
- node to parse content from- Returns:
- parsed boolean array
-
parseStringArray
Parses the text under a node and returns it as a string array.- Parameters:
node
- node to parse content from- Returns:
- parsed string array
-
stripNamespace
public void stripNamespace(org.jdom2.Element rootElement) Strips the namespace from all nodes in a tree.- Parameters:
rootElement
- Root of strip operation
-
getAttributeIntValue
Parse an int value in an attribute.- Parameters:
input
- Element containing the attributeattributeName
- Attribute name to parse a value fordefaultVal
- the default value- Returns:
- parsed integer
-
getColor
Convert a Collada color description into an Ardor3D ColorRGBA- Parameters:
colorDescription
- Collada color description- Returns:
- Ardor3d ColorRGBA
-
getPositionSource
public org.jdom2.Element getPositionSource(org.jdom2.Element v) Find Element with semantic POSITION under an element with inputs- Parameters:
v
- the element from which to start searching- Returns:
- the element with the semantic POSITION under an element with inputs
-