+++ /dev/null
-/*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef _MAPZEN_API_H_
-#define _MAPZEN_API_H_
-
-#include <maps_plugin.h>
-#include <maps_view.h>
-
-int MapzenPluginRoute(maps_coordinates_h origin, maps_coordinates_h destination,
- maps_item_hashtable_h pref, maps_service_search_route_cb callback_function,
- void* user_data, int* request_id);
-
-#endif // _MAPZEN_API_H_
+++ /dev/null
-/*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef _MAPZEN_CONSTANTS_H_
-#define _MAPZEN_CONSTANTS_H_
-
-// Error types
-enum ErrorType {
- kNone = 0, // Success
- kPermissionDenied, // Permission denied
- kOutOfMemory, // Out of memory
- kInvalidParameter, // Invalid parameter
- kNotSupported, // Unsupported operation
- kConnectionTimeout, // Connection timeout
- kNetworkUnreachable, // Network unavailable
- kInvalidOperation, // Invalid operation
- kInvalidKey, // Invalid key
- kResourceBusy, // Resource busy
- kCancelled, // Service cancelled
- kUnknown, // Unknown error
- kServiceUnavailable, // Service unavailable
- kResultNotFound // Result not found
-};
-
-#endif // _MAPZEN_CONSTANTS_H_
+++ /dev/null
-/*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include <string>
-#include <vector>
-#include <maps_area.h>
-#include <maps_preference.h>
-#include <maps_route_maneuver.h>
-#include <maps_service.h>
-#include <maps_view.h>
-
-extern "C"
-{
-
-}
-constexpr double kPolylinePrecision = 1E6;
-constexpr double kInvPolylinePrecision = 1.0 / kPolylinePrecision;
-
-
-class MapzenUtils
-{
-public:
- MapzenUtils();
- ~MapzenUtils();
-
- // Is the map coordinate valid (in valid latitude,longitude range)
- static bool IsValid(maps_coordinates_s& coord);
-
- // Decode the shape string returned in the route result
- void DecodeShape(const std::string& encoded,
- std::vector<maps_coordinates_s>& output);
-
-private:
-};
-
#define GEOCODE_URL "https://search.mapzen.com/v1/search?api_key=%s"
-int query_geocode_within_bounds(gchar *maps_key, char *address, coords_s top_left, coords_s bottom_right, int num_results, gpointer user_data)
+int query_geocode_within_bounding_box(gchar *maps_key, char *address, coords_s top_left, coords_s bottom_right, int num_results, gpointer user_data)
{
char url[1024];
char tmpStr[512];
snprintf(tmpStr, sizeof(tmpStr), GEOCODE_URL, "null");
STRCPY(url, tmpStr);
-
snprintf(tmpStr, sizeof(tmpStr), "&boundary.rect.min_lat=%f&boundary.rect.min_lon=%f&boundary.rect.max_lat=%f&boundary.rect.max_lon=%f",
- top_left.latitude, top_left.longitude, bottom_right.latitude, bottom_right.longitude);
+ bottom_right.latitude, top_left.longitude, top_left.latitude, bottom_right.longitude);
+ STRCAT(url, tmpStr);
+
+ snprintf(tmpStr, sizeof(tmpStr), "&size=%d", num_results);
+ STRCAT(url, tmpStr);
+
+ snprintf(tmpStr, sizeof(tmpStr), "&text=%s", address);
+ STRCAT(url, tmpStr);
+
+ add_handle(url, REQ_TYPE_GEOCODE, user_data);
+
+ return 0;
+}
+
+int query_geocode_within_circle(gchar *maps_key, char *address, coords_s center, double radius, int num_results, gpointer user_data)
+{
+ char url[1024];
+ char tmpStr[512];
+
+ if (maps_key != NULL)
+ snprintf(tmpStr, sizeof(tmpStr), GEOCODE_URL, maps_key);
+ else
+ snprintf(tmpStr, sizeof(tmpStr), GEOCODE_URL, "null");
+
+ STRCPY(url, tmpStr);
+
+ snprintf(tmpStr, sizeof(tmpStr), "&boundary.circle.lon=%f&boundary.circle.lat=%f&boundary.circle.radius=%f",
+ center.longitude, center.latitude, radius);
STRCAT(url, tmpStr);
snprintf(tmpStr, sizeof(tmpStr), "&size=%d", num_results);
STRCAT(url, tmpStr);
- snprintf(tmpStr, sizeof(tmpStr), "&layers=address&text=%s", address);
+ snprintf(tmpStr, sizeof(tmpStr), "&text=%s", address);
STRCAT(url, tmpStr);
add_handle(url, REQ_TYPE_GEOCODE, user_data);
snprintf(tmpStr, sizeof(tmpStr), "&size=%d", num_results);
STRCAT(url, tmpStr);
- snprintf(tmpStr, sizeof(tmpStr), "&layers=address&text=%s", address);
+ snprintf(tmpStr, sizeof(tmpStr), "&text=%s", address);
STRCAT(url, tmpStr);
add_handle(url, REQ_TYPE_GEOCODE, user_data);
#include "mapzen_types.h"
int query_geocode(gchar *maps_key, char *address, int num_results, gpointer user_data);
-int query_geocode_within_bounds(gchar *maps_key, char *address, coords_s top_left, coords_s bottom_right, int num_results, gpointer user_data);
+int query_geocode_within_bounding_box(gchar *maps_key, char *address, coords_s top_left, coords_s bottom_right, int num_results, gpointer user_data);
+int query_geocode_within_circle(gchar *maps_key, char *address, coords_s center, double radius, int num_results, gpointer user_data);
#endif /* MAPZEN_GEOCODE_H_ */
//if we have the key and its not an empty value
rapidjson::Value::ConstMemberIterator itr = obj.FindMember(key);
if(itr != obj.MemberEnd() && itr->value.GetStringLength()){
- (*value) = (gchar *)g_malloc(itr->value.GetStringLength() + 1);
+ (*value) = (gchar *)g_malloc(itr->value.GetStringLength() + sizeof(rapidjson::Document::Ch));
strncpy((*value), itr->value.GetString(), itr->value.GetStringLength());
+ memset((*value) + itr->value.GetStringLength(), 0, sizeof(rapidjson::Document::Ch));
}//we had nothing
else
(*value) = NULL;
if (!response || !status || !coordsList) return;
+ //so far we have nothing
*coordsList = NULL;
+ *status = 500;
//crack open that json
rapidjson::Document document;
coords_s *coord = (coords_s *)g_malloc0(sizeof(coords_s));
if (coord != NULL) {
- coord->latitude = coords->value[0].GetDouble();
- coord->longitude = coords->value[1].GetDouble();
+ coord->longitude = coords->value[0].GetDouble();
+ coord->latitude = coords->value[1].GetDouble();
}
if (*coordsList == NULL)
*coordsList = g_list_append(*coordsList, coord);
else
*coordsList = g_list_insert_before(*coordsList, NULL, coord);
+ *status = 0;
}
}
}
{
if (!response || !status || !respAddr) return;
+ //so far we have nothing
*respAddr = NULL;
+ *status = 500;
//crack open that json
rapidjson::Document document;
g_free(*respAddr);
(*respAddr) = NULL;
}//forget the rest, we have one with something in it
- else
+ else {
+ *status = 0;
break;
+ }
}
}
}
MAP_DEBUG("TOP LEFT >>><<< LATITUDE : %f, LONGITUDE : %f", req_details->boundary->rect.top_left.latitude, req_details->boundary->rect.top_left.longitude);
MAP_DEBUG("BOTTOM RIGHT >>><<< LATITUDE : %f, LONGITUDE : %f", req_details->boundary->rect.bottom_right.latitude, req_details->boundary->rect.bottom_right.longitude);
- query_geocode_within_bounds(req_details->maps_key, req_details->address, req_details->boundary->rect.top_left, req_details->boundary->rect.bottom_right, req_details->num_res, queryData);
+ query_geocode_within_bounding_box(req_details->maps_key, req_details->address, req_details->boundary->rect.top_left, req_details->boundary->rect.bottom_right, req_details->num_res, queryData);
} else if (req_details->boundary->type == MAPZEN_BOUNDARY_CIRCLE) {
- coords_s *top_left = NULL, *bottom_right = NULL;
coords_s circle = req_details->boundary->circle.center;
- gdouble radius = (req_details->boundary->circle.radius) * 0.001;
-
MAP_DEBUG("User input LATITUDE : %f, LONGITUDE : %f", circle.latitude, circle.longitude);
-
- /* Calculate the top left coordinate of bounding box. */
- calculate_point(circle.latitude, circle.longitude, 315, radius, &top_left);
-
- /* Calculate the bottom right coordinate of bounding box. */
- calculate_point(circle.latitude, circle.longitude, 135, radius, &bottom_right);
-
- if ((top_left != NULL) && (bottom_right != NULL)) {
- MAP_DEBUG("Top Left LATITUDE : %f, LONGITUDE : %f", top_left->latitude, top_left->longitude);
- MAP_DEBUG("Bottom Right LATITUDE : %f, LONGITUDE : %f", bottom_right->latitude, bottom_right->longitude);
-
- query_geocode_within_bounds(req_details->maps_key, req_details->address, *top_left, *bottom_right, req_details->num_res, queryData);
-
- g_free(top_left);
- top_left = NULL;
-
- g_free(bottom_right);
- bottom_right = NULL;
- }
+ query_geocode_within_circle(req_details->maps_key, req_details->address, circle, req_details->boundary->circle.radius, req_details->num_res, queryData);
} else {
query_geocode(req_details->maps_key, req_details->address, req_details->num_res, queryData);
#include <pthread.h>
#include <dlog.h>
#include "mapzen_route.hpp"
+
+extern "C" {
#include "mapzen_types.h"
#include "mapzen_server_private.h"
#include "mapzen_debug.h"
#include "mapzen_queue.h"
#include "mapzen_restcurl.h"
#include "mapzen_util.h"
+}
#include "rapidjson/rapidjson.h"
#include "rapidjson/allocators.h"
std::string url_encode(const std::string& unencoded) {
char* encoded = curl_escape(unencoded.c_str(), static_cast<int>(unencoded.size()));
- dlog_print(DLOG_DEBUG, "URL:*","json after url encoding: " + *encoded);
+ MAP_DEBUG("route json after url encoding: " + *encoded);
std::string encoded_str(encoded);
curl_free(encoded);
return encoded_str;
int query_route(gchar *maps_key, coords_s startPoint, coords_s endPoint, route_type type, route_feature_avoids avoids, route_driving_style style, GList *waypoints, gpointer user_data)
{
+ MAP_DEBUG("**********IN QUERY ROUTE!!**************");
rapidjson::Document document;
rapidjson::Document::AllocatorType& allocator = document.GetAllocator();
+ rapidjson::Value& costing = document.AddMember(rapidjson::Value("costing", allocator).Move(),
+ rapidjson::Value(rapidjson::kStringType).Move(), allocator);
+ switch (type) {
+ case COSTING_AUTO:
+ costing.SetString("auto");
+ break;
+ case COSTING_AUTO_SHORTER:
+ costing.SetString("auto_shorter");
+ break;
+ case COSTING_PEDESTRIAN:
+ costing.SetString("pedestrian");
+ break;
+ case COSTING_MULTIMODAL:
+ costing.SetString("multimodal");
+ break;
+ case COSTING_BICYCLE:
+ costing.SetString("bicycle");
+ break;
+ default:
+ costing.SetString("auto");
+ }
+
rapidjson::Value& locations = document.AddMember(rapidjson::Value("locations", allocator).Move(),
rapidjson::Value(rapidjson::kArrayType).Move(), allocator);
rapidjson::Value& location = locations.AddMember(rapidjson::Value("", allocator).Move(),
- rapidjson::Value(rapidjson::kObjectType).Move(), allocator);
+ rapidjson::Value(rapidjson::kObjectType).Move(), allocator);
int length = g_list_length(waypoints);
if (length != 0) {
location.AddMember<double>("lon", endPoint.longitude, allocator);
}
- rapidjson::Value& costing = document.AddMember(rapidjson::Value("costing", allocator).Move(),
- rapidjson::Value(rapidjson::kStringType).Move(), allocator);
- switch (type) {
- case COSTING_AUTO:
- costing.SetString("auto");
- break;
- case COSTING_AUTO_SHORTER:
- costing.SetString("auto_shorter");
- break;
- case COSTING_PEDESTRIAN:
- costing.SetString("pedestrian");
- break;
- case COSTING_MULTIMODAL:
- costing.SetString("multimodal");
- break;
- case COSTING_BICYCLE:
- costing.SetString("bicycle");
- break;
- default:
- costing.SetString("auto");
- }
-
rapidjson::Value& directions_options = document.AddMember(rapidjson::Value("directions_options", allocator).Move(),
rapidjson::Value(rapidjson::kObjectType).Move(), allocator);
directions_options.AddMember("unit","mi",allocator);
+++ /dev/null
-/*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "mapzen_api.h"
-#include "mapzen_constants.h"
-#include "mapzen_utils.h"
-
-int MapzenPluginRoute(maps_coordinates_h origin, maps_coordinates_h destination,
- maps_item_hashtable_h pref, maps_service_search_route_cb callback_func,
- void* user_data, int* request_id)
-{
- // Make sure pointers are valid
- if (!origin || !destination || !callback_func || !request_id)
- return ErrorType::kInvalidParameter;
-
- // Check if origin and destination coordinates are valid
- if (!MapzenUtils::IsValid(*(maps_coordinates_s*)origin) ||
- !MapzenUtils::IsValid(*(maps_coordinates_s*)destination))
- return ErrorType::kInvalidParameter;
-
- int error = 0;
- return error;
-}
callback_info_route *calldata_route = (callback_info_route *) user_data;
if (route_info) {
-/* maps_route_h route;
+ maps_route_h route;
maps_route_create(&route);
maps_coordinates_h top_left;
maps_distance_unit_e unit = MAPS_DISTANCE_UNIT_M;
switch (route_info->distance_unit) {
- case ROUTE_UNIT_M:
+ case UNIT_M:
unit = MAPS_DISTANCE_UNIT_M;
break;
- case ROUTE_UNIT_KM:
+ case UNIT_KM:
unit = MAPS_DISTANCE_UNIT_KM;
break;
- case ROUTE_UNIT_FT:
+ /*case ROUTE_UNIT_FT:
unit = MAPS_DISTANCE_UNIT_FT;
break;
case ROUTE_UNIT_YD:
unit = MAPS_DISTANCE_UNIT_YD;
- break;
+ break;*/
}
maps_route_set_distance_unit(route, unit);
maps_route_set_total_distance(route, route_info->distance);
maps_route_set_total_duration(route, (long) route_info->time);
- if (route_info->type == ROUTE_TYPE_FASTEST)
+ if (route_info->type == COSTING_AUTO)
maps_route_set_transport_mode(route, MAPS_ROUTE_TRANSPORT_MODE_CAR);
- else if (route_info->type == ROUTE_TYPE_PEDESTRIAN)
+ else if (route_info->type == COSTING_PEDESTRIAN)
maps_route_set_transport_mode(route, MAPS_ROUTE_TRANSPORT_MODE_PEDESTRIAN);
- else if (route_info->type == ROUTE_TYPE_BICYCLE)
+ else if (route_info->type == COSTING_BICYCLE)
maps_route_set_transport_mode(route, MAPS_ROUTE_TRANSPORT_MODE_BICYCLE);
- else if (route_info->type == ROUTE_TYPE_MULTIMODAL)
+ else if (route_info->type == COSTING_MULTIMODAL)
maps_route_set_transport_mode(route, MAPS_ROUTE_TRANSPORT_MODE_PUBLICTRANSIT);
else
maps_route_set_transport_mode(route, MAPS_ROUTE_TRANSPORT_MODE_CAR);
maps_route_maneuver_set_distance_to_next_instruction(man, maneuver->distance);
maps_route_maneuver_set_time_to_next_instruction(man, maneuver->time);
- maps_route_maneuver_set_turn_type(man, __convert_route_turn_type(maneuver->turn_type));
+ //maps_route_maneuver_set_turn_type(man, __convert_route_turn_type(maneuver->turn_type));
// maneuver_set_traffic_direction(man, (traffic_direction_e)action_id);
bool b = calldata_route->callback((maps_error_e)__convert_to_maps_error(result), calldata_route->reqID, 0, 1, route, calldata_route->data);
if (!b)
return;
- */
} else {
calldata_route->callback((maps_error_e)__convert_to_maps_error(result), calldata_route->reqID, 0, 0, NULL, calldata_route->data);
}
route_req->to.latitude = dest_lat;
route_req->to.longitude = dest_lon;
-/*
+
MAPS_LOGD("getting transport mode..");
maps_route_transport_mode_e transport_mode;
maps_preference_get_route_transport_mode(preference, &transport_mode);
if (transport_mode == MAPS_ROUTE_TRANSPORT_MODE_CAR)
- route_req->type = ROUTE_TYPE_FASTEST;
+ route_req->type = COSTING_AUTO;
else if (transport_mode == MAPS_ROUTE_TRANSPORT_MODE_PEDESTRIAN)
- route_req->type = ROUTE_TYPE_PEDESTRIAN;
+ route_req->type = COSTING_PEDESTRIAN;
else if (transport_mode == MAPS_ROUTE_TRANSPORT_MODE_BICYCLE)
- route_req->type = ROUTE_TYPE_BICYCLE;
+ route_req->type = COSTING_BICYCLE;
else if (transport_mode == MAPS_ROUTE_TRANSPORT_MODE_PUBLICTRANSIT)
- route_req->type = ROUTE_TYPE_MULTIMODAL;
+ route_req->type = COSTING_MULTIMODAL;
else
- route_req->type = ROUTE_TYPE_FASTEST; // Keeping it as default
+ route_req->type = COSTING_AUTO; // Keeping it as default
route_req->driving_style = DRIVING_STYLE_NORMAL; // Keeping it as default
switch (unit) {
case MAPS_DISTANCE_UNIT_M:
- route_req->unit = ROUTE_UNIT_M;
+ route_req->unit = UNIT_M; //miles, not meters
break;
case MAPS_DISTANCE_UNIT_KM:
- route_req->unit = ROUTE_UNIT_KM;
+ route_req->unit = UNIT_KM;
break;
case MAPS_DISTANCE_UNIT_FT:
- route_req->unit = ROUTE_UNIT_FT;
+ //route_req->unit = ROUTE_UNIT_FT;
break;
case MAPS_DISTANCE_UNIT_YD:
- route_req->unit = ROUTE_UNIT_YD;
+ //route_req->unit = ROUTE_UNIT_YD;
break;
}
- route_req->avoids = ROUTE_AVOID_NONE;
+ route_req->avoids = PENALTY_NONE;
maps_route_feature_weight_e routeWeight;
maps_preference_get_route_feature_weight(preference, &routeWeight);
maps_preference_get_route_feature(preference, &routeFeature);
if (routeFeature == MAPS_ROUTE_FEATURE_TOLL)
- route_req->avoids = ROUTE_AVOID_TOLL_ROAD;
+ route_req->avoids = PENALTY_TOLL_ROADS;
else if (routeFeature == MAPS_ROUTE_FEATURE_MOTORWAY)
- route_req->avoids = ROUTE_AVOID_LIMITED_ACCESS;
+ route_req->avoids = PENALTY_LIMITED_ACCESS;
else if ((routeFeature == MAPS_ROUTE_FEATURE_BOATFERRY) || (routeFeature == MAPS_ROUTE_FEATURE_RAILFERRY))
- route_req->avoids = ROUTE_AVOID_FERRY;
+ route_req->avoids = PENALTY_USE_FERRY;
else if (routeFeature == MAPS_ROUTE_FEATURE_DIRTROAD)
- route_req->avoids = ROUTE_AVOID_UNPAVED;
+ route_req->avoids = PENALTY_USE_UNPAVED;
else
- route_req->avoids = ROUTE_AVOID_NONE;
+ route_req->avoids = PENALTY_NONE;
}
route_req->way_points = NULL;
*request_id = ++__request_id;
calldata_route->reqID = __request_id;
-*/
+
int ret = mapzen_start_route(route_req, __mapzen_route_cb, __request_id, (void *)calldata_route);
return __convert_to_maps_error(ret);
route_req->to.latitude = 0.0;
route_req->to.longitude = 0.0;
-/*
+
MAPS_LOGD("getting transport mode..");
maps_route_transport_mode_e transport_mode;
maps_preference_get_route_transport_mode(preference, &transport_mode);
if (transport_mode == MAPS_ROUTE_TRANSPORT_MODE_CAR)
- route_req->type = ROUTE_TYPE_FASTEST;
+ route_req->type = COSTING_AUTO;
else if (transport_mode == MAPS_ROUTE_TRANSPORT_MODE_PEDESTRIAN)
- route_req->type = ROUTE_TYPE_PEDESTRIAN;
+ route_req->type = COSTING_PEDESTRIAN;
else if (transport_mode == MAPS_ROUTE_TRANSPORT_MODE_BICYCLE)
- route_req->type = ROUTE_TYPE_BICYCLE;
+ route_req->type = COSTING_BICYCLE;
else if (transport_mode == MAPS_ROUTE_TRANSPORT_MODE_PUBLICTRANSIT)
- route_req->type = ROUTE_TYPE_MULTIMODAL;
+ route_req->type = COSTING_MULTIMODAL;
else
- route_req->type = ROUTE_TYPE_FASTEST; // Keeping it as default
+ route_req->type = COSTING_AUTO; // Keeping it as default
route_req->driving_style = DRIVING_STYLE_NORMAL; // Keeping it as default
switch (unit) {
case MAPS_DISTANCE_UNIT_M:
- route_req->unit = ROUTE_UNIT_M;
+ route_req->unit = UNIT_M; //miles, not meters
break;
case MAPS_DISTANCE_UNIT_KM:
- route_req->unit = ROUTE_UNIT_KM;
+ route_req->unit = UNIT_KM;
break;
case MAPS_DISTANCE_UNIT_FT:
- route_req->unit = ROUTE_UNIT_FT;
+ // route_req->unit = ROUTE_UNIT_FT;
break;
case MAPS_DISTANCE_UNIT_YD:
- route_req->unit = ROUTE_UNIT_YD;
+ // route_req->unit = ROUTE_UNIT_YD;
break;
}
- route_req->avoids = ROUTE_AVOID_NONE;
+ route_req->avoids = PENALTY_NONE;
maps_route_feature_weight_e routeWeight;
maps_preference_get_route_feature_weight(preference, &routeWeight);
maps_preference_get_route_feature(preference, &routeFeature);
if (routeFeature == MAPS_ROUTE_FEATURE_TOLL)
- route_req->avoids = ROUTE_AVOID_TOLL_ROAD;
+ route_req->avoids = PENALTY_TOLL_ROADS;
else if (routeFeature == MAPS_ROUTE_FEATURE_MOTORWAY)
- route_req->avoids = ROUTE_AVOID_LIMITED_ACCESS;
+ route_req->avoids = PENALTY_LIMITED_ACCESS;
else if ((routeFeature == MAPS_ROUTE_FEATURE_BOATFERRY) || (routeFeature == MAPS_ROUTE_FEATURE_RAILFERRY))
- route_req->avoids = ROUTE_AVOID_FERRY;
+ route_req->avoids = PENALTY_USE_FERRY;
else if (routeFeature == MAPS_ROUTE_FEATURE_DIRTROAD)
- route_req->avoids = ROUTE_AVOID_UNPAVED;
+ route_req->avoids = PENALTY_USE_UNPAVED;
else
- route_req->avoids = ROUTE_AVOID_NONE;
+ route_req->avoids = PENALTY_NONE;
}
// Waypoints
*request_id = ++__request_id;
calldata_route->reqID = __request_id;
-*/
+
int ret = mapzen_start_route(route_req, __mapzen_route_cb, __request_id, (void *)calldata_route);
return __convert_to_maps_error(ret);