Class ServiceLegSegmentImpl

    • Field Detail

      • networkLayerLinkSegments

        protected List<? extends LinkSegment> networkLayerLinkSegments
        Service leg's underlying links connecting its two service nodes
    • Constructor Detail

      • ServiceLegSegmentImpl

        protected ServiceLegSegmentImpl​(IdGroupingToken tokenId,
                                        ServiceLeg parentLeg,
                                        boolean directionAB)
        Constructor with no reference to underlying physical links (to be populated later)
        Parameters:
        tokenId - contiguous id generation within this group for instances of this class
        parentLeg - parent leg of segment
        directionAB - direction of travel
      • ServiceLegSegmentImpl

        protected ServiceLegSegmentImpl​(IdGroupingToken tokenId,
                                        ServiceLeg parentLeg,
                                        boolean directionAB,
                                        List<LinkSegment> networkLayerLinkSegments)
        Constructor
        Parameters:
        tokenId - contiguous id generation within this group for instances of this class
        parentLeg - parent leg of segment
        directionAB - direction of travel
        networkLayerLinkSegments - to use
      • ServiceLegSegmentImpl

        protected ServiceLegSegmentImpl​(ServiceLegSegmentImpl other,
                                        boolean deepCopy)
        Copy constructor
        Parameters:
        other - to copy
        deepCopy - when true, create a deep cpy, shallow copy otherwise
    • Method Detail

      • getGeometry

        public org.locationtech.jts.geom.LineString getGeometry()
        Collect the geometry of this service leg segment. Because service leg segments comprise one or more physical link segments, they may have unique geometry compared to their opposite direction counterpart. Therefore, they are expected to be able to provide their own unique access to their geometry rather than rely on their parent, also this may be generated on the fly rather than stored on the instance
        Specified by:
        getGeometry in interface ServiceLegSegment
        Returns:
        lineString
      • getLengthKm

        public double getLengthKm()
        Sum of the underlying network layer link lengths. If no links are registered 0 is returned
        Specified by:
        getLengthKm in interface EdgeSegment
        Returns:
        found length
      • hasGeometry

        public boolean hasGeometry()
        Description copied from interface: EdgeSegment
        verify if geometry is present based on parent's geometry
        Specified by:
        hasGeometry in interface EdgeSegment
        Specified by:
        hasGeometry in interface ServiceLegSegment
        Returns:
        true when all underlying links have a geometry, false otherwise
      • setPhysicalParentSegments

        public void setPhysicalParentSegments​(List<? extends LinkSegment> networkLayerLinkSegments)
        Set the network layer links that make up this leg irrespective wether they have been set before. Use with caution
        Specified by:
        setPhysicalParentSegments in interface ServiceLegSegment
        Parameters:
        networkLayerLinkSegments - to use
      • validate

        public boolean validate()
        Validate based on edge that it is, but also make sure that the references to parent network are consistent, i.e., the service nodes reside on the parent links in the right location as well
        Specified by:
        validate in interface EdgeSegment
        Overrides:
        validate in class EdgeSegmentImpl<ServiceLeg>
        Returns:
        true when valid, false otherwise