View Javadoc

1   /*
2    * Created on Nov 12, 2003
3    * 
4    * Copyright (c) 2003, 2004 Delft University of Technology Jaffalaan 5, 2628 BX
5    * Delft, the Netherlands All rights reserved.
6    * 
7    * This software is proprietary information of Delft University of Technology
8    * The code is published under the General Public License
9    */
10  
11  package nl.tudelft.simulation.traffic.animation;
12  
13  import java.awt.Color;
14  import java.awt.Dimension;
15  import java.awt.Graphics2D;
16  import java.awt.geom.Point2D;
17  import java.awt.geom.Rectangle2D;
18  import java.awt.image.ImageObserver;
19  
20  import nl.tudelft.simulation.dsol.animation.D2.Renderable2D;
21  import nl.tudelft.simulation.dsol.simulators.SimulatorInterface;
22  import nl.tudelft.simulation.logger.Logger;
23  import nl.tudelft.simulation.traffic.station.Station;
24  
25  /***
26   * This class is used for the animation of a straight track.
27   * <p>
28   * (c) copyright 2004 <a href="http://www.simulation.tudelft.nl">Delft
29   * University of Technology </a>, the Netherlands.
30   * <p>
31   * See for project information <a href="http://www.simulation.tudelft.nl">
32   * www.simulation.tudelft.nl </a> <br>
33   * License of use: <a href="http://www.gnu.org/copyleft/gpl.html">General Public
34   * License (GPL) </a>, no warranty <br>
35   * 
36   * @version 1.0 June 1, 2004 <br>
37   * @author <a
38   * href="http://www.tbm.tudelft.nl/webstaf/alexandv/index.htm">Alexander
39   * Verbraeck </a> <br>
40   * <b>Original version: </b> H.W.G. Phaff & J.H. Kwakkel
41   * @see nl.tudelft.simulation.traffic.track.TrackInterface
42   */
43  public class StationAnimation extends Renderable2D
44  {
45      /*** the station */
46      private Station station;
47  
48      /***
49       * @param station
50       * @param simulator
51       */
52      public StationAnimation(final Station station,
53              final SimulatorInterface simulator)
54      {
55          super(station, simulator);
56          this.station = station;
57      }
58  
59      /***
60       * @see nl.tudelft.simulation.dsol.animation.D2.Renderable2D#paint(java.awt.Graphics2D,
61       * java.awt.image.ImageObserver)
62       */
63      public void paint(final Graphics2D gr, final ImageObserver io)
64      {
65          try
66          {
67              gr.setColor(Color.DARK_GRAY);
68              Rectangle2D platform = new Rectangle2D.Double(0.0, -1.5d,
69                      this.station.getStationLength(), 3.0d);
70              gr.fill(platform);
71          } catch (Exception e)
72          {
73              Logger.severe(this, "paint", e);
74          }
75      }
76  
77      /***
78       * @see nl.tudelft.simulation.dsol.animation.D2.Renderable2DInterface#contains(java.awt.geom.Point2D,
79       * java.awt.geom.Rectangle2D, java.awt.Dimension)
80       */
81      public boolean contains(Point2D pointWorldCoordinates, Rectangle2D extent,
82              Dimension screen)
83      {
84          //return super.contains(pointWorldCoordinates, extent, screen);
85          return false;
86      }
87  }