Package xj3d.filter.filters
Class GlobalBoundsFilter
java.lang.Object
xj3d.filter.AbstractFilter
xj3d.filter.BaseFilter
xj3d.filter.node.EncodedBaseFilter
xj3d.filter.filters.GlobalBoundsFilter
- All Implemented Interfaces:
BinaryContentHandler
,ContentHandler
,ProtoHandler
,RouteHandler
,ScriptHandler
,StringContentHandler
Processes the world and calculates the global bounds of the entire world.
Assumes that the FlattenTransform filter is run before this and has squashed all the objects down to single shape nodes that are at the file root. Works on the coordinates of the geometry, not any explicit bbox definitions.
Output is through the message reporter and generates it in the order center x, center y, center z, size x, size y, size z, where size is the total length along that axis, based on the center. Filter Options
None.
- Version:
- $Revision: 1.3 $
- Author:
- Justin Couch
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected float[]
max bounding point of the object in the order x,y,zprotected float[]
min bounding point of the object in the order x,y,zFields inherited from class xj3d.filter.node.EncodedBaseFilter
encMap, encodeNodes, encodeRoutes, encStack, factory, scene
Fields inherited from class xj3d.filter.BaseFilter
insideInvalidField, sceneMarker, suppressCalls
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 TypeMethodDescriptionvoid
Declaration of the end of the document.void
endNode()
Notification of the end of a node declaration.void
Declaration of the start of the document.void
Notification of the start of a node.Methods inherited from class xj3d.filter.node.EncodedBaseFilter
encode, endField, fieldValue, fieldValue, fieldValue, fieldValue, fieldValue, fieldValue, fieldValue, fieldValue, fieldValue, fieldValue, fieldValue, fieldValue, fieldValue, routeDecl, setDebug, useDecl
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, setArguments, setContentHandler, setDocumentLocator, setErrorReporter, setProtoHandler, setRouteHandler, setScriptHandler, startExternProtoDecl, startField, startProtoBody, startProtoDecl, startScriptDecl, suppressCalls
Methods inherited from class xj3d.filter.AbstractFilter
setParsingType
-
Field Details
-
minBound
protected float[] minBoundmin bounding point of the object in the order x,y,z -
maxBound
protected float[] maxBoundmax bounding point of the object in the order x,y,z
-
-
Constructor Details
-
GlobalBoundsFilter
public GlobalBoundsFilter()Recenters the geometry
-
-
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.0
and the second is#X3D V1.0
even though this second header represents a later spec.- Specified by:
startDocument
in interfaceContentHandler
- Overrides:
startDocument
in classEncodedBaseFilter
- 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:
endDocument
in interfaceContentHandler
- Overrides:
endDocument
in classEncodedBaseFilter
- 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:
startNode
in interfaceContentHandler
- Overrides:
startNode
in classEncodedBaseFilter
- 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:
endNode
in interfaceContentHandler
- Overrides:
endNode
in classEncodedBaseFilter
- 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.
-