From 56450c52cf4f76e80bff8acd953e3d8451a1d015 Mon Sep 17 00:00:00 2001 From: Homes32 Date: Wed, 25 Feb 2026 21:45:39 -0600 Subject: [PATCH] fixed ground tracks not being drawn after GooCanvas->GTKCanvas/Cairo migration --- src/gtk-sat-map-ground-track.c | 9 +-------- src/gtk-sat-map-ground-track.h | 6 ++++++ src/gtk-sat-map.c | 22 +++++++++------------- 3 files changed, 16 insertions(+), 21 deletions(-) diff --git a/src/gtk-sat-map-ground-track.c b/src/gtk-sat-map-ground-track.c index 8ad708a3..2678feaa 100644 --- a/src/gtk-sat-map-ground-track.c +++ b/src/gtk-sat-map-ground-track.c @@ -46,13 +46,6 @@ #include "sat-log.h" #include "sgpsdp/sgp4sdp4.h" - -/** Structure to hold line segment data */ -typedef struct { - gdouble *points; /*!< Array of x,y coordinate pairs */ - gint count; /*!< Number of points in this segment */ -} line_segment_t; - static void create_polylines(GtkSatMap * satmap, sat_t * sat, qth_t * qth, sat_map_obj_t * obj); static gboolean ssp_wrap_detected(GtkSatMap * satmap, gdouble x1, gdouble x2); @@ -387,7 +380,7 @@ static void create_polylines(GtkSatMap * satmap, sat_t * sat, qth_t * qth, /* add SSP to list */ points = g_slist_prepend(points, ssp); lastx = ssp->lon; - lasty = ssp->lon; + lasty = ssp->lat; } /* else do nothing */ else g_free(ssp); diff --git a/src/gtk-sat-map-ground-track.h b/src/gtk-sat-map-ground-track.h index bf839ec5..3bb872b3 100644 --- a/src/gtk-sat-map-ground-track.h +++ b/src/gtk-sat-map-ground-track.h @@ -31,6 +31,12 @@ #include "gtk-sat-map.h" +/** Structure to hold line segment data */ +typedef struct { + gdouble *points; /*!< Array of x,y coordinate pairs */ + gint count; /*!< Number of points in this segment */ +} line_segment_t; + void ground_track_create(GtkSatMap * satmap, sat_t * sat, qth_t * qth, sat_map_obj_t * obj); diff --git a/src/gtk-sat-map.c b/src/gtk-sat-map.c index 071a9823..2305d866 100644 --- a/src/gtk-sat-map.c +++ b/src/gtk-sat-map.c @@ -457,8 +457,6 @@ static gboolean on_draw(GtkWidget * widget, cairo_t * cr, gpointer data) gchar hmf = ' '; guint32 globe_shadow_col; GSList *line_node; - gdouble *line_points; - guint num_points; (void)widget; @@ -613,20 +611,18 @@ static gboolean on_draw(GtkWidget * widget, cairo_t * cr, gpointer data) line_node = obj->track_data.lines; while (line_node) { - line_points = (gdouble *)line_node->data; - if (line_points) + line_segment_t *seg = (line_segment_t *)line_node->data; + + if (seg && seg->points && seg->count > 1) { - num_points = (guint)line_points[0]; - if (num_points > 1) + cairo_move_to(cr, seg->points[0], seg->points[1]); + + for (i = 1; i < (guint)seg->count; i++) { - cairo_move_to(cr, line_points[1], line_points[2]); - for (i = 1; i < num_points; i++) - { - cairo_line_to(cr, line_points[2 * i + 1], - line_points[2 * i + 2]); - } - cairo_stroke(cr); + cairo_line_to(cr, seg->points[2 * i], + seg->points[2 * i + 1]); } + cairo_stroke(cr); } line_node = line_node->next; }