From: Kaj-Michael Lang Date: Wed, 11 Jun 2008 08:08:59 +0000 (+0300) Subject: Path: Fix and start to add gtk-doc comments X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=32086f6aefe0398a62c938b73d3419fd285ced8b;p=mapper Path: Fix and start to add gtk-doc comments --- diff --git a/src/path.c b/src/path.c index ea6991a..af3c92c 100644 --- a/src/path.c +++ b/src/path.c @@ -165,7 +165,7 @@ path->length=path->avgspeed=0.0; path->points=0; } -gboolean +static gboolean path_resize(Path *path, guint size) { g_return_val_if_fail(path, FALSE); @@ -189,7 +189,7 @@ if (path->head + size != path->cap) { return FALSE; } -gboolean +static gboolean path_wresize(Path *path, guint wsize) { g_return_val_if_fail(path, FALSE); @@ -207,7 +207,15 @@ return FALSE; } /** + * path_add_waypoint: + * @path + * @lat + * @lon + * @desc + * * Append a waypoint to path at given lat, lon with description desc + * + * Returns: TRUE */ gboolean path_add_waypoint(Path *path, gdouble lat, gdouble lon, gchar *desc) @@ -233,6 +241,10 @@ return TRUE; } /** + * path_add_point: + * @path + * @gps + * * Append a path point to path * * Returns: TRUE if the new point was added. FALSE is returned if new point distance was under sensitivity setting. @@ -276,6 +288,14 @@ if (abs((gint)unitx-path->tail->unitx) > path->sensitivity || abs((gint)unity-pa return FALSE; } +/** + * path_add_break: + * @path + * + * Add a break point to the path. + * + * Returns: TRUE if break was added, FALSE if last point was a break already. + */ gboolean path_add_break(Path *path) { @@ -283,8 +303,6 @@ g_return_val_if_fail(path, FALSE); g_return_val_if_fail(path->tail, FALSE); if (path->tail->unity && path->tail->unitx) { - guint x1, y1; - /* To mark a "break" in a track, we'll add a (0, 0) point and then another instance of the most recent track point. */ @@ -300,6 +318,14 @@ if (path->tail->unity && path->tail->unitx) { return FALSE; } +/** + * path_has_points: + * @path + * + * Checks if given path has any path points + * + * Returns: TRUE if there are points, FALSE otherwise + */ gboolean path_has_points(Path *path) { @@ -307,6 +333,13 @@ g_return_val_if_fail(path, FALSE); return path->head==path->tail ? FALSE : TRUE; } +/** + * path_has_waypoints: + * + * Checks if given path has any waypoints + * + * Returns: TRUE if there are waypoints, FALSE otherwise + */ gboolean path_has_waypoints(Path *path) { @@ -314,6 +347,12 @@ g_return_val_if_fail(path, FALSE); return path->whead==path->wtail ? FALSE : TRUE; } +/** + * path_find_last_point: + * @path + * + * Returns: The last path point or NULL if path is empty + */ Point * path_find_last_point(Path *path) { @@ -335,7 +374,7 @@ return p; * the entire list (starting from near_point) is searched. Otherwise, we * stop searching when we find a point that is farther away. */ -gboolean +static gboolean path_update_nears(Path *path, Point *point, gboolean quick) { gboolean ret = FALSE; @@ -427,6 +466,8 @@ return ret; } /** + * path_find_nearest_point: + * * Reset the near_point data by searching the entire path for the nearest point and waypoint. */ void @@ -452,6 +493,10 @@ path->next_wpt_dist_squared=-1; } +/** + * path_find_nearest_waypoint: + * + */ WayPoint * path_find_nearest_waypoint(Path *path, guint unitx, guint unity) { @@ -476,7 +521,7 @@ if (wcurr && wcurr->point && wcurr!=path->wtail) { } if (wnear && wnear->point) { - if (abs(unitx - wnear->point->unitx) < pixel2unit(3 * path->sensitivity) && abs(unity - wnear->point->unity) < pixel2unit(3 * path->sensitivity)) + if (abs(unitx - wnear->point->unitx) < path->sensitivity && abs(unity - wnear->point->unity) < path->sensitivity) return wnear; } @@ -484,12 +529,17 @@ return NULL; } /** - * Check if we should announce upcoming waypoint. + * path_check_waypoint_announce: + * @path + * @gps + * + * Check if we should announce upcoming waypoint. + * */ -void -path_check_waypoint_announce(Path *route, GpsData *gps) +static void +path_check_waypoint_announce(Path *path, GpsData *gps) { -guint a_thres_near, a_thre_at; +guint a_thres_near, a_thres_at; g_return_if_fail(path); g_return_if_fail(gps); @@ -502,10 +552,11 @@ a_thres_at=(20+(guint)gps->speed); if (path->next_way_dist_squared<(a_thres_near * a_thres_near) && path->next_way!=path->announced_waypoint) { g_signal_emit(G_OBJECT(path), signals[NEAR_WAYPOINT], 0, NULL); - announced_waypoint=route->next_way; + path->announced_waypoint=path->next_way; } else if (path->next_way_dist_squared<(a_thres_at * a_thres_at) && path->next_way!=path->announced_waypoint) { g_signal_emit(G_OBJECT(path), signals[REACHED_WAYPOINT], 0, NULL); - announced_waypoint=route->next_way; + path->announced_waypoint=path->next_way; +} } /******************************************************************************/ @@ -625,6 +676,16 @@ if (p) { return TRUE; } +/** + * path_get_waypoint_latlon: + * @way + * @lat + * @lon + * + * Get the real latitude and longitude of given waypoint + * + * Returns: TRUE if waypoint was valid, FALSE otherwise. + */ gboolean path_get_waypoint_latlon(WayPoint *way, gdouble *lat, gdouble *lon) { @@ -644,8 +705,12 @@ return TRUE; } /** - * Add a text description at current point - * + * path_insert_mark_text: + * @path + * @text + * + * Add a new waypoint to path with given text. + * */ void path_insert_mark_text(Path *path, gchar *text) @@ -662,6 +727,13 @@ if (text) { g_signal_emit(G_OBJECT(path), signals[NEW_WAYPOINT], 0, NULL); } +/** + * path_insert_mark_autonumber: + * @path + * + * Add autonumbered waypoint to given path + * + */ void path_insert_mark_autonumber(Path *path) { diff --git a/src/path.h b/src/path.h index 1c437de..b13ee1e 100644 --- a/src/path.h +++ b/src/path.h @@ -127,6 +127,7 @@ struct _Path { /* The waypoint we last announced */ WayPoint *announced_waypoint; + gint announce_notice_ratio; /* Path statistics */ guint32 points;