Commit 4e0e9413 authored by Bas Couwenberg's avatar Bas Couwenberg

Imported Upstream version 2.2.1

parent b0220e9e
......@@ -31,7 +31,7 @@ SET(POSTGRESQL_BIN "" CACHE STRING "Define optional path to PostgreSQL binaries
# PGROUTING version number.
set(PGROUTING_VERSION_MAJOR "2")
set(PGROUTING_VERSION_MINOR "2")
set(PGROUTING_VERSION_PATCH "0")
set(PGROUTING_VERSION_PATCH "1")
set(PGROUTING_VERSION_STRING "${PGROUTING_VERSION_MAJOR}.${PGROUTING_VERSION_MINOR}.${PGROUTING_VERSION_PATCH}")
set(PGROUTING_VERSION "${PGROUTING_VERSION_MAJOR}.${PGROUTING_VERSION_MINOR}")
......@@ -41,7 +41,7 @@ set(POSTGIS_MINIMUM_VERSION "2.0.0")
file(STRINGS "${PGROUTING_SOURCE_DIR}/VERSION" PGROUTING_BUILD_STRING)
set(PGROUTING_GIT_TAG "pgrouting-2.2.0")
set(PGROUTING_GIT_TAG "pgrouting-2.2.1")
#string(REGEX REPLACE "^(.+)-([0-9]+)-g([0-9a-f]+) (.*)$" "\\1" PGROUTING_GIT_TAG ${PGROUTING_BUILD_STRING})
string(REGEX REPLACE "^(.+)-([^-]+)-[0-9]+-g([0-9a-f]+) (.*)$" "\\2" PGROUTING_GIT_BUILD ${PGROUTING_BUILD_STRING})
string(REGEX REPLACE "^(.+)-([0-9]+)-g([0-9a-f]+) (.*)$" "\\3" PGROUTING_GIT_HASH ${PGROUTING_BUILD_STRING})
......
pgrouting-2.2.0-RC1-13-gafc622e master
pgrouting-v2.2.1-12-g91c70b8 master
......@@ -115,7 +115,7 @@ html_theme_path = ['@SPHINX_THEME_DIR@']
# The name for this set of Sphinx documents. If None, it defaults to
# "<project> v<release> documentation".
html_title = "pgRouting Manual (@PGROUTING_VERSION_STRING@)"
html_title = "pgRouting Manual (@PGROUTING_VERSION@)"
# A shorter title for the navigation bar. Default is the same as html_title.
#html_short_title = None
......
......@@ -121,9 +121,9 @@ When the columns required have the default names this can be used (pgr_func is t
.. code-block:: sql
pgr_func('edge_table') -- when tolerance is not requiered
pgr_func('edge_table',0.001) -- when tolerance is requiered
-- s_in_rule, s_out_rule, st_in_rules, t_out_rules are requiered
pgr_func('edge_table') -- when tolerance is not required
pgr_func('edge_table',0.001) -- when tolerance is required
-- s_in_rule, s_out_rule, st_in_rules, t_out_rules are required
SELECT pgr_analyzeOneway('edge_table', ARRAY['', 'B', 'TF'], ARRAY['', 'B', 'FT'],
ARRAY['', 'B', 'FT'], ARRAY['', 'B', 'TF'])
......
......@@ -57,7 +57,7 @@ do_pgr_johnson(
std::ostringstream log;
try {
if (total_tuples == 1) {
log << "Requiered: more than one tuple\n";
log << "Required: more than one tuple\n";
(*return_tuples) = NULL;
(*return_count) = 0;
*err_msg = strdup(log.str().c_str());
......
......@@ -250,8 +250,9 @@ static int compute_alpha_shape(char* sql, float8 alpha, vertex_t **res, size_t *
// TODO: report this as a bug to the pgrouting project
// the CGAL alpha-shape function crashes if called with less than three points!!!
if (total_tuples == 0) {
elog(ERROR, "Distance is too short. no vertex for alpha shape calculation. alpha shape calculation needs at least 3 vertices.");
if (total_tuples < 3) {
elog(ERROR, "Less than 3 vertices. Alpha shape calculation needs at least 3 vertices.");
return finish(SPIcode, ret);
}
if (total_tuples == 1) {
elog(ERROR, "Distance is too short. only 1 vertex for alpha shape calculation. alpha shape calculation needs at least 3 vertices.");
......@@ -278,7 +279,7 @@ static int compute_alpha_shape(char* sql, float8 alpha, vertex_t **res, size_t *
if (ret < 0)
{
//elog(ERROR, "Error computing shape: %s", err_msg);
ereport(ERROR, (errcode(ERRCODE_E_R_E_CONTAINING_SQL_NOT_PERMITTED), errmsg("Error computing shape: %s", err_msg)));
ereport(ERROR, (errcode(ERRCODE_E_R_E_CONTAINING_SQL_NOT_PERMITTED), errmsg("%s", err_msg)));
}
return finish(SPIcode, ret);
......
......@@ -190,16 +190,32 @@ alpha_edges( const Alpha_shape_2& A,
int alpha_shape(vertex_t *vertices, size_t count, double alpha,
vertex_t **res, size_t *res_count, char **err_msg)
{
try {
std::list<Point> points;
//std::copy(begin(vertices), end(vertices), std::back_inserter(points));
for (std::size_t j = 0; j < count; ++j)
{
Point p(vertices[j].x, vertices[j].y);
points.push_back(p);
std::vector<Point> pv;
for (std::size_t j = 0; j < count; ++j) {
Point p(vertices[j].x, vertices[j].y);
pv.push_back(p);
}
std::sort(pv.begin(), pv.end(),
[](const Point &e1, const Point &e2)->bool {
return e2.y() < e1.y();
});
std::stable_sort(pv.begin(), pv.end(),
[](const Point &e1, const Point &e2)->bool {
return e2.x() < e1.x();
});
pv.erase(std::unique(pv.begin(), pv.end()), pv.end());
if (pv.size() != count && pv.size() < 3) {
*err_msg = strdup("After eliminating duplicated points, less than 3 points remain!!. Alpha shape calculation needs at least 3 vertices.");
return -1;
}
points.insert(points.begin(), pv.begin(), pv.end());
}
Alpha_shape_2 A(points.begin(), points.end(),
coord_type(10000),
......@@ -277,4 +293,9 @@ int alpha_shape(vertex_t *vertices, size_t count, double alpha,
*err_msg = NULL;
return EXIT_SUCCESS;
} catch ( ... ) {
*err_msg = strdup("Caught unknown expection!");
}
return -1;
}
\i setup.sql
SELECT plan(3);
--DROP TABLE nodes;
CREATE TABLE nodes (
id integer,
x float8,
y float8);
copy nodes(id,x,y) FROM stdin WITH DELIMITER '|';
156|351885.927|739332.781
156|351893|739579
156|352004.408|739375.19
126|352004.408|739375.19
125|352473|739498
126|352473|739498
150|352543|741610
161|352893.205|740082.415
160|352893.205|740082.415
280|352893.205|740082.415
146|352984.15|739941.023
160|352984.15|739941.023
125|352984.15|739941.023
150|353370|740397
151|353370|740397
146|353370|740397
151|353400|740376
154|353400.927|741347.893
251|353486.777|740517.047
154|353486.777|740517.047
151|353486.777|740517.047
251|353752.373|740768.525
\.
PREPARE q1 AS
SELECT * FROM pgr_alphaShape('select * from nodes where id = 161');
-- ERROR: Distance is too short. only 1 vertex for alpha shape calculation. alpha shape calculation needs at least 3 vertices.
PREPARE q2 AS
SELECT * FROM pgr_alphaShape('select * from nodes where id in (160,161)');
-- ERROR: Error computing shape: After eliminating duplicated points, less than 3 points remain!!
PREPARE q3 AS
SELECT * FROM pgr_alphaShape('select * from nodes');
SELECT throws_ok('q1',
'XX000', 'Less than 3 vertices. Alpha shape calculation needs at least 3 vertices.',
'SHOULD THROW, because there is only one point');
SELECT throws_ok('q2',
'38001','After eliminating duplicated points, less than 3 points remain!!. Alpha shape calculation needs at least 3 vertices.',
'SHOULD THROW, because there are less than 3 distinc points');
SELECT lives_ok('q3', 'SHOULD LIVE because ater eliminating duplicates there are enough points to work with');
-- Finish the tests and clean up.
SELECT * FROM finish();
ROLLBACK;
......@@ -38,7 +38,7 @@ pgr_send_error(int errcode) {
elog(ERROR, "Unexpected point(s) with same pid but different edge/fraction/side combination found.");
break;
case 2:
elog(ERROR, "Internal: Unexpected missmatch count and sequence number on results");
elog(ERROR, "Internal: Unexpected mismatch count and sequence number on results");
break;
default:
elog(ERROR, "Unknown exception");
......
......@@ -183,7 +183,7 @@ do_pgr_dijkstraViaVertex(
try {
if (total_tuples == 1) {
log << "Requiered: more than one tuple\n";
log << "Required: more than one tuple\n";
(*return_tuples) = NULL;
(*return_count) = 0;
*err_msg = strdup(log.str().c_str());
......
......@@ -140,7 +140,7 @@ do_pgr_driving_distance(
log << "Returning number of tuples" << path.size() << "\n";
if (path.empty()) {
log << "NOTICE: it shoud have at least the one for it self";
log << "NOTICE: it should have at least the one for it self";
*err_msg = strdup(log.str().c_str());
*ret_path = noResult(path_count, (*ret_path));
return;
......
......@@ -56,7 +56,7 @@ Step by Step processing
~~~~{.c}
git remote -v
~~~~
- Now you shoud have something like this:
- Now you should have something like this:
~~~~{.c}
origin https://github.com/acountName/pgrouting (fetch)
origin https://github.com/acountName/pgrouting (push)
......
......@@ -9,9 +9,9 @@ SELECT * FROM pgr_withPoints(
-----+----------+------+------+------+----------
1 | 1 | -1 | 1 | 0.6 | 0
2 | 2 | 2 | 4 | 1 | 0.6
3 | 3 | 5 | 7 | 1 | 1.6
4 | 4 | 8 | 6 | 0.7 | 2.6
5 | 5 | -3 | -1 | 0 | 3.3
3 | 3 | 5 | 10 | 1 | 1.6
4 | 4 | 10 | 12 | 0.6 | 2.6
5 | 5 | -3 | -1 | 0 | 3.2
(5 rows)
--e2
......@@ -41,9 +41,9 @@ SELECT * FROM pgr_withPoints(
-----+----------+---------+------+------+------+----------
1 | 1 | -3 | -1 | 1 | 0.6 | 0
2 | 2 | -3 | 2 | 4 | 1 | 0.6
3 | 3 | -3 | 5 | 7 | 1 | 1.6
4 | 4 | -3 | 8 | 6 | 0.7 | 2.6
5 | 5 | -3 | -3 | -1 | 0 | 3.3
3 | 3 | -3 | 5 | 10 | 1 | 1.6
4 | 4 | -3 | 10 | 12 | 0.6 | 2.6
5 | 5 | -3 | -3 | -1 | 0 | 3.2
6 | 1 | 5 | -1 | 1 | 0.6 | 0
7 | 2 | 5 | 2 | 4 | 1 | 0.6
8 | 3 | 5 | 5 | -1 | 0 | 1.6
......@@ -58,13 +58,13 @@ SELECT * FROM pgr_withPoints(
-----+----------+-----------+------+------+------+----------
1 | 1 | -1 | -1 | 1 | 0.6 | 0
2 | 2 | -1 | 2 | 4 | 1 | 0.6
3 | 3 | -1 | 5 | 7 | 1 | 1.6
4 | 4 | -1 | 8 | 6 | 0.7 | 2.6
5 | 5 | -1 | -3 | -1 | 0 | 3.3
3 | 3 | -1 | 5 | 10 | 1 | 1.6
4 | 4 | -1 | 10 | 12 | 0.6 | 2.6
5 | 5 | -1 | -3 | -1 | 0 | 3.2
6 | 1 | 2 | 2 | 4 | 1 | 0
7 | 2 | 2 | 5 | 7 | 1 | 1
8 | 3 | 2 | 8 | 6 | 0.7 | 2
9 | 4 | 2 | -3 | -1 | 0 | 2.7
7 | 2 | 2 | 5 | 10 | 1 | 1
8 | 3 | 2 | 10 | 12 | 0.6 | 2
9 | 4 | 2 | -3 | -1 | 0 | 2.6
(9 rows)
--e5
......@@ -76,18 +76,18 @@ SELECT * FROM pgr_withPoints(
-----+----------+-----------+---------+------+------+------+----------
1 | 1 | -1 | -3 | -1 | 1 | 0.6 | 0
2 | 2 | -1 | -3 | 2 | 4 | 1 | 0.6
3 | 3 | -1 | -3 | 5 | 7 | 1 | 1.6
4 | 4 | -1 | -3 | 8 | 6 | 0.7 | 2.6
5 | 5 | -1 | -3 | -3 | -1 | 0 | 3.3
3 | 3 | -1 | -3 | 5 | 10 | 1 | 1.6
4 | 4 | -1 | -3 | 10 | 12 | 0.6 | 2.6
5 | 5 | -1 | -3 | -3 | -1 | 0 | 3.2
6 | 1 | -1 | 7 | -1 | 1 | 0.6 | 0
7 | 2 | -1 | 7 | 2 | 4 | 1 | 0.6
8 | 3 | -1 | 7 | 5 | 7 | 1 | 1.6
9 | 4 | -1 | 7 | 8 | 6 | 1 | 2.6
10 | 5 | -1 | 7 | 7 | -1 | 0 | 3.6
11 | 1 | 2 | -3 | 2 | 4 | 1 | 0
12 | 2 | 2 | -3 | 5 | 7 | 1 | 1
13 | 3 | 2 | -3 | 8 | 6 | 0.7 | 2
14 | 4 | 2 | -3 | -3 | -1 | 0 | 2.7
12 | 2 | 2 | -3 | 5 | 10 | 1 | 1
13 | 3 | 2 | -3 | 10 | 12 | 0.6 | 2
14 | 4 | 2 | -3 | -3 | -1 | 0 | 2.6
15 | 1 | 2 | 7 | 2 | 4 | 1 | 0
16 | 2 | 2 | 7 | 5 | 7 | 1 | 1
17 | 3 | 2 | 7 | 8 | 6 | 1 | 2
......@@ -178,26 +178,26 @@ SELECT * FROM pgr_withPoints(
1 | 1 | -1 | -3 | -1 | 1 | 0.6 | 0
2 | 2 | -1 | -3 | 2 | 4 | 0.7 | 0.6
3 | 3 | -1 | -3 | -6 | 4 | 0.3 | 1.3
4 | 4 | -1 | -3 | 5 | 7 | 1 | 1.6
5 | 5 | -1 | -3 | 8 | 6 | 0.7 | 2.6
6 | 6 | -1 | -3 | -3 | -1 | 0 | 3.3
4 | 4 | -1 | -3 | 5 | 10 | 1 | 1.6
5 | 5 | -1 | -3 | 10 | 12 | 0.6 | 2.6
6 | 6 | -1 | -3 | -3 | -1 | 0 | 3.2
7 | 1 | -1 | 7 | -1 | 1 | 0.6 | 0
8 | 2 | -1 | 7 | 2 | 4 | 0.7 | 0.6
9 | 3 | -1 | 7 | -6 | 4 | 0.3 | 1.3
10 | 4 | -1 | 7 | 5 | 7 | 1 | 1.6
11 | 5 | -1 | 7 | 8 | 6 | 0.7 | 2.6
12 | 6 | -1 | 7 | -3 | 6 | 0.3 | 3.3
12 | 6 | -1 | 7 | -4 | 6 | 0.3 | 3.3
13 | 7 | -1 | 7 | 7 | -1 | 0 | 3.6
14 | 1 | 2 | -3 | 2 | 4 | 0.7 | 0
15 | 2 | 2 | -3 | -6 | 4 | 0.3 | 0.7
16 | 3 | 2 | -3 | 5 | 7 | 1 | 1
17 | 4 | 2 | -3 | 8 | 6 | 0.7 | 2
18 | 5 | 2 | -3 | -3 | -1 | 0 | 2.7
16 | 3 | 2 | -3 | 5 | 10 | 1 | 1
17 | 4 | 2 | -3 | 10 | 12 | 0.6 | 2
18 | 5 | 2 | -3 | -3 | -1 | 0 | 2.6
19 | 1 | 2 | 7 | 2 | 4 | 0.7 | 0
20 | 2 | 2 | 7 | -6 | 4 | 0.3 | 0.7
21 | 3 | 2 | 7 | 5 | 7 | 1 | 1
22 | 4 | 2 | 7 | 8 | 6 | 0.7 | 2
23 | 5 | 2 | 7 | -3 | 6 | 0.3 | 2.7
23 | 5 | 2 | 7 | -4 | 6 | 0.3 | 2.7
24 | 6 | 2 | 7 | 7 | -1 | 0 | 3
(24 rows)
......
......@@ -7,7 +7,7 @@ SELECT * FROM pgr_withPointsCost(
-1, -3);
start_pid | end_pid | agg_cost
-----------+---------+----------
-1 | -3 | 3.3
-1 | -3 | 3.2
(1 row)
--e2
......@@ -28,7 +28,7 @@ SELECT * FROM pgr_withPointsCost(
-1, ARRAY[-3,5]);
start_pid | end_pid | agg_cost
-----------+---------+----------
-1 | -3 | 3.3
-1 | -3 | 3.2
-1 | 5 | 1.6
(2 rows)
......@@ -39,8 +39,8 @@ SELECT * FROM pgr_withPointsCost(
ARRAY[-1,2], -3);
start_pid | end_pid | agg_cost
-----------+---------+----------
-1 | -3 | 3.3
2 | -3 | 2.7
-1 | -3 | 3.2
2 | -3 | 2.6
(2 rows)
--e5
......@@ -50,9 +50,9 @@ SELECT * FROM pgr_withPointsCost(
ARRAY[-1,2], ARRAY[-3,7]);
start_pid | end_pid | agg_cost
-----------+---------+----------
-1 | -3 | 3.3
-1 | -3 | 3.2
-1 | 7 | 3.6
2 | -3 | 2.7
2 | -3 | 2.6
2 | 7 | 3
(4 rows)
......@@ -64,9 +64,9 @@ SELECT * FROM pgr_withPointsCost(
driving_side := 'l');
start_pid | end_pid | agg_cost
-----------+---------+----------
-1 | -3 | 3.3
-1 | -3 | 3.2
-1 | 7 | 3.6
2 | -3 | 2.7
2 | -3 | 2.6
2 | 7 | 3
(4 rows)
......@@ -78,9 +78,9 @@ SELECT * FROM pgr_withPointsCost(
driving_side := 'r');
start_pid | end_pid | agg_cost
-----------+---------+----------
-1 | -3 | 4.7
-1 | -3 | 4
-1 | 7 | 4.4
2 | -3 | 3.3
2 | -3 | 2.6
2 | 7 | 3
(4 rows)
......@@ -92,9 +92,9 @@ SELECT * FROM pgr_withPointsCost(
driving_side := 'b');
start_pid | end_pid | agg_cost
-----------+---------+----------
-1 | -3 | 3.3
-1 | -3 | 3.2
-1 | 7 | 3.6
2 | -3 | 2.7
2 | -3 | 2.6
2 | 7 | 3
(4 rows)
......
......@@ -56,8 +56,8 @@ SELECT * FROM pgr_withPointsDD(
6 | 6 | 8 | 1 | 2.6
7 | 8 | 7 | 1 | 2.6
8 | 10 | 10 | 1 | 2.6
9 | -5 | 12 | 0.6 | 3.2
10 | -3 | 6 | 0.7 | 3.3
9 | -3 | 12 | 0.6 | 3.2
10 | -4 | 6 | 0.7 | 3.3
11 | 7 | 6 | 0.3 | 3.6
12 | 9 | 9 | 1 | 3.6
13 | 11 | 11 | 1 | 3.6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 5.2
(13 rows)
--q2
SELECT * FROM pgr_withPointsKSP(
......@@ -44,10 +39,10 @@ SELECT * FROM pgr_withPointsKSP(
8 | 2 | 3 | -6 | 4 | 0.3 | 1.3
9 | 2 | 4 | 5 | 10 | 1 | 1.6
10 | 2 | 5 | 10 | 12 | 0.6 | 2.6
11 | 2 | 6 | -5 | 12 | 0.4 | 3.2
11 | 2 | 6 | -3 | 12 | 0.4 | 3.2
12 | 2 | 7 | 11 | 13 | 1 | 3.6
13 | 2 | 8 | 12 | 15 | 0.6 | 4.6
14 | 2 | 9 | -4 | 15 | 0.4 | 5.2
14 | 2 | 9 | -2 | 15 | 0.4 | 5.2
15 | 2 | 10 | 9 | 9 | 1 | 5.6
16 | 2 | 11 | 6 | -1 | 0 | 6.6
(16 rows)
......@@ -64,24 +59,19 @@ SELECT * FROM pgr_withPointsKSP(
2 | 1 | 2 | 2 | 4 | 0.7 | 0.6
3 | 1 | 3 | -6 | 4 | 0.3 | 1.3
4 | 1 | 4 | 5 | 8 | 1 | 1.6
5 | 1 | 5 | 6 | 9 | 1 | 2.6
6 | 1 | 6 | 9 | 16 | 1 | 3.6
7 | 1 | 7 | 4 | 3 | 1 | 4.6
8 | 1 | 8 | 3 | 5 | 0.8 | 5.6
9 | 1 | 9 | -2 | -1 | 0 | 6.4
10 | 2 | 1 | -1 | 1 | 0.6 | 0
11 | 2 | 2 | 2 | 4 | 0.7 | 0.6
12 | 2 | 3 | -6 | 4 | 0.3 | 1.3
13 | 2 | 4 | 5 | 8 | 1 | 1.6
14 | 2 | 5 | 6 | 11 | 1 | 2.6
15 | 2 | 6 | 11 | 13 | 1 | 3.6
16 | 2 | 7 | 12 | 15 | 0.6 | 4.6
17 | 2 | 8 | -4 | 15 | 0.4 | 5.2
18 | 2 | 9 | 9 | 16 | 1 | 5.6
19 | 2 | 10 | 4 | 3 | 1 | 6.6
20 | 2 | 11 | 3 | 5 | 0.8 | 7.6
21 | 2 | 12 | -2 | -1 | 0 | 8.4
(21 rows)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 2 | 4 | 0.7 | 1.4
26 | 3 | 4 | -6 | 4 | 0.3 | 2.1
27 | 3 | 5 | 5 | 10 | 1 | 2.4
28 | 3 | 6 | 10 | 12 | 0.6 | 3.4
29 | 3 | 7 | -5 | 12 | 0.4 | 4
30 | 3 | 8 | 11 | 13 | 1 | 4.4
31 | 3 | 9 | 12 | 15 | 1 | 5.4
32 | 3 | 10 | 9 | 16 | 1 | 6.4
33 | 3 | 11 | 4 | 3 | 1 | 7.4
34 | 3 | 12 | 3 | 5 | 0.8 | 8.4
35 | 3 | 13 | -2 | -1 | 0 | 9.2
(35 rows)
7 | 1 | 7 | 9 | 15 | 0.4 | 4.4
8 | 1 | 8 | -2 | -1 | 0 | 4.8
9 | 2 | 1 | -1 | 1 | 0.4 | 0
10 | 2 | 2 | 1 | 1 | 1 | 0.4
11 | 2 | 3 | 2 | 4 | 0.7 | 1.4
12 | 2 | 4 | -6 | 4 | 0.3 | 2.1
13 | 2 | 5 | 5 | 8 | 1 | 2.4
14 | 2 | 6 | 6 | 11 | 1 | 3.4
15 | 2 | 7 | 11 | 13 | 1 | 4.4
16 | 2 | 8 | 12 | 15 | 1 | 5.4
17 | 2 | 9 | 9 | 15 | 0.4 | 6.4
18 | 2 | 10 | -2 | -1 | 0 | 6.8
19 | 3 | 1 | -1 | 1 | 0.4 | 0
20 | 3 | 2 | 1 | 1 | 1 | 0.4
21 | 3 | 3 | 2 | 4 | 0.7 | 1.4
22 | 3 | 4 | -6 | 4 | 0.3 | 2.1
23 | 3 | 5 | 5 | 10 | 1 | 2.4
24 | 3 | 6 | 10 | 12 | 0.6 | 3.4
25 | 3 | 7 | -3 | 12 | 0.4 | 4
26 | 3 | 8 | 11 | 13 | 1 | 4.4
27 | 3 | 9 | 12 | 15 | 1 | 5.4
28 | 3 | 10 | 9 | 15 | 0.4 | 6.4
29 | 3 | 11 | -2 | -1 | 0 | 6.8
(29 rows)
--q5
ROLLBACK;
......
......@@ -103,7 +103,8 @@ do_pgr_withPoints(
int64_t start_vid(start_pid);
int64_t end_vid(end_pid);
#if 0
#ifdef DEBUG
for (const auto point : points) {
if (point.pid == start_pid) {
start_vid = point.vertex_id;
......
......@@ -261,7 +261,7 @@ create_new_edges(
}
}
if (points_on_edge.empty()) {
log << "For some reason we didnt find a point belonging to the edge, must be an error\n";
log << "For some reason we didn't find a point belonging to the edge, must be an error\n";
return false;
}
#if 0
......@@ -290,7 +290,7 @@ create_new_edges(
* vertex_id = -newnumber
*/
log << "\npid" << point.pid << "\teid" << point.edge_id << "/t" << point.fraction << "\t" << point.side << "\n";
if (point.fraction < 0 || point.fraction > 1) {
if (point.fraction <= 0 || point.fraction >= 1) {
log << "For some reason an invalid fraction was accepted, must be an error\n";
return false;
}
......@@ -303,8 +303,8 @@ create_new_edges(
point.vertex_id = edge.target;
}
if (point.fraction > 0 && point.fraction < 1) {
log << "vertex_id of the point is " << - vertex_id << "\n";
point.vertex_id = -vertex_id;
log << "vertex_id of the point is " << -point.pid << "\n";
point.vertex_id = -point.pid;
++vertex_id;
}
new_points.push_back(point);
......
--e1
1|1|-1|1|0.6|0
2|2|2|4|1|0.6
3|3|5|7|1|1.6
4|4|8|6|0.7|2.6
5|5|-3|-1|0|3.3
3|3|5|10|1|1.6
4|4|10|12|0.6|2.6
5|5|-3|-1|0|3.2
--e2
1|1|-1|1|0.6|0
2|2|2|4|0.7|0.6
......@@ -16,37 +16,37 @@
--e3
1|1|-3|-1|1|0.6|0
2|2|-3|2|4|1|0.6
3|3|-3|5|7|1|1.6
4|4|-3|8|6|0.7|2.6
5|5|-3|-3|-1|0|3.3
3|3|-3|5|10|1|1.6
4|4|-3|10|12|0.6|2.6
5|5|-3|-3|-1|0|3.2
6|1|5|-1|1|0.6|0
7|2|5|2|4|1|0.6
8|3|5|5|-1|0|1.6
--e4
1|1|-1|-1|1|0.6|0
2|2|-1|2|4|1|0.6
3|3|-1|5|7|1|1.6
4|4|-1|8|6|0.7|2.6
5|5|-1|-3|-1|0|3.3
3|3|-1|5|10|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