4 * Copyright (c) 2010-2013 Samsung Electronics Co., Ltd. All rights reserved.
6 * Contact: Youngae Kang <youngae.kang@samsung.com>, Minjune Kim <sena06.kim@samsung.com>
7 * Genie Kim <daejins.kim@samsung.com>
9 * Licensed under the Apache License, Version 2.0 (the "License");
10 * you may not use this file except in compliance with the License.
11 * You may obtain a copy of the License at
13 * http://www.apache.org/licenses/LICENSE-2.0
15 * Unless required by applicable law or agreed to in writing, software
16 * distributed under the License is distributed on an "AS IS" BASIS,
17 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18 * See the License for the specific language governing permissions and
19 * limitations under the License.
22 //http://www.yournavigation.org/api/1.0/gosmore.php?format=geojson&flat=52.215676&flon=5.963946&tlat=52.2573&tlon=6.1799&v=motorcar&fast=1&layer=mapnik
23 //http://www.yournavigation.org/api/1.0/gosmore.php?formats=geojson/&flat=52.215676&flot=5.963946&tlat=52.257300&tlon=6.179900&v=carmotor&fast=1&instructions=1&layer=mapnik
24 //http://www.yournavigation.org/api/1.0/gosmore.php?format=geojson&flat=52.215676&flon=5.963946&tlat=52.2573&tlon=6.179900&v=motorcar&fast=1&instructions=1&layer=mapnik
31 const char *YOURS_SERVER = "http://www.yournavigation.org/api/1.0/gosmore.php?";
32 const char *YOURS_FORMAT = "format=";
33 const char *YOURS_INSTRUCTIONS = "instructions=";
34 const char *YOURS_TYPE = "v=";
35 const char *YOURS_FAST = "fast=";
36 const char *YOURS_END = "layer=mapnik";
38 const char *YOURS_FORMAT_KML = "kml";
39 const char *YOURS_FORMAT_GEOJSON = "geojson";
41 const char *YOURS_SET_ON = "1";
42 const char *YOURS_SET_OFF = "0";
44 const char delimeter = '&';
46 static int _add_option (char *buf, const char *key, const char *option)
48 if (!buf || !option) return -1;
50 if (strlen(buf) == 0) { //create
51 strncpy(buf, YOURS_SERVER, strlen (YOURS_SERVER));
53 if (key) strncat(buf, key, strlen (key));
54 strncat(buf, option, strlen (option));
57 strncat(buf, &delimeter, 1);
58 if (key) strncat(buf, key, strlen (key));
59 strncat(buf, option, strlen (option));
65 char* yournavi_create_url (gdouble flat, gdouble flon, gdouble tlat, gdouble tlon, GList *way, int type, char *mode ,int instruction)
67 char url[1024] = {0, };
68 char pos_str[64] = {0, };
70 //TODO WAYPOINT : Not supported
74 _add_option(url, YOURS_FORMAT, YOURS_FORMAT_KML);
76 _add_option(url, YOURS_FORMAT, YOURS_FORMAT_GEOJSON);
79 snprintf(pos_str, 64, "flat=%f&flot=%f&tlat=%f&tlon=%f", flat, flon, tlat, tlon);
80 _add_option (url, NULL, pos_str);
82 _add_option (url, YOURS_TYPE, mode);
85 _add_option (url, YOURS_FAST, YOURS_SET_ON);
87 _add_option (url, YOURS_FAST, YOURS_SET_OFF);
90 _add_option (url, YOURS_INSTRUCTIONS, YOURS_SET_ON);
92 _add_option (url, NULL, YOURS_END);
94 MOD_LOGW ("URL[%s]", url);