1 package org.opentrafficsim.core.network.factory;
2
3 import java.awt.Dimension;
4 import java.awt.geom.Rectangle2D;
5 import java.rmi.RemoteException;
6
7 import nl.tudelft.simulation.dsol.ModelInterface;
8 import nl.tudelft.simulation.dsol.SimRuntimeException;
9 import nl.tudelft.simulation.dsol.animation.D2.AnimationPanel;
10 import nl.tudelft.simulation.dsol.experiment.ReplicationMode;
11 import nl.tudelft.simulation.dsol.gui.swing.DSOLApplication;
12 import nl.tudelft.simulation.dsol.gui.swing.DSOLPanel;
13 import nl.tudelft.simulation.dsol.simulators.SimulatorInterface;
14 import nl.tudelft.simulation.event.Event;
15
16 import org.opentrafficsim.core.dsol.OTSDEVSAnimator;
17 import org.opentrafficsim.core.dsol.OTSModelInterface;
18 import org.opentrafficsim.core.dsol.OTSReplication;
19 import org.opentrafficsim.core.dsol.OTSSimTimeDouble;
20 import org.opentrafficsim.core.unit.TimeUnit;
21 import org.opentrafficsim.core.value.vdouble.scalar.DoubleScalar;
22
23
24
25
26
27
28
29
30
31 public class TestXMLParser extends DSOLApplication
32 {
33
34 private static final long serialVersionUID = 1L;
35
36
37
38
39
40 public TestXMLParser(final String title,
41 final DSOLPanel<DoubleScalar.Abs<TimeUnit>, DoubleScalar.Rel<TimeUnit>, OTSSimTimeDouble> panel)
42 {
43 super(title, panel);
44 }
45
46
47
48
49
50
51 public static void main(final String[] args) throws RemoteException, SimRuntimeException
52 {
53 OTSModelInterface model = new TestXMLModel();
54 OTSDEVSAnimator simulator = new OTSDEVSAnimator();
55 OTSReplication replication =
56 new OTSReplication("rep1", new OTSSimTimeDouble(new DoubleScalar.Abs<TimeUnit>(0.0, TimeUnit.SECOND)),
57 new DoubleScalar.Rel<TimeUnit>(0.0, TimeUnit.SECOND),
58 new DoubleScalar.Rel<TimeUnit>(1800.0, TimeUnit.SECOND), model);
59 simulator.initialize(replication, ReplicationMode.TERMINATING);
60 DSOLPanel<DoubleScalar.Abs<TimeUnit>, DoubleScalar.Rel<TimeUnit>, OTSSimTimeDouble> panel =
61 new DSOLPanel<DoubleScalar.Abs<TimeUnit>, DoubleScalar.Rel<TimeUnit>, OTSSimTimeDouble>(model, simulator);
62
63 Rectangle2D extent = new Rectangle2D.Double(-50, -50, 300, 100);
64 Dimension size = new Dimension(1024, 768);
65 AnimationPanel animationPanel = new AnimationPanel(extent, size, simulator);
66 panel.getTabbedPane().addTab(0, "animation", animationPanel);
67
68
69 animationPanel.notify(new Event(SimulatorInterface.START_REPLICATION_EVENT, simulator, null));
70
71 new TestXMLParser("TestXMLParser", panel);
72 }
73
74 }