Class TriangulationFilter
- All Implemented Interfaces:
BinaryContentHandler,ContentHandler,ProtoHandler,RouteHandler,ScriptHandler,StringContentHandler
The output form is not always going to be an IndexedTriangleSet (though this could be implemented by way of argument flags in a later revision). The current implementation can process the following geometry types:
- Box
- Cone
- Cylinder
- Sphere
- ElevationGridGeometry
- ExtrusionGeometry
- IndexedFaceSetGeometry
- IndexedTriangleFanSetGeometry
- IndexedTriangleSetGeometry
- IndexedTriangleStripSetGeometry
- TriangleFanSetGeometry
- TriangleSetGeometry
- TriangleStripSetGeometry
This filter will force an upgrade to X3D if VRML is detected. VRML Does not have the IndexedTriangle* nodes that are generated as output of this filter.
- Version:
- $Revision: 1.11 $
- Author:
- Justin Couch
-
Field Summary
Fields inherited from class xj3d.filter.BaseFilter
insideInvalidField, sceneMarker, suppressCallsFields inherited from class xj3d.filter.AbstractFilter
contentHandler, documentLocator, errorHandler, fieldHandler, fieldReader, fieldStack, lastErrorCode, majorVersion, minorVersion, nodeStack, parsingType, protoHandler, routeHandler, scriptHandler -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidDeclaration of the end of the document.voidendField()Notification of the end of a field declaration.voidendNode()Notification of the end of a node declaration.voidfieldValue(boolean value) Set the value of the field at the given index as an boolean.voidfieldValue(boolean[] value, int len) Set the value of the field at the given index as an array of boolean.voidfieldValue(double value) Set the value of the field at the given index as an double.voidfieldValue(double[] value, int len) Set the value of the field at the given index as an array of doubles.voidfieldValue(float value) Set the value of the field at the given index as a float.voidfieldValue(float[] value, int len) Set the value of the field at the given index as an array of floats.voidfieldValue(int value) Set the value of the field at the given index as an integer.voidfieldValue(int[] value, int len) Set the value of the field at the given index as an array of integers.voidfieldValue(long value) Set the value of the field at the given index as an long.voidfieldValue(long[] value, int len) Set the value of the field at the given index as an array of longs.voidfieldValue(String value) The value of a normal field.voidfieldValue(String[] values) Set the value of the field at the given index as an array of strings.voidfieldValue(String[] value, int len) Set the value of the field at the given index as an array of strings.voidNotification of a ROUTE declaration in the file.voidsetArguments(String[] args) Set the argument parameters to control the filter operationvoidDeclaration of the start of the document.voidstartField(String name) Notification of a field declaration.voidNotification of the start of a node.voidThe field value is a USE for the given node name.Methods inherited from class xj3d.filter.BaseFilter
componentDecl, endExternProtoDecl, endProtoBody, endProtoDecl, endScriptDecl, exportDecl, externProtoURI, getContentHandler, getErrorReporter, getLastErrorCode, getProtoHandler, getRouteHandler, getScriptHandler, importDecl, metaDecl, profileDecl, protoFieldDecl, protoIsDecl, scriptFieldDecl, setContentHandler, setDebug, setDocumentLocator, setErrorReporter, setProtoHandler, setRouteHandler, setScriptHandler, startExternProtoDecl, startProtoBody, startProtoDecl, startScriptDecl, suppressCallsMethods inherited from class xj3d.filter.AbstractFilter
setParsingType
-
Constructor Details
-
TriangulationFilter
public TriangulationFilter()Create a new default filter for the conversion
-
-
Method Details
-
startDocument
public void startDocument(String uri, String url, String encoding, String type, String version, String comment) throws SAVException, VRMLException Declaration of the start of the document. The parameters are all of the values that are declared on the header line of the file after the#start. The type string contains the representation of the first few characters of the file after the #. This allows us to work out if it is VRML97 or the later X3D spec.Version numbers change from VRML97 to X3D and aren't logical. In the first, it is
#VRML V2.0and the second is#X3D V1.0even though this second header represents a later spec.- Specified by:
startDocumentin interfaceContentHandler- Overrides:
startDocumentin classBaseFilter- Parameters:
uri- The URI of the file.url- The base URL of the file for resolving relative URIs contained in the fileencoding- The encoding of this document - utf8 or binarytype- The bytes of the first part of the file headerversion- The full VRML version string of this documentcomment- Any trailing text on this line. If there is none, this is null.- Throws:
SAVException- This call is taken at the wrong time in the structure of the document.VRMLException- This call is taken at the wrong time in the structure of the document.
-
endDocument
Declaration of the end of the document. There will be no further parsing and hence events after this.- Specified by:
endDocumentin interfaceContentHandler- Overrides:
endDocumentin classBaseFilter- Throws:
SAVException- This call is taken at the wrong time in the structure of the document.VRMLException- This call is taken at the wrong time in the structure of the document.
-
startNode
Notification of the start of a node. This is the opening statement of a node and it's DEF name. USE declarations are handled in a separate method.- Specified by:
startNodein interfaceContentHandler- Overrides:
startNodein classBaseFilter- Parameters:
name- The name of the node that we are about to parsedefName- The string associated with the DEF name. Null if not given for this node.- Throws:
SAVException- This call is taken at the wrong time in the structure of the document.VRMLException- This call is taken at the wrong time in the structure of the document.
-
endNode
Notification of the end of a node declaration.- Specified by:
endNodein interfaceContentHandler- Overrides:
endNodein classBaseFilter- Throws:
SAVException- This call is taken at the wrong time in the structure of the document.VRMLException- This call is taken at the wrong time in the structure of the document.
-
startField
Notification of a field declaration. This notification is only called if it is a standard node. If the node is a script or PROTO declaration then theScriptHandlerorProtoHandlermethods are used.- Specified by:
startFieldin interfaceContentHandler- Overrides:
startFieldin classBaseFilter- Parameters:
name- The name of the field declared- Throws:
SAVException- This call is taken at the wrong time in the structure of the document.VRMLException- This call is taken at the wrong time in the structure of the document.
-
useDecl
The field value is a USE for the given node name. This is a terminating call for startField as well. The next call will either be anotherstartField()orendNode().- Specified by:
useDeclin interfaceContentHandler- Overrides:
useDeclin classBaseFilter- Parameters:
defName- The name of the DEF string to use- Throws:
SAVException- This call is taken at the wrong time in the structure of the document.VRMLException- This call is taken at the wrong time in the structure of the document.
-
endField
Notification of the end of a field declaration. This is called only at the end of an MFNode declaration. All other fields are terminated by eitheruseDecl(String)orfieldValue(String). This will only ever be called if there have been nodes declared. If no nodes have been declared (ie "[]") then you will get afieldValue(). call with the parameter value of null.- Specified by:
endFieldin interfaceContentHandler- Overrides:
endFieldin classBaseFilter- Throws:
SAVException- This call is taken at the wrong time in the structure of the document.VRMLException- This call is taken at the wrong time in the structure of the document.
-
fieldValue
The value of a normal field. This is a string that represents the entire value of the field. MFStrings will have to be parsed. This is a terminating call for startField as well. The next call will either be anotherstartField()orendNode().If this field is an SFNode with a USE declaration you will have the
useDecl(String)method called rather than this method. If the SFNode is empty the value returned here will be "NULL".There are times where we have an MFField that is declared in the file to be empty. To signify this case, this method will be called with a parameter value of null. A lot of the time this is because we can't really determine if the incoming node is an MFNode or not.
- Specified by:
fieldValuein interfaceBinaryContentHandler- Specified by:
fieldValuein interfaceStringContentHandler- Overrides:
fieldValuein classBaseFilter- Parameters:
value- The value of this field- Throws:
SAVException- This call is taken at the wrong time in the structure of the document.VRMLException- This call is taken at the wrong time in the structure of the document.
-
fieldValue
Set the value of the field at the given index as an array of strings. This would be used to set MFString field types.- Specified by:
fieldValuein interfaceStringContentHandler- Overrides:
fieldValuein classBaseFilter- Parameters:
values- The new value to use for the node- Throws:
SAVException- This call is taken at the wrong time in the structure of the document.VRMLException- This call is taken at the wrong time in the structure of the document.
-
fieldValue
Set the value of the field at the given index as an integer. This would be used to set SFInt32 field types.- Specified by:
fieldValuein interfaceBinaryContentHandler- Overrides:
fieldValuein classBaseFilter- Parameters:
value- The new value to use for the node- Throws:
SAVException- This call is taken at the wrong time in the structure of the document.VRMLException- This call is taken at the wrong time in the structure of the document.
-
fieldValue
Set the value of the field at the given index as an array of integers. This would be used to set MFInt32 field types.- Specified by:
fieldValuein interfaceBinaryContentHandler- Overrides:
fieldValuein classBaseFilter- Parameters:
value- The new value to use for the nodelen- The number of valid entries in the value array- Throws:
SAVException- This call is taken at the wrong time in the structure of the document.VRMLException- This call is taken at the wrong time in the structure of the document.
-
fieldValue
Set the value of the field at the given index as an boolean. This would be used to set SFBool field types.- Specified by:
fieldValuein interfaceBinaryContentHandler- Overrides:
fieldValuein classBaseFilter- Parameters:
value- The new value to use for the node- Throws:
SAVException- This call is taken at the wrong time in the structure of the document.VRMLException- This call is taken at the wrong time in the structure of the document.
-
fieldValue
Set the value of the field at the given index as an array of boolean. This would be used to set MFBool field types.- Specified by:
fieldValuein interfaceBinaryContentHandler- Overrides:
fieldValuein classBaseFilter- Parameters:
value- The new value to use for the nodelen- The number of valid entries in the value array- Throws:
SAVException- This call is taken at the wrong time in the structure of the document.VRMLException- This call is taken at the wrong time in the structure of the document.
-
fieldValue
Set the value of the field at the given index as a float. This would be used to set SFFloat field types.- Specified by:
fieldValuein interfaceBinaryContentHandler- Overrides:
fieldValuein classBaseFilter- Parameters:
value- The new value to use for the node- Throws:
SAVException- This call is taken at the wrong time in the structure of the document.VRMLException- This call is taken at the wrong time in the structure of the document.
-
fieldValue
Set the value of the field at the given index as an array of floats. This would be used to set MFFloat, SFVec2f, SFVec3f and SFRotation field types.- Specified by:
fieldValuein interfaceBinaryContentHandler- Overrides:
fieldValuein classBaseFilter- Parameters:
value- The new value to use for the nodelen- The number of valid entries in the value array- Throws:
SAVException- This call is taken at the wrong time in the structure of the document.VRMLException- This call is taken at the wrong time in the structure of the document.
-
fieldValue
Set the value of the field at the given index as an long. This would be used to set SFTime field types.- Specified by:
fieldValuein interfaceBinaryContentHandler- Overrides:
fieldValuein classBaseFilter- Parameters:
value- The new value to use for the node- Throws:
SAVException- This call is taken at the wrong time in the structure of the document.VRMLException- This call is taken at the wrong time in the structure of the document.
-
fieldValue
Set the value of the field at the given index as an array of longs. This would be used to set MFTime field types.- Specified by:
fieldValuein interfaceBinaryContentHandler- Overrides:
fieldValuein classBaseFilter- Parameters:
value- The new value to use for the nodelen- The number of valid entries in the value array- Throws:
SAVException- This call is taken at the wrong time in the structure of the document.VRMLException- This call is taken at the wrong time in the structure of the document.
-
fieldValue
Set the value of the field at the given index as an double. This would be used to set SFDouble field types.- Specified by:
fieldValuein interfaceBinaryContentHandler- Overrides:
fieldValuein classBaseFilter- Parameters:
value- The new value to use for the node- Throws:
SAVException- This call is taken at the wrong time in the structure of the document.VRMLException- This call is taken at the wrong time in the structure of the document.
-
fieldValue
Set the value of the field at the given index as an array of doubles. This would be used to set MFDouble, SFVec2d and SFVec3d field types.- Specified by:
fieldValuein interfaceBinaryContentHandler- Overrides:
fieldValuein classBaseFilter- Parameters:
value- The new value to use for the nodelen- The number of valid entries in the value array- Throws:
SAVException- This call is taken at the wrong time in the structure of the document.VRMLException- This call is taken at the wrong time in the structure of the document.
-
fieldValue
Set the value of the field at the given index as an array of strings. This would be used to set MFString field types.- Specified by:
fieldValuein interfaceBinaryContentHandler- Overrides:
fieldValuein classBaseFilter- Parameters:
value- The new value to use for the nodelen- The number of valid entries in the value array- Throws:
SAVException- This call is taken at the wrong time in the structure of the document.VRMLException- This call is taken at the wrong time in the structure of the document.
-
routeDecl
public void routeDecl(String srcNodeName, String srcFieldName, String destNodeName, String destFieldName) throws SAVException, VRMLException Notification of a ROUTE declaration in the file. The context of this route should be assumed from the surrounding calls to start and end of proto and node bodies.- Specified by:
routeDeclin interfaceRouteHandler- Overrides:
routeDeclin classBaseFilter- Parameters:
srcNodeName- The name of the DEF of the source nodesrcFieldName- The name of the field to route values fromdestNodeName- The name of the DEF of the destination nodedestFieldName- The name of the field to route values to- Throws:
SAVException- This call is taken at the wrong time in the structure of the documentVRMLException- The content provided is invalid for this part of the document or can't be parsed
-
setArguments
Set the argument parameters to control the filter operation- Overrides:
setArgumentsin classBaseFilter- Parameters:
args- The array of argument parameters.
-