Skip to content

Commit 1879bf3

Browse files
homes32csete
authored andcommitted
fixed ground tracks not being drawn after GooCanvas->GTKCanvas/Cairo migration
1 parent 1124f5a commit 1879bf3

3 files changed

Lines changed: 16 additions & 21 deletions

File tree

src/gtk-sat-map-ground-track.c

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -46,13 +46,6 @@
4646
#include "sat-log.h"
4747
#include "sgpsdp/sgp4sdp4.h"
4848

49-
50-
/** Structure to hold line segment data */
51-
typedef struct {
52-
gdouble *points; /*!< Array of x,y coordinate pairs */
53-
gint count; /*!< Number of points in this segment */
54-
} line_segment_t;
55-
5649
static void create_polylines(GtkSatMap * satmap, sat_t * sat, qth_t * qth,
5750
sat_map_obj_t * obj);
5851
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,
387380
/* add SSP to list */
388381
points = g_slist_prepend(points, ssp);
389382
lastx = ssp->lon;
390-
lasty = ssp->lon;
383+
lasty = ssp->lat;
391384
}
392385
/* else do nothing */
393386
else g_free(ssp);

src/gtk-sat-map-ground-track.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,12 @@
3131

3232
#include "gtk-sat-map.h"
3333

34+
/** Structure to hold line segment data */
35+
typedef struct {
36+
gdouble *points; /*!< Array of x,y coordinate pairs */
37+
gint count; /*!< Number of points in this segment */
38+
} line_segment_t;
39+
3440
void ground_track_create(GtkSatMap * satmap, sat_t * sat,
3541
qth_t * qth, sat_map_obj_t * obj);
3642

src/gtk-sat-map.c

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -457,8 +457,6 @@ static gboolean on_draw(GtkWidget * widget, cairo_t * cr, gpointer data)
457457
gchar hmf = ' ';
458458
guint32 globe_shadow_col;
459459
GSList *line_node;
460-
gdouble *line_points;
461-
guint num_points;
462460

463461
(void)widget;
464462

@@ -613,20 +611,18 @@ static gboolean on_draw(GtkWidget * widget, cairo_t * cr, gpointer data)
613611
line_node = obj->track_data.lines;
614612
while (line_node)
615613
{
616-
line_points = (gdouble *)line_node->data;
617-
if (line_points)
614+
line_segment_t *seg = (line_segment_t *)line_node->data;
615+
616+
if (seg && seg->points && seg->count > 1)
618617
{
619-
num_points = (guint)line_points[0];
620-
if (num_points > 1)
618+
cairo_move_to(cr, seg->points[0], seg->points[1]);
619+
620+
for (i = 1; i < (guint)seg->count; i++)
621621
{
622-
cairo_move_to(cr, line_points[1], line_points[2]);
623-
for (i = 1; i < num_points; i++)
624-
{
625-
cairo_line_to(cr, line_points[2 * i + 1],
626-
line_points[2 * i + 2]);
627-
}
628-
cairo_stroke(cr);
622+
cairo_line_to(cr, seg->points[2 * i],
623+
seg->points[2 * i + 1]);
629624
}
625+
cairo_stroke(cr);
630626
}
631627
line_node = line_node->next;
632628
}

0 commit comments

Comments
 (0)