PGROUTING  3.2
xy_vertex.h
Go to the documentation of this file.
1 /*PGR-GNU*****************************************************************
2  *
3 
4  Copyright (c) 2015 Celia Virginia Vergara Castillo
6 
7  ------
8 
9 This program is free software; you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation; either version 2 of the License, or
12 (at your option) any later version.
13 
14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
18 
19 You should have received a copy of the GNU General Public License
20 along with this program; if not, write to the Free Software
21 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
22 
23  ********************************************************************PGR-GNU*/
24 
27 #ifndef INCLUDE_CPP_COMMON_XY_VERTEX_H_
28 #define INCLUDE_CPP_COMMON_XY_VERTEX_H_
29 #pragma once
30 
31 
32 #include <vector>
33 
34 #include "cpp_common/bpoint.hpp"
35 #include "c_types/pgr_edge_xy_t.h"
36 
37 
38 namespace pgrouting {
39 
40 class XY_vertex {
41  public:
42  XY_vertex() = default;
43  XY_vertex(const XY_vertex &) = default;
44  XY_vertex(const int64_t _id, double _x, double _y) :
45  id(_id), point(_x, _y) {
46  }
47 
48  XY_vertex(const Pgr_edge_xy_t &other, bool is_source) :
49  id(is_source? other.source : other.target),
50  point(is_source? Bpoint(other.x1, other.y1) : Bpoint(other.x2, other.y2))
51  {}
52 
53 
54  double x() const {return point.x();}
55  double y() const {return point.y();}
56 
57  inline void cp_members(const XY_vertex &other) {
58  this->id = other.id;
59  this->point = other.point;
60  }
61 
62  friend std::ostream& operator<<(std::ostream& log, const XY_vertex &v);
63  bool operator==(const XY_vertex &rhs) const;
64 
65  public:
66  int64_t id;
68 };
69 
70 size_t
71 check_vertices(std::vector < XY_vertex > vertices);
72 
73 std::vector < XY_vertex >
75  const Pgr_edge_xy_t *data_edges, size_t count);
76 
77 std::vector < XY_vertex >
79  const std::vector < Pgr_edge_xy_t > &data_edges);
80 
81 #if 0
82 std::vector < XY_vertex > extract_vertices(
83  std::vector < XY_vertex > vertices,
84  const Pgr_edge_xy_t *data_edges, int64_t count);
85 
86 std::vector < XY_vertex > extract_vertices(
87  std::vector < XY_vertex > vertices,
88  const std::vector < Pgr_edge_xy_t > data_edges);
89 #endif
90 
91 } // namespace pgrouting
92 
93 #endif // INCLUDE_CPP_COMMON_XY_VERTEX_H_
pgrouting::XY_vertex
Definition: xy_vertex.h:40
pgrouting::XY_vertex::id
int64_t id
Definition: xy_vertex.h:66
pgrouting::Bpoint
bg::model::d2::point_xy< double > Bpoint
Definition: bline.hpp:40
pgrouting::XY_vertex::x
double x() const
Definition: xy_vertex.h:54
pgrouting::check_vertices
size_t check_vertices(std::vector< Basic_vertex > vertices)
Definition: basic_vertex.cpp:42
pgr_edge_xy_t.h
pgrouting::XY_vertex::operator==
bool operator==(const XY_vertex &rhs) const
Definition: xy_vertex.cpp:57
pgrouting::XY_vertex::point
Bpoint point
Definition: xy_vertex.h:67
pgrouting::XY_vertex::XY_vertex
XY_vertex(const Pgr_edge_xy_t &other, bool is_source)
Definition: xy_vertex.h:48
pgrouting::XY_vertex::XY_vertex
XY_vertex()=default
bpoint.hpp
pgrouting::XY_vertex::operator<<
friend std::ostream & operator<<(std::ostream &log, const XY_vertex &v)
Definition: xy_vertex.cpp:51
pgrouting::XY_vertex::XY_vertex
XY_vertex(const int64_t _id, double _x, double _y)
Definition: xy_vertex.h:44
pgrouting::XY_vertex::y
double y() const
Definition: xy_vertex.h:55
pgrouting::XY_vertex::cp_members
void cp_members(const XY_vertex &other)
Definition: xy_vertex.h:57
pgrouting::extract_vertices
std::vector< Basic_vertex > extract_vertices(std::vector< Basic_vertex > vertices, const std::vector< pgr_edge_t > data_edges)
Definition: basic_vertex.cpp:59
Pgr_edge_xy_t
Definition: pgr_edge_xy_t.h:38
pgrouting
Book keeping class for swapping orders between vehicles.
Definition: pgr_alphaShape.cpp:56