View Javadoc
1   package org.opentrafficsim.water.network.infra;
2   
3   import org.djunits.value.vdouble.scalar.Length;
4   import org.opentrafficsim.water.network.Waterway;
5   import org.opentrafficsim.water.network.WaterwayLocation;
6   
7   /**
8    * A fixed bridge.
9    * <p>
10   * Copyright (c) 2013-2019 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved. <br>
11   * BSD-style license. See <a href="http://opentrafficsim.org/docs/current/license.html">OpenTrafficSim License</a>.
12   * </p>
13   * <p>
14   * Based on software from the IDVV project, which is Copyright (c) 2013 Rijkswaterstaat - Dienst Water, Verkeer en Leefomgeving
15   * and licensed without restrictions to Delft University of Technology, including the right to sub-license sources and derived
16   * products to third parties.
17   * </p>
18   * $LastChangedDate: 2015-07-24 02:58:59 +0200 (Fri, 24 Jul 2015) $, @version $Revision: 1147 $, by $Author: averbraeck $,
19   * initial version Nov 6, 2016 <br>
20   * @author <a href="http://www.tbm.tudelft.nl/averbraeck">Alexander Verbraeck</a>
21   */
22  public class FixedBridge extends Obstacle implements HeightRestricted
23  {
24      /** */
25      private static final long serialVersionUID = 1L;
26  
27      /** max height in meters above surface. */
28      private Length maxHeight;
29  
30      /**
31       * @param name String; the name of the bridge
32       * @param waterwayLocation WaterwayLocation; the location on the waterway
33       * @param maxHeight Length; the max sailing height to pass the bridge
34       */
35      public FixedBridge(final String name, final WaterwayLocation waterwayLocation, final Length maxHeight)
36      {
37          super(name, waterwayLocation);
38          this.maxHeight = maxHeight;
39      }
40  
41      /**
42       * @param name String; the name of the bridge
43       * @param waterway Waterway; the waterway
44       * @param km Length; the location on the waterway
45       * @param maxHeight Length; the max sailing height to pass the bridge
46       */
47      public FixedBridge(final String name, final Waterway waterway, final Length km, final Length maxHeight)
48      {
49          this(name, new WaterwayLocation(waterway, km), maxHeight);
50      }
51  
52      /** {@inheritDoc} */
53      @Override
54      public final Length getMaxHeight()
55      {
56          return this.maxHeight;
57      }
58  
59      /** {@inheritDoc} */
60      @Override
61      @SuppressWarnings("checkstyle:designforextension")
62      public String toString()
63      {
64          return "Fixed Bridge " + this.getName() + " at " + this.getWaterwayLocation();
65      }
66  }