Skip to content

Commit

Permalink
Add bounding boxes to summary of each leg.
Browse files Browse the repository at this point in the history
  • Loading branch information
dnesbitt61 committed Jul 25, 2016
1 parent 103cca8 commit 1a886e9
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 1 deletion.
6 changes: 6 additions & 0 deletions proto/tripdirections.proto
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@ message TripDirections {
optional float lat = 1;
optional float lng = 2;
}

message BoundingBox {
optional LatLng min_ll = 1;
optional LatLng max_ll = 2;
}

message Location {
enum Type {
Expand Down Expand Up @@ -35,6 +40,7 @@ message TripDirections {
message Summary {
optional float length = 1; // kilometers or miles based on units
optional uint32 time = 2; // seconds
optional BoundingBox bbox = 3; // Bounding box of the shape
}

message TransitStop {
Expand Down
7 changes: 6 additions & 1 deletion proto/trippath.proto
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@ message TripPath {
optional float lat = 1;
optional float lng = 2;
}

message BoundingBox {
optional LatLng min_ll = 1;
optional LatLng max_ll = 2;
}

message Location {
enum Type {
Expand Down Expand Up @@ -215,6 +220,6 @@ message TripPath {
repeated Node node = 5;
repeated Admin admin = 6;
optional string shape = 7;

optional BoundingBox bbox = 8;
}

5 changes: 5 additions & 0 deletions src/odin/directionsbuilder.cc
Original file line number Diff line number Diff line change
Expand Up @@ -392,6 +392,11 @@ TripDirections DirectionsBuilder::PopulateTripDirections(
etp->GetLength(directions_options.units()));
trip_directions.mutable_summary()->set_time(
etp->node(etp->GetLastNodeIndex()).elapsed_time());
auto mutable_bbox = trip_directions.mutable_summary()->mutable_bbox();
mutable_bbox->mutable_min_ll()->set_lat(etp->bbox().min_ll().lat());
mutable_bbox->mutable_min_ll()->set_lng(etp->bbox().min_ll().lng());
mutable_bbox->mutable_max_ll()->set_lat(etp->bbox().max_ll().lat());
mutable_bbox->mutable_max_ll()->set_lng(etp->bbox().max_ll().lng());

// Populate shape
trip_directions.set_shape(etp->shape());
Expand Down

0 comments on commit 1a886e9

Please sign in to comment.