01: /*
02: * $Header: /cvs/j3dfly/J3dEditor/src/org/jdesktop/j3dedit/scenegraph/SGNode.java,v 1.1 2005/04/20 22:20:41 paulby Exp $
03: *
04: * Sun Public License Notice
05: *
06: * The contents of this file are subject to the Sun Public License Version
07: * 1.0 (the "License"). You may not use this file except in compliance with
08: * the License. A copy of the License is available at http://www.sun.com/
09: *
10: * The Original Code is the Java 3D(tm) Scene Graph Editor.
11: * The Initial Developer of the Original Code is Paul Byrne.
12: * Portions created by Paul Byrne are Copyright (C) 2002.
13: * All Rights Reserved.
14: *
15: * Contributor(s): Paul Byrne.
16: *
17: **/
18: package org.jdesktop.j3dedit.scenegraph;
19:
20: import javax.media.j3d.Locale;
21:
22: /**
23: *
24: * @author paulby
25: * @version
26: */
27: public abstract class SGNode extends SGObject {
28:
29: /**
30: * The parent of this node
31: */
32: protected SGGroup parent;
33:
34: /**
35: * Create the ancillary SGNode representing node
36: */
37: public SGNode(javax.media.j3d.Node node,
38: org.jdesktop.j3dedit.J3dEditContext editContext) {
39: super (editContext);
40: j3dNode = node;
41: }
42:
43: /**
44: * Set the Java3D which is represented by this object
45: *
46: * Store the capability bits for the node
47: */
48: public void setJ3dNode(javax.media.j3d.Node node) {
49: j3dNode = node;
50: capabilities.storeCapabilities(node);
51: }
52:
53: /**
54: * Get the Java3D node represented by this object
55: */
56: public javax.media.j3d.Node getJ3dNode() {
57: return (javax.media.j3d.Node) j3dNode;
58: }
59:
60: /**
61: * Sets the parent of this node
62: */
63: public void setParent(SGGroup parent) {
64: this .parent = parent;
65: }
66:
67: /**
68: * Get the parent of this node
69: */
70: public SGGroup getParent() {
71: return parent;
72: }
73:
74: /**
75: * Return the Locale to which this node is connected
76: */
77: public javax.media.j3d.Locale getLocale() {
78: Locale ret = null;
79:
80: SGNode obj = this ;
81: while (obj != null && !(obj instanceof SGLocale))
82: obj = obj.getParent();
83:
84: if (obj != null)
85: ret = (Locale) obj.getLocale();
86:
87: return ret;
88: }
89:
90: /**
91: * Is this node live
92: */
93: public boolean isLive() {
94: return j3dNode.isLive();
95: }
96:
97: }
|