PGROUTING  3.2
pgr_withPoints.hpp
Go to the documentation of this file.
1 /*PGR-GNU*****************************************************************
2 File: withPoints.hpp
3 
4 Copyright (c) 2015 pgRouting developers
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;
96  bool m_directed;
97 };
98 
99 } // namespace pgrouting
100 
101 #endif // INCLUDE_WITHPOINTS_PGR_WITHPOINTS_HPP_
pgrouting::Pgr_messages
Definition: pgr_messages.h:39
pgrouting::Pg_points_graph::m_o_points
std::vector< Point_on_edge_t > m_o_points
Definition: pgr_withPoints.hpp:92
pgrouting::Pg_points_graph::check_points
void check_points()
Definition: pgr_withPoints.cpp:112
Path
Definition: basePath_SSEC.hpp:47
pgrouting::Pg_points_graph::points
std::vector< Point_on_edge_t > points() const
Definition: pgr_withPoints.cpp:60
pgrouting::Pg_points_graph::edges_of_points
std::vector< pgr_edge_t > edges_of_points() const
Definition: pgr_withPoints.cpp:65
point_on_edge_t.h
pgrouting::Pg_points_graph::get_edge_data
const pgr_edge_t * get_edge_data(int64_t eid) const
Definition: pgr_withPoints.cpp:165
pgrouting::Pg_points_graph::reverse_sides
void reverse_sides()
Definition: pgr_withPoints.cpp:94
pgr_messages.h
pgr_edge_t
Definition: pgr_edge_t.h:37
pgrouting::Pg_points_graph
Definition: pgr_withPoints.hpp:40
pgrouting::Pg_points_graph::eliminate_details
Path eliminate_details(Path path) const
Definition: pgr_withPoints.cpp:229
pgrouting::Pg_points_graph::pointCompare::operator()
bool operator()(const Point_on_edge_t &lhs, const Point_on_edge_t &rhs) const
Definition: pgr_withPoints.hpp:42
pgrouting::Pg_points_graph::m_points
std::vector< Point_on_edge_t > m_points
Definition: pgr_withPoints.hpp:91
pgrouting::Pg_points_graph::adjust_pids
void adjust_pids(const std::vector< Point_on_edge_t > &points, Path &path)
Definition: pgr_withPoints.cpp:293
pgrouting::Pg_points_graph::Pg_points_graph
Pg_points_graph()=delete
pgrouting::Pg_points_graph::get_edge_id
int64_t get_edge_id(int64_t pid) const
Definition: pgr_withPoints.cpp:154
pgrouting::Pg_points_graph::new_edges
std::vector< pgr_edge_t > new_edges() const
Definition: pgr_withPoints.cpp:323
pgrouting::Pg_points_graph::m_directed
bool m_directed
Definition: pgr_withPoints.hpp:96
pgrouting::Pg_points_graph::m_driving_side
char m_driving_side
Definition: pgr_withPoints.hpp:95
pgrouting::Pg_points_graph::m_edges_of_points
std::vector< pgr_edge_t > m_edges_of_points
Definition: pgr_withPoints.hpp:93
Point_on_edge_t::pid
int64_t pid
Definition: point_on_edge_t.h:38
Point_on_edge_t
Definition: point_on_edge_t.h:37
Point_on_edge_t::fraction
double fraction
Definition: point_on_edge_t.h:41
pgrouting::Pg_points_graph::driving_side
char driving_side() const
Definition: pgr_withPoints.hpp:61
pgrouting::Pg_points_graph::m_new_edges
std::vector< pgr_edge_t > m_new_edges
Definition: pgr_withPoints.hpp:94
pgrouting::Pg_points_graph::create_new_edges
void create_new_edges()
Definition: pgr_withPoints.cpp:328
pgrouting::Pg_points_graph::pointCompare
Definition: pgr_withPoints.hpp:41
pgrouting
Book keeping class for swapping orders between vehicles.
Definition: pgr_alphaShape.cpp:56
pgrouting::Pg_points_graph::eliminate_details_dd
void eliminate_details_dd(Path &path) const
Definition: pgr_withPoints.cpp:176
basePath_SSEC.hpp
pgrouting::Pg_points_graph::operator<<
friend std::ostream & operator<<(std::ostream &os, const Pg_points_graph &g)
Definition: pgr_withPoints.cpp:46