home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Late Night VRML 2.0 with Java CD-ROM
/
code.zip
/
Ch13
/
hash
/
Part.java
< prev
next >
Wrap
Text File
|
1996-11-23
|
3KB
|
70 lines
// One part of an AnimationMaster Figure
// Written by Bernie Roehl, November 1996
package hash;
import java.io.*;
import java.util.*;
public class Part {
protected String filename;
protected int drawmode;
protected Vec3f translation;
protected Vec3f scale;
protected Vec3f rotation;
protected Vec3f pivotRotation;
protected Float lonmin, lonmax, latmin, latmax;
protected boolean cutter;
protected Part child, sibling;
public String getFilename() { return filename; }
public int getDrawmode() { return drawmode; }
public Vec3f getTranslation() { return translation; }
public Vec3f getScale() { return scale; }
public Vec3f getRotation() { return rotation; }
public Vec3f getPivotRotation() { return pivotRotation; }
public float getLongitudeMinimum() { return lonmin.floatValue(); }
public float getLongitudeMaximum() { return lonmax.floatValue(); }
public float getLatitudeMinimum() { return latmin.floatValue(); }
public float getLatitudeMaximum() { return latmax.floatValue(); }
public Part getChild() { return child; }
public Part getSibling() { return sibling; }
public void dump(String indent) {
System.out.println(indent + "Part '" + filename + "'");
System.out.println(indent + "trans = " + translation);
System.out.println(indent + "scale = " + scale);
System.out.println(indent + "rot = " + rotation);
System.out.println(indent + "pivotRotation = " + pivotRotation);
System.out.println(indent + "longitude limits = " + lonmin + ", " + lonmax);
System.out.println(indent + "latitude limits = " + latmin + ", " + latmax);
System.out.println(indent + "cutter = " + cutter);
if (child != null) child.dump(indent + "\t");
if (sibling != null) sibling.dump(indent);
}
public Part(DataInputStream input)
throws IOException {
StringTokenizer s;
filename = input.readLine();
drawmode = Integer.parseInt(input.readLine());
translation = new Vec3f(input.readLine());
scale = new Vec3f(input.readLine());
rotation = new Vec3f(input.readLine());
pivotRotation = new Vec3f(input.readLine());
s = new StringTokenizer(input.readLine());
lonmin = new Float(s.nextToken());
lonmax = new Float(s.nextToken());
latmin = new Float(s.nextToken());
latmax = new Float(s.nextToken());
s.nextToken(); // skip zero
cutter = (Integer.parseInt(s.nextToken()) != 0) ? true : false;
s = new StringTokenizer(input.readLine());
boolean siblings = (Integer.parseInt(s.nextToken()) != 0) ? true: false;
boolean children = (Integer.parseInt(s.nextToken()) != 0) ? true: false;
if (children) child = new Part(input);
if (siblings) sibling = new Part(input);
}
}