26 #include <boost/geometry/io/wkt/write.hpp>
37 typename std::enable_if<!std::numeric_limits<T>::is_integer,
bool>::type
41 return std::abs(x-y) <= std::numeric_limits<T>::epsilon() * std::abs(x+y) * ulp
43 || std::abs(x-y) < std::numeric_limits<T>::min();
52 log << v.
id <<
"-" << bg::wkt(v.
point);
58 if (&rhs ==
this)
return true;
59 return this->
id == rhs.
id &&
66 std::vector < XY_vertex > vertices) {
67 auto count(vertices.size());
69 vertices.begin(), vertices.end(),
71 {return lhs.id < rhs.id;});
74 vertices.begin(), vertices.end(),
76 {return lhs.id == rhs.id;}), vertices.end());
78 return count - vertices.size();
81 std::vector < XY_vertex >
83 const std::vector <Pgr_edge_xy_t > &data_edges) {
85 std::vector< XY_vertex > vertices;
86 if (data_edges.empty())
return vertices;
88 vertices.reserve(data_edges.size() * 2);
90 for (
const auto &
edge : data_edges) {
92 vertices.push_back(v_source);
95 vertices.push_back(v_target);
102 vertices.begin(), vertices.end(),
104 {return lhs.id < rhs.id;});
107 vertices.begin(), vertices.end(),
109 {return lhs.id == rhs.id;}), vertices.end());
113 std::vector < XY_vertex >
117 std::vector < Pgr_edge_xy_t >(data_edges, data_edges + count));
123 std::vector < XY_vertex > vertices,
124 const std::vector < Pgr_edge_xy_t > data_edges) {
125 if (data_edges.empty())
return vertices;
127 vertices.reserve(vertices.size() + data_edges.size() * 2);
129 for (
const auto edge : data_edges) {
137 std::stable_sort(vertices.begin(), vertices.end(),
138 [](
const XY_vertex &lhs,
const XY_vertex &rhs)
139 {return lhs.id < rhs.id;});
142 std::unique(vertices.begin(), vertices.end(),
143 [](
const XY_vertex &lhs,
const XY_vertex &rhs)
144 {return lhs.id == rhs.id;}), vertices.end());
148 std::vector < XY_vertex > vertices,
151 std::vector < Pgr_edge_xy_t >(data_edges, data_edges + count));