}
_branchRoot = new BranchGroup();
_branchRoot.setCapability(BranchGroup.ALLOW_DETACH);
_userTransformation = new TransformGroup(_lastTransform);
_userTransformation.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE);
_userTransformation.setCapability(TransformGroup.ALLOW_TRANSFORM_READ);
_userTransformation.setCapability(Group.ALLOW_CHILDREN_EXTEND);
_branchRoot.addChild(_userTransformation);
//To allow multiple shapes to be added
/* _root = new BranchGroup();
_root.setCapability(BranchGroup.ALLOW_DETACH);
_root.setCapability(BranchGroup.ALLOW_CHILDREN_WRITE);
_root.setCapability(BranchGroup.ALLOW_CHILDREN_READ);
_root.setCapability(BranchGroup.ALLOW_CHILDREN_EXTEND);
_userTransformation.addChild(_root); */
_bounds = new BoundingSphere(new Point3d(0.0, 0.0, 0.0), 100.0);
Background backg = _makeBackground();
backg.setApplicationBounds(_bounds);
_branchRoot.addChild(backg);
if (_isRotatable()) {
_mouseRotate = new MouseRotateView(this);
_mouseRotate.setTransformGroup(_userTransformation);
_mouseRotate.setSchedulingBounds(_bounds);
_branchRoot.addChild(_mouseRotate);
}
if (_isScalable()) {
MouseZoom mouseZoom = new MouseZoom();
mouseZoom.setTransformGroup(_userTransformation);
mouseZoom.setSchedulingBounds(_bounds);
_branchRoot.addChild(mouseZoom);
}
if (_isTranslatable()) {
MouseTranslate mouseTranslate = new MouseTranslate();
mouseTranslate.setTransformGroup(_userTransformation);
_userTransformation.addChild(mouseTranslate);
mouseTranslate.setSchedulingBounds(_bounds);
}
// FIXME: should implement this so that user can dynamically
// modify this value during design-time and run-time
// right now this is only user-changeable during initialization
if (_isIterationSynchronized()) {
_iterationSynchronized = true;
} else {
_iterationSynchronized = false;
}
if (_shouldShowAxes()) {
Sphere origin = new Sphere((float) 0.05);
_userTransformation.addChild(origin);
Cylinder yAxis = new Cylinder((float) 0.01, (float) 6.0);
_userTransformation.addChild(yAxis);
Cylinder xAxis = new Cylinder((float) 0.01, (float) 6.0);
Transform3D rotation = new Transform3D();
Quat4d quat = new Quat4d();
quat.set(new AxisAngle4d(0.0, 0.0, 1.0, Math.PI / 2.0));
rotation.set(quat);
TransformGroup xAxisGroup = new TransformGroup(rotation);
xAxisGroup.addChild(xAxis);
_userTransformation.addChild(xAxisGroup);
Cylinder zAxis = new Cylinder((float) 0.01, (float) 6.0);
Transform3D rotation2 = new Transform3D();
Quat4d quat2 = new Quat4d();
quat2.set(new AxisAngle4d(1.0, 0.0, 0.0, Math.PI / 2.0));
rotation2.set(quat2);
TransformGroup zAxisGroup = new TransformGroup(rotation2);
zAxisGroup.addChild(zAxis);
_userTransformation.addChild(zAxisGroup);
}
// Setup the lights.
BranchGroup lightRoot = new BranchGroup();