Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
R
rv2
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
Operations
Operations
Incidents
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Phyks
rv2
Commits
c9d3632a
Commit
c9d3632a
authored
Jan 15, 2015
by
Jean-Benoist Leger
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
state,status on stderr
parent
92aa7027
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
45 additions
and
6 deletions
+45
-6
src/conf.h
src/conf.h
+1
-0
src/get_route.cc
src/get_route.cc
+39
-3
src/get_route.h
src/get_route.h
+4
-2
src/route.cc
src/route.cc
+1
-1
No files found.
src/conf.h
View file @
c9d3632a
...
...
@@ -29,5 +29,6 @@
#define RV_MAXIMUM_USED_ANGLE 3 // rad
#define RV_MAXIMUM_RADIUS_OF_CURVATURE 500 // m
#define RV_STATUS_SCALE 1000
#endif
src/get_route.cc
View file @
c9d3632a
...
...
@@ -4,9 +4,13 @@ std::list<std::list<route_point_t> > get_routes(
route_db_t
*
route_db
,
parameters_t
&
parameters
,
std
::
list
<
std
::
pair
<
double
,
double
>
>
&
geos
,
stdout_output_t
stdout_output
)
stdout_output_t
stdout_output
,
bool
state_status_on_stderr
)
{
std
::
list
<
nid_t
>
nids
;
if
(
state_status_on_stderr
)
fprintf
(
stderr
,
"## state: lookup
\n
"
);
route_db
->
lookup
(
geos
,
nids
);
std
::
list
<
std
::
list
<
route_point_t
>
>
ret
;
...
...
@@ -20,13 +24,20 @@ std::list<std::list<route_point_t> > get_routes(
nids_it_next
++
;
if
(
nids_it_next
!=
nids
.
end
())
{
if
(
state_status_on_stderr
)
fprintf
(
stderr
,
"## status: routing_track %lu
\n
"
,
track
);
std
::
list
<
route_point_t
>
current_route
=
get_route_between_nids
(
route_db
,
parameters
,
*
nids_it
,
*
nids_it_next
);
*
nids_it_next
,
state_status_on_stderr
);
ret
.
push_back
(
current_route
);
if
(
state_status_on_stderr
)
fprintf
(
stderr
,
"## status: end_track %lu
\n
"
,
track
);
if
(
stdout_output
==
RV_STDOUT_OUTPUT_TEXT
)
write_to_stdout
(
route_db
,
track
,
current_route
);
...
...
@@ -41,7 +52,8 @@ std::list<route_point_t> get_route_between_nids(
route_db_t
*
route_db
,
parameters_t
&
parameters
,
nid_t
&
nid_initial
,
nid_t
&
nid_final
)
nid_t
&
nid_final
,
bool
state_status_on_stderr
)
{
std
::
priority_queue
<
edge_in_queue_t
>
queue
;
// This is the ordoned queue used to explore
edge_map_t
edges_map
;
...
...
@@ -50,6 +62,13 @@ std::list<route_point_t> get_route_between_nids(
// first we add edge starting from the initial node in the queue
node_info_t
*
initial_node
=
route_db
->
get_node
(
nid_initial
);
node_info_t
*
final_node
=
route_db
->
get_node
(
nid_final
);
double
total_flight_distance
=
rv_distance
(
initial_node
->
fixed
->
lon
,
initial_node
->
fixed
->
lat
,
final_node
->
fixed
->
lon
,
final_node
->
fixed
->
lat
);
unsigned
int
last_printed_status
=
0
;
edge_t
null_edge
;
null_edge
.
A
=
0
;
...
...
@@ -98,6 +117,23 @@ std::list<route_point_t> get_route_between_nids(
node_info_t
*
A_node
=
route_db
->
get_node
(
running_edge_in_queue
.
edge
.
A
);
node_info_t
*
B_node
=
route_db
->
get_node
(
running_edge_in_queue
.
edge
.
B
);
if
(
state_status_on_stderr
)
{
double
flight_distance
=
rv_distance
(
final_node
->
fixed
->
lon
,
final_node
->
fixed
->
lat
,
B_node
->
fixed
->
lon
,
B_node
->
fixed
->
lat
);
double
status
=
1
-
flight_distance
/
total_flight_distance
;
status
=
status
*
status
;
if
(
(
unsigned
int
)(
status
*
RV_STATUS_SCALE
)
>
last_printed_status
)
{
last_printed_status
=
(
unsigned
int
)(
status
*
RV_STATUS_SCALE
);
fprintf
(
stderr
,
"## status: %lu
\n
"
,
last_printed_status
);
}
}
if
(
running_edge_in_queue
.
edge
.
B
==
nid_final
)
// We are near the end
{
...
...
src/get_route.h
View file @
c9d3632a
...
...
@@ -12,12 +12,14 @@ std::list<route_point_t> get_route_between_nids(
route_db_t
*
route_db
,
parameters_t
&
parameters
,
nid_t
&
nid_from
,
nid_t
&
nid_to
);
nid_t
&
nid_to
,
bool
state_status_on_stderr
=
false
);
std
::
list
<
std
::
list
<
route_point_t
>
>
get_routes
(
route_db_t
*
route_db
,
parameters_t
&
parameters
,
std
::
list
<
std
::
pair
<
double
,
double
>
>
&
geos
,
stdout_output_t
stdout_output
=
RV_STDOUT_OUTPUT_NONE
);
stdout_output_t
stdout_output
=
RV_STDOUT_OUTPUT_NONE
,
bool
state_status_on_stderr
=
false
);
#endif
src/route.cc
View file @
c9d3632a
...
...
@@ -10,7 +10,7 @@ int main(int argc, char** argv)
parameters_t
parameters
=
read_parameters_from_stdin
();
std
::
list
<
std
::
pair
<
double
,
double
>>
geos
=
read_points_from_stdin
();
get_routes
(
&
route_db
,
parameters
,
geos
,
RV_STDOUT_OUTPUT_TEXT
);
get_routes
(
&
route_db
,
parameters
,
geos
,
RV_STDOUT_OUTPUT_TEXT
,
true
);
return
(
0
);
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment