From owner-svn-ports-head@FreeBSD.ORG Fri May 22 08:41:10 2015 Return-Path: Delivered-To: svn-ports-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 68E21C6D; Fri, 22 May 2015 08:41:10 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4AD8A128D; Fri, 22 May 2015 08:41:10 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t4M8fAPh082951; Fri, 22 May 2015 08:41:10 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t4M8f9M5082949; Fri, 22 May 2015 08:41:09 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201505220841.t4M8f9M5082949@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Fri, 22 May 2015 08:41:09 +0000 (UTC) To: ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org Subject: svn commit: r386994 - in head/astro/foxtrotgps: . files X-SVN-Group: ports-head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-ports-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the ports tree for head List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 May 2015 08:41:10 -0000 Author: glebius (src committer) Date: Fri May 22 08:41:09 2015 New Revision: 386994 URL: https://svnweb.freebsd.org/changeset/ports/386994 Log: Provide patch from future version to fix yournavigation.org API. PR: 200366 Approved by: Craig Whipp (maintainer) Added: head/astro/foxtrotgps/files/ head/astro/foxtrotgps/files/patch-src_tracks.c (contents, props changed) Modified: head/astro/foxtrotgps/Makefile Modified: head/astro/foxtrotgps/Makefile ============================================================================== --- head/astro/foxtrotgps/Makefile Fri May 22 08:40:36 2015 (r386993) +++ head/astro/foxtrotgps/Makefile Fri May 22 08:41:09 2015 (r386994) @@ -3,6 +3,7 @@ PORTNAME= foxtrotgps PORTVERSION= 1.2.0 +PORTREVISION= 1 CATEGORIES= astro geography MASTER_SITES= http://www.foxtrotgps.org/releases/ Added: head/astro/foxtrotgps/files/patch-src_tracks.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/astro/foxtrotgps/files/patch-src_tracks.c Fri May 22 08:41:09 2015 (r386994) @@ -0,0 +1,123 @@ +--- src/tracks.c.orig 2015-05-21 11:26:32 UTC ++++ src/tracks.c +@@ -41,8 +41,10 @@ bbox_t get_track_bbox(GSList *track); + GSList * load_log_file_into_list(char *file); + GSList * load_gpx_file_into_list(char *file); + GSList * load_ols_XML_file_into_list(char *file); ++GSList * load_kml_XML_file_into_list(char *file); + GSList * parse_gpx_nodes(xmlNode *node); + GSList * parse_ols_XML_nodes(xmlNode *node); ++GSList * parse_kml_XML_nodes(xmlNode *node); + + void * fetch_track_thread(void *ptr); + void * fetch_openrouteservice_track_thread(void *ptr); +@@ -662,6 +664,30 @@ load_ols_XML_string_into_list(char *ols_ + } + + GSList * ++load_kml_XML_string_into_list(char *kml_string) ++{ ++ GSList *list = NULL; ++ xmlDoc *doc = NULL; ++ xmlNode *root_element = NULL; ++ ++ if(!kml_string) return NULL; ++ ++ LIBXML_TEST_VERSION ++ ++ doc = xmlReadMemory(kml_string, strlen(kml_string), "noname.xml", NULL, 0); ++ ++ if (doc == NULL) { ++ fprintf (stderr, _("Failed to parse document\n")); ++ } else { ++ root_element = xmlDocGetRootElement(doc); ++ list = parse_kml_XML_nodes(root_element); ++ xmlFreeDoc(doc); ++ } ++ ++ return list; ++} ++ ++GSList * + parse_gpx_nodes(xmlNode *node) + { + xmlNode *cur_node = NULL; +@@ -754,6 +780,60 @@ parse_ols_XML_nodes(xmlNode *node) + return list; + } + ++GSList * ++parse_kml_XML_nodes(xmlNode *node) ++{ ++ xmlNode *cur_node = NULL; ++ GSList *list = NULL; ++ ++ for (cur_node = node; cur_node; cur_node = cur_node->next) ++ { ++ if (xmlStrEqual(cur_node->name, BAD_CAST "Placemark")) ++ { ++ xmlNode *geometry_node = cur_node->children; ++ while (geometry_node != NULL) ++ { ++ if (xmlStrEqual(geometry_node->name, BAD_CAST "LineString")) ++ { ++ xmlNode *inner_cur_node = geometry_node->children; ++ while (inner_cur_node != NULL) ++ { ++ if (xmlStrEqual(inner_cur_node->name, BAD_CAST "coordinates")) { ++ char** lonlatlist; ++ lonlatlist = g_strsplit(xmlNodeGetContent(inner_cur_node), "\n", -1); ++ for(unsigned int i = 0; lonlatlist[i]; i++){ ++ g_strchug(lonlatlist[i]); ++ g_strchomp(lonlatlist[i]); ++ char** lonlat = g_strsplit(lonlatlist[i], ",", 2); ++ if (lonlat[0]) ++ { ++ double lat, lon; ++ lon = atof(lonlat[0]); ++ if (lonlat[1]) ++ { ++ trackpoint_t *tp = g_new0(trackpoint_t,1); ++ lat = atof(lonlat[1]); ++ tp->lat = deg2rad(lat); ++ tp->lon = deg2rad(lon); ++ list = g_slist_append(list, tp); ++ } ++ } ++ g_strfreev (lonlat); ++ } ++ g_strfreev (lonlatlist); ++ } ++ inner_cur_node = inner_cur_node->next; ++ } ++ } ++ geometry_node = geometry_node->next; ++ } ++ } ++ list = g_slist_concat(list, parse_kml_XML_nodes(cur_node->children)); ++ } ++ ++ return list; ++} ++ + + void + fetch_track(GtkWidget *widget, char *service, char *start, char *end) +@@ -796,7 +876,7 @@ void fetch_yournavigation_track(GtkWidge + dialog10 = widget; + printf("%s(): %s, %s\n",__PRETTY_FUNCTION__, start, end); + +- url = g_strdup_printf("http://www.yournavigation.org/api/dev/gosmore.php?format=gpx&flat=%s&flon=%s&tlat=%s&tlon=%s&v=motorcar&fast=1&layer=mapnik",startlatstr, startlonstr, endlatstr, endlonstr); ++ url = g_strdup_printf("http://www.yournavigation.org/api/1.0/gosmore.php?format=kml&flat=%s&flon=%s&tlat=%s&tlon=%s&v=motorcar&fast=1&layer=mapnik",startlatstr, startlonstr, endlatstr, endlonstr); + if (!g_thread_create(&fetch_track_thread, (void *)url, FALSE, NULL) != 0) + g_warning("### can't create route thread\n"); + } +@@ -1002,7 +1082,7 @@ fetch_track_thread(void *ptr) + + printf("HTTP-GET: size: %d, statuscode %d \n", (int)reply->size, (int)reply->status_code); + +- loaded_track = load_gpx_string_into_list(reply->data); ++ loaded_track = load_kml_XML_string_into_list(reply->data); + process_fetched_track(reply, true); + + return NULL;