From aea2854daf9c6900a7d751bfee0a5d8e60f30e49 Mon Sep 17 00:00:00 2001 From: chanywa Date: Wed, 8 Jun 2016 11:28:59 +0900 Subject: [PATCH] [3.0][capi-maps-service][add new APIs for place details (ACR-452)] Change-Id: I6fc170859d75a2b2afd35ac7cad5bbc28b5b378e Signed-off-by: chanywa --- .../html/native/location/maps_tutorial_n.htm | 141 ++++++++++++++++----- 1 file changed, 109 insertions(+), 32 deletions(-) diff --git a/org.tizen.tutorials/html/native/location/maps_tutorial_n.htm b/org.tizen.tutorials/html/native/location/maps_tutorial_n.htm index ab5b2f6..261f27e 100644 --- a/org.tizen.tutorials/html/native/location/maps_tutorial_n.htm +++ b/org.tizen.tutorials/html/native/location/maps_tutorial_n.htm @@ -42,9 +42,9 @@

Related Info

- + @@ -405,6 +405,89 @@ __maps_service_search_place_cb(maps_error_e error, int request_id, int index, in +

To search for a list of places within a boundary, and get detailed information of a particular place:

+
    +
  1. Search for a place list: +
    • Use the maps_service_search_place_list() function for a search within a specified distance around the center coordinates: +
      +maps_area_h boundary = NULL;
      +/* Create the boundary with maps_area_create_rectangle() or maps_area_create_circle() */
      +
      +error = maps_service_search_place_list(maps, boundary, filter, preference,
      +                                       __maps_service_search_place_list_cb, user_data, &request_id);
      +
      +if (error != MAPS_ERROR_NONE)
      +    /* Error handling */
      +
      +
    • + +
    • Implement the __maps_service_search_place_list_cb() callback to receive the service response: +
      +static bool
      +__maps_service_search_place_list_cb(maps_error_e error, int request_id, int total,
      +                                    maps_place_list_h place_list, void* user_data)
      +{
      +    /* Handle the obtained place data */
      +    maps_place_list_foreach(place_list, __maps_place_details_cb, user_data);
      +
      +    /* Release the results */
      +    maps_place_list_destroy(place_list);
      +
      +    return true;
      +}
      +
      +
    • + +
    • Implement the __maps_place_details_cb() callback to receive the service response: +
      +static bool
      +__maps_place_details_cb(int index, maps_place_h place, void *user_data)
      +{
      +    /* Handle the obtained place data */
      +
      +    /* Get and store the uri in somewhere to get place details later */
      +    char *place_uri = NULL;
      +    maps_place_get_uri(place, &place_uri);
      +
      +    /* Don't release the place handle, because it is just a reference to data of the list */
      +
      +    return true;
      +}
      +
      +
    • +
  2. + +
  3. Get for place details: +
    • Use the maps_service_get_place_details() function for a search for place details: +
      +error = maps_service_get_place_details(maps, place_uri,
      +                                       __maps_service_get_place_details_cb, user_data, &request_id);
      +
      +if (error != MAPS_ERROR_NONE)
      +    /* Error handling */
      +
      +
    • + +
    • Implement the __maps_service_get_place_details_cb() callback to receive the service response: +
      +static void
      +__maps_service_get_place_details_cb(maps_error_e result, int request_id,
      +                                    maps_place_h place, void *user_data)
      +{
      +    /* Handle the obtained place data */
      +
      +    /* Release the results */
      +    maps_place_destroy(place);
      +}
      +
      +
    • + +
  4. +
+ + + +

Using the Routing Service

To query a route from point A to point B, use one of the following approaches. The service requests can be customized.

@@ -515,19 +598,16 @@ free(street);

The result of the place search request (maps_service_search_place(), maps_service_search_place_by_area(), or maps_service_search_place_by_address()) is retrieved from the map service using multiple iterations of the maps_service_search_place_cb() callback. The result is an instance of place data.

- - - - - - - - - -
Note
Different map providers are capable of providing different sets of place data features. Some map providers can extend the place data features with extra properties that are not specified in the Maps Service API. Such properties are organized as a key-value storage where the keys are the names of the properties. - -

If your map provider does not support a specific feature, the get function for the feature returns an error. To prevent problems, you can check which data features are available in your map provider using the maps_service_provider_is_data_supported() function.

-
+ + + + + + + +
Note
Different map providers are capable of providing different sets of place data features. Some map providers can extend the place data features with extra properties that are not specified in the Maps Service API. Such properties are organized as a key-value storage where the keys are the names of the properties. +

If your map provider does not support a specific feature, the get function for the feature returns an error. To prevent problems, you can check which data features are available in your map provider using the maps_service_provider_is_data_supported() function.

+

To parse place data:

@@ -658,24 +738,21 @@ __maps_place_properties_cb(int index, int total, char* key, void* value, void* u

The result of the route calculation request (maps_service_search_route() or maps_service_search_route_waypoints()) is retrieved from the map service using multiple iterations of the maps_service_search_route_cb() callback. The result is an instance of route data.

- - - - - - - - - -
Note
Different map providers are capable of providing different sets of route data features. Some map providers can extend the route data features with extra properties that are not specified in the Maps Service API. Such properties are organized as a key-value storage where the keys are the names of the properties. - -

If your map provider does not support a specific feature, the get function for the feature returns an error. To prevent problems, you can check which data features are available in your map provider using the maps_service_provider_is_data_supported() function.

-
- - + + + + + + + +
Note
Different map providers are capable of providing different sets of route data features. Some map providers can extend the route data features with extra properties that are not specified in the Maps Service API. Such properties are organized as a key-value storage where the keys are the names of the properties. +

If your map provider does not support a specific feature, the get function for the feature returns an error. To prevent problems, you can check which data features are available in your map provider using the maps_service_provider_is_data_supported() function.

+
+ +

To parse route data:

-
  1. To get the route information features, such as route ID, origin, destination, and total distance, use the following functions with a maps_route_h place handle:

    +
    1. To get the route information features, such as route ID, origin, destination, and total distance, use the following functions with a maps_route_h place handle:

      • To obtain the route ID, use the maps_route_get_route_id() function:
        @@ -1199,7 +1276,7 @@ if (error != MAPS_ERROR_NONE)
         var _gaq = _gaq || [];
         _gaq.push(['_setAccount', 'UA-25976949-1']);
         _gaq.push(['_trackPageview']);
        -(function() 
        +(function()
         {
         	var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
         	ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
        -- 
        2.7.4