diff options
-rw-r--r-- | qt-ui/profilegraphics.cpp | 23 | ||||
-rw-r--r-- | qt-ui/profilegraphics.h | 2 |
2 files changed, 23 insertions, 2 deletions
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; diff --git a/qt-ui/profilegraphics.h b/qt-ui/profilegraphics.h index 6ed41de1e..ca0aaedf9 100644 --- a/qt-ui/profilegraphics.h +++ b/qt-ui/profilegraphics.h @@ -106,7 +106,7 @@ private: void plot_pressure_value(int mbar, int sec, int xalign, int yalign); void plot_deco_text(); void plot_pp_gas_profile(); - + void plot_pp_text(); QColor get_sac_color(int sac, int avg_sac); QPen defaultPen; |