/** * Returns a reference to the "bottom most" transform in the * MultiTransformGroup that is above the ViewPlatform node. * * @return The TransformGroup that is immediately above the * ViewPlatform object. */ public TransformGroup getViewPlatformTransform() { return mtg.getTransformGroup(mtg.getNumTransforms() - 1); }
/** * Returns the TransformGroup of the viewing platform's MultiTransformGroup * which is responsible for animation. */ public TransformGroup getAnimationTG() { return getViewingPlatform().getMultiTransformGroup().getTransformGroup( ANIMATE_TG); }
mtg = new MultiTransformGroup(numTransforms); TransformGroup tg = mtg.getTransformGroup(0); addChild(tg); tg = mtg.getTransformGroup(numTransforms - 1); viewPlatform = new ViewPlatform(); viewPlatform.setCapability(ViewPlatform.ALLOW_POLICY_READ);
/** * Returns the TransformGroup of the viewing platform's MultiTransformGroup * which is responsible for rotation. */ public TransformGroup getRotationTG() { return getViewingPlatform().getMultiTransformGroup().getTransformGroup( ROTATION_TG); }
/** Set the transforms for zoom, pan, and rotation. */ public void setGlobalTransform(final GlobalTransform transform) { final MultiTransformGroup group = getViewingPlatform().getMultiTransformGroup(); final int num = group.getNumTransforms(); if (transform.transforms == null || transform.transforms.length != num) throw new RuntimeException( "Internal 3D Viewer error"); for (int i = 0; i < num; i++) group.getTransformGroup(i).setTransform(transform.transforms[i]); waitForNextFrame(); fireTransformationUpdated(); }
/** * Returns the TransformGroup of the viewing platform's MultiTransformGroup * which is responsible for translation. */ public TransformGroup getTranslateTG() { return getViewingPlatform().getMultiTransformGroup().getTransformGroup( TRANSLATE_TG); }
/** * Obtain a copy of all the Transform3D that describe the view such as zoom, * pan, and rotation. */ public void getGlobalTransform(final GlobalTransform transform) { final MultiTransformGroup group = getViewingPlatform().getMultiTransformGroup(); final int num = group.getNumTransforms(); if (transform.transforms == null || transform.transforms.length != num) { transform.transforms = new Transform3D[num]; for (int i = 0; i < num; i++) transform.transforms[i] = new Transform3D(); } for (int i = 0; i < num; i++) group.getTransformGroup(i).getTransform(transform.transforms[i]); }
/** * Returns the TransformGroup of the viewing platform's MultiTransformGroup * which is responsible for zooming. */ public TransformGroup getZoomTG() { return getViewingPlatform().getMultiTransformGroup().getTransformGroup( ZOOM_TG); }
private static final void setGlobalTransform(final Image3DUniverse u, final GlobalTransform transform) { u.getGlobalTransform(old); if (equals(old, transform)) return; final MultiTransformGroup group = u.getViewingPlatform().getMultiTransformGroup(); final int num = group.getNumTransforms(); for (int i = 0; i < num; i++) group.getTransformGroup(i).setTransform(transform.transforms[i]); u.fireTransformationUpdated(); }
/** * Returns the TransformGroup of the viewing platform's MultiTransformGroup * which is responsible for centering the universe. */ public TransformGroup getCenterTG() { return getViewingPlatform().getMultiTransformGroup().getTransformGroup( CENTER_TG); }
public void writeObject( DataOutput out ) throws IOException { MultiTransformGroup mtg = universe.getViewingPlatform().getMultiTransformGroup(); int mtgSize = mtg.getNumTransforms(); out.writeInt( mtgSize ); // Store the matrix from each MTG transform Transform3D trans = new Transform3D(); Matrix4d matrix = new Matrix4d(); for(int i=0; i<mtgSize; i++) { TransformGroup tg = mtg.getTransformGroup( i ); tg.getTransform( trans ); trans.get( matrix ); control.writeMatrix4d( out, matrix ); } control.writeObject( out, control.createState( universe.getViewingPlatform().getPlatformGeometry() )); control.writeObject( out, control.createState( universe.getViewer().getAvatar() )); writeLocales( out ); }
targetTG = vp.getMultiTransformGroup().getTransformGroup(0) ;
public void readObject( DataInput in, Canvas3D canvas ) throws IOException { int mtgSize = in.readInt(); // MultiTransformGroup size if ( canvas!=null) { universe = new ConfiguredUniverse( canvas, mtgSize); } else { universe = new ConfiguredUniverse( ConfiguredUniverse.getConfigURL(), mtgSize); } MultiTransformGroup mtg = universe.getViewingPlatform().getMultiTransformGroup(); // Read and set the matrix for each MTG transfrom Matrix4d matrix = new Matrix4d(); for(int i=0; i<mtgSize; i++) { TransformGroup tg = mtg.getTransformGroup( i ); matrix = control.readMatrix4d( in ); Transform3D trans = new Transform3D( matrix ); tg.setTransform( trans ); } SceneGraphObjectState tmp = control.readObject(in); if (tmp instanceof PlatformGeometryState) platformGeom = (PlatformGeometryState)tmp; else platformGeom = null; tmp = control.readObject(in); if (tmp instanceof ViewerAvatarState) viewerAvatar = (ViewerAvatarState)tmp; else viewerAvatar = null; readLocales( in ); }