01: /*
02: * $Header: /cvs/j3dfly/J3dEditor/src/org/jdesktop/j3dedit/scenegraph/SGShape3D.java,v 1.1 2005/04/20 22:20:42 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: /**
21: *
22: * @author Paul Byrne
23: */
24: public class SGShape3D extends SGLeaf {
25:
26: private SGAppearance sgAppearance = null;
27: private java.util.ArrayList geometry = new java.util.ArrayList();
28:
29: /**
30: * Create the ancillary SGNode representing node
31: */
32: public SGShape3D(javax.media.j3d.Node node,
33: org.jdesktop.j3dedit.J3dEditContext editContext) {
34: super (node, editContext);
35: }
36:
37: /**
38: * Change the live state of this node, this may change the live
39: * state of other nodes in the graph, but in general the minimum
40: * change will be made
41: */
42: public void setLive(boolean live) {
43: parent.setLive(live);
44: }
45:
46: /**
47: * Set the SGAppearance node component for this shape
48: */
49: public void setSGAppearance(SGAppearance appearance) {
50: if (sgAppearance != null)
51: appearance.removeReferencedBy(this );
52:
53: sgAppearance = appearance;
54: if (appearance != null)
55: appearance.addReferencedBy(this );
56: }
57:
58: /**
59: * Get the SGAppearance node component for this shape
60: */
61: public SGAppearance getSGAppearance() {
62: return sgAppearance;
63: }
64:
65: public void addSGGeometry(SGGeometry geom) {
66: geometry.add(geom);
67: }
68:
69: public int numSGGeometry() {
70: return geometry.size();
71: }
72:
73: /**
74: * Get the SGGeometry at the given index.
75: * This may be null if the Shape3D has null geometries
76: */
77: public SGGeometry getSGGeometry(int index) {
78: return (SGGeometry) geometry.get(index);
79: }
80: }
|