package org.opentrafficsim.demo.geometry.shape; import java.awt.Dimension; import java.awt.geom.Rectangle2D; import java.io.IOException; import javax.naming.NamingException; import org.djunits.unit.util.UNITS; import org.djunits.value.vdouble.scalar.Duration; import org.djunits.value.vdouble.scalar.Time; import org.djutils.event.TimedEvent; import org.opentrafficsim.core.animation.gtu.colorer.DefaultSwitchableGTUColorer; import org.opentrafficsim.core.dsol.OTSAnimator; import org.opentrafficsim.core.dsol.OTSReplication; import org.opentrafficsim.draw.core.OTSDrawingException; import org.opentrafficsim.draw.factory.DefaultAnimationFactory; import org.opentrafficsim.swing.gui.AnimationToggles; import org.opentrafficsim.swing.gui.OTSAnimationPanel; import org.opentrafficsim.swing.gui.OTSSwingApplication; import nl.tudelft.simulation.dsol.SimRuntimeException; import nl.tudelft.simulation.dsol.experiment.ReplicationInterface; import nl.tudelft.simulation.dsol.simtime.SimTimeDoubleUnit; import nl.tudelft.simulation.dsol.swing.gui.DSOLApplication; import nl.tudelft.simulation.dsol.swing.gui.DSOLPanel; import nl.tudelft.simulation.dsol.swing.gui.control.RealTimeControlPanel; import nl.tudelft.simulation.language.DSOLException; /** *
* Copyright (c) 2013-2022 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; String title of the application window
* @param panel DSOLPanel<Time,Duration,SimTimeDoubleUnit>; DSOLPanel
*/
public ShapeTestApplication(final String title, final DSOLPanel panel)
{
super(panel, title);
}
/** */
private static final long serialVersionUID = 20140819L;
/**
* @param args String[]; command line arguments
* @throws SimRuntimeException on ???
* @throws NamingException on ???
* @throws IOException on ???
* @throws OTSDrawingException on drawing error
* @throws DSOLException when the simulator does not implement the AnimatorInterface
*/
public static void main(final String[] args)
throws SimRuntimeException, NamingException, IOException, OTSDrawingException, DSOLException
{
OTSAnimator simulator = new OTSAnimator("ShapeTestApplication");
ShapeModel model = new ShapeModel(simulator);
OTSReplication replication =
new OTSReplication("rep1", Time.ZERO, Duration.ZERO, new Duration(7200.0, SECOND));
simulator.initialize(model, replication);
Rectangle2D extent = new Rectangle2D.Double(65000.0, 440000.0, 55000.0, 30000.0);
Dimension size = new Dimension(1024, 768);
DSOLPanel panel =
new DSOLPanel(new RealTimeControlPanel