mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Added the Temperature Graph.
Added the Temperature Graph with its related classes. A Temperature Axis is also created so the item is plotted on the right place. Currently the Temperature Axis is just like the depth axis - top is zero, wich means that the graph is inverted. Also, the Temperature axis is being displayed as this helps debugging. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
254beef5d4
commit
58aeb6ce40
6 changed files with 94 additions and 10 deletions
|
@ -143,15 +143,16 @@ qreal DiveCartesianAxis::posAtValue(qreal value)
|
|||
QPointF p = pos();
|
||||
|
||||
double size = max - min;
|
||||
double percent = value / size;
|
||||
double distanceFromOrigin = value - min;
|
||||
double percent = (value - min) / size;
|
||||
double realSize = orientation == Qt::Horizontal ?
|
||||
m.x2() - m.x1() :
|
||||
m.y2() - m.y1();
|
||||
double retValue = realSize * percent;
|
||||
retValue = (orientation == Qt::Horizontal) ?
|
||||
double adjusted = (orientation == Qt::Horizontal) ?
|
||||
retValue + m.x1() + p.x() :
|
||||
retValue + m.y1() + p.y();
|
||||
return retValue;
|
||||
return adjusted;
|
||||
}
|
||||
|
||||
qreal DiveCartesianAxis::percentAt(const QPointF& p)
|
||||
|
@ -192,6 +193,12 @@ QString TimeAxis::textForValue(double value)
|
|||
return QString::number(value / 60);
|
||||
}
|
||||
|
||||
QString TemperatureAxis::textForValue(double value)
|
||||
{
|
||||
return QString::number(mkelvin_to_C( (int) value));
|
||||
}
|
||||
|
||||
|
||||
void DiveCartesianPlane::setLeftAxis(DiveCartesianAxis* axis)
|
||||
{
|
||||
leftAxis = axis;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue