View Javadoc

1   /*
2    * @(#)ControlPointLocation.java Oct 31, 2004
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.rmi.RemoteException;
14  import javax.media.j3d.Bounds;
15  import javax.vecmath.Point3d;
16  import nl.tudelft.simulation.dsol.animation.LocatableInterface;
17  import nl.tudelft.simulation.language.d3.BoundingBox;
18  import nl.tudelft.simulation.language.d3.DirectedPoint;
19  import nl.tudelft.simulation.traffic.controlpoint.ControlPointInterface;
20  
21  /***
22   * The location of a control point
23   * <p>
24   * (c) copyright 2004 <a href="http://www.simulation.tudelft.nl">Delft
25   * University of Technology </a>, the Netherlands.
26   * <p>
27   * See for project information <a href="http://www.simulation.tudelft.nl">
28   * www.simulation.tudelft.nl </a> <br>
29   * License of use: <a href="http://www.gnu.org/copyleft/gpl.html">General Public
30   * License (GPL) </a>, no warranty <br>
31   * 
32   * @version 1.0 Oct 31, 2004 <br>
33   * @author <a
34   * href="http://www.tbm.tudelft.nl/webstaf/alexandv/index.htm">Alexander
35   * Verbraeck </a> <br>
36   */
37  public class ControlPointLocation implements LocatableInterface
38  {
39      /*** the location of the control point */
40      private DirectedPoint location;
41  
42      /*** the control point */
43      private ControlPointInterface controlPoint;
44  
45      /***
46       * @param cpi
47       */
48      public ControlPointLocation(final ControlPointInterface cpi)
49      {
50          this.location = cpi.getTrack().getLocationOfProgression(
51                  cpi.getProgression());
52          this.location.setRotZ(0.0);
53          this.controlPoint = cpi;
54      }
55  
56      /***
57       * @see nl.tudelft.simulation.dsol.animation.LocatableInterface#getBounds()
58       */
59      public Bounds getBounds() throws RemoteException
60      {
61          return new BoundingBox(new Point3d(-0.1, -0.1, 0), new Point3d(0.1,
62                  0.1, 0));
63      }
64  
65      /***
66       * @see nl.tudelft.simulation.dsol.animation.LocatableInterface#getLocation()
67       */
68      public DirectedPoint getLocation() throws RemoteException
69      {
70          return this.location;
71      }
72  
73      /***
74       * @see java.lang.Object#toString()
75       */
76      public String toString()
77      {
78          return this.controlPoint.toString();
79      }
80  }