From a691a8e5a35f2277d9a8c911696a4d0a394bb42e Mon Sep 17 00:00:00 2001 From: Dirk Hohndel Date: Sun, 16 Dec 2012 22:02:42 -1000 Subject: [PATCH] Improve visual appearance of horizontal marker lines This changes two things to improve the appearance of the profile: - the partial pressure scale is now in 0.5 increments if the total is <= 4 and in 1.0 increments if it is > 4. - the depth marker lines end slightly below the depth chart so that we no longer have overlap between the depth scale and the partial pressure scale. Signed-off-by: Dirk Hohndel --- profile.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/profile.c b/profile.c index a1f8c6bfb..3bc5e8ed1 100644 --- a/profile.c +++ b/profile.c @@ -552,7 +552,7 @@ static void plot_pp_text(struct graphics_context *gc, struct plot_info *pi) setup_pp_limits(gc, pi); pp = floor(pi->maxpp * 10.0) / 10.0 + 0.2; - dpp = floor(2.0 * pp) / 10.0; + dpp = pp > 4 ? 1.0 : 0.5; hpos = pi->entry[pi->nr - 1].sec; set_source_rgba(gc, PP_LINES); for (m = 0.0; m <= pp; m += dpp) { @@ -653,7 +653,7 @@ static void plot_depth_profile(struct graphics_context *gc, struct plot_info *pi cairo_t *cr = gc->cr; int sec, depth; struct plot_data *entry; - int maxtime, maxdepth, marker; + int maxtime, maxdepth, marker, maxline; int increments[8] = { 10, 20, 30, 60, 5*60, 10*60, 15*60, 30*60 }; /* Get plot scaling limits */ @@ -705,9 +705,9 @@ static void plot_depth_profile(struct graphics_context *gc, struct plot_info *pi case METERS: marker = 10000; break; case FEET: marker = 9144; break; /* 30 ft */ } - + maxline = MAX(pi->maxdepth + marker, maxdepth * 2 / 3); set_source_rgba(gc, DEPTH_GRID); - for (i = marker; i < maxdepth; i += marker) { + for (i = marker; i < maxline; i += marker) { move_to(gc, 0, i); line_to(gc, 1, i); }