Class ServiceLegImpl
- java.lang.Object
-
- org.goplanit.utils.id.IdAbleImpl
-
- org.goplanit.utils.id.ExternalIdAbleImpl
-
- org.goplanit.graph.GraphEntityImpl
-
- org.goplanit.graph.EdgeImpl
-
- org.goplanit.graph.directed.DirectedEdgeImpl
-
- org.goplanit.network.layer.service.ServiceLegImpl
-
- All Implemented Interfaces:
Serializable
,Cloneable
,Comparable<IdAble>
,DirectedEdge
,Edge
,GraphEntity
,ExternalIdAble
,IdAble
,ManagedId
,ServiceLeg
public class ServiceLegImpl extends DirectedEdgeImpl implements ServiceLeg
A service leg connects two service nodes. Underlying are one or more physical links represented by this single service leg.- Author:
- markr
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected List<Link>
networkLayerLinks
Service leg's underlying links connecting its two service nodes-
Fields inherited from class org.goplanit.graph.EdgeImpl
inputProperties, lengthInKm, lineGeometry, name
-
Fields inherited from interface org.goplanit.utils.graph.Edge
EDGE_ID_CLASS
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
ServiceLegImpl(ServiceLegImpl serviceLeg)
Copy Constructor.protected
ServiceLegImpl(IdGroupingToken tokenId, ServiceNode nodeA, ServiceNode nodeB)
Constructor which injects link lengths directlyprotected
ServiceLegImpl(IdGroupingToken tokenId, ServiceNode nodeA, ServiceNode nodeB, List<Link> networkLayerLinks)
Constructor which injects link lengths directly
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description org.locationtech.jts.geom.Envelope
createEnvelope()
Create absed on underlying links that have a geometryorg.locationtech.jts.geom.LineString
getGeometry()
Not allowed, collect geometry via underlying links insteaddouble
getLengthKm()
Sum of the underlying network layer link lengths.List<Link>
getParentLinks()
Collect the links that make up this leg ordered and in direction from A to Bboolean
hasGeometry()
check if geometry is availableboolean
isGeometryInAbDirection()
verify if the geometry is in the A to B direction of the linkvoid
setGeometry(org.locationtech.jts.geom.LineString lineString)
Not allowed, set geometry via underlying links insteadvoid
setLengthKm(double lengthInKm)
Not allowed, set length via underlying links insteadprotected void
setNetworkLayerLinks(List<Link> networkLayerLinks)
Set the network layer link that make up this legvoid
transformGeometry(org.opengis.referencing.operation.MathTransform transformer)
Not allowed on service leg, perform on underlying links instead.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-
Methods inherited from class org.goplanit.graph.directed.DirectedEdgeImpl
clone, getEdgeSegmentAb, getEdgeSegmentBa, getVertexA, getVertexB, registerEdgeSegment, replace, setEdgeSegmentAb, setEdgeSegmentBa
-
Methods inherited from class org.goplanit.graph.EdgeImpl
addInputProperty, getInputProperty, getName, removeVertex, removeVertexA, removeVertexB, replace, setName, setVertexA, setVertexB
-
Methods inherited from class org.goplanit.graph.GraphEntityImpl
generateAndSetId, generateId, recreateManagedIds, toString
-
Methods inherited from class org.goplanit.utils.id.ExternalIdAbleImpl
getExternalId, getXmlId, setExternalId, setXmlId
-
Methods inherited from class org.goplanit.utils.id.IdAbleImpl
equals, generateAndSetId, getId, hashCode, setId
-
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.goplanit.utils.graph.directed.DirectedEdge
getEdgeSegment, getEdgeSegmentAb, getEdgeSegmentBa, getEdgeSegments, getVertexA, getVertexB, hasEdgeSegmentAb, hasEdgeSegmentBa, registerEdgeSegment, replace
-
Methods inherited from interface org.goplanit.utils.graph.Edge
addInputProperty, clone, getIdClass, getInputProperty, getName, hasVertex, removeVertex, replace, setName
-
Methods inherited from interface org.goplanit.utils.id.ExternalIdAble
getExternalId, getXmlId, hasExternalId, hasXmlId, setExternalId, setXmlId
-
Methods inherited from interface org.goplanit.utils.id.IdAble
compareTo, getId, idEquals, idHashCode
-
Methods inherited from interface org.goplanit.utils.id.ManagedId
recreateManagedIds, resetChildManagedIdEntities
-
Methods inherited from interface org.goplanit.utils.network.layer.service.ServiceLeg
getFirstParentLink, getLastParentLink, getLegSegment, getLegSegmentAb, getLegSegments, getLinkSegmentBa, getServiceNodeA, getServiceNodeB, hasLegSegmentAb, hasLegSegmentBa, hasName
-
-
-
-
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 classnodeA
- first vertex in the linknodeB
- 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 classnodeA
- first vertex in the linknodeB
- second vertex in the linknetworkLayerLinks
- 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 interfaceEdge
- Overrides:
getLengthKm
in classEdgeImpl
- Returns:
- found length
-
hasGeometry
public boolean hasGeometry()
Description copied from interface:Edge
check if geometry is available- Specified by:
hasGeometry
in interfaceEdge
- 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 interfaceEdge
- 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 interfaceEdge
- Parameters:
transformer
- to use- Throws:
org.opengis.geometry.MismatchedDimensionException
- thrown if errororg.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 interfaceEdge
- 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 interfaceEdge
- Overrides:
getGeometry
in classEdgeImpl
- Returns:
- null
-
setGeometry
public void setGeometry(org.locationtech.jts.geom.LineString lineString)
Not allowed, set geometry via underlying links instead- Specified by:
setGeometry
in interfaceEdge
- Overrides:
setGeometry
in classEdgeImpl
- Parameters:
lineString
- to use
-
setLengthKm
public void setLengthKm(double lengthInKm)
Not allowed, set length via underlying links instead- Specified by:
setLengthKm
in interfaceEdge
- Overrides:
setLengthKm
in classEdgeImpl
- 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 interfaceServiceLeg
- 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
-
-