Class FileSurfaceXML_J3D.SurfaceXMLHandler
java.lang.Object
org.xml.sax.helpers.DefaultHandler
gov.nih.mipav.view.renderer.J3D.model.file.FileSurfaceXML_J3D.SurfaceXMLHandler
- All Implemented Interfaces:
ContentHandler,DTDHandler,EntityResolver,ErrorHandler
- Enclosing class:
FileSurfaceXML_J3D
Used by the XML Parser to parse the Surface.XML header.
-
Field Summary
FieldsModifier and TypeFieldDescription(package private) StringCurrent XML keyword:.(package private) StringCurrent buffer:.(package private) FileInfoSurfaceXML_J3DfileInfo data structure for reading the surface information into:.private int[]Triangle mesh connectivity (index) array.private javax.vecmath.Color4f[]Triangle mesh colors (may be null).private javax.vecmath.Vector3f[]Triangle mesh normals (may be null).private javax.vecmath.Point3f[]Vertex, Normal, and Connectivity arrays to read into from the file:. -
Constructor Summary
ConstructorsConstructorDescriptionCreates a new SurfaceXMLHandler object. -
Method Summary
Modifier and TypeMethodDescriptionvoidcharacters(char[] ch, int start, int length) Text data callback from parser.voidDo nothing.voidendElement(String namespaceURI, String localName, String qName) Called by parser when the end of an element is reached in the document.private javax.vecmath.Color3fCalled when reading the input surface.xml file: Parses the input string into a Color3f variable:private voidCalled when reading the input surface.xml file: Parses the input string into a an array of Color4f[], representing the mesh per-vertex colors:getColorString(javax.vecmath.Color3f kColor) Called when writing the surface.xml file: Converts the input Color3f to a String for writing:getColorString(javax.vecmath.Color4f[] akColors) Called when writing the surface.xml file: Converts the input array of Color4f[] to a String for writing:private voidgetConnectivity(String kParseString) Called when reading the input surface.xml file: Parses the input string into a an array of int[] to represent the mesh connectivity:getIndexString(int[] aiConnectivity) Called when writing the surface.xml file: Converts the input array of int[] to a String for writing:private voidgetNormals(String kParseString) Called when reading the input surface.xml file: Parses the input string into a an array of Vector3f[], representing the mesh normals:getNormalString(javax.vecmath.Vector3f[] akNormals) Called when writing the surface.xml file: Converts the input array of Vector3f[] to a String for writing:getVertexString(javax.vecmath.Point3f[] akVertices) Called when writing the surface.xml file: Converts the input array of Point3f[] to a String for writing:private voidgetVertices(String kParseString) Called when reading the input surface.xml file: Parses the input string into a an array of Point3f[], representing the mesh vertices:voidskippedEntity(String name) Do nothing but show the entity we skipped.voidstartElement(String namespaceURI, String localName, String qName, Attributes atts) Parser calls this for the beginning of each element in the document.Methods inherited from class org.xml.sax.helpers.DefaultHandler
endPrefixMapping, error, fatalError, ignorableWhitespace, notationDecl, processingInstruction, resolveEntity, setDocumentLocator, startDocument, startPrefixMapping, unparsedEntityDecl, warningMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.xml.sax.ContentHandler
declaration
-
Field Details
-
currentKey
String currentKeyCurrent XML keyword:. -
elementBuffer
String elementBufferCurrent buffer:. -
fileInfo
FileInfoSurfaceXML_J3D fileInfofileInfo data structure for reading the surface information into:. -
m_aiIndex
private int[] m_aiIndexTriangle mesh connectivity (index) array. -
m_akColors
private javax.vecmath.Color4f[] m_akColorsTriangle mesh colors (may be null). -
m_akNormals
private javax.vecmath.Vector3f[] m_akNormalsTriangle mesh normals (may be null). -
m_akVertices
private javax.vecmath.Point3f[] m_akVerticesVertex, Normal, and Connectivity arrays to read into from the file:.
-
-
Constructor Details
-
SurfaceXMLHandler
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:
charactersin interfaceContentHandler- Overrides:
charactersin classDefaultHandler- Parameters:
ch- Character arraystart- Start of data in array.length- Length of data in array.
-
endDocument
Do nothing.- Specified by:
endDocumentin interfaceContentHandler- Overrides:
endDocumentin classDefaultHandler- Throws:
SAXException- never happens
-
endElement
Called by parser when the end of an element is reached in the document.- Specified by:
endElementin interfaceContentHandler- Overrides:
endElementin classDefaultHandler- Parameters:
namespaceURI- the namespace urilocalName- the element nameqName- the qualified name- Throws:
SAXException- if a problem is encountered during parsing
-
getColorString
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
-
getColorString
Called when writing the surface.xml file: Converts the input array of Color4f[] to a String for writing:- Parameters:
akColors- array of Color4f, representing the surface triangle mesh per-vertex colors.- Returns:
- colors array in string format
-
getIndexString
Called when writing the surface.xml file: Converts the input array of int[] to a String for writing:- Parameters:
aiConnectivity- the connectivity array- Returns:
- the connectivity array in string format
-
getNormalString
Called when writing the surface.xml file: Converts the input array of Vector3f[] to a String for writing:- Parameters:
akNormals- normals array- Returns:
- normals array in string format
-
getVertexString
Called when writing the surface.xml file: Converts the input array of Point3f[] to a String for writing:- Parameters:
akVertices- mesh coordinate array- Returns:
- mesh coordinate array in string format
-
skippedEntity
Do nothing but show the entity we skipped.- Specified by:
skippedEntityin interfaceContentHandler- Overrides:
skippedEntityin classDefaultHandler- 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:
startElementin interfaceContentHandler- Overrides:
startElementin classDefaultHandler- Parameters:
namespaceURI- the namespace urilocalName- the element nameqName- the qualified nameatts- the attached attributes- Throws:
SAXException- if a problem is encountered during parsing
-
getColor
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
-
getColors
Called when reading the input surface.xml file: Parses the input string into a an array of Color4f[], representing the mesh per-vertex colors:- Parameters:
kParseString- input sting containing per-vertex color information.
-
getConnectivity
Called when reading the input surface.xml file: Parses the input string into a an array of int[] to represent the mesh connectivity:- Parameters:
kParseString- the string containing the connectivity information
-
getNormals
Called when reading the input surface.xml file: Parses the input string into a an array of Vector3f[], representing the mesh normals:- Parameters:
kParseString- string containing mesh normals
-
getVertices
Called when reading the input surface.xml file: Parses the input string into a an array of Point3f[], representing the mesh vertices:- Parameters:
kParseString- string containing mesh coordinates
-