pgRouting
pgRouting extends the PostGIS / PostgreSQL geospatial database to provide geospatial routing functionality.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
ch_edge.cpp
Go to the documentation of this file.
1 /*PGR-GNU*****************************************************************
2 File: ch_edge.cpp
3 
4 Generated with Template by:
5 Copyright (c) 2015 pgRouting developers
6 Mail: project@pgrouting.org
7 
8 Function's developer:
9 Copyright (c) 2016 Rohith Reddy
10 Mail:
11 
12 ------
13 
14 This program is free software; you can redistribute it and/or modify
15 it under the terms of the GNU General Public License as published by
16 the Free Software Foundation; either version 2 of the License, or
17 (at your option) any later version.
18 
19 This program is distributed in the hope that it will be useful,
20 but WITHOUT ANY WARRANTY; without even the implied warranty of
21 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 GNU General Public License for more details.
23 
24 You should have received a copy of the GNU General Public License
25 along with this program; if not, write to the Free Software
26 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
27 
28  ********************************************************************PGR-GNU*/
29 
30 #include "./ch_edge.h"
31 namespace pgrouting {
32 namespace contraction {
33 
34 void Edge::cp_members(const Edge &other, std::ostringstream& log) {
35  log << "Copying members of edge\n";
36  log << other;
37  #if 0
38  this->cost = other.cost;
39  log << "after copying cost of edge\n";
40  log << *this;
41  this->first = other.first;
42  log << "after copying first of edge\n";
43  log << *this;
44  this->source = other.source;
45  log << "after copying source of edge\n";
46  log << *this;
47  this->target = other.target;
48  log << "after copying target of edge\n";
49  log << *this;
50  this->m_contracted_vertices += other.contracted_vertices();
51  log << "after adding contracted vertices\n";
52  log << *this;
53  #endif
54  this->cost = other.cost;
55  this->id = other.id;
56  this->first = other.first;
57  this->source = other.source;
58  this->target = other.target;
59  this->m_contracted_vertices += other.contracted_vertices();
60  #if 0
61  log << "copying eid: " << other.id << "\n";
62  this->id = other.id;
63  // log << "after copying id of edge\n";
64  log << *this;
65  #endif
66  }
67 
68 
69 void Edge::cp_members(const Edge &other) {
70 
71  this->cost = other.cost;
72  this->id = other.id;
73  this->first = other.first;
74  this->source = other.source;
75  this->target = other.target;
77  }
78 
79 void Edge::cp_members(const Basic_edge &other) {
80  this->id = other.id;
81  this->cost = other.cost;
82  this->first = other.first;
83  }
85  if (m_contracted_vertices.size() == 0)
86  return false;
87  return true;
88 }
89 
91  return m_contracted_vertices;
92 }
93 
94 
95 void Edge::add_contracted_vertex(Vertex& v, int64_t vid) {
96  // adding the id(boost graph) of the contracted vertex v
97  m_contracted_vertices += vid;
98  // adding the ids of the contracted vertices of the given vertex v
100  // empty the contracted vertices of the given vertex v
102 }
103 
105  // adding the ids of the contracted vertices of the given edge e
107  // empty the contracted vertices of the given edge e
109 }
110 
111 std::ostream& operator <<(std::ostream& os, const Edge& e) {
112  os << "{\n id: " << e.id << ",\n";
113  os << " source: " << e.source << ",\n";
114  os << " target: " << e.target << ",\n";
115  os << " cost: " << e.cost << ",\n";
116  os << " first: " << e.first << ",\n";
117  os << " contracted vertices: ";
118  os << e.contracted_vertices();
119  os << "\n}";
120  os << "\n";
121  return os;
122 }
123 } // namespace contraction
124 } // namespace pgrouting
void add_contracted_edge_vertices(Edge &e)
Definition: ch_edge.cpp:104
std::ostream & operator<<(std::ostream &os, const Edge &e)
Definition: ch_edge.cpp:111
const Identifiers< int64_t > & contracted_vertices() const
Definition: ch_vertex.cpp:37
void add_contracted_vertex(Vertex &v, int64_t vid)
Definition: ch_edge.cpp:95
void cp_members(const Edge &other, std::ostringstream &log)
Definition: ch_edge.cpp:34
Identifiers< int64_t > m_contracted_vertices
Definition: ch_edge.h:69
size_t size() const
Definition: identifiers.hpp:49
const Identifiers< int64_t > & contracted_vertices() const
Definition: ch_edge.cpp:90
bool has_contracted_vertices() const
Definition: ch_edge.cpp:84