mirror of
https://github.com/subsurface/subsurface.git
synced 2024-11-30 22:20:21 +00:00
profile: remove AbstractProfilePolygonItem::hDataColumn
This indicated the data of the horizontal axis. It was (obviously) always the time axis. Remove. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
parent
e0f44237cc
commit
6fa5e59994
4 changed files with 31 additions and 34 deletions
|
@ -11,7 +11,6 @@
|
|||
class ProfileScene;
|
||||
class DiveTextItem;
|
||||
class DiveLineItem;
|
||||
class DivePlotDataModel;
|
||||
|
||||
class DiveCartesianAxis : public QGraphicsLineItem {
|
||||
private:
|
||||
|
|
|
@ -12,9 +12,9 @@
|
|||
#include "libdivecomputer/parser.h"
|
||||
#include "profile-widget/profilewidget2.h"
|
||||
|
||||
AbstractProfilePolygonItem::AbstractProfilePolygonItem(const DivePlotDataModel &model, const DiveCartesianAxis &horizontal, int hColumn,
|
||||
AbstractProfilePolygonItem::AbstractProfilePolygonItem(const DivePlotDataModel &model, const DiveCartesianAxis &horizontal,
|
||||
const DiveCartesianAxis &vertical, int vColumn, double dpr) :
|
||||
hAxis(horizontal), vAxis(vertical), dataModel(model), hDataColumn(hColumn), vDataColumn(vColumn), dpr(dpr), from(0), to(0)
|
||||
hAxis(horizontal), vAxis(vertical), dataModel(model), vDataColumn(vColumn), dpr(dpr), from(0), to(0)
|
||||
{
|
||||
setCacheMode(DeviceCoordinateCache);
|
||||
}
|
||||
|
@ -46,17 +46,17 @@ void AbstractProfilePolygonItem::clipStop(double &x, double &y, double prev_x, d
|
|||
|
||||
std::pair<double, double> AbstractProfilePolygonItem::getPoint(int i) const
|
||||
{
|
||||
double x = dataModel.index(i, hDataColumn).data().toReal();
|
||||
double x = dataModel.index(i, DivePlotDataModel::TIME).data().toReal();
|
||||
double y = dataModel.index(i, vDataColumn).data().toReal();
|
||||
|
||||
// Do clipping of first and last value
|
||||
if (i == from && i < to) {
|
||||
double next_x = dataModel.index(i+1, hDataColumn).data().toReal();
|
||||
double next_x = dataModel.index(i+1, DivePlotDataModel::TIME).data().toReal();
|
||||
double next_y = dataModel.index(i+1, vDataColumn).data().toReal();
|
||||
clipStart(x, y, next_x, next_y);
|
||||
}
|
||||
if (i == to - 1 && i > 0) {
|
||||
double prev_x = dataModel.index(i-1, hDataColumn).data().toReal();
|
||||
double prev_x = dataModel.index(i-1, DivePlotDataModel::TIME).data().toReal();
|
||||
double prev_y = dataModel.index(i-1, vDataColumn).data().toReal();
|
||||
clipStop(x, y, prev_x, prev_y);
|
||||
}
|
||||
|
@ -95,9 +95,9 @@ void AbstractProfilePolygonItem::makePolygon(int fromIn, int toIn)
|
|||
texts.clear();
|
||||
}
|
||||
|
||||
DiveProfileItem::DiveProfileItem(const DivePlotDataModel &model, const DiveCartesianAxis &hAxis, int hColumn,
|
||||
DiveProfileItem::DiveProfileItem(const DivePlotDataModel &model, const DiveCartesianAxis &hAxis,
|
||||
const DiveCartesianAxis &vAxis, int vColumn, double dpr) :
|
||||
AbstractProfilePolygonItem(model, hAxis, hColumn, vAxis, vColumn, dpr),
|
||||
AbstractProfilePolygonItem(model, hAxis, vAxis, vColumn, dpr),
|
||||
show_reported_ceiling(0), reported_ceiling_in_red(0)
|
||||
{
|
||||
}
|
||||
|
@ -258,9 +258,9 @@ void DiveProfileItem::plot_depth_sample(const struct plot_data &entry, QFlags<Qt
|
|||
texts.append(item);
|
||||
}
|
||||
|
||||
DiveHeartrateItem::DiveHeartrateItem(const DivePlotDataModel &model, const DiveCartesianAxis &hAxis, int hColumn,
|
||||
DiveHeartrateItem::DiveHeartrateItem(const DivePlotDataModel &model, const DiveCartesianAxis &hAxis,
|
||||
const DiveCartesianAxis &vAxis, int vColumn, double dpr) :
|
||||
AbstractProfilePolygonItem(model, hAxis, hColumn, vAxis, vColumn, dpr)
|
||||
AbstractProfilePolygonItem(model, hAxis, vAxis, vColumn, dpr)
|
||||
{
|
||||
QPen pen;
|
||||
pen.setBrush(QBrush(getColor(::HR_PLOT)));
|
||||
|
@ -348,9 +348,9 @@ void DiveHeartrateItem::paint(QPainter *painter, const QStyleOptionGraphicsItem*
|
|||
painter->restore();
|
||||
}
|
||||
|
||||
DiveTemperatureItem::DiveTemperatureItem(const DivePlotDataModel &model, const DiveCartesianAxis &hAxis, int hColumn,
|
||||
DiveTemperatureItem::DiveTemperatureItem(const DivePlotDataModel &model, const DiveCartesianAxis &hAxis,
|
||||
const DiveCartesianAxis &vAxis, int vColumn, double dpr) :
|
||||
AbstractProfilePolygonItem(model, hAxis, hColumn, vAxis, vColumn, dpr)
|
||||
AbstractProfilePolygonItem(model, hAxis, vAxis, vColumn, dpr)
|
||||
{
|
||||
QPen pen;
|
||||
pen.setBrush(QBrush(getColor(::TEMP_PLOT)));
|
||||
|
@ -434,9 +434,9 @@ void DiveTemperatureItem::paint(QPainter *painter, const QStyleOptionGraphicsIte
|
|||
|
||||
static const double diveMeanDepthItemLabelScale = 0.8;
|
||||
|
||||
DiveMeanDepthItem::DiveMeanDepthItem(const DivePlotDataModel &model, const DiveCartesianAxis &hAxis, int hColumn,
|
||||
DiveMeanDepthItem::DiveMeanDepthItem(const DivePlotDataModel &model, const DiveCartesianAxis &hAxis,
|
||||
const DiveCartesianAxis &vAxis, int vColumn, double dpr) :
|
||||
AbstractProfilePolygonItem(model, hAxis, hColumn, vAxis, vColumn, dpr),
|
||||
AbstractProfilePolygonItem(model, hAxis, vAxis, vColumn, dpr),
|
||||
labelWidth(DiveTextItem::getLabelSize(dpr, diveMeanDepthItemLabelScale, QStringLiteral("999.9ft")).first)
|
||||
{
|
||||
QPen pen;
|
||||
|
@ -682,9 +682,9 @@ void DiveGasPressureItem::paint(QPainter *painter, const QStyleOptionGraphicsIte
|
|||
painter->restore();
|
||||
}
|
||||
|
||||
DiveCalculatedCeiling::DiveCalculatedCeiling(const DivePlotDataModel &model, const DiveCartesianAxis &hAxis, int hColumn,
|
||||
DiveCalculatedCeiling::DiveCalculatedCeiling(const DivePlotDataModel &model, const DiveCartesianAxis &hAxis,
|
||||
const DiveCartesianAxis &vAxis, int vColumn, double dpr) :
|
||||
AbstractProfilePolygonItem(model, hAxis, hColumn, vAxis, vColumn, dpr)
|
||||
AbstractProfilePolygonItem(model, hAxis, vAxis, vColumn, dpr)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -706,15 +706,15 @@ void DiveCalculatedCeiling::paint(QPainter *painter, const QStyleOptionGraphicsI
|
|||
QGraphicsPolygonItem::paint(painter, option, widget);
|
||||
}
|
||||
|
||||
DiveCalculatedTissue::DiveCalculatedTissue(const DivePlotDataModel &model, const DiveCartesianAxis &hAxis, int hColumn,
|
||||
DiveCalculatedTissue::DiveCalculatedTissue(const DivePlotDataModel &model, const DiveCartesianAxis &hAxis,
|
||||
const DiveCartesianAxis &vAxis, int vColumn, double dpr) :
|
||||
DiveCalculatedCeiling(model, hAxis, hColumn, vAxis, vColumn, dpr)
|
||||
DiveCalculatedCeiling(model, hAxis, vAxis, vColumn, dpr)
|
||||
{
|
||||
}
|
||||
|
||||
DiveReportedCeiling::DiveReportedCeiling(const DivePlotDataModel &model, const DiveCartesianAxis &hAxis, int hColumn,
|
||||
DiveReportedCeiling::DiveReportedCeiling(const DivePlotDataModel &model, const DiveCartesianAxis &hAxis,
|
||||
const DiveCartesianAxis &vAxis, int vColumn, double dpr) :
|
||||
AbstractProfilePolygonItem(model, hAxis, hColumn, vAxis, vColumn, dpr)
|
||||
AbstractProfilePolygonItem(model, hAxis, vAxis, vColumn, dpr)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -838,9 +838,9 @@ void PartialPressureGasItem::setThresholdSettingsKey(const double *prefPointerMi
|
|||
thresholdPtrMax = prefPointerMax;
|
||||
}
|
||||
|
||||
PartialPressureGasItem::PartialPressureGasItem(const DivePlotDataModel &model, const DiveCartesianAxis &hAxis, int hColumn,
|
||||
PartialPressureGasItem::PartialPressureGasItem(const DivePlotDataModel &model, const DiveCartesianAxis &hAxis,
|
||||
const DiveCartesianAxis &vAxis, int vColumn, double dpr) :
|
||||
AbstractProfilePolygonItem(model, hAxis, hColumn, vAxis, vColumn, dpr),
|
||||
AbstractProfilePolygonItem(model, hAxis, vAxis, vColumn, dpr),
|
||||
thresholdPtrMin(NULL),
|
||||
thresholdPtrMax(NULL)
|
||||
{
|
||||
|
|
|
@ -30,7 +30,7 @@ class AbstractProfilePolygonItem : public QObject, public QGraphicsPolygonItem {
|
|||
Q_PROPERTY(qreal x WRITE setX READ x)
|
||||
Q_PROPERTY(qreal y WRITE setY READ y)
|
||||
public:
|
||||
AbstractProfilePolygonItem(const DivePlotDataModel &model, const DiveCartesianAxis &hAxis, int hColumn, const DiveCartesianAxis &vAxis, int vColumn, double dpr);
|
||||
AbstractProfilePolygonItem(const DivePlotDataModel &model, const DiveCartesianAxis &hAxis, const DiveCartesianAxis &vAxis, int vColumn, double dpr);
|
||||
virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0) = 0;
|
||||
void clear();
|
||||
|
||||
|
@ -46,7 +46,6 @@ protected:
|
|||
const DiveCartesianAxis &hAxis;
|
||||
const DiveCartesianAxis &vAxis;
|
||||
const DivePlotDataModel &dataModel;
|
||||
int hDataColumn;
|
||||
int vDataColumn;
|
||||
double dpr;
|
||||
int from, to;
|
||||
|
@ -57,7 +56,7 @@ class DiveProfileItem : public AbstractProfilePolygonItem {
|
|||
Q_OBJECT
|
||||
|
||||
public:
|
||||
DiveProfileItem(const DivePlotDataModel &model, const DiveCartesianAxis &hAxis, int hColumn, const DiveCartesianAxis &vAxis, int vColumn, double dpr);
|
||||
DiveProfileItem(const DivePlotDataModel &model, const DiveCartesianAxis &hAxis, const DiveCartesianAxis &vAxis, int vColumn, double dpr);
|
||||
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0) override;
|
||||
void replot(const dive *d, int from, int to, bool in_planner) override;
|
||||
void plot_depth_sample(const struct plot_data &entry, QFlags<Qt::AlignmentFlag> flags, const QColor &color);
|
||||
|
@ -72,7 +71,7 @@ private:
|
|||
class DiveMeanDepthItem : public AbstractProfilePolygonItem {
|
||||
Q_OBJECT
|
||||
public:
|
||||
DiveMeanDepthItem(const DivePlotDataModel &model, const DiveCartesianAxis &hAxis, int hColumn, const DiveCartesianAxis &vAxis, int vColumn, double dpr);
|
||||
DiveMeanDepthItem(const DivePlotDataModel &model, const DiveCartesianAxis &hAxis, const DiveCartesianAxis &vAxis, int vColumn, double dpr);
|
||||
void replot(const dive *d, int from, int to, bool in_planner) override;
|
||||
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0) override;
|
||||
double labelWidth;
|
||||
|
@ -86,7 +85,7 @@ private:
|
|||
class DiveTemperatureItem : public AbstractProfilePolygonItem {
|
||||
Q_OBJECT
|
||||
public:
|
||||
DiveTemperatureItem(const DivePlotDataModel &model, const DiveCartesianAxis &hAxis, int hColumn, const DiveCartesianAxis &vAxis, int vColumn, double dpr);
|
||||
DiveTemperatureItem(const DivePlotDataModel &model, const DiveCartesianAxis &hAxis, const DiveCartesianAxis &vAxis, int vColumn, double dpr);
|
||||
void replot(const dive *d, int from, int to, bool in_planner) override;
|
||||
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0) override;
|
||||
|
||||
|
@ -97,7 +96,7 @@ private:
|
|||
class DiveHeartrateItem : public AbstractProfilePolygonItem {
|
||||
Q_OBJECT
|
||||
public:
|
||||
DiveHeartrateItem(const DivePlotDataModel &model, const DiveCartesianAxis &hAxis, int hColumn, const DiveCartesianAxis &vAxis, int vColumn, double dpr);
|
||||
DiveHeartrateItem(const DivePlotDataModel &model, const DiveCartesianAxis &hAxis, const DiveCartesianAxis &vAxis, int vColumn, double dpr);
|
||||
void replot(const dive *d, int from, int to, bool in_planner) override;
|
||||
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) override;
|
||||
|
||||
|
@ -136,7 +135,7 @@ class DiveCalculatedCeiling : public AbstractProfilePolygonItem {
|
|||
Q_OBJECT
|
||||
|
||||
public:
|
||||
DiveCalculatedCeiling(const DivePlotDataModel &model, const DiveCartesianAxis &hAxis, int hColumn,
|
||||
DiveCalculatedCeiling(const DivePlotDataModel &model, const DiveCartesianAxis &hAxis,
|
||||
const DiveCartesianAxis &vAxis, int vColumn, double dpr);
|
||||
void replot(const dive *d, int from, int to, bool in_planner) override;
|
||||
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0) override;
|
||||
|
@ -146,7 +145,7 @@ class DiveReportedCeiling : public AbstractProfilePolygonItem {
|
|||
Q_OBJECT
|
||||
|
||||
public:
|
||||
DiveReportedCeiling(const DivePlotDataModel &model, const DiveCartesianAxis &hAxis, int hColumn, const DiveCartesianAxis &vAxis, int vColumn, double dpr);
|
||||
DiveReportedCeiling(const DivePlotDataModel &model, const DiveCartesianAxis &hAxis, const DiveCartesianAxis &vAxis, int vColumn, double dpr);
|
||||
void replot(const dive *d, int from, int to, bool in_planner) override;
|
||||
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0) override;
|
||||
private:
|
||||
|
@ -157,14 +156,14 @@ private:
|
|||
class DiveCalculatedTissue : public DiveCalculatedCeiling {
|
||||
Q_OBJECT
|
||||
public:
|
||||
DiveCalculatedTissue(const DivePlotDataModel &model, const DiveCartesianAxis &hAxis, int hColumn,
|
||||
DiveCalculatedTissue(const DivePlotDataModel &model, const DiveCartesianAxis &hAxis,
|
||||
const DiveCartesianAxis &vAxis, int vColumn, double dpr);
|
||||
};
|
||||
|
||||
class PartialPressureGasItem : public AbstractProfilePolygonItem {
|
||||
Q_OBJECT
|
||||
public:
|
||||
PartialPressureGasItem(const DivePlotDataModel &model, const DiveCartesianAxis &hAxis, int hColumn, const DiveCartesianAxis &vAxis, int vColumn, double dpr);
|
||||
PartialPressureGasItem(const DivePlotDataModel &model, const DiveCartesianAxis &hAxis, const DiveCartesianAxis &vAxis, int vColumn, double dpr);
|
||||
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0) override;
|
||||
void replot(const dive *d, int from, int to, bool in_planner) override;
|
||||
void setThresholdSettingsKey(const double *prefPointerMin, const double *prefPointerMax);
|
||||
|
|
|
@ -50,8 +50,7 @@ public:
|
|||
template<typename T, class... Args>
|
||||
T *ProfileScene::createItem(const DiveCartesianAxis &vAxis, int vColumn, int z, Args&&... args)
|
||||
{
|
||||
T *res = new T(*dataModel, *timeAxis, DivePlotDataModel::TIME, vAxis, vColumn,
|
||||
std::forward<Args>(args)...);
|
||||
T *res = new T(*dataModel, *timeAxis, vAxis, vColumn, std::forward<Args>(args)...);
|
||||
res->setZValue(static_cast<double>(z));
|
||||
profileItems.push_back(res);
|
||||
return res;
|
||||
|
|
Loading…
Reference in a new issue