package org.opentrafficsim.demo.conflict; import static org.opentrafficsim.core.gtu.GTUType.VEHICLE; import java.net.URL; import java.rmi.RemoteException; import java.util.ArrayList; import javax.naming.NamingException; import javax.swing.SwingUtilities; import org.djunits.unit.DurationUnit; import org.djunits.unit.LengthUnit; import org.djunits.value.vdouble.scalar.Duration; import org.djunits.value.vdouble.scalar.Length; import org.djunits.value.vdouble.scalar.Time; import org.opentrafficsim.base.modelproperties.Property; import org.opentrafficsim.base.modelproperties.PropertyException; import org.opentrafficsim.core.dsol.OTSModelInterface; import org.opentrafficsim.core.network.OTSLink; import org.opentrafficsim.core.network.OTSNetwork; import org.opentrafficsim.core.network.OTSNode; import org.opentrafficsim.road.animation.AnimationToggles; import org.opentrafficsim.road.network.factory.xml.XmlNetworkLaneParser; import org.opentrafficsim.road.network.lane.CrossSectionLink; import org.opentrafficsim.road.network.lane.Lane; import org.opentrafficsim.road.network.lane.conflict.ConflictBuilder; import org.opentrafficsim.road.network.lane.object.trafficlight.SimpleTrafficLight; import org.opentrafficsim.road.network.lane.object.trafficlight.TrafficLightColor; import org.opentrafficsim.simulationengine.AbstractWrappableAnimation; import org.opentrafficsim.simulationengine.OTSSimulationException; import nl.tudelft.simulation.dsol.SimRuntimeException; import nl.tudelft.simulation.dsol.simtime.SimTimeDoubleUnit; import nl.tudelft.simulation.dsol.simulators.DEVSSimulatorInterface; import nl.tudelft.simulation.dsol.simulators.SimulatorInterface; import nl.tudelft.simulation.language.io.URLResource; /** *
* Copyright (c) 2013-2018 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved.
* BSD-style license. See OpenTrafficSim License.
*
* @version $Revision$, $LastChangedDate$, by $Author$, initial version 11 dec. 2016
* @author Alexander Verbraeck
* @author Peter Knoppers
* @author Wouter Schakel
*/
public class TurboRoundaboutDemo extends AbstractWrappableAnimation
{
/** */
private static final long serialVersionUID = 20161211L;
/** {@inheritDoc} */
@Override
protected final OTSModelInterface makeModel() throws OTSSimulationException
{
return new TurboRoundaboutModel();
}
/** {@inheritDoc} */
@Override
protected final void addAnimationToggles()
{
AnimationToggles.setIconAnimationTogglesFull(this);
hideAnimationClass(OTSLink.class);
hideAnimationClass(OTSNode.class);
// addToggleAnimationButtonText("Block", LaneBlock.class, "Show/hide Blocks", false);
// addToggleAnimationButtonText("BlockId", LaneBlockAnimation.Text.class, "Show/hide Block Ids", false);
}
/** {@inheritDoc} */
@Override
public final String shortName()
{
return "Turbo roundabout demonstration";
}
/** {@inheritDoc} */
@Override
public final String description()
{
return "Turbo roundabout demonstration";
}
/**
* The simulation model.
*/
class TurboRoundaboutModel implements OTSModelInterface
{
/** */
private static final long serialVersionUID = 20161211L;
/** The network. */
private OTSNetwork network;
/** Simulator. */
private DEVSSimulatorInterface.TimeDoubleUnit simulator;
/** {@inheritDoc} */
@Override
public void constructModel(final SimulatorInterface