Package org.goplanit.utils.graph
Interface Vertex
-
- All Superinterfaces:
Comparable<IdAble>,ExternalIdAble,GraphEntity,IdAble,ManagedId,Serializable
- All Known Subinterfaces:
CentroidVertex,ConjugateConnectoidNode,ConjugateDirectedVertex,ConjugateNode,ConjugateVertex,DirectedVertex,Node,ServiceNode
- All Known Implementing Classes:
CentroidVertexImpl,ConjugateConnectoidNodeImpl,ConjugateDirectedVertexImpl,ConjugateNodeImpl,ConjugateVertexImpl,DirectedVertexImpl,NodeImpl,ServiceNodeImpl,VertexImpl
public interface Vertex extends Serializable, GraphEntity
Vertex representation connected to one or more edges and/or edge segments- Author:
- markr
-
-
Field Summary
Fields Modifier and Type Field Description static LoggerLOGGERvertex loggerstatic Class<Vertex>VERTEX_ID_CLASSid class for generating ids
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description booleanaddEdge(Edge edge)Add edge, do not invoke when parsing networks, this connection is auto-populated before the assignment starts based on the edge and its two vertices that have been registered.default voidaddEdges(Collection<? extends Edge> toBeAdded)Add multiple edges at the same timevoidaddInputProperty(String key, Object value)Add a property from the original input that is not part of the readily available membersVertexdeepClone()Deep cloneCollection<? extends Edge>getEdges()Returns a collection of Edge objects (unmodifiable)default Set<? extends Edge>getEdges(Vertex otherVertex)Collect the edge(s) based on the other vertexdefault Class<? extends Vertex>getIdClass()All vertices use the VERTEX_ID_CLASS to generate the unique internal idsObjectgetInputProperty(String key)collect a propertydefault intgetNumberOfEdges()Number of entries in edge segmentsorg.locationtech.jts.geom.PointgetPosition()Collect the geometry of the point location of this vertexdefault booleanhasPosition()Verify if position is availabledefault booleanisPositionEqual2D(org.locationtech.jts.geom.Coordinate coordinate)Verify if the vertex position is exactly equal (in 2D) to the passed in coordinatedefault booleanisPositionEqual2D(org.locationtech.jts.geom.Coordinate coordinate, double epsilon)Verify if the vertex position is exactly equal (in 2D) to the passed in coordinatevoidremoveAllEdges()Remove al edges from vertexbooleanremoveEdge(long edgeId)Remove edgedefault booleanremoveEdge(Edge edge)Remove edgedefault voidremoveEdges(Collection<? extends Edge> toBeRemoved)Remove provided edgesdefault booleanreplace(Edge edgeToReplace, Edge edgeToReplaceWith, boolean forceInsert)replace one edge with the othervoidsetPosition(org.locationtech.jts.geom.Point position)Set the center point geometry for a vertexVertexshallowClone()Shallow clonedefault voidtransformPosition(org.opengis.referencing.operation.MathTransform transformer)transform the position information of this vertex using the passed in MathTransformdefault booleanvalidate()Validate the vertex regarding it connections to edges etc.-
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
-
addInputProperty
void addInputProperty(String key, Object value)
Add a property from the original input that is not part of the readily available members- Parameters:
key- key (name) of the input propertyvalue- value of the input property
-
getInputProperty
Object getInputProperty(String key)
collect a property- Parameters:
key- for the property- Returns:
- property itself
-
setPosition
void setPosition(org.locationtech.jts.geom.Point position)
Set the center point geometry for a vertex- Parameters:
position- the center point for a vertex
-
getPosition
org.locationtech.jts.geom.Point getPosition()
Collect the geometry of the point location of this vertex- Returns:
- direct position reflecting point location
-
addEdge
boolean addEdge(Edge edge)
Add edge, do not invoke when parsing networks, this connection is auto-populated before the assignment starts based on the edge and its two vertices that have been registered.- Parameters:
edge- Edge to be added- Returns:
- true when added, false when already present (and not added)
-
addEdges
default void addEdges(Collection<? extends Edge> toBeAdded)
Add multiple edges at the same time- Parameters:
toBeAdded- the to be added edges
-
removeEdge
boolean removeEdge(long edgeId)
Remove edge- Parameters:
edgeId- Edge to be removed- Returns:
- true when removed, false when not present (and not removed)
-
getEdges
Collection<? extends Edge> getEdges()
Returns a collection of Edge objects (unmodifiable)- Returns:
- Set of Edge objects
-
shallowClone
Vertex shallowClone()
Shallow clone- Specified by:
shallowClonein interfaceGraphEntity- Specified by:
shallowClonein interfaceIdAble- Returns:
- the cloned entity
-
deepClone
Vertex deepClone()
Deep clone- Specified by:
deepClonein interfaceGraphEntity- Specified by:
deepClonein interfaceIdAble- Returns:
- the cloned entity
-
getIdClass
default Class<? extends Vertex> getIdClass()
All vertices use the VERTEX_ID_CLASS to generate the unique internal ids- Specified by:
getIdClassin interfaceManagedId- Returns:
- idClass to use for generating ids for instances of this idable derived class
-
hasPosition
default boolean hasPosition()
Verify if position is available- Returns:
- true when available, false otherwise
-
removeEdge
default boolean removeEdge(Edge edge)
Remove edge- Parameters:
edge- Edge to be removed- Returns:
- true when removed, false when not present (and not removed)
-
removeEdges
default void removeEdges(Collection<? extends Edge> toBeRemoved)
Remove provided edges- Parameters:
toBeRemoved- to remove
-
removeAllEdges
void removeAllEdges()
Remove al edges from vertex
-
getEdges
default Set<? extends Edge> getEdges(Vertex otherVertex)
Collect the edge(s) based on the other vertex- Parameters:
otherVertex- that defines the edge(s)- Returns:
- edges for which this holds, if none hold an empty set is returned
-
getNumberOfEdges
default int getNumberOfEdges()
Number of entries in edge segments- Returns:
- the number of edges connected to this vertex
-
replace
default boolean replace(Edge edgeToReplace, Edge edgeToReplaceWith, boolean forceInsert)
replace one edge with the other- Parameters:
edgeToReplace- one to replaceedgeToReplaceWith- one to replace it withforceInsert- when true the replacement will be added even if original cannot be found, when false not- Returns:
- successful replacement/insert when true, false otherwise
-
transformPosition
default void transformPosition(org.opengis.referencing.operation.MathTransform transformer) throws org.opengis.geometry.MismatchedDimensionException, org.opengis.referencing.operation.TransformExceptiontransform the position information of this vertex using the passed in MathTransform- Parameters:
transformer- to apply- Throws:
org.opengis.geometry.MismatchedDimensionException- thrown if errororg.opengis.referencing.operation.TransformException- thrown if error
-
isPositionEqual2D
default boolean isPositionEqual2D(org.locationtech.jts.geom.Coordinate coordinate)
Verify if the vertex position is exactly equal (in 2D) to the passed in coordinate- Parameters:
coordinate- to check against- Returns:
- true when equal location in 2D, false otherwise
-
isPositionEqual2D
default boolean isPositionEqual2D(org.locationtech.jts.geom.Coordinate coordinate, double epsilon)Verify if the vertex position is exactly equal (in 2D) to the passed in coordinate- Parameters:
coordinate- to check againstepsilon- allowed difference to still be regarded equal- Returns:
- true when equal location in 2D, false otherwise
-
validate
default boolean validate()
Validate the vertex regarding it connections to edges etc.- Returns:
- true when valid, false otherwise
-
-