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>
This commit is contained in:
Tomaz Canabrava 2013-05-09 17:30:16 -03:00 committed by Dirk Hohndel
parent 25d65ab97d
commit b794c23099
2 changed files with 23 additions and 2 deletions

View file

@ -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;

View file

@ -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;