1
2 package hep.wired.heprep.standalone;
3
4 import java.io.*;
5 import javax.swing.*;
6
7 import hep.graphics.heprep.HepRep;
8 import hep.graphics.heprep.HepRepReader;
9 import hep.graphics.heprep.xml.XMLHepRepFactory;
10
11 import hep.wired.plot.WiredPlot;
12 import hep.wired.heprep.graphicspanel.HepRepPanel;
13 import hep.wired.heprep.graphicspanel.HepRepGraphicsMode;
14
15 /***
16 * Example to run WIRED stand-alone
17 * Should move to "standalone" package
18 *
19 * @author Mark Donszelmann
20 * @version $Id: Wired.java 2094 2005-07-22 22:19:23Z duns $
21 */
22
23 public class Wired {
24
25 public static void main(String[] args) throws Exception {
26 if (args.length < 1) {
27 System.err.println("Usage: Wired heprepfile");
28 System.exit(1);
29 }
30
31 File file = new File(args[0]);
32 System.out.println("Open HepRep file "+file.getName()+"...");
33
34 XMLHepRepFactory factory = new XMLHepRepFactory();
35 InputStream in = new FileInputStream(file);
36 if (file.getName().toLowerCase().indexOf(".bheprep") >= 0) {
37 in = new DataInputStream(in);
38 }
39 HepRepReader reader = factory.createHepRepReader(in);
40 HepRep heprep = reader.next();
41 reader.close();
42
43 System.out.println("Opening WIRED4...");
44
45 WiredPlot plot = new WiredPlot("WIRED 4", new HepRepPanel(new HepRepGraphicsMode(false)));
46 JFrame frame = new JFrame("WIRED 4");
47 frame.getContentPane().add(plot);
48 frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
49 frame.pack();
50 frame.show();
51
52 System.out.println("Displaying Event...");
53 plot.setRecord(heprep);
54 }
55 }