File tree Expand file tree Collapse file tree 5 files changed +26
-9
lines changed Expand file tree Collapse file tree 5 files changed +26
-9
lines changed Original file line number Diff line number Diff line change @@ -4,6 +4,7 @@ SET(LOCAL_FILES
44 doc -pgr_withPointsCost
55 doc -pgr_withPointsDD
66 doc -pgr_withPointsKSP
7+ doc -pgr_withPointsKSPv3.6
78 doc -pgr_withPoints
89 withPointsVia
910 )
Original file line number Diff line number Diff line change 55 ' comment' => ' Function test for any versions.' ,
66 ' data' => [' sampledata.data' ],
77 ' tests' => [qw(
8- doc-pgr_withPoints
9- doc-pgr_withPointsCost
10- doc-pgr_withPointsCostMatrix
11- doc-pgr_withPointsDD
12- doc-pgr_withPointsKSP
13- withPointsVia
8+ doc-pgr_withPointsKSPv3.6
149 ) ],
1510 ' documentation' => [qw(
1611 doc-pgr_withPoints
Original file line number Diff line number Diff line change @@ -138,6 +138,10 @@ class Path {
138138 Path_rt **ret_path,
139139 size_t &sequence, int routeId) const ;
140140
141+ void get_pg_withPointsKSP_path (
142+ Path_rt **ret_path,
143+ size_t &sequence) const ;
144+
141145 void get_pg_turn_restricted_path (
142146 Path_rt **ret_path,
143147 size_t &sequence, int routeId) const ;
Original file line number Diff line number Diff line change @@ -280,6 +280,24 @@ void Path::get_pg_ksp_path(
280280 }
281281}
282282
283+ /* used by withPointsKSP */
284+ void Path::get_pg_withPointsKSP_path (
285+ Path_rt **ret_path,
286+ size_t &sequence) const {
287+ for (unsigned int i = 0 ; i < path.size (); i++) {
288+ (*ret_path)[sequence].seq = static_cast <int >(i + 1 );
289+ (*ret_path)[sequence].start_id = start_id ();
290+ (*ret_path)[sequence].end_id = end_id ();
291+ (*ret_path)[sequence].node = path[i].node ;
292+ (*ret_path)[sequence].edge = path[i].edge ;
293+ (*ret_path)[sequence].cost = path[i].cost ;
294+ (*ret_path)[sequence].agg_cost = (i == 0 )?
295+ 0 :
296+ (*ret_path)[sequence-1 ].agg_cost + path[i-1 ].cost ;
297+ sequence++;
298+ }
299+ }
300+
283301/* used by turn restricted */
284302void Path::get_pg_turn_restricted_path (
285303 Path_rt **ret_path,
Original file line number Diff line number Diff line change @@ -159,11 +159,10 @@ pgr_do_withPointsKsp(
159159 *return_tuples = pgr_alloc (count, (*return_tuples));
160160
161161 size_t sequence = 0 ;
162- int route_id = 0 ;
162+ // int route_id = 0;
163163 for (const auto &path : paths) {
164164 if (path.size () > 0 )
165- path.get_pg_ksp_path (return_tuples, sequence, route_id);
166- ++route_id;
165+ path.get_pg_withPointsKSP_path (return_tuples, sequence);
167166 }
168167
169168 if (count != sequence) {
You can’t perform that action at this time.
0 commit comments