Routify Documentation
Loading...
Searching...
No Matches
ch.routify.graph.CustomVertex Class Reference

Public Member Functions

 CustomVertex (double latitude, double longitude, Long osmId)
 
void loadMetaData ()
 
void setAltitude (double altitude)
 
String toString ()
 
double[] toLineStringArray ()
 
double[] toLonLatArray ()
 
Long getOsmId ()
 
double getLon ()
 
double getLat ()
 
double getAltitude ()
 
double getNoise ()
 
boolean equals (Object compareTo)
 
int hashCode ()
 
long computeId ()
 
double getPm10 ()
 
void setPm10 (double pm10)
 
long getId ()
 

Static Public Member Functions

static CustomVertex getByNodeId (long nodeId)
 
static double distance (CustomVertex from, CustomVertex to)
 

Detailed Description

Represents a custom vertex in a graph, uniquely identified by a UUID and an OpenStreetMap ID (osmId). Each vertex is characterized by geographical coordinates (latitude, longitude) and optionally altitude and noise level. This class supports determining if a vertex represents a tunnel or a bridge and includes utility methods for geographical calculations.

The primary coordinate system used is EPSG:4326 (WGS 84).

Author
Alexander Eggerth
Version
1.0
Since
2025-02-05 (distance calculation switched from the spherical law of cosines to the Haversine formula by Sachit Mahajan)

Constructor & Destructor Documentation

◆ CustomVertex()

ch.routify.graph.CustomVertex.CustomVertex ( double latitude,
double longitude,
Long osmId )
inline

Constructs a CustomVertex with specified geographical coordinates, tunnel and bridge status, and an OpenStreetMap ID. Altitude and noise level are retrieved from the Routify system if available; otherwise, they are initialized to sentinel values.

Parameters
latitudeThe latitude of the vertex in decimal degrees.
longitudeThe longitude of the vertex in decimal degrees.
osmIdThe OpenStreetMap ID associated with the vertex.

Member Function Documentation

◆ computeId()

long ch.routify.graph.CustomVertex.computeId ( )
inline

Computes a deterministic id using the full range of a long value. This provides maximum uniqueness and distribution for the coordinates and OSM ID.

Returns
An id using the full 64-bit range.

◆ distance()

static double ch.routify.graph.CustomVertex.distance ( CustomVertex from,
CustomVertex to )
inlinestatic

Calculates the distance in meters between two CustomVertex instances using the Haversine formula. This method considers the earth's curvature and is appropriate for short distances.

Parameters
fromThe starting CustomVertex.
toThe ending CustomVertex.
Returns
The distance between the two vertices in meters.

◆ equals()

boolean ch.routify.graph.CustomVertex.equals ( Object compareTo)
inline

Compares this CustomVertex with another object for equality, based on latitude and longitude.

Parameters
compareToThe object to compare with.
Returns
true if the specified object is a CustomVertex with the same latitude and longitude.

◆ getAltitude()

double ch.routify.graph.CustomVertex.getAltitude ( )
inline

◆ getByNodeId()

static CustomVertex ch.routify.graph.CustomVertex.getByNodeId ( long nodeId)
inlinestatic

◆ getId()

long ch.routify.graph.CustomVertex.getId ( )
inline

◆ getLat()

double ch.routify.graph.CustomVertex.getLat ( )
inline

◆ getLon()

double ch.routify.graph.CustomVertex.getLon ( )
inline

◆ getNoise()

double ch.routify.graph.CustomVertex.getNoise ( )
inline

◆ getOsmId()

Long ch.routify.graph.CustomVertex.getOsmId ( )
inline

◆ getPm10()

double ch.routify.graph.CustomVertex.getPm10 ( )
inline

◆ hashCode()

int ch.routify.graph.CustomVertex.hashCode ( )
inline

Generates a strong hash code for this CustomVertex based on its coordinates and OSM ID. Uses a combination of bit manipulation and prime number multiplication for better distribution.

Returns
A hash code value for this object.

◆ loadMetaData()

void ch.routify.graph.CustomVertex.loadMetaData ( )
inline

◆ setAltitude()

void ch.routify.graph.CustomVertex.setAltitude ( double altitude)
inline

◆ setPm10()

void ch.routify.graph.CustomVertex.setPm10 ( double pm10)
inline

◆ toLineStringArray()

double[] ch.routify.graph.CustomVertex.toLineStringArray ( )
inline

Converts the CustomVertex to a double array containing the latitude and longitude. This format is compatible with the "coordinates" array in a GeoJSON "LineString" object.

Returns
An array of doubles [latitude, longitude] in EPSG:4326 format.

◆ toLonLatArray()

double[] ch.routify.graph.CustomVertex.toLonLatArray ( )
inline

Converts the CustomVertex to a double array containing the longitude and latitude. This format is often used in geographic systems, where the order is [longitude, latitude]. It is compatible with coordinate formats used by many map APIs and geographic data systems.

Returns
An array of doubles [longitude, latitude] in EPSG:4326 format.

◆ toString()

String ch.routify.graph.CustomVertex.toString ( )
inline

Returns a string representation of the vertex in the format "(latitude,longitude)".

Returns
A string representing the vertex coordinates.

The documentation for this class was generated from the following file: