00f452ac206de0ca2bbd73d4d731abd75c2dbceb
[platform/core/location/maps-plugin-mapzen.git] / src / mapzen / mapzen_types.h
1 /*
2  * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16
17 #ifndef _MAPZEN_TYPES_H_
18 #define _MAPZEN_TYPES_H_
19
20 #include <glib.h>
21
22 typedef enum {
23         MAPZEN_ERROR_NONE = 0,                /**< Successful */
24         MAPZEN_ERROR_PERMISSION_DENIED,       /**< Permission Denied */
25         MAPZEN_ERROR_OUT_OF_MEMORY,           /**< Out of memory */
26         MAPZEN_ERROR_INVALID_PARAMETER,       /**< Invalid parameter */
27         MAPZEN_ERROR_NOT_SUPPORTED,           /**< Not supported */
28         MAPZEN_ERROR_CONNECTION_TIMED_OUT,    /**< Timeout error, no answer */
29         MAPZEN_ERROR_NETWORK_UNREACHABLE,     /**< Network unavailable */
30         MAPZEN_ERROR_INVALID_OPERATION,       /**< Opeartion is not valid */
31         MAPZEN_ERROR_KEY_NOT_AVAILABLE,       /**< Invalid key */
32         MAPZEN_ERROR_RESOURCE_BUSY,           /**< Resource busy */
33         MAPZEN_ERROR_CANCELED,                /**< Service canceled */
34         MAPZEN_ERROR_UNKNOWN,                 /**< Unknown error */
35         MAPZEN_ERROR_SERVICE_NOT_AVAILABLE,   /**< Service unavailabe*/
36         MAPZEN_ERROR_NOT_FOUND,               /**< Result not found */
37 } mapzen_error_e;
38
39 typedef enum {
40         MAPZEN_BOUNDARY_NONE = 0,       /*  Undefined geographical area type. */
41         MAPZEN_BOUNDARY_RECT,           /*  Rectangular geographical area type. */
42         MAPZEN_BOUNDARY_CIRCLE, /*  Circle geographical area type. */
43 } boundary_type;
44
45 typedef enum {
46         COSTING_AUTO = 0,
47         COSTING_AUTO_SHORTER,
48         COSTING_BICYCLE,
49         COSTING_MULTIMODAL,
50         COSTING_PEDESTRIAN
51 } route_type;
52
53 typedef enum {
54         UNIT_M = 0,     /* for miles */
55         UNIT_KM /* for kilometers */
56 } route_unit;
57
58 typedef enum {
59         PENALTY_NONE = 0, //TODO: Mapzen does not have currently
60         PENALTY_LIMITED_ACCESS, //TODO: Mapzen does not have currently
61         PENALTY_TOLL_ROADS, //set to > 0 to avoid
62         PENALTY_USE_FERRY, //This is range of values between 0 and 1. Values near 0 attempt to avoid ferries and
63                                  //values near 1 will favor ferries.
64         PENALTY_USE_UNPAVED, //TODO: Mapzen does not have currently
65         PENALTY_SEASONAL_CLOSURE, //TODO: Mapzen does not have currently
66         PENALTY_COUNTRY_CROSSING // set to > 0 to avoid
67 } route_feature_avoids;
68
69 typedef enum {
70         DRIVING_STYLE_NORMAL = 0,
71         DRIVING_STYLE_CAUTIOUS,
72         DRIVING_STYLE_AGGRESSIVE
73 } route_driving_style;
74
75 typedef enum {
76         TANGRAM_VIEW_NORMAL = 0,
77         TANGRAM_VIEW_TERRAIN,
78         TANGRAM_VIEW_SATELLITE,
79         TANGRAM_VIEW_HYBRID,
80         TANGRAM_VIEW_NOT_SUPPORTED
81 } tangram_view_type;
82
83 typedef struct {
84         gdouble latitude;
85         gdouble longitude;
86 } coords_s;
87
88 typedef struct {
89         coords_s top_left;
90         coords_s bottom_right;
91 } rectangle_s;
92
93 typedef struct {
94         coords_s center;
95         gdouble radius;
96 } circle_s;
97
98 typedef struct {
99         boundary_type type;
100         union {
101                 rectangle_s rect;
102                 circle_s circle;
103         };
104 } mapzen_boundary_s;
105
106 typedef struct {
107         gchar *maps_key;
108         gchar *address;
109         mapzen_boundary_s *boundary;
110         gint num_res;
111 } mapzen_geocode_req_s;
112
113 typedef struct {
114         gchar *maps_key;
115         gint num_res;
116         coords_s coordinates;
117 } mapzen_revgeocode_req_s;
118
119 typedef struct {
120         gchar *maps_key;
121         gchar *search_string;
122         gchar *categories;
123         gint num_res;
124         mapzen_boundary_s *boundary;
125 } mapzen_search_req_s;
126
127 typedef struct {
128         gchar *maps_key;
129         gchar *uri;
130 } mapzen_get_details_req_s;
131
132 typedef struct {
133         gchar *maps_key;
134         coords_s from;
135         coords_s to;
136         route_unit unit;
137         route_type type;
138         route_feature_avoids avoids;            /* List of type strings. (Limited Access, Toll Road, Ferry, Unpaved, Seasonal Closure, Country Crossing) */
139         route_driving_style driving_style;      /* (1 - cautious, 2 - normal, 3 - aggressive) */
140         GList *way_points;                              /* List of type coords_s */
141 } mapzen_route_req_s;
142
143 typedef struct {
144         gint zoom_level;
145         coords_s center_coords;
146 } mapzen_tiledata_req_s;
147
148 typedef struct {
149         gchar *street;
150         gchar *neighbourhood;
151         gchar *housenumber;
152         gchar *localadmin;
153         gchar *county;
154         gchar *region;
155         gchar *country;
156         gchar *country_a;
157         gchar *postalcode;
158 } mapzen_address_resp_s;
159
160 typedef struct {
161         gchar *place_id;
162         gchar *display_name;
163         mapzen_address_resp_s *address;
164         coords_s coordinates;
165         GList *categories;
166 } mapzen_place_resp_s;
167
168 typedef struct {
169         guint type;
170         guint direction;
171         guint text;
172         gchar *icon_url;
173 } mapzen_route_maneuver_signs;
174
175 typedef struct {
176         coords_s start_point;
177         coords_s end_point;
178         gdouble distance;
179         guint time;
180         gchar *formatted_time;
181         guint attribute;
182         guint turn_type;
183         guint direction;
184         gchar *instruction;
185         gchar *direction_name;
186         guint index;
187         gchar *street_name;
188 } mapzen_route_maneuver;
189
190 typedef struct {
191         rectangle_s bounding_box;
192         gdouble distance;
193         route_unit distance_unit;
194         guint time;
195         gchar *formatted_time;
196         route_type type;
197         GList *maneuvers;               /* List of type mapzen_route_maneuver */
198         GList *shapePoints;
199 } mapzen_route_resp_s;
200
201 #endif /* _MAPZEN_TYPES_H_ */