Package mgui.io.standard.gifti.xml
Class GiftiXMLHandler
java.lang.Object
org.xml.sax.helpers.DefaultHandler
mgui.io.standard.gifti.xml.GiftiXMLHandler
- All Implemented Interfaces:
org.xml.sax.ContentHandler
,org.xml.sax.DTDHandler
,org.xml.sax.EntityResolver
,org.xml.sax.ErrorHandler
public class GiftiXMLHandler
extends org.xml.sax.helpers.DefaultHandler
XML handler for GIFTI format surface files. See
http://www.nitrc.org/projects/gifti/ for details and specification.
- Since:
- 1.0
- Version:
- 1.0
- Author:
- Andrew Reid
-
Field Summary
-
Constructor Summary
Constructors Constructor Description GiftiXMLHandler()
GiftiXMLHandler(Mesh3DInt mesh)
Instantiate this handler with a pre-defined mesh. -
Method Summary
Modifier and Type Method Description protected void
addVertexData(java.lang.String column_name, byte[] b_data)
protected void
addVertexData(java.lang.String column_name, java.lang.String ascii_data)
void
characters(char[] ch, int start, int length)
void
endElement(java.lang.String uri, java.lang.String localName, java.lang.String qName)
Mesh3DInt
getMesh()
Returns the loaded surface.java.lang.String
getTopoFile()
Returns the associated topo file, if one was set.java.util.ArrayList<Jama.Matrix>
getTransforms()
Returns the transform(s), if any were setprotected Jama.Matrix
parseMatrix(java.lang.String s_data)
protected void
setSurfaceCoords(byte[] b_data)
Sets the coordinates fromb_data
, with the given "da" parameters.protected void
setSurfaceCoords(java.lang.String ascii_data)
protected void
setSurfaceFaces(byte[] b_data)
Sets this mesh's faces fromb_data
.protected void
setSurfaceFaces(java.lang.String ascii_data)
void
startElement(java.lang.String uri, java.lang.String localName, java.lang.String qName, org.xml.sax.Attributes attributes)
Methods inherited from class org.xml.sax.helpers.DefaultHandler
endDocument, endPrefixMapping, error, fatalError, ignorableWhitespace, notationDecl, processingInstruction, resolveEntity, setDocumentLocator, skippedEntity, startDocument, startPrefixMapping, unparsedEntityDecl, warning
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.xml.sax.ContentHandler
declaration
-
Field Details
-
topo_file
protected java.lang.String topo_file -
md_name
protected java.lang.String md_name -
md_value
protected java.lang.String md_value
-
-
Constructor Details
-
GiftiXMLHandler
public GiftiXMLHandler() -
GiftiXMLHandler
Instantiate this handler with a pre-defined mesh. If the- Parameters:
mesh
-
-
-
Method Details
-
getMesh
Returns the loaded surface.- Returns:
-
getTopoFile
public java.lang.String getTopoFile()Returns the associated topo file, if one was set.- Returns:
-
getTransforms
public java.util.ArrayList<Jama.Matrix> getTransforms()Returns the transform(s), if any were set- Returns:
-
startElement
public void startElement(java.lang.String uri, java.lang.String localName, java.lang.String qName, org.xml.sax.Attributes attributes) throws org.xml.sax.SAXException- Specified by:
startElement
in interfaceorg.xml.sax.ContentHandler
- Overrides:
startElement
in classorg.xml.sax.helpers.DefaultHandler
- Throws:
org.xml.sax.SAXException
-
endElement
public void endElement(java.lang.String uri, java.lang.String localName, java.lang.String qName) throws org.xml.sax.SAXException- Specified by:
endElement
in interfaceorg.xml.sax.ContentHandler
- Overrides:
endElement
in classorg.xml.sax.helpers.DefaultHandler
- Throws:
org.xml.sax.SAXException
-
characters
public void characters(char[] ch, int start, int length) throws org.xml.sax.SAXException- Specified by:
characters
in interfaceorg.xml.sax.ContentHandler
- Overrides:
characters
in classorg.xml.sax.helpers.DefaultHandler
- Throws:
org.xml.sax.SAXException
-
parseMatrix
protected Jama.Matrix parseMatrix(java.lang.String s_data) throws org.xml.sax.SAXException- Throws:
org.xml.sax.SAXException
-
setSurfaceCoords
protected void setSurfaceCoords(byte[] b_data) throws org.xml.sax.SAXExceptionSets the coordinates fromb_data
, with the given "da" parameters. If the mesh already has coordinates and faces, they will be deleted.- Parameters:
b_data
-- Throws:
org.xml.sax.SAXException
-
setSurfaceCoords
protected void setSurfaceCoords(java.lang.String ascii_data) throws org.xml.sax.SAXException- Throws:
org.xml.sax.SAXException
-
setSurfaceFaces
protected void setSurfaceFaces(byte[] b_data) throws org.xml.sax.SAXExceptionSets this mesh's faces fromb_data
. If faces already exist, they will be deleted.- Parameters:
b_data
-- Throws:
org.xml.sax.SAXException
-
setSurfaceFaces
protected void setSurfaceFaces(java.lang.String ascii_data) throws org.xml.sax.SAXException- Throws:
org.xml.sax.SAXException
-
addVertexData
protected void addVertexData(java.lang.String column_name, byte[] b_data) throws org.xml.sax.SAXException- Throws:
org.xml.sax.SAXException
-
addVertexData
protected void addVertexData(java.lang.String column_name, java.lang.String ascii_data) throws org.xml.sax.SAXException- Throws:
org.xml.sax.SAXException
-