package nl.tudelft.simulation.dsol.animation.D2;
import java.awt.Dimension;
import java.awt.geom.Point2D;
import java.net.URL;
import java.rmi.RemoteException;
import javax.naming.NamingException;
import nl.tudelft.simulation.dsol.animation.Locatable;
import nl.tudelft.simulation.dsol.simulators.SimulatorInterface;
import nl.tudelft.simulation.language.d3.DirectedPoint;
/**
*
* Copyright (c) 2002-2019 Delft University of Technology, Jaffalaan 5, 2628 BX Delft, the Netherlands. All rights
* reserved. See for project information
* https://simulation.tudelft.nl. The DSOL project is distributed under a three-clause BSD-style license, which can
* be found at
* https://simulation.tudelft.nl/dsol/3.0/license.html.
*
* @author Peter Jacobs
* @since 1.5
* @param the Locatable class of the source that indicates the location of the Renderable on the screen
*/
public class SingleImageRenderable extends ImageRenderable
{
/**
* constructs a new SingleImageRenderable
* @param source Locatable; the moving source
* @param simulator SimulatorInterface<?,?,?>; the simulator
* @param image URL; the image to animate
* @throws NamingException when animation context cannot be created or retrieved
* @throws RemoteException when remote context cannot be found
*/
public SingleImageRenderable(final T source, final SimulatorInterface, ?, ?> simulator, final URL image)
throws RemoteException, NamingException
{
super(source, simulator, new URL[]{image});
}
/**
* constructs a new SingleImageRenderable
* @param staticLocation Point2D; the static location
* @param size Dimension; the size
* @param simulator SimulatorInterface<?,?,?>; the simulator
* @param image URL; the image
* @throws NamingException when animation context cannot be created or retrieved
* @throws RemoteException when remote context cannot be found
*/
public SingleImageRenderable(final Point2D staticLocation, final Dimension size,
final SimulatorInterface, ?, ?> simulator, final URL image) throws RemoteException, NamingException
{
super(staticLocation, size, simulator, new URL[]{image});
}
/**
* constructs a new SingleImageRenderable
* @param staticLocation DirectedPoint; the static location
* @param size Dimension; the size of the image
* @param simulator SimulatorInterface<?,?,?>; the simulator
* @param image URL; the image
* @throws NamingException when animation context cannot be created or retrieved
* @throws RemoteException when remote context cannot be found
*/
public SingleImageRenderable(final DirectedPoint staticLocation, final Dimension size,
final SimulatorInterface, ?, ?> simulator, final URL image) throws RemoteException, NamingException
{
super(staticLocation, size, simulator, new URL[]{image});
}
/** {@inheritDoc} */
@Override
public int selectImage()
{
// We only have one image to show. Let's use this one.
return 0;
}
}