1 package org.textensor.vis;
2
3 import java.awt.BorderLayout;
4 import java.awt.Container;
5 import java.awt.Dimension;
6 import java.io.File;
7 import java.util.ArrayList;
8
9 import javax.swing.JFrame;
10
11
12 public class CCViz3D {
13
14 JFrame frame;
15
16 SceneGraphViewer viewer;
17
18
19 public CCViz3D() {
20 frame = new JFrame();
21 frame.setPreferredSize(new Dimension(800, 600));
22 Container ctr = frame.getContentPane();
23
24 viewer = new SceneGraphViewer();
25 ctr.setLayout(new BorderLayout());
26 ctr.add(viewer.getPanel(), BorderLayout.CENTER);
27
28 frame.setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE);
29
30
31 }
32
33
34
35 public void show() {
36 frame.pack();
37 frame.setVisible(true);
38 }
39
40
41
42 public static void main(String[] argv) {
43 CCViz3D sv = new CCViz3D();
44 sv.show();
45 if (argv.length > 0) {
46 sv.loadElements(new File(argv[0]));
47 }
48 }
49
50
51
52 public void loadElements(File ftri) {
53 ElementReader er = new ElementReader(ftri);
54 er.read();
55 SceneGraphBuilder sgb = new SceneGraphBuilder();
56
57 sgb.loadElements(er.getElements());
58 viewer.setSceneGraph(sgb.getSceneGraph(), sgb.getShapes());
59 }
60
61
62
63 }
64