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-2017 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   */
23  public class FixedBridge extends Obstacle implements HeightRestricted
24  {
25      /** */
26      private static final long serialVersionUID = 1L;
27  
28      /** max height in meters above surface. */
29      private Length maxHeight;
30  
31      /**
32       * @param name the name of the bridge
33       * @param waterwayLocation the location on the waterway
34       * @param maxHeight the max sailing height to pass the bridge
35       */
36      public FixedBridge(final String name, final WaterwayLocation waterwayLocation, final Length maxHeight)
37      {
38          super(name, waterwayLocation);
39          this.maxHeight = maxHeight;
40      }
41  
42      /**
43       * @param name the name of the bridge
44       * @param waterway the waterway
45       * @param km the location on the waterway
46       * @param maxHeight the max sailing height to pass the bridge
47       */
48      public FixedBridge(final String name, final Waterway waterway, final Length km, final Length maxHeight)
49      {
50          this(name, new WaterwayLocation(waterway, km), maxHeight);
51      }
52  
53      /** {@inheritDoc} */
54      @Override
55      public final Length getMaxHeight()
56      {
57          return this.maxHeight;
58      }
59  
60      /** {@inheritDoc} */
61      @Override
62      @SuppressWarnings("checkstyle:designforextension")
63      public String toString()
64      {
65          return "Fixed Bridge " + this.getName() + " at " + this.getWaterwayLocation();
66      }
67  }