diff options
author | Tomaz Canabrava <tcanabrava@kde.org> | 2013-05-09 17:30:16 -0300 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2013-05-09 17:50:06 -0700 |
commit | b794c23099f97cefd0a65b070fc9aa9dd5523e87 (patch) | |
tree | 3caab1ed366ddc75cebf434e5f694ba2a5186ae2 /qt-ui/profilegraphics.cpp | |
parent | 25d65ab97d80b80465e346f749a71e1664244301 (diff) | |
download | subsurface-b794c23099f97cefd0a65b070fc9aa9dd5523e87.tar.gz |
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 <tcanabrava@kde.org>
Diffstat (limited to 'qt-ui/profilegraphics.cpp')
-rw-r--r-- | qt-ui/profilegraphics.cpp | 23 |
1 files changed, 22 insertions, 1 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; |