~seh999/jcog/proto3

« back to all changes in this revision

Viewing changes to spacetime/tutorial/opencog/spacetime/tutorial/viewer/SimpleViewer.java

  • Committer: SeH
  • Date: 2009-09-19 22:59:48 UTC
  • Revision ID: seh999@gmail.com-20090919225948-q3ab80xa57i74mm6
start of major jReality refactoring

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
package opencog.spacetime.tutorial.viewer;
 
2
 
 
3
import java.awt.Component;
 
4
 
 
5
import javax.swing.JFrame;
 
6
 
 
7
import opencog.spacetime.geometry.Primitives;
 
8
import opencog.spacetime.space.SpaceComponent;
 
9
import opencog.spacetime.space.Viewer;
 
10
import opencog.spacetime.swing.JRViewer;
 
11
import opencog.spacetime.swing.ui.viewerapp.ViewerApp;
 
12
 
 
13
 
 
14
/**
 
15
 * A simple class showing how to use a {@link ViewerApp} to get a viewing component 
 
16
 * which is then packed into another frame.
 
17
 * @author Charles Gunn
 
18
 *
 
19
 */
 
20
public class SimpleViewer {
 
21
 
 
22
        public static void main(String[] args)  {
 
23
                SpaceComponent world = new SpaceComponent();
 
24
                world.setGeometry(Primitives.sharedIcosahedron);
 
25
                // if you don't want ViewerApp to provide lights and camera and some tools
 
26
                // then use the constructor     
 
27
                // public ViewerApp(SceneGraphComponent root, SceneGraphPath cameraPath, SceneGraphPath emptyPick, SceneGraphPath avatar) {
 
28
 
 
29
                Viewer v = JRViewer.display(world);
 
30
        JFrame f = new JFrame();
 
31
        f.getContentPane().add((Component) v.getViewingComponent());
 
32
 
 
33
        f.setSize(512, 512);
 
34
        f.validate();
 
35
        f.setVisible(true);
 
36
        }
 
37
 
 
38
}