PGROUTING  2.6
pgr_withPoints.hpp
Go to the documentation of this file.
1 /*PGR-GNU*****************************************************************
2 File: withPoints.hpp
3 
4 Copyright (c) 2015 pgRouting developers
5 Mail: project@pgrouting.org
6 
7 Function's developer:
8 Copyright (c) 2015 Celia Virginia Vergara Castillo
9 Mail:
10 
11 ------
12 
13 This program is free software; you can redistribute it and/or modify
14 it under the terms of the GNU General Public License as published by
15 the Free Software Foundation; either version 2 of the License, or
16 (at your option) any later version.
17 
18 This program is distributed in the hope that it will be useful,
19 but WITHOUT ANY WARRANTY; without even the implied warranty of
20 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 GNU General Public License for more details.
22 
23 You should have received a copy of the GNU General Public License
24 along with this program; if not, write to the Free Software
25 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
26 
27 ********************************************************************PGR-GNU*/
28 
29 #ifndef INCLUDE_WITHPOINTS_PGR_WITHPOINTS_HPP_
30 #define INCLUDE_WITHPOINTS_PGR_WITHPOINTS_HPP_
31 #pragma once
32 #include <vector>
33 
37 
38 namespace pgrouting {
39 
40 class Pg_points_graph : public Pgr_messages {
41  struct pointCompare {
43  const Point_on_edge_t& lhs,
44  const Point_on_edge_t& rhs) const
45  {return lhs.fraction < rhs.fraction? true : lhs.pid < rhs.pid;}
46  };
47 
48  public:
49  Pg_points_graph() = delete;
50  Pg_points_graph(const Pg_points_graph &) = delete;
52  std::vector<Point_on_edge_t> p_points,
53  std::vector<pgr_edge_t> p_edges_to_modify,
54  bool p_normal,
55  char p_driving_side,
56  bool p_directed);
57 
58  std::vector<Point_on_edge_t> points() const;
59  std::vector<pgr_edge_t> edges_of_points() const;
60  std::vector<pgr_edge_t> new_edges() const;
61  inline char driving_side() const {return m_driving_side;}
62 
63 
65  Path path) const;
66 
68  Path &path) const;
69 
70  void adjust_pids(
71  const std::vector< Point_on_edge_t > &points,
72  Path &path);
73 
74  friend std::ostream& operator<<(
75  std::ostream &os, const Pg_points_graph &g);
76 
77  private:
78  void adjust_pids(
79  const std::vector< Point_on_edge_t > &points,
80  const int64_t &start_pid,
81  const int64_t &end_pid,
82  Path &path);
83 
84  void create_new_edges();
85  void check_points();
86  void reverse_sides();
87  int64_t get_edge_id(int64_t pid) const;
88  const pgr_edge_t* get_edge_data(int64_t eid) const;
89 
90  private:
91  std::vector<Point_on_edge_t> m_points;
92  std::vector<Point_on_edge_t> m_o_points;
93  std::vector<pgr_edge_t> m_edges_of_points;
94  std::vector<pgr_edge_t> m_new_edges;
95  bool m_normal;
97  bool m_directed;
98 };
99 
100 } // namespace pgrouting
101 
102 #endif // INCLUDE_WITHPOINTS_PGR_WITHPOINTS_HPP_
std::vector< Point_on_edge_t > m_points
std::vector< pgr_edge_t > m_edges_of_points
int64_t get_edge_id(int64_t pid) const
bool operator()(const Point_on_edge_t &lhs, const Point_on_edge_t &rhs) const
friend std::ostream & operator<<(std::ostream &os, const Pg_points_graph &g)
Path eliminate_details(Path path) const
std::vector< pgr_edge_t > edges_of_points() const
std::vector< Point_on_edge_t > m_o_points
std::vector< pgr_edge_t > m_new_edges
std::vector< pgr_edge_t > new_edges() const
void eliminate_details_dd(Path &path) const
Book keeping class for swapping orders between vehicles.
Definition: basic_edge.cpp:28
const pgr_edge_t * get_edge_data(int64_t eid) const
std::vector< Point_on_edge_t > points() const
void adjust_pids(const std::vector< Point_on_edge_t > &points, Path &path)