New profile: partial addition of heartrate

This was done during an IRC hacking session with Tomaz.
It compiles, it shows something but not the right graph.
Committed here so Tomaz and I can continue to work on it.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Dirk Hohndel 2014-02-19 17:18:26 -08:00
parent 08490785b2
commit fd1a62568b
4 changed files with 29 additions and 5 deletions

View file

@ -40,6 +40,7 @@ QVariant DivePlotDataModel::data(const QModelIndex& index, int role) const
case PN2: return item.pn2;
case PHE: return item.phe;
case PO2: return item.po2;
case HEARTBEAT: return item.heartbeat;
}
}

View file

@ -14,7 +14,7 @@ Q_OBJECT
public:
enum {DEPTH, TIME, PRESSURE, TEMPERATURE, USERENTERED, COLOR, CYLINDERINDEX, SENSOR_PRESSURE, INTERPOLATED_PRESSURE,
SAC, CEILING, TISSUE_1,TISSUE_2,TISSUE_3,TISSUE_4,TISSUE_5,TISSUE_6,TISSUE_7,TISSUE_8,TISSUE_9,TISSUE_10,
TISSUE_11,TISSUE_12,TISSUE_13,TISSUE_14,TISSUE_15,TISSUE_16, PN2,PHE,PO2,COLUMNS};
TISSUE_11,TISSUE_12,TISSUE_13,TISSUE_14,TISSUE_15,TISSUE_16, PN2,PHE,PO2, HEARTBEAT, COLUMNS};
explicit DivePlotDataModel(QObject* parent = 0);
virtual int columnCount(const QModelIndex& parent = QModelIndex()) const;
virtual QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const;

View file

@ -50,6 +50,7 @@ static struct _ItemPos{
_Axis time;
_Axis cylinder;
_Axis temperature;
_Axis heartBeat;
} itemPos;
ProfileWidget2::ProfileWidget2(QWidget *parent) :
@ -73,7 +74,9 @@ ProfileWidget2::ProfileWidget2(QWidget *parent) :
reportedCeiling(new DiveReportedCeiling()),
pn2GasItem( new PartialPressureGasItem()),
pheGasItem( new PartialPressureGasItem()),
po2GasItem( new PartialPressureGasItem())
po2GasItem( new PartialPressureGasItem()),
heartBeatAxis(new DiveCartesianAxis()),
heartBeatItem(new DiveTemperatureItem()) // FIXME: making this a DiveTemperatureItem is a hack
{
memset(&plotInfo, 0, sizeof(plotInfo));
@ -111,6 +114,8 @@ void ProfileWidget2::addItemsToScene()
scene()->addItem(pn2GasItem);
scene()->addItem(pheGasItem);
scene()->addItem(po2GasItem);
scene()->addItem(heartBeatAxis);
scene()->addItem(heartBeatItem);
Q_FOREACH(DiveCalculatedTissue *tissue, allTissues){
scene()->addItem(tissue);
}
@ -137,6 +142,12 @@ void ProfileWidget2::setupItemOnScene()
gasYAxis->setFontLabelScale(0.7);
gasYAxis->setLineSize(96);
heartBeatAxis->setOrientation(DiveCartesianAxis::BottomToTop);
heartBeatAxis->setTickSize(2);
heartBeatAxis->setTickInterval(10);
heartBeatAxis->setFontLabelScale(0.7);
heartBeatAxis->setLineSize(96);
temperatureAxis->setOrientation(DiveCartesianAxis::BottomToTop);
temperatureAxis->setTickSize(2);
temperatureAxis->setTickInterval(300);
@ -163,6 +174,7 @@ void ProfileWidget2::setupItemOnScene()
}
setupItem(gasPressureItem, timeAxis, cylinderPressureAxis, dataModel, DivePlotDataModel::TEMPERATURE, DivePlotDataModel::TIME, 1);
setupItem(temperatureItem, timeAxis, temperatureAxis, dataModel, DivePlotDataModel::TEMPERATURE, DivePlotDataModel::TIME, 1);
setupItem(heartBeatItem, timeAxis, heartBeatAxis, dataModel, DivePlotDataModel::HEARTBEAT, DivePlotDataModel::TIME, 1);
setupItem(diveProfileItem, timeAxis, profileYAxis, dataModel, DivePlotDataModel::DEPTH, DivePlotDataModel::TIME, 0);
#define CREATE_PP_GAS( ITEM, VERTICAL_COLUMN, COLOR, COLOR_ALERT, THRESHOULD_SETTINGS, VISIBILITY_SETTINGS ) \
@ -185,7 +197,8 @@ void ProfileWidget2::setupItemOnScene()
timeAxis->setLinesVisible(true);
profileYAxis->setLinesVisible(true);
gasYAxis->setZValue(timeAxis->zValue()+1);
heartBeatAxis->setTextVisible(true);
heartBeatAxis->setLinesVisible(true);
}
void ProfileWidget2::setupItemSizes()
@ -248,6 +261,9 @@ void ProfileWidget2::setupItemSizes()
itemPos.temperature.shrinked.setP1(QPointF(0,5));
itemPos.temperature.shrinked.setP2(QPointF(0,15));
itemPos.heartBeat.pos.on.setX(3);
itemPos.heartBeat.pos.on.setY(60);
itemPos.dcLabel.on.setX(3);
itemPos.dcLabel.on.setY(100);
itemPos.dcLabel.off.setX(-10);
@ -326,6 +342,11 @@ void ProfileWidget2::plotDives(QList<dive*> dives)
temperatureAxis->setMinimum(pInfo.mintemp);
temperatureAxis->setMaximum(pInfo.maxtemp);
heartBeatAxis->setMinimum(20); // FIXME: find minimum
heartBeatAxis->setMaximum(200); // FIXME: find maximum
heartBeatAxis->updateTicks(); // this shows the ticks
timeAxis->setMaximum(maxtime);
int i, incr;
@ -525,7 +546,7 @@ void ProfileWidget2::setProfileState()
cylinderPressureAxis->setPos(itemPos.cylinder.pos.on);
temperatureAxis->setPos(itemPos.temperature.pos.on);
heartBeatAxis->setPos(itemPos.heartBeat.pos.on);
meanDepth->setVisible(true);
diveComputerText->setVisible(true);
@ -620,4 +641,4 @@ void ProfileWidget2::changeGas()
//TODO: find a way to make this do not need a full redraw
dataModel->clear();
plotDives(QList<dive*>() << getDiveById(diveId));
}
}

View file

@ -97,6 +97,8 @@ private:
PartialPressureGasItem *pn2GasItem;
PartialPressureGasItem *pheGasItem;
PartialPressureGasItem *po2GasItem;
DiveCartesianAxis *heartBeatAxis;
DiveTemperatureItem *heartBeatItem;
};
#endif // PROFILEWIDGET2_H