package org.opentrafficsim.demo.geometry.shape; import java.awt.Dimension; import java.awt.geom.Rectangle2D; import java.io.IOException; import javax.naming.NamingException; import nl.tudelft.simulation.dsol.SimRuntimeException; import nl.tudelft.simulation.dsol.animation.D2.AnimationPanel; import nl.tudelft.simulation.dsol.experiment.ReplicationMode; import nl.tudelft.simulation.dsol.gui.swing.DSOLApplication; import nl.tudelft.simulation.dsol.gui.swing.DSOLPanel; import nl.tudelft.simulation.dsol.simulators.SimulatorInterface; import nl.tudelft.simulation.event.Event; import org.djunits.unit.TimeUnit; import org.djunits.unit.UNITS; import org.djunits.value.vdouble.scalar.DoubleScalar; import org.djunits.value.vdouble.scalar.Time; import org.opentrafficsim.core.dsol.OTSDEVSAnimator; import org.opentrafficsim.core.dsol.OTSReplication; import org.opentrafficsim.core.dsol.OTSSimTimeDouble; /** *

* Copyright (c) 2013-2015 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved.
* BSD-style license. See OpenTrafficSim License. *

* $LastChangedDate$, @version $Revision$, by $Author$, * initial version Aug 15, 2014
* @author Alexander Verbraeck */ public class ShapeTestApplication extends DSOLApplication implements UNITS { /** * @param title String title of the application window * @param panel DSOLPanel */ public ShapeTestApplication(final String title, final DSOLPanel, DoubleScalar.Rel, OTSSimTimeDouble> panel) { super(title, panel); } /** */ private static final long serialVersionUID = 20140819L; /** * @param args String[]; command line arguments * @throws SimRuntimeException on ??? * @throws NamingException on ??? * @throws IOException on ??? */ public static void main(final String[] args) throws SimRuntimeException, NamingException, IOException { ShapeModel model = new ShapeModel(); OTSDEVSAnimator simulator = new OTSDEVSAnimator(); OTSReplication replication = new OTSReplication("rep1", new OTSSimTimeDouble(new DoubleScalar.Abs(0.0, SECOND)), new Time.Rel( 0.0, SECOND), new Time.Rel(7200.0, SECOND), model); simulator.initialize(replication, ReplicationMode.TERMINATING); DSOLPanel, DoubleScalar.Rel, OTSSimTimeDouble> panel = new DSOLPanel, DoubleScalar.Rel, OTSSimTimeDouble>(model, simulator); Rectangle2D extent = new Rectangle2D.Double(65000.0, 440000.0, 55000.0, 30000.0); Dimension size = new Dimension(1024, 768); AnimationPanel animationPanel = new AnimationPanel(extent, size, simulator); panel.getTabbedPane().addTab(0, "animation", animationPanel); // tell the animation panel to update its statistics // TODO should be done automatically in DSOL! animationPanel.notify(new Event(SimulatorInterface.START_REPLICATION_EVENT, simulator, null)); new ShapeTestApplication("Network Transmission Model", panel); } }