PGROUTING  3.1
pgrouting::XY_vertex Class Reference

#include "xy_vertex.h"

Public Member Functions

 XY_vertex ()=default
 
 XY_vertex (const XY_vertex &)=default
 
 XY_vertex (const int64_t _id, double _x, double _y)
 
 XY_vertex (const Pgr_edge_xy_t &other, bool is_source)
 
void cp_members (const XY_vertex &other)
 
bool operator== (const XY_vertex &rhs) const
 
double x () const
 
double y () const
 

Public Attributes

int64_t id
 
Bpoint point
 

Friends

std::ostream & operator<< (std::ostream &log, const XY_vertex &v)
 

Detailed Description

Definition at line 40 of file xy_vertex.h.

Constructor & Destructor Documentation

◆ XY_vertex() [1/4]

pgrouting::XY_vertex::XY_vertex ( )
default

◆ XY_vertex() [2/4]

pgrouting::XY_vertex::XY_vertex ( const XY_vertex )
default

◆ XY_vertex() [3/4]

pgrouting::XY_vertex::XY_vertex ( const int64_t  _id,
double  _x,
double  _y 
)
inline

Definition at line 44 of file xy_vertex.h.

44  :
45  id(_id), point(_x, _y) {
46  }

◆ XY_vertex() [4/4]

pgrouting::XY_vertex::XY_vertex ( const Pgr_edge_xy_t other,
bool  is_source 
)
inline

Definition at line 48 of file xy_vertex.h.

48  :
49  id(is_source? other.source : other.target),
50  point(is_source? Bpoint(other.x1, other.y1) : Bpoint(other.x2, other.y2))
51  {}
int64_t target
Definition: pgr_edge_xy_t.h:41
int64_t source
Definition: pgr_edge_xy_t.h:40
bg::model::d2::point_xy< double > Bpoint
Definition: bline.hpp:48

Member Function Documentation

◆ cp_members()

void pgrouting::XY_vertex::cp_members ( const XY_vertex other)
inline

Definition at line 57 of file xy_vertex.h.

References id, operator<<, operator==(), and point.

57  {
58  this->id = other.id;
59  this->point = other.point;
60  }

◆ operator==()

bool pgrouting::XY_vertex::operator== ( const XY_vertex rhs) const

Definition at line 61 of file xy_vertex.cpp.

References anonymous_namespace{xy_vertex.cpp}::almost_equal(), id, and point.

Referenced by cp_members().

61  {
62  if (&rhs == this) return true;
63  return this->id == rhs.id &&
64  almost_equal(point.x(), rhs.point.x(), 2) && almost_equal(point.y(), rhs.point.y(), 2);
65 }
std::enable_if<!std::numeric_limits< T >::is_integer, bool >::type almost_equal(T x, T y, int ulp)
Definition: xy_vertex.cpp:42

◆ x()

double pgrouting::XY_vertex::x ( ) const
inline

Definition at line 54 of file xy_vertex.h.

References point.

54 {return point.x();}

◆ y()

double pgrouting::XY_vertex::y ( ) const
inline

Definition at line 55 of file xy_vertex.h.

References point.

55 {return point.y();}

Friends And Related Function Documentation

◆ operator<<

std::ostream& operator<< ( std::ostream &  log,
const XY_vertex v 
)
friend

Definition at line 55 of file xy_vertex.cpp.

Referenced by cp_members().

55  {
56  log << v.id << "-" << bg::wkt(v.point);
57  return log;
58 }

Member Data Documentation

◆ id

int64_t pgrouting::XY_vertex::id

◆ point

Bpoint pgrouting::XY_vertex::point

Definition at line 67 of file xy_vertex.h.

Referenced by cp_members(), pgrouting::operator<<(), operator==(), x(), and y().


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