Class ServiceLegImpl
- java.lang.Object
- 
- org.goplanit.utils.id.IdAbleImpl
- 
- org.goplanit.utils.id.ExternalIdAbleImpl
- 
- org.goplanit.graph.GraphEntityImpl
- 
- org.goplanit.graph.EdgeImpl<V>
- 
- org.goplanit.graph.directed.DirectedEdgeImpl<ServiceNode,ServiceLegSegment>
- 
- org.goplanit.network.layer.service.ServiceLegImpl
 
 
 
 
 
 
- 
- All Implemented Interfaces:
- Serializable,- Comparable<IdAble>,- DirectedEdge,- Edge,- GraphEntity,- ExternalIdAble,- IdAble,- ManagedId,- ServiceLeg
 
 public class ServiceLegImpl extends DirectedEdgeImpl<ServiceNode,ServiceLegSegment> 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
 
- 
- 
Nested Class Summary- 
Nested classes/interfaces inherited from interface org.goplanit.utils.network.layer.service.ServiceLegServiceLeg.LengthType
 
- 
 - 
Field Summary- 
Fields inherited from class org.goplanit.graph.EdgeImplinputProperties, lengthInKm, lineGeometry, name
 - 
Fields inherited from interface org.goplanit.utils.graph.EdgeEDGE_ID_CLASS
 
- 
 - 
Constructor SummaryConstructors Modifier Constructor Description protectedServiceLegImpl(ServiceLegImpl other, boolean deepCopy)Copy Constructor.protectedServiceLegImpl(IdGroupingToken tokenId, ServiceNode nodeA, ServiceNode nodeB)Constructor which injects link lengths directly
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description org.locationtech.jts.geom.EnvelopecreateEnvelope()Create based on underlying links that have a geometryServiceLegImpldeepClone()An id entity should always support a deep copy, i.e., all "owned" members will be deep copied when a clone of this instance is created via this call.org.locationtech.jts.geom.LineStringgetGeometry()Because each service leg segment may comprise different physical link(s) (segments) they may have different geometry for either direction, so no single geometry may exist on the (non-directional) leg.doublegetLengthKm()Will apply #LengthType.AVERAGE to obtain average length across service leg segments (in case both service leg segments are mapped to the leg and have different lengths due to different underlying physical link segments).doublegetLengthKm(ServiceLeg.LengthType lengthType)determine length based on desired length type (in case both service leg segments are mapped to the leg and have different lengths due to different underlying physical link segments)booleanhasGeometry()check if geometry is availablebooleanisGeometryInAbDirection()verify if the geometry is in the A to B direction of the link, both vertices must have geometry present.voidsetGeometry(org.locationtech.jts.geom.LineString lineString)Not allowed, set geometry via underlying leg segment physical links insteadvoidsetLengthKm(double lengthInKm)Not allowed, set length via underlying links insteadServiceLegImplshallowClone()Create a shallow copy of this entityvoidtransformGeometry(org.opengis.referencing.operation.MathTransform transformer)Not allowed on service leg, perform on underlying links instead.booleanvalidate()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.DirectedEdgeImplgetEdgeSegmentAb, getEdgeSegmentBa, registerEdgeSegment, removeEdgeSegmentAb, removeEdgeSegmentBa, replace, setEdgeSegmentAb, setEdgeSegmentBa
 - 
Methods inherited from class org.goplanit.graph.EdgeImpladdInputProperty, getInputProperty, getName, getVertexA, getVertexB, removeVertex, removeVertexA, removeVertexB, replace, setName, setVertexA, setVertexB
 - 
Methods inherited from class org.goplanit.graph.GraphEntityImplgenerateAndSetId, generateId, recreateManagedIds, toString
 - 
Methods inherited from class org.goplanit.utils.id.ExternalIdAbleImplgetExternalId, getXmlId, setExternalId, setXmlId
 - 
Methods inherited from class org.goplanit.utils.id.IdAbleImplequals, generateAndSetId, getId, hashCode, setId
 - 
Methods inherited from class java.lang.Objectclone, finalize, getClass, notify, notifyAll, wait, wait, wait
 - 
Methods inherited from interface org.goplanit.utils.graph.directed.DirectedEdgeforEachSegment, getEdgeSegment, getEdgeSegmentAb, getEdgeSegmentBa, getEdgeSegments, getVertexA, getVertexB, hasEdgeSegment, hasEdgeSegmentAb, hasEdgeSegmentBa, registerEdgeSegment, registerEdgeSegment, removeEdgeSegment, removeEdgeSegmentAb, removeEdgeSegmentBa, removeEdgeSegments, replace
 - 
Methods inherited from interface org.goplanit.utils.graph.EdgeaddInputProperty, getIdClass, getInputProperty, getName, hasVertex, hasVertexA, hasVertexB, hasVertices, isGeometryInAbDirection, isVertexA, populateBasicGeometry, removeVertex, replace, setName, updateGeometryInjectCoordinateAtProjectedLocation
 - 
Methods inherited from interface org.goplanit.utils.id.ExternalIdAbleappendExternalId, appendExternalId, getExternalId, getIdsAsString, getSplitExternalId, getSplitExternalId, getXmlId, hasExternalId, hasXmlId, setExternalId, setXmlId, setXmlId
 - 
Methods inherited from interface org.goplanit.utils.id.IdAblecompareTo, getId, idEquals, idHashCode
 - 
Methods inherited from interface org.goplanit.utils.id.ManagedIdrecreateManagedIds, resetChildManagedIdEntities
 - 
Methods inherited from interface org.goplanit.utils.network.layer.service.ServiceLeggetLegSegment, getLegSegmentAb, getLegSegments, getLinkSegmentBa, getServiceNodeA, getServiceNodeB, hasLegSegmentAb, hasLegSegmentBa, hasName
 
- 
 
- 
- 
- 
Constructor Detail- 
ServiceLegImplprotected 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
 
 - 
ServiceLegImplprotected ServiceLegImpl(ServiceLegImpl other, boolean deepCopy) Copy Constructor. network layer links are shallow copied.- Parameters:
- other- to copy
- deepCopy- when true, create a deep cpy, shallow copy otherwise
 
 
- 
 - 
Method Detail- 
hasGeometrypublic boolean hasGeometry() Description copied from interface:Edgecheck if geometry is available- Specified by:
- hasGeometryin interface- Edge
- Returns:
- true when all underlying service leg segments have a geometry, false otherwise
 
 - 
isGeometryInAbDirectionpublic boolean isGeometryInAbDirection() Description copied from interface:Edgeverify if the geometry is in the A to B direction of the link, both vertices must have geometry present.- Specified by:
- isGeometryInAbDirectionin interface- Edge
- Returns:
- true when geometry is present and all underlying links are in ab direction, false otherwise
 
 - 
transformGeometrypublic void transformGeometry(org.opengis.referencing.operation.MathTransform transformer) throws org.opengis.geometry.MismatchedDimensionException, org.opengis.referencing.operation.TransformExceptionNot allowed on service leg, perform on underlying links instead. Always throws exception- Specified by:
- transformGeometryin interface- Edge
- Parameters:
- transformer- to use
- Throws:
- org.opengis.geometry.MismatchedDimensionException- thrown if error
- org.opengis.referencing.operation.TransformException- thrown if error
 
 - 
createEnvelopepublic org.locationtech.jts.geom.Envelope createEnvelope() Create based on underlying links that have a geometry- Specified by:
- createEnvelopein interface- Edge
- Returns:
- composite envelope, null if no underlying links, or links have no geometry
 
 - 
getGeometrypublic org.locationtech.jts.geom.LineString getGeometry() Because each service leg segment may comprise different physical link(s) (segments) they may have different geometry for either direction, so no single geometry may exist on the (non-directional) leg. Hence, we construct an on-the-fy and as-the-crow flies line between the service nodes instead (if the underlying service nodes do have a location)- Specified by:
- getGeometryin interface- Edge
- Overrides:
- getGeometryin class- EdgeImpl<ServiceNode>
- Returns:
- straight line between service node a position and service node b position if they have a position, otherwise null
 
 - 
setGeometrypublic void setGeometry(org.locationtech.jts.geom.LineString lineString) Not allowed, set geometry via underlying leg segment physical links instead- Specified by:
- setGeometryin interface- Edge
- Overrides:
- setGeometryin class- EdgeImpl<ServiceNode>
- Parameters:
- lineString- to use
 
 - 
getLengthKmpublic double getLengthKm() Will apply #LengthType.AVERAGE to obtain average length across service leg segments (in case both service leg segments are mapped to the leg and have different lengths due to different underlying physical link segments).- Specified by:
- getLengthKmin interface- Edge
- Overrides:
- getLengthKmin class- EdgeImpl<ServiceNode>
- Returns:
- found length, if no underlying service leg segments are present, length is set to infinite
 
 - 
getLengthKmpublic double getLengthKm(ServiceLeg.LengthType lengthType) determine length based on desired length type (in case both service leg segments are mapped to the leg and have different lengths due to different underlying physical link segments)- Specified by:
- getLengthKmin interface- ServiceLeg
- Parameters:
- lengthType- to apply
- Returns:
- found length, if no underlying service leg segments are present, length is set to zero
 
 - 
setLengthKmpublic void setLengthKm(double lengthInKm) Not allowed, set length via underlying links instead- Specified by:
- setLengthKmin interface- Edge
- Overrides:
- setLengthKmin class- EdgeImpl<ServiceNode>
- Parameters:
- lengthInKm- to use
 
 - 
validatepublic 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:
- validatein interface- Edge
- Overrides:
- validatein class- EdgeImpl<ServiceNode>
- Returns:
- true when valid, false otherwise
 
 - 
shallowClonepublic ServiceLegImpl shallowClone() Create a shallow copy of this entity- Specified by:
- shallowClonein interface- DirectedEdge
- Specified by:
- shallowClonein interface- Edge
- Specified by:
- shallowClonein interface- GraphEntity
- Specified by:
- shallowClonein interface- IdAble
- Specified by:
- shallowClonein interface- ServiceLeg
- Overrides:
- shallowClonein class- DirectedEdgeImpl<ServiceNode,ServiceLegSegment>
- Returns:
- shallow copy of entity
 
 - 
deepClonepublic ServiceLegImpl deepClone() An id entity should always support a deep copy, i.e., all "owned" members will be deep copied when a clone of this instance is created via this call. To be used with caution if not called by managed id container related code- Specified by:
- deepClonein interface- DirectedEdge
- Specified by:
- deepClonein interface- Edge
- Specified by:
- deepClonein interface- GraphEntity
- Specified by:
- deepClonein interface- IdAble
- Specified by:
- deepClonein interface- ServiceLeg
- Overrides:
- deepClonein class- DirectedEdgeImpl<ServiceNode,ServiceLegSegment>
- Returns:
- deep copy of entity
 
 
- 
 
-