Class StandardRoadNetwork

    • Constructor Detail

      • StandardRoadNetwork

        public StandardRoadNetwork​(Rectangle2afp<?,​?,​?,​?,​?,​?> originalBounds,
                                   AttributeCollection attributeProvider)
        Constructor.
        Parameters:
        originalBounds - are the bounds of the road network.
        attributeProvider - is the attribute collection associated to this network.
      • StandardRoadNetwork

        public StandardRoadNetwork​(Rectangle2afp<?,​?,​?,​?,​?,​?> originalBounds)
        Constructor.
        Parameters:
        originalBounds - are the bounds of the road network.
      • StandardRoadNetwork

        public StandardRoadNetwork​(UUID id,
                                   Rectangle2afp<?,​?,​?,​?,​?,​?> originalBounds,
                                   AttributeCollection attributeProvider)
        Constructor.
        Parameters:
        id - is the unique identifier of this element, or null if unknown.
        originalBounds - are the bounds of the road network.
        attributeProvider - is the attribute collection associated to this network.
        Since:
        4.0
      • StandardRoadNetwork

        public StandardRoadNetwork​(UUID id,
                                   Rectangle2afp<?,​?,​?,​?,​?,​?> originalBounds)
        Constructor.
        Parameters:
        id - is the unique identifier of this element, or null if unknown.
        originalBounds - are the bounds of the road network.
        Since:
        4.0
    • Method Detail

      • createInternalDataStructure

        protected GISPolylineSet<RoadPolyline> createInternalDataStructure​(Rectangle2afp<?,​?,​?,​?,​?,​?> originalBounds)
        Create the internal data structure.
        Parameters:
        originalBounds - are the bounds of the road network.
        Returns:
        the internal data structure.
      • getInternalSet

        @Pure
        public GISPolylineSet<RoadPolyline> getInternalSet()
        Replies the internal data-structure as set.
        Returns:
        the internal data-structure as set.
      • getInternalTree

        @Pure
        public Tree<RoadPolyline,​?> getInternalTree()
        Replies the internal data-structure as tree.
        Returns:
        the internal data-structure as tree.
      • getLegalTrafficSide

        @Pure
        public LegalTrafficSide getLegalTrafficSide()
        Replies the legal traffic side.

        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.

        Returns:
        the legal traffic side
      • isLeftSidedTrafficDirection

        @Pure
        public 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 RoadNetwork
        Specified by:
        isLeftSidedTrafficDirection in interface RoadSegmentContainer
        Returns:
        true if the left-side rule is used on this network, otherwise false.
      • isRightSidedTrafficDirection

        @Pure
        public 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 RoadNetwork
        Specified by:
        isRightSidedTrafficDirection in interface RoadSegmentContainer
        Returns:
        true if the right-side rule is used on this network, otherwise false.
      • getSegmentCount

        @Pure
        public int getSegmentCount()
        Description copied from interface: Graph
        Replies the count of segments in this graph.
        Specified by:
        getSegmentCount in interface Graph<RoadSegment,​RoadConnection>
        Returns:
        the count of segments in this graph.
      • getPointCount

        @Pure
        public int getPointCount()
        Description copied from interface: Graph
        Replies the count of points in this graph.
        Specified by:
        getPointCount in interface Graph<RoadSegment,​RoadConnection>
        Returns:
        the count of points in this graph.
      • contains

        @Pure
        public boolean contains​(Object obj)
        Description copied from interface: Graph
        Replies is this graph contains the given segment. The test is based on Object.equals(Object).
        Specified by:
        contains in interface Graph<RoadSegment,​RoadConnection>
        Parameters:
        obj - the object to search for.
        Returns:
        true if the graph contains the segment, otherwise false.
      • contains

        @Pure
        public final 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 RoadNetwork
        Specified by:
        contains in interface RoadSegmentContainer
        Parameters:
        segment - a segment.
        Returns:
        true if the segment is inside the road network, otherwise false
      • isEmpty

        @Pure
        public boolean isEmpty()
        Description copied from interface: Graph
        Replies if this graph is empty or not.
        Specified by:
        isEmpty in interface Graph<RoadSegment,​RoadConnection>
        Returns:
        true if the graph is empty, otherwise false.
      • getGeoLocation

        @Pure
        public GeoLocation getGeoLocation()
        Description copied from interface: GISPrimitive
        Replies the geo-location.

        A GeoLocation is unique according to the geo-location of the element. If two elements have the same points in the same order, or if two elements have the same points in a reverse order, they must have equal GeoLocations.

        The following code is always true (where the arguments of the constructors are the list of points of the polyline). It illustrates that for two elements with the same geo-localized points, they have the same geo-location identifier (Geo-Id) and they have different unique ientifier (Uid):

        
         GISElement obj1 = new MapPolyline(100,10,200,30,300,4);
         GISElement obj2 = new MapPolyline(100,10,200,30,300,4);
         assert( obj1.getGeoId().equals(obj2.getGeoId()) );
         assert( obj2.getGeoId().equals(obj1.getGeoId()) );
         assert( ! obj1.getUid().equals(obj2.getUid()) );
         assert( ! obj2.getUid().equals(obj1.getUid()) );
         
        Specified by:
        getGeoLocation in interface GISPrimitive
        Returns:
        a location
        See Also:
        GISPrimitive.getGeoId(), GISPrimitive.getGeoLocation()
      • getRoadSegments

        @Pure
        public Collection<? extends RoadSegment> getRoadSegments()
        Description copied from interface: RoadNetwork
        Replies a collection of segments inside this road network.
        Specified by:
        getRoadSegments in interface RoadNetwork
        Returns:
        a collection of segments inside this road network.
      • getRoadSegment

        @Pure
        public final 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 RoadNetwork
        Specified by:
        getRoadSegment in interface RoadSegmentContainer
        Parameters:
        geoId - an identifier.
        Returns:
        the road segment or null if not found.
      • getConnections

        @Pure
        public Collection<RoadConnection> getConnections​(Rectangle2afp<?,​?,​?,​?,​?,​?> bounds)
        Description copied from interface: RoadNetwork
        Return the the road connections inside the given bounds.
        Specified by:
        getConnections in interface RoadNetwork
        Parameters:
        bounds - are the bounds to explore.
        Returns:
        the road connections in the given bounds.
      • getConnections

        @Pure
        public Collection<RoadConnection> getConnections​(Rectangle2d bounds)
        Description copied from interface: RoadNetwork
        Return the the road connections inside the given bounds.
        Specified by:
        getConnections in interface RoadNetwork
        Parameters:
        bounds - are the bounds to explore.
        Returns:
        the road connections in the given bounds.
      • getNearestConnection

        @Pure
        public RoadConnection getNearestConnection​(Point2D<?,​?> pos)
        Description copied from interface: RoadNetwork
        Return the nearest point from a position.
        Specified by:
        getNearestConnection in interface RoadNetwork
        Parameters:
        pos - is the testing position.
        Returns:
        the nearest road network point to the given point.
      • getNearestSegment

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

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

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

        @Pure
        public Point1d getNearestPositionOnRoadBorder​(Point2D<?,​?> pos)
        Description copied from interface: RoadNetwork
        Return the nearest point 1.5D on the road borders from a 2D position.
        Specified by:
        getNearestPositionOnRoadBorder in interface RoadNetwork
        Parameters:
        pos - is the testing position.
        Returns:
        the nearest 1.5D position on the road network.
      • addRoadPolyline

        public final boolean addRoadPolyline​(RoadPolyline segment)
                                      throws RoadNetworkException
        Add a road segment inside the road network.
        Parameters:
        segment - is the road segment to insert
        Returns:
        true if segment successfully added, otherwise false
        Throws:
        RoadNetworkException - in case of error.
      • removeRoadSegment

        public boolean removeRoadSegment​(RoadSegment segment)
        Description copied from interface: RoadNetwork
        Remove a segment from this network.
        Specified by:
        removeRoadSegment in interface RoadNetwork
        Parameters:
        segment - is the segment to remove
        Returns:
        true if the segment was successfully removed, otherwhise false
      • clear

        public boolean clear()
        Description copied from interface: RoadNetwork
        Clear this road network by removing all the road segments.
        Specified by:
        clear in interface RoadNetwork
        Returns:
        true if the road network changed due to this call; otherwise false.
      • mergeRoadConnections

        public final RoadConnection mergeRoadConnections​(RoadConnection... connections)
        Description copied from interface: RoadNetwork
        Merge the given connections to obtain only one connection.
        Specified by:
        mergeRoadConnections in interface RoadNetwork
        Parameters:
        connections - are the connections to merge.
        Returns:
        the result of the merging action.
      • connectSegmentStartPoint

        public RoadConnection connectSegmentStartPoint​(RoadConnection connection,
                                                       RoadSegment segment,
                                                       Point2D<?,​?> position)
        Description copied from interface: RoadNetwork
        Connection the start point of the given road segment to the given road connection or to a new connection.
        Specified by:
        connectSegmentStartPoint in interface RoadNetwork
        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.
      • connectSegmentEndPoint

        public RoadConnection connectSegmentEndPoint​(RoadConnection connection,
                                                     RoadSegment segment,
                                                     Point2D<?,​?> position)
        Description copied from interface: RoadNetwork
        Connection the end point of the given road segment to the given road connection or to a new connection.
        Specified by:
        connectSegmentEndPoint in interface RoadNetwork
        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.
      • fireSegmentAdded

        protected void fireSegmentAdded​(RoadSegment segment)
        Fire the addition event.
        Parameters:
        segment - is the added segment
      • fireSegmentChanged

        protected void fireSegmentChanged​(RoadSegment segment)
        Fire the change event.
        Parameters:
        segment - is the changed segment
      • fireSegmentRemoved

        protected void fireSegmentRemoved​(RoadSegment segment)
        Fire the addition event.
        Parameters:
        segment - is the removed segment
      • depthIterator

        @Pure
        public GraphIterator<RoadSegment,​RoadConnection> depthIterator​(RoadSegment startingSegment,
                                                                             double depth,
                                                                             double position_from_starting_point,
                                                                             RoadConnection startingPoint,
                                                                             boolean allowManyReplies,
                                                                             boolean assumeOrientedSegments,
                                                                             DynamicDepthUpdater<RoadSegment,​RoadConnection> dynamicDepthUpdater)
        Description copied from interface: Graph
        Replies an iterator that permits to move along the segment's graph starting from the specified segment and from the specified starting point. If the specified starting point is not one of the ends of the segment, this function assumes to start from the point replied by GraphSegment.getBeginPoint().

        This function does not allow the cycles during the iterations.

        Specified by:
        depthIterator in interface Graph<RoadSegment,​RoadConnection>
        Specified by:
        depthIterator in interface RoadSegmentContainer
        Parameters:
        startingSegment - is the first segment to iterate.
        depth - is the maximal depth to reach.
        position_from_starting_point - is the starting position from the startingPoint.
        startingPoint - is the starting point of the iterations.
        allowManyReplies - may be true to allow to reply many times the same segment, otherwhise false.
        assumeOrientedSegments - may be true to assume that the same segment has two different instances for graph iteration: the first instance is associated the first point of the segment and the second instance is associated to the last point of the segment. If this parameter is false to assume that the end points of a segment are not distinguished.
        dynamicDepthUpdater - if not null, it is a lambda that is used for dynamically updating the maximal depth.
        Returns:
        the iterator.
        See Also:
        Graph.depthIterator(GraphSegment, double, double, GraphPoint, boolean, boolean)
      • iterator

        @Pure
        public GraphIterator<RoadSegment,​RoadConnection> iterator​(RoadSegment starting_segment,
                                                                        RoadConnection starting_point,
                                                                        boolean allowManyReplies,
                                                                        boolean assumeOrientedSegments)
        Description copied from interface: Graph
        Replies an iterator that permits to move along the road segment's graph starting from this road segment and from the specified starting point.
        Specified by:
        iterator in interface Graph<RoadSegment,​RoadConnection>
        Specified by:
        iterator in interface RoadSegmentContainer
        Parameters:
        starting_segment - is the first segment to iterate.
        starting_point - is the starting point of the iterations.
        allowManyReplies - may be true to allow to reply many times the same segment, otherwhise false.
        assumeOrientedSegments - may be true to assume that the same segment has two different instances for graph iteration: the first instance is associated the first point of the segment and the second instance is associated to the last point of the segment. If this parameter is false to assume that the end points of a segment are not distinguished.
        Returns:
        the iterator.
      • iterator

        @Pure
        public 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 RoadNetwork
        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
        public 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 RoadNetwork
        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
        public Iterator<Rectangle2afp<?,​?,​?,​?,​?,​?>> boundsIterator()
        Description copied from interface: RoadNetwork
        Replies the bounding rectangles of the internal data-structure elements.
        Specified by:
        boundsIterator in interface RoadNetwork
        Returns:
        the bounding boxes in the data-structure.