astro/foxtrotgps: update to 1.2.2

ChangeLog: https://bazaar.launchpad.net/~foxtrotgps-team/foxtrotgps/trunk/revision/317

PR:	248944
Submitted by:	crwhipp@gmail.com (maintainer)
This commit is contained in:
Fernando Apesteguía 2020-08-29 16:46:07 +00:00
parent 6e2ab1603b
commit 6b070bbfa6
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=546924
5 changed files with 16 additions and 146 deletions

View File

@ -2,8 +2,7 @@
# $FreeBSD$
PORTNAME= foxtrotgps
PORTVERSION= 1.2.0
PORTREVISION= 6
PORTVERSION= 1.2.2
CATEGORIES= astro geography
MASTER_SITES= http://www.foxtrotgps.org/releases/
@ -17,25 +16,26 @@ LIB_DEPENDS= libcurl.so:ftp/curl \
libexif.so:graphics/libexif \
libfontconfig.so:x11-fonts/fontconfig \
libfreetype.so:print/freetype2 \
libsoup-2.4.so:devel/libsoup \
libgps.so:astro/gpsd
libgps.so:astro/gpsd \
libsoup-2.4.so:devel/libsoup
INFO= foxtrotgps
GNU_CONFIGURE= yes
CONFIGURE_ENV= DATADIRNAME=share
CONFIGURE_ARGS= --disable-schemas-install
USES= compiler:c++11-lang gettext gmake gnome pkgconfig python \
shebangfix sqlite:3
USE_GNOME= cairo gconf2 gtk20 intltool libglade2 libxml2
GLIB_SCHEMAS= org.foxtrotgps.gschema.xml
INSTALLS_ICONS= yes
SHEBANG_FILES= contrib/convert2gpx \
contrib/convert2osm \
contrib/georss2foxtrotgps-poi\
contrib/gpx2osm \
contrib/poi2osm \
contrib/osb2foxtrot \
contrib/poi2osm
USE_GNOME= gtk20 gconf2 libxml2 intltool libglade2
INSTALLS_ICONS= yes
GNU_CONFIGURE= yes
CONFIGURE_ARGS= --disable-schemas-install
CONFIGURE_ENV= DATADIRNAME=share
GCONF_SCHEMAS= apps_foxtrotgps.schemas
INFO= foxtrotgps
.include <bsd.port.mk>

View File

@ -1,2 +1,3 @@
SHA256 (foxtrotgps-1.2.0.tar.gz) = aa1ffbbf299b7b0f305a0bdbe395266e18305bb9449d621fb88bf8760b55505a
SIZE (foxtrotgps-1.2.0.tar.gz) = 2115329
TIMESTAMP = 1598361882
SHA256 (foxtrotgps-1.2.2.tar.gz) = 1773d591ec5cc57a0695b9f9d909aa0b37f6fa577b1eb1753b3eb8a275e1290a
SIZE (foxtrotgps-1.2.2.tar.gz) = 2165187

View File

@ -12,15 +12,6 @@
static gboolean
cb_gpsd_data(GIOChannel *src, GIOCondition condition, gpointer data)
@@ -744,7 +749,7 @@ cb_gpsd_data(GIOChannel *src, GIOCondition condition,
if (!libgps_initialized)
return FALSE;
- ret = gps_read(&libgps_gpsdata);
+ ret = gps_read(&libgps_gpsdata, NULL, 0);
/* Note that gps_read() will never actually return 0
(zero-length reads are converted internally to a -1 return,
since they mean that the connection to the daemon has closed),
@@ -755,7 +760,7 @@ cb_gpsd_data(GIOChannel *src, GIOCondition condition,
{
gpsdata->satellites_used = libgps_gpsdata.satellites_used;

View File

@ -1,123 +0,0 @@
--- src/tracks.c.orig 2014-10-24 04:57:10 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;

View File

@ -50,3 +50,4 @@ share/pixmaps/foxtrotgps-photo.png
share/pixmaps/foxtrotgps-poi.png
share/pixmaps/foxtrotgps-wp.png
share/pixmaps/foxtrotgps.png
share/GConf/gsettings/org.foxtrotgps.convert