Class ServiceLegImpl

    • Field Detail

      • networkLayerLinks

        protected List<Link> networkLayerLinks
        Service leg's underlying links connecting its two service nodes
    • Constructor Detail

      • ServiceLegImpl

        protected ServiceLegImpl​(IdGroupingToken tokenId,
                                 ServiceNode nodeA,
                                 ServiceNode nodeB)
        Constructor which injects link lengths directly
        Parameters:
        tokenId - contiguous id generation within this group for instances of this class
        nodeA - first vertex in the link
        nodeB - second vertex in the link
      • ServiceLegImpl

        protected ServiceLegImpl​(IdGroupingToken tokenId,
                                 ServiceNode nodeA,
                                 ServiceNode nodeB,
                                 List<Link> networkLayerLinks)
        Constructor which injects link lengths directly
        Parameters:
        tokenId - contiguous id generation within this group for instances of this class
        nodeA - first vertex in the link
        nodeB - second vertex in the link
        networkLayerLinks - to use
      • ServiceLegImpl

        protected ServiceLegImpl​(ServiceLegImpl serviceLeg)
        Copy Constructor. network layer links are shallow copied.
        Parameters:
        serviceLeg - to copy
    • Method Detail

      • setNetworkLayerLinks

        protected void setNetworkLayerLinks​(List<Link> networkLayerLinks)
        Set the network layer link that make up this leg
        Parameters:
        networkLayerLinks - to use
      • 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 Edge
        Overrides:
        getLengthKm in class EdgeImpl
        Returns:
        found length
      • hasGeometry

        public boolean hasGeometry()
        Description copied from interface: Edge
        check if geometry is available
        Specified by:
        hasGeometry in interface Edge
        Returns:
        true when all underlying links have a geometry, false otherwise
      • isGeometryInAbDirection

        public boolean isGeometryInAbDirection()
        Description copied from interface: Edge
        verify if the geometry is in the A to B direction of the link
        Specified by:
        isGeometryInAbDirection in interface Edge
        Returns:
        true when geometry is present and all underlying links are in ab direction, false otherwise
      • transformGeometry

        public void transformGeometry​(org.opengis.referencing.operation.MathTransform transformer)
                               throws org.opengis.geometry.MismatchedDimensionException,
                                      org.opengis.referencing.operation.TransformException
        Not allowed on service leg, perform on underlying links instead. Always throws exception
        Specified by:
        transformGeometry in interface Edge
        Parameters:
        transformer - to use
        Throws:
        org.opengis.geometry.MismatchedDimensionException - thrown if error
        org.opengis.referencing.operation.TransformException - thrown if error
      • createEnvelope

        public org.locationtech.jts.geom.Envelope createEnvelope()
        Create absed on underlying links that have a geometry
        Specified by:
        createEnvelope in interface Edge
        Returns:
        composite envelope, null if no underlying links, or links have no geometry
      • getGeometry

        public org.locationtech.jts.geom.LineString getGeometry()
        Not allowed, collect geometry via underlying links instead
        Specified by:
        getGeometry in interface Edge
        Overrides:
        getGeometry in class EdgeImpl
        Returns:
        null
      • setGeometry

        public void setGeometry​(org.locationtech.jts.geom.LineString lineString)
        Not allowed, set geometry via underlying links instead
        Specified by:
        setGeometry in interface Edge
        Overrides:
        setGeometry in class EdgeImpl
        Parameters:
        lineString - to use
      • setLengthKm

        public void setLengthKm​(double lengthInKm)
        Not allowed, set length via underlying links instead
        Specified by:
        setLengthKm in interface Edge
        Overrides:
        setLengthKm in class EdgeImpl
        Parameters:
        lengthInKm - to use
      • getParentLinks

        public List<Link> getParentLinks()
        Collect the links that make up this leg ordered and in direction from A to B
        Specified by:
        getParentLinks in interface ServiceLeg
        Returns:
        parent links this leg represents
      • 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 Edge
        Overrides:
        validate in class EdgeImpl
        Returns:
        true when valid, false otherwise