View Javadoc

1   /*
2    * Copyright (c) 2003, the JUNG Project and the Regents of the University of
3    * California All rights reserved.
4    * 
5    * This software is open-source under the BSD license; see either "license.txt"
6    * or http://jung.sourceforge.net/license.txt for a description.
7    */
8   package edu.uci.ics.jung.visualization3d;
9   
10  /**
11   */
12  import javax.media.j3d.Node;
13  import javax.media.j3d.Transform3D;
14  import javax.media.j3d.TransformGroup;
15  
16  /**
17   * 
18   * @author Tom Nelson - tomnelson@dev.java.net
19   *
20   */
21  public class VertexGroup<V> extends TransformGroup {
22  
23  	 V vertex;
24  	 Node shape;
25  	 TransformGroup labelNode = new TransformGroup();
26  
27  	 public VertexGroup(V vertex, Node shape) {
28  		 this.vertex = vertex;
29  		 this.shape = shape;
30  		 setCapability(TransformGroup.ENABLE_PICK_REPORTING);
31  		 addChild(shape);
32  		 addChild(labelNode);
33  		 Transform3D tt = new Transform3D();
34  //		 tt.setTranslation(new Vector3f(10,10,0));
35  		 labelNode.setTransform(tt);
36  	 }
37  
38  
39  	 /**
40  	  * @return the shape
41  	  */
42  	 public Node getShape() {
43  		 return shape;
44  	 }
45  
46  
47  	 /**
48  	  * @param shape the shape to set
49  	  */
50  	 public void setShape(Node shape) {
51  		 this.shape = shape;
52  	 }
53  
54  
55  	 public String toString() { return "VertexGroup for "+vertex.toString(); }
56  
57  
58  	/**
59  	 * @return the labelNode
60  	 */
61  	public TransformGroup getLabelNode() {
62  		return labelNode;
63  	}
64  
65   }