mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Remove the class 'CartesianPlane'
This class was pratically a re-do of the axis, I'll do the axis to plot the lines when it feels like it. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
87d5289920
commit
fc55b2abfe
4 changed files with 0 additions and 124 deletions
|
@ -347,91 +347,6 @@ QString TemperatureAxis::textForValue(double value)
|
|||
return QString::number(mkelvin_to_C( (int) value));
|
||||
}
|
||||
|
||||
|
||||
void DiveCartesianPlane::setLeftAxis(DiveCartesianAxis* axis)
|
||||
{
|
||||
leftAxis = axis;
|
||||
connect(leftAxis, SIGNAL(maxChanged()), this, SLOT(setup()));
|
||||
if (bottomAxis)
|
||||
setup();
|
||||
}
|
||||
|
||||
void DiveCartesianPlane::setBottomAxis(DiveCartesianAxis* axis)
|
||||
{
|
||||
bottomAxis = axis;
|
||||
connect(bottomAxis, SIGNAL(maxChanged()), this, SLOT(setup()));
|
||||
if (leftAxis)
|
||||
setup();
|
||||
}
|
||||
|
||||
QLineF DiveCartesianPlane::horizontalLine() const
|
||||
{
|
||||
return (bottomAxis) ? bottomAxis->line() : QLineF();
|
||||
}
|
||||
|
||||
void DiveCartesianPlane::setHorizontalLine(QLineF line)
|
||||
{
|
||||
if (IS_FP_SAME(horizontalSize, line.length()))
|
||||
return;
|
||||
horizontalSize = line.length();
|
||||
setup();
|
||||
}
|
||||
|
||||
void DiveCartesianPlane::setVerticalLine(QLineF line)
|
||||
{
|
||||
if (IS_FP_SAME(verticalSize, line.length()))
|
||||
return;
|
||||
verticalSize = line.length();
|
||||
setup();
|
||||
}
|
||||
|
||||
QLineF DiveCartesianPlane::verticalLine() const
|
||||
{
|
||||
return (leftAxis) ? leftAxis->line() : QLineF();
|
||||
}
|
||||
|
||||
void DiveCartesianPlane::setup()
|
||||
{
|
||||
if (!leftAxis || !bottomAxis || !scene())
|
||||
return;
|
||||
|
||||
setPen(gridPen());
|
||||
// This creates a Grid around the axis, creating the cartesian plane.
|
||||
const int top = leftAxis->posAtValue(leftAxis->minimum());
|
||||
// unused for now:
|
||||
// const int bottom = leftAxis->posAtValue(leftAxis->maximum());
|
||||
const int left = bottomAxis->posAtValue(bottomAxis->minimum());
|
||||
// unused for now:
|
||||
// const int right = bottomAxis->posAtValue(bottomAxis->maximum());
|
||||
|
||||
setRect(0, 0, horizontalSize, verticalSize);
|
||||
setPos(left, top);
|
||||
|
||||
qDeleteAll(horizontalLines);
|
||||
qDeleteAll(verticalLines);
|
||||
horizontalLines.clear();
|
||||
verticalLines.clear();
|
||||
|
||||
// DEPTH is M_OR_FEET(10,30), Minutes are 600, per line.
|
||||
for (int i = leftAxis->minimum(), max = leftAxis->maximum(); i < max; i += M_OR_FT(10,30)) {
|
||||
DiveLineItem *line = new DiveLineItem(this);
|
||||
line->setLine(0, 0, horizontalSize, 0);
|
||||
line->setPos(0,leftAxis->posAtValue(i)-top);
|
||||
line->setZValue(-1);
|
||||
line->setPen(gridPen());
|
||||
horizontalLines.push_back(line);
|
||||
}
|
||||
|
||||
for (int i = bottomAxis->minimum(), max = bottomAxis->maximum(); i < max; i += 600) { // increments by 10 minutes.
|
||||
DiveLineItem *line = new DiveLineItem(this);
|
||||
line->setLine(0, 0, 0, verticalSize);
|
||||
line->setPos(bottomAxis->posAtValue(i)-left, 0);
|
||||
line->setZValue(-1);
|
||||
line->setPen(gridPen());
|
||||
verticalLines.push_back(line);
|
||||
}
|
||||
}
|
||||
|
||||
PartialGasPressureAxis::PartialGasPressureAxis()
|
||||
{
|
||||
connect(PreferencesDialog::instance(), SIGNAL(settingsChanged()), this, SLOT(preferencesChanged()));
|
||||
|
|
|
@ -97,27 +97,4 @@ private:
|
|||
DivePlotDataModel *model;
|
||||
};
|
||||
|
||||
// This is a try. Maybe the CartesianPlane should have the X and Y
|
||||
// axis and handle things internally?
|
||||
class DiveCartesianPlane :public QObject, public QGraphicsRectItem{
|
||||
Q_OBJECT
|
||||
Q_PROPERTY(QLineF verticalLine READ verticalLine WRITE setVerticalLine)
|
||||
Q_PROPERTY(QLineF horizontalLine READ horizontalLine WRITE setHorizontalLine)
|
||||
public:
|
||||
void setLeftAxis(DiveCartesianAxis *axis);
|
||||
void setBottomAxis(DiveCartesianAxis *axis);
|
||||
void setHorizontalLine(QLineF line);
|
||||
void setVerticalLine(QLineF line);
|
||||
QLineF horizontalLine() const;
|
||||
QLineF verticalLine() const;
|
||||
public slots:
|
||||
void setup();
|
||||
private:
|
||||
DiveCartesianAxis *leftAxis;
|
||||
DiveCartesianAxis *bottomAxis;
|
||||
QList<DiveLineItem*> verticalLines;
|
||||
QList<DiveLineItem*> horizontalLines;
|
||||
qreal verticalSize;
|
||||
qreal horizontalSize;
|
||||
};
|
||||
#endif // DIVECARTESIANAXIS_H
|
||||
|
|
|
@ -63,7 +63,6 @@ ProfileWidget2::ProfileWidget2(QWidget *parent) :
|
|||
temperatureAxis(new TemperatureAxis()),
|
||||
timeAxis(new TimeAxis()),
|
||||
diveProfileItem(new DiveProfileItem()),
|
||||
cartesianPlane(new DiveCartesianPlane()),
|
||||
temperatureItem(new DiveTemperatureItem()),
|
||||
cylinderPressureAxis(new DiveCartesianAxis()),
|
||||
gasPressureItem(new DiveGasPressureItem()),
|
||||
|
@ -104,7 +103,6 @@ void ProfileWidget2::addItemsToScene()
|
|||
scene()->addItem(cylinderPressureAxis);
|
||||
scene()->addItem(temperatureItem);
|
||||
scene()->addItem(gasPressureItem);
|
||||
scene()->addItem(cartesianPlane);
|
||||
scene()->addItem(meanDepth);
|
||||
scene()->addItem(diveComputerText);
|
||||
scene()->addItem(diveCeiling);
|
||||
|
@ -148,10 +146,6 @@ void ProfileWidget2::setupItemOnScene()
|
|||
meanDepth->setZValue(1);
|
||||
meanDepth->setAxis(profileYAxis);
|
||||
|
||||
cartesianPlane->setBottomAxis(timeAxis);
|
||||
cartesianPlane->setLeftAxis(profileYAxis);
|
||||
cartesianPlane->setZValue(-1);
|
||||
|
||||
diveComputerText->setAlignment(Qt::AlignRight | Qt::AlignBottom);
|
||||
diveComputerText->setBrush(getColor(TIME_TEXT));
|
||||
|
||||
|
@ -351,7 +345,6 @@ void ProfileWidget2::plotDives(QList<dive*> dives)
|
|||
meanDepth->animateMoveTo(3, profileYAxis->posAtValue(pInfo.meandepth));
|
||||
|
||||
dataModel->emitDataChanged();
|
||||
cartesianPlane->setup();
|
||||
// The event items are a bit special since we don't know how many events are going to
|
||||
// exist on a dive, so I cant create cache items for that. that's why they are here
|
||||
// while all other items are up there on the constructor.
|
||||
|
@ -484,7 +477,6 @@ void ProfileWidget2::setEmptyState()
|
|||
diveComputerText->setVisible(false);
|
||||
diveCeiling->setVisible(false);
|
||||
reportedCeiling->setVisible(false);
|
||||
cartesianPlane->setVisible(false);
|
||||
Q_FOREACH(DiveCalculatedTissue *tissue, allTissues){
|
||||
tissue->setVisible(false);
|
||||
}
|
||||
|
@ -525,19 +517,13 @@ void ProfileWidget2::setProfileState()
|
|||
timeAxis->setLine(itemPos.time.expanded);
|
||||
|
||||
cylinderPressureAxis->setPos(itemPos.cylinder.pos.on);
|
||||
|
||||
|
||||
temperatureAxis->setPos(itemPos.temperature.pos.on);
|
||||
|
||||
cartesianPlane->setVisible(true);
|
||||
meanDepth->setVisible(true);
|
||||
|
||||
diveComputerText->setVisible(true);
|
||||
diveComputerText->setPos(itemPos.dcLabel.on);
|
||||
|
||||
cartesianPlane->setHorizontalLine( itemPos.time.expanded );
|
||||
cartesianPlane->setVerticalLine( itemPos.depth.expanded );
|
||||
|
||||
diveCeiling->setVisible(s.value("calcceiling").toBool());
|
||||
reportedCeiling->setVisible(s.value("dcceiling").toBool());
|
||||
|
||||
|
|
|
@ -31,7 +31,6 @@ class DepthAxis;
|
|||
class DiveCartesianAxis;
|
||||
class DiveProfileItem;
|
||||
class TimeAxis;
|
||||
class DiveCartesianPlane;
|
||||
class DiveTemperatureItem;
|
||||
class DiveGasPressureItem;
|
||||
class DiveCalculatedCeiling;
|
||||
|
@ -84,7 +83,6 @@ private:
|
|||
TemperatureAxis *temperatureAxis;
|
||||
TimeAxis *timeAxis;
|
||||
DiveProfileItem *diveProfileItem;
|
||||
DiveCartesianPlane *cartesianPlane;
|
||||
DiveTemperatureItem *temperatureItem;
|
||||
DiveCartesianAxis *cylinderPressureAxis;
|
||||
DiveGasPressureItem *gasPressureItem;
|
||||
|
|
Loading…
Add table
Reference in a new issue