Package org.goplanit.utils.graph
Interface Vertex
-
- All Superinterfaces:
Cloneable
,Comparable<IdAble>
,ExternalIdAble
,GraphEntity
,IdAble
,ManagedId
,Serializable
- All Known Subinterfaces:
Centroid
,DirectedVertex
,Node
,ServiceNode
- All Known Implementing Classes:
CentroidImpl
,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 Logger
LOGGER
vertex loggerstatic Class<Vertex>
VERTEX_ID_CLASS
id class for generating ids
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description 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.void
addInputProperty(String key, Object value)
Add a property from the original input that is not part of the readily available membersVertex
clone()
Clone the vertexCollection<Edge>
getEdges()
Returns a collection of Edge objects (unmodifiable)default Set<Edge>
getEdges(Vertex otherVertex)
Collect the edge(s) based on the other vertexdefault Class<Vertex>
getIdClass()
All vertices use the VERTEX_ID_CLASS to generate the unique internal idsObject
getInputProperty(String key)
collect a propertydefault int
getNumberOfEdges()
Number of entries in edge segmentsorg.locationtech.jts.geom.Point
getPosition()
Collect the geometry of the point location of this vertexdefault boolean
hasPosition()
Verify if position is availabledefault boolean
isPositionEqual2D(org.locationtech.jts.geom.Coordinate coordinate)
Verify if the vertex position is equal (in 2D) to the passed in coordinateboolean
removeEdge(long edgeId)
Remove edgedefault boolean
removeEdge(Edge edge)
Remove edgedefault boolean
replace(Edge edgeToReplace, Edge edgeToReplaceWith, boolean forceInsert)
replace one edge with the othervoid
setPosition(org.locationtech.jts.geom.Point position)
Set the center point geometry for a vertexdefault void
transformPosition(org.opengis.referencing.operation.MathTransform transformer)
transform the position information of this vertex using the passed in MathTransformdefault boolean
validate()
Validate the vertex regarding it connections to edges etc.-
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
-
-
-
-
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)
-
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<Edge> getEdges()
Returns a collection of Edge objects (unmodifiable)- Returns:
- Set of Edge objects
-
clone
Vertex clone()
Clone the vertex
-
getIdClass
default Class<Vertex> getIdClass()
All vertices use the VERTEX_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
-
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)
-
getEdges
default Set<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.TransformException
transform 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 equal (in 2D) to the passed in coordinate- Parameters:
coordinate
- to check against- 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
-
-