diff options
author | Tomaz Canabrava <tcanabrava@kde.org> | 2013-05-09 18:02:52 -0300 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2013-05-09 17:50:06 -0700 |
commit | cb8198b5243df425b6baa4d2fa4b5edb619b2855 (patch) | |
tree | 8a443b9733376b084fd267a3604ee3068876d7f6 /qt-ui | |
parent | b794c23099f97cefd0a65b070fc9aa9dd5523e87 (diff) | |
download | subsurface-cb8198b5243df425b6baa4d2fa4b5edb619b2855.tar.gz |
Plot the vertical ruler on the left of the profile.
Plot the numbers on the left of the profile.
It seems that everythign is being plotted -
But I can see that there are coordinate-errors on the
code. ( the GTK one plots some curves below of the
dive, but the Qt one is overlapping - probably the
way that I'm using the gc information)
Need to investigate a bit.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-ui')
-rw-r--r-- | qt-ui/profilegraphics.cpp | 41 | ||||
-rw-r--r-- | qt-ui/profilegraphics.h | 2 |
2 files changed, 37 insertions, 6 deletions
diff --git a/qt-ui/profilegraphics.cpp b/qt-ui/profilegraphics.cpp index 91e230e91..625dfdf10 100644 --- a/qt-ui/profilegraphics.cpp +++ b/qt-ui/profilegraphics.cpp @@ -276,16 +276,18 @@ void ProfileGraphicsView::plot(struct dive *dive) plot_pp_text(); //} -#if 0 + /* now shift the translation back by half the margin; * this way we can draw the vertical scales on both sides */ - cairo_translate(gc->cr, -drawing_area->x / 2.0, 0); - gc->maxx += drawing_area->x; - gc->leftx = -(drawing_area->x / drawing_area->width) / 2.0; - gc->rightx = 1.0 - gc->leftx; + //cairo_translate(gc->cr, -drawing_area->x / 2.0, 0); + + //gc->maxx += drawing_area->x; + //gc->leftx = -(drawing_area->x / drawing_area->width) / 2.0; + //gc->rightx = 1.0 - gc->leftx; - plot_depth_scale(gc, pi); + plot_depth_scale(); +#if 0 if (gc->printer) { free(pi->entry); last_pi_entry = pi->entry = NULL; @@ -294,6 +296,33 @@ void ProfileGraphicsView::plot(struct dive *dive) #endif } +void ProfileGraphicsView::plot_depth_scale() +{ + int i, maxdepth, marker; + static text_render_options_t tro = {DEPTH_TEXT_SIZE, SAMPLE_DEEP, RIGHT, MIDDLE}; + + /* Depth markers: every 30 ft or 10 m*/ + maxdepth = get_maxdepth(&gc.pi); + gc.topy = 0; gc.bottomy = maxdepth; + + switch (prefs.units.length) { + case units::METERS: marker = 10000; break; + case units::FEET: marker = 9144; break; /* 30 ft */ + } + + QColor c(profile_color[DEPTH_GRID].first()); + + /* don't write depth labels all the way to the bottom as + * there may be other graphs below the depth plot (like + * partial pressure graphs) where this would look out + * of place - so we only make sure that we print the next + * marker below the actual maxdepth of the dive */ + for (i = marker; i <= gc.pi.maxdepth + marker; i += marker) { + double d = get_depth_units(i, NULL, NULL); + plot_text(&tro, -0.002, i, QString::number(d)); + } +} + void ProfileGraphicsView::plot_pp_text() { double pp, dpp, m; diff --git a/qt-ui/profilegraphics.h b/qt-ui/profilegraphics.h index ca0aaedf9..394a97a9f 100644 --- a/qt-ui/profilegraphics.h +++ b/qt-ui/profilegraphics.h @@ -107,6 +107,8 @@ private: void plot_deco_text(); void plot_pp_gas_profile(); void plot_pp_text(); + void plot_depth_scale(); + QColor get_sac_color(int sac, int avg_sac); QPen defaultPen; |