Interface RoadNetwork

    • Method Detail

      • isLeftSidedTrafficDirection

        @Pure
        boolean isLeftSidedTrafficDirection()
        Description copied from interface: RoadSegmentContainer
        Replies if this road network uses a left-side circulation direction rule.

        When left-side circulation direction rule is used, it is supposed that all vehicles are going on the left side of the roads. For example, this rule is used in UK.

        Specified by:
        isLeftSidedTrafficDirection in interface RoadSegmentContainer
        Returns:
        true if the left-side rule is used on this network, otherwise false.
      • isRightSidedTrafficDirection

        @Pure
        boolean isRightSidedTrafficDirection()
        Description copied from interface: RoadSegmentContainer
        Replies if this road network uses a right-side circulation direction rule.

        When right-side circulation direction rule is used, it is supposed that all vehicles are going on the right side of the roads. For example, this rule is used in France.

        Specified by:
        isRightSidedTrafficDirection in interface RoadSegmentContainer
        Returns:
        true if the right-side rule is used on this network, otherwise false.
      • getRoadSegments

        @Pure
        Collection<? extends RoadSegment> getRoadSegments()
        Replies a collection of segments inside this road network.
        Returns:
        a collection of segments inside this road network.
      • contains

        @Pure
        boolean contains​(RoadSegment segment)
        Description copied from interface: RoadSegmentContainer
        Replies if the given road segment is inside this road network.
        Specified by:
        contains in interface RoadSegmentContainer
        Parameters:
        segment - a segment.
        Returns:
        true if the segment is inside the road network, otherwise false
      • getRoadSegment

        @Pure
        RoadSegment getRoadSegment​(GeoId geoId)
        Description copied from interface: RoadSegmentContainer
        Replies the road segment with the given identifier.

        This function is time consuming because the location of the road segment could not be retrieved from the geoId.

        Specified by:
        getRoadSegment in interface RoadSegmentContainer
        Parameters:
        geoId - an identifier.
        Returns:
        the road segment or null if not found.
      • getNearestConnection

        @Pure
        RoadConnection getNearestConnection​(Point2D<?,​?> pos)
        Return the nearest point from a position.
        Parameters:
        pos - is the testing position.
        Returns:
        the nearest road network point to the given point.
      • getConnections

        @Pure
        Collection<RoadConnection> getConnections​(Rectangle2afp<?,​?,​?,​?,​?,​?> bounds)
        Return the the road connections inside the given bounds.
        Parameters:
        bounds - are the bounds to explore.
        Returns:
        the road connections in the given bounds.
        Since:
        4.0
      • getConnections

        @Pure
        Collection<RoadConnection> getConnections​(Rectangle2d bounds)
        Return the the road connections inside the given bounds.
        Parameters:
        bounds - are the bounds to explore.
        Returns:
        the road connections in the given bounds.
        Since:
        4.0
      • getNearestSegment

        @Pure
        RoadSegment getNearestSegment​(Point2D<?,​?> pos)
        Return the nearest segment from a position.
        Parameters:
        pos - is the testing position.
        Returns:
        the nearest road network segment to the given point.
      • getNearestSegmentData

        @Pure
        org.eclipse.xtext.xbase.lib.Pair<? extends RoadSegment,​Double> getNearestSegmentData​(Point2D<?,​?> pos)
        Return the nearest segment from a position; and its distance to the point.
        Parameters:
        pos - is the testing position.
        Returns:
        the nearest road network segment and its distance to the given point; or null if none.
        Since:
        4.0
      • getNearestPosition

        @Pure
        Point1d getNearestPosition​(Point2D<?,​?> pos)
        Return the nearest point 1.5D from a 2D position.
        Parameters:
        pos - is the testing position.
        Returns:
        the nearest 1.5D position on the road network.
      • getNearestPositionOnRoadBorder

        @Pure
        Point1d getNearestPositionOnRoadBorder​(Point2D<?,​?> pos)
        Return the nearest point 1.5D on the road borders from a 2D position.
        Parameters:
        pos - is the testing position.
        Returns:
        the nearest 1.5D position on the road network.
        Since:
        16.0
      • addRoadSegment

        void addRoadSegment​(RoadSegment segment)
        Add a road segment inside the road network.
        Parameters:
        segment - is the road segment to insert
      • removeRoadSegment

        boolean removeRoadSegment​(RoadSegment segment)
        Remove a segment from this network.
        Parameters:
        segment - is the segment to remove
        Returns:
        true if the segment was successfully removed, otherwhise false
      • clear

        boolean clear()
        Clear this road network by removing all the road segments.
        Returns:
        true if the road network changed due to this call; otherwise false.
        Since:
        4.0
      • mergeRoadConnections

        RoadConnection mergeRoadConnections​(RoadConnection... connections)
        Merge the given connections to obtain only one connection.
        Parameters:
        connections - are the connections to merge.
        Returns:
        the result of the merging action.
        Since:
        4.0
      • mergeRoadConnections

        RoadConnection mergeRoadConnections​(Collection<? extends RoadConnection> connections)
        Merge the given connections to obtain only one connection.
        Parameters:
        connections - are the connections to merge.
        Returns:
        the result of the merging action.
        Since:
        4.0
      • connectSegmentStartPoint

        RoadConnection connectSegmentStartPoint​(RoadConnection connection,
                                                RoadSegment segment,
                                                Point2D<?,​?> position)
        Connection the start point of the given road segment to the given road connection or to a new connection.
        Parameters:
        connection - is the connection to connect to, or null if a new connection should be created.
        segment - is the road to connected to.
        position - is the position where the first point of the segment should be located, or null if this position may be unchanged.
        Returns:
        the connection to which the segment was attached.
        Since:
        4.0
      • connectSegmentEndPoint

        RoadConnection connectSegmentEndPoint​(RoadConnection connection,
                                              RoadSegment segment,
                                              Point2D<?,​?> position)
        Connection the end point of the given road segment to the given road connection or to a new connection.
        Parameters:
        connection - is the connection to connect to, or null if a new connection should be created.
        segment - is the road to connected to.
        position - is the position where the end point of the segment should be located, or null if this position may be unchanged.
        Returns:
        the connection to which the segment was attached.
        Since:
        4.0
      • addRoadNetworkListener

        void addRoadNetworkListener​(RoadNetworkListener listener)
        Add a listener.
        Parameters:
        listener - the listener.
      • removeRoadNetworkListener

        void removeRoadNetworkListener​(RoadNetworkListener listener)
        Remove a listener.
        Parameters:
        listener - the listener.
      • iterator

        @Pure
        Iterator<? extends RoadSegment> iterator​(Rectangle2afp<?,​?,​?,​?,​?,​?> bounds)
        Description copied from interface: RoadSegmentContainer
        Iterates on the segments that intersect the specified bounds.
        Specified by:
        iterator in interface RoadSegmentContainer
        Parameters:
        bounds - is the rectangle inside which the replied elements must be located
        Returns:
        an iterator.
      • iterator

        @Pure
        Iterator<? extends RoadSegment> iterator​(Rectangle2afp<?,​?,​?,​?,​?,​?> bounds,
                                                 int budget)
        Description copied from interface: RoadSegmentContainer
        Iterates on the segments that intersect the specified bounds.
        Specified by:
        iterator in interface RoadSegmentContainer
        Parameters:
        bounds - is the rectangle inside which the replied elements must be located
        budget - is the maximal count of elements which will be replied by the iterator.
        Returns:
        an iterator.
      • toIterable

        @Pure
        Iterable<? extends RoadSegment> toIterable​(Rectangle2afp<?,​?,​?,​?,​?,​?> bounds,
                                                   int budget)
        Description copied from interface: RoadSegmentContainer
        Iterates on the segments that intersect the specified bounds.
        Specified by:
        toIterable in interface RoadSegmentContainer
        Parameters:
        bounds - is the rectangle inside which the replied elements must be located
        budget - is the maximal count of elements which will be replied by the iterator.
        Returns:
        an iterator.
      • boundsIterator

        @Pure
        Iterator<Rectangle2afp<?,​?,​?,​?,​?,​?>> boundsIterator()
        Replies the bounding rectangles of the internal data-structure elements.
        Returns:
        the bounding boxes in the data-structure.