Package org.goplanit.utils.graph
Interface Edge
-
- All Superinterfaces:
Comparable<IdAble>
,ExternalIdAble
,GraphEntity
,IdAble
,ManagedId
,Serializable
- All Known Subinterfaces:
ConjugateConnectoidEdge
,ConjugateDirectedEdge
,ConjugateEdge
,ConjugateLink
,ConnectoidEdge
,DirectedEdge
,Link
,MacroscopicLink
,ServiceLeg
- All Known Implementing Classes:
ConjugateConnectoidEdgeImpl
,ConjugateDirectedEdgeImpl
,ConjugateEdgeImpl
,ConjugateLinkImpl
,ConnectoidEdgeImpl
,DirectedEdgeImpl
,EdgeImpl
,LinkImpl
,MacroscopicLinkImpl
,ServiceLegImpl
public interface Edge extends Serializable, GraphEntity
Edge interface connecting two vertices in a non-directional fashion.- Author:
- markr
-
-
Field Summary
Fields Modifier and Type Field Description static Class<Edge>
EDGE_ID_CLASS
id class for generating ids
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description void
addInputProperty(String key, Object value)
Add a property from the original input that is not part of the readily available link membersdefault org.locationtech.jts.geom.Envelope
createEnvelope()
collect the bounding box of the geometry of this linkEdge
deepClone()
Deep copy, non-owned members are reference copiedorg.locationtech.jts.geom.LineString
getGeometry()
Collect the geometry of this linedefault Class<? extends Edge>
getIdClass()
All edges use the EDGE_ID_CLASS to generate the unique internal idsObject
getInputProperty(String key)
Get input property by its keydouble
getLengthKm()
Return length of this edge in kmString
getName()
get the name of the edgeVertex
getVertexA()
Vertex A of the edgeVertex
getVertexB()
Vertex B of the edgedefault boolean
hasGeometry()
check if geometry is availabledefault boolean
hasName()
Verify if a name has been setdefault boolean
hasVertex(Vertex vertex)
check if vertex is present on the edgedefault boolean
hasVertexA()
Verify if vertex A is availabledefault boolean
hasVertexB()
Verify if vertex B is availabledefault boolean
hasVertices()
Verify if vertex A and B are availabledefault boolean
isGeometryInAbDirection()
verify if the geometry is in the A to B direction of the link, both vertices must have geometry present.default boolean
isGeometryInAbDirection(boolean allowSingleVertexWithoutGeometry)
verify if the geometry is in the A to B direction of the edge.default boolean
isVertexA(Vertex vertex)
Verify if passed in vertex is the same object reference as vertex Adefault boolean
populateBasicGeometry(boolean overwrite)
Utilising the A and B vertex construct a direct line between the two points as the geometryboolean
removeVertex(Vertex vertex)
Remove vertex from edgeboolean
replace(Vertex vertextoReplace, Vertex vertexToReplaceWith)
Replace one of the vertices of the linkvoid
setGeometry(org.locationtech.jts.geom.LineString lineString)
set the geometry of this link as a line stringvoid
setLengthKm(double lengthInKm)
set length of this edge in kmvoid
setName(String name)
set the name of the edgeEdge
shallowClone()
Shallow copydefault void
transformGeometry(org.opengis.referencing.operation.MathTransform transformer)
transform the line string information of this edge using the passed in MathTransformdefault org.locationtech.jts.geom.Geometry
updateGeometryInjectCoordinateAtProjectedLocation(org.locationtech.jts.linearref.LinearLocation projectedLinearLocation)
Update the geometry by taking the current geometry and inject a coordinate at the projected location between existing coordinates using the passed in location.boolean
validate()
validate the contents of this edge-
Methods inherited from interface org.goplanit.utils.id.ExternalIdAble
appendExternalId, appendExternalId, getExternalId, getIdsAsString, getSplitExternalId, getSplitExternalId, getXmlId, hasExternalId, hasXmlId, setExternalId, setXmlId, 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
-
-
-
-
Method Detail
-
isVertexA
default boolean isVertexA(Vertex vertex)
Verify if passed in vertex is the same object reference as vertex A- Parameters:
vertex
- to check- Returns:
- true when identical object instance, false otherwise
-
getGeometry
org.locationtech.jts.geom.LineString getGeometry()
Collect the geometry of this line- Returns:
- lineString
-
setGeometry
void setGeometry(org.locationtech.jts.geom.LineString lineString)
set the geometry of this link as a line string- Parameters:
lineString
- to set
-
populateBasicGeometry
default boolean populateBasicGeometry(boolean overwrite)
Utilising the A and B vertex construct a direct line between the two points as the geometry- Parameters:
overwrite
- when true, overwrite existing geometry, otherwise ignore- Returns:
- true when successful, false otherwise
-
removeVertex
boolean removeVertex(Vertex vertex)
Remove vertex from edge- Parameters:
vertex
- to remove- Returns:
- true when successful false otherwise
-
getVertexA
Vertex getVertexA()
Vertex A of the edge- Returns:
- vertex A
-
getVertexB
Vertex getVertexB()
Vertex B of the edge- Returns:
- vertex B
-
setName
void setName(String name)
set the name of the edge- Parameters:
name
- to set
-
getName
String getName()
get the name of the edge- Returns:
- name
-
setLengthKm
void setLengthKm(double lengthInKm)
set length of this edge in km- Parameters:
lengthInKm
- of this edge in km
-
getLengthKm
double getLengthKm()
Return length of this edge in km- Returns:
- length of this edge in km
-
addInputProperty
void addInputProperty(String key, Object value)
Add a property from the original input that is not part of the readily available link members- Parameters:
key
- (name) of input propertyvalue
- of input property
-
getInputProperty
Object getInputProperty(String key)
Get input property by its key- Parameters:
key
- of input property- Returns:
- value retrieved value of input property
-
replace
boolean replace(Vertex vertextoReplace, Vertex vertexToReplaceWith)
Replace one of the vertices of the link- Parameters:
vertextoReplace
- the vertex to replacevertexToReplaceWith
- the vertex to replace with- Returns:
- true when replaced, false otherwise
-
shallowClone
Edge shallowClone()
Shallow copy- Specified by:
shallowClone
in interfaceGraphEntity
- Specified by:
shallowClone
in interfaceIdAble
- Returns:
- copy of this edge
-
deepClone
Edge deepClone()
Deep copy, non-owned members are reference copied- Specified by:
deepClone
in interfaceGraphEntity
- Specified by:
deepClone
in interfaceIdAble
- Returns:
- copy of this edge
-
validate
boolean validate()
validate the contents of this edge- Returns:
- true when valid, false otherwise
-
getIdClass
default Class<? extends Edge> getIdClass()
All edges use the EDGE_ID_CLASS to generate the unique internal ids- Specified by:
getIdClass
in interfaceManagedId
- Returns:
- idClass to use for generating ids for instances of this idable derived class
-
hasName
default boolean hasName()
Verify if a name has been set- Returns:
- true when present, false otherwise
-
hasVertex
default boolean hasVertex(Vertex vertex)
check if vertex is present on the edge- Parameters:
vertex
- to check- Returns:
- true when present false otherwise
-
hasVertexA
default boolean hasVertexA()
Verify if vertex A is available- Returns:
- true when present, false otherwise
-
hasVertexB
default boolean hasVertexB()
Verify if vertex B is available- Returns:
- true when present, false otherwise
-
hasVertices
default boolean hasVertices()
Verify if vertex A and B are available- Returns:
- true when present, false otherwise
-
hasGeometry
default boolean hasGeometry()
check if geometry is available- Returns:
- true when available, false otherwise
-
isGeometryInAbDirection
default boolean isGeometryInAbDirection()
verify if the geometry is in the A to B direction of the link, both vertices must have geometry present.- Returns:
- true if in A to B direction, false otherwise
-
isGeometryInAbDirection
default boolean isGeometryInAbDirection(boolean allowSingleVertexWithoutGeometry)
verify if the geometry is in the A to B direction of the edge. When one of the vertices has no geometry, we may or may not allow for this. If this is the case, we enforce that at least one end of the geometry is matched to the other vertex's geometry to infer direction.- Parameters:
allowSingleVertexWithoutGeometry
- when true, we assume that geometry of edge is ok to be not matching vertex on one end- Returns:
- true if in A to B direction, false otherwise
-
transformGeometry
default void transformGeometry(org.opengis.referencing.operation.MathTransform transformer) throws org.opengis.geometry.MismatchedDimensionException, org.opengis.referencing.operation.TransformException
transform the line string information of this edge using the passed in MathTransform- Parameters:
transformer
- to apply- Throws:
org.opengis.geometry.MismatchedDimensionException
- thrown if errororg.opengis.referencing.operation.TransformException
- thrown if error
-
updateGeometryInjectCoordinateAtProjectedLocation
default org.locationtech.jts.geom.Geometry updateGeometryInjectCoordinateAtProjectedLocation(org.locationtech.jts.linearref.LinearLocation projectedLinearLocation)
Update the geometry by taking the current geometry and inject a coordinate at the projected location between existing coordinates using the passed in location. this replaces the existing geometry instance which is returned.- Parameters:
projectedLinearLocation
- to use as reference point of new coordinate- Returns:
- old geometry that is now replaced
-
createEnvelope
default org.locationtech.jts.geom.Envelope createEnvelope()
collect the bounding box of the geometry of this link- Returns:
- envelope (bounding box) of this link based on its geometry
-
-