Class ColladaDOMUtil

java.lang.Object
com.ardor3d.extension.model.collada.jdom.ColladaDOMUtil

public class ColladaDOMUtil extends Object
Utility methods for parsing Collada data related to node hierarchy and arrays, using XPath or arrays extracted during sax parsing.
  • Constructor Details

    • ColladaDOMUtil

      public ColladaDOMUtil(DataCache dataCache)
  • Method Details

    • findTargetWithId

      public org.jdom2.Element findTargetWithId(String baseUrl)
      Find element with specific id
      Parameters:
      baseUrl - url specifying target id
      Returns:
      element with specific id or null if not found
    • findTargetWithSid

      public org.jdom2.Element findTargetWithSid(String baseUrl)
      Find element with specific sid
      Parameters:
      baseUrl - url specifying target sid
      Returns:
      element with specific id or null if not found
    • selectNodes

      public List<?> selectNodes(org.jdom2.Element element, String query)
      Select nodes through an XPath query and return all hits as a List
      Parameters:
      element - root element to start search on
      query - XPath expression
      Returns:
      the list of selected items, which may be of types: Element, Attribute, Text, CDATA, Comment, ProcessingInstruction, Boolean, Double, or String.
    • selectSingleNode

      public Object selectSingleNode(org.jdom2.Element element, String query)
      Select nodes through an XPath query and returns the first hit
      Parameters:
      element - root element to start search on
      query - XPath expression
      Returns:
      the first selected item, which may be of types: Element, Attribute, Text, CDATA, Comment, ProcessingInstruction, Boolean, Double, String, or null 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

      public String[] parseStringArray(org.jdom2.Element node)
      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

      public int getAttributeIntValue(org.jdom2.Element input, String attributeName, int defaultVal)
      Parse an int value in an attribute.
      Parameters:
      input - Element containing the attribute
      attributeName - Attribute name to parse a value for
      defaultVal - the default value
      Returns:
      parsed integer
    • getColor

      public ColorRGBA getColor(String colorDescription)
      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