implements announcement of waypoints, closes #584
This commit is contained in:
parent
aab5e8430f
commit
d54a55c12b
@ -69,6 +69,11 @@ struct RawRouteData
|
||||
int shortest_path_length;
|
||||
int alternative_path_length;
|
||||
|
||||
bool is_via_leg(const std::size_t leg) const
|
||||
{
|
||||
return (leg != unpacked_path_segments.size() - 1);
|
||||
}
|
||||
|
||||
RawRouteData()
|
||||
: check_sum(SPECIAL_NODEID),
|
||||
shortest_path_length(INVALID_EDGE_WEIGHT),
|
||||
|
@ -31,7 +31,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
enum class TurnInstruction : unsigned char
|
||||
{
|
||||
NoTurn = 0, GoStraight, TurnSlightRight, TurnRight, TurnSharpRight, UTurn,
|
||||
TurnSharpLeft, TurnLeft, TurnSlightLeft, ReachViaPoint, HeadOn, EnterRoundAbout,
|
||||
TurnSharpLeft, TurnLeft, TurnSlightLeft, ReachViaLocation, HeadOn, EnterRoundAbout,
|
||||
LeaveRoundAbout, StayOnRoundAbout, StartAtEndOfStreet, ReachedYourDestination,
|
||||
EnterAgainstAllowedDirection, LeaveAgainstAllowedDirection,
|
||||
InverseAccessRestrictionFlag = 127,
|
||||
|
@ -50,13 +50,19 @@ void DescriptionFactory::SetStartSegment(const PhantomNode &source, const bool t
|
||||
BOOST_ASSERT(path_description.back().duration == segment_duration);
|
||||
}
|
||||
|
||||
void DescriptionFactory::SetEndSegment(const PhantomNode &target, const bool traversed_in_reverse)
|
||||
void DescriptionFactory::SetEndSegment(const PhantomNode &target, const bool traversed_in_reverse, const bool is_via_location)
|
||||
{
|
||||
target_phantom = target;
|
||||
const EdgeWeight segment_duration =
|
||||
(traversed_in_reverse ? target.reverse_weight : target.forward_weight);
|
||||
path_description.emplace_back(
|
||||
target.location, target.name_id, segment_duration, 0.f, TurnInstruction::NoTurn, true, true);
|
||||
target.location,
|
||||
target.name_id,
|
||||
segment_duration,
|
||||
0.f,
|
||||
is_via_location ? TurnInstruction::ReachViaLocation : TurnInstruction::NoTurn,
|
||||
true,
|
||||
true);
|
||||
BOOST_ASSERT(path_description.back().duration == segment_duration);
|
||||
}
|
||||
|
||||
|
@ -80,7 +80,7 @@ class DescriptionFactory
|
||||
void AppendSegment(const FixedPointCoordinate &coordinate, const PathData &data);
|
||||
void BuildRouteSummary(const double distance, const unsigned time);
|
||||
void SetStartSegment(const PhantomNode &start_phantom, const bool traversed_in_reverse);
|
||||
void SetEndSegment(const PhantomNode &start_phantom, const bool traversed_in_reverse);
|
||||
void SetEndSegment(const PhantomNode &start_phantom, const bool traversed_in_reverse, const bool is_via_location = false);
|
||||
JSON::Value AppendEncodedPolylineString(const bool return_encoded);
|
||||
std::vector<unsigned> const & GetViaIndices() const;
|
||||
|
||||
|
@ -76,7 +76,8 @@ template <class DataFacadeT> class JSONDescriptor : public BaseDescriptor<DataFa
|
||||
|
||||
unsigned DescribeLeg(const std::vector<PathData> route_leg,
|
||||
const PhantomNodes &leg_phantoms,
|
||||
const bool target_traversed_in_reverse)
|
||||
const bool target_traversed_in_reverse,
|
||||
const bool is_via_leg)
|
||||
{
|
||||
unsigned added_element_count = 0;
|
||||
// Get all the coordinates for the computed route
|
||||
@ -87,7 +88,7 @@ template <class DataFacadeT> class JSONDescriptor : public BaseDescriptor<DataFa
|
||||
description_factory.AppendSegment(current_coordinate, path_data);
|
||||
++added_element_count;
|
||||
}
|
||||
description_factory.SetEndSegment(leg_phantoms.target_phantom, target_traversed_in_reverse);
|
||||
description_factory.SetEndSegment(leg_phantoms.target_phantom, target_traversed_in_reverse, is_via_leg);
|
||||
++added_element_count;
|
||||
BOOST_ASSERT((route_leg.size() + 1) == added_element_count);
|
||||
return added_element_count;
|
||||
@ -126,7 +127,8 @@ template <class DataFacadeT> class JSONDescriptor : public BaseDescriptor<DataFa
|
||||
#endif
|
||||
DescribeLeg(raw_route.unpacked_path_segments[i],
|
||||
raw_route.segment_end_coordinates[i],
|
||||
raw_route.target_traversed_in_reverse[i]);
|
||||
raw_route.target_traversed_in_reverse[i],
|
||||
raw_route.is_via_leg(i));
|
||||
BOOST_ASSERT(0 < added_segments);
|
||||
}
|
||||
description_factory.Run(facade, config.zoom_level);
|
||||
|
Loading…
Reference in New Issue
Block a user