1   package org.opentrafficsim.draw.road;
2   
3   import java.awt.Color;
4   import java.awt.Graphics2D;
5   import java.awt.image.ImageObserver;
6   import java.io.Serializable;
7   import java.rmi.RemoteException;
8   
9   import javax.naming.NamingException;
10  
11  import org.opentrafficsim.draw.core.PaintPolygons;
12  import org.opentrafficsim.road.network.lane.Shoulder;
13  
14  import nl.tudelft.simulation.dsol.animation.D2.Renderable2D;
15  import nl.tudelft.simulation.dsol.simulators.SimulatorInterface;
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  public class ShoulderAnimation extends Renderable2D<Shoulder> implements Serializable
27  {
28      
29      private static final long serialVersionUID = 20141017L;
30  
31      
32      private final Color color;
33  
34      
35  
36  
37  
38  
39  
40  
41      public ShoulderAnimation(final Shoulder source, final SimulatorInterface.TimeDoubleUnit simulator, final Color color)
42              throws NamingException, RemoteException
43      {
44          super(source, simulator);
45          this.color = color;
46      }
47  
48      
49      @Override
50      public final void paint(final Graphics2D graphics, final ImageObserver observer)
51      {
52          Shoulder shoulder = getSource();
53          PaintPolygons.paintMultiPolygon(graphics, this.color, shoulder.getLocation(), shoulder.getContour(), true);
54      }
55  
56      
57      @Override
58      public final String toString()
59      {
60          return "ShoulderAnimation [source = " + getSource().toString() + ", color=" + this.color + "]";
61      }
62  }