|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectiicm.vrml.pw.Traverser
iicm.vrml.pw.SceneTraverser
public class SceneTraverser
Traverses VRML scene graph. It walks through a VRML97 scene nodes hiearchy to extract
relevant information and store the data in a W3C DOM Document
class.
Field Summary | |
---|---|
private int |
currentLevel
|
private java.util.Vector |
defNames
|
private org.w3c.dom.Document |
doc
|
private boolean |
isChildOfAppearance
|
private boolean |
isChildOfShape
|
private boolean |
isChildOfSound
|
private boolean |
isChildOfText
|
private boolean |
isColorChild
|
private boolean |
isCoordinateChild
|
private boolean |
isNormalChild
|
private boolean |
isTextureCoordinateChild
|
private org.w3c.dom.Element |
parentAppearance
|
private org.w3c.dom.Element |
parentElement
|
private boolean |
parentElementSet
|
private org.w3c.dom.Element |
parentOfColor
|
private org.w3c.dom.Element |
parentOfCoordinate
|
private org.w3c.dom.Element |
parentOfNormal
|
private org.w3c.dom.Element |
parentOfTextureCoordinate
|
private org.w3c.dom.Element |
parentProto
|
private java.util.Vector |
parents
|
private org.w3c.dom.Element |
parentShape
|
private org.w3c.dom.Element |
parentSound
|
private org.w3c.dom.Element |
parentText
|
private org.w3c.dom.Element |
sceneElement
|
private boolean |
setExternProto
|
private boolean |
setFieldValue
|
Constructor Summary | |
---|---|
SceneTraverser(org.w3c.dom.Document d,
org.w3c.dom.Element sceneRoot)
Constructs a SceneTraverser . |
Method Summary | |
---|---|
private boolean |
arraysEqual(float[] array1,
float[] array2)
Returns a boolean value indicating whether two float arrays have equal values. |
private boolean |
arraysEqual(int[] array1,
int[] array2)
Returns a boolean value indicating whether two integer arrays have equal values. |
private boolean |
arraysEqual(java.lang.String[] array1,
java.lang.String[] array2)
Returns a boolean value indicating whether two string arrays have equal values. |
void |
checkISconnect(Node node,
org.w3c.dom.Element element)
Overrides super class's method. |
private java.lang.String |
convertToString(boolean bool)
Returns a string representation of a boolean. |
private java.lang.String |
convertToString(float[] array,
int length)
Returns a string representation of a float array. |
private java.lang.String |
convertToString(float[] array,
int length,
int count)
Returns a string representation of a float array. |
private java.lang.String |
convertToString(int[] array,
int length)
Returns a string representation of a integer array. |
private java.lang.String |
convertToString(int[] array,
int length,
int count)
Returns a string representation of a integer array. |
private java.lang.String |
convertToString(java.lang.String[] array,
int length,
boolean wrapInQuotes)
Returns a string representation of a string array. |
private org.w3c.dom.Element |
getFieldElement(Field f,
java.lang.String name)
Returns a field Element by extracting data from the given Field object. |
private boolean |
setObjectName(org.w3c.dom.Element element,
java.lang.String objname)
Registers object name for the node. |
void |
tAnchor(Anchor n)
Traverses an Anchor node. |
void |
tAppearance(Appearance n)
Traverses an Appearance node. |
void |
tAudioClip(AudioClip n)
Traverses an AudioClip node. |
void |
tBackground(Background n)
Traverses a Background node. |
void |
tBillboard(Billboard n)
Traverses a Billboard node. |
void |
tBox(Box n)
Traverses a Box node. |
void |
tCollision(Collision n)
Traverses a Collision node. |
void |
tColor(Color n)
Traverses a Color node. |
void |
tColorInterpolator(ColorInterpolator n)
Traverses a ColorInterpolator node. |
void |
tCone(Cone n)
Traverses a Cone node. |
void |
tCoordinate(Coordinate n)
Traverses a Coordinate node. |
void |
tCoordinateInterpolator(CoordinateInterpolator n)
Traverses a CoordinateInterpolator node. |
void |
tCylinder(Cylinder n)
Traverses a Cylinder node. |
void |
tCylinderSensor(CylinderSensor n)
Traverses a CylinderSensor node. |
void |
tDirectionalLight(DirectionalLight n)
Traverses a DirectionalLight node. |
void |
tElevationGrid(ElevationGrid n)
Traverses an ElevationGrid node. |
void |
tExtrusion(Extrusion n)
Traverses an Extrusion node. |
void |
tFog(Fog n)
Traverses a Fog node. |
void |
tFontStyle(FontStyle n)
Traverses a FontStyle node. |
void |
tGroup(Group n)
Traverses a Group node. |
void |
tGroupNode(GroupNode n)
Overrides super class's method. |
void |
tImageTexture(ImageTexture n)
Traverses an ImageTexture node. |
void |
tIndexedFaceSet(IndexedFaceSet n)
Traverses an IndexedFaceSet node. |
void |
tIndexedLineSet(IndexedLineSet n)
Traverses an IndexedLineSet node. |
void |
tInline(Inline n)
Traverses an Inline node. |
void |
tLOD(LOD n)
Traverses a LOD node. |
void |
tMaterial(Material n)
Traverses a Material node. |
void |
tMovieTexture(MovieTexture n)
Traverses a MovieTexture node. |
void |
tNavigationInfo(NavigationInfo n)
Traverses a NavigationInfo node. |
void |
tNormal(Normal n)
Traverses a Normal node. |
void |
tNormalInterpolator(NormalInterpolator n)
Traverses a NormalInterpolator node. |
void |
tOrientationInterpolator(OrientationInterpolator n)
Traverses an OrientationInterpolator node. |
void |
tPixelTexture(PixelTexture n)
Traverses a PixelTexture node. |
void |
tPlaneSensor(PlaneSensor n)
Traverses a PlaneSensor node. |
void |
tPointLight(PointLight n)
Traverses a PointLight node. |
void |
tPointSet(PointSet n)
Traverses a PointSet node. |
void |
tPositionInterpolator(PositionInterpolator n)
Traverses a PositionInterpolator node. |
void |
tProtoInstance(ProtoInstance n)
Traverses a ProtoInstance node. |
void |
tProtoNode(ProtoNode n)
Traverses a Proto node. |
void |
tProximitySensor(ProximitySensor n)
Traverses a ProximitySensor node. |
private void |
traverseGenericNode(Node node,
org.w3c.dom.Element parent)
Traverses a generic node with a given parent. |
void |
tRoute(RouteNode n)
Traverses a ROUTE node (statement). |
void |
tScalarInterpolator(ScalarInterpolator n)
Traverses a ScalarInterpolator node. |
void |
tScript(Script n)
Traverses a Script node. |
void |
tShape(Shape n)
Traverses a Shape node. |
void |
tSound(Sound n)
Traverses a Sound node. |
void |
tSphere(Sphere n)
Traverses a Sphere node. |
void |
tSphereSensor(SphereSensor n)
Traverses a SphereSensor node. |
void |
tSpotLight(SpotLight n)
Traverses a SpotLight node. |
void |
tSwitch(Switch n)
Traverses a Switch node. |
void |
tText(Text n)
Traverses a Texture node. |
void |
tTextureCoordinate(TextureCoordinate n)
Traverses a TextureCoordinate node. |
void |
tTextureTransform(TextureTransform n)
Traverses a TextureTransform node. |
void |
tTimeSensor(TimeSensor n)
Traverses a TimeSensor node. |
void |
tTouchSensor(TouchSensor n)
Traverses a TouchSensor node. |
void |
tTransform(Transform n)
Traverses a Transform node. |
void |
tViewpoint(Viewpoint n)
Traverses a Viewpoint node. |
void |
tVisibilitySensor(VisibilitySensor n)
Traverses a VisibilitySensor node. |
void |
tWorldInfo(WorldInfo n)
Traverses a WorldInfo node. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private org.w3c.dom.Document doc
private org.w3c.dom.Element sceneElement
private org.w3c.dom.Element parentElement
private org.w3c.dom.Element parentProto
private org.w3c.dom.Element parentShape
private org.w3c.dom.Element parentAppearance
private org.w3c.dom.Element parentText
private org.w3c.dom.Element parentSound
private org.w3c.dom.Element parentOfColor
private org.w3c.dom.Element parentOfNormal
private org.w3c.dom.Element parentOfTextureCoordinate
private org.w3c.dom.Element parentOfCoordinate
private java.util.Vector defNames
private java.util.Vector parents
private int currentLevel
private boolean parentElementSet
private boolean setFieldValue
private boolean setExternProto
private boolean isChildOfSound
private boolean isChildOfShape
private boolean isChildOfAppearance
private boolean isChildOfText
private boolean isColorChild
private boolean isNormalChild
private boolean isTextureCoordinateChild
private boolean isCoordinateChild
Constructor Detail |
---|
public SceneTraverser(org.w3c.dom.Document d, org.w3c.dom.Element sceneRoot)
SceneTraverser
.
d
- W3C DOM DocumentsceneRoot
- the root Scene elementMethod Detail |
---|
public void checkISconnect(Node node, org.w3c.dom.Element element)
node
- the node to traverseelement
- the element to checkpublic void tGroupNode(GroupNode n)
tGroupNode
in class Traverser
n
- the node to traversepublic void tProtoInstance(ProtoInstance n)
tProtoInstance
in class Traverser
n
- a ProtoInstance node to traversepublic void tProtoNode(ProtoNode n)
tProtoNode
in class Traverser
n
- a Proto node to traversepublic void tViewpoint(Viewpoint n)
tViewpoint
in class Traverser
n
- a Viewpoint node to traversepublic void tNavigationInfo(NavigationInfo n)
tNavigationInfo
in class Traverser
n
- a NavigationInfo node to traversepublic void tFog(Fog n)
tFog
in class Traverser
n
- a Fog node to traversepublic void tBackground(Background n)
tBackground
in class Traverser
n
- a Background node to traversepublic void tRoute(RouteNode n)
tRoute
in class Traverser
n
- a ROUTE node to traversepublic void tScalarInterpolator(ScalarInterpolator n)
tScalarInterpolator
in class Traverser
n
- a ScalerInterpolator node to traversepublic void tPositionInterpolator(PositionInterpolator n)
tPositionInterpolator
in class Traverser
n
- a PositionInterpolator node to traversepublic void tOrientationInterpolator(OrientationInterpolator n)
tOrientationInterpolator
in class Traverser
n
- an OrientationInterpolator nodepublic void tNormalInterpolator(NormalInterpolator n)
tNormalInterpolator
in class Traverser
n
- a NormalInterpolator node to traversepublic void tCoordinateInterpolator(CoordinateInterpolator n)
tCoordinateInterpolator
in class Traverser
n
- a CoordinateInterpolator node to traversepublic void tColorInterpolator(ColorInterpolator n)
tColorInterpolator
in class Traverser
n
- a ColorInterpolator node to traversepublic void tTextureTransform(TextureTransform n)
tTextureTransform
in class Traverser
n
- a TextureTransform node to traversepublic void tPixelTexture(PixelTexture n)
tPixelTexture
in class Traverser
n
- a PixelTexture node to traversepublic void tMovieTexture(MovieTexture n)
tMovieTexture
in class Traverser
n
- a MovieTexture node to traversepublic void tImageTexture(ImageTexture n)
tImageTexture
in class Traverser
n
- an ImageTexture node to traversepublic void tMaterial(Material n)
tMaterial
in class Traverser
n
- a Material nodepublic void tFontStyle(FontStyle n)
tFontStyle
in class Traverser
n
- a FontStyle node to traversepublic void tAppearance(Appearance n)
tAppearance
in class Traverser
n
- an Appearance node to traversepublic void tTextureCoordinate(TextureCoordinate n)
tTextureCoordinate
in class Traverser
n
- a TextureCoordinate node to traversepublic void tNormal(Normal n)
tNormal
in class Traverser
n
- a Normal node to traversepublic void tCoordinate(Coordinate n)
tCoordinate
in class Traverser
n
- a Coordinate node to traversepublic void tColor(Color n)
tColor
in class Traverser
n
- a Color node to traversepublic void tText(Text n)
tText
in class Traverser
n
- a Text node to traversepublic void tSphere(Sphere n)
tSphere
in class Traverser
n
- a Sphere node to traversepublic void tPointSet(PointSet n)
tPointSet
in class Traverser
n
- a PointSet node to traversepublic void tIndexedLineSet(IndexedLineSet n)
tIndexedLineSet
in class Traverser
n
- an IndexedLineSet node to traversepublic void tIndexedFaceSet(IndexedFaceSet n)
tIndexedFaceSet
in class Traverser
n
- an IndexedFaceSet node to traversepublic void tExtrusion(Extrusion n)
tExtrusion
in class Traverser
n
- an Extrusion node to traversepublic void tElevationGrid(ElevationGrid n)
tElevationGrid
in class Traverser
n
- an ElevationGrid node to traversepublic void tCylinder(Cylinder n)
tCylinder
in class Traverser
n
- a Cylinder node to traversepublic void tCone(Cone n)
tCone
in class Traverser
n
- a Cone node to traversepublic void tBox(Box n)
tBox
in class Traverser
n
- a Box node to traversepublic void tVisibilitySensor(VisibilitySensor n)
tVisibilitySensor
in class Traverser
n
- a VisibilitySensor node to traversepublic void tTouchSensor(TouchSensor n)
tTouchSensor
in class Traverser
n
- a TouchSensor nodepublic void tTimeSensor(TimeSensor n)
tTimeSensor
in class Traverser
n
- a TimeSensor node to traversepublic void tSphereSensor(SphereSensor n)
tSphereSensor
in class Traverser
n
- a SphereSensor node to traversepublic void tProximitySensor(ProximitySensor n)
tProximitySensor
in class Traverser
n
- a ProximitySensor node to traversepublic void tPlaneSensor(PlaneSensor n)
tPlaneSensor
in class Traverser
n
- a PlaneSensor node to traversepublic void tCylinderSensor(CylinderSensor n)
tCylinderSensor
in class Traverser
n
- a CylinderSensor node to traversepublic void tWorldInfo(WorldInfo n)
tWorldInfo
in class Traverser
n
- a WorldInfo node to traversepublic void tScript(Script n)
tScript
in class Traverser
n
- a Script node to traversepublic void tSpotLight(SpotLight n)
tSpotLight
in class Traverser
n
- a SpotLight node to traversepublic void tSound(Sound n)
tSound
in class Traverser
n
- a Sound node to traversepublic void tShape(Shape n)
tShape
in class Traverser
n
- a Shape node to traversepublic void tPointLight(PointLight n)
tPointLight
in class Traverser
n
- a PointLight node to traversepublic void tDirectionalLight(DirectionalLight n)
tDirectionalLight
in class Traverser
n
- a DirectionalLight node to traversepublic void tAudioClip(AudioClip n)
tAudioClip
in class Traverser
n
- an AudioClip node to traversepublic void tSwitch(Switch n)
tSwitch
in class Traverser
n
- a Switch node to traversepublic void tLOD(LOD n)
tLOD
in class Traverser
n
- a LOD node to traversepublic void tInline(Inline n)
tInline
in class Traverser
n
- an Inline nodepublic void tTransform(Transform n)
tTransform
in class Traverser
n
- a Transform node to traversepublic void tCollision(Collision n)
tCollision
in class Traverser
n
- a Collision node to traversepublic void tBillboard(Billboard n)
tBillboard
in class Traverser
n
- a Billboard node to traversepublic void tAnchor(Anchor n)
tAnchor
in class Traverser
n
- an Anchor node to traversepublic void tGroup(Group n)
tGroup
in class Traverser
n
- a Group node to traverseprivate boolean setObjectName(org.w3c.dom.Element element, java.lang.String objname)
element
- the node elementobjname
- the object name
true
if the object name is a DEF,
or false
if it is a USEprivate java.lang.String convertToString(boolean bool)
bool
- a boolean value
private java.lang.String convertToString(int[] array, int length)
array
- an array containing integer elementslength
- number of valid integer numbers
private java.lang.String convertToString(int[] array, int length, int count)
array
- an array containing integer elementslength
- number of valid integer numberscount
- number of float numbers on a single line
private java.lang.String convertToString(float[] array, int length)
array
- an array containing float elementslength
- number of valid float numbers
private java.lang.String convertToString(float[] array, int length, int count)
array
- an array containing float elementslength
- number of valid float numberscount
- number of float numbers on a single line
private java.lang.String convertToString(java.lang.String[] array, int length, boolean wrapInQuotes)
array
- an array containing string elementslength
- number of valid stringswrapInQuotes
- if true
, wrape each string in quotes,
false
otherwise
private boolean arraysEqual(float[] array1, float[] array2)
array1
- first array of float elementsarray2
- second array of float elements
true
if two arrays are equal, false
otherwiseprivate boolean arraysEqual(int[] array1, int[] array2)
array1
- first array of integer elementsarray2
- second array of integer elements
true
if two arrays are equal, false
otherwiseprivate boolean arraysEqual(java.lang.String[] array1, java.lang.String[] array2)
array1
- first array of string elementsarray2
- second array of string elements
true
if two arrays are equal, false
otherwiseprivate org.w3c.dom.Element getFieldElement(Field f, java.lang.String name)
Field
object.
f
- the structure that contains relevent dataname
- user specified field name
private void traverseGenericNode(Node node, org.w3c.dom.Element parent)
node
- the generic node to traverseparent
- the parent element
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |