Class FileSurfaceRefXML_J3D.SurfaceRefXMLHandler

java.lang.Object
org.xml.sax.helpers.DefaultHandler
gov.nih.mipav.view.renderer.J3D.model.file.FileSurfaceRefXML_J3D.SurfaceRefXMLHandler
All Implemented Interfaces:
ContentHandler, DTDHandler, EntityResolver, ErrorHandler
Enclosing class:
FileSurfaceRefXML_J3D

private class FileSurfaceRefXML_J3D.SurfaceRefXMLHandler extends DefaultHandler
Used by the XML Parser to parse the Surface.XML header.
  • Field Details

    • currentKey

      String currentKey
      Current XML keyword:.
    • elementBuffer

      String elementBuffer
      Current buffer:.
    • fileInfo

      fileInfo data structure for reading the surface information into:.
  • Constructor Details

    • SurfaceRefXMLHandler

      public SurfaceRefXMLHandler(FileInfoSurfaceRefXML_J3D fInfo)
      Creates a new SurfaceXMLHandler object.
      Parameters:
      fInfo - FileInfo for storing the file data into.
  • Method Details

    • characters

      public void characters(char[] ch, int start, int length)
      Text data callback from parser. If the parser is not validating, this method can report whitespace. We ignore strings that are entirely whitespace.
      Specified by:
      characters in interface ContentHandler
      Overrides:
      characters in class DefaultHandler
      Parameters:
      ch - Character array
      start - Start of data in array.
      length - Length of data in array.
    • endDocument

      public void endDocument() throws SAXException
      Do nothing.
      Specified by:
      endDocument in interface ContentHandler
      Overrides:
      endDocument in class DefaultHandler
      Throws:
      SAXException - never happens
    • endElement

      public void endElement(String namespaceURI, String localName, String qName) throws SAXException
      Called by parser when the end of an element is reached in the document.
      Specified by:
      endElement in interface ContentHandler
      Overrides:
      endElement in class DefaultHandler
      Parameters:
      namespaceURI - the namespace uri
      localName - the element name
      qName - the qualified name
      Throws:
      SAXException - if a problem is encountered during parsing
    • skippedEntity

      public void skippedEntity(String name)
      Do nothing but show the entity we skipped.
      Specified by:
      skippedEntity in interface ContentHandler
      Overrides:
      skippedEntity in class DefaultHandler
      Parameters:
      name - the skipped entity name
    • startElement

      public void startElement(String namespaceURI, String localName, String qName, Attributes atts) throws SAXException
      Parser calls this for the beginning of each element in the document.
      Specified by:
      startElement in interface ContentHandler
      Overrides:
      startElement in class DefaultHandler
      Parameters:
      namespaceURI - the namespace uri
      localName - the element name
      qName - the qualified name
      atts - the attached attributes
      Throws:
      SAXException - if a problem is encountered during parsing
    • getColorString

      public String getColorString(javax.vecmath.Color3f kColor)
      Called when writing the surface.xml file: Converts the input Color3f to a String for writing:
      Parameters:
      kColor - color object
      Returns:
      the color in string format
    • getColor

      private javax.vecmath.Color3f getColor(String kParseString)
      Called when reading the input surface.xml file: Parses the input string into a Color3f variable:
      Parameters:
      kParseString - input string containing the material color
      Returns:
      the material color in Color3f format