From b794c23099f97cefd0a65b070fc9aa9dd5523e87 Mon Sep 17 00:00:00 2001 From: Tomaz Canabrava Date: Thu, 9 May 2013 17:30:16 -0300 Subject: Plot pp Text This patch plots the PP text, but when I plotted I realized that the gc.pi.mapp is being calculated wrong, probably something went wrong on the calculations - it's comming zered always. So, only one line & text is plotted. Signed-off-by: Tomaz Canabrava --- qt-ui/profilegraphics.cpp | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) (limited to 'qt-ui/profilegraphics.cpp') diff --git a/qt-ui/profilegraphics.cpp b/qt-ui/profilegraphics.cpp index 5425cae32..91e230e91 100644 --- a/qt-ui/profilegraphics.cpp +++ b/qt-ui/profilegraphics.cpp @@ -273,7 +273,7 @@ void ProfileGraphicsView::plot(struct dive *dive) //if (PP_GRAPHS_ENABLED) { plot_pp_gas_profile(); - // plot_pp_text(gc, pi); + plot_pp_text(); //} #if 0 @@ -294,6 +294,27 @@ void ProfileGraphicsView::plot(struct dive *dive) #endif } +void ProfileGraphicsView::plot_pp_text() +{ + double pp, dpp, m; + int hpos; + static text_render_options_t tro = {PP_TEXT_SIZE, PP_LINES, LEFT, MIDDLE}; + + setup_pp_limits(&gc); + pp = floor(gc.pi.maxpp * 10.0) / 10.0 + 0.2; + dpp = pp > 4 ? 1.0 : 0.5; + hpos = gc.pi.entry[gc.pi.nr - 1].sec; + QColor c = profile_color[PP_LINES].first(); + + qDebug() << pp << dpp; + for (m = 0.0; m <= pp; m += dpp) { + QGraphicsLineItem *item = new QGraphicsLineItem(SCALEGC(0, m), SCALEGC(hpos, m)); + item->setPen(QPen(c)); + scene()->addItem(item); + plot_text(&tro, hpos + 30, m, QString::number(m)); + } +} + void ProfileGraphicsView::plot_pp_gas_profile() { int i; -- cgit v1.2.3-70-g09d2