/* */ package com.sun.j3d.utils.universe;
/* */
/* */ import java.awt.GraphicsConfiguration;
/* */ import java.awt.GraphicsDevice;
/* */ import java.awt.GraphicsEnvironment;
/* */ import java.net.URL;
/* */ import java.security.AccessController;
/* */ import java.security.PrivilegedAction;
/* */ import javax.media.j3d.BranchGroup;
/* */ import javax.media.j3d.Canvas3D;
/* */ import javax.media.j3d.GraphicsConfigTemplate3D;
/* */ import javax.media.j3d.HiResCoord;
/* */ import javax.media.j3d.Locale;
/* */ import javax.media.j3d.View;
/* */ import javax.media.j3d.VirtualUniverse;
/* */
/* */ public class SimpleUniverse extends VirtualUniverse
/* */ {
/* */ protected Locale locale;
/* 76 */ protected Viewer[] viewer = null;
/* */
/* */ public SimpleUniverse()
/* */ {
/* 88 */ this(null, 1, null, null);
/* */ }
/* */
/* */ public SimpleUniverse(int numTransforms)
/* */ {
/* 107 */ this(null, numTransforms, null, null);
/* */ }
/* */
/* */ public SimpleUniverse(Canvas3D canvas)
/* */ {
/* 126 */ this(null, 1, canvas, null);
/* */ }
/* */
/* */ public SimpleUniverse(Canvas3D canvas, int numTransforms)
/* */ {
/* 151 */ this(null, numTransforms, canvas, null);
/* */ }
/* */
/* */ /** @deprecated */
/* */ public SimpleUniverse(HiResCoord origin, int numTransforms, Canvas3D canvas, URL userConfig)
/* */ {
/* 177 */ this(origin, numTransforms, canvas, userConfig, null);
/* */ }
/* */
/* */ /** @deprecated */
/* */ public SimpleUniverse(HiResCoord origin, int numTransforms, Canvas3D canvas, URL userConfig, LocaleFactory localeFactory)
/* */ {
/* 207 */ createLocale(origin, localeFactory);
/* */
/* 211 */ ViewingPlatform vwp = new ViewingPlatform(numTransforms);
/* 212 */ vwp.setUniverse(this);
/* 213 */ this.viewer = new Viewer[1];
/* */
/* 215 */ this.viewer[0] = new Viewer(canvas);
/* 216 */ this.viewer[0].setViewingPlatform(vwp);
/* */
/* 220 */ this.locale.addBranchGraph(vwp);
/* */ }
/* */
/* */ public SimpleUniverse(ViewingPlatform viewingPlatform, Viewer viewer)
/* */ {
/* 234 */ this(viewingPlatform, viewer, null);
/* */ }
/* */
/* */ public SimpleUniverse(ViewingPlatform viewingPlatform, Viewer viewer, LocaleFactory localeFactory)
/* */ {
/* 249 */ createLocale(null, localeFactory);
/* 250 */ viewingPlatform.setUniverse(this);
/* */
/* 253 */ this.viewer = new Viewer[1];
/* 254 */ this.viewer[0] = viewer;
/* */
/* 257 */ this.viewer[0].setViewingPlatform(viewingPlatform);
/* */
/* 261 */ this.locale.addBranchGraph(viewingPlatform);
/* */ }
/* */
/* */ SimpleUniverse(HiResCoord origin, LocaleFactory localeFactory)
/* */ {
/* 268 */ createLocale(origin, localeFactory);
/* */ }
/* */
/* */ private void createLocale(HiResCoord origin, LocaleFactory localeFactory)
/* */ {
/* 278 */ if (localeFactory != null) {
/* 279 */ if (origin != null)
/* 280 */ this.locale = localeFactory.createLocale(this, origin);
/* */ else {
/* 282 */ this.locale = localeFactory.createLocale(this);
/* */ }
/* */ }
/* 285 */ else if (origin != null)
/* 286 */ this.locale = new Locale(this, origin);
/* */ else
/* 288 */ this.locale = new Locale(this);
/* */ }
/* */
/* */ public Locale getLocale()
/* */ {
/* 299 */ return this.locale;
/* */ }
/* */
/* */ public Viewer getViewer()
/* */ {
/* 310 */ return this.viewer[0];
/* */ }
/* */
/* */ public ViewingPlatform getViewingPlatform()
/* */ {
/* 319 */ return this.viewer[0].getViewingPlatform();
/* */ }
/* */
/* */ public Canvas3D getCanvas()
/* */ {
/* 331 */ return getCanvas(0);
/* */ }
/* */
/* */ public Canvas3D getCanvas(int canvasNum)
/* */ {
/* 345 */ return this.viewer[0].getCanvas3D(canvasNum);
/* */ }
/* */
/* */ public void addBranchGraph(BranchGroup bg)
/* */ {
/* 356 */ this.locale.addBranchGraph(bg);
/* */ }
/* */
/* */ public static GraphicsConfiguration getPreferredConfiguration()
/* */ {
/* 368 */ GraphicsConfigTemplate3D template = new GraphicsConfigTemplate3D();
/* */
/* 375 */ String stereo = (String)AccessController.doPrivileged(new PrivilegedAction()
/* */ {
/* */ public Object run() {
/* 378 */ return System.getProperty("j3d.stereo");
/* */ }
/* */ });
/* 383 */ if (stereo != null) {
/* 384 */ if (stereo.equals("REQUIRED"))
/* 385 */ template.setStereo(1);
/* 386 */ else if (stereo.equals("PREFERRED")) {
/* 387 */ template.setStereo(2);
/* */ }
/* */ }
/* */
/* 391 */ return GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice().getBestConfiguration(template);
/* */ }
/* */
/* */ public void cleanup()
/* */ {
/* 400 */ this.viewer[0].getView().removeAllCanvas3Ds();
/* 401 */ this.viewer[0].setViewingPlatform(null);
/* 402 */ removeAllLocales();
/* */
/* 404 */ Viewer.clearViewerMap();
/* */ }
/* */ }
/* Location: Z:\System\Library\Java\Extensions\j3dutils.jar
* Qualified Name: com.sun.j3d.utils.universe.SimpleUniverse
* JD-Core Version: 0.6.2
*/