static void path_init(Path *path);
static gboolean path_resize(Path *path, guint size);
-static void path_check_waypoint_announce(Path *path);
-
static void
path_dispose(GObject *object)
{
signals[NEW_POINT]=g_signal_new("new-point", G_OBJECT_CLASS_TYPE(object_class),
G_SIGNAL_RUN_FIRST, G_STRUCT_OFFSET(PathClass, new_point),
NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0, NULL);
+
signals[NEW_BREAK]=g_signal_new("new-break", G_OBJECT_CLASS_TYPE(object_class),
G_SIGNAL_RUN_FIRST, G_STRUCT_OFFSET(PathClass, new_break),
NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0, NULL);
+
signals[NEW_WAYPOINT]=g_signal_new("new-waypoint", G_OBJECT_CLASS_TYPE(object_class),
G_SIGNAL_RUN_FIRST, G_STRUCT_OFFSET(PathClass, new_waypoint),
NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0, NULL);
+
+signals[NEAR_WAYPOINT]=g_signal_new("near-waypoint", G_OBJECT_CLASS_TYPE(object_class),
+ G_SIGNAL_RUN_FIRST, G_STRUCT_OFFSET(PathClass, near_waypoint),
+ NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0, NULL);
+
+signals[REACHED_WAYPOINT]=g_signal_new("reached-waypoint", G_OBJECT_CLASS_TYPE(object_class),
+ G_SIGNAL_RUN_FIRST, G_STRUCT_OFFSET(PathClass, reached_waypoint),
+ NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0, NULL);
+
}
static void
p->type=type;
p->id=id;
p->sensitivity=3;
+p->announce_waypoints=FALSE;
if (time1==0) {
time1=time(NULL);
}
return FALSE;
-
}
/**
/**
* path_check_waypoint_announce:
* @path
- * @lat
- * @lon
*
* Check if we should announce upcoming waypoint.
*
*/
-static void
+void
path_check_waypoint_announce(Path *path)
{
guint a_thres_near, a_thres_at;
g_return_if_fail(path);
+if (!path->announce_waypoints)
+ return;
+
+if (path->whead==path->wtail)
+ return;
+
if (!path->next_way)
return;
Point *next_wpt;
guint64 next_wpt_dist_squared;
- /* The waypoint we last announced */
+ /* The waypoint announcements vars */
WayPoint *announced_waypoint;
gint announce_notice_ratio;
+ gboolean announce_waypoints;
/* Path statistics */
guint32 points;
void (*new_point) (Path *path);
void (*new_break) (Path *path);
void (*new_waypoint) (Path *path);
+ void (*near_waypoint) (Path *path);
+ void (*reached_waypoint) (Path *path);
};
/* Null point */
gboolean path_has_points(Path *path);
gboolean path_has_waypoints(Path *path);
+void path_check_waypoint_announce(Path *path);
gboolean path_set_destination_from_last(Path *path, Position *pos);