1 package org.opentrafficsim.water.network; 2 3 import java.util.Map; 4 import java.util.SortedMap; 5 import java.util.TreeMap; 6 7 import org.djunits.value.vdouble.scalar.Length; 8 import org.opentrafficsim.core.geometry.OTSLine3D; 9 import org.opentrafficsim.core.gtu.GTUType; 10 import org.opentrafficsim.core.network.LinkType; 11 import org.opentrafficsim.core.network.LongitudinalDirectionality; 12 import org.opentrafficsim.core.network.Network; 13 import org.opentrafficsim.core.network.NetworkException; 14 import org.opentrafficsim.core.network.OTSLink; 15 import org.opentrafficsim.core.network.OTSNode; 16 17 /** 18 * <p> 19 * Copyright (c) 2013-2016 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved. <br> 20 * BSD-style license. See <a href="http://opentrafficsim.org/docs/license.html">OpenTrafficSim License</a>. 21 * </p> 22 * $LastChangedDate: 2015-07-24 02:58:59 +0200 (Fri, 24 Jul 2015) $, @version $Revision: 1147 $, by $Author: averbraeck $, 23 * initial version Sep 27, 2015 <br> 24 * @author <a href="http://www.tbm.tudelft.nl/averbraeck">Alexander Verbraeck</a> 25 */ 26 public class Waterway extends OTSLink 27 { 28 /** */ 29 private static final long serialVersionUID = 20150927L; 30 31 /** description. */ 32 // TODO private final String description; 33 34 /** current; positive direction is along the design line. */ 35 private double current; 36 37 /** list of obstacles, sorted on distance along the design line. */ 38 private SortedMap<Length, Obstacle> obstacles = new TreeMap<>(); 39 40 /** list of terminals, sorted on distance along the design line. */ 41 // TODO private SortedMap<Length, Terminal> terminals = new TreeMap<>(); 42 43 44 /** 45 * Construct a new waterway. 46 * @param network the network. 47 * @param id the link id 48 * @param startNode start node (directional) 49 * @param endNode end node (directional) 50 * @param linkType Link type to indicate compatibility with GTU types 51 * @param designLine the OTSLine3D design line of the Link 52 * @param directionality to indicate the general direction of the waterway (FORWARD = in the direction of the design line; 53 * BACKWARD is in the opposite direction; BOTH is a waterway that can be used in both directions; NONE is a 54 * waterway that cannot be used for sailing. 55 * @throws NetworkException when waterway with this id already exists 56 */ 57 public Waterway(final Network network, final String id, final OTSNode startNode, final OTSNode endNode, 58 final LinkType linkType, final OTSLine3D designLine, final LongitudinalDirectionality directionality) 59 throws NetworkException 60 { 61 super(network, id, startNode, endNode, linkType, designLine, directionality); 62 } 63 64 /** 65 * Construct a new waterway. 66 * @param network the network. 67 * @param id the link id 68 * @param startNode start node (directional) 69 * @param endNode end node (directional) 70 * @param linkType Link type to indicate compatibility with GTU types 71 * @param designLine the OTSLine3D design line of the Link 72 * @param directionalityMap the directions for different type of ships; it might be that all or certain types of ships are 73 * only allowed to use a canal in one direction. Furthermore, the directions can limit waterways for certain 74 * classes of ships. Set the LongitudinalDirectionality to NONE for ships that are not allowed to sail this 75 * waterway. 76 * @throws NetworkException when waterway with this id already exists 77 */ 78 public Waterway(final Network network, final String id, final OTSNode startNode, final OTSNode endNode, 79 final LinkType linkType, final OTSLine3D designLine, 80 final Map<GTUType, LongitudinalDirectionality> directionalityMap) throws NetworkException 81 { 82 super(network, id, startNode, endNode, linkType, designLine, directionalityMap); 83 } 84 85 }