add member variable/functions to store information if uturns are allowed

This commit is contained in:
Dennis Luxen 2014-07-16 12:47:10 +02:00
parent 7110acc94f
commit 0c529361a3
2 changed files with 27 additions and 1 deletions

View File

@ -33,7 +33,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
RouteParameters::RouteParameters() RouteParameters::RouteParameters()
: zoom_level(18), print_instructions(false), alternate_route(true), geometry(true), : zoom_level(18), print_instructions(false), alternate_route(true), geometry(true),
compression(true), deprecatedAPI(false), check_sum(-1) compression(true), deprecatedAPI(false), uturn_default(false), check_sum(-1)
{ {
} }
@ -47,6 +47,26 @@ void RouteParameters::setZoomLevel(const short level)
void RouteParameters::setAlternateRouteFlag(const bool flag) { alternate_route = flag; } void RouteParameters::setAlternateRouteFlag(const bool flag) { alternate_route = flag; }
void RouteParameters::setUTurn(const bool flag)
{
uturns.resize(coordinates.size(), uturn_default);
if (!uturns.empty())
{
uturns.back() = flag;
}
}
void RouteParameters::setAllUTurns(const bool flag)
{
// if the flag flips the default, then we erase everything.
if (flag)
{
uturn_default = flag;
uturns.clear();
uturns.resize(coordinates.size(), uturn_default);
}
}
void RouteParameters::setDeprecatedAPIFlag(const std::string &) { deprecatedAPI = true; } void RouteParameters::setDeprecatedAPIFlag(const std::string &) { deprecatedAPI = true; }
void RouteParameters::setChecksum(const unsigned sum) { check_sum = sum; } void RouteParameters::setChecksum(const unsigned sum) { check_sum = sum; }

View File

@ -43,6 +43,10 @@ struct RouteParameters
void setAlternateRouteFlag(const bool flag); void setAlternateRouteFlag(const bool flag);
void setUTurn(const bool flag);
void setAllUTurns(const bool flag);
void setDeprecatedAPIFlag(const std::string &); void setDeprecatedAPIFlag(const std::string &);
void setChecksum(const unsigned check_sum); void setChecksum(const unsigned check_sum);
@ -71,12 +75,14 @@ struct RouteParameters
bool geometry; bool geometry;
bool compression; bool compression;
bool deprecatedAPI; bool deprecatedAPI;
bool uturn_default;
unsigned check_sum; unsigned check_sum;
std::string service; std::string service;
std::string output_format; std::string output_format;
std::string jsonp_parameter; std::string jsonp_parameter;
std::string language; std::string language;
std::vector<std::string> hints; std::vector<std::string> hints;
std::vector<bool> uturns;
std::vector<FixedPointCoordinate> coordinates; std::vector<FixedPointCoordinate> coordinates;
}; };