Class CrossSectionLink

    • Field Detail

      • LANE_ADD_EVENT

        public static final TimedEventType LANE_ADD_EVENT
        The (regular, not timed) event type for pub/sub indicating the addition of a Lane to a CrossSectionLink.
        Payload: Object[] { String networkId, String linkId, String LaneId, int laneNumber }
        TODO work in a different way with lane numbers to align to standard lane numbering.
      • LANE_REMOVE_EVENT

        public static final TimedEventType LANE_REMOVE_EVENT
        The (regular, not timed) event type for pub/sub indicating the removal of a Lane from a CrossSectionLink.
        Payload: Object[] { String networkId, String linkId, String LaneId }
        TODO allow for the removal of a Lane; currently this is not possible.
    • Constructor Detail

      • CrossSectionLink

        public CrossSectionLink​(OTSRoadNetwork network,
                                String id,
                                OTSRoadNode startNode,
                                OTSRoadNode endNode,
                                LinkType linkType,
                                OTSLine3D designLine,
                                LaneKeepingPolicy laneKeepingPolicy)
                         throws NetworkException
        Construction of a cross section link.
        Parameters:
        network - OTSRoadNetwork; the network
        id - String; the link id.
        startNode - OTSRoadNode; the start node (directional).
        endNode - OTSRoadNode; the end node (directional).
        linkType - LinkType; the link type
        designLine - OTSLine3D; the design line of the Link
        laneKeepingPolicy - LaneKeepingPolicy; the policy to generally keep left, keep right, or keep lane
        Throws:
        NetworkException - if link already exists in the network, if name of the link is not unique, or if the start node or the end node of the link are not registered in the network.
      • CrossSectionLink

        protected CrossSectionLink​(OTSRoadNetwork newNetwork,
                                   CrossSectionLink link)
                            throws NetworkException
        Clone a CrossSectionLink for a new network.
        Parameters:
        newNetwork - Network; the new network to which the clone belongs
        link - CrossSectionLink; the link to clone from
        Throws:
        NetworkException - if link already exists in the network, if name of the link is not unique, or if the start node or the end node of the link are not registered in the network.
    • Method Detail

      • addCrossSectionElement

        protected final void addCrossSectionElement​(CrossSectionElement cse)
        Add a cross section element at the end of the list.
        Note: LEFT is seen as a positive lateral direction, RIGHT as a negative lateral direction.
        Parameters:
        cse - CrossSectionElement; the cross section element to add.
      • getCrossSectionElementList

        public final List<CrossSectionElement> getCrossSectionElementList()
        Retrieve a safe copy of the cross section element list.
        Returns:
        List<CrossSectionElement>; the cross section element list.
      • getLaneKeepingPolicy

        public final LaneKeepingPolicy getLaneKeepingPolicy()
        Retrieve the lane keeping policy.
        Returns:
        LaneKeepingPolicy; the lane keeping policy on this CrossSectionLink
      • getCrossSectionElement

        public final CrossSectionElement getCrossSectionElement​(String id)
        Find a cross section element with a specified id.
        Parameters:
        id - String; the id to search for
        Returns:
        CrossSectionElement; the cross section element with the given id, or null if not found
      • getLanes

        public final List<Lane> getLanes()
        Return a safe copy of the list of lanes of this CrossSectionLink.
        Returns:
        List<Lane>; the list of lanes.
      • setPriority

        public final void setPriority​(CrossSectionLink.Priority priority)
        Parameters:
        priority - Priority; set priority.
      • setDemandWeight

        public final void setDemandWeight​(double demandWeight)
        Sets the demand weight. This is only applicable to links of type CONNECTOR.
        Parameters:
        demandWeight - double; demand weight, which is any positive value
      • clearDemandWeight

        public final void clearDemandWeight()
        Clears the demand weight. This is only applicable to links of type CONNECTOR.
      • getDemandWeight

        public final Double getDemandWeight()
        Returns the demand weight. This is only applicable to links of type CONNECTOR.
        Returns:
        Double; demand weight, any positive value, or null
      • getStartLine

        public OTSLine3D getStartLine()
        Returns the line over which GTUs enter and leave the link at the start node.
        Returns:
        OTSLine3D; line over which GTUs enter and leave the link at the start node
      • getEndLine

        public OTSLine3D getEndLine()
        Returns the line over which GTUs enter and leave the link at the end node.
        Returns:
        OTSLine3D; line over which GTUs enter and leave the link at the end node