Package xj3d.filter
Class DEFUSEImageTextureFilter
java.lang.Object
xj3d.filter.AbstractFilter
xj3d.filter.DEFUSEImageTextureFilter
- All Implemented Interfaces:
BinaryContentHandler,ContentHandler,ProtoHandler,RouteHandler,ScriptHandler,StringContentHandler
Finds duplicate url references in ImageTextures and DEF/USE them
This version is 1 pass, so it must DEF all ImageTextures in the
scene.
Metadata on ImageTextures will be lost. We would need a node buffering strategy to fix this.
Assumes that urls with the first entry the same are equal.
- Version:
- $Revision: 1.8 $
- Author:
- Alan Hudson
-
Field Summary
Fields 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(String value) The value of a normal field.voidfieldValue(String[] values) The value of an MFField where the underlying parser knows about how the values are broken up.voidfieldValue(String[] values, int len) Set the value of the field at the given index as an array of strings.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.AbstractFilter
componentDecl, endExternProtoDecl, endProtoBody, endProtoDecl, endScriptDecl, exportDecl, externProtoURI, fieldValue, fieldValue, fieldValue, fieldValue, fieldValue, fieldValue, fieldValue, fieldValue, fieldValue, fieldValue, getContentHandler, getErrorReporter, getLastErrorCode, getProtoHandler, getRouteHandler, getScriptHandler, importDecl, metaDecl, profileDecl, protoFieldDecl, protoIsDecl, routeDecl, scriptFieldDecl, setArguments, setContentHandler, setDocumentLocator, setErrorReporter, setParsingType, setProtoHandler, setRouteHandler, setScriptHandler, startDocument, startExternProtoDecl, startProtoBody, startProtoDecl, startScriptDecl
-
Constructor Details
-
DEFUSEImageTextureFilter
public DEFUSEImageTextureFilter()Construct a default instance of this filter
-
-
Method Details
-
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 classAbstractFilter- 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 classAbstractFilter- 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 classAbstractFilter- 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 classAbstractFilter- 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 classAbstractFilter- 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 classAbstractFilter- 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 an MFField where the underlying parser knows about how the values are broken up. The parser is not required to support this callback, but implementors of this interface should understand it. The most likely time we will have this method called is for MFString or URL lists. If called, it is guaranteed to split the strings along the SF node type boundaries.- Specified by:
fieldValuein interfaceStringContentHandler- Overrides:
fieldValuein classAbstractFilter- Parameters:
values- The list of string representing the values- 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
-
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 classAbstractFilter- Parameters:
values- 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
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 classAbstractFilter- 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.
-